Skip to content

Instantly share code, notes, and snippets.

@ped7g
Created March 6, 2024 01:18
Show Gist options
  • Save ped7g/b3d6fdc06a7f9c6a46d3911bdd2dbf70 to your computer and use it in GitHub Desktop.
Save ped7g/b3d6fdc06a7f9c6a46d3911bdd2dbf70 to your computer and use it in GitHub Desktop.
"cauldron" logo drawn by attributes for ZX Spectrum, size coding optimization, 40 bytes
; ZX SPECTRUM code, sjasmplus syntax: https://github.com/z00m128/sjasmplus
; alternative code for Allan Turvey post: https://www.facebook.com/groups/z80asm/posts/1982356728824612/
ORG $8000-8
DEVICE ZXSPECTRUM48, $ - 1
size_start:
dg ...#.###
dg ....####
dg ...#####
dg ...#####
dg ..######
dg .#.#####
dg .##.####
dg ...#####
cauldrondata: ; points at end of data
cauldronlogo:
push bc
ASSERT $00 == low cauldronlogo ; C should be zero here ; or do ld (iy+..),0 for +1 byte size
ld (iy+$5C8D-$5C3A),c ; set ATTR_P[$5C8D] to 0
call $0DAF ; CL_ALL clear screen from ZX48 ROM
pop hl ; HL = cauldrondata
ld de,$5910
.row_loop:
dec hl
ld b,d
ld c,e
.dot_loop:
rrc (hl) ; read bitmap dot into carry flag
sbc a,a ; A = $00 for blank dot, $FF for filled dot
dec c ; set attributes in symmetric way
ld (bc),a
ld (de),a
inc e
bit 3,e
jr z,.dot_loop ; 8x loop for 8 bits (E goes %xxx1'0000 .. %xxx1'1000)
ld a,e
add a,$20-8
ld e,a
jr nc,.row_loop
ret
DISPLAY "Size: ",/D,$-size_start
SAVESNA "fb_cauldron.sna", cauldronlogo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment