1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-26 08:32:00 +00:00

DONE, GETPALETTE and GETDEFPALETTE will no longer return errors.

Use TGI_API_VERSION.


git-svn-id: svn://svn.cc65.org/cc65/trunk@2568 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2003-10-23 09:29:12 +00:00
parent 24d58573fe
commit ca72fb45b4
3 changed files with 89 additions and 80 deletions

View File

@ -4,23 +4,24 @@
; 23.12.2002 ; 23.12.2002
; ;
; NOTES: ; NOTES:
; For any smart monkey that will try to optimize this: PLEASE do tests on real VDC, ; For any smart monkey that will try to optimize this: PLEASE do tests on
; not only VICE. ; real VDC, not only VICE.
; ;
; Only DONE routine contains C128-mode specific stuff, everything else will work in ; Only DONE routine contains C128-mode specific stuff, everything else will
; C64-mode of C128 (C64 needs full VDC init then). ; work in C64-mode of C128 (C64 needs full VDC init then).
; ;
; With special initialization and CALC we can get 320x200 double-pixel mode. ; With special initialization and CALC we can get 320x200 double-pixel mode.
; ;
; Color translation values for BROWN and GRAY3 are obviously wrong, they could ; Color translation values for BROWN and GRAY3 are obviously wrong, they
; be replaced by equiv. of ORANGE and GRAY2 but this would give only 14 of 16 colors available. ; could be replaced by equiv. of ORANGE and GRAY2 but this would give only
; 14 of 16 colors available.
; ;
; Register 25 ($19) is said to require different value for VDC v1, but I couldn't find what ; Register 25 ($19) is said to require different value for VDC v1, but I
; it should be. ; couldn't find what it should be.
.include "zeropage.inc" .include "zeropage.inc"
.include "tgi-kernel.inc" .include "tgi-kernel.inc"
.include "tgi-mode.inc" .include "tgi-mode.inc"
.include "tgi-error.inc" .include "tgi-error.inc"
@ -53,7 +54,7 @@ VDC_DATA = 31
; capabilities of the driver ; capabilities of the driver
.byte $74, $67, $69 ; "tgi" .byte $74, $67, $69 ; "tgi"
.byte $00 ; TGI version number .byte TGI_API_VERSION ; TGI API version number
xres: .word 640 ; X resolution xres: .word 640 ; X resolution
yres: .word 200 ; Y resolution yres: .word 200 ; Y resolution
.byte 2 ; Number of drawing colors .byte 2 ; Number of drawing colors
@ -63,10 +64,7 @@ pages: .byte 1 ; Number of screens available
.res 4, $00 ; Reserved for future extensions .res 4, $00 ; Reserved for future extensions
; Next comes the jump table. Currently all entries must be valid and may point ; 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 ; to an RTS for test versions (function not implemented).
; 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.
.word INSTALL .word INSTALL
.word UNINSTALL .word UNINSTALL
@ -322,7 +320,7 @@ INIT:
; The graphics kernel will never call DONE when no graphics mode is active, ; The graphics kernel will never call DONE when no graphics mode is active,
; so there is no need to protect against that. ; so there is no need to protect against that.
; ;
; Must set an error code: YES ; Must set an error code: NO
; ;
DONE: DONE:
@ -346,8 +344,7 @@ DONE:
jsr VDCWriteReg ; restore color (background) jsr VDCWriteReg ; restore color (background)
lda #$47 lda #$47
ldx #VDC_HSCROLL ldx #VDC_HSCROLL
jsr VDCWriteReg ; switch to text screen jmp VDCWriteReg ; switch to text screen
; fall through to GETERROR in order to clear ERROR status
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; GETERROR: Return the error code in A and clear it. ; GETERROR: Return the error code in A and clear it.
@ -465,13 +462,17 @@ SETPALETTE:
ora COLTRANS,y ora COLTRANS,y
ldx #VDC_COLORS ldx #VDC_COLORS
jmp VDCWriteReg jsr VDCWriteReg ; Clear error code
lda #TGI_ERR_OK
sta ERROR
rts
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; GETPALETTE: Return the current palette in A/X. Must return NULL and set an ; GETPALETTE: Return the current palette in A/X. Even drivers that cannot
; error if palettes are not supported. ; set the palette should return the default palette here, so there's no
; way for this function to fail.
; ;
; Must set an error code: YES ; Must set an error code: NO
; ;
GETPALETTE: GETPALETTE:
@ -480,10 +481,12 @@ GETPALETTE:
rts rts
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; GETDEFPALETTE: Return the default palette for the driver in A/X. Must ; GETDEFPALETTE: Return the default palette for the driver in A/X. All
; return NULL and set an error of palettes are not supported. ; drivers should return something reasonable here, even drivers that don't
; support palettes, otherwise the caller has no way to determine the colors
; of the (not changeable) palette.
; ;
; Must set an error code: YES ; Must set an error code: NO (all drivers must have a default palette)
; ;
GETDEFPALETTE: GETDEFPALETTE:

