Snowflake by RMDA [web] | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||||||||||
|
popularity : 54% |
|||||||||||||
alltime top: #14921 |
|
|||||||||||||
|
||||||||||||||
added on the 2020-06-07 10:29:59 by hedning |
popularity helper
comments
Nice Snowflakes on ZX Speccy in 256b
rulez added on the 2020-06-07 10:46:52 by Queen_Luna
nice
source code:
Code:
device zxspectrum48
table equ #63
attr equ #5800
cycle equ 16
org #6214 ; decrease if add code (use cls ? #6214 : #6222)
begin_file: ; self-documenting code
start: push iy ; for returning to basic
ld c, 3
loop5: ld b, cycle
loop4: ld ix, fractal
push bc
call main
ld a, c
rra
call nc, main
ld a, (split+1)
add 128 ; left or right fractal
ld (split+1), a
ld a, (grain+1)
dec a
small dec a
ld (grain+1), a
ld ixl, 4
call main
ld a, c
rra
call c, main
pop bc
djnz loop4
xor a
ld (small), a
ld (flash), a ; disable blinking after first iteration
dec c
jr nz, loop5
pop iy
ret ; end
main: ld a,cycle
loop_i: dec a
ld iyl, a
ld b,cycle
loop_j: and %00010000 ; disable beeper - %00000000
out (#fe),a
ld a, b
dec a
ld iyh, a
flash rra
jr nc, grain
ld hl,attr ; ld hl,attr+#c3
ld de,attr + 1 ; ld de,attr+#c3 + 1
ld bc,768 - 1 ; ld bc,442 - 1
and %00000110
add %01000001 ; bright -> true
ld (hl),a
ldir
grain: ld a, 15
and %00001111
out (#fe),a
inc a
ld b, a
loop_k: push bc
dec b
ld a, b
add ixl
ld l, a
ld h, table
call coords ; (hl) -> de
ld bc, de ; b = ky, c = kx
ld a,iyh ;
ld l, a ;
call coords ; (hl) -> de
ld a, d ;
rla ;
rla ;
ld h, a ;
ld a, e ;
rla ;
rla ;
ld l, a ;
add hl, bc ;
ld bc, hl ; 4 * j + k
ld a, iyl ;
add ixl ;
ld l, a ;
ld h, table ;
call coords ; (hl) -> de
ld a, d ;
rla ;
rla ;
rla ;
rla ;
add b ;
ld d, a ; y -> b = 16 * i + 4 * j + k
ld a, e ;
rla ;
rla ;
rla ;
rla ;
add c ;
split: add 246 ;
ld e, a ; x -> c = 16 * i + 4 * j + k
call point ; D - y, E - x
pop bc
djnz loop_k
ld a, iyh
inc a
ld b, a
djnz loop_j
ld a, iyl
cp 0
jr nz, loop_i
ret
point: LD A,#AF ; fast point: D - y, E - x
SUB D
LD D,A
AND A
RRA
SCF
RRA
AND A
RRA
XOR D
AND #F8
XOR D
LD H,A
LD A,E
RLCA
RLCA
RLCA
XOR D
AND #C7
XOR D
RLCA
RLCA
LD L,A
LD A,E
AND #07
LD B,A
INC B
LD A,#FE
LOOP RRCA
DJNZ LOOP
LD B,#FF
XOR B
LD B,A
LD A,(HL)
XOR B
LD (HL),A
RET
coords: ld a, (hl)
and %00001111
ld d, a
ld a, (hl)
and %11110000
rra
rra
rra
rra
ld e, a
ret
org table * #100 ; table must start at #00
fractal db #22, #52, #55, #25
fracta2 db #31, #63, #46, #14
db #32, #53, #45, #24
db #33, #43, #44, #34
db #12, #26, #51, #65
end_file:
len_file equ end_file-begin_file
dope prod !
really good, love the sound of it as well
why you use:
?
Code:
point: LD A,#AF ; fast point: D - y, E - x
SUB D
LD D,A
?
now that is sick!
nice intro :) ...some quick hack for 183 bytes, hope it helps somebody to dive into z80 sizecoding, havn't time dig it more, sorry ;)
Code:
device zxspectrum48
attr equ #5800
cycle equ 16
org #805d ; decrease if add code (use cls ? #6214 : #6222)
begin_file: ; self-documenting code
start:
; push iy ; for returning to basic
ld c, 3
loop5: ld b, cycle
loop4:
; ld ix, fractal
push bc
ld ixl,#ff
call main
; ld a, c
; rra
call nc, main
; ld a, (split+1)
ld hl,split+1
ld a,(hl)
add 128 ; left or right fractal
ld (hl),a
; ld (split+1), a
; ld a, (grain+1)
; ld hl,grain+1
ld l,0+(grain+1)%256
dec (hl) ;a
small dec (hl) ;a ;-------changing command
; ld (grain+1), a
; ld ixl, 4
ld ixl,#03
call main
; ld a, c
; rra
call c, main
pop bc
djnz loop4
xor a
ld (small), a
ld (flash), a ; disable blinking after first iteration
dec c
jr nz, loop5
; pop iy
; ret ; end
coords:
ex de,hl
ld l,a
ld h,table
ld a, (hl)
and %00001111
; ld d, a
; xor (hl)
; ld a, (hl)
; and %11110000
ld l,(hl)
ld h,a
xor l
rra
rra
rra
rra
; ld e, a
; ex de,hl
ld l,a
ret
main:
; ld a,cycle
exx
ld c,cycle
loop_i:
; dec a
ld b,cycle
; ld iyl, a
; ld b,cycle
loop_j:
and %00010000 ; disable beeper - %00000000
out (#fe),a
; ld a, b
; dec a
dec b
ld a,b
exx
; ld iyh, a
flash rra ;-------changing command
jr nc, grain
ld hl,attr ; ld hl,attr+#c3
ld de,attr + 1 ; ld de,attr+#c3 + 1
; ld bc,768 - 1 ; ld bc,442 - 1
ld b,#03 ;but be care with printer buffer 23296/#5b00
and %00000110
add %01000001 ; bright -> true
ld (hl),a
ldir
;can do -2b, but maybe some slow:
; ld h,#5b
; ld (hl),a
; ld c,l ;c=0 after exit
; dec hl
; bit 3,h
; jr nz,$-5
;c=0
grain:
ld a, 15 ;-------changing value
and %00001111
out (#fe),a
inc a
ld b, a
loop_k:
push bc
; dec b
ld a, b
add ixl
; ld l, a
; ld h, table
call coords ; (hl) -> de
; ld bc, de ; b = ky, c = kx
; ld a,iyh ;
exx
ld a,b
exx
; ld l, a ;
call coords ; (hl) -> de
; ld a, d ;
; rla ;
; rla ;
; ld h, a ;
; ld a, e ;
; rla ;
; rla ;
; ld l, a ;
; add hl, bc ;
add hl,hl
add hl,hl
add hl,de
; ld bc, hl ; 4 * j + k
; ld a, iyl ;
; add ixl ;
exx
ld a,c
exx
add a,ixl
; ld l, a ;
; ld h, table ;
call coords ; (hl) -> de
; ld a, d ;
; rla ;
; rla ;
; rla ;
; rla ;
; add b ;
; ld d, a ; y -> b = 16 * i + 4 * j + k
; ld a, e ;
; rla ;
; rla ;
; rla ;
; rla ;
; add c ;
add hl,hl
add hl,hl
add hl,hl
add hl,hl
add hl,de
; ld d,h
ld a,l
split: add 246 ;-------changing value
; ld e, a ; x -> c = 16 * i + 4 * j + k
ld c,a
; call point ; D - y, E - x
;point:
LD A,#AF ; fast point: D - y, E - x
; SUB D
sub h
; ld a,h ;if want Y-mirror and save 2 bytes, del [ld a,#af:sub h]
call #22b0
; LD D,A
; AND A
; RRA
; SCF
; RRA
; AND A
; RRA
; XOR D
; AND #F8
; XOR D
; LD H,A
; LD A,E
; RLCA
; RLCA
; RLCA
; XOR D
; AND #C7
; XOR D
; RLCA
; RLCA
; LD L,A
; LD A,E
; AND #07
LD B,A
INC B
; LD A,#FE
;LOOP RRCA
; DJNZ LOOP
; LD B,#FF
; XOR B
; LD B,A
; LD A,(HL)
; XOR B
ld a,#01
rrca
djnz $-1
xor (hl)
LD (HL),A
; RET
pop bc
djnz loop_k
; ld a, iyh
; inc a
; ld b, a
exx
inc b
djnz loop_j
; ld a, iyl
; cp 0
dec c
jr nz, loop_i
exx
ld a,c
rra
ret
if $/256*256<$
__LOST equ $/256*256+256-$
ds __LOST
display "__LOST: ",/d,__LOST
display "NEED ORG: ",/h,begin_file+__LOST
endif
table equ $/256
; org table * #100 ; table must start at #00
fractal db #22, #52, #55, #25
fracta2 db #31, #63, #46, #14
db #32, #53, #45, #24
db #33, #43, #44, #34
db #12, #26, #51, #65
end_file:
len_file equ end_file-begin_file
display "filesize: ",/d,len_file
SAVESNA "snowfl.sna",start
SAVEBIN "snowfl.bin",begin_file,len_file
Quote:
nice intro :) ...some quick hack for 183 bytes, hope it helps somebody to dive into z80 sizecoding, havn't time dig it more, sorry ;)
yep.
and i know this.
but also remember that @dpro code for the first time on Z80 for last 20 years :-)
Very nice 256 intro!
kool
It's nice.
Roxx!!
Nice! Good work!
Indeed!
thats quite interesting
cool
submit changes
if this prod is a fake, some info is false or the download link is broken,
do not post about it in the comments, it will get lost.
instead, click here !