From: cuz Date: Thu, 19 Dec 2002 20:29:27 +0000 (+0000) Subject: For the CBM platforms, make revers() machine dependent and use the RVS flag X-Git-Tag: V2.12.0~1884 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=36fe6284a84a279ab94c47a74a6bb572e1aa0e0a;p=cc65 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 --- diff --git a/libsrc/c128/Makefile b/libsrc/c128/Makefile index 80c768423..fc7e52a9b 100644 --- a/libsrc/c128/Makefile +++ b/libsrc/c128/Makefile @@ -37,6 +37,7 @@ OBJS = _scrsize.o \ mouse.o \ randomize.o \ readjoy.o \ + revers.o \ rs232.o \ tgi_mode_table.o diff --git a/libsrc/c128/c128.inc b/libsrc/c128/c128.inc index 57441e302..9e101d4f9 100644 --- a/libsrc/c128/c128.inc +++ b/libsrc/c128/c128.inc @@ -16,6 +16,7 @@ FNAM_LO = $BB ; Address of filename FNAM_HI = $BC FNAM_BANK = $C7 ; Bank for filename KEY_COUNT = $D0 ; Number of keys in input buffer +FKEY_COUNT = $D1 ; Characters for function key MODE = $D7 ; 40/80 column mode flag CURS_X = $EC ; Cursor column 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 CHARCOLOR = $F1 -FKEY_COUNT = $D1 ; Characters for function key +RVS = $F3 ; Reverse output flag FETCH = $2A2 ; Fetch subroutine in RAM FETVEC = $2AA ; Vector patch location for FETCH STASH = $2AF ; Stash routine in RAM @@ -41,6 +42,7 @@ CURS_ON = $CD6F CURS_OFF = $CD9F CLRSCR = $C142 KBDREAD = $C006 +PRINT = $C00C ; Extended jump table SETBNK = $FF68 diff --git a/libsrc/c128/color.s b/libsrc/c128/color.s index e58234373..f60529b24 100644 --- a/libsrc/c128/color.s +++ b/libsrc/c128/color.s @@ -12,7 +12,11 @@ _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 txa rts diff --git a/libsrc/c128/cputc.s b/libsrc/c128/cputc.s index 318aa6175..9ba194290 100644 --- a/libsrc/c128/cputc.s +++ b/libsrc/c128/cputc.s @@ -8,7 +8,7 @@ .export _cputcxy, _cputc, cputdirect, putchar .export newline, plot .import popa, _gotoxy - .import xsize, revers + .import xsize .import PLOT .include "c128.inc" @@ -98,7 +98,7 @@ plot: ldy CURS_X ; position in Y putchar: - ora revers ; Set revers bit + ora RVS ; Set revers bit ldy CURS_X sta (SCREEN_PTR),y ; Set char lda CHARCOLOR diff --git a/libsrc/c128/revers.s b/libsrc/c128/revers.s new file mode 100644 index 000000000..f722c84a8 --- /dev/null +++ b/libsrc/c128/revers.s @@ -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 + diff --git a/libsrc/c16/Makefile b/libsrc/c16/Makefile index 8577b66bb..12b91c6a8 100644 --- a/libsrc/c16/Makefile +++ b/libsrc/c16/Makefile @@ -23,7 +23,8 @@ OBJS = _scrsize.o \ kbhit.o \ kernal.o \ randomize.o \ - readjoy.o + readjoy.o \ + revers.o all: $(OBJS) diff --git a/libsrc/c16/cputc.s b/libsrc/c16/cputc.s index 0d705892d..680dc5593 100644 --- a/libsrc/c16/cputc.s +++ b/libsrc/c16/cputc.s @@ -8,7 +8,7 @@ .export _cputcxy, _cputc, cputdirect, putchar .export newline, plot .import popa, _gotoxy - .import xsize, revers + .import xsize .import PLOT .include "../plus4/plus4.inc" @@ -98,7 +98,7 @@ plot: ldy CURS_X ; position in Y putchar: - ora revers ; Set revers bit + ora RVS ; Set revers bit ldy CURS_X sta (SCREEN_PTR),y ; Set char lda CHARCOLOR diff --git a/libsrc/c16/revers.s b/libsrc/c16/revers.s new file mode 100644 index 000000000..c9adac7f2 --- /dev/null +++ b/libsrc/c16/revers.s @@ -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 + diff --git a/libsrc/c64/Makefile b/libsrc/c64/Makefile index c57920254..a336320ec 100644 --- a/libsrc/c64/Makefile +++ b/libsrc/c64/Makefile @@ -38,6 +38,7 @@ OBJS = _scrsize.o \ mouse.o \ randomize.o \ readjoy.o \ + revers.o \ rs232.o \ tgi_mode_table.o diff --git a/libsrc/c64/c64.inc b/libsrc/c64/c64.inc index 9d0130034..913842fa3 100644 --- a/libsrc/c64/c64.inc +++ b/libsrc/c64/c64.inc @@ -13,10 +13,10 @@ FNAM_LEN = $B7 ; Length of filename SECADR = $B9 ; Secondary address DEVNUM = $BA ; Device number KEY_COUNT = $C6 ; Number of keys in input buffer +RVS = $C7 ; Reverse flag CURS_FLAG = $CC ; 1 = cursor off CURS_BLINK = $CD ; Blink counter CURS_CHAR = $CE ; Character under the cursor -CURS_COLOR = $287 ; Color under the cursor CURS_STATE = $CF ; Cursor blink state SCREEN_PTR = $D1 ; Pointer to current char in text screen CURS_X = $D3 ; Cursor column @@ -24,6 +24,7 @@ CURS_Y = $D6 ; Cursor row CRAM_PTR = $F3 ; Pointer to current char in color RAM CHARCOLOR = $286 +CURS_COLOR = $287 ; Color under the cursor PALFLAG = $2A6 ; $01 = PAL, $00 = NTSC diff --git a/libsrc/c64/cputc.s b/libsrc/c64/cputc.s index 7bdcdc859..83a0c8b63 100644 --- a/libsrc/c64/cputc.s +++ b/libsrc/c64/cputc.s @@ -8,7 +8,7 @@ .export _cputcxy, _cputc, cputdirect, putchar .export newline, plot .import popa, _gotoxy - .import xsize, revers + .import xsize .import PLOT .include "c64.inc" @@ -98,7 +98,7 @@ plot: ldy CURS_X ; position in Y putchar: - ora revers ; Set revers bit + ora RVS ; Set revers bit ldy CURS_X sta (SCREEN_PTR),y ; Set char lda CHARCOLOR diff --git a/libsrc/c64/revers.s b/libsrc/c64/revers.s new file mode 100644 index 000000000..b6afa9cd0 --- /dev/null +++ b/libsrc/c64/revers.s @@ -0,0 +1,27 @@ +; +; Ullrich von Bassewitz, 07.08.1998 +; +; unsigned char revers (unsigned char onoff); +; + + .export _revers + + .include "c64.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 + diff --git a/libsrc/cbm/Makefile b/libsrc/cbm/Makefile index a77597bfa..c8643855c 100644 --- a/libsrc/cbm/Makefile +++ b/libsrc/cbm/Makefile @@ -56,7 +56,6 @@ S_OBJS = c_acptr.o \ oserrlist.o \ oserror.o \ read.o \ - revers.o \ rwcommon.o \ scratch.o \ sysremove.o \ diff --git a/libsrc/cbm/revers.s b/libsrc/cbm/revers.s deleted file mode 100644 index 64a0029ea..000000000 --- a/libsrc/cbm/revers.s +++ /dev/null @@ -1,26 +0,0 @@ -; -; Ullrich von Bassewitz, 07.08.1998 -; -; unsigned char revers (unsigned char onoff); -; - - .export _revers - .export revers - -_revers: - ldx #$00 ; Assume revers off - tay ; Test onoff - beq L1 ; Jump if off - ldx #$80 ; Load on value -L1: ldy #$00 ; Assume old value is zero - lda revers ; Load old value - stx revers ; 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 - -.bss - -revers: .res 1 diff --git a/libsrc/cbm510/Makefile b/libsrc/cbm510/Makefile index e37d72bbe..7c0add7d9 100644 --- a/libsrc/cbm510/Makefile +++ b/libsrc/cbm510/Makefile @@ -49,6 +49,7 @@ OBJS = _scrsize.o \ pokesys.o \ randomize.o \ readjoy.o \ + revers.o \ rs232.o \ tgi_mode_table.o diff --git a/libsrc/cbm510/cbm510.inc b/libsrc/cbm510/cbm510.inc index d092f3d84..75ef374b7 100644 --- a/libsrc/cbm510/cbm510.inc +++ b/libsrc/cbm510/cbm510.inc @@ -174,8 +174,7 @@ rs232head = $037C rs232tail = $037D PgmKeyEnd = $0380 PgmKeySeg = $0382 -PgmKeySize = $0383 -rvsFlag = $0397 +RVS = $0383 linetmp = $0398 LastPrtChar = $0399 InsertFlag = $039A @@ -188,7 +187,6 @@ SegSave = $03A0 TabStopTable = $03A1 ; 80 bits for tabstops KeyBuf = $03AB ; Keyboard buffer funvec = $03B5 ; Vector for function key handline -FunKeyTmp = $03B7 sedt3 = $03B9 MoniSegSave = $03f0 wstvec = $03F8 diff --git a/libsrc/cbm510/cputc.s b/libsrc/cbm510/cputc.s index 8b832614b..e0c0e7837 100644 --- a/libsrc/cbm510/cputc.s +++ b/libsrc/cbm510/cputc.s @@ -10,7 +10,7 @@ .import PLOT .import popa, _gotoxy - .import xsize, revers + .import xsize .include "cbm510.inc" @@ -97,7 +97,7 @@ plot: ldy CURS_X ; position in Y putchar: - ora revers ; Set revers bit + ora RVS ; Set revers bit ldy CURS_X sta (SCREEN_PTR),y ; Set char ldx IndReg diff --git a/libsrc/cbm510/revers.s b/libsrc/cbm510/revers.s new file mode 100644 index 000000000..47ed9ae7a --- /dev/null +++ b/libsrc/cbm510/revers.s @@ -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 + diff --git a/libsrc/cbm610/Makefile b/libsrc/cbm610/Makefile index ccd841b2c..9fac393de 100644 --- a/libsrc/cbm610/Makefile +++ b/libsrc/cbm610/Makefile @@ -40,6 +40,7 @@ OBJS = _scrsize.o \ peeksys.o \ pokesys.o \ randomize.o \ + revers.o \ rs232.o #-------------------------------------------------------------------------- diff --git a/libsrc/cbm610/cbm610.inc b/libsrc/cbm610/cbm610.inc index 32e41633d..4f259ed2a 100644 --- a/libsrc/cbm610/cbm610.inc +++ b/libsrc/cbm610/cbm610.inc @@ -167,7 +167,7 @@ rs232tail = $037D PgmKeyEnd = $0380 PgmKeySeg = $0382 PgmKeySize = $0383 -rvsFlag = $0397 +RVS = $0397 linetmp = $0398 LastPrtChar = $0399 InsertFlag = $039A diff --git a/libsrc/cbm610/cputc.s b/libsrc/cbm610/cputc.s index ac3224c6f..64988e4fe 100644 --- a/libsrc/cbm610/cputc.s +++ b/libsrc/cbm610/cputc.s @@ -12,7 +12,7 @@ .import PLOT .import _gotoxy .import popa - .import xsize, revers + .import xsize .include "cbm610.inc" @@ -94,7 +94,7 @@ putchar: ldx IndReg ldy #$0F sty IndReg - ora revers ; Set revers bit + ora RVS ; Set revers bit ldy CURS_X sta (CharPtr),y ; Set char stx IndReg diff --git a/libsrc/cbm610/revers.s b/libsrc/cbm610/revers.s new file mode 100644 index 000000000..d5958a64d --- /dev/null +++ b/libsrc/cbm610/revers.s @@ -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 + diff --git a/libsrc/pet/Makefile b/libsrc/pet/Makefile index 86eb5b5b4..80cdb6cea 100644 --- a/libsrc/pet/Makefile +++ b/libsrc/pet/Makefile @@ -32,7 +32,8 @@ OBJS = _scrsize.o \ kreadst.o \ ksetlfs.o \ ksetnam.o \ - randomize.o + randomize.o \ + revers.o all: $(OBJS) diff --git a/libsrc/pet/cputc.s b/libsrc/pet/cputc.s index 7dca23143..eb8430536 100644 --- a/libsrc/pet/cputc.s +++ b/libsrc/pet/cputc.s @@ -8,10 +8,10 @@ .export _cputcxy, _cputc, cputdirect, putchar .export newline, plot .import popa, _gotoxy - .import xsize, revers + .import xsize .include "pet.inc" - .include "../cbm/cbm.inc" +; .include "../cbm/cbm.inc" _cputcxy: pha ; Save C @@ -98,7 +98,7 @@ plot: ldy CURS_Y ; position in Y putchar: - ora revers ; Set revers bit + ora RVS ; Set revers bit ldy CURS_X sta (SCREEN_PTR),y ; Set char rts diff --git a/libsrc/pet/pet.inc b/libsrc/pet/pet.inc index 2bcbf5786..27a614b16 100644 --- a/libsrc/pet/pet.inc +++ b/libsrc/pet/pet.inc @@ -10,6 +10,7 @@ MEMSIZE = $34 ; Size of memory installed TIME = $8D ; 60HZ clock ST = $96 ; IEC status byte KEY_COUNT = $9E ; Number of keys in input buffer +RVS = $9F ; Reverse flag CURS_FLAG = $A7 ; 1 = cursor off CURS_BLINK = $A8 ; Blink counter CURS_CHAR = $A9 ; Character under the cursor @@ -29,7 +30,7 @@ KEY_BUF = $26F ; Keyboard buffer ;---------------------------------------------------------------------------- ; PET ROM type detection -PET_DETECT = $FFFB +PET_DETECT = $FFFB PET_2000 = $CA PET_3000 = $FC PET_4000 = $FD diff --git a/libsrc/pet/revers.s b/libsrc/pet/revers.s new file mode 100644 index 000000000..bbcf8e132 --- /dev/null +++ b/libsrc/pet/revers.s @@ -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 + diff --git a/libsrc/plus4/Makefile b/libsrc/plus4/Makefile index 3b8ce2346..0e4c2633e 100644 --- a/libsrc/plus4/Makefile +++ b/libsrc/plus4/Makefile @@ -46,6 +46,7 @@ OBJS = _scrsize.o \ kuntlk.o \ randomize.o \ readjoy.o \ + revers.o \ tgi_mode_table.o all: $(OBJS) diff --git a/libsrc/plus4/cputc.s b/libsrc/plus4/cputc.s index 1d3208c28..bbf4c5f12 100644 --- a/libsrc/plus4/cputc.s +++ b/libsrc/plus4/cputc.s @@ -8,7 +8,7 @@ .export _cputcxy, _cputc, cputdirect, putchar .export newline, plot .import popa, _gotoxy - .import xsize, revers + .import xsize .import PLOT .include "plus4.inc" @@ -89,7 +89,7 @@ L11: ora #$40 plot: ldy CURS_X ldx CURS_Y - clc + clc jmp PLOT ; Set the new cursor @@ -98,7 +98,7 @@ plot: ldy CURS_X ; position in Y putchar: - ora revers ; Set revers bit + ora RVS ; Set revers bit ldy CURS_X sta (SCREEN_PTR),y ; Set char lda CHARCOLOR diff --git a/libsrc/plus4/plus4.inc b/libsrc/plus4/plus4.inc index 825dda15f..01d02a641 100644 --- a/libsrc/plus4/plus4.inc +++ b/libsrc/plus4/plus4.inc @@ -15,6 +15,7 @@ SECADR = $AD ; Secondary address DEVNUM = $AE ; Device number FNAM_ADR = $AF ; Pointer to filename for OPEN KEY_COUNT = $EF ; Number of keys in input buffer +RVS = $C2 ; Reverse flag CURS_X = $CA ; Cursor column CURS_Y = $CD ; Cursor row SCREEN_PTR = $C8 ; Pointer to current char in text screen diff --git a/libsrc/plus4/revers.s b/libsrc/plus4/revers.s new file mode 100644 index 000000000..c48ff9862 --- /dev/null +++ b/libsrc/plus4/revers.s @@ -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 + diff --git a/libsrc/vic20/Makefile b/libsrc/vic20/Makefile index 4967c2720..3b713f681 100644 --- a/libsrc/vic20/Makefile +++ b/libsrc/vic20/Makefile @@ -23,7 +23,8 @@ OBJS = _scrsize.o \ kernal.o \ kplot.o \ randomize.o \ - readjoy.o + readjoy.o \ + revers.o all: $(OBJS) diff --git a/libsrc/vic20/cputc.s b/libsrc/vic20/cputc.s index c788d32af..cf3c02fdf 100644 --- a/libsrc/vic20/cputc.s +++ b/libsrc/vic20/cputc.s @@ -8,7 +8,7 @@ .export _cputcxy, _cputc, cputdirect, putchar .export newline, plot .import popa, _gotoxy - .import xsize, revers + .import xsize .import PLOT .include "vic20.inc" @@ -98,7 +98,7 @@ plot: ldy CURS_X ; position in Y putchar: - ora revers ; Set revers bit + ora RVS ; Set revers bit ldy CURS_X sta (SCREEN_PTR),y ; Set char lda CHARCOLOR diff --git a/libsrc/vic20/revers.s b/libsrc/vic20/revers.s new file mode 100644 index 000000000..da4d2ca11 --- /dev/null +++ b/libsrc/vic20/revers.s @@ -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 + diff --git a/libsrc/vic20/vic20.inc b/libsrc/vic20/vic20.inc index c24b99cc2..3297fdbca 100644 --- a/libsrc/vic20/vic20.inc +++ b/libsrc/vic20/vic20.inc @@ -13,10 +13,10 @@ FNAM_LEN = $B7 ; Length of filename SECADR = $B9 ; Secondary address DEVNUM = $BA ; Device number KEY_COUNT = $C6 ; Number of keys in input buffer +RVS = $C7 ; Reverse flag CURS_FLAG = $CC ; 1 = cursor off CURS_BLINK = $CD ; Blink counter CURS_CHAR = $CE ; Character under the cursor -CURS_COLOR = $287 ; Color under the cursor CURS_STATE = $CF ; Cursor blink state SCREEN_PTR = $D1 ; Pointer to current char in text screen CURS_X = $D3 ; Cursor column @@ -24,6 +24,7 @@ CURS_Y = $D6 ; Cursor row CRAM_PTR = $F3 ; Pointer to current char in color RAM CHARCOLOR = $286 +CURS_COLOR = $287 ; Color under the cursor PALFLAG = $2A6 ; $01 = PAL, $00 = NTSC