From 16129b2724d98e8ba750bd1984911ff01e013d8c Mon Sep 17 00:00:00 2001
From: "ol.sc"
Date: Sat, 23 Jan 2010 08:55:37 +0000
Subject: [PATCH] Quite some minor changes to have the two C128 TGI driver
source files only differ where they are semantically different.
git-svn-id: svn://svn.cc65.org/cc65/trunk@4552 b7a2c559-68d2-44c3-8de9-860c34a00d81
---
libsrc/c128/c128-640-200-2.s | 109 ++++++++++++++++++-----------------
libsrc/c128/c128-640-480-2.s | 38 ++++++------
2 files changed, 74 insertions(+), 73 deletions(-)
diff --git a/libsrc/c128/c128-640-200-2.s b/libsrc/c128/c128-640-200-2.s
index 1a51eb903..0dc7a7c78 100644
--- a/libsrc/c128/c128-640-200-2.s
+++ b/libsrc/c128/c128-640-200-2.s
@@ -453,8 +453,8 @@ SETPALETTE:
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
@@ -766,59 +766,59 @@ BAR:
; 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
@@ -881,6 +881,7 @@ HORLINE:
@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.
diff --git a/libsrc/c128/c128-640-480-2.s b/libsrc/c128/c128-640-480-2.s
index af3591bf3..d72f8cd3e 100644
--- a/libsrc/c128/c128-640-480-2.s
+++ b/libsrc/c128/c128-640-480-2.s
@@ -56,7 +56,7 @@ VDC_DATA = 31
; 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
@@ -123,7 +123,7 @@ 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
COUNT: .res 2
NY: .res 2
@@ -283,13 +283,13 @@ UNINSTALL:
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
@@ -494,23 +494,23 @@ GETDEFPALETTE:
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
@@ -645,7 +645,7 @@ LINE:
bne @L0167
rts
; setpixel(X1,Y1)
-@L0167: jsr SETPIXEL
+@L0167: jsr SETPIXEL
; pb = err + ny
lda ERR
clc
--
2.39.5