2 ; Ullrich von Bassewitz, 2009-10-25
4 ; Generates clipping outcodes for Cohen Sutherland and others.
7 .include "tgi-kernel.inc"
8 .include "zeropage.inc"
10 ;----------------------------------------------------------------------------
15 ; Clipping coordinates. They must be in this order!
21 ;----------------------------------------------------------------------------
22 ; Generate a Cohen Sutherland outcode
26 ; unsigned char o = 0;
28 ; o = TGI_CLIP_BOTTOM;
29 ; } else if (Y >= yres) {
34 ; } else if (X >= xres) {
35 ; o |= TGI_CLIP_RIGHT;
40 ; The function return the outcode in A and the flags for the outcode are
52 lda tgi_clip_y1+1,y ; High byte of Y1
53 bmi L2 ; Jump if bottom clip
55 ldx tgi_clip_y1,y ; Low byte of Y1
61 lda #TGI_CLIP_TOP ; Top clipping necessary
63 L2: lda #TGI_CLIP_BOTTOM
64 L3: sta tmp1 ; Save temp outcode
69 L4: lda tgi_clip_x1+1,y ; High byte of X1
70 bmi L7 ; Jump if left clip
72 ldx tgi_clip_x1,y ; Low byte of X1
79 ; No right or left clipping necessary
86 L6: lda #TGI_CLIP_RIGHT
92 L7: lda #TGI_CLIP_LEFT