hirom header org $C12456 JSR old_2497 ; ---- some reordering starts here. ---- LDX #$1800 reuse1: LDY #$0000 reuse2: STX $10 LDX #$AE3F ; ---- next 2 instructions unchanged ---- ; LDA #$7E ; JMP $198D org $C1246C ; Just 1 instruction in C1/2469 changed. ; ; C1/2469: A28F01 LDX #$018F JSR old_2497 ; C1/246F: A20008 LDX #$0800 ; C1/2472: 8610 STX $10 ; C1/2474: A23FAE LDX #$AE3F ; C1/2477: A00020 LDY #$2000 ; C1/247A: A97E LDA #$7E ; C1/247C: 208D19 JSR $198D ; C1/247F: 6B RTL ; C1/2480 unchanged, here for reference. ; ; C1/2480: 208424 JSR $2484 ; C1/2483: 6B RTL org $C12484 JSR old_2497 LDX #$1400 ; --- Dropping 2 instructions --- LDY #$2400 ; --- Dropping 2 more instructions, then adding 1 --- BRA reuse2 old_2497: ; ---- 1 added instruction, 4 just shifted up a little, ----- ; ---- 1 changed, then 2 more added. ------- PHX STX $10 JSR $2020 JSR $24F5 JSR $24E5 JSR $22A5 PLX RTS rep 5 : NOP ; 5 bytes to spare. ; C1/24A5 unchanged, here for reference. ; ; C1/24A5: 20A924 JSR $24A9 ; C1/24A8: 6B RTL org $C124A9 JSR old_2497 ; see original file for rest of function. ; ---------------------- org $C124D1 JSR old_2497 CPX #$FFFF ; is pointer our special case null value? BNE skip_call JSR $2020 ; if so, zero out two buffers skip_call: LDX #$2000 JSR reuse1 RTL ; 2 bytes to spare NOP RTL ; C1/24E5 unchanged, see original file for it ; ---------------------- org $C124F9 ; C1/24F5: C2 20 REP #$20 ; C1/24F7: A5 10 LDA $10 ; --- slightly shorter version of FF3us 1.1 Sketch bug avoidance. --- inc beq zeroit ; if special case FFFFh, make it 0. could branch further, ; really. dec zeroit: ; ---- This chunk is unchanged, aside from being shifted down 4 bytes. ---- ASL ASL CLC ADC $10 TAX ; X = monster # x 5 LDA $D27002,X ; get index to palette XBA AND #$03FF ; save palette index, zeroing out stencil bit and others ASL ASL ASL ASL STA $6169 LDA $D27000,X ; tile bank pointer AND #$7FFF ; zero out top bit that indicates 8 vs 16 colors STA $81A8 TDC ; A = 0 ; ------- Now we get freaky. ------- LDA $D27001,X SEP #$20 ; Set 8-bit accumulator asl ; Carry = bit 7 of $D27001,X, indicating 8 vs 16 color ; bitmap. 0 = 16-color, 1 = 8-color xba ; get $D27002,X , which holds: ; bit 7: stencil bit, set for big bitmaps, ; bit 1 and 0: top two bits of palette index, ; bits 2 thru 6: unknown, not set for any monsters ror STA $81AC ; bit 7: 8 vs 16 color bitmap (0=16-color, 1=8-color), ; bit 6: stencil bit, bit 0: top bit of palette index asl asl asl ; Carry = bit 6 from $D27002,X. you got me, since ; it's never set, and its purpose is unknown. tdc ; zeroes A, bottom AND top half. latter is imperative ; for a "TAX" shortly after the "LDA $D27004,X". rol ; isolate bit 6 of above in bit 0 STA $81AB ; always zero? ; (that's 20 bytes versus 32 bytes original. you were warned!) rep 8 : NOP ; 8 bytes to spare! ; ------- Rest of function unchanged. -------- ; C1/2539: BF 04 70 D2 LDA $D27004,X (index to map used) ; C1/253D: 8D AA 81 STA $81AA ; [...]