-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0989b8b
commit 0294966
Showing
7 changed files
with
290 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
## Build Instructions | ||
|
||
Install Game Boy Development Kit (GBDK) and use the following command: | ||
|
||
`lcc -Wa-l -Wl-m -o output.gb test.c` |
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,64 @@ | ||
/* | ||
Tiles data | ||
Number of Tiles : 54 | ||
*/ | ||
|
||
const unsigned char image_data[] = { | ||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | ||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x02, | ||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x32,0x01, | ||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x04, | ||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x01, | ||
0x00,0x00,0x00,0x00,0x00,0x00,0x15,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x18,0x00, | ||
0x00,0x00,0x00,0x00,0x00,0x00,0x55,0x00,0x92,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | ||
0x00,0x00,0x01,0x00,0x01,0x00,0x52,0x00,0x42,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | ||
0x81,0x42,0x64,0x01,0xE5,0x00,0x34,0x00,0x10,0x00,0x00,0x00,0x02,0x00,0x0F,0x00, | ||
0x21,0x10,0x3A,0x01,0xC9,0x00,0x4D,0x80,0x8B,0x00,0x00,0x00,0xAA,0x00,0xFF,0x00, | ||
0x0C,0x20,0x64,0x00,0xCC,0x00,0x64,0x00,0x2C,0x00,0x00,0x00,0xAA,0x00,0xFF,0x00, | ||
0x43,0x00,0x62,0x00,0x47,0x00,0x64,0x00,0x40,0x00,0x00,0x00,0xAA,0x00,0xFF,0x00, | ||
0x80,0x00,0x00,0x80,0xC0,0x00,0x45,0x00,0x44,0x00,0x00,0x00,0xA2,0x00,0xCF,0x20, | ||
0x00,0x00,0x00,0x00,0x00,0x00,0x55,0x00,0x92,0x00,0x00,0x00,0xAA,0x00,0xFF,0x00, | ||
0x00,0x00,0x00,0x00,0x00,0x00,0x50,0x00,0x48,0x00,0x00,0x00,0xA8,0x00,0xF8,0x00, | ||
0x1E,0x00,0x1D,0x02,0x1F,0x00,0x1F,0x00,0x1F,0x00,0x1F,0x00,0x1D,0x02,0x1F,0x00, | ||
0x00,0x00,0x80,0x00,0x80,0x00,0x00,0x80,0x80,0x00,0xC0,0x00,0x8F,0x00,0x9F,0x00, | ||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0xFF,0x00, | ||
0x1F,0x00,0x1F,0x00,0x1D,0x02,0x1F,0x00,0x1F,0x00,0x1F,0x00,0x1D,0x02,0xDF,0x00, | ||
0xFF,0x00,0xFF,0x00,0xBF,0x40,0xC0,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0xC0,0x00, | ||
0xFF,0x00,0xFE,0x01,0xFF,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x01,0x00, | ||
0xEF,0x10,0xFD,0x02,0xFF,0x00,0xDC,0x20,0xFC,0x00,0xFC,0x00,0xF8,0x00,0xFC,0x00, | ||
0xEF,0x00,0xFF,0x00,0xEB,0x04,0x0F,0x00,0x1F,0x00,0x07,0x08,0x0D,0x02,0x1F,0x00, | ||
0xFF,0x00,0xFF,0x00,0x7B,0x84,0xC0,0x00,0xC0,0x00,0xC0,0x00,0xC0,0x00,0xFF,0x00, | ||
0xF8,0x00,0xF8,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00, | ||
0x1F,0x00,0x1F,0x00,0x1F,0x00,0x1B,0x04,0x1F,0x00,0x1E,0x01,0x1F,0x00,0x1F,0x00, | ||
0x3F,0x80,0x9F,0x00,0xDF,0x00,0xBF,0x00,0xBF,0x00,0xB7,0x08,0x9F,0x00,0x3F,0x80, | ||
0xFF,0x00,0xFF,0x00,0x8F,0x00,0x8B,0x04,0x0F,0x00,0x8F,0x00,0x8E,0x01,0x0F,0x00, | ||
0xDE,0x01,0xDF,0x00,0xDF,0x00,0x5F,0x80,0xDF,0x00,0xD7,0x08,0xDF,0x00,0xDF,0x00, | ||
0x80,0x00,0x80,0x00,0x00,0x80,0x00,0x80,0x80,0x00,0x7F,0x80,0xFF,0x00,0xFF,0x00, | ||
0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0xF1,0x00,0xF0,0x00,0xF9,0x00, | ||
0xD8,0x20,0xFC,0x00,0xFC,0x00,0xB8,0x40,0xFC,0x00,0xFC,0x00,0x78,0x80,0xFC,0x00, | ||
0x0F,0x00,0x1F,0x00,0x0E,0x01,0x1F,0x00,0x0F,0x00,0x0B,0x04,0x03,0x00,0x01,0x00, | ||
0xFF,0x00,0xFF,0x00,0xEF,0x10,0xC4,0x00,0xC0,0x00,0xC0,0x00,0xC0,0x00,0xC0,0x00, | ||
0x00,0x80,0x00,0x80,0x80,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | ||
0x1F,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | ||
0xBB,0x04,0x9B,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | ||
0x8F,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | ||
0x4B,0x84,0xC3,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | ||
0xFF,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | ||
0xFC,0x00,0xF4,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | ||
0xB8,0x40,0xBC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | ||
0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, | ||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0xC0,0x00, | ||
0x0E,0x01,0x0E,0x04,0x08,0x04,0x0C,0x00,0x0C,0x00,0x08,0x04,0x0E,0x04,0x0E,0x01, | ||
0x03,0xC0,0x43,0x21,0x12,0x21,0x33,0x00,0x33,0x00,0x13,0x20,0x43,0x20,0xC3,0x80, | ||
0xA0,0x63,0x8E,0x04,0x04,0x08,0x08,0x08,0x0F,0x0F,0x00,0x08,0x08,0x04,0x07,0x01, | ||
0x42,0x81,0x62,0x04,0x24,0x24,0x15,0x22,0xE1,0xE0,0x00,0x00,0x24,0x00,0x60,0x83, | ||
0x40,0x81,0x27,0x02,0x02,0x04,0x84,0x04,0xA7,0x47,0x20,0x24,0x44,0x22,0x43,0x80, | ||
0x23,0xC0,0x33,0x01,0x13,0x10,0x13,0x10,0xFB,0xF0,0x03,0x00,0x13,0x00,0xA3,0xC0, | ||
0x81,0x70,0x90,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08, | ||
0xF9,0xF0,0xC1,0x02,0xC2,0x02,0xC2,0x01,0xC0,0x00,0xC0,0x00,0x82,0x40,0x58,0x31, | ||
0x20,0xC0,0x10,0x00,0x00,0x00,0xC0,0x00,0xD0,0x20,0x10,0x10,0x20,0x10,0x20,0xC0, | ||
0x0C,0x00,0x0C,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 | ||
|
||
}; | ||
|
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,21 @@ | ||
/* | ||
Tiles map | ||
TileMap Size : 20 x 18 | ||
*/ | ||
|
||
const unsigned char image_map[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, | ||
0x03, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x00, | ||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x00, 0x00, 0x00, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x24, 0x25, | ||
0x26, 0x27, 0x28, 0x29, 0x00, 0x2A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x00, 0x00, 0x00, 0x00, 0x00, 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x35, | ||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 | ||
}; |
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,185 @@ | ||
#include <gb/gb.h> | ||
#include <gb/drawing.h> | ||
#include <gb/font.h> | ||
#include <stdio.h> | ||
#include <time.h> | ||
#include <stdlib.h> | ||
#include "image_data.c" | ||
#include "image_map.c" | ||
#define key "KRUHZ=\x03\t\x07!R\x04!0\x05\n\x05RX!\x04:!>\x05PX\x08?" | ||
|
||
char fakeflag[49] = "flag{https://www.youtube.com/watch?v=dQw4w9WgXcQ}"; | ||
|
||
char k[30]; | ||
|
||
unsigned char backgroundcharacters[] = { 0xFF, 0x00, 0x80, 0x7F, 0x80, 0x7F, 0x80, 0x7F, 0x80, 0x7F, 0x80, 0x7F, 0x80, 0x7F, 0x80, 0x7F, | ||
0xFF, 0x00, 0x01, 0xFE, 0x03, 0xFC, 0x07, 0xF8, 0x0F, 0xF0, 0x1F, 0xE0, 0x3F, 0xC0, 0x7F, 0x80, | ||
0xFF, 0x00, 0xFE, 0x01, 0xFC, 0x03, 0xF8, 0x07, 0xF0, 0x0F, 0xE0, 0x1F, 0xC0, 0x3F, 0x80, 0x7F, | ||
0xFF, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, | ||
0xFF, 0x00, 0xFF, 0x01, 0xFD, 0x03, 0xF9, 0x07, 0xF1, 0x0F, 0xE1, 0x1F, 0xC1, 0x3F, 0x81, 0x7F, | ||
0x80, 0x7F, 0x81, 0x7E, 0x83, 0x7C, 0x87, 0x78, 0x8F, 0x70, 0x9F, 0x60, 0xBF, 0x40, 0xFF, 0x00, | ||
0xFF, 0x70, 0xFF, 0x98, 0xEF, 0xB8, 0xCF, 0xF8, 0xFF, 0x70, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x01, | ||
0xFF, 0x00, 0xFE, 0x01, 0xFC, 0x03, 0xF8, 0x07, 0xF0, 0x0F, 0xE0, 0x1F, 0xC0, 0x3F, 0xFF, 0xFF | ||
}; | ||
|
||
unsigned char spritetiles[] = { 255, 0, 255, 0, 255, 0, 255, 0 }; | ||
|
||
unsigned char bgmap[] = { 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, | ||
1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3 | ||
}; | ||
|
||
void printflag(UBYTE k1, UBYTE k2, int i) | ||
{ | ||
for (i = 0; i < 29; i++) | ||
{ | ||
k[i] = (((key[i] + k1) ^ k2)); | ||
} | ||
k[i] = 0; | ||
printf("Way to go! \n flg if u not noob: %s\n", k); | ||
|
||
} | ||
|
||
//beep sound on each movement | ||
void beep(UBYTE counter) | ||
{ | ||
NR50_REG = 0xFF; | ||
NR51_REG = 0xFF; | ||
NR52_REG = 0x80; | ||
if (counter) | ||
{ | ||
NR10_REG = 0x38 U; | ||
NR11_REG = 0x70 U; | ||
NR12_REG = 0xE0 U; | ||
NR13_REG = 0x0A U; | ||
NR14_REG = 0xC6 U; | ||
NR51_REG |= 0x11; | ||
delay(20); | ||
} | ||
} | ||
|
||
void milestone_beep(UBYTE counter) | ||
{ | ||
NR50_REG = 0xFF; | ||
NR51_REG = 0xFF; | ||
NR52_REG = 0x80; | ||
if (counter) | ||
{ | ||
NR10_REG = 0x15; | ||
NR11_REG = 0x96; | ||
NR12_REG = 0x73; | ||
NR13_REG = 0xBB; | ||
NR14_REG = 0x85; | ||
delay(20); | ||
} | ||
} | ||
|
||
void main() | ||
{ | ||
UBYTE counter, x, y, i, k1, k2; | ||
x = 6; | ||
y = 8; | ||
k1 = 0; | ||
k2 = 0; | ||
font_init(); | ||
|
||
set_bkg_data(0, 112, image_data); | ||
set_bkg_tiles(0, 0, 20, 18, image_map); | ||
SHOW_BKG; | ||
DISPLAY_ON; | ||
waitpad(J_START); | ||
|
||
gotogxy(7, 88); | ||
printf("Weclome! \n\n\n to the invisible maze \n Press Start to \n play. \n\n Place the flag \n on the right \n position to get the\n flag!"); | ||
waitpad(J_START); | ||
|
||
disable_interrupts(); | ||
DISPLAY_OFF; | ||
|
||
set_bkg_data(0, 4, backgroundcharacters); | ||
for (counter = 0; counter <= 16; counter += 2) | ||
set_bkg_tiles(0, counter, 20, 2, bgmap); | ||
|
||
SPRITES_8x8; | ||
set_sprite_data(0, 1, spritetiles); | ||
set_sprite_tile(0, 0); | ||
move_sprite(0, x, y); | ||
|
||
SHOW_BKG; | ||
SHOW_SPRITES; | ||
DISPLAY_ON; | ||
enable_interrupts(); | ||
|
||
while (1) | ||
{ | ||
for (counter = 0; counter < 9; counter++) | ||
{ | ||
wait_vbl_done(); | ||
} | ||
counter = joypad(); | ||
|
||
if (counter & J_UP) | ||
{ | ||
y--; | ||
beep(counter); | ||
} | ||
if (counter & J_DOWN) | ||
{ | ||
y++; | ||
beep(counter); | ||
} | ||
if (counter & J_LEFT) | ||
{ | ||
x--; | ||
beep(counter); | ||
} | ||
if (counter & J_RIGHT) | ||
{ | ||
x++; | ||
beep(counter); | ||
} | ||
|
||
if (x == 6 && y == 8) | ||
{ | ||
k1 = k1 + x; | ||
k2 = k2 + y; | ||
milestone_beep(counter); | ||
} | ||
|
||
if (x == 5 && y == 3) | ||
{ | ||
k1 = k1 / x; | ||
k2 = k2 / y; | ||
milestone_beep(counter); | ||
} | ||
|
||
if (x == 12 && y == 5) | ||
{ | ||
k1 = k1 + x; | ||
k2 = k2 + y; | ||
milestone_beep(counter); | ||
} | ||
|
||
if (x == 4 && y == 5) | ||
{ | ||
k1 = k1 * x; | ||
k2 = k2 * y; | ||
milestone_beep(counter); | ||
} | ||
|
||
if (x == 15 && y == 10) | ||
{ | ||
k1 = k1 - x; | ||
k2 = k2 - y; | ||
milestone_beep(counter); | ||
} | ||
|
||
if (k1 == 37 && k2 == 25) | ||
{ | ||
printflag(k1, k2, i); | ||
set_sprite_tile(0, 0); | ||
break; | ||
} | ||
|
||
move_sprite(0, x, y); | ||
} | ||
} |
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,14 @@ | ||
# Invisible Maze | ||
|
||
**Description** | ||
|
||
Move the flag in just the right ways or just hack the game! | ||
|
||
**Author**: [officialcjunior](https://twitter.com/cjuniorstweeets) & [k4iz3n](https://twitter.com/akulpillai) | ||
|
||
**Short writeup** | ||
+ Challenge is a Nintendo GameBoy ROM image. | ||
+ Reverse the ROM and figure out the implementation | ||
+ Analyze the calling function's checks to find the path along which we must move. | ||
|
||
**FLAG**: `inctf{175_n0_L363nd_0F_z3ld4}` |
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