# HG changeset patch # User John Tsiombikas # Date 1547088462 -7200 # Node ID d63782badb6b97584929ebcdd3f7b17096419ec4 # Parent cacfa0888410a6c15c6a1e78e3c8addb5336698b nicer distortion diff -r cacfa0888410 -r d63782badb6b Makefile --- a/Makefile Thu Jan 10 04:16:47 2019 +0200 +++ b/Makefile Thu Jan 10 04:47:42 2019 +0200 @@ -19,8 +19,12 @@ clean: rm -f $(obj) $(bin) $(img) +.PHONY: run +run: $(img) + sameboy $< + logo.tiles: logo.png rgbgfx -T -u -o $@ $< -sin.inc: +sin.inc: gensine ./gensine >$@ diff -r cacfa0888410 -r d63782badb6b test.asm --- a/test.asm Thu Jan 10 04:16:47 2019 +0200 +++ b/test.asm Thu Jan 10 04:47:42 2019 +0200 @@ -46,17 +46,52 @@ xor a, a ld b, a + ldh a, [REG_LY] - add a, d + add a, d ; add frame number ld c, a ld hl, sintab - add hl, bc ; hl points to sin value (0-64) + add hl, bc ; hl now points to the sine value - ld a, yoffs_center - add a, [hl] + ld a, [hl] + + ; add a half-octave sine + ld e, a ; save first sine to e + sla d + ld a, [REG_LY] + sla a + add a, d + ld c, a + srl d + + ld hl, sintab + add hl, bc + ld a, [hl] + sra a + add a, e ; add previously saved sine + + add a, yoffs_center ldh [REG_SCY], a + ; do something for SCX too + ld a, d + sla a + ld d, a + + ldh a, [REG_LY] + add a, 32 + add a, d ; add frame number + ld c, a + + ld hl, sintab + add hl, bc + + ld a, [hl] + sra a + add a, xoffs_center + ldh [REG_SCX], a + ; done, wait until we're out of hsync .wait_endhsync: ldh a, [REG_STAT]