mirror of
https://github.com/cc65/cc65.git
synced 2024-12-26 08:32:00 +00:00
Hold the maximum X and Y coordinate in variables instead of calculating them
when needed. The variables make signed compares in the line clipper easier. git-svn-id: svn://svn.cc65.org/cc65/trunk@4450 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
eee4430061
commit
e319fc217b
@ -17,6 +17,8 @@
|
||||
.bss
|
||||
|
||||
_tgi_drv: .res 2 ; Pointer to driver
|
||||
; From here on, variables get cleared when a new driver is loaded
|
||||
cstart:
|
||||
_tgi_error: .res 1 ; Last error code
|
||||
_tgi_gmode: .res 1 ; Flag: Graphics mode active
|
||||
_tgi_curx: .res 2 ; Current drawing cursor X
|
||||
@ -35,6 +37,13 @@ _tgi_textscaleh: .res 3 ; Text scale for the height
|
||||
_tgi_charwidth: .res 1 ; Char width of system font
|
||||
_tgi_charheight: .res 1 ; Char height of system font
|
||||
|
||||
; End of section that gets cleared when a new driver is loaded
|
||||
csize = * - cstart
|
||||
|
||||
; Maximum X and Y coordinate (that is, xres-1 and yres-1)
|
||||
_tgi_xmax: .res 2
|
||||
_tgi_ymax: .res 2
|
||||
|
||||
; The following variables are copied from the driver header for faster access
|
||||
; fontwidth and fontheight are expected to be in order and adjacent.
|
||||
tgi_driver_vars:
|
||||
@ -51,6 +60,7 @@ _tgi_aspectratio: .res 2 ; Aspect ratio in 8.8 fixed point
|
||||
|
||||
; Jump table for the driver functions.
|
||||
|
||||
jumpvectors:
|
||||
tgi_install: jmp $0000
|
||||
tgi_uninstall: jmp $0000
|
||||
tgi_init: jmp $0000
|
||||
@ -134,17 +144,17 @@ _tgi_install:
|
||||
; Initialize some other variables
|
||||
|
||||
lda #$00
|
||||
@L4: ldx #8-1
|
||||
@L5: sta _tgi_error,x ; Clear error/mode/curx/cury/textdir
|
||||
@L4: ldx #csize-1
|
||||
@L5: sta cstart,x ; Clear error/mode/curx/cury/...
|
||||
dex
|
||||
bpl @L5
|
||||
|
||||
rts
|
||||
|
||||
; Copy one byte from the jump vectors
|
||||
; Copy one byte to the jump vectors
|
||||
|
||||
copy: lda (ptr1),y
|
||||
sta tgi_install,x
|
||||
sta jumpvectors,x
|
||||
iny
|
||||
inx
|
||||
rts
|
||||
|
@ -8,13 +8,12 @@
|
||||
|
||||
.include "tgi-kernel.inc"
|
||||
|
||||
.import decax1
|
||||
|
||||
|
||||
.proc _tgi_getmaxx
|
||||
|
||||
jsr _tgi_getxres
|
||||
jmp decax1
|
||||
lda _tgi_xmax
|
||||
ldx _tgi_xmax+1
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
|
@ -7,12 +7,12 @@
|
||||
; */
|
||||
|
||||
.include "tgi-kernel.inc"
|
||||
.import decax1
|
||||
|
||||
.proc _tgi_getmaxy
|
||||
|
||||
jsr _tgi_getyres
|
||||
jmp decax1
|
||||
lda _tgi_ymax
|
||||
ldx _tgi_ymax+1
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
|
@ -8,9 +8,13 @@
|
||||
.include "tgi-kernel.inc"
|
||||
.include "tgi-error.inc"
|
||||
|
||||
.import pushax, pusha
|
||||
.import pushax, pusha, decax1
|
||||
.importzp ptr1
|
||||
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
|
||||
.code
|
||||
.proc _tgi_init
|
||||
|
||||
jsr _tgi_done ; Switch off graphics if needed
|
||||
@ -22,6 +26,18 @@
|
||||
|
||||
inc _tgi_gmode ; Remember that graph mode is active
|
||||
|
||||
; Get the maximum X and Y coordinate
|
||||
|
||||
jsr _tgi_getxres
|
||||
jsr decax1
|
||||
sta _tgi_xmax
|
||||
stx _tgi_xmax+1
|
||||
|
||||
jsr _tgi_getyres
|
||||
jsr decax1
|
||||
sta _tgi_ymax
|
||||
stx _tgi_ymax+1
|
||||
|
||||
; Do driver initialization. Set draw and view pages.
|
||||
|
||||
lda #0
|
||||
|
Loading…
Reference in New Issue
Block a user