1
0
mirror of https://github.com/cc65/cc65.git synced 2024-11-16 18:08:04 +00:00

Fix scrolling (again). The old code switched off scrolling completely, as a

consequence it didn't work when write(FILENO_STDOUT, ...) was used. So we will
have to disable scrolling on a per character basis in cputc.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4617 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz 2010-03-07 13:37:58 +00:00
parent 28736e9a17
commit 9656dde9e3
2 changed files with 22 additions and 20 deletions

View File

@ -7,15 +7,12 @@
; ;
.export _cputcxy, _cputc, cputdirect, putchar .export _cputcxy, _cputc, cputdirect, putchar
.export newline, plot .export newline, plot
.constructor initcputc
.destructor donecputc
.import popa, _gotoxy .import popa, _gotoxy
.import PLOT .import PLOT
.include "c128.inc" .include "c128.inc"
cputdirect = PRINT
newline = NEWLINE newline = NEWLINE
;-------------------------------------------------------------------------- ;--------------------------------------------------------------------------
@ -40,15 +37,26 @@ _cputc: cmp #$0A ; CR?
; Printable char of some sort ; Printable char of some sort
L2: cmp #' ' L2: cmp #' '
bcc L4 ; Other control char bcc cputdirect ; Other control char
tay tay
bmi L5 bmi L5
cmp #$60 cmp #$60
bcc L3 bcc L3
and #$DF and #$DF
bne L4 ; Branch always bne cputdirect ; Branch always
L3: and #$3F L3: and #$3F
L4: jmp PRINT ; Output character
; Output one character to the screen. We will disable scrolling while doing so
cputdirect:
ldx SCROLL
stx ScrollSave ; Save scroll flag
ldx #$C0
stx SCROLL ; Disable scrolling
jsr PRINT ; Call kernal entry point
ldx ScrollSave
stx SCROLL ; Restore old scroll flag
rts
; Handle character if high bit set ; Handle character if high bit set
@ -56,9 +64,9 @@ L5: and #$7F
cmp #$7E ; PI? cmp #$7E ; PI?
bne L6 bne L6
lda #$5E ; Load screen code for PI lda #$5E ; Load screen code for PI
bne L4 bne cputdirect
L6: ora #$40 L6: ora #$40
bne L4 ; Branch always bne cputdirect ; Branch always
; Carriage return ; Carriage return
@ -78,14 +86,9 @@ plot: ldy CURS_X
putchar = $CC2F putchar = $CC2F
;-------------------------------------------------------------------------- ;--------------------------------------------------------------------------
; Module constructor/destructor. Don't move the constructor into the INIT ; Data
; segment, because it shares most of the code with the destructor. .bss
ScrollSave: .res 1 ; Save location for scroll byte
initcputc:
lda #$C0
.byte $2C
donecputc:
lda #$00
sta SCROLL
rts

View File

@ -22,8 +22,7 @@
jsr SWAPPER ; Toggle the mode jsr SWAPPER ; Toggle the mode
lda #14 lda #14
jsr BSOUT ; Switch to lower case chars jsr BSOUT ; Switch to lower case chars
lda #$C0
sta SCROLL ; Disable scrolling
pla ; Get old mode into A pla ; Get old mode into A
; Done, old mode is in A ; Done, old mode is in A