; Based on Stephen L. Judds GRLIB code
;
- .include "zeropage.inc"
+ .include "zeropage.inc"
- .include "tgi-kernel.inc"
+ .include "tgi-kernel.inc"
.include "tgi-error.inc"
.addr UNINSTALL
.addr INIT
.addr DONE
- .addr GETERROR
+ .addr GETERROR
.addr CONTROL
.addr CLEAR
.addr SETVIEWPAGE
.bss
-ERROR: .res 1 ; Error code
+ERROR: .res 1 ; Error code
PALETTE: .res 2 ; The current palette
BITMASK: .res 1 ; $00 = clear, $FF = set pixels
CHARROM := $D000 ; Character rom base address
CBASE := $D000 ; Color memory base address
-VBASE := $E000 ; Video memory base address
+VBASE := $E000 ; Video memory base address
.code
lda $D018
sta OLDD018
- lda #$48 ; Set color map to $D000, screen to $E000
+ lda #$48 ; Set color map to $D000, screen to $E000
sta $D018
- lda $D011 ; And turn on bitmap
+ lda $D011 ; And turn on bitmap
ora #$20
DONE1: sta $D011
; GETERROR: Return the error code in A and clear it.
GETERROR:
- ldx #TGI_ERR_OK
- lda ERROR
- stx ERROR
+ ldx #TGI_ERR_OK
+ lda ERROR
+ stx ERROR
rts
; ------------------------------------------------------------------------
;
CONTROL:
- lda #TGI_ERR_INV_FUNC
- sta ERROR
+ lda #TGI_ERR_INV_FUNC
+ sta ERROR
rts
; ------------------------------------------------------------------------
; Initialize the color map with the new color settings (it is below the
; I/O area)
- ldy #$00
- sei
- lda $01 ; Get ROM config
- pha ; Save it
- and #%11111100 ; Clear bit 0 and 1
- sta $01
- txa ; Load color code
-@L2: sta CBASE+$0000,y
- sta CBASE+$0100,y
- sta CBASE+$0200,y
- sta CBASE+$0300,y
- iny
- bne @L2
- pla
- sta $01
- cli
+ ldy #$00
+ sei
+ lda $01 ; Get ROM config
+ pha ; Save it
+ and #%11111100 ; Clear bit 0 and 1
+ sta $01
+ txa ; Load color code
+@L2: sta CBASE+$0000,y
+ sta CBASE+$0100,y
+ sta CBASE+$0200,y
+ sta CBASE+$0300,y
+ iny
+ bne @L2
+ pla
+ sta $01
+ cli
; Done, reset the error code
bmi @C1 ;Skip if column is negative
cmp #39 ;End if move past end of screen
bcs EXIT
-@C1: lda POINT
+@C1: lda POINT
adc #8
sta POINT
bcc @CONT
bmi @C1 ;If negative, then don't update
cmp #24
bcs @TOAST ;If at bottom of screen then quit
-@C1: lda POINT
+@C1: lda POINT
adc #<320
sta POINT
lda POINT+1
; the original C wrapper and could be written much smaller (besides that,
; calling LINE is not a good idea either).
-BAR: lda Y2
+BAR: lda Y2
sta Y2SAVE
lda Y2+1
sta Y2SAVE+1
lda X1+1
sta X1SAVE+1
-@L1: lda Y1
+@L1: lda Y1
sta Y2
lda Y1+1
sta Y2+1
- jsr LINE
+ jsr LINE
lda Y1SAVE
cmp Y2SAVE