1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-07 07:29:33 +00:00

Make screensize() fetch the values dynamically instead of using variables

that are set on startup. This is needed to support the C128, which can switch
the screen size at runtime.


git-svn-id: svn://svn.cc65.org/cc65/trunk@2042 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2003-04-09 19:34:57 +00:00
parent 8632683f11
commit 37178d5141
25 changed files with 153 additions and 158 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -192,6 +192,12 @@ MoniSegSave = $03f0
wstvec = $03F8
WstFlag = $03FA ; Warm start flag
; ---------------------------------------------------------------------------
; Screen size
XSIZE = 40
YSIZE = 25
;-----------------------------------------------------------------------------
; I/O Definitions

View File

@ -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

View File

@ -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

View File

@ -187,6 +187,12 @@ wstvec = $03F8
WstFlag = $03FA ; Warm start flag
; ---------------------------------------------------------------------------
; Screen size
XSIZE = 80
YSIZE = 25
; ---------------------------------------------------------------------------
; I/O definitions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -41,6 +41,12 @@ IRQVec = $0314
BRKVec = $0316
NMIVec = $0318
; ---------------------------------------------------------------------------
; Screen size
XSIZE = 40
YSIZE = 25
; ---------------------------------------------------------------------------
; I/O

View File

@ -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

View File

@ -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

View File

@ -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