RosettaCodeData/Task/Image-noise/Z80-Assembly/image-noise-2.z80
2026-04-30 12:34:36 -04:00

19 lines
665 B
Z80 Assembly

TV_Static_FX:
;this code runs every time the game boy finishes drawing one row of pixels, unless the interrupt is disabled as described above.
push hl
push af
ld hl,(COSINE_INDEX)
inc (hl)
ld a,(hl)
callpoint:
call cos ;<--- SMC, gets changed to "CALL SIN" by main game loop when bit 4 of frametimer equals 0, and back to
;"CALL COS" when bit 4 of frametimer equals 1.
; returns cos(A) into A
LD (&FF43),A ;output cos(frametimer) to horizontal scroll register
done_TV_Static_FX:
pop af
pop hl
reti ;return to main program
TV_Static_FX_End: