-
Notifications
You must be signed in to change notification settings - Fork 53
/
password.asm
596 lines (529 loc) · 18 KB
/
password.asm
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
Module_Password:
LDA.b GameSubMode
JSL.l JumpTableLong
dl Password_BeginInit ; 0
dl Password_EndInit ; 1
dl Password_Main ; 2
dl Password_Check ; 3
dl Password_Return ; 4
Password_BeginInit:
LDA.b #$80 : STA.w $0710 ;skip animated sprite updates in NMI
JSL EnableForceBlank
JSL Vram_EraseTilemaps_triforce
JSL LoadCustomHudPalette ; replace the 2bpp palettes, and trigger upload
LDA.b #$07 : STA.b NMISTRIPES ; have NMI load up the initial tilemap from Password_Tilemap
INC.b GameSubMode
RTL
Password_EndInit:
JSR LoadPasswordStripeTemplate
;reset the variables used by this screen
STZ.b PasswordCodePosition
STZ.b PasswordSelectPosition
JSL ValidatePassword : BNE +
; zero out password if not valid
LDX.b #$0F
LDA.b #$00
-
STA.l PasswordSRAM, X
DEX : BPL -
+
LDA.b #$0F : STA.b INIDISPQ
INC.b GameSubMode
RTL
Password_Main:
PHB
PHK : PLB
JSR PasswordEraseOldCursors
; handle joypad input
LDA.b $F6 : AND.b #$10 : BEQ + ; R Button
JSR PasswordMoveCursorRight
+
LDA.b $F6 : AND.b #$20 : BEQ + ; L Button
JSR PasswordMoveCursorLeft
+
LDA.b $F4 : AND.b #$01 : BEQ + ; right
LDA.b PasswordSelectPosition : INC A : CMP.b #$24 : !BLT ++
!SUB.b #$24
++
STA.b PasswordSelectPosition
LDA.b #$20 : STA.w SFX3
+
LDA.b $F4 : AND.b #$02 : BEQ + ; left
LDA.b PasswordSelectPosition : DEC A : BPL ++
!ADD.b #$24
++
STA.b PasswordSelectPosition
LDA.b #$20 : STA.w SFX3
+
LDA.b $F4 : AND.b #$04 : BEQ + ; down
LDA.b PasswordSelectPosition : !ADD.b #$09 : CMP.b #$24 : !BLT ++
!SUB.b #$24
++
STA.b PasswordSelectPosition
LDA.b #$20 : STA.w SFX3
+
LDA.b $F4 : AND.b #$08 : BEQ + ; up
LDA.b PasswordSelectPosition : !SUB.b #$09 : BPL ++
!ADD.b #$24
++
STA.b PasswordSelectPosition
LDA.b #$20 : STA.w SFX3
+
LDA.b $F4 : ORA.b $F6 : AND.b #$C0 : BEQ + ; face button
LDX.b PasswordSelectPosition
LDA.l .selectionValues, X : BPL ++
CMP.b #$F0 : BNE +++
INC.b GameSubMode
BRA .endOfButtonChecks
+++ : CMP.b #$F1 : BNE +++
JSR PasswordMoveCursorLeft
BRA +
+++ : CMP.b #$F2 : BNE +++
JSR PasswordMoveCursorRight
BRA +
+++ : CMP.b #$F3 : BNE +++
INC.b GameSubMode : INC.b GameSubMode ; skip to return submodule
LDA.b #$2C : STA.w SFX2 ;file screen selection sound
BRA .endOfButtonChecks
+++
BRA +
++
LDX.b PasswordCodePosition
STA.l PasswordSRAM,X
TXA : INC A : AND.b #$0F : STA.b PasswordCodePosition
BNE ++
STZ.w SFX2
INC.b GameSubMode
BRA .endOfButtonChecks
++
LDA.b #$2B : STA.w SFX2
+
LDA.b $F4 : AND.b #$10 : BEQ + ; start
INC.b GameSubMode
+
.endOfButtonChecks
JSR UpdatePasswordTiles
JSR PasswordSetNewCursors
LDA.b #$01 : STA.b NMISTRIPES
PLB
RTL
.selectionValues
db $01, $02, $03, $04, $05, $06, $07, $08, $F0
db $09, $0A, $0B, $0C, $0D, $0E, $0F, $10, $F1
db $11, $12, $13, $14, $15, $16, $17, $18, $F2
db $19, $1A, $1B, $1C, $1D, $1E, $1F, $20, $F3
Password_Check:
JSL.l ValidatePassword : BNE .correct
LDA.b #$3C : STA.w SFX2 ; error
DEC.b GameSubMode
RTL
.correct
LDA.b #$1B : STA.w SFX3 ; solved puzzle sound
INC.b GameSubMode
RTL
Password_Return:
LDA.b #$01 : STA.b GameMode ; select screen
LDA.b #$01 : STA.b GameSubMode ; Skip the first submodule
STZ.b SubSubModule
STZ.w SaveFileIndex
STZ.b PasswordCodePosition
STZ.b PasswordCodePosition+1
RTL
;--------------------------------------------------------------------------------
; Exported Function
;--------------------------------------------------------------------------------
ValidatePassword:
; returns 1/Not Z for correct, 0/Z for incorrect
; REQUIRES: 8 bit both
; has a deliberate side effect of key being loaded into RAM if password is correct.
PHX : PHY
;check for incomplete password
LDX.b #$0F
-
LDA.l PasswordSRAM, X : BNE +
JMP .incorrect
+
DEX : BPL -
REP #$20 ; 16 bit Accumulator
; Clear out any existing encryption key
LDX.b #$0E
LDA.w #$0000
- : STA.l KeyBase, X : DEX #2 : BPL -
JSR PasswordToKey
LDA.l StaticDecryptionKey+$0A : STA.l KeyBase+$0A
LDA.l StaticDecryptionKey+$0C : STA.l KeyBase+$0C
LDA.l StaticDecryptionKey+$0E : STA.l KeyBase+$0E
LDA.l KnownEncryptedValue : STA.l CryptoBuffer
LDA.l KnownEncryptedValue+2 : STA.l CryptoBuffer+2
LDA.l KnownEncryptedValue+4 : STA.l CryptoBuffer+4
LDA.l KnownEncryptedValue+6 : STA.l CryptoBuffer+6
LDA.w #$0002 : STA.b $04 ;set block size
JSL.l XXTEA_Decode
SEP #$20 ; 8 bit accumulator
LDA.l CryptoBuffer+0 : CMP.b #$31 : BNE .incorrect
LDA.l CryptoBuffer+1 : CMP.b #$41 : BNE .incorrect
LDA.l CryptoBuffer+2 : CMP.b #$59 : BNE .incorrect
LDA.l CryptoBuffer+3 : CMP.b #$26 : BNE .incorrect
LDA.l CryptoBuffer+4 : CMP.b #$53 : BNE .incorrect
LDA.l CryptoBuffer+5 : CMP.b #$58 : BNE .incorrect
LDA.l CryptoBuffer+6 : CMP.b #$97 : BNE .incorrect
LDA.l CryptoBuffer+7 : CMP.b #$93 : BNE .incorrect
;trial decrypt the known plaintext, and verify if result is correct
.correct
PLY : PLX
LDA.b #$01 : STA.l ValidKeyLoaded
RTL
.incorrect
PLY : PLX
LDA.b #$00
RTL
;--------------------------------------------------------------------------------
; Local Helper functions
;--------------------------------------------------------------------------------
PasswordToKey:
; $00 input offset
; $02 output offset
; $04 shift amount
LDA.w #$0000 : STA.b $00 : STA.b $02
LDA.w #$000B : STA.b $04
-
LDX.b $00
LDA.l PasswordSRAM, X : DEC : AND.w #$001F
LDY.b $04
-- : BEQ + : ASL : DEY : BRA -- : + ; Shift left by Y
XBA
LDX.b $02
ORA.l KeyBase, X
STA.l KeyBase, X
LDA.b $04 : !SUB.w #$0005 : BPL +
!ADD.w #$0008
INC $02
+ : STA.b $04
LDA.b $00 : INC : STA.b $00 : CMP.w #$0010 : !BLT -
RTS
LoadPasswordStripeTemplate:
LDA.w DMAP0 : PHA : LDA.w BBAD0 : PHA : LDA.w A1T0L : PHA ; preserve DMA parameters
LDA.w A1T0H : PHA : LDA.w A1B0 : PHA : LDA.w DAS0L : PHA ; preserve DMA parameters
LDA.w DAS0H : PHA ; preserve DMA parameters
LDA.b #$00 : STA.w DMAP0 ; set DMA transfer direction A -> B, bus A auto increment, single-byte mode
LDA.b #$80 : STA.w BBAD0 ; set bus B destination to WRAM register
LDA.b #$02 : STA.w WMADDL ; set WRAM register source address
LDA.b #$10 : STA.w WMADDH
LDA.b #$7E : STA.w WMADDB
LDA.b #Password_StripeImageTemplate : STA.w A1T0L ; set bus A source address
LDA.b #Password_StripeImageTemplate>>8 : STA.w A1T0H ; set bus A source address
LDA.b #Password_StripeImageTemplate>>16 : STA.w A1B0 ; set bus A source bank
LDA.b #Password_StripeImageTemplate_end-Password_StripeImageTemplate
STA.w DAS0L ;
LDA.b #Password_StripeImageTemplate_end-Password_StripeImageTemplate>>8
STA.w DAS0H ; set transfer size
LDA.b #$01 : STA.w MDMAEN ; begin DMA transfer
PLA : STA.w DAS0H : PLA : STA.w DAS0L : PLA : STA.w A1B0 ; restore DMA parameters
PLA : STA.w A1T0H : PLA : STA.w A1T0L : PLA : STA.w BBAD0 ; restore DMA parameters
PLA : STA.w DMAP0 ; restore DMA parameters
RTS
PasswordEraseOldCursors:
REP #$20 ; set 16-bit accumulator
;Code Cursor
LDA.b PasswordCodePosition : AND.w #$00FF : ASL : TAX
LDA.l .code_offsets, X
!ADD.w #$20*Scrap04+Scrap04+$6000
XBA ; because big endian is needed
STA.l $1002+Password_StripeImageTemplate_CodeCursorErase-Password_StripeImageTemplate
;selection cursor
LDA.b PasswordSelectPosition : AND.w #$00FF : ASL : TAX
LDA.l .selection_offsets, X
!ADD.w #$20*Scrap0D+Scrap03+$6000
XBA ; because big endian is needed
STA.l $1002+Password_StripeImageTemplate_SelectionCursorErase-Password_StripeImageTemplate
XBA : !ADD.w #$0020 : XBA
STA.l $1002+$0C+Password_StripeImageTemplate_SelectionCursorErase-Password_StripeImageTemplate
XBA : !ADD.w #$0003 : XBA
STA.l $1002+$14+Password_StripeImageTemplate_SelectionCursorErase-Password_StripeImageTemplate
XBA : !ADD.w #$0040-$0003 : XBA
STA.l $1002+$1C+Password_StripeImageTemplate_SelectionCursorErase-Password_StripeImageTemplate
SEP #$20 ; restore 8-bit accumulator
RTS
.code_offsets
dw $0040, $0043, $0046, $0049, $004C, $004F, $0052, $0055
dw $00A0, $00A3, $00A6, $00A9, $00AC, $00AF, $00B2, $00B5
.selection_offsets
dw $FFDF, $FFE2, $FFE5, $FFE8, $FFEB, $FFEE, $FFF1, $FFF4, $FFF7
dw $003F, $0042, $0045, $0048, $004B, $004E, $0051, $0054, $0057
dw $009F, $00A2, $00A5, $00A8, $00AB, $00AE, $00B1, $00B4, $00B7
dw $00FF, $0102, $0105, $0108, $010B, $010E, $0111, $0114, $0117
PasswordSetNewCursors:
REP #$20 ; set 16-bit accumulator
;Code Cursor
LDA.b PasswordCodePosition : AND.w #$00FF : ASL : TAX
LDA.l PasswordEraseOldCursors_code_offsets, X
!ADD.w #$20*Scrap04+Scrap04+$6000
XBA ; because big endian is needed
STA.l $1002+Password_StripeImageTemplate_CodeCursorDraw-Password_StripeImageTemplate
;Selection cursor
LDA.b PasswordSelectPosition : AND.w #$00FF : ASL : TAX
LDA.l PasswordEraseOldCursors_selection_offsets, X
!ADD.w #$20*Scrap0D+Scrap03+$6000
XBA ; because big endian is needed
STA.l $1002+Password_StripeImageTemplate_SelectionCursorDraw-Password_StripeImageTemplate
XBA : !ADD.w #$0020 : XBA
STA.l $1002+$0C+Password_StripeImageTemplate_SelectionCursorDraw-Password_StripeImageTemplate
XBA : !ADD.w #$0003 : XBA
STA.l $1002+$14+Password_StripeImageTemplate_SelectionCursorDraw-Password_StripeImageTemplate
XBA : !ADD.w #$0040-$0003 : XBA
STA.l $1002+$1C+Password_StripeImageTemplate_SelectionCursorDraw-Password_StripeImageTemplate
SEP #$20 ; restore 8-bit accumulator
RTS
UpdatePasswordTiles:
REP #$30 ; set 16-bit both
LDX.w #$000F
-
LDA.l PasswordSRAM, X : AND.w #$00FF : TXY
ASL #3 : STA.b $00
TYA : ASL #4 : STA.b $03
LDX.b $00 : LDA.l HashAlphabetTilesWithBlank, X
LDX.b $03 : STA.w $1006, X
LDX.b $00 : LDA.l HashAlphabetTilesWithBlank+$02, X
LDX.b $03 : STA.w $1008, X
LDX.b $00 : LDA.l HashAlphabetTilesWithBlank+$04, X
LDX.b $03 : STA.w $100E, X
LDX.b $00 : LDA.l HashAlphabetTilesWithBlank+$06, X
LDX.b $03 : STA.w $1010, X
TYX : DEX : BMI + : BRA -
+
SEP #$30 ; restore 8-bit both
RTS
PasswordMoveCursorRight:
; return new code position
LDA.b #$2B : STA.w SFX2
LDA.b PasswordCodePosition : INC A : AND.b #$0F : STA.b PasswordCodePosition
RTS
PasswordMoveCursorLeft:
; return new code position
LDA.b #$2B : STA.w SFX2
LDA.b PasswordCodePosition : DEC A : AND.b #$0F : STA.b PasswordCodePosition
RTS
macro dw_big_endian(value)
db <value>>>8
db <value>
endmacro
macro Layer3_VRAM_Address(x,y)
%dw_big_endian(<y>*$20+<x>+$6000)
endmacro
Password_Tilemap:
;Add any graphics for background 0 here
%Layer3_VRAM_Address(Scrap03,Scrap0D+0)
%dw_big_endian(51) ;(9*4)+(8*2)-1
dw #$0201|!FS_COLOR_YELLOW, #$0202|!FS_COLOR_YELLOW ;BOW
dw #$0200
dw #$0205|!FS_COLOR_BLUE, #$0206|!FS_COLOR_BLUE ;BOOM
dw #$0200
dw #$0200|!FS_COLOR_RED, #$0215|!FS_COLOR_RED ;HOOK
dw #$0200
dw #$020C|!FS_COLOR_BLUE, #$020D|!FS_COLOR_BLUE ;BOMB
dw #$0200
dw #$0262|!FS_COLOR_RED, #$0263|!FS_COLOR_RED ;SHROOM
dw #$0200
dw #$020A|!FS_COLOR_BROWN, #$020B|!FS_COLOR_BROWN ;POWDER
dw #$0200
dw #$0220|!FS_COLOR_BLUE, #$0221|!FS_COLOR_BLUE ;ROD
dw #$0200
dw #$0285|!FS_COLOR_GREEN, #$0286|!FS_COLOR_GREEN ;PENDANT
dw #$0200
dw #$02AB|!FS_COLOR_BW, #$02AB|!FS_COLOR_BW ;placeholder upper half action button
%Layer3_VRAM_Address(Scrap03,Scrap0D+1)
%dw_big_endian(51) ;(9*4)+(8*2)-1
dw #$0211|!FS_COLOR_YELLOW, #$0212|!FS_COLOR_YELLOW ;BOW
dw #$0200
dw #$0200|!FS_COLOR_BW, #$0216|!FS_COLOR_BLUE ;BOOM
dw #$0200
dw #$0230|!FS_COLOR_RED, #$0200|!FS_COLOR_BW ;HOOK
dw #$0200
dw #$021C|!FS_COLOR_BLUE, #$021C|!FS_COLOR_BLUE|!FS_HFLIP ;BOMB
dw #$0200
dw #$0272|!FS_COLOR_RED, #$0273|!FS_COLOR_RED ;SHROOM
dw #$0200
dw #$021A|!FS_COLOR_BROWN, #$021B|!FS_COLOR_BROWN ;POWDER
dw #$0200
dw #$0230|!FS_COLOR_BLUE, #$0231|!FS_COLOR_BLUE ;ROD
dw #$0200
dw #$0295|!FS_COLOR_GREEN, #$0296|!FS_COLOR_GREEN ;PENDANT
dw #$0200
dw #$02AB|!FS_COLOR_BW, #$02AB|!FS_COLOR_BW ;placeholder lower half action button
%Layer3_VRAM_Address(Scrap03,Scrap0D+3)
%dw_big_endian(51) ;(9*4)+(8*2)-1
dw #$0207|!FS_COLOR_YELLOW, #$0217|!FS_COLOR_YELLOW|!FS_HFLIP|!FS_VFLIP ;BOMBOS
dw #$0200
dw #$0208|!FS_COLOR_YELLOW, #$0218|!FS_COLOR_YELLOW|!FS_HFLIP|!FS_VFLIP ;ETHER
dw #$0200
dw #$0209|!FS_COLOR_YELLOW, #$0219|!FS_COLOR_YELLOW|!FS_HFLIP|!FS_VFLIP ;QUAKE
dw #$0200
dw #$022C|!FS_COLOR_RED, #$022C|!FS_COLOR_RED|!FS_HFLIP ;LAMP
dw #$0200
dw #$0222|!FS_COLOR_BROWN, #$0223|!FS_COLOR_BROWN ;HAMMER
dw #$0200
dw #$0224|!FS_COLOR_BROWN, #$0225|!FS_COLOR_BROWN ;SHOVEL
dw #$0200
dw #$0226|!FS_COLOR_BLUE, #$0227|!FS_COLOR_BLUE ;FLUTE
dw #$0200
dw #$0228|!FS_COLOR_YELLOW, #$0229|!FS_COLOR_YELLOW ;NET
dw #$0200
dw #$018A|!FS_COLOR_BW, #$0200 ; Left
%Layer3_VRAM_Address(Scrap03,Scrap0D+4)
%dw_big_endian(51) ;(9*4)+(8*2)-1
dw #$0217|!FS_COLOR_YELLOW, #$0207|!FS_COLOR_YELLOW|!FS_HFLIP|!FS_VFLIP ;BOMBOS
dw #$0200
dw #$0218|!FS_COLOR_YELLOW, #$0208|!FS_COLOR_YELLOW|!FS_HFLIP|!FS_VFLIP ;ETHER
dw #$0200
dw #$0219|!FS_COLOR_YELLOW, #$0209|!FS_COLOR_YELLOW|!FS_HFLIP|!FS_VFLIP ;QUAKE
dw #$0200
dw #$023C|!FS_COLOR_RED, #$023D|!FS_COLOR_RED ;LAMP
dw #$0200
dw #$0232|!FS_COLOR_BROWN, #$0233|!FS_COLOR_BROWN ;HAMMER
dw #$0200
dw #$0234|!FS_COLOR_BROWN, #$0235|!FS_COLOR_BROWN ;SHOVEL
dw #$0200
dw #$0236|!FS_COLOR_BLUE, #$0237|!FS_COLOR_BLUE ;FLUTE
dw #$0200
dw #$0238|!FS_COLOR_YELLOW, #$0239|!FS_COLOR_YELLOW ;NET
dw #$0200
dw #$019A|!FS_COLOR_BW, #$0200 ; Left
%Layer3_VRAM_Address(Scrap03,Scrap0D+6)
%dw_big_endian(51) ;(9*4)+(8*2)-1
dw #$022A|!FS_COLOR_GREEN, #$022B|!FS_COLOR_GREEN ;BOOK
dw #$0200
dw #$0240|!FS_COLOR_BW, #$0241|!FS_COLOR_BW ;BOTTLE
dw #$0200
dw #$0242|!FS_COLOR_GREEN, #$0242|!FS_COLOR_GREEN|!FS_HFLIP ;POTION
dw #$0200
dw #$021D|!FS_COLOR_RED, #$021E|!FS_COLOR_RED
dw #$0200
dw #$0248|!FS_COLOR_RED, #$0249|!FS_COLOR_RED
dw #$0200
dw #$024A|!FS_COLOR_BLUE, #$024B|!FS_COLOR_BLUE
dw #$0200
dw #$024C|!FS_COLOR_BOOTS, #$024D|!FS_COLOR_BOOTS
dw #$0200
dw #$024E|!FS_COLOR_BROWN, #$024F|!FS_COLOR_BROWN
dw #$0200
dw #$0200, #$018B|!FS_COLOR_BW ; Right
%Layer3_VRAM_Address(Scrap03,Scrap0D+7)
%dw_big_endian(51) ;(9*4)+(8*2)-1
dw #$023A|!FS_COLOR_GREEN, #$023B|!FS_COLOR_GREEN ;BOOK
dw #$0200
dw #$0250|!FS_COLOR_BW, #$0251|!FS_COLOR_BW ;BOTTLE
dw #$0200
dw #$0252|!FS_COLOR_GREEN, #$0253|!FS_COLOR_GREEN ;POTION
dw #$0200
dw #$022D|!FS_COLOR_RED, #$022E|!FS_COLOR_RED ;CANE
dw #$0200
dw #$0258|!FS_COLOR_RED, #$0259|!FS_COLOR_RED ;CAPE
dw #$0200
dw #$025A|!FS_COLOR_BLUE, #$025B|!FS_COLOR_BLUE ;MIRROR
dw #$0200
dw #$025C|!FS_COLOR_BOOTS, #$025D|!FS_COLOR_BOOTS ;BOOTS
dw #$0200
dw #$025E|!FS_COLOR_BROWN, #$025F|!FS_COLOR_BROWN ;GLOVES
dw #$0200
dw #$0200, #$019B|!FS_COLOR_BW ; Right
%Layer3_VRAM_Address(Scrap03,Scrap0D+9)
%dw_big_endian(51) ;(9*4)+(8*2)-1
dw #$020E|!FS_COLOR_BLUE, #$020F|!FS_COLOR_BLUE ;FLIPPERS
dw #$0200
dw #$0264|!FS_COLOR_RED, #$0265|!FS_COLOR_RED ;PEARL
dw #$0200
dw #$026D|!FS_COLOR_YELLOW, #$026E|!FS_COLOR_YELLOW ;SHIELD
dw #$0200
dw #$026F|!FS_COLOR_GREEN, #$026F|!FS_COLOR_GREEN|!FS_HFLIP ;TUNIC
dw #$0200
dw #$0281|!FS_COLOR_RED, #$0281|!FS_COLOR_RED|!FS_HFLIP ;HEART
dw #$0200
dw #$0282|!FS_COLOR_YELLOW, #$0283|!FS_COLOR_YELLOW ;MAP
dw #$0200
dw #$0284|!FS_COLOR_RED, #$0284|!FS_COLOR_RED|!FS_HFLIP ;COMPASS
dw #$0200
dw #$022F|!FS_COLOR_YELLOW|!FS_HFLIP, #$022F|!FS_COLOR_YELLOW ;KEY
dw #$0200
dw #$0267|!FS_COLOR_BW|!FS_HFLIP, #$0267|!FS_COLOR_BW ;cancel
%Layer3_VRAM_Address(Scrap03,Scrap0D+10)
%dw_big_endian(51) ;(9*4)+(8*2)-1
dw #$021F|!FS_COLOR_BLUE|!FS_HFLIP, #$021F|!FS_COLOR_BLUE ;FLIPPERS
dw #$0200
dw #$0274|!FS_COLOR_RED, #$0275|!FS_COLOR_RED ;PEARL
dw #$0200
dw #$027D|!FS_COLOR_YELLOW, #$027E|!FS_COLOR_YELLOW ;SHIELD
dw #$0200
dw #$027F|!FS_COLOR_GREEN, #$027F|!FS_COLOR_GREEN|!FS_HFLIP ;TUNIC
dw #$0200
dw #$0291|!FS_COLOR_RED, #$0291|!FS_COLOR_RED|!FS_HFLIP ;HEART
dw #$0200
dw #$0292|!FS_COLOR_YELLOW, #$0293|!FS_COLOR_YELLOW ;MAP
dw #$0200
dw #$0294|!FS_COLOR_RED, #$0294|!FS_COLOR_RED|!FS_HFLIP ;COMPASS
dw #$0200
dw #$023E|!FS_COLOR_YELLOW, #$023F|!FS_COLOR_YELLOW ;KEY
dw #$0200
dw #$0267|!FS_COLOR_BW|!FS_HFLIP|!FS_VFLIP, #$0267|!FS_VFLIP|!FS_COLOR_BW ;cancel
dw $FFFF
macro PasswordDisplaySlot(x,y)
%Layer3_VRAM_Address(Scrap04+<x>,Scrap04+<y>)
%dw_big_endian(3)
dw #$0186|!FS_COLOR_BW, #$0186|!FS_COLOR_BW
%Layer3_VRAM_Address(Scrap04+<x>,Scrap04+1+<y>)
%dw_big_endian(3)
dw #$0196|!FS_COLOR_BW, #$0196|!FS_COLOR_BW
endmacro
!FS_VERT_STRIPE = $8000
Password_StripeImageTemplate:
%PasswordDisplaySlot(0,0)
%PasswordDisplaySlot(3,0)
%PasswordDisplaySlot(6,0)
%PasswordDisplaySlot(9,0)
%PasswordDisplaySlot(12,0)
%PasswordDisplaySlot(15,0)
%PasswordDisplaySlot(18,0)
%PasswordDisplaySlot(21,0)
%PasswordDisplaySlot(0,3)
%PasswordDisplaySlot(3,3)
%PasswordDisplaySlot(6,3)
%PasswordDisplaySlot(9,3)
%PasswordDisplaySlot(12,3)
%PasswordDisplaySlot(15,3)
%PasswordDisplaySlot(18,3)
%PasswordDisplaySlot(21,3)
.CodeCursorErase ; a code cursor erase (position get be updated)
%Layer3_VRAM_Address(Scrap04,Scrap04+2)
%dw_big_endian(3)
dw #$0200, #$0200
.CodeCursorDraw ; Then comes a code cursor draw (will override the erase if same position)
%Layer3_VRAM_Address(Scrap04,Scrap04+2)
%dw_big_endian(3)
dw #$0267|!FS_COLOR_BW|!FS_HFLIP|!FS_VFLIP, #$0267|!FS_VFLIP|!FS_COLOR_BW
.SelectionCursorErase ; a selection cursor erase (position get be updated)
%Layer3_VRAM_Address(Scrap03-1,Scrap0D-1)
%dw_big_endian(7)
dw #$0200, #$0200, #$0200, #$0200
%Layer3_VRAM_Address(Scrap03-1,Scrap0D)
%dw_big_endian(3|!FS_VERT_STRIPE)
dw #$0200, #$0200
%Layer3_VRAM_Address(Scrap03+2,Scrap0D)
%dw_big_endian(3|!FS_VERT_STRIPE)
dw #$0200, #$0200
%Layer3_VRAM_Address(Scrap03-1,Scrap0D+2)
%dw_big_endian(7)
dw #$0200, #$0200, #$0200, #$0200
.SelectionCursorDraw ; Then comes a selection cursor draw (will override the erase if same position)
%Layer3_VRAM_Address(Scrap03-1,Scrap0D-1)
%dw_big_endian(7)
dw #$02BB|!FS_COLOR_GREEN, #$02BC|!FS_COLOR_GREEN, #$02BC|!FS_COLOR_GREEN|!FS_HFLIP, #$02BB|!FS_COLOR_GREEN|!FS_HFLIP
%Layer3_VRAM_Address(Scrap03-1,Scrap0D)
%dw_big_endian(3|!FS_VERT_STRIPE)
dw #$02BD|!FS_COLOR_GREEN, #$02BD|!FS_COLOR_GREEN|!FS_VFLIP
%Layer3_VRAM_Address(Scrap03+2,Scrap0D)
%dw_big_endian(3|!FS_VERT_STRIPE)
dw #$02BD|!FS_COLOR_GREEN|!FS_HFLIP, #$02BD|!FS_COLOR_GREEN|!FS_HFLIP|!FS_VFLIP
%Layer3_VRAM_Address(Scrap03-1,Scrap0D+2)
%dw_big_endian(7)
dw #$02BB|!FS_COLOR_GREEN|!FS_VFLIP, #$02BC|!FS_COLOR_GREEN|!FS_VFLIP, #$02BC|!FS_COLOR_GREEN|!FS_HFLIP|!FS_VFLIP, #$02BB|!FS_COLOR_GREEN|!FS_HFLIP|!FS_VFLIP
dw $FFFF
.end