Код:
;69 bytes -2
device zxspectrum128
ORG #6000
begin
matrix:
db 0*8,8*8,2*8,10*8
db 12*8,4*8,14*8,6*8
db 3*8,11*8,1*8,9*8
db 15*8,7*8,13*8,5*8
gench:
; For y=0 To 128;;;;;+8
; For x=0 To 7
; i=x&3
; j=y&3
; II=y>>3
; If II <= D(i,j)
; Plot(x,y,0)
; Else
; Plot(y,x,RGB(255,255,255))
; EndIf
; Next x
; Next y
ld hl,$4000
ld b,$80;bit weight
ld e,0;y
for_y:
ld d,0;x
push hl
for_x:
push hl
; i=x&3
; j=y&3
ld a,e;y
and 3
ld c,a
add a,a
add a,a;c
ld c,a
ld a,d;x
and 3
add a,c
ld l,a
ld h,matrix/256
ld a,e;II=y>>3
; and %11111000
; rra:rra:rra
cp (hl); If II <= D(i,j)
pop hl
;; jr z,plot
jr c,noplot
plot:
ld a,b:or (hl):ld (hl),a
noplot:
inc h
inc d
bit 3,d:jr z,for_x
pop hl
or a:rrc b:jr nc,nonextp
inc l
nonextp:
inc e:bit 7,e:jr z,for_y
jr $
end
display /d,end-begin
savesna "!gc.sna",gench;;begin