1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-23 19:29:37 +00:00

Changes to the TGI driver API:

* Removed CIRCLE
  * Aspect ratio is a new header variable
  * Removed the reserved bytes - it's easier to bump the API version
  * Clipping is done completely in the wrapper



git-svn-id: svn://svn.cc65.org/cc65/trunk@4396 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz 2009-10-29 20:13:56 +00:00
parent 1d9fc5f655
commit 5304a8149e
8 changed files with 43 additions and 893 deletions

View File

@ -46,8 +46,8 @@
PAGECOUNT .byte 1 ; Number of screens available
FONTSIZE_X .byte 1 ; System font size in X direction
FONTSIZE_Y .byte 1 ; System font size in Y direction
ASPECTRATIO .word 1 ; Fixed point 8.8 format
.endstruct
RESERVED .byte 4 ; Reserved for extensions
JUMPTAB .struct
INSTALL .addr ; INSTALL routine
UNINSTALL .addr ; UNINSTALL routine
@ -66,7 +66,6 @@
GETPIXEL .addr ; GETPIXEL routine
LINE .addr ; LINE routine
BAR .addr ; BAR routine
CIRCLE .addr ; CIRCLE routine
TEXTSTYLE .addr ; TEXTSTYLE routine
OUTTEXT .addr ; OUTTEXT routine
IRQ .addr ; IRQ routine
@ -76,7 +75,7 @@
;------------------------------------------------------------------------------
; The TGI API version, stored at TGI_HDR_VERSION
TGI_API_VERSION = $02
TGI_API_VERSION = $03
;------------------------------------------------------------------------------
; Text style constants
@ -102,6 +101,7 @@ TGI_TEXT_VERTICAL = 1
.global _tgi_pagecount ; Number of available screen pages
.global _tgi_fontsizex ; System font X size
.global _tgi_fontsizey ; System font Y size
.global _tgi_aspectratio ; Aspect ratio, fixed point 8.8
;------------------------------------------------------------------------------
; Driver entry points
@ -123,7 +123,6 @@ TGI_TEXT_VERTICAL = 1
.global tgi_getpixel
.global tgi_line
.global tgi_bar
.global tgi_circle
.global tgi_textstyle
.global tgi_outtext

View File

@ -6,10 +6,10 @@
/* */
/* */
/* */
/* (C) 2002-2004 Ullrich von Bassewitz */
/* Römerstraße 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
/* (C) 2002-2009, Ullrich von Bassewitz */
/* Roemerstrasse 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
/* */
/* */
/* This software is provided 'as-is', without any expressed or implied */
@ -44,7 +44,7 @@
/* TGI kernel variables */
/* TGI kernel variables */
extern void* tgi_drv; /* Pointer to driver */
extern unsigned char tgi_error; /* Last error code */
extern unsigned char tgi_gmode; /* Flag: Graphics mode active */
@ -55,6 +55,7 @@ extern unsigned tgi_xres; /* X resolution of the current mode */
extern unsigned tgi_yres; /* Y resolution of the current mode */
extern unsigned char tgi_colorcount; /* Number of available colors */
extern unsigned char tgi_pagecount; /* Number of available screens */
extern unsigned tgi_aspectratio;/* Aspect ratio as fixed point 8.8 */

View File

@ -29,7 +29,7 @@
.byte 1 ; Number of screens available
xsize: .byte 6 ; System font X size
.byte 8 ; System font Y size
.res 4, $00 ; Reserved for future extensions
.word $100 ; Aspect ratio
; Next comes the jump table. Currently all entries must be valid and may point
; to an RTS for test versions (function not implemented).
@ -51,7 +51,6 @@ xsize: .byte 6 ; System font X size
.addr GETPIXEL
.addr LINE
.addr BAR
.addr _CIRCLE
.addr TEXTSTYLE
.addr OUTTEXT
.addr 0 ; IRQ entry is unused
@ -88,7 +87,6 @@ CHAR = $F12D
POINT = $F1C8
PAPER = $F204
INK = $F210
CIRCLE = $F37F
.rodata
@ -350,22 +348,6 @@ BAR:
bne @L1
rts
; ------------------------------------------------------------------------
; CIRCLE: Draw a circle around the center X1/Y1 (= ptr1/ptr2) with the
; radius in tmp1 and the current drawing color.
;
; Must set an error code: NO
;
_CIRCLE:
lda #3
jsr mymode
lda RADIUS
sta PARAM1
lda MODE
sta PARAM2
jmp CIRCLE
; ------------------------------------------------------------------------
; TEXTSTYLE: Set the style used when calling OUTTEXT. Text scaling in X and Y
; direction is passend in X/Y, the text direction is passed in A.

