diff --git a/ASM/Snake/moveSnake.elf b/ASM/Snake/moveSnake.elf index 9c0f493..bb908e9 100644 Binary files a/ASM/Snake/moveSnake.elf and b/ASM/Snake/moveSnake.elf differ diff --git a/ASM/Snake/moveSnake.s b/ASM/Snake/moveSnake.s index 9f4754f..4aea9d9 100644 --- a/ASM/Snake/moveSnake.s +++ b/ASM/Snake/moveSnake.s @@ -185,7 +185,6 @@ b End doGrow: ldrh r3,[r4] add r3,#1 -strh r3,[r4] @check if the snake is going to hit herself push {r0-r3} mov r0,r1 @@ -204,6 +203,7 @@ strh r0,[r4,#0x1A] ldrh r0,[r4,#0x16] sub r0,#1 strh r0,[r4,#0x16] +strh r3,[r4] b End End: diff --git a/ASM/mainLoop.elf b/ASM/mainLoop.elf index 8cd1206..288d916 100644 Binary files a/ASM/mainLoop.elf and b/ASM/mainLoop.elf differ diff --git a/ASM/mainLoop.s b/ASM/mainLoop.s index 85c87ab..731a487 100644 --- a/ASM/mainLoop.s +++ b/ASM/mainLoop.s @@ -253,6 +253,13 @@ b skipSnake runSnake: strh r3,[r0,#0x18] @update counter +@check for win +ldrb r3,[r0,#0xD] +cmp r3,#0xFE +bne notWIN1 +b WIN +notWIN1: + @check for game over ldrb r3,[r0,#0xD] cmp r3,#0xFF @@ -272,9 +279,16 @@ ldr r0,=moveSnake mov lr,r0 .short 0xF800 -@check for game over +@check for win ldr r0,=#0x02000000 ldrb r3,[r0,#0xD] +cmp r3,#0xFE +bne notWIN2 +b WIN +notWIN2: + +@check for game over +ldrb r3,[r0,#0xD] cmp r3,#0xFF beq gameover @@ -443,3 +457,7 @@ ldr r3,=#0x04000100 ldrh r3,[r3,#4] @counter strh r3,[r0,#0x18] @counter last time logic was ran b main + +WIN: +swi #5 +b WIN diff --git a/rom.gba b/rom.gba index 6274b4d..161c7dd 100644 Binary files a/rom.gba and b/rom.gba differ