Pastebin
API
tools
faq
paste
Login
Sign up
Please fix the following errors:
New Paste
Syntax Highlighting
-- Code Generation Algorithm -- The LUT operation refers to the value in this table: B4, 6B, CB, DE, B8, 74, E1, 51, 59, 3D, 66, DD, F3, DA, 9D, 3F 08, 0A, E6, BB, 68, 21, 79, F1, F2, C3, 69, F5, 44, 9F, AA, 77 62, D1, 2E, 00, 82, 52, BD, 57, 86, 76, 34, 84, 64, 31, 10, FD AD, A9, EA, 01, 9A, 53, E8, 7B, 9B, 0D, 56, 22, 50, B1, 61, F7 94, CE, 16, D5, 90, 91, C7, D8, F9, 3A, C5, 36, 8B, 73, 03, AF 37, 38, A1, 7A, 72, C8, B0, 02, 43, 63, D7, 1D, 24, 85, 25, A8 46, E4, E0, 33, AC, C0, A7, 6D, F4, 95, 0F, 4E, D6, 41, B6, 99 1B, 2D, 78, 8C, 97, E9, 28, 4F, E3, 6C, 1E, 9E, B5, 11, CC, 87 7C, A2, 47, 8D, EB, 70, 8E, A3, 81, FE, 4C, 5A, 8F, 5E, 4A, 5B EC, 15, 20, D0, 13, FC, 92, 58, 7E, 4B, 49, 05, 09, 88, 30, 89 5F, AB, 75, 26, 80, D2, 17, 8A, 60, AE, CF, BE, 96, 55, 54, 07 ED, 0C, 9C, CD, BA, A5, 32, 2A, 29, 35, 12, 83, 27, EE, C9, 7F 98, E5, B9, 19, C6, 3E, 0E, 42, 0B, B7, 1A, A4, 6A, 2C, E2, D3 F8, CA, 18, F0, DF, DC, 23, 1C, 3B, 48, BC, FB, B2, 65, EF, 6E FA, DB, F6, 14, 71, 6F, D4, 5D, 5C, 4D, 93, FF, D9, 39, 45, 40 2F, E7, 67, 04, C4, B3, A6, 7D, C2, 2B, C1, BF, 1F, 06, 3C, A0 So LUT(00) = B4 LUT(11) = 0A LUT(F0) = 2F 1. Generate the achievement bitfield: +-----+---+---+---+-----+-------+--------+----------------------+ |7 MSB| 6 | 5 | 4 | 3 | 2 | 1 | 0 LSB | +-----+---+---+---+-----+-------+--------+----------------------+ |31337| |OOB|Dex|Guard|Pancake|Magikarp|RivalFreeRoHSCompliant| +-----+---+---+---+-----+-------+--------+----------------------+ 2. Let this value be ACH 3. Generate a random number R from 0 to 127 4. If the total time exceeded an hour, RNH = R * 2 + 1 else RNH = R * 2 5. MIN is the number of minutes passed 6. SEC is the number of seconds passed 7. ACH1 = LUT(ACH XOR 55) 8. RNH1 = LUT(RNH XOR AA) 9. MIN1 = LUT(MIN XOR F0) 10. SEC1 = LUT(SEC XOR 0F) 11. CHK1 = D4 + A7 * (C7 + ACH1 + RNH1 + MIN1 + SEC1) 12. CHK2 = D4 + A7 * (8A XOR ACH1 XOR RNH1 XOR MIN1 XOR SEC1) 13. ACH2 = ACH1 XOR CHK2 14. RNH2 = RNH1 XOR CHK2 15. MIN2 = MIN1 XOR CHK2 16. SEC2 = SEC1 XOR CHK2 17. For each byte in ACH2 RNH2 MIN2 SEC2 CHK1 CHK2 in that order, encode 2 letters/numbers (each symbol represents one half of the byte. The lower half is encoded first) 0 => H 1 => B 2 => E 3 => A 4 => V 5 => L 6 => G 7 => F 8 => C 9 => S A => D B => I C => M D => 2 E => 6 F => 7 -- Code Generator Script -- <?php // DansGame I know, but this is the first language I learned and it's what I most often use for scripts like this $ach = 0x00; // (sometimes node.js or bash, but mainly php) $rnh = 0x01; // you probably want to change these values $min = 0xFF; $sec = 0xFF; $lut = array(0xB4, 0x6B, 0xCB, 0xDE, 0xB8, 0x74, 0xE1, 0x51, 0x59, 0x3D, 0x66, 0xDD, 0xF3, 0xDA, 0x9D, 0x3F, 0x08, 0x0A, 0xE6, 0xBB, 0x68, 0x21, 0x79, 0xF1, 0xF2, 0xC3, 0x69, 0xF5, 0x44, 0x9F, 0xAA, 0x77, 0x62, 0xD1, 0x2E, 0x00, 0x82, 0x52, 0xBD, 0x57, 0x86, 0x76, 0x34, 0x84, 0x64, 0x31, 0x10, 0xFD, 0xAD, 0xA9, 0xEA, 0x01, 0x9A, 0x53, 0xE8, 0x7B, 0x9B, 0x0D, 0x56, 0x22, 0x50, 0xB1, 0x61, 0xF7, 0x94, 0xCE, 0x16, 0xD5, 0x90, 0x91, 0xC7, 0xD8, 0xF9, 0x3A, 0xC5, 0x36, 0x8B, 0x73, 0x03, 0xAF, 0x37, 0x38, 0xA1, 0x7A, 0x72, 0xC8, 0xB0, 0x02, 0x43, 0x63, 0xD7, 0x1D, 0x24, 0x85, 0x25, 0xA8, 0x46, 0xE4, 0xE0, 0x33, 0xAC, 0xC0, 0xA7, 0x6D, 0xF4, 0x95, 0x0F, 0x4E, 0xD6, 0x41, 0xB6, 0x99, 0x1B, 0x2D, 0x78, 0x8C, 0x97, 0xE9, 0x28, 0x4F, 0xE3, 0x6C, 0x1E, 0x9E, 0xB5, 0x11, 0xCC, 0x87, 0x7C, 0xA2, 0x47, 0x8D, 0xEB, 0x70, 0x8E, 0xA3, 0x81, 0xFE, 0x4C, 0x5A, 0x8F, 0x5E, 0x4A, 0x5B, 0xEC, 0x15, 0x20, 0xD0, 0x13, 0xFC, 0x92, 0x58, 0x7E, 0x4B, 0x49, 0x05, 0x09, 0x88, 0x30, 0x89, 0x5F, 0xAB, 0x75, 0x26, 0x80, 0xD2, 0x17, 0x8A, 0x60, 0xAE, 0xCF, 0xBE, 0x96, 0x55, 0x54, 0x07, 0xED, 0x0C, 0x9C, 0xCD, 0xBA, 0xA5, 0x32, 0x2A, 0x29, 0x35, 0x12, 0x83, 0x27, 0xEE, 0xC9, 0x7F, 0x98, 0xE5, 0xB9, 0x19, 0xC6, 0x3E, 0x0E, 0x42, 0x0B, 0xB7, 0x1A, 0xA4, 0x6A, 0x2C, 0xE2, 0xD3, 0xF8, 0xCA, 0x18, 0xF0, 0xDF, 0xDC, 0x23, 0x1C, 0x3B, 0x48, 0xBC, 0xFB, 0xB2, 0x65, 0xEF, 0x6E, 0xFA, 0xDB, 0xF6, 0x14, 0x71, 0x6F, 0xD4, 0x5D, 0x5C, 0x4D, 0x93, 0xFF, 0xD9, 0x39, 0x45, 0x40, 0x2F, 0xE7, 0x67, 0x04, 0xC4, 0xB3, 0xA6, 0x7D, 0xC2, 0x2B, 0xC1, 0xBF, 0x1F, 0x06, 0x3C, 0xA0); $ach = $lut[$ach ^ 0x55]; $rnh = $lut[$rnh ^ 0xAA]; $min = $lut[$min ^ 0xF0]; $sec = $lut[$sec ^ 0x0F]; $chk1 = (0xD4 + 0xA7 * (0xC7 + $ach + $rnh + $min + $sec)) % 256; $chk2 = (0xD4 + 0xA7 * (0x8A ^ $ach ^ $rnh ^ $min ^ $sec)) % 256; $ach ^= $chk2; $rnh ^= $chk2; $min ^= $chk2; $sec ^= $chk2; function doByte($b){ $encoding = "HBEAVLGFCSDIM267"; echo $encoding[$b % 16]; echo $encoding[$b >> 4]; } doByte($ach); doByte($rnh); doByte($min); doByte($sec); doByte($chk1); doByte($chk2); echo "\n"; ?> -- Variables -- DD00 - hours XOR 55 DD01 - minutes XOR FF DD02 - seconds XOR AA DA80 - Room1 script counter DA81 - Room2 script counter DA82 - Room3 script counter DA83 - Room3 after bruno run-only-once variable DA84 - number of 4F functions unlocked DA85 - Room4 script counter DA86 - Room5 script counter DA87 - Room6 script counter 2:BFF0 - set to E2 when you get the "I'm good on my own" achievement 2:BFF1 - set to 57 when you get the "Top percentage" achievement 2:BFF2 - set to 8C when you get the "0x Up Presses" achievement 2:BFF3 - set to 2D when you get the "Guard Skip" achievement 2:BFF5 - set to 5D when you get the "Did I getcha?" achievement 3:BFF4 - set to DD when you get the "Pokedex flags are weird" achievement 2:BFFA - temp variable for the "0x Up Presses" achievement. Initialized to 0, set to D_UP when up is pressed 2:BFFB - $28 when you have a chansey, $00 if you don't 3:AEF8 - 0: show 4F intro - 1: skip 4F intro 3:A1C7 - 0: show ClearSAV intro - 1: skip ClearSAV intro 3:A972 - buffer for code generation: A972 - achievements field (ACH) A973 - random/maxed time (RNH) bits 7-1 - random bit 0 - set when IGT over an hour A974 - minutes (MIN) A975 - seconds (SEC) A976 - checksum (CHK1) A977 - checksum (CHK2) P. S. ZZAZZ sucks at coding, I marked every facepalm with NotLikeThis. There's 76 of them. -- Disassembly -- Room5Setup: 01:D60E rra ; value 1F for the script index, almost no-op 01:D60F ld hl, DA94 ; cerulean, not visited, then 7 unused bytes 01:D612 jp hl Room6Setup2: 01:D63C ld hl, DA95 01:D63F jp hl Room6Setup: 01:D64B jr Room6Setup2 ; 18 EF - first byte as script counter Room3Setup: 01:D7C3 ld hl, DA92 01:D7C6 jp hl Room4Setup: 01:D7F3 ld hl, DA93 01:D7F6 jp hl 4FEntryPoint: 01:DA65 jp Do4F EntryPoint: 01:DA90 ld e,d ; simple signature 01:DA91 ld e,d 01:DA92 ld b,c 01:DA93 ld e,d 01:DA94 ld e,d 01:DA95 ld b,h 01:DA96 ld e,d 01:DA97 ld e,d 01:DA98 scf 01:DA99 ld e,d 01:DA9A ld e,d 01:DA9B ld c,h 01:DA9C ld e,d 01:DA9D ld e,d 01:DA9E ld d,a 01:DA9F ld e,d 01:DAA0 ld e,d 01:DAA1 ld b,c 01:DAA2 ld e,d 01:DAA3 ld e,d 01:DAA4 ld b,l 01:DAA5 ld e,d 01:DAA6 ld e,d 01:DAA7 ld a,b 01:DAA8 ld a,b 01:DAA9 ld a,l ; A ends up with the lower half of the script pointer, all these LDs act as a nop-sled to make it possible to call the script from different addresses 01:DAAA sub a,90 01:DAAC add a 01:DAAD ld c,a 01:DAAE xor a 01:DAAF ld b,a 01:DAB0 ld hl,Jumptable 01:DAB3 add hl,bc 01:DAB4 ld a,0A 01:DAB6 ld (0000),a ; unlock SRAM 01:DAB9 ldi a,(hl) 01:DABA ld h,(hl) 01:DABB ld l,a 01:DABC jp CallFunctionInSRA2 ReturnToSRA2: 01:DAC2 ld a,0A 01:DAC4 ld (0000),a 01:DAC7 ld a,02 01:DAC9 ld (4000),a 01:DACC ret Jumptable: 01:DAD0 dw Room1 ; A=90 01:DAD2 dw Room2 ; A=91 01:DAD4 dw Room3 ; A=92 01:DAD6 dw Room4 ; A=93 01:DAD8 dw Room5 ; A=94 01:DADA dw Room6 ; A=95 OurOpenTextBox: 01:DB00 call LoadFontTilePatterns 01:DB03 ld a,01 01:DB05 ld (FFBA),a 01:DB08 call CopyScreenTileBufferToVRAM 01:DB0B xor a 01:DB0C ld (FFB0),a 01:DB0F jp ReturnToSRA2 OurPrintText: 01:DB12 push hl 01:DB13 call SaveScreenTilesToBuffer1 01:DB16 call OurOpenTextBox 01:DB19 pop hl 01:DB1A call PrintText 01:DB1D call LoadScreenTilesFromBuffer1 01:DB20 jp ReturnToSRA2 OurCommandProcessor: 01:DB30 ldi a,(hl) ; FF - return 01:DB31 cp a,FF ; HI LO DATA - write DATA to address HILO. 80 <= HI <= FE 01:DB33 ret z ; 00 is useless too, but can be tested for in one byte. Why don't you use zero as return NotLikeThis 01:DB34 cp a,80 01:DB36 jr nc,.single 01:DB38 and a,0F ; xZ HI LO <Z bytes> - copy Z bytes to HILO 01:DB3A ld c,a 01:DB3B ldi a,(hl) 01:DB3C ld d,a 01:DB3D ldi a,(hl) 01:DB3E ld e,a .loop 01:DB3F ldi a,(hl) 01:DB40 ld (de),a 01:DB41 inc de 01:DB42 dec c 01:DB43 jr nz,.loop 01:DB45 jr OurCommandProcessor .single 01:DB47 ld d,a 01:DB48 ldi a,(hl) 01:DB49 ld e,a 01:DB4A ldi a,(hl) 01:DB4B ld (de),a 01:DB4C jr OurCommandProcessor OurCloseTextbox: 01:DB50 ld a,90 01:DB52 ld (hWY),a 01:DB54 call DelayFrame 01:DB57 call LoadGBPal 01:DB5A xor a 01:DB5B ld (H_AUTOBGTRANSFERENABLED),a 01:DB5D call SwitchToMapRomBank 01:DB60 ld a,(ff00+E8) 01:DB62 ld h,a 01:DB63 xor a 01:DB64 ld l,a 01:DB65 push hl ; we jump into the center of a routine which makes it pop af without pushing. Push 0600 01:DB66 call LoadTextBoxTilePatterns 01:DB69 jp CloseTextDisplay.restoreSpriteFacingDirectionLoop+08 ; ld a,BANK(InitMapSprites) ReturnToSRA3: 01:DB80 ld a,0A 01:DB82 ld (0000),a 01:DB85 ld a,03 01:DB87 ld (4000),a 01:DB8A ret ldCmemAtHL: 01:DB90 ld c,(hl) 01:DB91 ret 01:DB92 ld (hl),c 01:DB93 ret 01:DBA0 xor a 01:DBA1 ld (4000),a 01:DBA4 ld hl,A000 01:DBA7 ld bc,1000 01:DBAA ld a,(hl) 01:DBAB inc hl 01:DBAC ld e,(hl) 01:DBAD inc hl 01:DBAE cp a,39 01:DBB0 jr nz,DBC1 01:DBB2 ld a,e 01:DBB3 and a 01:DBB4 jr nz,DBC1 01:DBB6 inc d 01:DBB7 ld a,d 01:DBB8 cp a,20 01:DBBA jr nz,DBC1 01:DBBC ld d,01 01:DBBE jp DB80 01:DBC1 dec bc 01:DBC2 ld a,c 01:DBC3 or b 01:DBC4 jr nz,DBAA 01:DBC6 ld d,00 01:DBC8 jp DB80 CallFunctionInSRA2: ; also runs time anticheat 01:DBE0 ld a,02 ; SRAM bank 2 01:DBE2 ld (4000),a 01:DBE5 push hl 01:DBE6 pop bc 01:DBE7 pop de ; get the return address for this function 01:DBE8 ld hl,CallFunctionInSRAMReturn.jump+1 01:DBEB ld (hl),e 01:DBEC inc hl 01:DBED ld (hl),d 01:DBEE ld hl,CallFunctionInSRAMReturn 01:DBF1 push hl 01:DBF2 push bc ; restore HL 01:DBF3 pop hl 01:DBF4 call TimeAnticheat 01:DBF7 jp hl Do4F: 01:DC00 ld a,0A 01:DC02 ld (0000),a 01:DC05 ld a,03 01:DC07 ld (4000),a 01:DC0A pop de 01:DC0B ld hl,CallFunctionInSRAMReturn.jump+1 01:DC0E ld (hl),e 01:DC0F inc hl 01:DC10 ld (hl),d 01:DC11 ld hl,CallFunctionInSRAMReturn 01:DC14 push hl 01:DC15 jp 4FHandler CallFuncionInSRAMReturn: 01:DC20 xor a 01:DC21 nop ; Why the nops? NotLikeThis 01:DC22 nop 01:DC23 nop .jump 01:DC24 jp CallFunctionInTable.returnAddress TimeAnticheat: 01:DC30 push de 01:DC31 push hl 01:DC32 ld hl,wPlayTimeHours 01:DC35 call TimeAnticheatHelper 01:DC38 ldi a,(hl) ; update the copy at DD00 01:DC39 inc hl 01:DC3A xor a,55 01:DC3C ld (de),a 01:DC3D inc de 01:DC3E ldi a,(hl) 01:DC3F xor a,FF 01:DC41 ld (de),a 01:DC42 inc de 01:DC43 ld a,(hl) 01:DC44 xor a,AA 01:DC46 ld (de),a 01:DC47 pop hl 01:DC48 pop de 01:DC49 ret TimeAnticheatHelper: ; clobbers AF, BC. If time is less than before, set it to 59:59:59. It does this by maintaining a copy of the time: 01:DC60 ld de,$DD00 ; DD00 contains hours XOR 55 01:DC63 push hl ; DD01 contains minutes XOR FF 01:DC64 push de ; DD02 contains seconds XOR AA 01:DC65 ld b,(hl) 01:DC66 ld a,(de) 01:DC67 inc hl 01:DC68 inc hl 01:DC69 inc de 01:DC6A xor a,$55 01:DC6C cp b 01:DC6D jr z,.hoursSame 01:DC6F jr c,.hoursLarger ; why don't you jump straight to .return NotLikeThis 01:DC71 jr .cheaterDetected .hoursLarger 01:DC73 jr .return ; if hours larger .hoursSame 01:DC75 ld b,(hl) 01:DC76 ld a,(de) 01:DC77 inc hl 01:DC78 inc de 01:DC79 xor a,FF 01:DC7B cp b 01:DC7C jr z,.minutesSame 01:DC7E jr c,.minutesLarger; why don't you jump straight to .return NotLikeThis 01:DC80 jr .cheaterDetected .minutesLarger 01:DC82 jr .return .minutesSame 01:DC84 ld b,(hl) 01:DC85 ld a,(de) 01:DC86 xor a,AA 01:DC88 cp b 01:DC89 jr z,.return 01:DC8B jr c,.secondsLarger; why don't you jump straight to .return NotLikeThis 01:DC8D jr .cheaterDetected .secondsLarger 01:DC8F jr .return ; that's effectively a nop NotLikeThis .return 01:DC91 pop de 01:DC92 pop hl 01:DC93 ret .cheaterDetected 01:DC94 ld hl,wPlayTimeHours 01:DC97 ld a,3B 01:DC99 ld (hl),a 01:DC9A inc hl 01:DC9B inc hl 01:DC9C ld (hl),a 01:DC9D inc hl 01:DC9E ld (hl),a 01:DC9F pop de ; why don't you jr .return NotLikeThis 01:DCA0 pop hl 01:DCA1 ret Room1: 02:A010 ld a,(DA80) ; DA80 starts as 0, incremented later. Run only once. 02:A013 and a 02:A014 ret nz 02:A015 ld c,30 ; wait 02:A017 call DelayFrames 02:A01A ld hl,wAudioFadeOutCounter ; fade out sound 02:A01D ld (hl),10 02:A01F dec hl 02:A020 ld (hl),10 02:A022 dec hl 02:A023 ld (hl),FF 02:A025 ld c,A0 ; wait 02:A027 call DelayFrames 02:A02A ld hl,.text1 02:A02D call OurPrintText 02:A030 ld a,E8 ; change four 2x2 blocks, creating a glitched barrier 02:A032 ld hl,C71D 02:A035 ldi (hl),a 02:A036 ldi (hl),a 02:A037 ldi (hl),a 02:A038 ldi (hl),a 02:A039 ld c,33 02:A03B call DelayFrames 02:A03E ld b,BANK(UsedCut) 02:A040 ld hl,UsedCut.canCut+61 ; ld a, SFX_CUT / call PlaySound... 02:A043 call Bankswitch 02:A046 ld c,40 02:A048 call DelayFrames 02:A04B ld c,AUDIO_3 02:A04D ld a,MUSIC_DUNGEON1 02:A04F call PlayMusic 02:A052 ld c,20 02:A054 call DelayFrames 02:A057 ld hl,.text2 02:A05A call OurPrintText 02:A05D ld hl,.script1 02:A060 call OurCommandProcessor 02:A063 call LoadTextBoxTilePatterns 02:A066 jp CloseTextDisplay .script1 02:A069 db $DA, $80, $01 ; DA80 = 01 - run the script only once 02:A06C db $D1, $2B, $01 ; D12B = 01 - deny using items 02:A06F db $D7, $2E, $40 ; D72E = 40 - reset instead of save in the menu 02:A072 db $D5, $3A, $00 ; D53A = 00 - no items in the PC 02:A075 db $02, $D3, $B1, $01, $46 ; D3B1 = 01 46 - staircase warp to map $46 index 1 - http://pokeworld.herokuapp.com/rb/70#4,5 02:A07A db $04, $D7, $CD, $21, $91, $DA, $E9 ; D7CD = 21 91 DA E9 - ld hl, DA91 / jp hl - why not jp DA91? the L register is used as an index 02:A081 db $D6, $62, $2D ; D662 = 2D - route 5 gate current script - array index out of bounds (Route5GateScriptPointers) - points to D7CD, effectively executing DA91 as the script 02:A084 db $FF ; end .text1 02:A085 text "Greetings." 02:A090 line "So you're back!" 02:A09F para "It is so nice to" 02:A0B0 line "see you again." 02:A0BF para "I was defeated a" 02:A0D0 line "year ago, but" 02:A0DE cont "this time, I won't" 02:A0F0 cont "give up easily." 02:A100 para "In fact, I won't" 02:A110 line "even let you do" 02:A120 cont "anything!@" 02:A12B TX_BLINK ; NotLikeThis 02:A12C text "" 02:A12D done .text2 02:A12E text "You see?" 02:A137 line "Now you're stuck!" 02:A148 para "Just give up!" 02:A156 line "You can't do" 02:A162 cont "anything here!" 02:A171 para "Surely there's no" 02:A182 line "way for you to" 02:A191 cont "go through walls!" 02:A1A3 cont "See you later!@" 02:A1B3 TX_BLINK ; NotLikeThis 02:A1B4 text "" 02:A1B5 done Room2: 02:A210 ld hl,DA81 ; if less than 4, increment and return 02:A213 ld a,(hl) 02:A214 cp a,04 02:A216 jp nc,.first ; this can be a JR NotLikeThis 02:A219 inc (hl) 02:A21A ret .first 02:A21B cp a,05 02:A21D jp z,.second ; this can be a JR NotLikeThis 02:A220 ld hl,.script1 02:A223 call OurCommandProcessor 02:A226 call AddPartyMon 02:A229 ld c,20 02:A22B call DelayFrames 02:A22E ld hl,.text1 02:A231 call OurPrintText 02:A234 ld a,1F ; modify the map 02:A236 ld hl,C713 02:A239 ldi (hl),a 02:A23A ldi (hl),a 02:A23B ldi (hl),a 02:A23C ldi (hl),a 02:A23D xor a 02:A23E ld l,1D 02:A240 ldi (hl),a 02:A241 ldi (hl),a 02:A242 ldi (hl),a 02:A243 ldi (hl),a 02:A244 ld c,10 02:A246 call DelayFrames 02:A249 ld b,BANK(UsedCut) 02:A24B ld hl,UsedCut.canCut+61 ; ld a, SFX_CUT / call PlaySound... 02:A24E call Bankswitch 02:A251 ld hl,wMapTextPtr 02:A254 ld de,.textPointer 02:A257 inc de 02:A258 ld (hl),e 02:A259 inc hl 02:A25A ld (hl),d 02:A25B ld hl,DA81 02:A25E inc (hl) 02:A25F jp OurCloseTextbox .second 02:A262 ld a,(wSimulatedJoypadStatesIndex) ; runs continously. If CD38 is not 0 (ie WTW GS code enabled now or just before)... 02:A265 and a 02:A266 ret z 02:A267 xor a ; try to clear it first (if used in previous room and now disabled, the value stays) 02:A268 ld (wSimulatedJoypadStatesIndex),a 02:A26B halt ; wait one frame (no NOP!) 02:A26C ld a,(wSimulatedJoypadStatesIndex) ; if the code is still on (GS applies in VBlank) 02:A26F and a 02:A270 ret z 02:A271 di ; disable interrupts - nothing happens now 02:A272 ld hl,8000 02:A275 ld de,FF04 .hangLoop 02:A278 ld a,h ; fill VRAM with random values 02:A279 and a,DF ; when HL rolls over to A000, this AND makes it 8000 again 02:A27B ld h,a 02:A27C ld a,(de) 02:A27D ld (hl),a 02:A27E inc hl 02:A27F jr .hangLoop .script1 02:A281 db $CF, $91, $85 ; CF91 = 85 - parameter for AddPartyMon - Magikarp 02:A284 db $CC, $49, $10 ; CC49 = 10 - parameter for AddPartyMon - player party, do not allow naming 02:A287 db $D1, $27, $01 ; D127 = 01 - parameter for AddPartyMon - level 1 02:A28A db $D3, $B0, $CC ; D3B0 = CC - disable the bottom 2 warps by moving them out of bounds 02:A28D db $D3, $B4, $CC ; D3B4 = CC - same as above 02:A290 db $02, $D3, $B9, $00, $F6 ; D3B9 = 00 F6 - set the top 2 warp locations to map F6 index 0 - http://pokeworld.herokuapp.com/rb/246#4,11 02:A295 db $02, $D3, $BD, $00, $F6 ; D3BD = 00 F6 - same as above 02:A29A db $04, $D2, $B5, "lol@" ; D2B5 = AB AE AB 50 - first pokemon nickname = "lol" 02:A2A1 db $D1, $2B, $00 ; D12B = 00 - allow using items 02:A2A4 db $FF ; end - the script for bruno is set up in the savefile itself, 57 - points to D7C3 .textPointer 02:A2A5 ld de,.glitchDealerText .glitchDealerText 02:A2A8 TX_ASM 02:A2A9 ld hl,.dealerIntroText 02:A2AC call PrintText 02:A2AF ld a,MONEY_BOX 02:A2B1 ld (wTextBoxID),a 02:A2B4 call DisplayTextBoxID 02:A2B7 call YesNoChoice 02:A2BA ld a,(wCurrentMenuItem) 02:A2BD and a 02:A2BE jr nz,.dealerNo 02:A2C0 ld hl,wPlayerMoney 02:A2C3 ld a,99 02:A2C5 cp (hl) 02:A2C6 jr z,.next1 02:A2C8 jr nc,.noMoney .next1 02:A2CA inc hl 02:A2CB cp (hl) 02:A2CC jr z,.next2 02:A2CE jr nc,.noMoney .next2 02:A2D0 inc hl 02:A2D1 cp (hl) 02:A2D2 jr z,.next3 02:A2D4 jr nc,.noMoney .next3 02:A2D6 ld hl,wPlayerMoney ; double dec hl could save a byte 02:A2D9 xor a ; take all the money (even if you have more than 999999 - there are explicit checks for more than that) 02:A2DA ldi (hl),a 02:A2DB ldi (hl),a 02:A2DC ldi (hl),a 02:A2DD ld a,MONEY_BOX 02:A2DF ld (wTextBoxID),a 02:A2E2 call DisplayTextBoxID 02:A2E5 ld hl,.dealerBoughtText1 02:A2E8 call PrintText 02:A2EB ld c,01 02:A2ED ld b,A2 ; RIVAL's 02:A2EF call GiveItem 02:A2F2 ld hl,.dealerBoughtText2 02:A2F5 call PrintText 02:A2F8 jr .textScriptEnd .noMoney 02:A2FA ld hl,.noMoneyText 02:A2FD call PrintText 02:A300 jr .textScriptEnd .dealerNo 02:A302 ld hl,.dealerNoText 02:A305 call PrintText 02:A308 jr .textScriptEnd ; NotLikeThis #nopjump .textScriptEnd 02:A30A jp TextScriptEnd .dealerIntroText 02:A30D text "Have I got a deal" 02:A31F line "just for you!" 02:A32D para "You can have this" 02:A33F line "swell glitch item" 02:A351 cont "for just ¥999999!" 02:A363 done .dealerNoText 02:A364 text "You don't want it?" 02:A376 line "Okay then." 02:A381 done .noMoneyText 02:A382 text "Oops! You can't" 02:A391 line "afford it." 02:A39C para "That's really" 02:A3A9 line "unfortunate." 02:A3B6 para "If only you had" 02:A3C6 line "a way to get an" 02:A3D6 cont "infinite amount" 02:A3E6 cont "of money..." 02:A3F2 done .dealerBoughtText1 02:A3F3 text "Sold! Here's your" 02:A404 line "glitch item!@" 02:A412 TX_BLINK ; NotLikeThis 02:A413 text "" 02:A414 done .dealerBoughtText2 02:A415 text "<PLAYER> received" 02:A420 line "RIVAL's@" 02:A429 TX_SFX_ITEM_2 02:A42A text "" 02:A42B done .text1 02:A42C text "What? How did you" 02:A43E line "escape?" 02:A446 para "Ah, you and your" 02:A457 line "debugging tools" 02:A467 cont "these days..." 02:A475 para "Let me try that" 02:A485 line "again." 02:A48C para "But this time, I" 02:A49D line "will crash the" 02:A4AC cont "game if I see any" 02:A4BE cont "WTW cheating!@" 02:A4CD TX_BLINK ; NotLikeThis 02:A4CE text "" 02:A4CF done Room3: 02:A510 ld hl,wYCoord 02:A513 ld a,(hl) 02:A514 cp a,06 02:A516 jr nc,.move 02:A518 ld hl,DA82 02:A51B ld a,(hl) 02:A51C and a 02:A51D jr z,.part0 02:A51F cp a,02 02:A521 jp z,.part2 02:A524 ld hl,wMapTextPtr ; part 1 02:A527 ld de,.textPointer 02:A52A inc de ; NotLikeThis 02:A52B ld (hl),e 02:A52C inc hl 02:A52D ld (hl),d 02:A52E ld hl,wPartyMon1Level 02:A531 ld a,(hl) 02:A532 cp a,0A 02:A534 jr c,.notL10 ; you could jump straight to .detectWTW NotLikeThis 02:A536 ld a,57 02:A538 ld (BFF1),a .notL10 02:A53B call .detectWTW ; NotLikeThis 02:A53E ret .move 02:A53F ld hl,wSimulatedJoypadStatesEnd 02:A542 ld a,D_UP 02:A544 ld (hl),a 02:A545 ld a,01 02:A547 ld (wSimulatedJoypadStatesIndex),a 02:A54A call StartSimulatingJoypadStates ; NotLikeThis 02:A54D ret .part0 02:A54E ld hl,wNumBagItems ; clear the bag 02:A551 ld (hl),00 02:A553 inc hl 02:A554 ld (hl),FF 02:A556 inc hl 02:A557 inc hl 02:A558 ld a,(hl) ; if this is zero, no items were obtained 02:A559 ld hl,.idiotText 02:A55C and a 02:A55D jr nz,.usedItem 02:A55F ld hl,.smartText 02:A562 ld a,E2 ; give the achievement 02:A564 ld (BFF0),a .usedItem 02:A567 call OurPrintText 02:A56A ld hl,.script1 02:A56D call OurCommandProcessor 02:A570 jp OurCloseTextbox ; oh, so you KNOW it's possible .part2 02:A573 inc (hl) ; no idea why 02:A574 ld hl,wMapTextPtr ; repair text pointer after battle 02:A577 ld de,.textPointer ; NotLikeThis 02:A57A inc de 02:A57B ld (hl),e 02:A57C inc hl 02:A57D ld (hl),d 02:A57E ld hl,wd732 02:A581 bit 5,(hl) ; seems to be used as an anticheat flag, but why? Making sure one doesn't trigger this script without battling? 02:A583 jr z,.hang 02:A585 ld hl,.script1 02:A588 call OurCommandProcessor 02:A58B ld hl,DA83 ; starts as 0 02:A58E ld a,(hl) 02:A58F and a 02:A590 ret nz 02:A591 inc (hl) ; make it 1 - run only once 02:A592 ld hl,.afterBrunoText1 02:A595 call OurPrintText 02:A598 ld hl,.afterBrunoText2 02:A59B call OurPrintText 02:A59E ld c,01 02:A5A0 ld b,59 ; 4F - jumps to FA65 when used 02:A5A2 call GiveItem 02:A5A5 jp OurCloseTextbox .detectWTW 02:A5A8 ld a,(wSimulatedJoypadStatesIndex) 02:A5AB and a 02:A5AC ret z .hang 02:A5AD di 02:A5AE jr $ .script1 02:A5B0 db $DA, $82, $01 ; DA82 = 01 - script counter for room 3 02:A5B3 db $D3, $BA, $33 ; D3BA = 33 - warp 2 destination map to $33 - defaults to index 0 - http://pokeworld.herokuapp.com/rb/51#1,0 02:A5B6 db $02, $D3, $BD, $00, $33 ; D3BD = 00 33 - warp 3 destination map to $33, index 0 (defaults to 1) - http://pokeworld.herokuapp.com/rb/51#1,0 02:A5BB db $D1, $2B, $FF ; D12B = FF - link state to FF - allow using items but don't let ReadTrainer change any moves 02:A5BE db $DA, $84, $01 ; DA84 = 01 - allow only ClearDoor 02:A5C1 db $FF ; end - the script counter for viridian forest is set up in the savefile to 18, goes to D7F3 .textPointer 02:A5C2 ld de,.brunoScript .brunoScript 02:A5C5 text "... ... ... ..." 02:A5D5 line "... ... ... ...@" 02:A5E6 TX_ASM 02:A5E7 ld de, wEnemyPartyCount 02:A5EA ld hl,.brunoScriptRAM 02:A5ED ld bc,00FF 02:A5F0 call CopyData 02:A5F3 call wEnemyPartyCount 02:A5F6 ld hl,.script2 02:A5F9 call OurCommandProcessor 02:A5FC ld hl,wd732 02:A5FF set 5,(hl) ; currently being forced to ride bike (cycling road) - wut? 02:A601 ld hl,DA82 02:A604 ld (hl),02 ; trigger .part2 02:A606 jp TextScriptEnd .brunoScriptRAM 02:A609 ld a,0A ; go to SRA0 02:A60B ld (0000),a 02:A60E xor a 02:A60F ld (4000),a 02:A612 ld hl,BE00 ; fill with 53 50 repeating pattern, BE00-BFFD 02:A615 ld c,FF .loop 02:A617 ld (hl),53 02:A619 inc hl 02:A61A ld (hl),50 02:A61C inc hl 02:A61D dec c 02:A61E jr nz,.loop 02:A620 ld a,02 ; back to SRA2 02:A622 ld (4000),a 02:A625 ret .script2 02:A626 db $04, $D0, $59, $D0, $00, $00, $FF ; D059 = D0 00 00 FF - OPP_SUPER_NERD, normal battle, lone attack? - trigger the battle 02:A62D db $04, $D8, $87, "???@" ; D887 = "???" - link enemy name 02:A634 db $0C, $D8, $A4, $B8, $01, $01, $FF ; D8A4 = B8 01 01 FF... - first enemy pokemon - ghost missingno, 257 HP, level 255 02:A63B db $00, $00, $00, $FF, $BF, $BF, $BF, $BF ; ... - catch rate 255, no types, no status, 4 super glitch moves 02:A643 db $0B, $D8, $C5, $FF, $01, $01, $11 ; D8C5 = FF 01 01 11... - level 255, max HP 257 02:A64A db $11, $11, $11, $11, $11, $11, $11 ; ... - 4369 each stat 02:A651 db $08, $D3, "PWNZORD@" ; D34A - "PWNZORD" - setup super glitch move name 02:A65C db $03, $D8, $9C, $01, $B8, $FF ; enemy party: 1 pokemon, ghost missingno 02:A662 db $FF ; end .idiotText 02:A663 text "What? You escaped" 02:A675 line "again?" 02:A67C para "So now, let's see" 02:A68D line "how you will" 02:A69A cont "handle THIS" 02:A6A6 cont "situation!@" 02:A6B2 TX_BLINK ; NotLikeThis 02:A6B3 text "" 02:A6B4 done .smartText 02:A6B5 text "What? You escaped" 02:A6C7 line "again?" 02:A6CE para "And you didn't" 02:A6DC line "even need any" 02:A6EA cont "items to do so?" 02:A6FA para "Looks like I'm" 02:A708 line "dealing with a" 02:A717 cont "professional!@" 02:A726 TX_BLINK ; NotLikeThis 02:A727 text "" 02:A728 done .afterBrunoText1 02:A729 text "..." 02:A72D line "..." 02:A731 para "What?" 02:A737 line "What happened?" 02:A746 para "The last thing I" 02:A757 line "remember was a" 02:A766 cont "ZAPDOS cry..." 02:A774 para "And after that," 02:A784 line "everything went" 02:A794 cont "black..." 02:A79D para "I also found this" 02:A7AF line "really strange" 02:A7BE cont "item in my room." 02:A7CF para "I have no idea" 02:A7DE line "what it does," 02:A7EC cont "maybe you can" 02:A7FA cont "make some use out" 02:A80C cont "of it...@" 02:A816 TX_BLINK ; NotLikeThis 02:A817 text "" 02:A818 done .afterBrunoText2 02:A819 text "<PLAYER> received" 02:A824 line "4F!@" 02:A829 TX_SFX_ITEM_2 02:A82A text "" 02:A82B done Room4: 02:A910 ld hl,DA85 02:A913 ld a,(hl) 02:A914 cp a,02 02:A916 jr z,.part2 02:A918 cp a,01 02:A91A jr z,.part1 02:A91C inc (hl) ; move to .part1 02:A91D call JumpToBlack 02:A920 call Room4LoadMap 02:A923 ld b,BANK(UsedCut) 02:A925 ld hl,UsedCut.canCut+0x66 ; ld a, $90 / ld [hWY], a / call UpdateSprites / jp RedrawMapView 02:A928 call Bankswitch 02:A92B ld hl,.script1 02:A92E call OurCommandProcessor 02:A931 ld hl,BFFA 02:A934 ld (hl),00 02:A936 ret .part1 02:A937 inc (hl) ; move to .part2 02:A938 ld hl,PlayerFacingDirection; face down 02:A93B ld (hl),00 02:A93D ld hl,.script1 02:A940 call OurCommandProcessor 02:A943 call LoadGBPal ; NotLikeThis 02:A946 ret .part2 02:A947 call .detectWTW 02:A94A ld hl,hJoyInput 02:A94D ld a,(hl) 02:A94E and a,D_UP 02:A950 ld hl,BFFA ; gets set when no achievement 02:A953 or (hl) 02:A954 ld (hl),a 02:A955 ret .detectWTW 02:A956 ld a,(wSimulatedJoypadStatesIndex) 02:A959 and a 02:A95A ret z 02:A95B di 02:A95C jr A95C .script1 02:A95E db $08, $D3, $AF, $18, $0E, $00, $C1 ; D3AF = 18 0E 00 C1 - ladder warp - http://pokeworld.herokuapp.com/rb/193#4,7 02:A965 db $66, $66, $66, $66 ; D3B3 = 66 66 66 66 - no other warp 02:A969 db $DA, $84, $02 ; DA84 = 02 - unlock TileBlockPtr 02:A96C db $D4, $E1, $00 ; D4E1 = 00 - no sprites on the map 02:A96F db $C1, $10, $00 ; C110 = 00 - disable sprite 1 02:A972 db $C1, $20, $00 ; C120 = 00 - disable sprite 2 02:A975 db $C1, $30, $00 ; C130 = 00 - disable sprite 3 02:A978 db $C1, $40, $00 ; C140 = 00 - disable sprite 4 02:A97B db $C1, $50, $00 ; C150 = 00 - disable sprite 5 02:A97E db $C1, $60, $00 ; C160 = 00 - disable sprite 6 02:A981 db $FF ; end - route 22 gate cur script 1F, points to D60E JumpToBlack: ; this could be inlined NotLikeThis 02:A982 ld a,FF 02:A984 ld (ff00+47),a 02:A986 ld (ff00+48),a 02:A988 ld (ff00+49),a 02:A98A ret Room4LoadMap: ; this could be inlined NotLikeThis 02:A98B ld de,wOverworldMap 02:A98E ld hl,.data .loop 02:A991 ld a,(hl) ; simple compression 02:A992 cp a,FF ; FF xx - xx bytes of 03 02:A994 jr z,.darkness ; FE - stop 02:A996 cp a,FE ; any other - literal 02:A998 ret z 02:A999 ld (de),a 02:A99A inc hl 02:A99B inc de 02:A99C jr .loop .darkness 02:A99E inc hl 02:A99F ld c,(hl) 02:A9A0 inc hl 02:A9A1 ld a,03 .tinyloop 02:A9A3 ld (de),a 02:A9A4 inc de 02:A9A5 dec c 02:A9A6 jr nz,.tinyloop 02:A9A8 jr .loop .data 02:A9AA db $FF, $48, $29, $29, $FF, $0B, $39, $39, $39, $49, $FF, $06, $29, $29, $FF, $0B 02:A9BA db $35, $35, $29, $3B, $FF, $06, $1F, $1F, $FF, $0B, $02, $02, $37, $3B, $FF, $06 02:A9CA db $29, $29, $7E, $7F, $7D, $29, $29, $FF, $06, $02, $02, $37, $3B, $FF, $0B, $29 02:A9DA db $29, $49, $FF, $15, $49, $37, $49, $FF, $15, $49, $37, $4D, $FF, $15, $4D, $3B 02:A9EA db $4D, $FF, $15, $4D, $39, $49, $FF, $15, $4D, $4D, $29, $FF, $15, $29, $29, $FF 02:A9FA db $10, $29, $29, $29, $FF, $02, $29, $29, $FF, $10, $29, $64, $29, $1F, $1F, $37 02:AA0A db $29, $FF, $10, $29, $29, $29, $FF, $53, $02, $02, $02, $1B, $07, $02, $02, $06 02:AA1A db $1B, $FF, $0E, $02, $02, $02, $1B, $07, $02, $02, $06, $1B, $FF, $0E, $02, $02 02:AA2A db $02, $1B, $07, $02, $02, $06, $1B, $07, $02, $02, $06, $1B, $02, $02, $02, $FF 02:AA3A db $06, $06, $01, $01, $1B, $01, $01, $01, $01, $14, $01, $01, $01, $16, $1B, $01 02:AA4A db $01, $07, $FF, $06, $06, $01, $01, $1B, $1B, $1B, $1B, $1B, $18, $1B, $1B, $1B 02:AA5A db $1B, $1B, $01, $01, $07, $FF, $06, $02, $02, $02, $02, $02, $02, $02, $37, $1B 02:AA6A db $15, $02, $02, $02, $02, $02, $02, $02, $FF, $06, $02, $02, $02, $02, $02, $02 02:AA7A db $02, $37, $58, $3B, $02, $02, $02, $02, $02, $02, $02, $FF, $DD, $FF, $DD, $FE Room5: 02:AB10 call .disableOriginal 02:AB13 ld hl,DA86 02:AB16 ld a,(hl) 02:AB17 and a 02:AB18 jr z,.part0 02:AB1A ld hl,wYCoord 02:AB1D ld a,(hl) 02:AB1E cp a,07 02:AB20 jp z,.blockExit 02:AB23 ld hl,.guardedArea 02:AB26 call ArePlayerCoordsInArray 02:AB29 jr nc,.regularStuff; jp c, .guard NotLikeThis 02:AB2B jp .guard .regularStuff 02:AB2E ld hl,.script1 02:AB31 call OurCommandProcessor 02:AB34 ld hl,wMapTextPtr 02:AB37 ld de,.textPointer ; NotLikeThis 02:AB3A inc de 02:AB3B ld (hl),e 02:AB3C inc hl 02:AB3D ld (hl),d 02:AB3E call .detectWTW ; NotLikeThis 02:AB41 ret .detectWTW 02:AB42 ld a,(wSimulatedJoypadStatesIndex) 02:AB45 and a 02:AB46 ret z 02:AB47 di .hang 02:AB48 jr .hang .script1 02:AB4A db $D3, $B0, $EE ; move warp OOB 02:AB4D db $D3, $B4, $EE ; move warp OOB 02:AB40 db $02, $D3, $B9, $00, $76 ; warp to HoF 02:AB55 db $02, $D3, $BD, $00, $76 ; warp to HoF 02:AB5A db $D7, $4B, $FF ; some event flags 02:AB5D db $FF ; end - HoF script counter $18, points to D64B 02:AB5E ret .part0 02:AB5F inc (hl) ; redirect to .part1 02:AB60 ld hl,.emptyText ; NotLikeThis 02:AB63 call PrintText 02:AB66 ld hl,DA84 ; unlock GivePokemon 02:AB69 ld (hl),03 02:AB6B ld hl,BFFA 02:AB6E ld a,(hl) 02:AB6F and a 02:AB70 jr nz,.pressedUp 02:AB72 ld hl,BFF2 ; if you did this earlier you could've used a ret nz above NotLikeThis 02:AB75 ld (hl),8C .pressedUp 02:AB77 ld a,00 02:AB79 ld (BFFB),a 02:AB7C ret .guard 02:AB7D ld hl,wJoyIgnore 02:AB80 ld (hl),FF 02:AB82 ld hl,C102 ; make sure you don't trigger the textbox during the walking animation, the font overwrites moving sprites data 02:AB85 ld a,(hl) 02:AB86 and a,01 02:AB88 ret nz 02:AB89 ld hl,wJoyIgnore 02:AB8C ld (hl),00 02:AB8E call .detectChansey 02:AB91 cp a,28 02:AB93 ret z 02:AB94 ld hl,wJoyIgnore ; already done! NotLikeThis 02:AB97 ld (hl),00 02:AB99 ld hl,.guardText 02:AB9C call OurPrintText 02:AB9F ld hl,wYCoord 02:ABA2 ld a,(hl) 02:ABA3 cp a,01 02:ABA5 jr nz,.moveOnlyOnce 02:ABA7 ld a,D_RIGHT ; no idea why... 02:ABA9 ld hl,wSimulatedJoypadStatesEnd 02:ABAC ld (hl),a 02:ABAD ld a,D_DOWN 02:ABAF inc hl 02:ABB0 ld (hl),a 02:ABB1 ld a,02 02:ABB3 ld (wSimulatedJoypadStatesIndex),a 02:ABB6 call StartSimulatingJoypadStates 02:ABB9 jp OurCloseTextbox .moveOnlyOnce 02:ABBC ld a,D_DOWN 02:ABBE ld hl,wCanEvolveFlags 02:ABC1 ld (hl),a 02:ABC2 ld a,01 02:ABC4 ld (wSimulatedJoypadStatesIndex),a 02:ABC7 call StartSimulatingJoypadStates 02:ABCA jp OurCloseTextbox .blockExit 02:ABCD ld hl,wSimulatedJoypadStatesEnd 02:ABD0 ld a,D_UP 02:ABD2 ld (hl),a 02:ABD3 ld a,01 02:ABD5 ld (wSimulatedJoypadStatesIndex),a 02:ABD8 call StartSimulatingJoypadStates ; NotLikeThis 02:ABDB ret .detectChansey 02:ABDC ld hl,wPartySpecies .detectChanseyLoop 02:ABDF ld a,(hl) 02:ABE0 cp a,FF 02:ABE2 ret z 02:ABE3 cp a,28 02:ABE5 jr z,.found 02:ABE7 inc hl 02:ABE8 jr ABDF .found 02:ABEA ld (BFFB),a 02:ABED ret .disableOriginal 02:ABEE inc sp ; ADD SP,0A NotLikeThis 02:ABEF inc sp 02:ABF0 inc sp 02:ABF1 inc sp 02:ABF2 inc sp 02:ABF3 inc sp 02:ABF4 inc sp 02:ABF5 inc sp 02:ABF6 inc sp 02:ABF7 inc sp 02:ABF8 pop hl 02:ABF9 ld l,9D ; change the return address of Route22GateScript's CallFunctionInTable to a ret 02:ABFB push hl 02:ABFC dec sp ; ADD SP,-A NotLikeThis 02:ABFD dec sp 02:ABFE dec sp 02:ABFF dec sp 02:AC00 dec sp 02:AC01 dec sp 02:AC02 dec sp 02:AC03 dec sp 02:AC04 dec sp 02:AC05 dec sp 02:AC06 ret .textPointer 02:AC07 ld bc,.guardText .guardText 02:AC0A TX_ASM ; NotLikeThis 02:AC0B ld hl,.guardRules 02:AC0E call PrintText 02:AC11 jp TextScriptEnd .guardRules 02:AC14 text "To continue past" 02:AC25 line "here, you need to" 02:AC37 cont "own a CHANSEY." 02:AC46 para "Sorry!" 02:AC4D line "Rules are rules!@" 02:AC5F TX_BLINK ; NotLikeThis 02:AC60 text "" 02:AC61 done .guardedArea 02:AC62 db $02, $04 02:AC64 db $02, $05 02:AC66 db $01, $05 ; unreachable anyway 02:AC68 db $01, $04 ; and untested. Letters appear NotLikeThis 02:AC6A db $FF .emptyText 02:AC6B text "" ; why don't you at least use the ending of another text? NotLikeThis 02:AC6C done Room6: 02:AD10 ld hl,DA87 02:AD13 ld a,(hl) 02:AD14 cp a,00 ; NotLikeThis 02:AD16 jp z,.part0 ; JR! NotLikeThis 02:AD19 cp a,01 02:AD1B jp z,.part1 ; DEFINITELY JR! NotLikeThis 02:AD1E ld hl,wStepCounter 02:AD21 ld a,(hl) 02:AD22 cp a,FF ; how about INC A? NotLikeThis 02:AD24 jp z,.triesToWalk 02:AD27 cp a,FA 02:AD29 jp z,.walksMore 02:AD2C call .checkAchievement 02:AD2F call .detectWTW ; NotLikeThis - you can inline this 02:AD32 ret ; NotLikeThis - you can use jr .detectWTW 02:AD33 ld a,(wSimulatedJoypadStatesIndex) 02:AD36 and a 02:AD37 ret z 02:AD38 di 02:AD39 jr AD39 .part1 02:AD3B inc (hl) 02:AD3C call LoadGBPal 02:AD3F ld c,60 .fadeOutLoop 02:AD41 ld hl,wAudioFadeOutControl 02:AD44 halt 02:AD45 ld a,FF 02:AD47 ld (hl),a 02:AD48 call PlaySound 02:AD4B dec c 02:AD4C jr nz,.fadeOutLoop 02:AD4E ld hl,.text1 02:AD51 call OurPrintText 02:AD54 ld hl,wStepCounter 02:AD57 ld (hl),00 02:AD59 ld hl,DA84 02:AD5C ld (hl),04 ; unlock ClearSAV 02:AD5E jp OurCloseTextbox .part0 02:AD61 inc (hl) 02:AD62 call .black 02:AD65 call .fillMapWithBlack 02:AD68 ld b,BANK(UsedCut) 02:AD6A ld hl,UsedCut.canCut+0x66 ; ld a, $90 / ld [hWY], a / call UpdateSprites / jp RedrawMapView 02:AD6D call Bankswitch 02:AD70 ld hl,wYCoord 02:AD73 ld (hl),99 02:AD75 ld hl,BFFB 02:AD78 ld a,(hl) 02:AD79 cp a,28 02:AD7B jr z,.dontFuckTheGuard ; ret z NotLikeThis 02:AD7D ld hl,BFF3 02:AD80 ld (hl),2D .dontFuckTheGuard 02:AD82 ret .checkAchievement 02:AD83 ld hl,hJoyInput 02:AD86 ld a,(hl) 02:AD87 and a,D_LEFT 02:AD89 jr nz,.holdingLeft 02:AD8B ld a,(hl) 02:AD8C and a,D_RIGHT 02:AD8E jr nz,.holdingRight 02:AD90 ret ; couldn't you move .holdingRight here and use RET Z? NotLikeThis .holdingLeft 02:AD91 ld hl,wXCoord 02:AD94 ld a,(hl) ; if at the leftmost edge 02:AD95 and a 02:AD96 ret nz 02:AD97 jr .award .holdingRight 02:AD99 ld hl,wXCoord 02:AD9C ld a,(hl) 02:AD9D cp a,09 ; or at the rightmost edge 02:AD9F ret nz .award 02:ADA0 ld hl,BFF5 02:ADA3 ld (hl),5D 02:ADA5 ret .triesToWalk 02:ADA6 dec (hl) 02:ADA7 ld hl,AE67 02:ADAA call OurPrintText 02:ADAD jp OurCloseTextbox .walksMore 02:ADB0 dec (hl) 02:ADB1 ld hl,.walksMoreText 02:ADB4 call OurPrintText 02:ADB7 jp OurCloseTextbox .black 02:ADBA ld a,FF 02:ADBC ld (ff00+47),a 02:ADBE ld (ff00+48),a 02:ADC0 ld (ff00+49),a 02:ADC2 ret .fillMapWithBlack 02:ADC3 ld hl,wOverworldMap 02:ADC6 ld bc,0200 02:ADC9 ld a,03 02:ADCB jp FillMemory .text1 02:ADCE text "Enough already!" 02:ADDE para "All of this was" 02:ADEE line "fun and all, but" 02:ADFF cont "this time, you're" 02:AE10 cont "trapped for good!" 02:AE22 para "No warps. No NPCs." 02:AE35 line "No signs." 02:AE3F para "Complete darkness." 02:AE52 line "Enjoy your stay.@" 02:AE63 TX_BLINK ; NotLikeThis 02:AE64 text "" 02:AE66 done .triesToWalkText 02:AE67 text "Oh..." 02:AE6D line "You don't want to" 02:AE7E cont "erase the save?" 02:AE8E para "... Yes!" 02:AE97 line "Exactly!" 02:AEA0 para "This definitely" 02:AEB0 line "wouldn't work!" 02:AEBE cont "It's too easy to" 02:AECE cont "be true!" 02:AED7 para "You should try" 02:AEE6 line "going out of" 02:AEF3 cont "bounds instead!" 02:AF03 para "Try going to the" 02:AF14 line "side! Trust me!@" 02:AF25 TX_BLINK ; NotLikeThis 02:AF26 text "" 02:AF27 done .walksMoreText 02:AF28 text "Yes! Only a few" 02:AF38 line "more steps!" 02:AF44 para "Look, I think I" 02:AF54 line "see a PIKABLU" 02:AF62 cont "hiding over here!@" 02:AF75 TX_BLINK ; NotLikeThis 02:AF76 text "" 02:AF77 done 4FHandler: 03:A000 ld hl,DA84 ; room 4 script counter 03:A003 ld a,(hl) 03:A004 ld hl,AEF9 ; if all options unlocked 03:A007 ld (hl),a 03:A008 cp a,04 03:A00A jp z,.allOptionsUnlocked 03:A00D ld hl,AEF8 03:A010 ld a,(hl) 03:A011 and a 03:A012 jr nz,.afterIntro 03:A014 ld hl,Used4FText ; first use 03:A017 call PrintText 03:A01A ld a,FF 03:A01C call PlaySound ; mute sound 03:A01F ld c,10 03:A021 call DelayFrames 03:A024 ld a,SFX_SWITCH 03:A026 call PlaySound 03:A029 ld c,70 03:A02B call DelayFrames 03:A02E ld hl,4FLoadingText 03:A031 call PrintText 03:A034 ld c,70 03:A036 call DelayFrames 03:A039 ld hl,4FWelcomeText 03:A03C call PrintText 03:A03F ld hl,AEF8 ; don't talk about that next time 03:A042 inc (hl) .afterIntro 03:A043 ld hl,EmptyText ; clear the textbox 03:A046 call PrintText 03:A049 ld hl,C3CC 03:A04C ld bc,080E 03:A04F call TextBoxBorder 03:A052 ld de,C4A5 ; fill it with instructions 03:A055 ld hl,4FInstructions 03:A058 call InstantRenderText 03:A05B call Render4FMenu ; draw the options 03:A05E ld de,C3E1 03:A061 ld b,02 03:A063 ld hl,AEF9 03:A066 ld c,(hl) 03:A067 call Handle4FInput 03:A06A cp a,FF 03:A06C jr z,.cancelled 03:A06E cp a,00 ; and a NotLikeThis 03:A070 jp z,4FClearDoor 03:A073 cp a,01 03:A075 jp z,4FTilePointer 03:A078 cp a,02 03:A07A jp z,.givePokemon 03:A07D cp a,03 03:A07F jp z,4FClearSAV 03:A082 ld a,9B 03:A084 ret .cancelled 03:A085 ld a,SFX_TURN_OFF_PC 03:A087 call PlaySound 03:A08A call WaitForSoundToFinish 03:A08D ret .givePokemon 03:A08E ld hl,DA80 ; formerly Room 1 script counter, now unnecessar 03:A091 ld (hl),14 ; fill the box to avoid corruption 03:A093 ld de,C4A5 03:A096 ld hl,.givePokemonSetValueText 03:A099 call InstantRenderText 03:A09C ld hl,C44C 03:A09F ld bc,0206 03:A0A2 call TextBoxBorder 03:A0A5 ld de,C475 03:A0A8 ld hl,.givePokemonInitialBoxContents 03:A0AB call InstantRenderText 03:A0AE ld c,00 ; ld bc, $0000 works just as well NotLikeThis 03:A0B0 ld b,c 03:A0B1 ld d,01 03:A0B3 call .AskValue 03:A0B6 ld b,a 03:A0B7 ld c,05 03:A0B9 ld a,01 ; how is that different from JP C? 03:A0BB sbc a,00 03:A0BD jp z,.afterIntro ; C is also a valid condition NotLikeThis 03:A0C0 call GivePokemon ; it's also possible to call a function conditionally 03:A0C3 jp .afterIntro ; go to main menu of 4F .AskValue: 03:A0C6 jp .AskValueReleaseJoypad ; NotLikeThis Why don't you move that to the top of .AskValue? .AskValueReturn 03:A0C9 ld hl,C465 ; remove cursor from both possible positions 03:A0CC ld (hl),7F 03:A0CE inc hl 03:A0CF ld (hl),7F 03:A0D1 dec hl 03:A0D2 add hl,bc ; draw it on the correct position 03:A0D3 ld (hl),EE 03:A0D5 push de ; draw D as a hex value 03:A0D6 push bc 03:A0D7 ld a,d 03:A0D8 push af 03:A0D9 ld de,C47A 03:A0DC ld hl,A17D 03:A0DF ld b,00 03:A0E1 and a,0F 03:A0E3 ld c,a 03:A0E4 add hl,bc 03:A0E5 ld a,(hl) 03:A0E6 ld (de),a 03:A0E7 pop af 03:A0E8 ld de,C479 03:A0EB ld hl,.hexValues 03:A0EE ld b,00 03:A0F0 rrca ; SWAP is 2 bytes less 03:A0F1 rrca 03:A0F2 rrca 03:A0F3 rrca 03:A0F4 and a,0F 03:A0F6 ld c,a 03:A0F7 add hl,bc 03:A0F8 ld a,(hl) 03:A0F9 ld (de),a 03:A0FA pop bc 03:A0FB pop de 03:A0FC halt 03:A0FD ld hl,hJoyInput 03:A100 ld a,(hl) 03:A101 and a,D_UP 03:A103 jp nz,.pressedUp 03:A106 ld a,(hl) 03:A107 and a,D_DOWN 03:A109 jp nz,.pressedDown 03:A10C ld a,(hl) 03:A10D and a,D_RIGHT 03:A10F jp nz,.switchColumns 03:A112 ld a,(hl) 03:A113 and a,D_LEFT 03:A115 jp nz,.switchColumns 03:A118 ld a,(hl) 03:A119 and a,B_BUTTON 03:A11B jp nz,.pressedB 03:A11E ld a,(hl) 03:A11F and a,A_BUTTON 03:A121 jp nz,.pressedA 03:A124 jp .AskValueReleaseJoypad .pressedUp 03:A127 ld a,SFX_MUTED_SNARE_4 03:A129 call PlaySound 03:A12C ld a,c 03:A12D and a 03:A12E jr z,.pressedUpLeftColumn 03:A130 ld e,d 03:A131 ld a,d 03:A132 and a,F0 03:A134 ld d,a 03:A135 ld a,e 03:A136 inc a 03:A137 and a,0F 03:A139 or d 03:A13A ld d,a 03:A13B jp .AskValueReleaseJoypad .pressedUpLeftColumn 03:A13E ld a,d 03:A13F add a,10 03:A141 ld d,a 03:A142 jp .AskValueReleaseJoypad .pressedDown 03:A145 ld a,SFX_MUTED_SNARE_4 03:A147 call PlaySound 03:A14A ld a,c 03:A14B and a 03:A14C jr z,.pressedDownLeftColumn 03:A14E ld e,d 03:A14F ld a,d 03:A150 and a,F0 03:A152 ld d,a 03:A153 ld a,e 03:A154 dec a 03:A155 and a,0F 03:A157 or d 03:A158 ld d,a 03:A159 jp .AskValueReleaseJoypad .pressedDownLeftColumn 03:A15C ld a,d 03:A15D sub a,10 03:A15F ld d,a 03:A160 jp .AskValueReleaseJoypad .switchColumns 03:A163 inc c ; ld a, c / xor $01 / ld c, a would take 1 byte less 03:A164 ld a,c 03:A165 and a,01 03:A167 ld c,a 03:A168 jp .AskValueReleaseJoypad .pressedB 03:A16B ld a,FF 03:A16D scf 03:A16E ret .pressedA 03:A16F ld a,d 03:A170 scf 03:A171 ccf 03:A172 ret .AskValueReleaseJoypad: 03:A173 ld hl,hJoyInput 03:A176 ld a,(hl) 03:A177 and a 03:A178 jr nz,.AskValueReleaseJoypad 03:A17A jp .AskValueReturn .hexValues 03:A17D db "0123456789ABCDEF" .givePokemonSetValueText 03:A18D db "Please set value" 03:A19D line "for register B@" .givePokemonInitialBoxContents 03:A1AD db $61, ": ¥01@" ; $61 = bold B .allOptionsUnlocked ; this could be inlined so easily... NotLikeThis 03:A1B4 ld hl,A1C7 ; only once 03:A1B7 ld a,(hl) 03:A1B8 cp a,01 03:A1BA jp z,.afterIntro 03:A1BD inc (hl) 03:A1BE ld hl,ClearSAVIntroText 03:A1C1 call PrintText 03:A1C4 jp 4FHandler 4FClearSAV: 03:A1C8 ld a,SFX_ENTER_PC 03:A1CA call PlaySound 03:A1CD call WaitForSoundToFinish 03:A1D0 ld hl,4FClearDoor.called 03:A1D3 call PrintText 03:A1D6 ld de,1000 .fadeOutLoop 03:A1D9 ld hl,C02A 03:A1DC xor a 03:A1DD or (hl) 03:A1DE inc hl 03:A1DF or (hl) 03:A1E0 inc hl 03:A1E1 inc hl 03:A1E2 or (hl) 03:A1E3 jr nz,.skipSound 03:A1E5 ld a,SFX_SNARE_5 03:A1E7 call PlaySound .skipSound 03:A1EA call ClearSAVSemiRandomTransition ; "fade" to white 03:A1ED call ClearSAVSemiRandomTransition ; pattern from ROM, 20 tiles per frame 03:A1F0 call ClearSAVSemiRandomTransition 03:A1F3 call ClearSAVSemiRandomTransition 03:A1F6 call ClearSAVSemiRandomTransition 03:A1F9 call ClearSAVSemiRandomTransition 03:A1FC call ClearSAVSemiRandomTransition 03:A1FF call ClearSAVSemiRandomTransition 03:A202 call ClearSAVSemiRandomTransition 03:A205 call ClearSAVSemiRandomTransition 03:A208 call ClearSAVSemiRandomTransition 03:A20B call ClearSAVSemiRandomTransition 03:A20E call ClearSAVSemiRandomTransition 03:A211 call ClearSAVSemiRandomTransition 03:A214 call ClearSAVSemiRandomTransition 03:A217 call ClearSAVSemiRandomTransition 03:A21A call ClearSAVSemiRandomTransition 03:A21D call ClearSAVSemiRandomTransition 03:A220 call ClearSAVSemiRandomTransition 03:A223 call ClearSAVSemiRandomTransition 03:A226 ld a,d 03:A227 cp a,3F 03:A229 jr z,.doneFading 03:A22B halt 03:A22C jp .fadeOutLoop 03:A22F ret .doneFading 03:A230 call ClearScreen 03:A233 ld c,3C 03:A235 call DelayFrames 03:A238 ld b,BANK(AnimateHallOfFame) 03:A23A ld hl,.continueAfterHoF 03:A23D push hl 03:A23E ld hl,ReturnToSRA3 03:A241 push hl 03:A242 ld hl,AnimateHallOfFame 03:A245 jp Bankswitch .continueAfterHoF 03:A248 ld c,78 03:A24A call DelayFrames 03:A24D call ClearScreen 03:A250 call DrawLeetPokemonTrailer 03:A253 call LoadTextBoxTilePatterns 03:A256 call EnableLCD 03:A259 call GBPalNormal 03:A25C ld c,D2 03:A25E call DelayFrames 03:A261 ld c,D2 03:A263 call DelayFrames 03:A266 call ClearScreen 03:A269 call DrawFinalScreen 03:A26C ld a,F8 03:A26E ld c,AUDIO_2 03:A270 call PlayMusic 03:A273 jr $ DrawLeetPokemonTrailer: 03:A275 xor a 03:A276 call RunPaletteCommand 03:A279 ld de,C3B5 03:A27C ld hl,.text1 03:A27F call InstantRenderText 03:A282 ld de,.logoTiles 03:A285 ld hl,9300 03:A288 ld bc,002F 03:A28B call CopyVideoData 03:A28E ld de,C404 03:A291 ld hl,.logoTilemap 03:A294 ld bc,0050 03:A297 call CopyData+03 ; dec bc... 03:A29A ld de,C469 03:A29D ld hl,.text2 03:A2A0 call InstantRenderText ; NotLikeThis 03:A2A3 ret .text1 03:A2A4 db "What if you HAD to" 03:A2B6 line " hack the game to" 03:A2C8 line " complete it?@" 03:A2C9 ld a,a ; is that unused? 03:A2CA ld a,a 03:A2CB ld a,a 03:A2CC and d 03:A2CD xor (hl) 03:A2CE xor h 03:A2CF xor a 03:A2D0 xor e 03:A2D1 and h 03:A2D2 or e 03:A2D3 and h 03:A2D4 ld a,a 03:A2D5 xor b 03:A2D6 or e 03:A2D7 and a,50 .logoTilemap 03:A2D9 db $7F, $7F, $7F, $7F, $30, $31, $32, $33, $34, $35, $36, $37, $38, $39, $3A, $3B, $7F, $7F, $7F, $7F 03:A2ED db $7F, $7F, $7F, $7F, $3C, $3D, $3E, $3F, $40, $41, $42, $43, $44, $45, $46, $47, $7F, $7F, $7F, $7F 03:A301 db $7F, $7F, $7F, $7F, $48, $49, $4A, $4B, $4C, $4D, $4E, $4F, $50, $51, $52, $53, $7F, $7F, $7F, $7F 03:A315 db $7F, $7F, $7F, $7F, $7F, $7F, $54, $55, $56, $57, $58, $59, $5A, $5B, $5C, $5D, $7F, $7F, $7F, $7F .text2 03:A329 db "Use the tools" 03:A336 line "within the game to" 03:A349 line "modify it. Learn" 03:A35A line "basics of Gen I" 03:A36A line "glitching and GB" 03:A37B line "programming." 03:A388 line " COMING SOON", $5E, $50 .logoTiles 03:A39C db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $08, $00, $1b, $0d, $1f, $0f 03:A3AC db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $e0, $00, $f0, $f0, $f0, $38 03:A3BC db $00, $00, $00, $00, $05, $1e, $3f, $3f, $61, $71, $c0, $60, $60, $c0, $c3, $c1 03:A3CC db $00, $00, $03, $03, $03, $03, $03, $83, $83, $c3, $c3, $c3, $e3, $c3, $c3, $e3 03:A3DC db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $06, $00, $06, $0e, $08, $1c 03:A3EC db $00, $00, $00, $00, $17, $0f, $0f, $1f, $10, $00, $00, $00, $00, $00, $00, $00 03:A3FC db $00, $00, $00, $00, $40, $80, $c0, $e0, $e0, $60, $71, $60, $71, $61, $e1, $61 03:A40C db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $31, $00, $37, $fb, $fd, $de 03:A41C db $00, $00, $00, $00, $00, $01, $03, $03, $06, $07, $0c, $06, $86, $8c, $8c, $cc 03:A42C db $00, $00, $00, $00, $50, $e0, $f0, $f8, $18, $1c, $0c, $0c, $0e, $0c, $3c, $1e 03:A43C db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $23, $00, $6f, $37, $7b, $3c 03:A44C db $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $80, $00, $c0, $c0, $c0, $e0 03:A45C db $1c, $0e, $1c, $0c, $18, $0c, $18, $0c, $18, $0c, $18, $0c, $18, $0c, $1c, $0f 03:A46C db $18, $18, $0c, $18, $0c, $18, $0c, $18, $0c, $18, $18, $18, $10, $38, $30, $f0 03:A47C db $c3, $c7, $cc, $ce, $f8, $dc, $f8, $f0, $40, $e0, $c0, $60, $70, $61, $71, $3f 03:A48C db $43, $e3, $c3, $63, $c3, $63, $c3, $63, $63, $c3, $c3, $c3, $83, $c3, $83, $83 03:A49C db $10, $38, $20, $70, $40, $e0, $60, $e0, $20, $70, $10, $38, $18, $1c, $0c, $0e 03:A4AC db $06, $01, $0f, $07, $07, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $1f 03:A4BC db $c1, $c1, $81, $c1, $71, $e1, $71, $31, $31, $31, $31, $31, $21, $71, $c1, $e1 03:A4CC db $cc, $9c, $8c, $98, $8c, $98, $8c, $98, $8c, $98, $8c, $98, $8c, $98, $8c, $98 03:A4DC db $8c, $cc, $8c, $cc, $8f, $cd, $8f, $cf, $84, $ce, $8c, $c6, $87, $c6, $87, $c3 03:A4EC db $34, $7e, $cc, $e6, $8c, $c6, $8c, $06, $06, $0c, $0c, $0c, $08, $1c, $18, $f8 03:A4FC db $70, $38, $70, $30, $60, $30, $60, $30, $60, $30, $60, $30, $60, $30, $60, $30 03:A50C db $c0, $60, $60, $60, $60, $60, $60, $60, $60, $60, $60, $60, $60, $60, $60, $60 03:A51C db $1f, $0f, $18, $0c, $18, $0c, $18, $0c, $18, $0c, $04, $08, $00, $00, $00, $00 03:A52C db $c0, $e0, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 03:A53C db $3e, $1f, $00, $00, $00, $00, $00, $00, $00, $00, $03, $03, $07, $03, $0f, $0f 03:A54C db $03, $03, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $0e, $1c, $86, $b2 03:A55C db $0f, $06, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $38, $70, $1b, $cb 03:A56C db $1f, $1f, $04, $00, $00, $00, $00, $00, $00, $00, $f0, $70, $c0, $80, $e0, $e0 03:A57C db $c1, $81, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $11, $0a 03:A58C db $8c, $98, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $71, $39 03:A59C db $83, $c1, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $67, $e3 03:A5AC db $e0, $f0, $00, $00, $00, $00, $00, $00, $00, $00, $04, $06, $00, $00, $9e, $9c 03:A5BC db $60, $30, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $39, $71 03:A5CC db $60, $60, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $60, $e0 03:A5DC db $02, $07, $0f, $0f, $07, $06, $06, $06, $00, $00, $00, $00, $00, $00, $00, $00 03:A5EC db $3f, $26, $b7, $ba, $06, $32, $0e, $1c, $00, $00, $00, $00, $00, $00, $00, $00 03:A5FC db $fc, $98, $dc, $e8, $18, $c8, $38, $70, $00, $00, $00, $00, $00, $00, $00, $00 03:A60C db $c0, $80, $c0, $80, $c0, $80, $c0, $80, $00, $00, $00, $00, $00, $00, $00, $00 03:A61C db $00, $0a, $00, $0a, $0e, $00, $04, $04, $00, $00, $00, $00, $00, $00, $00, $00 03:A62C db $49, $69, $7d, $79, $41, $61, $79, $39, $00, $00, $00, $00, $00, $00, $00, $00 03:A63C db $34, $a6, $85, $03, $81, $00, $87, $07, $00, $00, $00, $00, $00, $00, $00, $00 03:A64C db $06, $04, $06, $84, $c6, $84, $1e, $9e, $00, $00, $00, $00, $00, $00, $00, $00 03:A65C db $19, $c9, $cd, $89, $99, $c9, $79, $71, $00, $00, $00, $00, $00, $00, $00, $00 03:A66C db $30, $a0, $b0, $20, $b0, $20, $b0, $20, $00, $00, $00, $00, $00, $00, $00, $00 03:A67C db $f1, $f1, $5b, $5b, $55, $55, $51, $51, $00, $00, $00, $00, $00, $00, $00, $00 CheckPokedexAchievement: 03:A68C push hl ; do you need to preserve the registers here? NotLikeThis 03:A68D push de 03:A68E push bc 03:A68F ld hl,wPartyDataEnd 03:A692 ld b,13 03:A694 call CountSetBits 03:A697 ld d,a 03:A698 push de 03:A699 ld hl,wPokedexSeen 03:A69C ld b,13 03:A69E call CountSetBits 03:A6A1 pop de 03:A6A2 cp d 03:A6A3 jr z,.return 03:A6A5 ld hl,BFF4 03:A6A8 ld (hl),DD .return 03:A6AA pop bc 03:A6AB pop de 03:A6AC pop hl 03:A6AD ret DrawFinalScreen: 03:A6AE call CheckPokedexAchievement 03:A6B1 call TimeAnticheat 03:A6B4 call EncodeToBuffer 03:A6B7 ld hl,A975 ; render the code 03:A6BA ld de,C4A8 03:A6BD call InstantRenderText 03:A6C0 call RemoveCodeFromMemory 03:A6C3 ld de,C3B4 03:A6C6 ld hl,FinalScreenText1 03:A6C9 call InstantRenderText 03:A6CC ld de,C4E1 03:A6CF ld hl,FinalScreenText2 03:A6D2 call InstantRenderText ; NotLikeThis 03:A6D5 ret GenerateRandomAndHoursField: 03:A6D6 push hl 03:A6D7 push bc 03:A6D8 push de 03:A6D9 cp a,00 ; NotLikeThis and a 03:A6DB ld a,00 ; NotLikeThis it's already zero or you overwrite it below 03:A6DD jr z,.gotBit 03:A6DF ld a,01 .gotBit 03:A6E1 ld b,a 03:A6E2 call Random 03:A6E5 and a,FE ; make space for the bit 03:A6E7 or b ; and insert it 03:A6E8 pop de 03:A6E9 pop bc 03:A6EA pop hl 03:A6EB ret EncodeToBuffer: 03:A6EC ld hl,DD00 03:A6EF ld de,A972 03:A6F2 ld a,00 ; initialize achievements to 0 03:A6F4 ld (de),a 03:A6F5 inc de 03:A6F6 ld a,(hl) 03:A6F7 xor a,55 ; unencrypt hours 03:A6F9 call GenerateRandomAndHoursField 03:A6FC ld (de),a 03:A6FD inc hl 03:A6FE inc de 03:A6FF ld a,(hl) ; unencrypt and store minutes 03:A700 xor a,FF 03:A702 ld (de),a 03:A703 inc hl 03:A704 inc de 03:A705 ld a,(hl) ; unencrypt and store minutes 03:A706 xor a,AA 03:A708 ld (de),a 03:A709 ld hl,BFF0 03:A70C call ReadSRA2 03:A70F cp a,E2 03:A711 jr nz,.ImBadOnMyOwn 03:A713 ld hl,A972 03:A716 set 0,(hl) .ImBadOnMyOwn 03:A718 ld hl,BFF1 03:A71B call ReadSRA2 03:A71E cp a,57 03:A720 ld hl,A972 03:A723 jr nz,.BottomPercentage 03:A725 set 1,(hl) .BottomPercentage 03:A727 ld hl,BFF2 03:A72A call ReadSRA2 03:A72D cp a,8C 03:A72F ld hl,A972 03:A732 jr nz,.IaintPancake 03:A734 set 2,(hl) .IaintPancake 03:A736 ld hl,BFF3 03:A739 call ReadSRA2 03:A73C cp a,2D 03:A73E ld hl,A972 03:A741 jr nz,.DontFuckTheGuard 03:A743 set 3,(hl) .DontFuckTheGuard 03:A745 ld hl,BFF4 ; this one is in SRA3 03:A748 ld a,(hl) 03:A749 cp a,DD 03:A74B ld hl,A972 03:A74E jr nz,.TooWeirdToUnderstand 03:A750 set 4,(hl) .TooWeirdToUnderstand 03:A752 ld hl,BFF5 03:A755 call ReadSRA2 03:A758 cp a,5D 03:A75A ld hl,A972 03:A75D jr nz,.DarknessIsScary 03:A75F set 5,(hl) .DarknessIsScary 03:A761 ld hl,A972 ; it's A972 already NotLikeThis 03:A764 res 6,(hl) ; unused bit 03:A766 call Encrypt1 03:A769 call Encrypt2 03:A76C ret Encrypt1: 03:A76D ld hl,A972 03:A770 ld a,(hl) 03:A771 and a,3F ; get the achievement byte, remove the """unused""" bits. This is the value I dub `ACH` 03:A773 xor a,55 ; ACH1 = LUT(ACH XOR 55) 03:A775 call EncodeByte 03:A778 ldi (hl),a 03:A779 ld a,AA 03:A77B xor (hl) ; RNH1 = LUT(RNH XOR AA) 03:A77C call EncodeByte 03:A77F ldi (hl),a 03:A780 ld a,F0 03:A782 xor (hl) ; MIN1 = LUT(MIN XOR F0) 03:A783 call EncodeByte 03:A786 ldi (hl),a 03:A787 ld a,0F 03:A789 xor (hl) ; SEC1 = LUT(SEC XOR 0F) 03:A78A call EncodeByte 03:A78D ld (hl),a 03:A78E ld hl,A972 03:A791 ld bc,C78A 03:A794 ld a,(hl) 03:A795 add b 03:A796 ld b,a ; B = C7 + ACH1 03:A797 ld a,(hl) 03:A798 xor c 03:A799 ld c,a ; C = 8A XOR ACH1 03:A79A inc hl ; NotLikeThis - ldi 03:A79B ld a,(hl) 03:A79C add b 03:A79D ld b,a ; B = C7 + ACH1 + RNH1 03:A79E ld a,(hl) 03:A79F xor c 03:A7A0 ld c,a ; C = 8A XOR ACH1 XOR RHN1 03:A7A1 inc hl ; NotLikeThis - ldi 03:A7A2 ld a,(hl) 03:A7A3 add b 03:A7A4 ld b,a ; B = C7 + ACH1 + RNH1 + MIN1 03:A7A5 ld a,(hl) 03:A7A6 xor c 03:A7A7 ld c,a ; C = 8A XOR ACH1 XOR RNH1 XOR MIN1 03:A7A8 inc hl ; NotLikeThis - ldi 03:A7A9 ld a,(hl) 03:A7AA add b 03:A7AB ld b,a ; B = C7 + ACH1 + RNH1 + MIN1 + SEC1 03:A7AC ld a,(hl) 03:A7AD xor c 03:A7AE ld c,a ; C = 8A XOR ACH1 XOR RNH1 XOR MIN1 XOR SEC1 03:A7AF inc hl ; NotLikeThis - ldi 03:A7B0 ld a,b 03:A7B1 call EncodeChecksum 03:A7B4 ld (hl),a ; CHK1 = D4 + A7 * (C7 + ACH1 + RNH1 + MIN1 + SEC1) 03:A7B5 inc hl ; NotLikeThis - ldi 03:A7B6 ld a,c 03:A7B7 call EncodeChecksum 03:A7BA ld (hl),a ; CHK2 = D4 + A7 * (8A XOR ACH1 XOR RNH1 XOR MIN1 XOR SEC1) 03:A7BB ld b,a 03:A7BC ld hl,A972 03:A7BF ld a,(hl) 03:A7C0 xor b 03:A7C1 ldi (hl),a ; ACH2 = ACH1 XOR CHK2 03:A7C2 ld a,(hl) 03:A7C3 xor b 03:A7C4 ldi (hl),a ; RNH2 = RNH1 XOR CHK2 03:A7C5 ld a,(hl) 03:A7C6 xor b 03:A7C7 ldi (hl),a ; MIN2 = MIN1 XOR CHK2 03:A7C8 ld a,(hl) 03:A7C9 xor b 03:A7CA ldi (hl),a ; SEC2 = SEC1 XOR CHK2 03:A7CB ret Encrypt2: 03:A7CC ld de,A965 03:A7CF ld hl,A972 ; values at A972 now: ACH2 RNH2 MIN2 SEC2 CHK1 CHK2 03:A7D2 call .byte ; NotLikeThis - loop 03:A7D5 call .byte 03:A7D8 call .byte 03:A7DB call .byte 03:A7DE call .byte 03:A7E1 call .byte ; NotLikeThis - call/ret 03:A7E4 ret .byte 03:A7E5 push hl ; encode the two nibbles separately 03:A7E6 ld a,(hl) ; bottom half first 03:A7E7 and a,0F 03:A7E9 call .half 03:A7EC pop hl 03:A7ED push hl 03:A7EE ld a,(hl) 03:A7EF rrca 03:A7F0 rrca 03:A7F1 rrca 03:A7F2 rrca 03:A7F3 and a,0F 03:A7F5 call .half 03:A7F8 pop hl 03:A7F9 inc hl 03:A7FA ret .half 03:A7FB ld hl,Encrypt2LUT 03:A7FE ld c,a 03:A7FF ld b,00 03:A801 add hl,bc 03:A802 ld a,(hl) 03:A803 ld (de),a 03:A804 inc de 03:A805 ret RemoveCodeFromMemory: 03:A806 xor a 03:A807 ld hl,A972 03:A80A ldi (hl),a ; NotLikeThis - you could use a loop 03:A80B ldi (hl),a ; clear the scratch buffer, probably to make debugging harder 03:A80C ldi (hl),a ; NotLikeThis - these buffers are next to each other 03:A80D ldi (hl),a ; NotLikeThis - USE FillMemory!!! 03:A80E ldi (hl),a 03:A80F ldi (hl),a 03:A810 ld hl,A965 03:A813 ldi (hl),a 03:A814 ldi (hl),a 03:A815 ldi (hl),a 03:A816 ldi (hl),a 03:A817 ldi (hl),a 03:A818 ldi (hl),a 03:A819 ldi (hl),a 03:A81A ldi (hl),a 03:A81B ldi (hl),a 03:A81C ldi (hl),a 03:A81D ldi (hl),a 03:A81E ldi (hl),a 03:A81F ret EncodeChecksum: ; A = D4 + A * A7 03:A820 push bc 03:A821 push hl 03:A822 ld bc,41A7 03:A825 ld hl,72D4 .loop 03:A828 add hl,bc 03:A829 dec a 03:A82A jr nz,.loop 03:A82C ld a,l 03:A82D pop hl 03:A82E pop bc 03:A82F ret EncodeByte: 03:A830 push hl 03:A831 push bc 03:A832 ld hl,.encodeTable 03:A835 ld c,a 03:A836 ld b,00 03:A838 add hl,bc 03:A839 ld a,(hl) 03:A83A pop bc 03:A83B pop hl 03:A83C ret .encodeTable 03:A83D db $B4, $6B, $CB, $DE, $B8, $74, $E1, $51, $59, $3D, $66, $DD, $F3, $DA, $9D, $3F 03:A84D db $08, $0A, $E6, $BB, $68, $21, $79, $F1, $F2, $C3, $69, $F5, $44, $9F, $AA, $77 03:A85D db $62, $D1, $2E, $00, $82, $52, $BD, $57, $86, $76, $34, $84, $64, $31, $10, $FD 03:A86D db $AD, $A9, $EA, $01, $9A, $53, $E8, $7B, $9B, $0D, $56, $22, $50, $B1, $61, $F7 03:A87D db $94, $CE, $16, $D5, $90, $91, $C7, $D8, $F9, $3A, $C5, $36, $8B, $73, $03, $AF 03:A88D db $37, $38, $A1, $7A, $72, $C8, $B0, $02, $43, $63, $D7, $1D, $24, $85, $25, $A8 03:A89D db $46, $E4, $E0, $33, $AC, $C0, $A7, $6D, $F4, $95, $0F, $4E, $D6, $41, $B6, $99 03:A8AD db $1B, $2D, $78, $8C, $97, $E9, $28, $4F, $E3, $6C, $1E, $9E, $B5, $11, $CC, $87 03:A8BD db $7C, $A2, $47, $8D, $EB, $70, $8E, $A3, $81, $FE, $4C, $5A, $8F, $5E, $4A, $5B 03:A8CD db $EC, $15, $20, $D0, $13, $FC, $92, $58, $7E, $4B, $49, $05, $09, $88, $30, $89 03:A8DD db $5F, $AB, $75, $26, $80, $D2, $17, $8A, $60, $AE, $CF, $BE, $96, $55, $54, $07 03:A8ED db $ED, $0C, $9C, $CD, $BA, $A5, $32, $2A, $29, $35, $12, $83, $27, $EE, $C9, $7F 03:A8FD db $98, $E5, $B9, $19, $C6, $3E, $0E, $42, $0B, $B7, $1A, $A4, $6A, $2C, $E2, $D3 03:A90D db $F8, $CA, $18, $F0, $DF, $DC, $23, $1C, $3B, $48, $BC, $FB, $B2, $65, $EF, $6E 03:A91D db $FA, $DB, $F6, $14, $71, $6F, $D4, $5D, $5C, $4D, $93, $FF, $D9, $39, $45, $40 03:A92D db $2F, $E7, $67, $04, $C4, $B3, $A6, $7D, $C2, $2B, $C1, $BF, $1F, $06, $3C, $A0 ReadSRA2: ; ld a, (2:HL) 03:A93D push de ; wouldn't it be a lot simpler if this function was in WRAM? NotLikeThis 03:A93E ld de,.continueChain 03:A941 push de 03:A942 ld de,ReturnToSRA3 03:A945 push de 03:A946 ld de,ldCmemAtHL 03:A949 push de 03:A94A ld de,ReturnToSRA2 03:A94D push de 03:A94E ret .continueChain 03:A94F ld a,c 03:A950 pop de 03:A951 ret FinalScreenText2: 03:A952 db "TheZZAZZGlitch '17@" Encrypt2LUT: 03:A978 dbold "HBEA", "VLGF", "CSDI", "M267" ; dbold = db, but use the bold characters at 0x60 - 0x6C when possible FinalScreenText1: 03:A988 db " CONGRATULATION !!!" 03:A99B line "" 03:A99C line " YOU HAVE COMPLETED" 03:A9B0 line " A GREAT SAVE." 03:A9C1 line "" 03:A9C2 line " Enter the password" 03:A9D6 line " at the website in" 03:A9E9 line " the description to" 03:A9FD line " have your results" 03:AA10 line " saved online!@" ClearSAVSemiRandomTransition: 03:AA20 ld a,(de) 03:AA21 ld c,a 03:AA22 inc de 03:AA23 ld a,(de) 03:AA24 and a,01 03:AA26 ld b,a 03:AA27 inc de 03:AA28 ld hl,wTileMap 03:AA2B add hl,bc 03:AA2C ld (hl),7F 03:AA2E ret ClearSAVIntroText: 03:AA2F text "Hahaha!" 03:AA37 line "Even 4F won't help" 03:AA49 cont "you now!" 03:AA52 para "A new subroutine" 03:AA63 line "was unlocked just" 03:AA75 cont "now, but I doubt" 03:AA86 cont "it would help." 03:AA95 para "Let's see what" 03:AAA3 line "it is..." 03:AAAC para "The new function" 03:AABD line "is... ClearSAV." 03:AACD para "... ..." 03:AAD5 line "... ..." 03:AADD para "Wait... If you" 03:AAEC line "clear the save..." 03:AAFE para "...will I get" 03:AB0C line "removed too?@" 03:AB1A TX_BLINK ; NotLikeThis 03:AB1B text "" 03:AB1C done 4FTilePointer: 03:AB1D ld hl,.instructions+0x33 ; self modifying... data? Clever. 03:AB20 ld (hl),84 03:AB22 ld hl,wTilesetBlocksPtr 03:AB25 ld a,(hl) 03:AB26 cp a,EF 03:AB28 jr z,.currentEF 03:AB2A ld hl,.instructions+0x33 03:AB2D ld (hl),83 .currentEF 03:AB2F ld de,C4A5 03:AB32 ld hl,.instructions 03:AB35 call InstantRenderText 03:AB38 ld hl,C438 03:AB3B ld bc,0306 03:AB3E call TextBoxBorder 03:AB41 ld de,C44E 03:AB44 ld hl,.menu 03:AB47 call InstantRenderText 03:AB4A ld de,C44D 03:AB4D ld bc,0202 03:AB50 call Handle4FInput 03:AB53 ld hl,wTilesetBlocksPtr 03:AB56 cp a,FF 03:AB58 jp z,4FHandler.afterIntro 03:AB5B cp a,01 03:AB5D jr z,.changeDF 03:AB5F ld (hl),EF 03:AB61 jr .done .changeDF 03:AB63 ld (hl),DF .done 03:AB65 ld a,SFX_PURCHASE 03:AB67 call PlaySound 03:AB6A ld b,BANK(UsedCut) 03:AB6C ld hl,UsedCut.canCut+0x66 ; ld a, $90 / ld [hWY], a / call UpdateSprites / jp RedrawMapView 03:AB6F call Bankswitch 03:AB72 ld hl,0420 03:AB75 pop af 03:AB76 ld sp,DFF0 03:AB79 push hl 03:AB7A jp OurCloseTextbox .menu 03:AB7D db "¥69EF" 03:AB82 line "" 03:AB83 line "¥69DF@" .instructions 03:AB8A db "Set new value for" 03:AB9B line "WRAM:D52C -16-." 03:ABAB line "" 03:ABAC line "Current val: ¥69DF@" 4FClearDoor: 03:ABC0 ld hl,wIsInBattle 03:ABC3 ld a,(hl) 03:ABC4 and a 03:ABC5 jp nz,.battle 03:ABC8 ld a,SFX_ENTER_PC 03:ABCA call PlaySound 03:ABCD call WaitForSoundToFinish 03:ABD0 ld hl,.called 03:ABD3 call PrintText 03:ABD6 call LoadCurrentMapView ; close the menus 03:ABD9 halt 03:ABDA call UpdateSprites 03:ABDD halt 03:ABDE ld hl,.removed 03:ABE1 call PrintText 03:ABE4 ld c,20 03:ABE6 call DelayFrames 03:ABE9 ld hl,wOverworldMap 03:ABEC ld bc,0200 .loop 03:ABEF ld a,(hl) 03:ABF0 cp a,24 03:ABF2 jr nz,.next 03:ABF4 ld (hl),05 .next 03:ABF6 inc hl 03:ABF7 dec bc 03:ABF8 ld a,c 03:ABF9 or b 03:ABFA jr nz,.loop 03:ABFC ld b,BANK(UsedCut) 03:ABFE ld hl,UsedCut.canCut+61 ; ld a, SFX_CUT / call PlaySound... 03:AC01 call Bankswitch 03:AC04 call WaitForSoundToFinish 03:AC07 ld hl,wd730 03:AC0A ld (hl),04 03:AC0C ld hl,0420 ; reenter the overworld loop 03:AC0F pop af 03:AC10 ld sp,DFF0 03:AC13 push hl 03:AC14 jp OurCloseTextbox .battle 03:AC17 ld hl,.battleText 03:AC1A call PrintText 03:AC1D ret .battleText 03:AC1E text "Can't use that in" 03:AC2F line "battle.@" 03:AC38 TX_BLINK ; NotLikeThis 03:AC39 text "" 03:AC3A done .called 03:AC3B text "Called the" 03:AC46 line "subroutine.@" 03:AC53 TX_BLINK ; NotLikeThis 03:AC54 text "" 03:AC55 done .removed 03:AC56 text "All door blocks" 03:AC66 line "in the current" 03:AC75 cont "map have been" 03:AC83 cont "removed!@" 03:AC8D TX_BLINK ; NotLikeThis 03:AC8E text "" 03:AC8F done Handle4FInput: ; returns entry numer in A. C = entry count. B = entry height 03:AC90 ld hl,AD1D ; entry count 03:AC93 ld (hl),c 03:AC94 inc hl 03:AC95 ld (hl),00 ; initialize cursor at the top 03:AC97 inc hl 03:AC98 ld (hl),b 03:AC99 jp .loop .handleInput 03:AC9C ld a,ED ; draw cursor 03:AC9E ld (de),a 03:AC9F halt 03:ACA0 ld hl,hJoyInput 03:ACA3 ld a,(hl) 03:ACA4 and a,A_BUTTON 03:ACA6 jr nz,.pressedA 03:ACA8 ld a,(hl) 03:ACA9 and a,B_BUTTON 03:ACAB jr nz,.pressedB 03:ACAD ld a,(hl) 03:ACAE and a,D_UP 03:ACB0 jr nz,.pressedUp 03:ACB2 ld a,(hl) 03:ACB3 and a,D_DOWN 03:ACB5 jr nz,.pressedDown .moveImpossible 03:ACB7 ld a,ED ; draw cursor 03:ACB9 ld (de),a .loop 03:ACBA ld hl,hJoyInput ; wait until no input 03:ACBD ld a,(hl) 03:ACBE and a 03:ACBF jr nz,.loop 03:ACC1 jp .handleInput .pressedA 03:ACC4 ld hl,AD1E 03:ACC7 ld a,(hl) 03:ACC8 ret .pressedB 03:ACC9 ld a,FF 03:ACCB ret .pressedUp 03:ACCC ld a,SFX_MUTED_SNARE_4 03:ACCE call PlaySound 03:ACD1 ld a,7F ; remove cursor 03:ACD3 ld (de),a 03:ACD4 ld hl,AD1E 03:ACD7 ld a,(hl) 03:ACD8 and a 03:ACD9 jp z,.moveImpossible 03:ACDC dec (hl) 03:ACDD ld hl,AD1F 03:ACE0 ld a,(hl) 03:ACE1 ld h,d 03:ACE2 ld l,e 03:ACE3 ld bc,-14 .loop1 03:ACE6 add hl,bc ; substract screen width * AD1F (entry height) 03:ACE7 dec a 03:ACE8 jr nz,.loop1 03:ACEA ld d,h ; update cursor 03:ACEB ld e,l 03:ACEC ld a,ED 03:ACEE ld (de),a 03:ACEF jp .loop .pressedDown 03:ACF2 ld a,SFX_MUTED_SNARE_4 03:ACF4 call PlaySound 03:ACF7 ld a,7F ; remove cursor 03:ACF9 ld (de),a 03:ACFA ld hl,AD1D 03:ACFD ld b,(hl) 03:ACFE dec b 03:ACFF ld hl,AD1E 03:AD02 ld a,(hl) 03:AD03 cp b 03:AD04 jp z,.moveImpossible 03:AD07 inc (hl) 03:AD08 ld hl,AD1F 03:AD0B ld a,(hl) 03:AD0C ld h,d 03:AD0D ld l,e 03:AD0E ld bc,14 .loop2 03:AD11 add hl,bc 03:AD12 dec a 03:AD13 jr nz,.loop2 03:AD15 ld d,h 03:AD16 ld e,l 03:AD17 ld a,ED ; update cursor 03:AD19 ld (de),a 03:AD1A jp .loop Render4FMenu: 03:AD20 ld a,00 03:AD22 push af 03:AD23 ld hl,4FOptions 03:AD26 ld de,C3E1 .loop 03:AD29 pop af 03:AD2A push af 03:AD2B push hl 03:AD2C ld hl,AEF9 03:AD2F ld h,(hl) 03:AD30 cp h 03:AD31 pop hl 03:AD32 push hl 03:AD33 jr c,.unlocked 03:AD35 ld hl,4FLockedRoutine .unlocked 03:AD38 call Render4FHelper 03:AD3B pop hl 03:AD3C ld bc,001F 03:AD3F add hl,bc 03:AD40 pop af 03:AD41 inc a 03:AD42 push af 03:AD43 cp a,04 03:AD45 jr nz,.loop 03:AD47 pop af 03:AD48 ret Render4FHelper: 03:AD49 ld a,(hl) 03:AD4A cp a,50 03:AD4C ret z 03:AD4D cp a,4F 03:AD4F jr z,.line 03:AD51 ld (de),a 03:AD52 inc de 03:AD53 inc hl 03:AD54 jr Render4FHelper .line 03:AD56 inc de 03:AD57 inc de 03:AD58 inc de 03:AD59 inc de 03:AD5A inc de 03:AD5B inc de 03:AD5C inc hl 03:AD5D jr Render4FHelper InstantRenderText: 03:AD5F push de .loop 03:AD60 ld a,(hl) 03:AD61 cp a,50 03:AD63 jr z,.end 03:AD65 cp a,4F 03:AD67 jr z,.line 03:AD69 ld (de),a 03:AD6A inc de 03:AD6B inc hl 03:AD6C jr .loop .line 03:AD6E pop de 03:AD6F push hl 03:AD70 ld bc,0014 03:AD73 ld h,d 03:AD74 ld l,e 03:AD75 add hl,bc 03:AD76 ld d,h 03:AD77 ld e,l 03:AD78 pop hl 03:AD79 push de 03:AD7A inc hl 03:AD7B jr .loop .end 03:AD7D pop de 03:AD7E ret 4FOptions: 03:AD7F db " ClearDoor " 03:AD8D line " SUBROUTINE" 03:AD9C line "@" 03:AD9E db " TileBlockPtr " 03:ADAC line " RAM 16BIT" 03:ADBB line "@" 03:ADBD db " GivePokemon " 03:ADCB line " SUBROUTINE" 03:ADDA line "@" 03:ADDC db " ClearSAV " 03:ADEA line " SUBROUTINE" 03:ADF9 line "@" 4FLockedRoutine: 03:ADFB db " --- " 03:AE09 line " ?" 03:AE18 line "@" Used4FText: 03:AE1A text "<PLAYER> used" 03:AE21 line "4F!" 03:AE25 done 4FLoadingText: 03:AE26 text "L@", $47 03:AE2A text "o@", $47 03:AE2E text "a@", $47 03:AE32 text "d@", $47 03:AE36 text "i@", $47 03:AE3A text "n@", $47 03:AE3E text "g@", $47 03:AE42 text "..." 03:AE46 next "" 03:AE47 done 4FWelcomeText: 03:AE48 text "Welcome." 03:AE51 line "I am 4F." 03:AE5A para "I am 8F's younger" 03:AE6B line "cousin." 03:AE73 para "I am here to" 03:AE80 line "help you." 03:AE8A para "I will give you" 03:AE9A line "access to the" 03:AEA8 cont "game's internal" 03:AEB7 cont "structures." 03:AEC3 para "With me, you can" 03:AED4 line "bend the game to" 03:AEE5 cont "your own will.@" 03:AEF5 TX_BLINK ; NotLikeThis EmptyText: 03:AEF6 text "" 03:AEF7 done 4FInstructions: 03:AEFA db "Select an option." 03:AF0B line "" 03:AF0C line "A button: Confirm" 03:AF1E line "B button: Cancel@"
Optional Paste Settings
Category:
None
Cryptocurrency
Cybersecurity
Fixit
Food
Gaming
Haiku
Help
History
Housing
Jokes
Legal
Money
Movies
Music
Pets
Photo
Science
Software
Source Code
Spirit
Sports
Travel
TV
Writing
Tags:
Syntax Highlighting:
None
Bash
C
C#
C++
CSS
HTML
JSON
Java
JavaScript
Lua
Markdown (PRO members only)
Objective C
PHP
Perl
Python
Ruby
Swift
4CS
6502 ACME Cross Assembler
6502 Kick Assembler
6502 TASM/64TASS
ABAP
AIMMS
ALGOL 68
APT Sources
ARM
ASM (NASM)
ASP
ActionScript
ActionScript 3
Ada
Apache Log
AppleScript
Arduino
Asymptote
AutoIt
Autohotkey
Avisynth
Awk
BASCOM AVR
BNF
BOO
Bash
Basic4GL
Batch
BibTeX
Blitz Basic
Blitz3D
BlitzMax
BrainFuck
C
C (WinAPI)
C Intermediate Language
C for Macs
C#
C++
C++ (WinAPI)
C++ (with Qt extensions)
C: Loadrunner
CAD DCL
CAD Lisp
CFDG
CMake
COBOL
CSS
Ceylon
ChaiScript
Chapel
Clojure
Clone C
Clone C++
CoffeeScript
ColdFusion
Cuesheet
D
DCL
DCPU-16
DCS
DIV
DOT
Dart
Delphi
Delphi Prism (Oxygene)
Diff
E
ECMAScript
EPC
Easytrieve
Eiffel
Email
Erlang
Euphoria
F#
FO Language
Falcon
Filemaker
Formula One
Fortran
FreeBasic
FreeSWITCH
GAMBAS
GDB
GDScript
Game Maker
Genero
Genie
GetText
Go
Godot GLSL
Groovy
GwBasic
HQ9 Plus
HTML
HTML 5
Haskell
Haxe
HicEst
IDL
INI file
INTERCAL
IO
ISPF Panel Definition
Icon
Inno Script
J
JCL
JSON
Java
Java 5
JavaScript
Julia
KSP (Kontakt Script)
KiXtart
Kotlin
LDIF
LLVM
LOL Code
LScript
Latex
Liberty BASIC
Linden Scripting
Lisp
Loco Basic
Logtalk
Lotus Formulas
Lotus Script
Lua
M68000 Assembler
MIX Assembler
MK-61/52
MPASM
MXML
MagikSF
Make
MapBasic
Markdown (PRO members only)
MatLab
Mercury
MetaPost
Modula 2
Modula 3
Motorola 68000 HiSoft Dev
MySQL
Nagios
NetRexx
Nginx
Nim
NullSoft Installer
OCaml
OCaml Brief
Oberon 2
Objeck Programming Langua
Objective C
Octave
Open Object Rexx
OpenBSD PACKET FILTER
OpenGL Shading
Openoffice BASIC
Oracle 11
Oracle 8
Oz
PARI/GP
PCRE
PHP
PHP Brief
PL/I
PL/SQL
POV-Ray
ParaSail
Pascal
Pawn
Per
Perl
Perl 6
Phix
Pic 16
Pike
Pixel Bender
PostScript
PostgreSQL
PowerBuilder
PowerShell
ProFTPd
Progress
Prolog
Properties
ProvideX
Puppet
PureBasic
PyCon
Python
Python for S60
QBasic
QML
R
RBScript
REBOL
REG
RPM Spec
Racket
Rails
Rexx
Robots
Roff Manpage
Ruby
Ruby Gnuplot
Rust
SAS
SCL
SPARK
SPARQL
SQF
SQL
SSH Config
Scala
Scheme
Scilab
SdlBasic
Smalltalk
Smarty
StandardML
StoneScript
SuperCollider
Swift
SystemVerilog
T-SQL
TCL
TeXgraph
Tera Term
TypeScript
TypoScript
UPC
Unicon
UnrealScript
Urbi
VB.NET
VBScript
VHDL
VIM
Vala
Vedit
VeriLog
Visual Pro Log
VisualBasic
VisualFoxPro
WHOIS
WhiteSpace
Winbatch
XBasic
XML
XPP
Xojo
Xorg Config
YAML
YARA
Z80 Assembler
ZXBasic
autoconf
jQuery
mIRC
newLISP
q/kdb+
thinBasic
Paste Expiration:
Never
Burn after read
10 Minutes
1 Hour
1 Day
1 Week
2 Weeks
1 Month
6 Months
1 Year
Paste Exposure:
Public
Unlisted
Private
Folder:
(members only)
Password
NEW
Enabled
Disabled
Burn after read
NEW
Paste Name / Title:
Create New Paste
Hello
Guest
Sign Up
or
Login
Sign in with Facebook
Sign in with Twitter
Sign in with Google
You are currently not logged in, this means you can not edit or delete anything you paste.
Sign Up
or
Login
Public Pastes
anydesk forensics
1 hour ago | 0.80 KB
OoTMM rando seed 7/28
4 hours ago | 93.67 KB
Untitled
5 hours ago | 5.87 KB
EARNING-BTC ENGINE
CSS | 6 hours ago | 0.38 KB
Secret Guide
6 hours ago | 0.39 KB
Step 7 Enumeration
12 hours ago | 19.79 KB
Disable Drag and Drop Image Improved Plugin i...
PHP | 1 day ago | 1.31 KB
z66is_archive.zip.txt
1 day ago | 1.53 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the
Cookies Policy
.
OK, I Understand
Not a member of Pastebin yet?
Sign Up
, it unlocks many cool features!