-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added egg generation, drawing and eating, improved snake turning
- Loading branch information
1 parent
82a0249
commit d22fb95
Showing
19 changed files
with
325 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
|
||
*.db | ||
Event Assembler/ | ||
*.sav |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
@echo off | ||
|
||
SET startDir=C:\devkitPro\devkitARM\bin\ | ||
|
||
@rem Assemble into an elf | ||
SET as="%startDir%arm-none-eabi-as" | ||
%as% -g -mcpu=arm7tdmi -mthumb-interwork %1 -o "%~n1.elf" | ||
|
||
pause |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
.thumb | ||
|
||
push {lr} | ||
|
||
ldr r3,=drawTile | ||
mov lr,r3 | ||
ldr r3,=#0x02000000 | ||
ldrh r2,[r3,#6] | ||
cmp r2,#0 | ||
beq End | ||
ldrb r2,[r3,#6] @x | ||
ldrb r3,[r3,#7] @y | ||
mov r0,#0 | ||
ldr r1,=#0x02000000 | ||
ldrb r1,[r1,#0x14] | ||
.short 0xF800 | ||
|
||
End: | ||
pop {r0} | ||
bx r0 |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
.thumb | ||
|
||
ldr r0,=#0x02000000 | ||
ldrh r1,[r0,#0x6] @egg coords | ||
ldrh r2,[r0] @size | ||
lsl r2,#1 | ||
add r2,#0x20 | ||
sub r2,#2 | ||
ldrh r2,[r0,r2] @head coords | ||
cmp r1,r2 | ||
bne End | ||
mov r3,#0 | ||
strh r3,[r0,#0x6] @destroy egg | ||
ldrh r3,[r0,#0xE] | ||
add r3,#1 @add size | ||
strh r3,[r0,#0xE] | ||
|
||
End: | ||
bx lr |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
.thumb | ||
|
||
push {lr} | ||
|
||
ldr r0,=#0x02000000 | ||
ldrh r0,[r0,#6] @egg coords | ||
cmp r0,#0 | ||
bne End @if egg already exists, do nothing | ||
|
||
@generate egg color and save it | ||
ldr r0,=rng | ||
mov lr,r0 | ||
.short 0xF800 | ||
mov r1,#1 | ||
and r0,r1 | ||
ldr r1,=#0x02000000 | ||
add r0,#20 | ||
str r0,[r1,#0x14] | ||
|
||
@make a list of all tiles that are available | ||
mov r0,#0 | ||
mov r1,#2 | ||
mov r2,#0 @ammount of tiles in the list*2 | ||
b loopnoadd | ||
loop: | ||
add r0,#1 | ||
loopnoadd: | ||
cmp r0,#0x1E | ||
bne dontincreasey | ||
mov r0,#0 | ||
add r1,#1 | ||
dontincreasey: | ||
cmp r1,#0x14 | ||
beq endloop | ||
@check if the coords conflict with the body, if they do, do not add them to the list | ||
push {r0-r2} | ||
ldr r2,=bonkSnake | ||
mov lr,r2 | ||
.short 0xF800 | ||
mov r3,r0 | ||
pop {r0-r2} | ||
cmp r3,#1 | ||
beq loop | ||
ldr r3,=#0x02005000 | ||
strb r0,[r3,r2] | ||
add r2,#1 | ||
strb r1,[r3,r2] | ||
add r2,#1 | ||
b loop | ||
endloop: | ||
|
||
ldr r0,=#0x02000000 | ||
strh r2,[r0,#0x16] @save length | ||
|
||
@choose a tile from the list | ||
ldr r0,=rng | ||
mov lr,r0 | ||
.short 0xF800 | ||
|
||
ldr r3,=#0x02000000 | ||
ldrh r1,[r3,#0x16] | ||
lsr r1,#1 | ||
add r1,#1 | ||
swi #6 @divide random number by length/2 +1 | ||
lsl r1,#1 | ||
ldr r3,=#0x02005000 | ||
ldrh r0,[r3,r1] | ||
|
||
@store coords | ||
ldr r3,=#0x02000000 | ||
strh r0,[r3,#6] | ||
|
||
End: | ||
pop {r0} | ||
bx r0 |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
.thumb | ||
|
||
@r0 = x, r1 = y | ||
|
||
lsl r1,#8 | ||
add r0,r1 @xy | ||
|
||
ldr r2,=#0x02000000 | ||
ldrh r3,[r2] | ||
add r2,#0x20 | ||
lsl r3,#1 | ||
add r3,r2 | ||
|
||
loop: | ||
cmp r2,r3 | ||
beq nobonk | ||
ldrh r1,[r2] | ||
cmp r1,r0 | ||
beq bonk | ||
add r2,#2 | ||
b loop | ||
|
||
bonk: | ||
mov r0,#1 | ||
b End | ||
|
||
nobonk: | ||
mov r0,#0 | ||
|
||
End: | ||
bx lr |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Oops, something went wrong.