View File

@ -62,7 +62,7 @@ yres: .word 200 ; Y resolution
pages: .byte 1 ; Number of screens available
.byte 8 ; System font X size
.byte 8 ; System font Y size
.res 4, $00 ; Reserved for future extensions
.word $100 ; Aspect ratio
; Next comes the jump table. Currently all entries must be valid and may point
; to an RTS for test versions (function not implemented).
@ -84,7 +84,6 @@ pages: .byte 1 ; Number of screens available
.addr GETPIXEL
.addr LINE
.addr BAR
.addr CIRCLE
.addr TEXTSTYLE
.addr OUTTEXT
.addr 0 ; IRQ entry is unused
@ -99,7 +98,6 @@ X1 = ptr1
Y1 = ptr2
X2 = ptr3
Y2 = ptr4
RADIUS = tmp1
ADDR = tmp1 ; (2) CALC
TEMP = tmp3 ; CALC icmp
@ -112,12 +110,6 @@ PB = ptr3 ; (2) LINE
UB = ptr4 ; (2) LINE
ERR = regsave ; (2) LINE
NX = regsave+2 ; (2) LINE
; Circle stuff
XX = ptr3 ; (2) CIRCLE
YY = ptr4 ; (2) CIRCLE
MaxO = sreg ; (overwritten by TEMP3+TEMP4, but restored from OG/OU anyway)
XS = regsave ; (2) CIRCLE
YS = regsave+2 ; (2) CIRCLE
; Absolute variables used in the code
@ -132,13 +124,10 @@ BITMASK: .res 1 ; $00 = clear, $FF = set pixels
OLDCOLOR: .res 1 ; colors before entering gfx mode
; Line routine stuff (combined with CIRCLE to save space)
; Line routine stuff
OGora:
COUNT: .res 2
OUkos:
NY: .res 2
Y3:
DX: .res 1
DY: .res 1
AX: .res 1
@ -504,31 +493,6 @@ GETDEFPALETTE:
; Must set an error code: NO
;
SETPIXELCLIP:
lda Y1+1
bmi @finito ; y<0
lda X1+1
bmi @finito ; x<0
lda X1
ldx X1+1
sta ADDR
stx ADDR+1
ldx #ADDR
lda xres
ldy xres+1
jsr icmp ; ( x < xres ) ...
bcs @finito
lda Y1
ldx Y1+1
sta ADDR
stx ADDR+1
ldx #ADDR
lda yres
ldy yres+1
jsr icmp ; ... && ( y < yres )
bcc SETPIXEL
@finito:rts
SETPIXEL:
jsr CALC ; Calculate coordinates
@ -683,7 +647,7 @@ LINE:
bne @L0167
rts
; setpixel(X1,Y1)
@L0167: jsr SETPIXELCLIP
@L0167: jsr SETPIXEL
; pb = err + ny
lda ERR
clc
@ -917,213 +881,6 @@ HORLINE:
@L5: jmp HORLINE
; ------------------------------------------------------------------------
; CIRCLE: Draw a circle around the center X1/Y1 (= ptr1/ptr2) with the
; radius in tmp1 and the current drawing color.
;
; Must set an error code: NO
;
CIRCLE:
lda RADIUS
bne @L1
jmp SETPIXELCLIP ; Plot as a point
@L1: sta XX
; x = r;
lda #0
sta XX+1
sta YY
sta YY+1
sta MaxO
sta MaxO+1
; y =0; mo=0;
lda X1
ldx X1+1
sta XS
stx XS+1
lda Y1
ldx Y1+1
sta YS
stx YS+1 ; XS/YS to remember the center
; while (y<x) {
@L013B: ldx #YY
lda XX
ldy XX+1
jsr icmp
bcc @L12
rts
@L12: ; plot points in 8 slices...
lda XS
clc
adc XX
sta X1
lda XS+1
adc XX+1
sta X1+1 ; x1 = xs+x
lda YS
clc
adc YY
sta Y1
pha
lda YS+1
adc YY+1
sta Y1+1 ; (stack)=ys+y, y1=(stack)
pha
jsr SETPIXELCLIP ; plot(xs+x,ys+y)
lda YS
sec
sbc YY
sta Y1
sta Y3
lda YS+1
sbc YY+1
sta Y1+1 ; y3 = y1 = ys-y
sta Y3+1
jsr SETPIXELCLIP ; plot(xs+x,ys-y)
pla
sta Y1+1
pla
sta Y1 ; y1 = ys+y
lda XS
sec
sbc XX
sta X1
lda XS+1
sbc XX+1
sta X1+1
jsr SETPIXELCLIP ; plot (xs-x,ys+y)
lda Y3
sta Y1
lda Y3+1
sta Y1+1
jsr SETPIXELCLIP ; plot (xs-x,ys-y)
lda XS
clc
adc YY
sta X1
lda XS+1
adc YY+1
sta X1+1 ; x1 = xs+y
lda YS
clc
adc XX
sta Y1
pha
lda YS+1
adc XX+1
sta Y1+1 ; (stack)=ys+x, y1=(stack)
pha
jsr SETPIXELCLIP ; plot(xs+y,ys+x)
lda YS
sec
sbc XX
sta Y1
sta Y3
lda YS+1
sbc XX+1
sta Y1+1 ; y3 = y1 = ys-x
sta Y3+1
jsr SETPIXELCLIP ; plot(xs+y,ys-x)
pla
sta Y1+1
pla
sta Y1 ; y1 = ys+x(stack)
lda XS
sec
sbc YY
sta X1
lda XS+1
sbc YY+1
sta X1+1
jsr SETPIXELCLIP ; plot (xs-y,ys+x)
lda Y3
sta Y1
lda Y3+1
sta Y1+1
jsr SETPIXELCLIP ; plot (xs-y,ys-x)
; og = mo+y+y+1
lda MaxO
ldx MaxO+1
clc
adc YY
tay
txa
adc YY+1
tax
tya
clc
adc YY
tay
txa
adc YY+1
tax
tya
clc
adc #1
bcc @L0143
inx
@L0143: sta OGora
stx OGora+1
; ou = og-x-x+1
sec
sbc XX
tay
txa
sbc XX+1
tax
tya
sec
sbc XX
tay
txa
sbc XX+1
tax
tya
clc
adc #1
bcc @L0146
inx
@L0146: sta OUkos
stx OUkos+1
; ++y
inc YY
bne @L0148
inc YY+1
@L0148: ; if (abs(ou)<abs(og))
lda OUkos
ldy OUkos+1
jsr abs
sta TEMP3
sty TEMP4
lda OGora
ldy OGora+1
jsr abs
ldx #TEMP3
jsr icmp
bpl @L0149
; { --x;
sec
lda XX
sbc #1
sta XX
bcs @L014E
dec XX+1
@L014E: ; mo = ou; }
lda OUkos
ldx OUkos+1
jmp @L014G
; else { mo = og }
@L0149: lda OGora
ldx OGora+1
@L014G: sta MaxO
stx MaxO+1
; }
jmp @L013B
; ------------------------------------------------------------------------
; TEXTSTYLE: Set the style used when calling OUTTEXT. Text scaling in X and Y
; direction is passend in X/Y, the text direction is passed in A.

View File

@ -63,7 +63,7 @@ yres: .word 480 ; Y resolution
pages: .byte 0 ; Number of screens available
.byte 8 ; System font X size
.byte 8 ; System font Y size
.res 4, $00 ; Reserved for future extensions
.word $100 ; Aspect ratio
; Next comes the jump table. Currently all entries must be valid and may point
; to an RTS for test versions (function not implemented).
@ -85,7 +85,6 @@ pages: .byte 0 ; Number of screens available
.addr GETPIXEL
.addr LINE
.addr BAR
.addr CIRCLE
.addr TEXTSTYLE
.addr OUTTEXT
.addr 0 ; IRQ entry is unused
@ -100,7 +99,6 @@ X1 = ptr1
Y1 = ptr2
X2 = ptr3
Y2 = ptr4
RADIUS = tmp1
ADDR = tmp1 ; (2) CALC
TEMP = tmp3 ; CALC icmp
@ -113,12 +111,6 @@ PB = ptr3 ; (2) LINE
UB = ptr4 ; (2) LINE
ERR = regsave ; (2) LINE
NX = regsave+2 ; (2) LINE
; Circle stuff
XX = ptr3 ; (2) CIRCLE
YY = ptr4 ; (2) CIRCLE
MaxO = sreg ; (overwritten by TEMP3+TEMP4, but restored from OG/OU anyway)
XS = regsave ; (2) CIRCLE
YS = regsave+2 ; (2) CIRCLE
; Absolute variables used in the code
@ -133,11 +125,8 @@ OLDCOLOR: .res 1 ; colors before entering gfx mode
; Line routine stuff (combined with CIRCLE to save space)
OGora:
COUNT: .res 2
OUkos:
NY: .res 2
Y3:
DX: .res 1
DY: .res 1
AX: .res 1
@ -183,7 +172,7 @@ InitVDCTab:
.byte 27, $00
.byte $ff
SCN80CLR: .byte 27,88,147,27,88,0
SCN80CLR: .byte 27,88,147,27,88,0
.code
@ -502,51 +491,26 @@ GETDEFPALETTE:
; Must set an error code: NO
;
SETPIXELCLIP:
lda Y1+1
bmi @finito ; y<0
lda X1+1
bmi @finito ; x<0
lda X1
ldx X1+1
sta ADDR
stx ADDR+1
ldx #ADDR
lda xres
ldy xres+1
jsr icmp ; ( x < xres ) ...
bcs @finito
lda Y1
ldx Y1+1
sta ADDR
stx ADDR+1
ldx #ADDR
lda yres
ldy yres+1
jsr icmp ; ... && ( y < yres )
bcc SETPIXEL
@finito:rts
SETPIXEL:
jsr CALC ; Calculate coordinates
stx TEMP
lda ADDR
ldy ADDR+1
jsr VDCSetSourceAddr
jsr VDCReadByte
ldx TEMP
stx TEMP
lda ADDR
ldy ADDR+1
jsr VDCSetSourceAddr
jsr VDCReadByte
ldx TEMP
sta TEMP
sta TEMP
eor BITMASK
and BITTAB,X
eor TEMP
pha
lda ADDR
ldy ADDR+1
jsr VDCSetSourceAddr
pla
jsr VDCWriteByte
eor TEMP
pha
lda ADDR
ldy ADDR+1
jsr VDCSetSourceAddr
pla
jsr VDCWriteByte
@L9: rts
@ -681,7 +645,7 @@ LINE:
bne @L0167
rts
; setpixel(X1,Y1)
@L0167: jsr SETPIXELCLIP
@L0167: jsr SETPIXEL
; pb = err + ny
lda ERR
clc
@ -916,213 +880,6 @@ HORLINE:
@L5: jmp HORLINE
; ------------------------------------------------------------------------
; CIRCLE: Draw a circle around the center X1/Y1 (= ptr1/ptr2) with the
; radius in tmp1 and the current drawing color.
;
; Must set an error code: NO
;
CIRCLE:
lda RADIUS
bne @L1
jmp SETPIXELCLIP ; Plot as a point
@L1: sta XX
; x = r;
lda #0
sta XX+1
sta YY
sta YY+1
sta MaxO
sta MaxO+1
; y =0; mo=0;
lda X1
ldx X1+1
sta XS
stx XS+1
lda Y1
ldx Y1+1
sta YS
stx YS+1 ; XS/YS to remember the center
; while (y<x) {
@L013B: ldx #YY
lda XX
ldy XX+1
jsr icmp
bcc @L12
rts
@L12: ; plot points in 8 slices...
lda XS
clc
adc XX
sta X1
lda XS+1
adc XX+1
sta X1+1 ; x1 = xs+x
lda YS
clc
adc YY
sta Y1
pha
lda YS+1
adc YY+1
sta Y1+1 ; (stack)=ys+y, y1=(stack)
pha
jsr SETPIXELCLIP ; plot(xs+x,ys+y)
lda YS
sec
sbc YY
sta Y1
sta Y3
lda YS+1
sbc YY+1
sta Y1+1 ; y3 = y1 = ys-y
sta Y3+1
jsr SETPIXELCLIP ; plot(xs+x,ys-y)
pla
sta Y1+1
pla
sta Y1 ; y1 = ys+y
lda XS
sec
sbc XX
sta X1
lda XS+1
sbc XX+1
sta X1+1
jsr SETPIXELCLIP ; plot (xs-x,ys+y)
lda Y3
sta Y1
lda Y3+1
sta Y1+1
jsr SETPIXELCLIP ; plot (xs-x,ys-y)
lda XS
clc
adc YY
sta X1
lda XS+1
adc YY+1
sta X1+1 ; x1 = xs+y
lda YS
clc
adc XX
sta Y1
pha
lda YS+1
adc XX+1
sta Y1+1 ; (stack)=ys+x, y1=(stack)
pha
jsr SETPIXELCLIP ; plot(xs+y,ys+x)
lda YS
sec
sbc XX
sta Y1
sta Y3
lda YS+1
sbc XX+1
sta Y1+1 ; y3 = y1 = ys-x
sta Y3+1
jsr SETPIXELCLIP ; plot(xs+y,ys-x)
pla
sta Y1+1
pla
sta Y1 ; y1 = ys+x(stack)
lda XS
sec
sbc YY
sta X1
lda XS+1
sbc YY+1
sta X1+1
jsr SETPIXELCLIP ; plot (xs-y,ys+x)
lda Y3
sta Y1
lda Y3+1
sta Y1+1
jsr SETPIXELCLIP ; plot (xs-y,ys-x)
; og = mo+y+y+1
lda MaxO
ldx MaxO+1
clc
adc YY
tay
txa
adc YY+1
tax
tya
clc
adc YY
tay
txa
adc YY+1
tax
tya
clc
adc #1
bcc @L0143
inx
@L0143: sta OGora
stx OGora+1
; ou = og-x-x+1
sec
sbc XX
tay
txa
sbc XX+1
tax
tya
sec
sbc XX
tay
txa
sbc XX+1
tax
tya
clc
adc #1
bcc @L0146
inx
@L0146: sta OUkos
stx OUkos+1
; ++y
inc YY
bne @L0148
inc YY+1
@L0148: ; if (abs(ou)<abs(og))
lda OUkos
ldy OUkos+1
jsr abs
sta TEMP3
sty TEMP4
lda OGora
ldy OGora+1
jsr abs
ldx #TEMP3
jsr icmp
bpl @L0149
; { --x;
sec
lda XX
sbc #1
sta XX
bcs @L014E
dec XX+1
@L014E: ; mo = ou; }
lda OUkos
ldx OUkos+1
jmp @L014G
; else { mo = og }
@L0149: lda OGora
ldx OGora+1
@L014G: sta MaxO
stx MaxO+1
; }
jmp @L013B
; ------------------------------------------------------------------------
; TEXTSTYLE: Set the style used when calling OUTTEXT. Text scaling in X and Y
; direction is passend in X/Y, the text direction is passed in A.

View File

@ -30,13 +30,10 @@
.byte 1 ; Number of screens available
.byte 8 ; System font X size
.byte 8 ; System font Y size
.res 4, $00 ; Reserved for future extensions
.word $100 ; Aspect ratio
; Next comes the jump table. Currently all entries must be valid and may point
; to an RTS for test versions (function not implemented). A future version may
; allow for emulation: In this case the vector will be zero. Emulation means
; that the graphics kernel will emulate the function by using lower level
; primitives - for example ploting a line by using calls to SETPIXEL.
; Next comes the jump table. With the exception of IRQ, all entries must be
; valid and may point to an RTS for test versions (function not implemented).
.addr INSTALL
.addr UNINSTALL
@ -55,7 +52,6 @@
.addr GETPIXEL
.addr LINE
.addr BAR
.addr CIRCLE
.addr TEXTSTYLE
.addr OUTTEXT
.addr 0 ; IRQ entry is unused
@ -70,7 +66,6 @@ X1 := ptr1
Y1 := ptr2
X2 := ptr3
Y2 := ptr4
RADIUS := tmp1
ROW := tmp2 ; Bitmap row...
COL := tmp3 ; ...and column, both set by PLOT
@ -98,21 +93,11 @@ OLDD018: .res 1 ; Old register value
DX: .res 2
DY: .res 2
; Circle routine stuff, overlaid by BAR variables
X1SAVE:
CURX: .res 1
CURY: .res 1
Y1SAVE:
BROW: .res 1 ; Bottom row
TROW: .res 1 ; Top row
X2SAVE:
LCOL: .res 1 ; Left column
RCOL: .res 1 ; Right column
Y2SAVE:
CHUNK1: .res 1
OLDCH1: .res 1
CHUNK2: .res 1
OLDCH2: .res 1
; BAR variables
X1SAVE: .res 2
Y1SAVE: .res 2
X2SAVE: .res 2
Y2SAVE: .res 2
; Text output stuff
TEXTMAGX: .res 1
@ -859,334 +844,6 @@ BAR: lda Y2
@L4: rts
; ------------------------------------------------------------------------
; CIRCLE: Draw a circle around the center X1/Y1 (= ptr1/ptr2) with the
; radius in tmp1 and the current drawing color.
;
; Must set an error code: NO
;
CIRCLE: lda RADIUS
sta CURY
bne @L1
jmp SETPIXEL ; Plot as a point
@L1: clc
adc Y1
sta Y1
bcc @L2
inc Y1+1
@L2: jsr CALC ; Compute XC, YC+R
lda ROW
sta BROW
lda COL
sta LCOL
sta RCOL
sty Y2 ; Y AND 07
lda BITCHUNK,X
sta CHUNK1 ; Forwards chunk
sta OLDCH1
lsr
eor #$FF
sta CHUNK2 ; Backwards chunk
sta OLDCH2
lda POINT
sta TEMP2 ; TEMP2 = forwards high pointer
sta X2 ; X2 = backwards high pointer
lda POINT+1
sta TEMP2+1
sta X2+1
; Next compute CY-R
lda Y1
sec
sbc RADIUS
bcs @C3
dec Y1+1
sec
@C3: sbc RADIUS
bcs @C4
dec Y1+1
@C4: sta Y1
jsr CALC ; Compute new coords
sty Y1
lda POINT
sta X1 ; X1 will be the backwards
lda POINT+1 ; low-pointer
sta X1+1 ; POINT will be forwards
lda ROW
sta TROW
sei ; Get underneath ROM
lda #$34
sta $01
lda RADIUS
lsr ; A=r/2
ldx #00
stx CURX ; y=0
; Main loop
@LOOP: inc CURX ; x=x+1
lsr CHUNK1 ; Right chunk
bne @CONT1
jsr UPCHUNK1 ; Update if we move past a column
@CONT1: asl CHUNK2
bne @CONT2
jsr UPCHUNK2
@CONT2: sec
sbc CURX ; a=a-x
bcs @LOOP
adc CURY ;if a<0 then a=a+y; y=y-1
tax
jsr PCHUNK1
jsr PCHUNK2
lda CHUNK1
sta OLDCH1
lda CHUNK2
sta OLDCH2
txa
dec CURY ;(y=y-1)
dec Y2 ;Decrement y-offest for upper
bpl @CONT3 ;points
jsr DECYOFF
@CONT3: ldy Y1
iny
sty Y1
cpy #8
bcc @CONT4
jsr INCYOFF
@CONT4: ldy CURX
cpy CURY ;if y<=x then punt
bcc @LOOP ;Now draw the other half
;
; Draw the other half of the circle by exactly reversing
; the above!
;
NEXTHALF:
lsr OLDCH1 ;Only plot a bit at a time
asl OLDCH2
lda RADIUS ;A=-R/2-1
lsr
eor #$FF
@LOOP:
tax
jsr PCHUNK1 ;Plot points
jsr PCHUNK2
txa
dec Y2 ;Y2=bottom
bpl @CONT1
jsr DECYOFF
@CONT1: inc Y1
ldy Y1
cpy #8
bcc @CONT2
jsr INCYOFF
@CONT2: ldx CURY
beq @DONE
clc
adc CURY ;a=a+y
dec CURY ;y=y-1
bcc @LOOP
inc CURX
sbc CURX ;if a<0 then x=x+1; a=a+x
lsr CHUNK1
bne @CONT3
tax
jsr UPCH1 ;Upchunk, but no plot
@CONT3: lsr OLDCH1 ;Only the bits...
asl CHUNK2 ;Fix chunks
bne @CONT4
tax
jsr UPCH2
@CONT4: asl OLDCH2
bcs @LOOP
@DONE:
CIRCEXIT: ;Restore interrupts
lda #$37
sta $01
cli
rts
;
; Decrement lower pointers
;
DECYOFF:
tay
lda #7
sta Y2
lda X2 ;If we pass through zero, then
sec
sbc #<320 ;subtract 320
sta X2
lda X2+1
sbc #>320
sta X2+1
lda TEMP2
sec
sbc #<320
sta TEMP2
lda TEMP2+1
sbc #>320
sta TEMP2+1
tya
dec BROW
bmi EXIT2
rts
EXIT2: pla ;Grab return address
pla
jmp CIRCEXIT ;Restore interrupts, etc.
; Increment upper pointers
INCYOFF:
tay
lda #00
sta Y1
lda X1
clc
adc #<320
sta X1
lda X1+1
adc #>320
sta X1+1
lda POINT
clc
adc #<320
sta POINT
lda POINT+1
adc #>320
sta POINT+1
@ISKIP: inc TROW
bmi @DONE
lda TROW
cmp #25
bcs EXIT2
@DONE: tya
rts
;
; UPCHUNK1 -- Update right-moving chunk pointers
; Due to passing through a column
;
UPCHUNK1:
tax
jsr PCHUNK1
UPCH1: lda #$FF ;Alternative entry point
sta CHUNK1
sta OLDCH1
lda TEMP2
clc
adc #8
sta TEMP2
bcc @CONT
inc TEMP2+1
clc
@CONT: lda POINT
adc #8
sta POINT
bcc @DONE
inc POINT+1
@DONE: txa
inc RCOL
rts
;
; UPCHUNK2 -- Update left-moving chunk pointers
;
UPCHUNK2:
tax
jsr PCHUNK2
UPCH2: lda #$FF
sta CHUNK2
sta OLDCH2
lda X2
sec
sbc #8
sta X2
bcs @CONT
dec X2+1
sec
@CONT: lda X1
sbc #8
sta X1
bcs @DONE
dec X1+1
@DONE: txa
dec LCOL
rts
;
; Plot right-moving chunk pairs for circle routine
;
PCHUNK1:
lda RCOL ;Make sure we're in range
cmp #40
bcs @SKIP2
lda CHUNK1 ;Otherwise plot
eor OLDCH1
sta TEMP
lda TROW ;Check for underflow
bmi @SKIP
ldy Y1
lda (POINT),y
eor BITMASK
and TEMP
eor (POINT),y
sta (POINT),y
@SKIP: lda BROW ;If CY+Y >= 200...
cmp #25
bcs @SKIP2
ldy Y2
lda (TEMP2),y
eor BITMASK
and TEMP
eor (TEMP2),y
sta (TEMP2),y
@SKIP2: rts
;
; Plot left-moving chunk pairs for circle routine
;
PCHUNK2:
lda LCOL ;Range check in X
cmp #40
bcs EXIT3
lda CHUNK2 ;Otherwise plot
eor OLDCH2
sta TEMP
lda TROW ;Check for underflow
bmi @SKIP
ldy Y1
lda (X1),y
eor BITMASK
and TEMP
eor (X1),y
sta (X1),y
@SKIP: lda BROW ;If CY+Y >= 200...
cmp #25
bcs EXIT3
ldy Y2
lda (X2),y
eor BITMASK
and TEMP
eor (X2),y
sta (X2),y
EXIT3: rts
; ------------------------------------------------------------------------
; TEXTSTYLE: Set the style used when calling OUTTEXT. Text scaling in X and Y
; direction is passend in X/Y, the text direction is passed in A.

View File

@ -34,6 +34,7 @@ _tgi_colorcount: .res 1 ; Number of available colors
_tgi_pagecount: .res 1 ; Number of available screen pages
_tgi_fontsizex: .res 1 ; System font X size
_tgi_fontsizey: .res 1 ; System font Y size
_tgi_aspectratio: .res 2 ; Aspect ratio in 8.8 fixed point
.data
@ -57,7 +58,6 @@ tgi_setpixel: jmp $0000
tgi_getpixel: jmp $0000
tgi_line: jmp $0000
tgi_bar: jmp $0000
tgi_circle: jmp $0000
tgi_textstyle: jmp $0000
tgi_outtext: jmp $0000
tgi_irq: .byte $60, $00, $00 ; RTS plus two dummy bytes
@ -189,4 +189,4 @@ _tgi_uninstall:
rts

View File

@ -6,14 +6,11 @@
.include "tgi-kernel.inc"
.import popax
.importzp tmp1
.import incsp4
.proc _tgi_circle
sta tmp1 ; Get the coordinates
jsr popax
jsr tgi_popxy ; Pop X/Y into ptr1/ptr2
jmp tgi_circle ; Call the driver
; For now
jmp incsp4
.endproc