Skip to content

Commit

Permalink
apple2e: implemented screen_showcursor
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasbaumann committed Nov 30, 2024
1 parent 3fec73b commit 412502e
Showing 1 changed file with 39 additions and 6 deletions.
45 changes: 39 additions & 6 deletions src/arch/apple2e/apple2e.S
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ DECODE_TABLE_START = 0x96

SCREENF_CURSORSHOWN = 0x80
SCREENF_INVERSE = 0x40
SCREENF_CURSORENABLED = 0x20

;#define APPLE2
;#define APPLE2PLUS
Expand Down Expand Up @@ -131,6 +132,7 @@ _start:

jsr initdrivers
lda #0
ora #(SCREENF_CURSORENABLED)
sta cursorf

; Print the startup banner.
Expand Down Expand Up @@ -276,7 +278,7 @@ screen_jmptable_lo:
jmptablo screen_putchar
jmptablo screen_putstring
jmptablo screen_getchar
jmptablo fail ; screen_showcursor
jmptablo screen_showcursor
jmptablo screen_scrollup
jmptablo screen_scrolldown
jmptablo screen_cleartoeol
Expand All @@ -290,7 +292,7 @@ screen_jmptable_hi:
jmptabhi screen_putchar
jmptabhi screen_putstring
jmptabhi screen_getchar
jmptabhi fail
jmptabhi screen_showcursor
jmptabhi screen_scrollup
jmptabhi screen_scrolldown
jmptabhi screen_cleartoeol
Expand Down Expand Up @@ -410,7 +412,12 @@ zproc screen_putstring
rts
zendproc

; XA = timeout in cs

zproc screen_getchar
sta ptr
stx ptr+1

; Turn the disk motor off.

ldx #DISK_SLOT
Expand All @@ -433,6 +440,28 @@ zproc screen_getchar
rts
zendproc

zproc screen_showcursor
cmp #0
zif_eq
jsr prepare_for_screen_write
lda (ptr), y
ora #0x80
sta (ptr), y
lda cursorf
and #(~SCREENF_CURSORENABLED) & 0xff ; unset bit 5, cursor is disabled
sta cursorf
zelse
lda cursorf
ora #SCREENF_CURSORENABLED ; set bit 5, cursor is enabled
sta cursorf
jsr prepare_for_screen_write
lda (ptr), y
and #0x7f
sta (ptr), y
zendif
rts
zendproc

zproc screen_scrollup
jsr hide_cursor

Expand Down Expand Up @@ -611,10 +640,14 @@ zproc hide_cursor
zendproc

zproc toggle_cursor
jsr prepare_for_screen_write
lda (ptr), y
eor #0x80
sta (ptr), y
lda cursorf
and #(SCREENF_CURSORENABLED) ; draw cursor only if bit 5 it set
zif_ne
jsr prepare_for_screen_write
lda (ptr), y
eor #0x80
sta (ptr), y
zendif

lda cursorf
eor #SCREENF_CURSORSHOWN
Expand Down

0 comments on commit 412502e

Please sign in to comment.