1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-20 20:28:06 +11:00
collapseos/kernel/trs80/vid.asm
Virgil Dupras 92ddc7ebc1 recipes/trs80: use grid module
Not much of a gain in terms of usability (a bit of a loss in fact, things are
a bit slow and glitchy), but it's a necessary move if we want to use upcoming
grid-enabled userspace apps, such as a visual text editor.
2020-02-26 16:27:27 -05:00

60 lines
1.0 KiB
NASM

; vid - TRS-80's video
;
; Implement PutC and GRID_SETCELL using TRS-80's SVC calls.
.equ TRS80_COLS 80
.equ TRS80_ROWS 24
trs80PutC:
push af
push bc
push de ; altered by SVC
ld c, a
ld a, 0x02 ; @DSP
rst 0x28
pop de
pop bc
pop af
ret
trs80SetCell:
push af
push bc
push hl ; HL altered by @VDCTL
push de ; DE altered by @VDCTL
ex de, hl
bit 0, c
ld c, a ; save A now
jr z, .skip ; Z from BIT above. cursor not set
; set cursor
ld a, 0x0f ; @VDCTL
ld b, 3 ; move cursor fn
rst 0x28
; HL altered.
; Our Row/Col is our currently-pushed DE value. Let's take advantage of
; that.
pop hl \ push hl ; HL altered. bring back from stack
.skip:
ld a, 0x0f ; @VDCTL
ld b, 2 ; display char
rst 0x28
pop de
pop hl
pop bc
pop af
ret
; This is a much faster version of gridPushScr. Use it in your glue code, but
; you need to set HL to GRID_BUF first.
trs80PushScr:
push af
push bc
ld a, 0x0f ; @VDCTL
ld b, 5 ; move from RAM to vid
; HL is already set by caller
rst 0x28
pop bc
pop af
cp a ; ensure Z
ret