1
0
mirror of https://github.com/cc65/cc65.git synced 2025-08-08 06:25:17 +00:00

For the CBM platforms, make revers() machine dependent and use the RVS flag

of the different machines instead of a separate one.
For the C128, make the textcolor() function work in 40 and 80 column mode.


git-svn-id: svn://svn.cc65.org/cc65/trunk@1787 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz
2002-12-19 20:29:27 +00:00
parent 0b496a9daa
commit 36fe6284a8
33 changed files with 243 additions and 38 deletions

View File

@@ -37,6 +37,7 @@ OBJS = _scrsize.o \
mouse.o \ mouse.o \
randomize.o \ randomize.o \
readjoy.o \ readjoy.o \
revers.o \
rs232.o \ rs232.o \
tgi_mode_table.o tgi_mode_table.o

View File

@@ -16,6 +16,7 @@ FNAM_LO = $BB ; Address of filename
FNAM_HI = $BC FNAM_HI = $BC
FNAM_BANK = $C7 ; Bank for filename FNAM_BANK = $C7 ; Bank for filename
KEY_COUNT = $D0 ; Number of keys in input buffer KEY_COUNT = $D0 ; Number of keys in input buffer
FKEY_COUNT = $D1 ; Characters for function key
MODE = $D7 ; 40/80 column mode flag MODE = $D7 ; 40/80 column mode flag
CURS_X = $EC ; Cursor column CURS_X = $EC ; Cursor column
CURS_Y = $EB ; Cursor row CURS_Y = $EB ; Cursor row
@@ -23,7 +24,7 @@ SCREEN_PTR = $E0 ; Pointer to current char in text screen
CRAM_PTR = $E2 ; Pointer to current char in color RAM CRAM_PTR = $E2 ; Pointer to current char in color RAM
CHARCOLOR = $F1 CHARCOLOR = $F1
FKEY_COUNT = $D1 ; Characters for function key RVS = $F3 ; Reverse output flag
FETCH = $2A2 ; Fetch subroutine in RAM FETCH = $2A2 ; Fetch subroutine in RAM
FETVEC = $2AA ; Vector patch location for FETCH FETVEC = $2AA ; Vector patch location for FETCH
STASH = $2AF ; Stash routine in RAM STASH = $2AF ; Stash routine in RAM
@@ -41,6 +42,7 @@ CURS_ON = $CD6F
CURS_OFF = $CD9F CURS_OFF = $CD9F
CLRSCR = $C142 CLRSCR = $C142
KBDREAD = $C006 KBDREAD = $C006
PRINT = $C00C
; Extended jump table ; Extended jump table
SETBNK = $FF68 SETBNK = $FF68

View File

@@ -12,7 +12,11 @@
_textcolor: _textcolor:
ldx CHARCOLOR ; get old value bit MODE ; Check 80/40 column mode
bpl @L1 ; Jump if 40 columns
tax
lda $CE5C,x ; Translate VIC color -> VDC color
@L1: ldx CHARCOLOR ; get old value
sta CHARCOLOR ; set new value sta CHARCOLOR ; set new value
txa txa
rts rts

View File

@@ -8,7 +8,7 @@
.export _cputcxy, _cputc, cputdirect, putchar .export _cputcxy, _cputc, cputdirect, putchar
.export newline, plot .export newline, plot
.import popa, _gotoxy .import popa, _gotoxy
.import xsize, revers .import xsize
.import PLOT .import PLOT
.include "c128.inc" .include "c128.inc"
@@ -98,7 +98,7 @@ plot: ldy CURS_X
; position in Y ; position in Y
putchar: putchar:
ora revers ; Set revers bit ora RVS ; Set revers bit
ldy CURS_X ldy CURS_X
sta (SCREEN_PTR),y ; Set char sta (SCREEN_PTR),y ; Set char
lda CHARCOLOR lda CHARCOLOR

27
libsrc/c128/revers.s Normal file
View File

