Created
June 5, 2021 21:19
-
-
Save pmalin/90a81ccc4cc54db2d33897f1cfa5b118 to your computer and use it in GitHub Desktop.
Source for ZxSpectrumBot diagonal bars tweet
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
ORG $8000 | |
; Set Border Colour to black | |
ld a,0 | |
out (254),a | |
; Fill Background with Crosshatch | |
ld a,170 | |
ld de,16384 | |
ld c,24 | |
loopy: | |
ld b,0 ; loop 256 | |
loopx: | |
ld (de),a | |
inc de | |
djnz loopx | |
xor 255 | |
dec c | |
jp nz,loopy | |
; Main animation | |
rep: | |
; halt ; without double buffering we get tearing if we enable this | |
ld a,(v) | |
dec a | |
ld (v),a | |
ld de,22528 | |
ld a,0 | |
ld c,24 | |
loopv: | |
ld b,32 | |
loopu: | |
ld a,(v) | |
add a,b | |
add a,c | |
and 31 | |
add a,pal&255 | |
ld l,a | |
ld a,0 | |
adc a,pal>>8 | |
ld h,a | |
ld a,(hl) | |
ld (de),a | |
inc de | |
djnz loopu | |
dec c | |
jp nz,loopv | |
jp rep | |
ret | |
; "time" variable | |
v: | |
db 0 | |
; Attribute settings for bars | |
; + 1 x (0-7) = Ink | |
; + 8 x (0-7) = Paper | |
; + 64 = Bright | |
pal: | |
db 0,1,1+8,5,5+8,5+64,5+8*7,7+8*7,5+8*5+64,5+8*7+64,7+8*7+64 | |
db 7+8*7,5+8*7,5+8,1+8,0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment