ora COLTRANS,y
ldx #VDC_COLORS
- jsr VDCWriteReg ; Clear error code
- lda #TGI_ERR_OK
+ jsr VDCWriteReg
+ lda #TGI_ERR_OK ; Clear error code
sta ERROR
rts
; Original code for a horizontal line
HORLINE:
- lda X1
- pha
- lda X1+1
- pha
- jsr CALC ; get data for LEFT
- lda BITMASKL,x ; remember left address and bitmask
- pha
- lda ADDR
- pha
- lda ADDR+1
- pha
-
- lda X2
- sta X1
- lda X2+1
- sta X1+1
- jsr CALC ; get data for RIGHT
- lda BITMASKR,x
- sta TEMP3
-
- pla ; recall data for LEFT
- sta X1+1
- pla
- sta X1 ; put left address into X1
- pla
-
- cmp #%11111111 ; if left bit <> 0
- beq @L1
- sta TEMP2 ; do left byte only...
- lda X1
- ldy X1+1
- jsr VDCSetSourceAddr
- jsr VDCReadByte
- sta TEMP
- eor BITMASK
- and TEMP2
- eor TEMP
- pha
- lda X1
- ldy X1+1
- jsr VDCSetSourceAddr
- pla
- jsr VDCWriteByte
- inc X1 ; ... and proceed
- bne @L1
- inc X1+1
-
- ; do right byte (if Y2=0 ++ADDR and skip)
+ lda X1
+ pha
+ lda X1+1
+ pha
+ jsr CALC ; get data for LEFT
+ lda BITMASKL,x ; remember left address and bitmask
+ pha
+ lda ADDR
+ pha
+ lda ADDR+1
+ pha
+
+ lda X2
+ sta X1
+ lda X2+1
+ sta X1+1
+ jsr CALC ; get data for RIGHT
+ lda BITMASKR,x
+ sta TEMP3
+
+ pla ; recall data for LEFT
+ sta X1+1
+ pla
+ sta X1 ; put left address into X1
+ pla
+
+ cmp #%11111111 ; if left bit <> 0
+ beq @L1
+ sta TEMP2 ; do left byte only...
+ lda X1
+ ldy X1+1
+ jsr VDCSetSourceAddr
+ jsr VDCReadByte
+ sta TEMP
+ eor BITMASK
+ and TEMP2
+ eor TEMP
+ pha
+ lda X1
+ ldy X1+1
+ jsr VDCSetSourceAddr
+ pla
+ jsr VDCWriteByte
+ inc X1 ; ... and proceed
+ bne @L1
+ inc X1+1
+
+ ; do right byte (if Y2=0 ++ADDR and skip)
@L1: lda TEMP3
- cmp #%11111111 ; if right bit <> 7
- bne @L11
- inc ADDR ; right bit = 7 - the next one is the last
- bne @L10
+ cmp #%11111111 ; if right bit <> 7
+ bne @L11
+ inc ADDR ; right bit = 7 - the next one is the last
+ bne @L10
inc ADDR+1
@L10: bne @L2
@L5: jmp HORLINE
+
; ------------------------------------------------------------------------
; 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.
; capabilities of the driver
.byte $74, $67, $69 ; "tgi"
- .byte TGI_API_VERSION ; TGI version number
+ .byte TGI_API_VERSION ; TGI API version number
xres: .word 640 ; X resolution
yres: .word 480 ; Y resolution
.byte 2 ; Number of drawing colors
OLDCOLOR: .res 1 ; colors before entering gfx mode
-; Line routine stuff (combined with CIRCLE to save space)
+; Line routine stuff
COUNT: .res 2
NY: .res 2
INIT:
lda pages ; is there enough memory?
- bne @L11 ; Jump if there is one screen
+ bne @L1 ; Jump if there is one screen
lda #TGI_ERR_INV_MODE ; Error
bne @L9
; Initialize variables
-@L11: ldx #$FF
+@L1: ldx #$FF
stx BITMASK
; Remeber current color value
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
bne @L0167
rts
; setpixel(X1,Y1)
-@L0167: jsr SETPIXEL
+@L0167: jsr SETPIXEL
; pb = err + ny
lda ERR
clc