@@ -0,0 +1,27 @@
;
; Ullrich von Bassewitz, 07.08.1998
;
; unsigned char revers (unsigned char onoff);
;
.export _revers
.include "c128.inc"
.proc _revers
ldx #$00 ; Assume revers off
tay ; Test onoff
beq L1 ; Jump if off
ldx #$80 ; Load on value
ldy #$00 ; Assume old value is zero
L1: lda RVS ; Load old value
stx RVS ; Set new value
beq L2 ; Jump if old value zero
iny ; Make old value = 1
L2: ldx #$00 ; Load high byte of result
tya ; Load low byte, set CC
rts
.endproc

View File

@@ -23,7 +23,8 @@ OBJS = _scrsize.o \
kbhit.o \ kbhit.o \
kernal.o \ kernal.o \
randomize.o \ randomize.o \
readjoy.o readjoy.o \
revers.o
all: $(OBJS) all: $(OBJS)

View File

@@ -8,7 +8,7 @@
.export _cputcxy, _cputc, cputdirect, putchar .export _cputcxy, _cputc, cputdirect, putchar
.export newline, plot .export newline, plot
.import popa, _gotoxy .import popa, _gotoxy
.import xsize, revers .import xsize
.import PLOT .import PLOT
.include "../plus4/plus4.inc" .include "../plus4/plus4.inc"
@@ -98,7 +98,7 @@ plot: ldy CURS_X
; position in Y ; position in Y
putchar: putchar:
ora revers ; Set revers bit ora RVS ; Set revers bit
ldy CURS_X ldy CURS_X
sta (SCREEN_PTR),y ; Set char sta (SCREEN_PTR),y ; Set char
lda CHARCOLOR lda CHARCOLOR

27
libsrc/c16/revers.s Normal file
View File

@@ -0,0 +1,27 @@
;
; Ullrich von Bassewitz, 07.08.1998
;
; unsigned char revers (unsigned char onoff);
;
.export _revers
.include "../plus4/plus4.inc"
.proc _revers
ldx #$00 ; Assume revers off
tay ; Test onoff
beq L1 ; Jump if off
ldx #$80 ; Load on value
ldy #$00 ; Assume old value is zero
L1: lda RVS ; Load old value
stx RVS ; Set new value
beq L2 ; Jump if old value zero
iny ; Make old value = 1
L2: ldx #$00 ; Load high byte of result
tya ; Load low byte, set CC
rts
.endproc

View File

@@ -38,6 +38,7 @@ OBJS = _scrsize.o \
mouse.o \ mouse.o \
randomize.o \ randomize.o \
readjoy.o \ readjoy.o \
revers.o \
rs232.o \ rs232.o \
tgi_mode_table.o tgi_mode_table.o

View File

@@ -13,10 +13,10 @@ FNAM_LEN = $B7 ; Length of filename
SECADR = $B9 ; Secondary address SECADR = $B9 ; Secondary address
DEVNUM = $BA ; Device number DEVNUM = $BA ; Device number
KEY_COUNT = $C6 ; Number of keys in input buffer KEY_COUNT = $C6 ; Number of keys in input buffer
RVS = $C7 ; Reverse flag
CURS_FLAG = $CC ; 1 = cursor off CURS_FLAG = $CC ; 1 = cursor off
CURS_BLINK = $CD ; Blink counter CURS_BLINK = $CD ; Blink counter
CURS_CHAR = $CE ; Character under the cursor CURS_CHAR = $CE ; Character under the cursor
CURS_COLOR = $287 ; Color under the cursor
CURS_STATE = $CF ; Cursor blink state CURS_STATE = $CF ; Cursor blink state
SCREEN_PTR = $D1 ; Pointer to current char in text screen SCREEN_PTR = $D1 ; Pointer to current char in text screen
CURS_X = $D3 ; Cursor column CURS_X = $D3 ; Cursor column
@@ -24,6 +24,7 @@ CURS_Y = $D6 ; Cursor row
CRAM_PTR = $F3 ; Pointer to current char in color RAM CRAM_PTR = $F3 ; Pointer to current char in color RAM
CHARCOLOR = $286 CHARCOLOR = $286
CURS_COLOR = $287 ; Color under the cursor
PALFLAG = $2A6 ; $01 = PAL, $00 = NTSC PALFLAG = $2A6 ; $01 = PAL, $00 = NTSC

View File

@@ -8,7 +8,7 @@
.export _cputcxy, _cputc, cputdirect, putchar .export _cputcxy, _cputc, cputdirect, putchar
.export newline, plot .export newline, plot
.import popa, _gotoxy .import popa, _gotoxy
.import xsize, revers .import xsize
.import PLOT .import PLOT
.include "c64.inc" .include "c64.inc"
@@ -98,7 +98,7 @@ plot: ldy CURS_X
; position in Y ; position in Y
putchar: putchar:
ora revers ; Set revers bit ora RVS ; Set revers bit
ldy CURS_X ldy CURS_X
sta (SCREEN_PTR),y ; Set char sta (SCREEN_PTR),y ; Set char
lda CHARCOLOR lda CHARCOLOR

View File

@@ -5,22 +5,23 @@
; ;
.export _revers .export _revers
.export revers
_revers: .include "c64.inc"
.proc _revers
ldx #$00 ; Assume revers off ldx #$00 ; Assume revers off
tay ; Test onoff tay ; Test onoff
beq L1 ; Jump if off beq L1 ; Jump if off
ldx #$80 ; Load on value ldx #$80 ; Load on value
L1: ldy #$00 ; Assume old value is zero ldy #$00 ; Assume old value is zero
lda revers ; Load old value L1: lda RVS ; Load old value
stx revers ; Set new value stx RVS ; Set new value
beq L2 ; Jump if old value zero beq L2 ; Jump if old value zero
iny ; Make old value = 1 iny ; Make old value = 1
L2: ldx #$00 ; Load high byte of result L2: ldx #$00 ; Load high byte of result
tya ; Load low byte, set CC tya ; Load low byte, set CC
rts rts
.bss .endproc
revers: .res 1

View File

@@ -56,7 +56,6 @@ S_OBJS = c_acptr.o \
oserrlist.o \ oserrlist.o \
oserror.o \ oserror.o \
read.o \ read.o \
revers.o \
rwcommon.o \ rwcommon.o \
scratch.o \ scratch.o \
sysremove.o \ sysremove.o \

View File

@@ -49,6 +49,7 @@ OBJS = _scrsize.o \
pokesys.o \ pokesys.o \
randomize.o \ randomize.o \
readjoy.o \ readjoy.o \
revers.o \
rs232.o \ rs232.o \
tgi_mode_table.o tgi_mode_table.o

View File

@@ -174,8 +174,7 @@ rs232head = $037C
rs232tail = $037D rs232tail = $037D
PgmKeyEnd = $0380 PgmKeyEnd = $0380
PgmKeySeg = $0382 PgmKeySeg = $0382
PgmKeySize = $0383 RVS = $0383
rvsFlag = $0397
linetmp = $0398 linetmp = $0398
LastPrtChar = $0399 LastPrtChar = $0399
InsertFlag = $039A InsertFlag = $039A
@@ -188,7 +187,6 @@ SegSave = $03A0
TabStopTable = $03A1 ; 80 bits for tabstops TabStopTable = $03A1 ; 80 bits for tabstops
KeyBuf = $03AB ; Keyboard buffer KeyBuf = $03AB ; Keyboard buffer
funvec = $03B5 ; Vector for function key handline funvec = $03B5 ; Vector for function key handline
FunKeyTmp = $03B7
sedt3 = $03B9 sedt3 = $03B9
MoniSegSave = $03f0 MoniSegSave = $03f0
wstvec = $03F8 wstvec = $03F8

View File

@@ -10,7 +10,7 @@
.import PLOT .import PLOT
.import popa, _gotoxy .import popa, _gotoxy
.import xsize, revers .import xsize
.include "cbm510.inc" .include "cbm510.inc"
@@ -97,7 +97,7 @@ plot: ldy CURS_X
; position in Y ; position in Y
putchar: putchar:
ora revers ; Set revers bit ora RVS ; Set revers bit
ldy CURS_X ldy CURS_X
sta (SCREEN_PTR),y ; Set char sta (SCREEN_PTR),y ; Set char
ldx IndReg ldx IndReg

