diff --git a/libsrc/apple2/_scrsize.s b/libsrc/apple2/_scrsize.s index 5578c1be1..df849510c 100644 --- a/libsrc/apple2/_scrsize.s +++ b/libsrc/apple2/_scrsize.s @@ -4,12 +4,15 @@ ; Screen size variables ; - .export xsize, ysize + .export screensize -.rodata + .include "apple2.inc" -xsize: .byte 40 -ysize: .byte 24 +.proc screensize + ldx #XSIZE + ldy #YSIZE + rts +.endproc diff --git a/libsrc/apple2/apple2.inc b/libsrc/apple2/apple2.inc index 78f323dd0..7002f7aad 100644 --- a/libsrc/apple2/apple2.inc +++ b/libsrc/apple2/apple2.inc @@ -20,6 +20,12 @@ MEMSIZE = $73 ; Highest free RAM location BRKVec = $03F0 ; Break vector RESTOR = $03D0 ; Goto Dos +; --------------------------------------------------------------------------- +; Screen size + +XSIZE = 40 +YSIZE = 24 + ;----------------------------------------------------------------------------- ; Hardware diff --git a/libsrc/atari/_scrsize.s b/libsrc/atari/_scrsize.s index 5578c1be1..420505fa5 100644 --- a/libsrc/atari/_scrsize.s +++ b/libsrc/atari/_scrsize.s @@ -4,12 +4,14 @@ ; Screen size variables ; - .export xsize, ysize + .export screensize -.rodata - -xsize: .byte 40 -ysize: .byte 24 +.proc screensize + ldx #40 + ldy #24 + rts + +.endproc diff --git a/libsrc/c128/_scrsize.s b/libsrc/c128/_scrsize.s index dcbc4a2d9..1f38ea65c 100644 --- a/libsrc/c128/_scrsize.s +++ b/libsrc/c128/_scrsize.s @@ -4,26 +4,19 @@ ; Screen size variables ; - .export xsize, ysize - .import SCREEN - .constructor initscrsize - - -.code - -initscrsize: - jsr SCREEN - inx - stx xsize - iny - sty ysize - rts - -.bss - -xsize: .res 1 -ysize: .res 1 - - + .export screensize + + .include "c128.inc" + +.proc screensize + + ldx #40 ; Assume 40 column mode + bit MODE + bpl C40 ; Jump if 40 column mode + ldx #80 +C40: ldy #25 + rts + +.endproc diff --git a/libsrc/c16/_scrsize.s b/libsrc/c16/_scrsize.s index c63df59d2..c0a746198 100644 --- a/libsrc/c16/_scrsize.s +++ b/libsrc/c16/_scrsize.s @@ -4,22 +4,9 @@ ; Screen size variables ; - .export xsize, ysize + .export screensize .import SCREEN - .constructor initscrsize - - -.code - -initscrsize: - jsr SCREEN - stx xsize - sty ysize - rts - -.bss - -xsize: .res 1 -ysize: .res 1 + +screensize = SCREEN diff --git a/libsrc/c16/cputc.s b/libsrc/c16/cputc.s index 680dc5593..26bc2ae5a 100644 --- a/libsrc/c16/cputc.s +++ b/libsrc/c16/cputc.s @@ -8,7 +8,6 @@ .export _cputcxy, _cputc, cputdirect, putchar .export newline, plot .import popa, _gotoxy - .import xsize .import PLOT .include "../plus4/plus4.inc" @@ -50,7 +49,7 @@ cputdirect: advance: iny - cpy xsize + cpy #XSIZE bne L3 jsr newline ; new line ldy #0 ; + cr @@ -59,13 +58,13 @@ L3: sty CURS_X newline: clc - lda xsize + lda #XSIZE adc SCREEN_PTR sta SCREEN_PTR bcc L4 inc SCREEN_PTR+1 clc -L4: lda xsize +L4: lda #XSIZE adc CRAM_PTR sta CRAM_PTR bcc L5 diff --git a/libsrc/c64/_scrsize.s b/libsrc/c64/_scrsize.s index c63df59d2..c0a746198 100644 --- a/libsrc/c64/_scrsize.s +++ b/libsrc/c64/_scrsize.s @@ -4,22 +4,9 @@ ; Screen size variables ; - .export xsize, ysize + .export screensize .import SCREEN - .constructor initscrsize - - -.code - -initscrsize: - jsr SCREEN - stx xsize - sty ysize - rts - -.bss - -xsize: .res 1 -ysize: .res 1 + +screensize = SCREEN diff --git a/libsrc/c64/c64.inc b/libsrc/c64/c64.inc index e93872f93..471551c26 100644 --- a/libsrc/c64/c64.inc +++ b/libsrc/c64/c64.inc @@ -11,7 +11,7 @@ ST = $90 ; IEC status byte TIME = $A0 ; 60 HZ clock FNAM_LEN = $B7 ; Length of filename SECADR = $B9 ; Secondary address -DEVNUM = $BA ; Device number +DEVNUM = $BA ; Device number FNAM = $BB ; Pointer to filename KEY_COUNT = $C6 ; Number of keys in input buffer RVS = $C7 ; Reverse flag @@ -43,6 +43,12 @@ IRQVec = $0314 BRKVec = $0316 NMIVec = $0318 +; --------------------------------------------------------------------------- +; Screen size + +XSIZE = 40 +YSIZE = 25 + ; --------------------------------------------------------------------------- ; I/O: VIC diff --git a/libsrc/c64/cputc.s b/libsrc/c64/cputc.s index 83a0c8b63..cf4275668 100644 --- a/libsrc/c64/cputc.s +++ b/libsrc/c64/cputc.s @@ -8,7 +8,6 @@ .export _cputcxy, _cputc, cputdirect, putchar .export newline, plot .import popa, _gotoxy - .import xsize .import PLOT .include "c64.inc" @@ -50,7 +49,7 @@ cputdirect: advance: iny - cpy xsize + cpy #XSIZE bne L3 jsr newline ; new line ldy #0 ; + cr @@ -59,13 +58,13 @@ L3: sty CURS_X newline: clc - lda xsize + lda #XSIZE adc SCREEN_PTR sta SCREEN_PTR bcc L4 inc SCREEN_PTR+1 clc -L4: lda xsize +L4: lda #XSIZE adc CRAM_PTR sta CRAM_PTR bcc L5 diff --git a/libsrc/cbm510/_scrsize.s b/libsrc/cbm510/_scrsize.s index 5c0fb14e7..99a758455 100644 --- a/libsrc/cbm510/_scrsize.s +++ b/libsrc/cbm510/_scrsize.s @@ -4,12 +4,16 @@ ; Screen size variables ; - .export xsize, ysize + .export screensize -.rodata - -xsize: .byte 40 -ysize: .byte 25 + .include "cbm510.inc" +.proc screensize + + ldx #XSIZE + ldy #YSIZE + rts + +.endproc diff --git a/libsrc/cbm510/cbm510.inc b/libsrc/cbm510/cbm510.inc index 75ef374b7..1e66e2c6d 100644 --- a/libsrc/cbm510/cbm510.inc +++ b/libsrc/cbm510/cbm510.inc @@ -192,6 +192,12 @@ MoniSegSave = $03f0 wstvec = $03F8 WstFlag = $03FA ; Warm start flag +; --------------------------------------------------------------------------- +; Screen size + +XSIZE = 40 +YSIZE = 25 + ;----------------------------------------------------------------------------- ; I/O Definitions diff --git a/libsrc/cbm510/cputc.s b/libsrc/cbm510/cputc.s index e0c0e7837..6e321a017 100644 --- a/libsrc/cbm510/cputc.s +++ b/libsrc/cbm510/cputc.s @@ -10,7 +10,6 @@ .import PLOT .import popa, _gotoxy - .import xsize .include "cbm510.inc" @@ -53,7 +52,7 @@ cputdirect: advance: iny - cpy xsize + cpy #XSIZE bne L3 jsr newline ; new line ldy #0 ; + cr @@ -62,13 +61,13 @@ L3: sty CURS_X newline: clc - lda xsize + lda #XSIZE adc SCREEN_PTR sta SCREEN_PTR bcc L4 inc SCREEN_PTR+1 clc -L4: lda xsize +L4: lda #XSIZE adc CRAM_PTR sta CRAM_PTR bcc L5 diff --git a/libsrc/cbm610/_scrsize.s b/libsrc/cbm610/_scrsize.s index f7095af75..928972bcc 100644 --- a/libsrc/cbm610/_scrsize.s +++ b/libsrc/cbm610/_scrsize.s @@ -4,12 +4,16 @@ ; Screen size variables ; - .export xsize, ysize + .export screensize -.rodata - -xsize: .byte 80 -ysize: .byte 25 + .include "cbm610.inc" +.proc screensize + + ldx #XSIZE + ldy #YSIZE + rts + +.endproc diff --git a/libsrc/cbm610/cbm610.inc b/libsrc/cbm610/cbm610.inc index 4f259ed2a..942c6bf84 100644 --- a/libsrc/cbm610/cbm610.inc +++ b/libsrc/cbm610/cbm610.inc @@ -187,6 +187,12 @@ wstvec = $03F8 WstFlag = $03FA ; Warm start flag +; --------------------------------------------------------------------------- +; Screen size + +XSIZE = 80 +YSIZE = 25 + ; --------------------------------------------------------------------------- ; I/O definitions diff --git a/libsrc/cbm610/cputc.s b/libsrc/cbm610/cputc.s index 64988e4fe..ae8bfb16f 100644 --- a/libsrc/cbm610/cputc.s +++ b/libsrc/cbm610/cputc.s @@ -12,7 +12,6 @@ .import PLOT .import _gotoxy .import popa - .import xsize .include "cbm610.inc" @@ -53,7 +52,7 @@ cputdirect: advance: iny - cpy xsize + cpy #XSIZE bne L3 jsr newline ; new line ldy #0 ; + cr @@ -62,7 +61,7 @@ L3: sty CURS_X newline: clc - lda xsize + lda #XSIZE adc CharPtr sta CharPtr bcc L4 diff --git a/libsrc/conio/scrsize.s b/libsrc/conio/scrsize.s index 0779fb1e5..291f42d4a 100644 --- a/libsrc/conio/scrsize.s +++ b/libsrc/conio/scrsize.s @@ -6,24 +6,29 @@ .export _screensize - .import popax - .import xsize, ysize - .importzp ptr1, ptr2 + .import popsreg + .import screensize + .importzp ptr1, sreg .proc _screensize - sta ptr1 ; Store the y pointer + sta ptr1 ; Store the y pointer stx ptr1+1 + jsr popsreg ; Get the x pointer into sreg + jsr screensize ; Get screensize into X/Y + tya ; Get Y size into A - jsr popax ; get the x pointer - sta ptr2 - stx ptr2+1 +.IFP02 + ldy #0 + sta (ptr1),y + txa + sta (sreg),y +.ELSE + sta (ptr1) + txa + sta (sreg) +.ENDIF - ldy #0 - lda xsize - sta (ptr2),y - lda ysize - sta (ptr1),y rts .endproc diff --git a/libsrc/pet/_scrsize.s b/libsrc/pet/_scrsize.s index 09c94182b..ef8b4c56b 100644 --- a/libsrc/pet/_scrsize.s +++ b/libsrc/pet/_scrsize.s @@ -4,27 +4,16 @@ ; Screen size variables ; - - .export xsize, ysize - .constructor initscrsize + .export screensize .include "pet.inc" -.code +.proc screensize -initscrsize: ldx SCR_LINELEN inx ; Variable is one less - stx xsize - lda #25 - sta ysize + ldy #25 rts - -.bss - -xsize: .res 1 -ysize: .res 1 - - +.endproc diff --git a/libsrc/pet/clrscr.s b/libsrc/pet/clrscr.s index 2cabcc084..426a8c5ad 100644 --- a/libsrc/pet/clrscr.s +++ b/libsrc/pet/clrscr.s @@ -7,7 +7,6 @@ .export _clrscr .import plot .importzp ptr1 - .import xsize .include "pet.inc" @@ -23,9 +22,9 @@ _clrscr: ; Determine, how many pages to fill ldx #4 - lda xsize - cmp #40 - beq L1 + lda SCR_LINELEN ; Check length of one line + cmp #40+1 + bcc L1 ldx #8 ; Clear the screen diff --git a/libsrc/pet/cputc.s b/libsrc/pet/cputc.s index eb8430536..c9ac9928e 100644 --- a/libsrc/pet/cputc.s +++ b/libsrc/pet/cputc.s @@ -8,10 +8,8 @@ .export _cputcxy, _cputc, cputdirect, putchar .export newline, plot .import popa, _gotoxy - .import xsize .include "pet.inc" -; .include "../cbm/cbm.inc" _cputcxy: pha ; Save C @@ -48,17 +46,17 @@ cputdirect: ; Advance cursor position advance: - iny - cpy xsize + cpy SCR_LINELEN ; xsize-1 bne L3 jsr newline ; new line - ldy #0 ; + cr -L3: sty CURS_X + ldy #$FF ; + cr +L3: iny + sty CURS_X rts newline: - clc - lda xsize + lda SCR_LINELEN ; xsize-1 + sec ; Account for -1 above adc SCREEN_PTR sta SCREEN_PTR bcc L4 @@ -84,9 +82,9 @@ plot: ldy CURS_Y lda ScrLo,y sta SCREEN_PTR lda ScrHi,y - ldy xsize - cpy #40 - beq @L1 + ldy SCR_LINELEN + cpy #40+1 + bcc @L1 asl SCREEN_PTR ; 80 column mode rol a @L1: ora #$80 ; Screen at $8000 diff --git a/libsrc/plus4/_scrsize.s b/libsrc/plus4/_scrsize.s index 15dd1f778..19f92d7e5 100644 --- a/libsrc/plus4/_scrsize.s +++ b/libsrc/plus4/_scrsize.s @@ -4,11 +4,18 @@ ; Screen size variables ; - .export xsize, ysize + .export screensize -.data +; We will return the values directly instead of banking in the ROM and calling +; SCREEN which is a lot more overhead in code size and CPU cycles. + +.proc screensize + + ldx #40 + ldy #25 + rts + +.endproc -xsize: .byte 40 -ysize: .byte 25 diff --git a/libsrc/plus4/cputc.s b/libsrc/plus4/cputc.s index bbf4c5f12..5788c1cb0 100644 --- a/libsrc/plus4/cputc.s +++ b/libsrc/plus4/cputc.s @@ -8,7 +8,6 @@ .export _cputcxy, _cputc, cputdirect, putchar .export newline, plot .import popa, _gotoxy - .import xsize .import PLOT .include "plus4.inc" @@ -50,7 +49,7 @@ cputdirect: advance: iny - cpy xsize + cpy #XSIZE bne L3 jsr newline ; new line ldy #0 ; + cr @@ -59,13 +58,13 @@ L3: sty CURS_X newline: clc - lda xsize + lda #XSIZE adc SCREEN_PTR sta SCREEN_PTR bcc L4 inc SCREEN_PTR+1 clc -L4: lda xsize +L4: lda #XSIZE adc CRAM_PTR sta CRAM_PTR bcc L5 diff --git a/libsrc/plus4/plus4.inc b/libsrc/plus4/plus4.inc index e4f53a76c..0d51f0aaf 100644 --- a/libsrc/plus4/plus4.inc +++ b/libsrc/plus4/plus4.inc @@ -41,6 +41,12 @@ IRQVec = $0314 BRKVec = $0316 NMIVec = $0318 +; --------------------------------------------------------------------------- +; Screen size + +XSIZE = 40 +YSIZE = 25 + ; --------------------------------------------------------------------------- ; I/O diff --git a/libsrc/vic20/_scrsize.s b/libsrc/vic20/_scrsize.s index c63df59d2..c0a746198 100644 --- a/libsrc/vic20/_scrsize.s +++ b/libsrc/vic20/_scrsize.s @@ -4,22 +4,9 @@ ; Screen size variables ; - .export xsize, ysize + .export screensize .import SCREEN - .constructor initscrsize - - -.code - -initscrsize: - jsr SCREEN - stx xsize - sty ysize - rts - -.bss - -xsize: .res 1 -ysize: .res 1 + +screensize = SCREEN diff --git a/libsrc/vic20/cputc.s b/libsrc/vic20/cputc.s index cf3c02fdf..2dd6f00c9 100644 --- a/libsrc/vic20/cputc.s +++ b/libsrc/vic20/cputc.s @@ -8,7 +8,6 @@ .export _cputcxy, _cputc, cputdirect, putchar .export newline, plot .import popa, _gotoxy - .import xsize .import PLOT .include "vic20.inc" @@ -50,7 +49,7 @@ cputdirect: advance: iny - cpy xsize + cpy #XSIZE bne L3 jsr newline ; new line ldy #0 ; + cr @@ -59,13 +58,13 @@ L3: sty CURS_X newline: clc - lda xsize + lda #XSIZE adc SCREEN_PTR sta SCREEN_PTR bcc L4 inc SCREEN_PTR+1 clc -L4: lda xsize +L4: lda #XSIZE adc CRAM_PTR sta CRAM_PTR bcc L5 diff --git a/libsrc/vic20/vic20.inc b/libsrc/vic20/vic20.inc index 3297fdbca..95c1f2fec 100644 --- a/libsrc/vic20/vic20.inc +++ b/libsrc/vic20/vic20.inc @@ -28,6 +28,12 @@ CURS_COLOR = $287 ; Color under the cursor PALFLAG = $2A6 ; $01 = PAL, $00 = NTSC +; --------------------------------------------------------------------------- +; Screen size + +XSIZE = 22 +YSIZE = 23 + ; --------------------------------------------------------------------------- ; Kernal routines