-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.asm
More file actions
111 lines (93 loc) · 2.94 KB
/
init.asm
File metadata and controls
111 lines (93 loc) · 2.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
; Hijack boot routine to initialize practice hack RAM
org $80803A
JSL InitRAM
org $BFE000
print pc, " init.asm start"
InitRAM:
{
%ai16()
; Zero RAM from $7FFF00 onward for practice hack use
LDA #$0000 : LDX !WRAM_SIZE-2
- STA !WRAM_START,X : DEX #2 : BPL -
; check if SRAM has been initialized
LDA !sram_initialized : CMP !SRAM_VERSION : BEQ .nonZeroValues
CMP #$0003 : BEQ UpdateSRAM_version03
CMP #$0004 : BEQ UpdateSRAM_version04
JSR InitSRAM
.nonZeroValues
; Non-zero default values
LDA #$08E7 : STA !ram_watch_left ; Al X Position
LDA #$08EA : STA !ram_watch_right ; Al Y Position
LDA !sram_cheat_code : STA !AL_CheatCode
%ai8()
LDX #$01 : LDY #$0B ; overwritten code
RTL
}
UpdateSRAM:
{
.version03
LDA #$01F4 : STA !sram_custom_checkpoint
.version04
; addresses introduced in version 5 go here
LDA !SRAM_VERSION : STA !sram_initialized
JMP InitRAM_nonZeroValues
}
InitSRAM:
{
; menu settings
LDA #$0000 : STA !sram_display_mode
LDA #$0000 : STA !sram_infinite_hearts
LDA #$0000 : STA !sram_infinite_apples
LDA #$0000 : STA !sram_infinite_lives
LDA #$0000 : STA !sram_infinite_credits
LDA #$0001 : STA !sram_default_cape
LDA #$0007 : STA !sram_default_hearts
LDA #$0099 : STA !sram_default_apples
LDA #$0003 : STA !sram_default_lives
LDA #$0003 : STA !sram_default_credits
LDA #$0000 : STA !sram_cheat_code
LDA #$000C : STA !sram_customsfx_move
LDA #$0006 : STA !sram_customsfx_toggle
LDA #$003B : STA !sram_customsfx_number
LDA #$000B : STA !sram_customsfx_confirm
LDA #$0008 : STA !sram_customsfx_goback
LDA #$0002 : STA !sram_customsfx_fail
LDA #$004A : STA !sram_customsfx_reset
LDA #$0001 : STA !sram_options_control_type
LDA #$0000 : STA !sram_options_sound
LDA #$0001 : STA !sram_stage_clear_skip
LDA #$0001 : STA !sram_story_time_skip
LDA #$0000 : STA !sram_disable_music
LDA #$0001 : STA !sram_loadstate_music
LDA #$0000 : STA !sram_loadstate_rng
; $30 bytes for Time Attack
LDA #$7FFF : LDX #$002E
- STA !sram_TimeAttack,X : DEX #2 : BPL -
; controller shortcuts
LDA #$2000 : STA !sram_ctrl_menu ; Select
LDA #$6010 : STA !sram_ctrl_save_state ; Select + Y + R
LDA #$6020 : STA !sram_ctrl_load_state ; Select + Y + L
LDA #$0000 : STA !sram_ctrl_next_level
LDA #$0000 : STA !sram_ctrl_kill_Aladdin
LDA #$0000 : STA !sram_ctrl_refill
LDA #$0000 : STA !sram_ctrl_update_timers
LDA #$3030 : STA !sram_ctrl_soft_reset ; Select + Start + L + R
LDA #$0000 : STA !sram_ctrl_test_code
LDA !SRAM_VERSION : STA !sram_initialized
RTS
; Input Cheat Sheet ($4218)
; $8000 = B
; $4000 = Y
; $2000 = Select
; $1000 = Start
; $0800 = Up
; $0400 = Down
; $0200 = Left
; $0100 = Right
; $0080 = A
; $0040 = X
; $0020 = L
; $0010 = R
}
print pc, " init.asm end"
warnpc $BFF000 ; save.asm