Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- After the rating:
- 4F2E -> make the screen white
- 4F31 -> set C to 0x64
- 4F33 -> wait C frames (if called directly, C will be 0x00 and it waits 256 frames)
- 4F36 -> LCD stuff
- 4F39 -> set A to 0xA7
- 4F3B -> set x position of the window to A (if called directly, A will be 0x3B and everything will be off)
- 4F3D -> set A to 0x00
- 4F3E -> set "Background Horizontal Scrolling" to A
- 4F40 -> set "Background Vertical Scrolling" to A
- 4F42 -> set $FFAE to A
- 4F44 -> set $FFAF to A
- 4F46 -> set $FFB0 to A
- 4F48 -> set y position of the window to A
- 4F4A -> upload text graphics
- 4F4D -> set HL to 0xC3A0
- 4F50 -> set 0x4F bytes starting from HL to 0x7E (top black bar)
- 4F53 -> set HL to 0xC4B8
- 4F56 -> set 0x4F bytes starting from HL to 0x7E (bottom black bar)
- 4F59 -> set A to 0xC0
- 4F5B -> set the background palette to A
- 4F5D -> ??? (it has something to do with palettes and it works with values at around $DEE0 to $DFC0)
- 4F60 -> enable LCD operation (which was disabled at the end of $4F36)
- 4F63 -> sound stuff
- 4F66 -> set HL to 0x9C00
- 4F69 -> copy the screen in RAM into the window at (HL)
- 4F6C -> set HL to 0x9800
- 4F6F -> copy background (I guess?) in RAM into the background at (HL)
- 4F72 -> set C to 0x1F
- 4F74 -> set A to 0xC7
- 4F76 -> sound stuff (it also fills various parts at $C0xx with 0x00 and 0x01)
- 4F79 -> set C to 0x80
- 4F7B -> wait C frames
- 4F7E -> set A to 0x00
- 4F7F -> set $CD3D to A
- 4F82 -> set $CD3E to A
- 4F85 -> jump to $50B6
- 50B6 -> set DE to 0x5171
- 50B9 -> push DE
- 50BA -> pop DE
- 50BB -> set HL to 0xC421
- 50BE -> push HL
- 50BF -> make the screen white (copy 0x7F to $C3F0 - $C4B7)
- 50C2 -> pop HL
- / 50C3 -> set A to (DE)
- | 50C4 -> DE += 1
- | 50C5 -> push DE
- |
- | 50C6 - 50DC -> if A is 0xFF/0xFE/0xFD/0xFC/0xFB/0xFA then jump to $50EF/$50F6/$5100/$5107/$50E4/$510E
- | 50DE -> get the next line to write (pointer is at (DE))
- | 50E1 -> pop DE
- \ 50E2 -> jump to $50C3
- if 0xFB:
- 50E4:06 01 LD B,#01h
- 50E6:21 40 43 LD HL,#4340h
- 50E9:CD 84 3E CALL #3E84h
- 50EC:D1 POP DE
- 50ED:18 D4 JR 50C3h
- if 0xFF:
- 50EF:CD 88 4F CALL #4F88h <- 4F: LD C,A
- 50F2:0E 66 LD C,#66h
- 50F4:18 02 JR 50F8h
- if 0xFE:
- 50F6:0E 7A LD C,#7Ah
- 50F8:CD 2F 37 CALL #372Fh
- 50FB:CD A4 4F CALL #4FA4h
- 50FE:18 BA JR 50BAh
- if 0xFD:
- 5100:CD 88 4F CALL #4F88h
- 5103:0E 84 LD C,#84h
- 5105:18 02 JR 5109h
- if 0xFC:
- 5107:0E 98 LD C,#98h
- 5109:CD 2F 37 CALL #372Fh
- 510C:18 AC JR 50BAh
- if 0xFA:
- 510E:CD 13 51 CALL #5113h
- 5111:D1 POP DE
- 5112:C9 RET
- Our code directly jumps into a "special case" (normally tested at $50C6 - $50DC) at $50F1. This would explain the garbage screen at the start, because text is only updated at such a case.
- It then goes into the normal loop where it reads the value at (DE). That value normally is set to 0x50B6, but we skipped that part.
- Our DE is set to 0x0D5D just before the jump to $50F1 and it isn't changed after that (only +1 at $50C4 to get the next line of text).
- So wrong values are loaded, but remember, the game waits for a "special case" to update text. The first value starting from $0D5D which gives a special case is 0xFA, which is the "THE END" case.
- Now the code jumps to $510E and executes the normal code for the "THE END" screen.
- After the return at $5112 the game eventually reaches $0D4C.
- It accesses the bank pointer at $D35D and jumps to the word stored in $D36D.
- In our case this is bank 0x3C and address $50F1.
- Since just before the jump DE is set to 0x0D5D, it results in an infinite loop, which always shows "THE END".
Advertisement
Add Comment
Please, Sign In to add comment