27
libsrc/cbm510/revers.s Normal file
View File

@@ -0,0 +1,27 @@
;
; Ullrich von Bassewitz, 07.08.1998
;
; unsigned char revers (unsigned char onoff);
;
.export _revers
.include "cbm510.inc"
.proc _revers
ldx #$00 ; Assume revers off
tay ; Test onoff
beq L1 ; Jump if off
ldx #$80 ; Load on value
ldy #$00 ; Assume old value is zero
L1: lda RVS ; Load old value
stx RVS ; Set new value
beq L2 ; Jump if old value zero
iny ; Make old value = 1
L2: ldx #$00 ; Load high byte of result
tya ; Load low byte, set CC
rts
.endproc

View File

@@ -40,6 +40,7 @@ OBJS = _scrsize.o \
peeksys.o \ peeksys.o \
pokesys.o \ pokesys.o \
randomize.o \ randomize.o \
revers.o \
rs232.o rs232.o
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------

View File

@@ -167,7 +167,7 @@ rs232tail = $037D
PgmKeyEnd = $0380 PgmKeyEnd = $0380
PgmKeySeg = $0382 PgmKeySeg = $0382
PgmKeySize = $0383 PgmKeySize = $0383
rvsFlag = $0397 RVS = $0397
linetmp = $0398 linetmp = $0398
LastPrtChar = $0399 LastPrtChar = $0399
InsertFlag = $039A InsertFlag = $039A

View File

@@ -12,7 +12,7 @@
.import PLOT .import PLOT
.import _gotoxy .import _gotoxy
.import popa .import popa
.import xsize, revers .import xsize
.include "cbm610.inc" .include "cbm610.inc"
@@ -94,7 +94,7 @@ putchar:
ldx IndReg ldx IndReg
ldy #$0F ldy #$0F
sty IndReg sty IndReg
ora revers ; Set revers bit ora RVS ; Set revers bit
ldy CURS_X ldy CURS_X
sta (CharPtr),y ; Set char sta (CharPtr),y ; Set char
stx IndReg stx IndReg

27
libsrc/cbm610/revers.s Normal file
View File

@@ -0,0 +1,27 @@
;
; Ullrich von Bassewitz, 07.08.1998
;
; unsigned char revers (unsigned char onoff);
;
.export _revers
.include "cbm610.inc"
.proc _revers
ldx #$00 ; Assume revers off
tay ; Test onoff
beq L1 ; Jump if off
ldx #$80 ; Load on value
ldy #$00 ; Assume old value is zero
L1: lda RVS ; Load old value
stx RVS ; Set new value
beq L2 ; Jump if old value zero
iny ; Make old value = 1
L2: ldx #$00 ; Load high byte of result
tya ; Load low byte, set CC
rts
.endproc

View File

@@ -32,7 +32,8 @@ OBJS = _scrsize.o \
kreadst.o \ kreadst.o \
ksetlfs.o \ ksetlfs.o \
ksetnam.o \ ksetnam.o \
randomize.o randomize.o \
revers.o
all: $(OBJS) all: $(OBJS)

View File

@@ -8,10 +8,10 @@
.export _cputcxy, _cputc, cputdirect, putchar .export _cputcxy, _cputc, cputdirect, putchar
.export newline, plot .export newline, plot
.import popa, _gotoxy .import popa, _gotoxy
.import xsize, revers .import xsize
.include "pet.inc" .include "pet.inc"
.include "../cbm/cbm.inc" ; .include "../cbm/cbm.inc"
_cputcxy: _cputcxy:
pha ; Save C pha ; Save C
@@ -98,7 +98,7 @@ plot: ldy CURS_Y
; position in Y ; position in Y
putchar: putchar:
ora revers ; Set revers bit ora RVS ; Set revers bit
ldy CURS_X ldy CURS_X
sta (SCREEN_PTR),y ; Set char sta (SCREEN_PTR),y ; Set char
rts rts

