mirror of
https://github.com/cc65/cc65.git
synced 2025-01-03 16:33:19 +00:00
kbhit() function and scrolling.
Patch provided by Jeff Tranter.
This commit is contained in:
parent
cbb6f82b99
commit
b1969ac16a
@ -48,8 +48,16 @@ newline:
|
|||||||
lda CURS_Y
|
lda CURS_Y
|
||||||
cmp #SCR_HEIGHT ; screen height
|
cmp #SCR_HEIGHT ; screen height
|
||||||
bne plot
|
bne plot
|
||||||
lda #0 ; wrap around to line 0
|
dec CURS_Y ; bottom of screen reached, scroll
|
||||||
sta CURS_Y
|
ldx #0
|
||||||
|
scroll: lda SCRNBASE+$00A5,x
|
||||||
|
sta SCRNBASE+$0085,x
|
||||||
|
lda SCRNBASE+$01A5,x
|
||||||
|
sta SCRNBASE+$0185,x
|
||||||
|
lda SCRNBASE+$02A5,x
|
||||||
|
sta SCRNBASE+$0285,x
|
||||||
|
inx
|
||||||
|
bne scroll
|
||||||
|
|
||||||
plot: ldy CURS_Y
|
plot: ldy CURS_Y
|
||||||
lda ScrLo,y
|
lda ScrLo,y
|
||||||
|
28
libsrc/osic1p/kbhit.s
Normal file
28
libsrc/osic1p/kbhit.s
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
;
|
||||||
|
; unsigned char kbhit (void);
|
||||||
|
;
|
||||||
|
|
||||||
|
.export _kbhit
|
||||||
|
.include "osic1p.inc"
|
||||||
|
|
||||||
|
_kbhit:
|
||||||
|
lda #%11111110 ; Select first keyboard row
|
||||||
|
scan:
|
||||||
|
sta KBD ; Select keyboard row
|
||||||
|
tax ; Save A
|
||||||
|
lda KBD ; Read keyboard columns
|
||||||
|
ora #$01 ; Mask out lsb (Shift Lock), since we ignore it
|
||||||
|
cmp #$FF ; No keys pressed?
|
||||||
|
bne keypressed
|
||||||
|
txa ; Restore A
|
||||||
|
sec ; Want to shift in ones
|
||||||
|
rol a ; Rotate row select to next bit position
|
||||||
|
cmp #$FF ; Done?
|
||||||
|
bne scan ; If not, continue
|
||||||
|
ldx #$00 ; High byte of return is always zero
|
||||||
|
lda #$00 ; Return false
|
||||||
|
rts
|
||||||
|
keypressed:
|
||||||
|
ldx #$00 ; High byte of return is always zero
|
||||||
|
lda #$01 ; Return true
|
||||||
|
rts
|
@ -2,6 +2,7 @@
|
|||||||
SCRNBASE := $D000 ; Base of video RAM
|
SCRNBASE := $D000 ; Base of video RAM
|
||||||
INPUTC := $FD00 ; Input character from keyboard
|
INPUTC := $FD00 ; Input character from keyboard
|
||||||
RESET := $FF00 ; Reset address, show boot prompt
|
RESET := $FF00 ; Reset address, show boot prompt
|
||||||
|
KBD := $DF00 ; Polled keyboard register
|
||||||
|
|
||||||
; Other definitions
|
; Other definitions
|
||||||
VIDEORAMSIZE = $0400 ; Size of C1P video RAM (1 kB)
|
VIDEORAMSIZE = $0400 ; Size of C1P video RAM (1 kB)
|
||||||
|
Loading…
Reference in New Issue
Block a user