View File

@ -5,23 +5,24 @@
; 23.12.2002 ; 23.12.2002
; ;
; NOTES: ; NOTES:
; For any smart monkey that will try to optimize this: PLEASE do tests on real VDC, ; For any smart monkey that will try to optimize this: PLEASE do tests on
; not only VICE. ; real VDC, not only VICE.
; ;
; Only DONE routine contains C128-mode specific stuff, everything else will work in ; Only DONE routine contains C128-mode specific stuff, everything else will
; C64-mode of C128 (C64 needs full VDC init then). ; work in C64-mode of C128 (C64 needs full VDC init then).
; ;
; With special initialization and CALC we can get 320x200 double-pixel mode. ; With special initialization and CALC we can get 320x200 double-pixel mode.
; ;
; Color translation values for BROWN and GRAY3 are obviously wrong, they could ; Color translation values for BROWN and GRAY3 are obviously wrong, they
; be replaced by equiv. of ORANGE and GRAY2 but this would give only 14 of 16 colors available. ; could be replaced by equiv. of ORANGE and GRAY2 but this would give only
; 14 of 16 colors available.
; ;
; Register 25 ($19) is said to require different value for VDC v1, but I couldn't find what ; Register 25 ($19) is said to require different value for VDC v1, but I
; it should be. ; couldn't find what it should be.
.include "zeropage.inc" .include "zeropage.inc"
.include "tgi-kernel.inc" .include "tgi-kernel.inc"
.include "tgi-mode.inc" .include "tgi-mode.inc"
.include "tgi-error.inc" .include "tgi-error.inc"
@ -54,7 +55,7 @@ VDC_DATA = 31
; capabilities of the driver ; capabilities of the driver
.byte $74, $67, $69 ; "tgi" .byte $74, $67, $69 ; "tgi"
.byte $00 ; TGI version number .byte TGI_API_VERSION ; TGI version number
xres: .word 640 ; X resolution xres: .word 640 ; X resolution
yres: .word 480 ; Y resolution yres: .word 480 ; Y resolution
.byte 2 ; Number of drawing colors .byte 2 ; Number of drawing colors
@ -64,10 +65,7 @@ pages: .byte 0 ; Number of screens available
.res 4, $00 ; Reserved for future extensions .res 4, $00 ; Reserved for future extensions
; Next comes the jump table. Currently all entries must be valid and may point ; 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 ; to an RTS for test versions (function not implemented).
; 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.
.word INSTALL .word INSTALL
.word UNINSTALL .word UNINSTALL
@ -331,7 +329,7 @@ INIT:
; The graphics kernel will never call DONE when no graphics mode is active, ; The graphics kernel will never call DONE when no graphics mode is active,
; so there is no need to protect against that. ; so there is no need to protect against that.
; ;
; Must set an error code: YES ; Must set an error code: NO
; ;
DONE: DONE:
@ -355,8 +353,7 @@ DONE:
jsr VDCWriteReg ; restore color (background) jsr VDCWriteReg ; restore color (background)
lda #$47 lda #$47
ldx #VDC_HSCROLL ldx #VDC_HSCROLL
jsr VDCWriteReg ; switch to text screen jmp VDCWriteReg ; switch to text screen
; fall through to GETERROR in order to clear ERROR status
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; GETERROR: Return the error code in A and clear it. ; GETERROR: Return the error code in A and clear it.
@ -463,13 +460,17 @@ SETPALETTE:
ora COLTRANS,y ora COLTRANS,y
ldx #VDC_COLORS ldx #VDC_COLORS
jmp VDCWriteReg jsr VDCWriteReg
lda #TGI_ERR_OK ; Clear error code
sta ERROR
rts
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; GETPALETTE: Return the current palette in A/X. Must return NULL and set an ; GETPALETTE: Return the current palette in A/X. Even drivers that cannot
; error if palettes are not supported. ; set the palette should return the default palette here, so there's no
; way for this function to fail.
; ;
; Must set an error code: YES ; Must set an error code: NO
; ;
GETPALETTE: GETPALETTE:
@ -478,10 +479,12 @@ GETPALETTE:
rts rts
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; GETDEFPALETTE: Return the default palette for the driver in A/X. Must ; GETDEFPALETTE: Return the default palette for the driver in A/X. All
; return NULL and set an error of palettes are not supported. ; drivers should return something reasonable here, even drivers that don't
; support palettes, otherwise the caller has no way to determine the colors
; of the (not changeable) palette.
; ;
; Must set an error code: YES ; Must set an error code: NO (all drivers must have a default palette)
; ;
GETDEFPALETTE: GETDEFPALETTE:

View File

