Last active
June 28, 2021 13:25
-
-
Save pmalin/c97f01e0338de762ca30d04239bd9cba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{AB1} | |
org $8000 | |
; Simple vertical scrolltext for ZX Spectrum Bot | |
; @P_Malin https://twitter.com/P_Malin | |
; https://gist.github.com/pmalin/c97f01e0338de762ca30d04239bd9cba | |
ATTR_DATA: equ 16384+32*192 | |
;border 0 | |
ld a,0 | |
ld hl,$5C8D | |
ld (hl),a | |
out (254),a | |
;cls | |
call $d6b | |
mainLoop: | |
halt | |
halt | |
; scroll attributes upwards | |
ld de,ATTR_DATA | |
ld hl,ATTR_DATA+32 | |
ld bc,32*(24-1) | |
ldir | |
; write bottom line | |
; clear bottom line | |
ld hl,ATTR_DATA+32*24-1 | |
ld de,ATTR_DATA+32*23 | |
ld a,1*9 | |
ld b,32 | |
loopx: | |
ld (de),a | |
inc de | |
djnz loopx | |
; get character bit pattern in c | |
; get string character | |
ld a,(charIndex) | |
ld l,a | |
ld h,0 | |
ld de,msg | |
add hl,de | |
; get char value | |
ld a,(hl) | |
ld l,a | |
ld h,0 | |
add hl,hl ; x2 | |
add hl,hl ; x4 | |
add hl,hl ; x8 | |
ld d,$3d-1 | |
ld a,(chary) | |
ld e,a | |
add hl,de | |
ld a,(hl) | |
ld c,a | |
ld a,0*9 | |
; dest | |
ld de,ATTR_DATA+32*23+13 | |
call draw | |
pop bc | |
ld de,ATTR_DATA+32*23+12 | |
ld a,(hl) | |
ld c,a | |
push bc | |
ld a,5*9 | |
call draw | |
; increment string positions | |
ld hl,chary | |
ld a,(hl) | |
inc a | |
and 7 | |
ld (hl),a | |
jr nz,noSkip | |
ld hl,charIndex | |
ld a,(hl) | |
inc a | |
and 15 | |
ld (hl),a | |
noSkip: | |
jr mainLoop | |
draw: | |
ld b,8 | |
bitloop: | |
rl c | |
jr nc,noDraw | |
ld (de),a | |
noDraw: | |
inc de | |
djnz bitloop | |
ret | |
msg: db "ZX Spectrum!!! " | |
chary: db 0 | |
charIndex: db 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment