<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wikidot="http://www.wikidot.com/rss-namespace">

	<channel>
		<title>Comments for page &quot;Program Ideas&quot;</title>
		<link>http://z80-heaven.wikidot.com/forum/t-135650/program-ideas</link>
		<description>Posts in the discussion thread &quot;Program Ideas&quot;</description>
				<copyright></copyright>
		<lastBuildDate>Fri, 13 Mar 2026 07:17:35 +0000</lastBuildDate>
		
					<item>
				<guid>http://z80-heaven.wikidot.com/forum/t-135650#post-1732032</guid>
				<title>Re: Program Ideas</title>
				<link>http://z80-heaven.wikidot.com/forum/t-135650/program-ideas#post-1732032</link>
				<description></description>
				<pubDate>Sat, 16 Mar 2013 14:28:42 +0000</pubDate>
				<wikidot:authorName>Xeda Elnara</wikidot:authorName>				<wikidot:authorUserId>595803</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>I started on a snake game that may or may not use some advanced coding techniques. It isn't finished, but it has full collision detection and the code for eating fruit is added, just not the code for adding fruit. The speed on this is a bit outrageous, but it gives an idea of what assembly can do. At full speed, it gets over 2000 frames per second, so I had to add in code to really slow it down:</p> <div class="code"> <pre><code> ld a,8 ei HaltLoop: halt dec a jr nz,HaltLoop di</code></pre></div> <br /> That delay cuts it down to 17.5 FPS, but here is a screenshot where the delay is removed a little at a time until it is about 1/15th the max speed:<br /> <img src="http://img.removedfromgame.com/imgs/SnakeEx0.gif" alt="SnakeEx0.gif" class="image" /><br /> So now, I actually could add in fancy graphics and shtuff, which I tend to avoid. A snake that has a chomping mouth would be cool and you could watch it swallow its food as it grows. <p>The code so far is:</p> <div class="code"> <pre><code>#include &quot;ti83plus.inc&quot; #define progStart $9D95 .org progStart-2 .db $BB,$6D gBufMSB = 93h gBufLSB = 40h di ld bc,3 xor a ld hl,plotSScreen ld (hl),a inc hl djnz $-2 dec c jr nz,$-5 bcall(_GrBufCpy ld hl,8000h ld b,32 ld (hl),c inc l djnz $-2 SnakeLoop: ld hl,8000h ld d,l ld e,l ld b,(hl) inc l ld c,(hl) ld a,8 ei \ halt \ di dec a \ jr nz,$-4 call PutTile4x4 .db 01h ;ld bc,** SnakeSize: .dw 30 ld d,80h ld hl,8002h ldir push de .db 21h ;ld hl,** smc_BufOffset: .dw plotSScreen+12 .db 01h ;ld bc,** smc_Coord: .dw 0 ld de,48 .db 3Eh ;ld a,* direction: .db 0 or a jr nz,CheckLeft inc c bit 4,c jr z,$+4 Exit: pop de ret add hl,de jp CheckCollide CheckLeft: dec a jr nz,CheckRight dec b jp m,Exit bit 0,b jr z,CheckCollide dec hl jr CheckCollide CheckRight: dec a jr nz,CheckUp inc b ld a,b cp 24 jr z,Exit bit 0,b jr nz,CheckCollide inc hl jp CheckCollide CheckUp: dec c jp m,Exit sbc hl,de CheckCollide: ld (smc_BufOffset),hl ld (smc_Coord),bc ld a,(hl) bit 0,b jr z,$+8 and 3 srl a jr $+6 and $C0 sla a jr c,Exit DrawTile: pop hl jr z,$+12 inc l inc l ld a,(snakesize) inc a inc a ld (snakesize),a ld (hl),b inc l ld (hl),c ld de,6996h ld a,$FC out (1),a call PutTile4x4 in a,(1) bit 6,a ret z ld b,a ld a,(direction) bit 0,b jr nz,$+3 xor a bit 1,b jr nz,$+4 ld a,1 bit 2,b jr nz,$+4 ld a,2 bit 3,b jr nz,$+4 ld a,3 ld (direction),a jp SnakeLoop PutTile4x4: ld a,c \ cp 16 \ ret nc ld a,b \ cp 24 \ ret nc ld b,c push bc ld b,0 \ ld h,b \ ld l,c add hl,hl \ add hl,bc \ add hl,hl add hl,hl \ add hl,hl \ add hl,hl rra ld c,a set 5,a out (16),a ex af,af' ld b,gBufMSB set 6,c \ add hl,bc ex af,af' sbc a,a \ ld b,a pop af add a,a add a,a add a,80h inc b jr z,PutRight PutLeft: add a,3 out (16),a ld bc,36 add hl,bc ld bc,-12 ld a,4 ex (sp),hl ex (sp),hl out (16),a ld a,1 L4x4: push af rrd ld (hl),e rld push af ld a,(hl) out (17),a pop af add hl,bc push af rld ld a,d ld d,e ld e,a pop af rrd ld a,(hl) out (17),a pop af add hl,bc dec a jr z,L4x4 ret PutRight: out (16),a ld bc,12 ld a,5 ex (sp),hl ex (sp),hl out (16),a ld a,1 R4x4: push af rld \ ld (hl),d \ rrd push af ld a,(hl) out (17),a pop af add hl,bc rrd ld a,d \ ld d,e \ ld e,a rld ld a,(hl) out (17),a add hl,bc pop af dec a jr z,R4x4 ret</code></pre></div> <p>Also, if you didn't notice, I like to use SMC a lot.</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://z80-heaven.wikidot.com/forum/t-135650#post-1729648</guid>
				<title>Program Ideas</title>
				<link>http://z80-heaven.wikidot.com/forum/t-135650/program-ideas#post-1729648</link>
				<description></description>
				<pubDate>Tue, 12 Mar 2013 19:21:45 +0000</pubDate>
				<wikidot:authorName>Xeda Elnara</wikidot:authorName>				<wikidot:authorUserId>595803</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>I might try some of these o.o Should we post ode? :D</p> 
				 	]]>
				</content:encoded>							</item>
				</channel>
</rss>