@ -23,7 +23,7 @@
; capabilities of the driver ; capabilities of the driver
.byte $74, $67, $69 ; "tgi" .byte $74, $67, $69 ; "tgi"
.byte $00 ; TGI version number .byte TGI_API_VERSION ; TGI API version number
.word 320 ; X resolution .word 320 ; X resolution
.word 200 ; Y resolution .word 200 ; Y resolution
.byte 2 ; Number of drawing colors .byte 2 ; Number of drawing colors
@ -66,20 +66,21 @@
; Variables mapped to the zero page segment variables. Some of these are ; Variables mapped to the zero page segment variables. Some of these are
; used for passing parameters to the driver. ; used for passing parameters to the driver.
X1 = ptr1 X1 := ptr1
Y1 = ptr2 Y1 := ptr2
X2 = ptr3 X2 := ptr3
Y2 = ptr4 Y2 := ptr4
RADIUS = tmp1 RADIUS := tmp1
ROW = tmp2 ; Bitmap row... ROW := tmp2 ; Bitmap row...
COL = tmp3 ; ...and column, both set by PLOT COL := tmp3 ; ...and column, both set by PLOT
TEMP = tmp4 TEMP := tmp4
TEMP2 = sreg TEMP2 := sreg
POINT = regsave POINT := regsave
INRANGE := regsave+2 ; PLOT variable, $00 = coordinates in range
CHUNK = X2 ; Used in the line routine CHUNK := X2 ; Used in the line routine
OLDCHUNK = X2+1 ; Dito OLDCHUNK := X2+1 ; Dito
; Absolute variables used in the code ; Absolute variables used in the code
@ -93,9 +94,6 @@ BITMASK: .res 1 ; $00 = clear, $FF = set pixels
; INIT/DONE ; INIT/DONE
OLDD018: .res 1 ; Old register value OLDD018: .res 1 ; Old register value
; PLOT variables
INRANGE: .res 1 ; $00 = coordinates in range
; Line routine stuff ; Line routine stuff
DX: .res 2 DX: .res 2
DY: .res 2 DY: .res 2
@ -206,7 +204,7 @@ DONE1: sta $D011
; The graphics kernel will never call DONE when no graphics mode is active, ; The graphics kernel will never call DONE when no graphics mode is active,
; so there is no need to protect against that. ; so there is no need to protect against that.
; ;
; Must set an error code: YES ; Must set an error code: NO
; ;
DONE: lda $DD02 ; Set the data direction regs DONE: lda $DD02 ; Set the data direction regs
@ -221,7 +219,8 @@ DONE: lda $DD02 ; Set the data direction regs
lda $D011 lda $D011
and #<~$20 and #<~$20
jmp DONE1 sta $D011
rts
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; GETERROR: Return the error code in A and clear it. ; GETERROR: Return the error code in A and clear it.
@ -367,15 +366,18 @@ SETPALETTE:
sta $01 sta $01
cli cli
; Done ; Done, reset the error code
lda #TGI_ERR_OK
sta ERROR
rts rts
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; GETPALETTE: Return the current palette in A/X. Must return NULL and set an ; GETPALETTE: Return the current palette in A/X. Even drivers that cannot
; error if palettes are not supported. ; set the palette should return the default palette here, so there's no
; way for this function to fail.
; ;
; Must set an error code: YES ; Must set an error code: NO
; ;
GETPALETTE: GETPALETTE:
@ -384,10 +386,12 @@ GETPALETTE:
rts rts
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------
; GETDEFPALETTE: Return the default palette for the driver in A/X. Must ; GETDEFPALETTE: Return the default palette for the driver in A/X. All
; return NULL and set an error of palettes are not supported. ; drivers should return something reasonable here, even drivers that don't
; support palettes, otherwise the caller has no way to determine the colors
; of the (not changeable) palette.
; ;
; Must set an error code: YES ; Must set an error code: NO (all drivers must have a default palette)
; ;
GETDEFPALETTE: GETDEFPALETTE:
@ -769,9 +773,7 @@ FIXY: cpy #255 ;Y=255 or Y=8
@CONT1: inc ROW @CONT1: inc ROW
bne @DONE bne @DONE
lda COL lda COL
bmi @DONE bpl @CLEAR
lda #00
sta INRANGE
@DONE: rts @DONE: rts
@DECPTR: ;Okay, subtract 320 then @DECPTR: ;Okay, subtract 320 then
@ -790,9 +792,10 @@ FIXY: cpy #255 ;Y=255 or Y=8
bne @DONE bne @DONE
lda COL lda COL
bmi @DONE bmi @DONE
lda #00 @CLEAR: lda #00
sta INRANGE sta INRANGE
rts rts
@TOAST: pla ;Remove old return address @TOAST: pla ;Remove old return address
pla pla
jmp EXIT ;Restore interrupts, etc. jmp EXIT ;Restore interrupts, etc.