View File

@@ -10,6 +10,7 @@ MEMSIZE = $34 ; Size of memory installed
TIME = $8D ; 60HZ clock TIME = $8D ; 60HZ clock
ST = $96 ; IEC status byte ST = $96 ; IEC status byte
KEY_COUNT = $9E ; Number of keys in input buffer KEY_COUNT = $9E ; Number of keys in input buffer
RVS = $9F ; Reverse flag
CURS_FLAG = $A7 ; 1 = cursor off CURS_FLAG = $A7 ; 1 = cursor off
CURS_BLINK = $A8 ; Blink counter CURS_BLINK = $A8 ; Blink counter
CURS_CHAR = $A9 ; Character under the cursor CURS_CHAR = $A9 ; Character under the cursor
@@ -29,7 +30,7 @@ KEY_BUF = $26F ; Keyboard buffer
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; PET ROM type detection ; PET ROM type detection
PET_DETECT = $FFFB PET_DETECT = $FFFB
PET_2000 = $CA PET_2000 = $CA
PET_3000 = $FC PET_3000 = $FC
PET_4000 = $FD PET_4000 = $FD

27
libsrc/pet/revers.s Normal file
View File

@@ -0,0 +1,27 @@
;
; Ullrich von Bassewitz, 07.08.1998
;
; unsigned char revers (unsigned char onoff);
;
.export _revers
.include "pet.inc"
.proc _revers
ldx #$00 ; Assume revers off
tay ; Test onoff
beq L1 ; Jump if off
ldx #$80 ; Load on value
ldy #$00 ; Assume old value is zero
L1: lda RVS ; Load old value
stx RVS ; Set new value
beq L2 ; Jump if old value zero
iny ; Make old value = 1
L2: ldx #$00 ; Load high byte of result
tya ; Load low byte, set CC
rts
.endproc

View File

@@ -46,6 +46,7 @@ OBJS = _scrsize.o \
kuntlk.o \ kuntlk.o \
randomize.o \ randomize.o \
readjoy.o \ readjoy.o \
revers.o \
tgi_mode_table.o tgi_mode_table.o
all: $(OBJS) all: $(OBJS)

View File

@@ -8,7 +8,7 @@
.export _cputcxy, _cputc, cputdirect, putchar .export _cputcxy, _cputc, cputdirect, putchar
.export newline, plot .export newline, plot
.import popa, _gotoxy .import popa, _gotoxy
.import xsize, revers .import xsize
.import PLOT .import PLOT
.include "plus4.inc" .include "plus4.inc"
@@ -89,7 +89,7 @@ L11: ora #$40
plot: ldy CURS_X plot: ldy CURS_X
ldx CURS_Y ldx CURS_Y
clc clc
jmp PLOT ; Set the new cursor jmp PLOT ; Set the new cursor
@@ -98,7 +98,7 @@ plot: ldy CURS_X
; position in Y ; position in Y
putchar: putchar:
ora revers ; Set revers bit ora RVS ; Set revers bit
ldy CURS_X ldy CURS_X
sta (SCREEN_PTR),y ; Set char sta (SCREEN_PTR),y ; Set char
lda CHARCOLOR lda CHARCOLOR

View File

@@ -15,6 +15,7 @@ SECADR = $AD ; Secondary address
DEVNUM = $AE ; Device number DEVNUM = $AE ; Device number
FNAM_ADR = $AF ; Pointer to filename for OPEN FNAM_ADR = $AF ; Pointer to filename for OPEN
KEY_COUNT = $EF ; Number of keys in input buffer KEY_COUNT = $EF ; Number of keys in input buffer
RVS = $C2 ; Reverse flag
CURS_X = $CA ; Cursor column CURS_X = $CA ; Cursor column
CURS_Y = $CD ; Cursor row CURS_Y = $CD ; Cursor row
SCREEN_PTR = $C8 ; Pointer to current char in text screen SCREEN_PTR = $C8 ; Pointer to current char in text screen

27
libsrc/plus4/revers.s Normal file
View File

