; ; Simple starfield effect ; stars_update: ld x, stars stars_update_loop: ld y, [a : x] inc x bo inc a ld b, [a : x] ; is the end of list? cmp b, 0xff bz ret push a push x ; erase old ld x, 0 ld [b : y], x ld x, [sp + 0] ; update address inc x bo inc a push x ld x, [a : x] stars_update_addr: add y, 128 bo inc b cmp b, 0xfe bnz jmp stars_no_wrap cmp y, 0x80 bc ld b, 0xbf ; add some randomness push a push x push b call rnd pop b pop x pop a stars_no_wrap: dec x bnz jmp stars_update_addr pop x ; draw new: color inc x bo inc a ld x, [a : x] ld [b : y], x pop x pop a ; save new address ld [a : x], b dec x bo dec a ld [a : x], y ; next star add x, 4 bo inc a jmp stars_update_loop