Skip to content

Commit

Permalink
Make the hardware cursor work.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidgiven committed Jan 6, 2024
1 parent 9fcd21b commit 024770f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 34 deletions.
11 changes: 1 addition & 10 deletions arch/brother/pn8800/bios.z80
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
jp BOOTE
jp WBOOTE
jp CONSTE
jp CONINE
jp KBGET
jp CONOUTE
jp LISTE
jp PUNCHE
Expand Down Expand Up @@ -118,18 +118,12 @@ start_ccp:
jp CBASE ; pass control to CCP

CONSTE:
call CURON

call KBTEST
ld a, 0
ret z ; no key pressed
dec a ; key pressed
ret

CONINE:
call CURON
jp KBGET

ADDAHL
add a, l
ld l, a
Expand All @@ -138,9 +132,6 @@ ADDAHL
ret

CONOUTE:
push bc
call CUROFF
pop bc
ld a, c
jp TTYPUTC

Expand Down
6 changes: 6 additions & 0 deletions arch/brother/pn8800/include/pn8800.lib
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ PORT_VIDEO_CTRL = 0x75
PORT_VIDEO_OFFSET_CTRL = 0x76
PORT_VIDEO_CURSOR_CTRL = 0x77

CURSOR_CURU = 10000000b
CURSOR_CURL = 01000000b
CURSOR_CBKH = 00100000b
CURSOR_CREV = 00010000b
CURSOR_CURB = 00001000b

ATTR_UNDERLINE = 0x01
ATTR_BOLD = 0x04
ATTR_RIGHTBAR = 0x08
Expand Down
33 changes: 9 additions & 24 deletions arch/brother/pn8800/tty.z80
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
SCREEN_WIDTH = 80
SCREEN_HEIGHT = 25

CURSOR_UPDATES = 0
CURSOR_UPDATES = 1
CLEAR_SCREEN_ON_INIT = 1
EMULATE_CLEAR_TO_EOL = 1
EMULATE_CLEAR_TO_EOS = 1
Expand All @@ -38,34 +38,19 @@ TTYGOTO equ tty_goto_xy
label TTYINIT
ld a, SCREEN_ON | SCREEN_SQUASHED
out0 (PORT_VIDEO_CTRL), a
ld a, CURSOR_CURU | CURSOR_CURL | CURSOR_CREV
out0 (PORT_VIDEO_CURSOR_CTRL), a
jp tty_init

label CURON
ld hl, cursor_state
bit 0, (hl)
ret nz
set 0, (hl)
toggle_cursor:
ld hl, (tty_cursorx)
tty_update_cursor
ld hl, (tty_cursorx) ; h=Y, l=X
sla l
out0 (PORT_VIDEO_ADDR_LO), l
out0 (PORT_VIDEO_ADDR_HI), h
in0 a, (PORT_VIDEO_DATA)
nop
nop
nop
xor ATTR_BOTFLASH_BACK | ATTR_TOPFLASH_BACK
out0 (PORT_VIDEO_DATA), a
srl h
rr l
out0 (PORT_CURSOR_ADDR_LO), l
out0 (PORT_CURSOR_ADDR_HI), h
ret

label CUROFF
ld hl, cursor_state
bit 0, (hl)
ret z
res 0, (hl)
ld a, (cursor_state)
jr toggle_cursor

tty_rawwrite:
ld d, 0
ld hl, tty_attributes
Expand Down

0 comments on commit 024770f

Please sign in to comment.