@@ -0,0 +1,27 @@
;
; Ullrich von Bassewitz, 07.08.1998
;
; unsigned char revers (unsigned char onoff);
;
.export _revers
.include "plus4.inc"
.proc _revers
ldx #$00 ; Assume revers off
tay ; Test onoff
beq L1 ; Jump if off
ldx #$80 ; Load on value
ldy #$00 ; Assume old value is zero
L1: lda RVS ; Load old value
stx RVS ; Set new value
beq L2 ; Jump if old value zero
iny ; Make old value = 1
L2: ldx #$00 ; Load high byte of result
tya ; Load low byte, set CC
rts
.endproc

View File

@@ -23,7 +23,8 @@ OBJS = _scrsize.o \
kernal.o \ kernal.o \
kplot.o \ kplot.o \
randomize.o \ randomize.o \
readjoy.o readjoy.o \
revers.o
all: $(OBJS) all: $(OBJS)

View File

@@ -8,7 +8,7 @@
.export _cputcxy, _cputc, cputdirect, putchar .export _cputcxy, _cputc, cputdirect, putchar
.export newline, plot .export newline, plot
.import popa, _gotoxy .import popa, _gotoxy
.import xsize, revers .import xsize
.import PLOT .import PLOT
.include "vic20.inc" .include "vic20.inc"
@@ -98,7 +98,7 @@ plot: ldy CURS_X
; position in Y ; position in Y
putchar: putchar:
ora revers ; Set revers bit ora RVS ; Set revers bit
ldy CURS_X ldy CURS_X
sta (SCREEN_PTR),y ; Set char sta (SCREEN_PTR),y ; Set char
lda CHARCOLOR lda CHARCOLOR

27
libsrc/vic20/revers.s Normal file
View File

@@ -0,0 +1,27 @@
;
; Ullrich von Bassewitz, 07.08.1998
;
; unsigned char revers (unsigned char onoff);
;
.export _revers
.include "vic20.inc"
.proc _revers
ldx #$00 ; Assume revers off
tay ; Test onoff
beq L1 ; Jump if off
ldx #$80 ; Load on value
ldy #$00 ; Assume old value is zero
L1: lda RVS ; Load old value
stx RVS ; Set new value
beq L2 ; Jump if old value zero
iny ; Make old value = 1
L2: ldx #$00 ; Load high byte of result
tya ; Load low byte, set CC
rts
.endproc

View File

@@ -13,10 +13,10 @@ FNAM_LEN = $B7 ; Length of filename
SECADR = $B9 ; Secondary address SECADR = $B9 ; Secondary address
DEVNUM = $BA ; Device number DEVNUM = $BA ; Device number
KEY_COUNT = $C6 ; Number of keys in input buffer KEY_COUNT = $C6 ; Number of keys in input buffer
RVS = $C7 ; Reverse flag
CURS_FLAG = $CC ; 1 = cursor off CURS_FLAG = $CC ; 1 = cursor off
CURS_BLINK = $CD ; Blink counter CURS_BLINK = $CD ; Blink counter
CURS_CHAR = $CE ; Character under the cursor CURS_CHAR = $CE ; Character under the cursor
CURS_COLOR = $287 ; Color under the cursor
CURS_STATE = $CF ; Cursor blink state CURS_STATE = $CF ; Cursor blink state
SCREEN_PTR = $D1 ; Pointer to current char in text screen SCREEN_PTR = $D1 ; Pointer to current char in text screen
CURS_X = $D3 ; Cursor column CURS_X = $D3 ; Cursor column
@@ -24,6 +24,7 @@ CURS_Y = $D6 ; Cursor row
CRAM_PTR = $F3 ; Pointer to current char in color RAM CRAM_PTR = $F3 ; Pointer to current char in color RAM
CHARCOLOR = $286 CHARCOLOR = $286
CURS_COLOR = $287 ; Color under the cursor
PALFLAG = $2A6 ; $01 = PAL, $00 = NTSC PALFLAG = $2A6 ; $01 = PAL, $00 = NTSC