|
|
@ -1,5 +1,15 @@ |
|
|
|
|
|
|
|
;; ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ |
|
|
|
|
|
|
|
;; ██░███░█▀▄▄▀█░▄▄▀█░▄▀█░██░▄▄██ |
|
|
|
|
|
|
|
;; ██░█░█░█░██░█░▀▀▄█░█░█░██░▄▄██ |
|
|
|
|
|
|
|
;; ██▄▀▄▀▄██▄▄██▄█▄▄█▄▄██▄▄█▄▄▄██ |
|
|
|
|
|
|
|
;; ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ |
|
|
|
|
|
|
|
;; The famous word puzzle |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
; Include hardware-specific constants |
|
|
|
|
|
|
|
; used all over the code. |
|
|
|
include "inc/constants.asm" |
|
|
|
include "inc/constants.asm" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; Game specific constants |
|
|
|
;; Game specific constants |
|
|
|
; Game states |
|
|
|
; Game states |
|
|
|
STATE_MENU EQU %00000001 |
|
|
|
STATE_MENU EQU %00000001 |
|
|
@ -22,28 +32,28 @@ TILE_ENTER EQU $1e |
|
|
|
TILE_RIGHT EQU $1f |
|
|
|
TILE_RIGHT EQU $1f |
|
|
|
TILE_MISPLACED EQU $20 |
|
|
|
TILE_MISPLACED EQU $20 |
|
|
|
TILE_WRONG EQU $21 |
|
|
|
TILE_WRONG EQU $21 |
|
|
|
TILE_SLASH EQU $22 |
|
|
|
TILE_ARROW EQU $22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
; Vertical blanking interrupt starting address |
|
|
|
; Vertical blanking interrupt starting address |
|
|
|
SECTION "ENTRY_VBLANK", ROM0[$0040] |
|
|
|
SECTION "ENTRY_VBLANK", ROM0[$0040] |
|
|
|
jp int_vblank |
|
|
|
jp int_vblank ; used for game logic updates |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
; LCDC status interrupt starting address |
|
|
|
; LCDC status interrupt starting address |
|
|
|
SECTION "ENTRY_LCDCS", ROM0[$0048] |
|
|
|
SECTION "ENTRY_LCDCS", ROM0[$0048] |
|
|
|
reti |
|
|
|
reti ; we don't use this interrupt |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
; Timer overflow interrupt starting address |
|
|
|
; Timer overflow interrupt starting address |
|
|
|
SECTION "ENTRY_TIMER", ROM0[$0050] |
|
|
|
SECTION "ENTRY_TIMER", ROM0[$0050] |
|
|
|
jp int_timer |
|
|
|
jp int_timer ; used for generating randomness |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
; Serial transfer completion interrupt starting address |
|
|
|
; Serial transfer completion interrupt starting address |
|
|
|
SECTION "ENTRY_SERIAL", ROM0[$0058] |
|
|
|
SECTION "ENTRY_SERIAL", ROM0[$0058] |
|
|
|
reti |
|
|
|
reti ; we don't use this interrupt |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
; Program starting address |
|
|
|
; Program starting address |
|
|
@ -54,7 +64,8 @@ SECTION "ENTRY_START", ROM0[$0100] |
|
|
|
|
|
|
|
|
|
|
|
SECTION "MAIN", ROM0[$0150] |
|
|
|
SECTION "MAIN", ROM0[$0150] |
|
|
|
main: |
|
|
|
main: |
|
|
|
; turn the screen off until everything is initialised |
|
|
|
; turn the screen off until everything is initialized, |
|
|
|
|
|
|
|
; or wild glitches will appear |
|
|
|
ld a, DISPLAY_OFF |
|
|
|
ld a, DISPLAY_OFF |
|
|
|
ld [LCD_CONTROL_REGISTER], a |
|
|
|
ld [LCD_CONTROL_REGISTER], a |
|
|
|
ld [LCD_STATUS_REGISTER], a |
|
|
|
ld [LCD_STATUS_REGISTER], a |
|
|
@ -99,7 +110,6 @@ main_loop: |
|
|
|
.within_vblank: |
|
|
|
.within_vblank: |
|
|
|
call update_oam |
|
|
|
call update_oam |
|
|
|
call read_input |
|
|
|
call read_input |
|
|
|
|
|
|
|
|
|
|
|
ld a, [current_state] |
|
|
|
ld a, [current_state] |
|
|
|
|
|
|
|
|
|
|
|
.in_menu: |
|
|
|
.in_menu: |
|
|
@ -156,7 +166,6 @@ include "inc/dict.asm" |
|
|
|
include "inc/input.asm" |
|
|
|
include "inc/input.asm" |
|
|
|
include "inc/guess.asm" |
|
|
|
include "inc/guess.asm" |
|
|
|
include "inc/hints.asm" |
|
|
|
include "inc/hints.asm" |
|
|
|
include "inc/search.asm" |
|
|
|
|
|
|
|
include "inc/messages.asm" |
|
|
|
include "inc/messages.asm" |
|
|
|
include "inc/wincondition.asm" |
|
|
|
include "inc/wincondition.asm" |
|
|
|
include "inc/interrupts.asm" |
|
|
|
include "inc/interrupts.asm" |
|
|
@ -165,7 +174,10 @@ include "inc/interrupts.asm" |
|
|
|
|
|
|
|
|
|
|
|
;; Game data |
|
|
|
;; Game data |
|
|
|
SECTION "DATA0", ROM0[$1000] |
|
|
|
SECTION "DATA0", ROM0[$1000] |
|
|
|
; Tiles |
|
|
|
|
|
|
|
|
|
|
|
;; Tiles |
|
|
|
|
|
|
|
; Small 8x8 pixel images, which are addressable |
|
|
|
|
|
|
|
; and will be used for sprite maps and objects. |
|
|
|
tiles_start: |
|
|
|
tiles_start: |
|
|
|
tile_null: |
|
|
|
tile_null: |
|
|
|
include "tiles/plain-null.asm" |
|
|
|
include "tiles/plain-null.asm" |
|
|
@ -185,15 +197,16 @@ tile_misplaced: |
|
|
|
include "tiles/sign-misplaced.asm" |
|
|
|
include "tiles/sign-misplaced.asm" |
|
|
|
tiles_wrong: |
|
|
|
tiles_wrong: |
|
|
|
include "tiles/sign-wrong.asm" |
|
|
|
include "tiles/sign-wrong.asm" |
|
|
|
tiles_slash: |
|
|
|
tiles_arrow: |
|
|
|
include "tiles/sign-slash.asm" |
|
|
|
include "tiles/sign-arrow.asm" |
|
|
|
tiles_logo: |
|
|
|
tiles_logo: |
|
|
|
include "tiles/logo.asm" |
|
|
|
include "tiles/logo.asm" |
|
|
|
tiles_end: |
|
|
|
tiles_end: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; Maps |
|
|
|
; Maps |
|
|
|
; Each map defines a grid of tile addresses, |
|
|
|
|
|
|
|
; which combined will form the desired image. |
|
|
|
maps_start: |
|
|
|
maps_start: |
|
|
|
background: |
|
|
|
background: |
|
|
|
include "maps/background.asm" |
|
|
|
include "maps/background.asm" |
|
|
@ -203,13 +216,20 @@ window_game: |
|
|
|
include "maps/window-game.asm" |
|
|
|
include "maps/window-game.asm" |
|
|
|
maps_end: |
|
|
|
maps_end: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; Dictionary |
|
|
|
|
|
|
|
; A list of known words to choose from. |
|
|
|
dictionary: |
|
|
|
dictionary: |
|
|
|
incbin "dict/en.dat" |
|
|
|
incbin "dict/en.dat" |
|
|
|
dictionary_end: |
|
|
|
dictionary_end: |
|
|
|
DB |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
; Help data |
|
|
|
;; Help data |
|
|
|
|
|
|
|
; The help screen will reuse the normal |
|
|
|
|
|
|
|
; game mechanics to provide a manual |
|
|
|
|
|
|
|
; how to play this game. |
|
|
|
|
|
|
|
; Now following is hard coded-data |
|
|
|
|
|
|
|
; to provide a set of information. |
|
|
|
help_word: |
|
|
|
help_word: |
|
|
|
DB $12, $09, $07, $08, $14 ; right |
|
|
|
DB $12, $09, $07, $08, $14 ; right |
|
|
|
|
|
|
|
|
|
|
@ -230,7 +250,11 @@ help_guess_hints: |
|
|
|
DB TILE_WHITE, TILE_WHITE, TILE_WHITE, TILE_WHITE, TILE_WHITE |
|
|
|
DB TILE_WHITE, TILE_WHITE, TILE_WHITE, TILE_WHITE, TILE_WHITE |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
; Messages |
|
|
|
;; Messages |
|
|
|
|
|
|
|
; This game uses a message system to |
|
|
|
|
|
|
|
; provide feedback to the user. |
|
|
|
|
|
|
|
; For this, nine objects are reserved |
|
|
|
|
|
|
|
; and can be used at will. |
|
|
|
message_clear: |
|
|
|
message_clear: |
|
|
|
DB $00, $00, $00, $00 |
|
|
|
DB $00, $00, $00, $00 |
|
|
|
DB $00, $00, $00, $00 |
|
|
|
DB $00, $00, $00, $00 |
|
|
@ -265,41 +289,41 @@ message_menu_help: |
|
|
|
DB $90, $80, 25, OBJ_ATTR_PALETTE1 ; Y |
|
|
|
DB $90, $80, 25, OBJ_ATTR_PALETTE1 ; Y |
|
|
|
|
|
|
|
|
|
|
|
message_unknown: |
|
|
|
message_unknown: |
|
|
|
DB $74, $38, 21, OBJ_ATTR_PALETTE1 ; U |
|
|
|
DB $78, $38, 21, OBJ_ATTR_PALETTE1 ; U |
|
|
|
DB $74, $40, 14, OBJ_ATTR_PALETTE1 ; N |
|
|
|
DB $78, $40, 14, OBJ_ATTR_PALETTE1 ; N |
|
|
|
DB $74, $48, 11, OBJ_ATTR_PALETTE1 ; k |
|
|
|
DB $78, $48, 11, OBJ_ATTR_PALETTE1 ; k |
|
|
|
DB $74, $50, 14, OBJ_ATTR_PALETTE1 ; N |
|
|
|
DB $78, $50, 14, OBJ_ATTR_PALETTE1 ; N |
|
|
|
DB $74, $58, 15, OBJ_ATTR_PALETTE1 ; O |
|
|
|
DB $78, $58, 15, OBJ_ATTR_PALETTE1 ; O |
|
|
|
DB $74, $60, 23, OBJ_ATTR_PALETTE1 ; W |
|
|
|
DB $78, $60, 23, OBJ_ATTR_PALETTE1 ; W |
|
|
|
DB $74, $68, 14, OBJ_ATTR_PALETTE1 ; N |
|
|
|
DB $78, $68, 14, OBJ_ATTR_PALETTE1 ; N |
|
|
|
DB $00, $00, 0, 0 |
|
|
|
DB $00, $00, 0, 0 |
|
|
|
DB $00, $00, 0, 0 |
|
|
|
DB $00, $00, 0, 0 |
|
|
|
|
|
|
|
|
|
|
|
message_won: |
|
|
|
message_won: |
|
|
|
DB $74, $38, 25, OBJ_ATTR_PALETTE1 ; Y |
|
|
|
DB $78, $38, 25, OBJ_ATTR_PALETTE1 ; Y |
|
|
|
DB $74, $40, 15, OBJ_ATTR_PALETTE1 ; O |
|
|
|
DB $78, $40, 15, OBJ_ATTR_PALETTE1 ; O |
|
|
|
DB $74, $48, 21, OBJ_ATTR_PALETTE1 ; U |
|
|
|
DB $78, $48, 21, OBJ_ATTR_PALETTE1 ; U |
|
|
|
DB $74, $58, 23, OBJ_ATTR_PALETTE1 ; W |
|
|
|
DB $78, $58, 23, OBJ_ATTR_PALETTE1 ; W |
|
|
|
DB $74, $60, 15, OBJ_ATTR_PALETTE1 ; O |
|
|
|
DB $78, $60, 15, OBJ_ATTR_PALETTE1 ; O |
|
|
|
DB $74, $68, 14, OBJ_ATTR_PALETTE1 ; N |
|
|
|
DB $78, $68, 14, OBJ_ATTR_PALETTE1 ; N |
|
|
|
DB $00, $00, 0, 0 |
|
|
|
DB $00, $00, 0, 0 |
|
|
|
DB $00, $00, 0, 0 |
|
|
|
DB $00, $00, 0, 0 |
|
|
|
DB $00, $00, 0, 0 |
|
|
|
DB $00, $00, 0, 0 |
|
|
|
|
|
|
|
|
|
|
|
message_lost: |
|
|
|
message_lost: |
|
|
|
DB $74, $30, 9, OBJ_ATTR_PALETTE1 ; I |
|
|
|
DB $78, $30, 9, OBJ_ATTR_PALETTE1 ; I |
|
|
|
DB $74, $38, 20, OBJ_ATTR_PALETTE1 ; T |
|
|
|
DB $78, $38, 20, OBJ_ATTR_PALETTE1 ; T |
|
|
|
DB $74, $40, 19, OBJ_ATTR_PALETTE1 ; S |
|
|
|
DB $78, $40, 19, OBJ_ATTR_PALETTE1 ; S |
|
|
|
DB $74, $50, 0, OBJ_ATTR_PALETTE1 ; guess[0] |
|
|
|
DB $78, $50, 0, OBJ_ATTR_PALETTE1 ; guess[0] |
|
|
|
DB $74, $58, 0, OBJ_ATTR_PALETTE1 ; guess[1] |
|
|
|
DB $78, $58, 0, OBJ_ATTR_PALETTE1 ; guess[1] |
|
|
|
DB $74, $60, 0, OBJ_ATTR_PALETTE1 ; guess[2] |
|
|
|
DB $78, $60, 0, OBJ_ATTR_PALETTE1 ; guess[2] |
|
|
|
DB $74, $68, 0, OBJ_ATTR_PALETTE1 ; guess[3] |
|
|
|
DB $78, $68, 0, OBJ_ATTR_PALETTE1 ; guess[3] |
|
|
|
DB $74, $70, 0, OBJ_ATTR_PALETTE1 ; guess[4] |
|
|
|
DB $78, $70, 0, OBJ_ATTR_PALETTE1 ; guess[4] |
|
|
|
DB $00, $00, 0, 0 |
|
|
|
DB $00, $00, 0, 0 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
; Address reservations within the working ram |
|
|
|
;; Address reservations within the working ram |
|
|
|
SECTION "RAM", WRAM0 |
|
|
|
SECTION "RAM", WRAM0 |
|
|
|
; The first 160 Bytes are reserved for a copy |
|
|
|
; The first 160 Bytes are reserved for a copy |
|
|
|
; of the OAM data, which will be updated via DMA. |
|
|
|
; of the OAM data, which will be updated via DMA. |
|
|
@ -319,7 +343,7 @@ obj_dma_padding: |
|
|
|
vblank_flag: |
|
|
|
vblank_flag: |
|
|
|
DB |
|
|
|
DB |
|
|
|
|
|
|
|
|
|
|
|
; Saves the current 16bit random number |
|
|
|
; Saves the current random number consisting of 16 bits |
|
|
|
random_number: |
|
|
|
random_number: |
|
|
|
DS 2 |
|
|
|
DS 2 |
|
|
|
|
|
|
|
|
|
|
@ -327,19 +351,19 @@ random_number: |
|
|
|
input_state: |
|
|
|
input_state: |
|
|
|
DB |
|
|
|
DB |
|
|
|
|
|
|
|
|
|
|
|
; Saves the current game state |
|
|
|
; Saves the current game state (see STATE constants) |
|
|
|
current_state: |
|
|
|
current_state: |
|
|
|
DB |
|
|
|
DB |
|
|
|
|
|
|
|
|
|
|
|
; Saves the state in the submenu |
|
|
|
; Saves the subordinate state (see STATE constants) |
|
|
|
sub_state: |
|
|
|
sub_state: |
|
|
|
DB |
|
|
|
DB |
|
|
|
|
|
|
|
|
|
|
|
; Number of the current guess |
|
|
|
; Number of the current guess (0..5) |
|
|
|
current_guess: |
|
|
|
current_guess: |
|
|
|
DB |
|
|
|
DB |
|
|
|
|
|
|
|
|
|
|
|
; Position within the current guess |
|
|
|
; Position within the current guess (0..4) |
|
|
|
current_char: |
|
|
|
current_char: |
|
|
|
DB |
|
|
|
DB |
|
|
|
|
|
|
|
|
|
|
@ -348,21 +372,22 @@ current_word: |
|
|
|
DS 5 |
|
|
|
DS 5 |
|
|
|
|
|
|
|
|
|
|
|
; The guess attempts |
|
|
|
; The guess attempts |
|
|
|
guesses: |
|
|
|
guess_attempts: |
|
|
|
DS 30 |
|
|
|
DS 30 |
|
|
|
|
|
|
|
|
|
|
|
; The corresponding hints |
|
|
|
; The corresponding hints |
|
|
|
guesses_hints: |
|
|
|
guess_hints: |
|
|
|
DS 30 |
|
|
|
DS 30 |
|
|
|
|
|
|
|
|
|
|
|
; Message timeout |
|
|
|
; Message timeout (remaining number of frames) |
|
|
|
message_timeout: |
|
|
|
message_timeout: |
|
|
|
DB |
|
|
|
DB |
|
|
|
|
|
|
|
|
|
|
|
; Horizontal position of the letter selection |
|
|
|
; Horizontal position of the letter selection within the alphabet grid |
|
|
|
selected_letter_x: |
|
|
|
selected_letter_x: |
|
|
|
DB |
|
|
|
DB |
|
|
|
|
|
|
|
|
|
|
|
; Vertical position of the letter selection |
|
|
|
; Vertical position of the letter selection within the alphabet grid |
|
|
|
selected_letter_y: |
|
|
|
selected_letter_y: |
|
|
|
DB |
|
|
|
DB |
|
|
|
|
|
|
|
|
|
|
|