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
25 files changed:
; Screen size variables
;
; Screen size variables
;
-xsize: .byte 40
-ysize: .byte 24
+ ldx #XSIZE
+ ldy #YSIZE
+ rts
BRKVec = $03F0 ; Break vector
RESTOR = $03D0 ; Goto Dos
BRKVec = $03F0 ; Break vector
RESTOR = $03D0 ; Goto Dos
+; ---------------------------------------------------------------------------
+; Screen size
+
+XSIZE = 40
+YSIZE = 24
+
;-----------------------------------------------------------------------------
; Hardware
;-----------------------------------------------------------------------------
; Hardware
; Screen size variables
;
; Screen size variables
;
-xsize: .byte 40
-ysize: .byte 24
+ ldx #40
+ ldy #24
+ rts
; Screen size variables
;
; 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
+ ldx #40 ; Assume 40 column mode
+ bit MODE
+ bpl C40 ; Jump if 40 column mode
+ ldx #80
+C40: ldy #25
+ rts
; Screen size variables
;
; Screen size variables
;
- .constructor initscrsize
-
-.code
-
-initscrsize:
- jsr SCREEN
- stx xsize
- sty ysize
- rts
-
-.bss
-
-xsize: .res 1
-ysize: .res 1
.export _cputcxy, _cputc, cputdirect, putchar
.export newline, plot
.import popa, _gotoxy
.export _cputcxy, _cputc, cputdirect, putchar
.export newline, plot
.import popa, _gotoxy
.import PLOT
.include "../plus4/plus4.inc"
.import PLOT
.include "../plus4/plus4.inc"
bne L3
jsr newline ; new line
ldy #0 ; + cr
bne L3
jsr newline ; new line
ldy #0 ; + cr
adc SCREEN_PTR
sta SCREEN_PTR
bcc L4
inc SCREEN_PTR+1
clc
adc SCREEN_PTR
sta SCREEN_PTR
bcc L4
inc SCREEN_PTR+1
clc
adc CRAM_PTR
sta CRAM_PTR
bcc L5
adc CRAM_PTR
sta CRAM_PTR
bcc L5
; Screen size variables
;
; Screen size variables
;
- .constructor initscrsize
-
-.code
-
-initscrsize:
- jsr SCREEN
- stx xsize
- sty ysize
- rts
-
-.bss
-
-xsize: .res 1
-ysize: .res 1
TIME = $A0 ; 60 HZ clock
FNAM_LEN = $B7 ; Length of filename
SECADR = $B9 ; Secondary address
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
FNAM = $BB ; Pointer to filename
KEY_COUNT = $C6 ; Number of keys in input buffer
RVS = $C7 ; Reverse flag
BRKVec = $0316
NMIVec = $0318
BRKVec = $0316
NMIVec = $0318
+; ---------------------------------------------------------------------------
+; Screen size
+
+XSIZE = 40
+YSIZE = 25
+
; ---------------------------------------------------------------------------
; I/O: VIC
; ---------------------------------------------------------------------------
; I/O: VIC
.export _cputcxy, _cputc, cputdirect, putchar
.export newline, plot
.import popa, _gotoxy
.export _cputcxy, _cputc, cputdirect, putchar
.export newline, plot
.import popa, _gotoxy
.import PLOT
.include "c64.inc"
.import PLOT
.include "c64.inc"
bne L3
jsr newline ; new line
ldy #0 ; + cr
bne L3
jsr newline ; new line
ldy #0 ; + cr
adc SCREEN_PTR
sta SCREEN_PTR
bcc L4
inc SCREEN_PTR+1
clc
adc SCREEN_PTR
sta SCREEN_PTR
bcc L4
inc SCREEN_PTR+1
clc
adc CRAM_PTR
sta CRAM_PTR
bcc L5
adc CRAM_PTR
sta CRAM_PTR
bcc L5
; Screen size variables
;
; Screen size variables
;
-xsize: .byte 40
-ysize: .byte 25
+ ldx #XSIZE
+ ldy #YSIZE
+ rts
+
+.endproc
wstvec = $03F8
WstFlag = $03FA ; Warm start flag
wstvec = $03F8
WstFlag = $03FA ; Warm start flag
+; ---------------------------------------------------------------------------
+; Screen size
+
+XSIZE = 40
+YSIZE = 25
+
;-----------------------------------------------------------------------------
; I/O Definitions
;-----------------------------------------------------------------------------
; I/O Definitions
.import PLOT
.import popa, _gotoxy
.import PLOT
.import popa, _gotoxy
bne L3
jsr newline ; new line
ldy #0 ; + cr
bne L3
jsr newline ; new line
ldy #0 ; + cr
adc SCREEN_PTR
sta SCREEN_PTR
bcc L4
inc SCREEN_PTR+1
clc
adc SCREEN_PTR
sta SCREEN_PTR
bcc L4
inc SCREEN_PTR+1
clc
adc CRAM_PTR
sta CRAM_PTR
bcc L5
adc CRAM_PTR
sta CRAM_PTR
bcc L5
; Screen size variables
;
; Screen size variables
;
-xsize: .byte 80
-ysize: .byte 25
+ ldx #XSIZE
+ ldy #YSIZE
+ rts
+
+.endproc
WstFlag = $03FA ; Warm start flag
WstFlag = $03FA ; Warm start flag
+; ---------------------------------------------------------------------------
+; Screen size
+
+XSIZE = 80
+YSIZE = 25
+
; ---------------------------------------------------------------------------
; I/O definitions
; ---------------------------------------------------------------------------
; I/O definitions
.import PLOT
.import _gotoxy
.import popa
.import PLOT
.import _gotoxy
.import popa
bne L3
jsr newline ; new line
ldy #0 ; + cr
bne L3
jsr newline ; new line
ldy #0 ; + cr
adc CharPtr
sta CharPtr
bcc L4
adc CharPtr
sta CharPtr
bcc L4
- .import popax
- .import xsize, ysize
- .importzp ptr1, ptr2
+ .import popsreg
+ .import screensize
+ .importzp ptr1, sreg
- sta ptr1 ; Store the y pointer
+ sta ptr1 ; Store the y pointer
+ jsr popsreg ; Get the x pointer into sreg
+ jsr screensize ; Get screensize into X/Y
+ tya ; Get Y size into A
+
+.IFP02
+ ldy #0
+ sta (ptr1),y
+ txa
+ sta (sreg),y
+.ELSE
+ sta (ptr1)
+ txa
+ sta (sreg)
+.ENDIF
- jsr popax ; get the x pointer
- sta ptr2
- stx ptr2+1
-
- ldy #0
- lda xsize
- sta (ptr2),y
- lda ysize
- sta (ptr1),y
; Screen size variables
;
; Screen size variables
;
-
- .export xsize, ysize
- .constructor initscrsize
ldx SCR_LINELEN
inx ; Variable is one less
ldx SCR_LINELEN
inx ; Variable is one less
- stx xsize
- lda #25
- sta ysize
-
-.bss
-
-xsize: .res 1
-ysize: .res 1
-
-
.export _clrscr
.import plot
.importzp ptr1
.export _clrscr
.import plot
.importzp ptr1
; Determine, how many pages to fill
ldx #4
; 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
ldx #8
; Clear the screen
.export _cputcxy, _cputc, cputdirect, putchar
.export newline, plot
.import popa, _gotoxy
.export _cputcxy, _cputc, cputdirect, putchar
.export newline, plot
.import popa, _gotoxy
-; .include "../cbm/cbm.inc"
; Advance cursor position
advance:
; Advance cursor position
advance:
+ cpy SCR_LINELEN ; xsize-1
bne L3
jsr newline ; new line
bne L3
jsr newline ; new line
- ldy #0 ; + cr
-L3: sty CURS_X
+ ldy #$FF ; + cr
+L3: iny
+ sty CURS_X
+ lda SCR_LINELEN ; xsize-1
+ sec ; Account for -1 above
adc SCREEN_PTR
sta SCREEN_PTR
bcc L4
adc SCREEN_PTR
sta SCREEN_PTR
bcc L4
lda ScrLo,y
sta SCREEN_PTR
lda ScrHi,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
asl SCREEN_PTR ; 80 column mode
rol a
@L1: ora #$80 ; Screen at $8000
; Screen size variables
;
; Screen size variables
;
+; 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
.export _cputcxy, _cputc, cputdirect, putchar
.export newline, plot
.import popa, _gotoxy
.export _cputcxy, _cputc, cputdirect, putchar
.export newline, plot
.import popa, _gotoxy
.import PLOT
.include "plus4.inc"
.import PLOT
.include "plus4.inc"
bne L3
jsr newline ; new line
ldy #0 ; + cr
bne L3
jsr newline ; new line
ldy #0 ; + cr
adc SCREEN_PTR
sta SCREEN_PTR
bcc L4
inc SCREEN_PTR+1
clc
adc SCREEN_PTR
sta SCREEN_PTR
bcc L4
inc SCREEN_PTR+1
clc
adc CRAM_PTR
sta CRAM_PTR
bcc L5
adc CRAM_PTR
sta CRAM_PTR
bcc L5
BRKVec = $0316
NMIVec = $0318
BRKVec = $0316
NMIVec = $0318
+; ---------------------------------------------------------------------------
+; Screen size
+
+XSIZE = 40
+YSIZE = 25
+
; ---------------------------------------------------------------------------
; I/O
; ---------------------------------------------------------------------------
; I/O
; Screen size variables
;
; Screen size variables
;
- .constructor initscrsize
-
-.code
-
-initscrsize:
- jsr SCREEN
- stx xsize
- sty ysize
- rts
-
-.bss
-
-xsize: .res 1
-ysize: .res 1
.export _cputcxy, _cputc, cputdirect, putchar
.export newline, plot
.import popa, _gotoxy
.export _cputcxy, _cputc, cputdirect, putchar
.export newline, plot
.import popa, _gotoxy
.import PLOT
.include "vic20.inc"
.import PLOT
.include "vic20.inc"
bne L3
jsr newline ; new line
ldy #0 ; + cr
bne L3
jsr newline ; new line
ldy #0 ; + cr
adc SCREEN_PTR
sta SCREEN_PTR
bcc L4
inc SCREEN_PTR+1
clc
adc SCREEN_PTR
sta SCREEN_PTR
bcc L4
inc SCREEN_PTR+1
clc
adc CRAM_PTR
sta CRAM_PTR
bcc L5
adc CRAM_PTR
sta CRAM_PTR
bcc L5
PALFLAG = $2A6 ; $01 = PAL, $00 = NTSC
PALFLAG = $2A6 ; $01 = PAL, $00 = NTSC
+; ---------------------------------------------------------------------------
+; Screen size
+
+XSIZE = 22
+YSIZE = 23
+
; ---------------------------------------------------------------------------
; Kernal routines
; ---------------------------------------------------------------------------
; Kernal routines