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