; Disassembly of the Wizard of Wor ROM" ; ; CPU Type: Z80 ; ; Created with dZ80 1.50 on 02/19/02 by David E. Turner ; ;============================================================================== ; ; Memory map for Wizard of Wor ; ; $0000-$3fff ROMS X1-X4 but also "magic" RAM (which processes data and copies it to the video RAM) ; $4000-$7fbf Viewable SCREEN RAM (bitmap). Every line on screen is $50 bytes long. ; $7fc0-$7fff Non-viewable. This $40 bytes is used for STACK during game. ; $8000-$afff ROMS X5-X7 ; $b000-$bfff ??? ROM X8 Foreign language-never seen one... normally empty socket. ; $c000-$cfff X11 EMPTY SOCKET (not used in WOW) ; $d000-$d3ff STATIC RAM (protected write - X21 & X22) ; $d400-$dfff Empty static RAM sockets in WOW (X23-X28). Used in Gorf however. ; $e000-$ffff X12-X13 EMPTY SOCKETS (not used in WOW) ; ; ; Specific ROM locations and checksums, according to MAME: ; ; Socket X01: wow.x1 $0000 to $0fff, Checksum $c1295786 ; Socket X02: wow.x2 $1000 to $1fff, Checksum $9be93215 ; Socket X03: wow.x3 $2000 to $2fff, Checksum $75e5a22e ; Socket X04: wow.x4 $3000 to $3fff, Checksum $ef28eb84 ; Socket X05: wow.x5 $8000 to $8fff, Checksum $16912c2b ; Socket X06: wow.x6 $9000 to $9fff, Checksum $35797f82 ; Socket X07: wow.x7 $a000 to $afff, Checksum $ce404305 ; Socket X08: wow.x8 $b000 to $bfff, Checksum (None) <----Here would go the foreign language ROM ; Socket X11: (None) $c000 to $cfff, Checksum (None) <----Not used in game ; Socket X12: (None) $e000 to $efff, Checksum (None) <----Not used in game ; Socket X13 (None) $f000 to $ffff, Checksum (None) <----Not used in game ; ;================================================================================= ; Interesting ROM locations: ; ; $8006: Byte is C3 in normal MAME ROM's. Tested for C3 at locations 0030, ; 00fc and 08d7 in the code. Function: Unknown at this time. It might ; be checking for ROM revision??? -DET 9/17/02 ; ;******************************************************************************* ; How Video Memory is arranged (Preliminary): ; ; Memory goes from left to right on the screen. Meaning $4000 is the ; first position on top left. It then continues to the right for $50 ; bytes. So $4050 is the first pixel position on the left on the second line. ; $FF draws a line the total width of the character. ; Writes to video memory is done with the pattern board (DMA) for the ; most part. ; ; "Magic RAM" is located at $0000 through $3FFF. ??? ; ; The formula for printing to screen in double size mode is: ; DE = ((line number - 1) * 960) + ((character position - 1)* 2) ; where "line number" is 1-16 and "character position" is 1-40. ; -OR- ; DE = 960*(Line Number) + 2*(Character Position) - 962 ; (The latter form is used in this code) ; ; Note! TASM does not use operator precidence, but just interprets left to right. ; ; These formula are only used to simplify placing characters. In reality, you ; could just use absolute values. With the formulas, you just have to fill in the ; line and character positioning. ; ;============================================================================== ; I/O ports: ;============================================================================== ; IN: ; ; $08 intercept register (collision detector) ; bit 0: intercept in pixel 3 in an OR or XOR write since last reset ; bit 1: intercept in pixel 2 in an OR or XOR write since last reset ; bit 2: intercept in pixel 1 in an OR or XOR write since last reset ; bit 3: intercept in pixel 0 in an OR or XOR write since last reset ; bit 4: intercept in pixel 3 in last OR or XOR write ; bit 5: intercept in pixel 2 in last OR or XOR write ; bit 6: intercept in pixel 1 in last OR or XOR write ; bit 7: intercept in pixel 0 in last OR or XOR write ; ; $10 IN0 - This is an input port with bits indicating events ; bit 0: Coin Input 1 active low ; bit 1: Coin Input 2 active low ; bit 2: Coin Input 3 active low ; bit 3: Service Switch active low ; bit 4: Tilt active low ; bit 5: Player 1 Start active low ; bit 6: Player 2 Start active low ; bit 7: Flip Screen ??? active low Cocktail Setting??? ; ; $11 IN1 ; bit 0: Joystick Up - Player 2 active low ; bit 1: Joystick Down - Player 2 active low ; bit 2: Joystick Left - Player 2 active low ; bit 3: Joystick Right - Player 2 active low ; bit 4: Button 2 - Player 2 active HIGH ; bit 5: Button 1 - Player 2 active low ; bit 6: Unknown ??? ; bit 7: Unknown ??? ; ; $12 IN2 ; bit 0: Joystick Up - Player 1 active low ; bit 1: Joystick Down - Player 1 active low ; bit 2: Joystick Left - Player 1 active low ; bit 3: Joystick Right - Player 1 active low ; bit 4: Button 2 - Player 1 active HIGH ; bit 5: Button 1 - Player 1 active low ; bit 6: Unknown ??? active low ; bit 7: Speech Status active HIGH - Speech chip ready to accept phonemes ; ; $13 Dip Switch (DSW) ; bit 0: Coin Slot A Settings On=active HIGH ; Off = 1 Coin, 1 Credit ; On = 2 coins, 1 Credit ; ; bit 1: Coin Slot B Settings\ On=active HIGH ???Verify??? ; bit 2: Coin Slot B Settings/ On=active HIGH ; 0,0 = 1 Coin, 5 Credits ; 0,1 = 1 Coin, 3 Credits ; 1,0 = 2 Coins, 1 Credits ; 1,1 = 1 Coin, 1 Credit ; ; bit 3: Language on=active HIGH ; Off = Foreign (NEED ROM) ; On = English ; ; bit 4: Lives on=active HIGH ; Off = 3 / 7 ; On = 2 / 5 ; ; bit 5: Bonus Life on=active HIGH ; Off = 4th Level ; On = 3rd Level ; ; bit 6: Free Play on=active HIGH ??? ; Off = No Free Play ; On = Free Play ; ; bit 7: Demo Sounds ; Off = No Demo Sounds on=active HIGH ??? ; On = Demo Sounds ; ; $14 Video Retrace ; ; $15 Special Control Register ; These are data writes, done by IN commands ; The data is placed on the upper bits 8-11 bits of the address bus (A) ; and is used to drive 1 8 bit addressable latches to control: ; ; 0 coin counter ; 1 coin counter ; 2 Star enable (never written to) ; 3 Sparkle 1 ; 4 Sparkle 2 ; 5 Sparkle 3 ; 6 n.c. ; 7 coin counter ; ; ; $17 Speech Synthesizer (Output) ; Load the B register with out phoneme ; Load register C with $17 ; Execute IN A,(C) --> This is not a typo. ; (Register A holds ??? after execution) ; How this works: ??? The Votrax SC-01 chip ; is wired to the upper address lines. When an IN A,(C) is executed, ; the value in A ??? is put to the upper address lines! The IN command ; also fires a strobe to the chip letting it know the data is available ; on the address lines. The speech chip reads the phoneme, outputs the ; sound and then places ??? in A after execution. ??? ; ; ; ; OUT: ; ; $00-07 palette (00-03 = right part of screen; 04-07 left part) ; $08 select video mode (0 = low res 160x102, 1 = high res 320x204) ; $09 --xxxxxx position where to switch from the "left" to the "right" palette (/2). ; xx------ background color (portion of screen after vblank) ; ; $0a Vertical Blank. The Address chip needs this register to determine ; the scan line below which Scre en Refresh is n o longer ne eded. ; The Data chip must duplicate this register to determine when to ; turn on the border color. ; ; $0b color block transfer ; $0c magic RAM control ; bit 7: ? ; bit 6: flip ; bit 5: draw in XOR mode ; bit 4: draw in OR mode ; bit 3: "expand" mode (convert 1bpp data to 2bpp) ; bit 2: "rotate" mode (rotate 90 degrees) ; bit 1:\ shift amount to be applied before copying ; bit 0:/ ; $0d set interrupt vector ; ; $0e Interrupt Enable and Mode/Vertical Line Feedback. On write, ; this register enables the two interrupts and determines the ; interrupt mode of each. On read, this register contains ; the vertical line number that a Light Pen Interrupt was ; received on (not used in WOW). Bit 3 of the Interrupt Enable port (0x0E) when ; set enables line interrupts, while bit 1 of the same register ; enables the Light Pen interrupt. ; ; $0f Interrupt Line/Horizontal Address Feedback. On write, this ; register sets the scan line number on which to generate a ; line interrupt back to the Z80. On read, this register ; contains the horizontal address (i.e., position in the line) ; that a Light Pen Interrupt was received on. ; ; $10-$18 sound ??? ; $19 magic RAM expand mode color - How does this work ??? ; $5b Write an A5 to unlock write on D000-DC30 ??? static memory ; ; pattern board ports. It's what we now know as a DMA transfer board. ; THe ports are 78-7e, with each function below: ; ; $78 LSB of source address ; $79 MSB of source address ; $7a Line offset value??? (WOW manual has this listed as $7b also ; $7b LSB of destination address ; $7c MSB of destination address ; $7d Width of pattern ??? ; $7e Height of pattern, and also starts the xfer process! ; ;****************************************************************************** ; ; Votrax Phoneme List ; ; These are the phonemes used on the Votrax SC-01 speech chip. More information ; on the speech chip implementation will be added here at a later date. ; ;****************************************************************************** ; ; 00 = EH3 ; 01 = EH2 ; 02 = EH1 ; 03 = PA0 ; 04 = DT ; 05 = A2 ; 06 = A1 ; 07 = ZH ; 08 = AH2 ; 09 = I3 ; 0A = I2 ; 0B = I1 ; 0C = M ; 0D = N ; 0E = B ; 0F = V ; 10 = CH ; 11 = SH ; 12 = Z ; 13 = AW1 ; 14 = NG ; 15 = AH1 ; 16 = OO1 ; 17 = OO ; 18 = L ; 19 = K ; 1A = J ; 1B = H ; 1C = G ; 1D = F ; 1E = D ; 1F = S ; 20 = A ; 21 = AY ; 22 = Y1 ; 23 = UH3 ; 24 = AH ; 25 = P ; 26 = O ; 27 = I ; 28 = U ; 29 = Y ; 2A = T ; 2B = R ; 2C = E ; 2D = W ; 2E = AE ; 2F = AE1 ; 30 = AW2 ; 31 = UH2 ; 32 = UH1 ; 33 = UH ; 34 = O2 ; 35 = O1 ; 36 = IU ; 37 = U1 ; 38 = THV ; 39 = TH ; 3A = ER ; 3B = EH ; 3C = E1 ; 3D = AW ; 3E = PA1 ; 3F = STOP ; ;****************************************************************************** ; ; Begin initilization for game. ; Things to do include: ; ??? ;***************************************************** .ORG $0000 ; Beginning of ROM (see memory map) di ; No Interruptions ld sp,$D400 ; Set Stack at $D400 ($0400 stack size) ; STATIC RAM is at $D000 - $D3FF ld a,$01 L0006: out ($08),a ; Set Video to HI-RES L0008: ld a,%00101100 ; 00xxxxb = background color ; 00=clear ???, 01=blue, 10=yellow, 11=red ; Does this depend on the palatte??? ; xx101100b = set right/left palette ??? L000A: out ($09),a ; Set video color and mode L000C: ld a,$CC ; =204 out ($0A),a ; Set screen height L0010: call L0093 ; Set interrupt vector and color mapping ld a,%00001000 ; Bit 3 enables screen interrupt and bit 1 light pen interrupt L0015: out ($0E),a ; Enable screen line interrupts and disable light pen interrupt. L0017: ld a,$00 ; Turn off sound? in a,($15) ; Reset SPCR (Special Control Register) ??? verify ld a,$02 ; set bits to 0001b in a,($15) ; write it... yes, it is an IN command... it's special ld a,$0E ; set bits to 1110b in a,($15) ; write it... call L06C8 ; More SPCR stuff... ??? L0026: ld a,$00 ; ld i,a ; Set High order byte for Interrupt im 2 ; A call is made to an address read from address ; (register I × 256 + value from interrupting device) ; Looks like interrupts will be from $0000 to $00FF ; ; **************************************************************************** ; This looks like the end of the hardware initialization code ; and the beginning of the code to run the game. So far, I have found that the ; program "subroutines" are kept in a table and called by indexing in IY. ; While the details are sketchy, the routine at $007E looks to be the focal ; point of the seeming madness... the routines seem to always come back there ; to continue to the next routine. What controls which routines are called when ; is a mystery so far. "Although it seems like madness, there be method to it". ; This comment will be revised over time. ??? ;***************************************************************************** ; xor a ; ld (LD2D3),a ; Zero (location always seems to have a $D2 in it) L0030: ld a,(L8006) ;If l8006 = Jump Instruction - check to see if ROM X5 is there??? cp $C3 call z,L8006 ;Go to ??? routine ; If this is not called, nothing is drawn to the screen ; even though the rest of the game plays... ??? ; ; Temporary !!! ; At this point, memory between has the following: ; $D270 = $18, $40, $87 ; $D281 = $01 ; $D2AC = $58, $40, $87 ; $D2BE = $01 ; $D3F5 = $AF, $D2, $AF, $D2, $58, $08, $AB, $D2, $63, $82, $38 ; ; ld hl,LD03A ; Increment ld c,(hl) ; L003C: inc c ; call L0F6A ; Write to protected memory (HL)=C routine L0040: ld hl,(LD038) ; Load call L00AA ; ...and ??? ld hl,(LD03E) ; Load call L00AA ; ...and ??? ld a,(LD03C) ; If ($d03c)=$1f then L004F: cp $1F ; ...Go zero first $40 bytes of static RAM ($D000-$D03F) call nc,L00B5 ; L0054: ld hl,LD245 ; Load call L00BA ; ...and ??? call L00B8 ; ...and ??? ld a,r ; Load a with refresh register??? RND Number? ld (LD34A),a ; ...and save it to ld hl,LD000 ; Move $20 bytes (32 decimal) from $D000 to $D300 ld de,LD300 ; L0068: ld bc,L0020 ; ldir ; call L08AE ; Reset video and blank some static RAM ??? ; ; Here is where all the real stuff starts happening. Details are few, but from what ; I can gather, this part runs the demo and game loop. It also checks to see if the ; diagnostic switch is set and jumps to diagnostic loop if so at the end of a game or ; the demo loop. ??? ; ld a,(LD303) ; Load game status variable and a ; Is game in "demo" mode (i.e. no game going on) ld iy,L0F70 ; Ready demo loop pointer L0078: jr z,L007E ; Skip game loop - we are in demo mode ld iy,L10FD ; ...else ready game loop pointer L007E: ld hl,L007E ; Set up "return" from subroutine L0081: push hl ; call L0875 ; Load up HL with a saved address in IY and IY+1 ; ... and IY=IY+2 push hl ;...and push it to the stack (for return later?) in a,($10) ; Check status of Service Switch (active low) L0088: bit 3,a ; ret nz ; Diag switch off, continue to demo in progress ld a,(LD303) ; Ia a game in progress and a ; ret nz ; Yes, continue game in progress ; (... don't want to jump to diag's during a game... wait until after game is over) ; jp L00FB ; Otherwise, jump to diagnostics loop ; ... note diag loop terminates with a RST $00 ; ;***************************************************** ; ??? ; ; Ports: ; $0D = set interrupt vector ??? ; $0B = Color Block Transfer ??? ; ; ;***************************************************** ; L0093: ld a,$CA ;Interrupt vector at $CA (202) out ($0D),a ;Set interrupt vector ld hl,L00C5 ;Point to an color mapping table ld bc,L080B ;Move $08 bytes to Port $0b otir ;(C)<-(HL), HL+1, B-1 until B=0 ret ;Interrupt vector an color mapping complete ; ;***************************************************** ; L00A0: ld a,$CC out ($0D),a L00A4: ret L00A5: ld a,$CE out ($0D),a ret ; ;***************************************************** ; ; ??? ; ;***************************************************** ; L00AA: ld a,l ; L00AB: rlca ; Multiply by 16??? rlca rlca rlca cp l ; Same as original? jr nz,L00B5 ; Nope, skip ahead cpl ; cp h ; Check for complement in H??? ret z ; So if L has a number whose nybbles match and ; HL holds L's complement, then return. ; Otherwise, go zero out $40 bytes of ; storage locations??? L00B5: ld hl,LD000 ; Bottom of Static RAM L00B8: ld b,$40 ; bytes to write L00BA: ld c,$00 ; Fill with 0's ld a,$A5 ; Unlock memory byte L00BE: out ($5B),a ; Memory Protection Port L00C0: ld (hl),c ; write byte inc hl ; next byte djnz L00BE ; Go until all byte written ret ; Done! ; ;********************************************************* ; ; Data area for routines at ??? ; What is the data for ??? ; ;********************************************************* ; L00C5: .db $51, $7c, $f3 L00C8: .db $c7, $00, $56, $09, $9e, $09, $b4, $09 ; ;***************************************************** ; ; This is called from the memory fill routine when it ; gets an error. (See L00D4). It loads the refresh register ; (random number) and outputs it to a video port. ; This may be what makes the screen go crazy when video ; memory is bad. ; ;***************************************************** ; L00D0: ld a,r out ($09),a ; ;***************************************************** ; ; This routine is part of the memory test, or at least ; it fills the memory to solid values. It takes a byte, ; fills video memory, checks it. It then complements ; the byte and fills from top of video to bottom, checks it ; then returns. ; One of the interesting things is that this is a type of ; worm test. It walks the byte through memory so it only has ; to check the last location for the correct value. ; If it's different than the pattern, then memory screwed ; it up somewhere. In that case, it calls the error routine. ; Another note, the "return" address is in HL, so if calling ; this routine, you have to set up HL with where you want ; it to "return" to. ; ;***************************************************** ; L00D4: exx ; Swap the main registers ld hl,L4000 ; Point to beginning of video memory ld (hl),a ; Load the pattern to write in first ; byte of video memory ld de,L4001 ; point to one byte later ld bc,L3FFF ; set count for all memory ldir ; walk the bit through memory cp (hl) ; did the pattern change? jr nz,L00D0 ; yes, then go to error routine ex af,af' ; exchange AF in a,($10) ; Kick the dog ex af,af' ; exchange again L00E8: dec de ; set up de to correct place dec de ; ... for the next pass cpl ; complement the pattern ld (hl),a ; load it at top of video memory ld bc,L3FFF ; whole video memory as before lddr ; work it down.. cp (hl) ; did it change? jr nz,L00D0 ; yes, go to error routine ex af,af' ; exchange in a,($10) ; kick the dog ex af,af' ; swap back cpl ; complement the pattern back exx ; swap the main register back jp (hl) ; Go back from whence it came... ; ;********************************************************* ; ; Entry point to the game diagnostics. The diagnostics ; loop is terminated by a RST $00 when the diag ; switch is turned off. Otherwise, it loops forever. ; ;********************************************************* ; L00FB: di ; no interuptions ld a,(L8006) ; Load from ROM L00FF: cp $C3 ; check ROM $8006 for a Jump ; instruction... Why check??? L0101: call z,L8006 ; Well, call it if it's there... call L06CC ; I think this sets up sound to ; a known state. ??? ld a,$80 ; Load a pattern for video ; memory test (Pattern is 1000 0000B) ; and fall through to the test... ; ;********************************************************* ; ; Set up return to $010e and call memory test fill pass ; at l00d4. ??? ; ;********************************************************* ; L0109: ld hl,L010E ; set the return location to l010e jr L00D4 ; Off to fill video memory... ; ;********************************************************* ; ; This rotates the initial test pattern in a (which looks ; to be $80 (or 1000 0000 binary) to walk the bit to the ; right for each pass. When a=0, then it's done and moves on. ; ;********************************************************* ; L010E: and a ; Set the flags jr z,L0114 ; Jump if done... L0111: rra ; Change the fill pattern by walking bit right jr L0109 ; Go to memory fill at l0109 ; ;********************************************************* ; ; Entry point to the game after the Video RAM tests are ; complete. Let's go play Wizard of Wor! ??? ; ;********************************************************* ; L0114: ld sp,L8000 ; Set stack pointer right ; below high ROM, but into ; the top of video memory. ; Turns out that video memory ends at $7fbf ; and from $7fc0 to $7fff ($40 bytes) is not ; displayed. That $40 bytes is used for the stack. L0117: call L08AE ; Reset video and blank some static RAM ??? ld hl,L042E ; String "SCREEN RAM OK" ld de,L001A ; Color (RED) ??? ld b,$0D ; Length call L03B3 ; Go write the string - check on details ??? ; ; ;***************************************************** ; ; Static RAM test starts here ; ;***************************************************** ; ld hl,LD000 ; Bottom of Static RAM ld bc,$0004 ; Outer loop setup ld d,$FF ; Pattern ld a,$A5 ; L012F: out ($5B),a ; Enable write to protected memory ld (hl),d ; Store in Static RAM ld d,(hl) ; Read it back in inc hl ; Increment to next location to test djnz L012F ; ... and keep going until 255 bytes checked dec c ; count down the outer loop jr nz,L012F ; Outer loop is executed 4 times for 1K ld a,d ; Load test character again cp $FF ; Is it an $FF? jr nz,L016C ; No, jump off to error ld c,$04 ; Set up outer loop again L0140: inc d ; Bump up test character... ld a,$A5 ; L0143: out ($5B),a ; Enable write to protected memory dec hl ; Going down through memory ld (hl),d ; Store test character ld d,(hl) ; Get it back from memory djnz L0143 ; Go until bottom of static RAM reached dec c ; Outer loop ??? jr nz,L0143 ; go do ??? until ??? ld a,d ; and a ; Test if we got back test character correctly jr nz,L016C ; Jump to ??? if not ld c,$04 ; Set up for next pass L0153: or (hl) ; change bit pattern in memory L0154: inc hl ; next (going up) L0155: djnz L0153 ; Again until reach end of memory dec c ; Outer loop ??? jr nz,L0153 ; More until ??? and a ; Did we get back correct byte? ??? jr nz,L016C ; Off to the error routine if not... ld a,$55 ; ld (LD045),a ; This location seems to hold a $55 when ??? and static RAM tests OK ld a,(LD045) ; This location seems to hold a $55 when ??? and static RAM tests OK cp $55 ; ld hl,$043B ; String "STATIC RAM OK " L016A: jr z,L016F ; Skip if static RAM is good ??? L016C: ld hl,L0449 ; String "STATIC RAM BAD" L016F: ld de,$051A ; Set color and ??? ld b,$0E ; Length call L03B3 ; Write the string ; ;***************************************************** ; ;Start checking ROMS ; ;***************************************************** ld hl,L0457 ; String "ROM " ld de,L0A28 ; Set color and ??? call L03B1 ; Sets length to $04 and drops ; through to the write string ; routine. ld hl,L03D5 ; String "ABCDEFGX" exx ; Swap the registers ld de,L03E0 ; ??? ld hl,$0000 ; Point to ROM beginning ld a,(LD347) ; ??? in a,($13) ; Check if Foriegn language switch bit 3,a ; ... in bit 3 (DSW Switch 4 - English=On) ld b,$07 ; B=initial number of ROMS jr nz,L0196 ; If it's English, leave ROM count at 7 inc b ; If Foreign, Set ROM count to 8 L0196: push bc ; Below is ROM check... details to come... ??? ld a,h ; cp $40 ; Is H=$40? ??? jr nz,L019E ; No, skip ahead ld h,$80 ; H=80 ??? L019E: cp $B0 ; Is old H=$B0? ??? jr nz,L01A7 ; No, skip ahead ld de,LC00A ; DE is set to location in alt. char. ROM ld h,$C0 ; H=$C0??? L01A7: ld bc,L0010 ; xor a ; A=0 L01AB: add a,(hl) ; inc hl ; djnz L01AB ; Add 255 bytes starting at HL dec c ; jr nz,L01AB ; ... 16 times for a total of 4K ex de,hl ; cp (hl) ; inc hl ex de,hl exx jr z,L01C1 ld a,d ld (LD1D4),a call L0374 dec hl L01C1: inc hl exx pop bc djnz L0196 ; ; End of ROM Test ; exx ; Restore registers after ROM test ld hl,$0446 ; String "OK" ld a,(LD1D4) ; ??? and a ; call z,L0356 ; ??? ld a,$01 ; ld (LD1C5),a ; Save 01 in ??? ld de,L1403 ; Set color and ??? for string write call L03A7 ; Go write "MOVE" and "FIRE" then drop to write routine ld e,$30 ; change color or ??? for string write call L03A7 ; Go write "MOVE" and "FIRE" then drop to write routine L01E1: ld de,L1E0B ; Set color and ??? for string write call L03AE ; Write "FIRE" and drop to write string ld e,$38 ; change color or ??? for string write call L03AE ; Write "FIRE" and drop to write string ld hl,L0408 ; String "PL1" ld de,L230B ; Color and ??? for string write call L03A3 ; B=3 and drop to write string ld hl,L040B ; ld e,$38 call L03A3 L01FD: ld de,L280B L0200: ld hl,L03DD L0203: call L03BA L0206: ld e,$38 call L03BA L020B: ld e,$22 call L03BA ld de,L2D0B ld hl,L0412 L0216: call L03B1 ld hl,L0416 ld de,L2D22 call L03C4 ; Write a string and ??? ld de,L2D38 call L03C4 ; Write a string and ??? L0228: ei ; OK to interrupt me... ld de,LD1D6 ; Player 2 control status save area in a,($11) ; Read player 2 controls cpl ; ??? ld (de),a ; Save Player 2 control status L0230: ld de,LD1D7 ; Player 1 control status save area in a,($12) ; Read Player 1 controls cpl ; ??? ld (de),a ; Save Player 1 control status ld de,L190B ; ??? ld hl,LD1CE ; ??? ld a,(LD1D6) ; Load Player 2 control status call L0317 ; ??? ld de,L1939 ; ??? ld hl,LD1CF ; ??? ld a,(LD1D7) ; Load Player 1 control status call L0317 ; ??? ld de,L1903 ; ??? ld hl,LD1D0 ; ??? ld a,(LD1D6) ; Load Player 2 control status and $10 ; ??? call L0397 ; Test and write YES or NO ld e,$30 ; ??? ld hl,LD1D1 ; ??? ld a,(LD1D7) ; Load Player 1 control status and $10 ; ??? call L0397 ; Test and write YES or NO ld de,L1E03 ; ??? ld hl,LD1CC ; ??? ld a,(LD1D6) ; Load Player 2 control status and $20 ; ??? call L0397 ; Test and write YES or NO ld e,$30 ; ??? ld hl,LD1CD ; ??? ld a,(LD1D7) ; Load Player 1 control status and $20 ; ??? call L0397 ; Test and write YES or NO ld de,L2303 ; ??? ld hl,LD1D2 ; ??? in a,($10) ; Check IN0 for activity cpl ; ??? and $20 ; Check ??? call L0397 ; Test and write YES or NO ld e,$30 ; Check ??? ld hl,LD1D3 ; ??? in a,($10) ; Check IN0 for activity cpl ; ??? and $40 ; Check ??? call L0397 ; Test and write YES or NO L02A0: ld de,L2803 ; ??? ld hl,LD1C9 ; ??? in a,($10) L02A8: cpl and $01 call L0397 ld e,$30 ld hl,LD1CA in a,($10) cpl and $02 call L0397 ld e,$1A ld hl,LD1CB in a,($10) cpl and $04 call L0397 ld de,L2D03 ld hl,LD1D5 in a,($10) cpl L02D1: and $10 call L0397 ld a,(LD347) in a,($13) L02DB: cpl ld b,a ld de,L2D1A ld hl,LD1D8 ld c,$01 L02E5: push hl push bc ld a,b and c push de call L0397 pop de pop bc ld hl,$0500 add hl,de ex de,hl pop hl inc hl ld a,c cp $08 jr nz,L02FE ld de,L2D30 L02FE: sla c L0300: jr nz,L02E5 L0302: in a,($10) and $60 L0306: jr z,L0310 in a,($10) ; bit 3,a ; Check for service switch on jp z,L0228 ; Jump back to diagnostic screen if so L030F: rst 00H ; Otherwise, restart everything! ; ;***************************************************** ; ; ??? ; ;***************************************************** L0310: di call L08AE L0314: jp LAF80 L0317: and $0F cp (hl) ret z ; ld (hl),a ld c,a ld b,$00 L031F: push bc L0320: push de ld b,$05 xor a call L03B5 pop de L0328: pop bc ld hl,L0333 add hl,bc add hl,bc ld a,(hl) inc hl ld h,(hl) L0331: ld l,a jp (hl) L0333: ld d,e inc bc ld e,d inc bc ld e,a inc bc ld h,h L033A: inc bc ld l,h inc bc ld a,b inc bc add a,b L0340: inc bc ld h,h inc bc adc a,b L0344: inc bc adc a,l inc bc sub d inc bc ld h,h inc bc ld h,h inc bc ld h,h inc bc ld h,h inc bc ld h,h inc bc ld hl,L03EC ; "NO" String L0356: ld b,$02 jr L03B3 ; Write String L035A: ld hl,L03EE jr L0356 L035F: ld hl,L03F0 jr L0356 ld hl,L03F7 ; String "ERROR" ld b,$05 jp L03B3 ; Write String ; L036C: ld hl,L03F2 ; String "YES" jr L0356 L0371: ld hl,L03F6 ; String "_" May translate to other character ??? L0374: ld b,$01 jr L03B3 ; Write string ; call L036C L037B: call L0371 jr L035A call L036C L0383: call L0371 jr L035F L0388: ld hl,L03F4 jr L0356 call L0388 jr L037B call L0388 jr L0383 ; ;***************************************************** ; ; ??? test to see if specified control is off or on ; and write YES or NO accordingly. ; ;***************************************************** ; L0397: cp (hl) ; ??? ret z ; ??? ld (hl),a ; ??? and a ; ??? ld hl,$03EB ; String " NO" jr z,L03A3 ; ??? ld hl,L03E8 ; String "YES" L03A3: ld b,$03 ; Length jr L03B3 ; Write string ; ;***************************************************** ; Write "MOVE" ;***************************************************** ; L03A7: ld hl,L0400 ; String "MOVE" ld b,$08 ; Length jr L03B3 ; Write string ; ;***************************************************** ; Write "FIRE" ;***************************************************** ; L03AE: ld hl,L03FC ; String "FIRE" L03B1: ld b,$04 ; Length ; ;***************************************************** ; Entry Point to "write string" command? ; Parameters: ; HL= ??? ; B=?") L04B3: ld l,a ; L = table entry sub $2C ; Check for alternate characters??? ld de,L04CE ; Entry to character table jr c,L04C2 ; Skip alternate ROM set ld hl,LC00B ; Entry of table to alternate ROM character set ld e,(hl) ; \ inc hl ; Manipulations for Alternate ROM set. ld d,(hl) ; Need to figure out what it does later... ??? ld l,a ; / L04C2: ld h,$00 ; add hl,hl ; Begin multiplying HL * $0A push de ; Push beginning of table address ld d,h ; L04C7: ld e,l ; add hl,hl ; add hl,hl ; add hl,de ; Multiply HL * $0A complete. This is table offset. pop de ; Restore beginning of table address add hl,de ; Add start of table address with offset to give table entry. ret ; Thou are done with thy translation! ; ;****************************************************************************** ; ; NAME: GCHARS ; ; This is the data area for alphabetic and a few special characters in ; graphic format. ; ; Characters include (in order): ; 0-9, Space, copyright symbol, left arrow, up arrow, down arrow, dash, ; apostrophe, and right arrow. ; Note that each character is $0A apart. ; Note that table start with entry zero. For example, if you write the letter ; "A", then it would be table entry 11. ; ; Characters are just a 10 down x 8 across bit map. ; If you change the hex numbers into binary you ; will see the actual characters "drawn" in a grid. ; ;****************************************************************************** ; L04CE: .db $3C,$7E,$66,$66,$66,$66,$66,$66,$7E,$3C ; "0" .db $18,$38,$18,$18,$18,$18,$18,$18,$3C,$3C ; "1" .db $3C,$7E,$66,$06,$3E,$7C,$60,$60,$7E,$7E ; "2" .db $3C,$7E,$66,$06,$1C,$1E,$06,$66,$7E,$3C ; "3" .db $66,$66,$66,$66,$7E,$7E,$06,$06,$06,$06 ; "4" .db $7C,$7C,$60,$60,$7C,$7E,$06,$66,$7E,$3C ; "5" .db $3C,$7C,$60,$60,$7C,$7E,$66,$66,$7E,$3C ; "6" .db $7E,$7E,$06,$0E,$0C,$1C,$18,$38,$30,$30 ; "7" .db $3C,$7E,$66,$66,$3C,$7E,$66,$66,$7E,$3C ; "8" .db $3C,$7E,$66,$66,$7E,$3E,$06,$06,$3E,$3C ; "9" .db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00 ; "space" .db $18,$3C,$7E,$66,$66,$66,$7E,$7E,$66,$66 ; "A" .db $7C,$7E,$66,$66,$7C,$7E,$66,$66,$7E,$7C ; "B" .db $3C,$7E,$66,$60,$60,$60,$60,$66,$7E,$3C ; "C" .db $7C,$7E,$66,$66,$66,$66,$66,$66,$7E,$7C ; "D" .db $7E,$7E,$60,$60,$7C,$7C,$60,$60,$7E,$7E ; "E" .db $7E,$7E,$60,$60,$7C,$7C,$60,$60,$60,$60 ; "F" .db $3C,$7E,$60,$60,$60,$6E,$6E,$66,$7E,$3C ; "G" .db $66,$66,$66,$66,$7E,$7E,$66,$66,$66,$66 ; "H" .db $3C,$3C,$18,$18,$18,$18,$18,$18,$3C,$3C ; "I" .db $06,$06,$06,$06,$06,$06,$66,$66,$7E,$3C ; "J" .db $66,$66,$6E,$7C,$78,$78,$6C,$6E,$66,$66 ; "K" .db $60,$60,$60,$60,$60,$60,$60,$60,$7E,$7E ; "L" .db $C3,$E7,$E7,$DB,$DB,$C3,$C3,$C3,$C3,$C3 ; "M" .db $66,$66,$76,$7E,$7E,$6E,$66,$66,$66,$66 ; "N" .db $3C,$7E,$66,$66,$66,$66,$66,$66,$7E,$3C ; "O" .db $7C,$7E,$66,$66,$7E,$7C,$60,$60,$60,$60 ; "P" .db $3C,$7E,$66,$66,$66,$66,$66,$6E,$64,$3A ; "Q" .db $7C,$7E,$66,$66,$7E,$7C,$6E,$66,$66,$66 ; "R" .db $3C,$7E,$66,$60,$7C,$3E,$06,$66,$7E,$3C ; "S" .db $7E,$7E,$18,$18,$18,$18,$18,$18,$18,$18 ; "T" .db $66,$66,$66,$66,$66,$66,$66,$66,$7E,$3C ; "U" .db $66,$66,$66,$66,$66,$7E,$3C,$3C,$18,$18 ; "V" .db $C3,$C3,$C3,$DB,$DB,$DB,$FF,$E7,$C3,$C3 ; "W" .db $66,$66,$7E,$3C,$18,$18,$3C,$7E,$66,$66 ; "X" .db $66,$66,$7E,$3C,$18,$18,$18,$18,$18,$18 ; "Y" .db $7E,$7E,$06,$0E,$1C,$38,$70,$60,$7E,$7E ; "Z" .db $3C,$42,$99,$A5,$A1,$A1,$A5,$99,$42,$3C ; "Copyright Symbol" .db $38,$20,$60,$40,$FF,$FF,$40,$60,$20,$38 ; "Left arrow" .db $18,$18,$3C,$3C,$7E,$5A,$DB,$99,$18,$18 ; "Up arrow" .db $18,$18,$99,$DB,$5A,$7E,$3C,$3C,$18,$18 ; "Down arrow" .db $00,$00,$00,$00,$7E,$7E,$00,$00,$00,$00 ; "Dash" .db $1C,$1C,$1C,$08,$08,$00,$00,$00,$00,$00 ; "Apostrophe" .db $1C,$04,$06,$02,$FF,$FF,$02,$06,$04,$1C ; "Right arrow" ; .db $ ,$ ,$ ,$ ,$ ,$ ,$ ,$ ,$ ,$ ; " " ; .db $ ,$ ,$ ,$ ,$ ,$ ,$ ,$ ,$ ,$ ; " " ; .db $ ,$ ,$ ,$ ,$ ,$ ,$ ,$ ,$ ,$ ; " " ; .db $ ,$ ,$ ,$ ,$ ,$ ,$ ,$ ,$ ,$ ; " " ; .db $ ,$ ,$ ,$ ,$ ,$ ,$ ,$ ,$ ,$ ; " " nop ; Not sure why there is a NOP here... left in just in case. ; ;************************************************* ; ; ;************************************************* L0687: call L06B5 ld hl,LD1BF ld a,(hl) and a ret z inc hl dec (hl) ret nz ld (hl),$02 dec hl dec (hl) ld a,(hl) sub $09 cpl ld e,a call L06D9 ld a,e cp $08 ret c ld a,(L00C8) out ($04),a xor a ld (LD1BA),a ld (LD050),a inc a ld (LD048),a jr L06C8 L06B5: ld hl,LD1C1 ld a,(hl) and a ret z inc hl dec (hl) ret nz ld (hl),$04 dec hl dec (hl) ld e,(hl) call L06D9 dec e ret p ; ;********************************************************* ; ; ; ;********************************************************* ; L06C8: ld a,$A8 ; 162 decimal out ($0F),a ; Set scan line interrupt at 162 L06CC: ld a,$07 in a,($15) ; This does not match the ld a,$09 ; ...writeup for $15 port. ??? in a,($15) ld a,$0B in a,($15) ret ; ;********************************************************* ; L06D9: ld d,$00 ld hl,$06F3 add hl,de add hl,de L06E0: add hl,de ld a,(LD1BA) and a jr nz,L06E8 L06E7: ld a,(hl) L06E8: out ($07),a inc hl ld a,(hl) out ($06),a inc hl ld a,(hl) out ($05),a ret ; ld d,c ld a,h di ld d,c ld a,e di ld d,c ld a,e di ld d,c ld a,d jp p,L7A51 jp p,L7950 pop af ld d,b ld a,c pop af ld d,b ld a,b ret p ld d,b L070C: ld a,b ret p L070E: ld a,$04 in a,($15) jr L06C8 L0714: ld hl,LD1BB ld a,(hl) and a ret z ld a,$CC out ($0F),a inc hl ld a,(hl) and a jr z,L0725 dec (hl) ret ; L0725: ld (hl),$01 dec hl ld a,$05 in a,($15) dec (hl) call z,L070E ld a,(hl) L0731: sub $10 jr nc,L0731 add a,$10 ld c,a ld b,$00 ld hl,L0742 add hl,bc L073E: ld a,(hl) out ($04),a ret ; ; Data Below? ; L0742: rst 00H ld a,b ld c,e jr L0702 ld l,b in a,($58) dec hl ex af,af' xor e adc a,b dec sp sbc a,b set 7,e L0752: ld hl,$06F3 call L06E7 jp L06C8 ; ; End Data? ; L075B: ld hl,LD1BD ld a,(hl) and a ret z ld a,$CC out ($0F),a inc hl ld a,(hl) and a jr z,L076C dec (hl) ret ; L076C: ld (hl),$03 dec hl dec (hl) jr z,L0752 bit 0,(hl) ld a,$07 jr z,L0779 xor a L0779: out ($07),a out ($06),a out ($05),a ret ; nop L0781: call L0894 call L07A8 xor a jp L045C ; L078B: ld a,(LD347) in a,($13) ; Check for language... bit 3,a ; Off=Foreign, On=English (active HIGH) ld hl,L3131 jr nz,L079A ld hl,LC00D L079A: ld a,(hl) inc hl cp $30 jr nc,L079A djnz L079A ld b,a ld a,(LD1E2) add a,b ret ; L07A8: call L0875 push hl call L0875 in a,($10) ; Unknown what bit 7 does... bit 7,a jr nz,L07B6 ex (sp),hl L07B6: pop hl ex de,hl ret ; call L0875 call L0894 call L0886 call L0880 ld c,$FF jp L0460 ; ;***************************************************************************** ; Called this routine from L007E routine ; ??? ;***************************************************************************** ;L07CA: call L0886 call L0894 call L07A8 L07D3: call L0880 jp L045C ; call L0894 call L07A8 call L078B jr L07D3 ; ;***************************************************************************** ; Called this routine from L007E routine ; ??? ;***************************************************************************** ; L07E4: call L0894 call L078B sub $29 cpl ld e,a call L088B in a,($10) bit 7,a ;Unknown what bit 7 does on port $10 call L0880 jr nz,L07FF ld d,a ld a,$4F sub e ld e,a L07FF: push hl L0800: call L0947 ex de,hl pop hl jr L07D3 ; ;***************************************************************************** ; Called this routine from L007E routine ; ??? ;***************************************************************************** ; L0807: call L0872 ld (hl),a L080B: ret ; ;***************************************************************************** ; Called this routine from L007E routine ; ??? ;***************************************************************************** ; L080C: call L0886 L080F: call L0875 ld (hl),e inc hl ld (hl),d ret ; call L0872 call L0886 cp (hl) ret z jr L083E call L0886 L0823: call L0875 ld a,(de) and a ret nz jr L086E call L0886 call L0875 ld a,(de) and a ret z jr L086E L0836: call L0872 call L0886 cp (hl) ret c L083E: push de pop iy ret in a,($10) and (iy+$00) inc iy call L0875 ret z jr L086E L084F: xor a ld (LD050),a call L0880 ld (LD048),a ret xor a ld (LD053),a call L0872 ld (LD051),hl ld (LD042),a ret ld l,(iy+$00) ld h,(iy+$01) L086E: push hl pop iy ret ; ;********************************************************* ; Sub to A=(IY), IY=IY+1 ;********************************************************* ; L0872: call L0880 ; ;********************************************************* ; ; Load H=(IY+1), L=(IY), IY=IY+2 ; Why are we loading up HL with these values? ; ;********************************************************* ; L0875: ld l,(iy+$00) inc iy ld h,(iy+$00) inc iy ret ; ;********************************************************* ; ; Load A=(IY), IY=IY+1 ; ;********************************************************* ; L0880: ld a,(iy+$00) inc iy ret ; ;********************************************************* ; ; Load E=(IY+1), D=(IY), IY=IY+2 ; ;********************************************************* ; L0886: ld e,(iy+$00) inc iy L088B: ld d,(iy+$00) inc iy ret ; ;********************************************************* ; ; Load C=(IY), B=(IY+1) ; ;********************************************************* ; call L089A L0894: ld b,(iy+$00) inc iy ret ; ;********************************************************* ; ; Load C=(IY) ; ;********************************************************* ; L089A: ld c,(iy+$00) inc iy ret ; ;***************************************************************************** ; Called this routine from L007E routine ; ??? ;***************************************************************************** ; L08A0: pop hl ; Return address in HL call L0886 ; Load E=(IY+1), D=(IY), IY=IY+2 push iy ; Save old subroutine pointer ??? push de pop iy ; Setup subroutine pointer to new area ??? jp (hl) ; Return... ; ;***************************************************************************** ; Called this routine from L007E routine ; ??? ;***************************************************************************** ;L08AA: pop hl pop iy jp (hl) ; ;*********************************************************************** ; ; I think this routine sets video for game play and fills some ; static RAM memory with 0's. ; Note: In the pattern xfer below, the source destination regisers are ; missing. This probably means they were set before the call ??? ; ; ; Details and film at eleven... ; ;*********************************************************************** ; L08AE: di xor a ; Zero A out ($19),a ; Magic RAM expand mode color ??? ld a,$08 out ($0C),a ; Set vertical blanking (see description) ??? ld a,$22 out ($7A),a ; Mode control byte ??? xor a ; A=0 out ($7B),a ; LSB of destination address out ($7C),a ; MSB of destination address inc a ; A=1 L08C0: out ($7B),a ; Line offset value ??? ld a,$4F out ($7D),a ; Width of pattern ld a,$CB out ($7E),a ; Height of pattern and start transfer ; NOTE: After the execution of the previous instruction, the screen is cleared! ; So is this a "clear screen" routine using the pattern board??? ; ; What is this section of static RAM used for? ; This section of code blanks out $d040 to $d243 inclusive. ; Also note that the first $40 (64 decimal) bytes is not included. ; ld hl,LD040 ld (hl),$00 ld de,LD041 ld bc,L0203 ldir ld a,(L8006) cp $C3 call z,L8006 ret ; ;************************************************************************ ; call L089A call L0880 ex af,af' call L0875 exx call L07A8 ex de,hl exx L08F0: ld a,(hl) inc hl exx push hl call L04AB ex de,hl pop hl exx ld b,$0A L08FC: exx ld b,$08 ex af,af' ld c,a ex af,af' ld a,(de) inc de L0904: rla jr nc,L0908 ld (hl),c L0908: inc hl push af in a,($10) bit 7,a jr nz,L0912 dec hl dec hl L0912: pop af djnz L0904 in a,($10) bit 7,a ld c,$E8 jr nz,L0920 ld bc,LFF18 L0920: add hl,bc exx djnz L08FC exx ld bc,LF6A8 in a,($10) bit 7,a jr nz,L0931 ld bc,L0958 L0931: add hl,bc exx dec c jr nz,L08F0 ret nop L0938: push hl srl e srl e call L0947 ld de,L0007 add hl,de ex de,hl pop hl ret L0947: ld l,d ld h,$00 ld d,h add hl,hl add hl,hl add hl,hl add hl,hl push hl add hl,hl add hl,hl add hl,de pop de add hl,de ret push af L0957: push bc L0958: push de push hl ex af,af' push af exx push bc push de push hl L0960: push ix call L0E2B call L09D1 call L0979 pop ix pop hl pop de pop bc exx pop af ex af,af' pop hl pop de pop bc pop af ei ret L0979: ld a,(LD1C5) and a ret nz ld hl,LD038 ld a,(hl) inc a call L098B ld hl,LD03E ld a,r L098B: and $0F ld c,a rlca rlca rlca rlca or c ld c,a cpl ld b,a call L0F6A inc hl ld c,b jp L0F6A push af ld a,(LD1C4) add a,$2C out ($0F),a call L00A5 ld a,$0A in a,($15) ld a,$52 out ($07),a pop af ei ret push af ld a,(LD1C4) out ($0F),a call L00A0 ld a,$0B in a,($15) ld a,$51 out ($07),a jr L0957 nop L09C8: ld hl,LD003 ld c,$00 call L0F6A rst 00H L09D1: ld a,(LD1C5) and a jp nz,L0A68 in a,($10) ; Check for TILT and $10 ; Bit 4, active LOW jr z,L09C8 ; Jump to TILT routine ld a,(LD03A) cp $05 jr nc,L09C8 ld a,(LD34E) rra jr c,L0A25 ld hl,LD05C call L0B62 ld hl,LD09C call L0B62 ld hl,LD0E8 call L0B62 ld hl,LD134 L0A00: call L0B62 ld hl,LD067 L0A06: call L0AA6 ld hl,LD0A7 call L0AA6 ld hl,LD0F3 call L0AA6 L0A15: ld hl,LD13F call L0AA6 call L0BD7 call L075B ld a,$05 jr L0A5D L0A25: ld hl,LD07C L0A28: call L0B62 ld hl,LD0C2 call L0B62 ld hl,LD10E call L0B62 ld hl,LD15A call L0B62 ld hl,LD087 call L0AA6 ld hl,LD0CD call L0AA6 ld hl,LD119 call L0AA6 ld hl,LD165 call L0AA6 call L0BE7 call L0714 ld a,$0A L0A5D: ld hl,LD1C3 or (hl) ld (hl),a call L0A72 call L0687 L0A68: ld a,(L8000) cp $C3 call z,L8000 ret nop L0A72: call L0A82 ld hl,LD048 inc de ld a,(de) and a ret nz ld b,$08 call L0A95 ret L0A82: ld de,LD040 ld a,(de) and a ret nz ld hl,LD34E dec (hl) ret nz ld (hl),$3C ld bc,L0601 ld hl,LD042 L0A95: ld a,(hl) and a jr z,L0A9D dec (hl) jr nz,L0A9D scf L0A9D: rl c inc hl L0AA0: djnz L0A95 ld a,c ld (de),a ret nop L0AA6: bit 7,(hl) L0AA8: ret z ld a,$0C out ($19),a ld a,$28 out ($0C),a bit 3,(hl) jr z,L0AB9 res 7,(hl) jr L0AE8 L0AB9: push hl call L0AE8 pop hl bit 5,(hl) ret nz push hl inc hl ld a,(hl) inc hl add a,(hl) jr z,L0AC9 ld (hl),a L0AC9: ld e,a inc hl ld a,(hl) inc hl add a,(hl) ld (hl),a ld d,a call L0938 inc hl ld (hl),e inc hl ld (hl),d in a,($08) pop hl ld a,(hl) push hl call L0AF5 pop hl set 6,(hl) in a,($08) and a ret z set 5,(hl) L0AE8: bit 6,(hl) ret z res 6,(hl) ld a,(hl) ld de,L0005 add hl,de ld e,(hl) inc hl ld d,(hl) L0AF5: ex de,hl ld de,L004F bit 1,a jr nz,L0B2E bit 2,a jr nz,L0B17 ld a,$18 call L0B06 L0B06: ld (hl),a L0B07: inc hl ld (hl),a add hl,de ld (hl),a inc hl ld (hl),a add hl,de ld (hl),a inc hl ld (hl),a add hl,de ld (hl),a inc hl ld (hl),a add hl,de ret L0B17: inc de ld bc,L2244 ld a,(LD1C6) and a call z,L0B25 call L0B25 L0B25: ld (hl),b add hl,de ld (hl),b add hl,de ld (hl),c add hl,de ld (hl),c add hl,de ret L0B2E: bit 2,a jr nz,L0B3C ld a,$FF ld (hl),a inc hl ld (hl),a add hl,de ld (hl),a inc hl ld (hl),a ret L0B3C: ld a,(LD1C6) and a jr nz,L0B55 dec de ld (hl),$99 inc hl ld (hl),$99 inc hl ld (hl),$9E add hl,de ld (hl),$9E inc hl ld (hl),$67 inc hl ld (hl),$67 ret L0B55: ld (hl),$99 inc hl ld (hl),$99 add hl,de ld (hl),$E7 inc hl ld (hl),$E7 ret nop L0B62: bit 7,(hl) ret z res 7,(hl) push hl bit 6,(hl) res 6,(hl) call nz,L0B89 pop hl bit 5,(hl) ret z push hl pop ix ld a,(ix-$04) ld (ix+$16),a ld a,(ix-$02) ld (ix+$17),a push ix pop hl ld a,(hl) xor $70 ld (hl),a L0B89: bit 4,(hl) ld de,L0005 jr z,L0B91 add hl,de L0B91: inc hl L0B92: di ld a,(hl) out ($0C),a ld de,L0005 bit 7,a jr z,L0B9F set 4,d L0B9F: bit 6,a jr nz,L0BA5 set 5,d L0BA5: ld a,d or $0C out ($7A),a L0BAA: bit 5,a jr z,L0BB0 ld e,$FB L0BB0: bit 4,a ld a,$50 jr z,L0BB8 ld a,$B0 ; ;***************************************************************************** ; First seen drawing the monsters on the demo screen! ??? ;***************************************************************************** ; L0BB8: add a,e ld e,a inc hl ld a,(hl) out ($78),a inc hl ld a,(hl) out ($79),a inc hl ld a,(hl) out ($7B),a inc hl ld a,(hl) out ($7C),a ld a,e out ($7B),a ld a,$05 out ($7D),a ld a,$11 out ($7E),a ret nop L0BD7: push iy ld iy,LD054 ld ix,LD074 call L0C2B pop iy ret L0BE7: push iy ld iy,LD074 ld ix,LD054 call L0C2B pop iy ret L0BF7: push iy ld a,$06 L0BFB: push af call L0F2C call L0C09 pop af L0C03: dec a jr nz,L0BFB pop iy ret L0C09: ld a,(iy+$13) L0C0C: bit 5,a ret z ld ix,LD074 call L0C49 L0C16: ld ix,LD054 call L0C49 ld (iy+$13),$00 ld a,(LD1C6) and a ret nz ld (iy+$1c),$0F ret L0C2B: ld a,(iy+$13) bit 5,a ret z call L0C49 call L0E0B ld a,$06 L0C39: push af call L0F1F call L0C49 pop af dec a jr nz,L0C39 ld (iy+$13),$00 ret L0C49: ld a,(ix+$00) and $9A cp $80 ret nz bit 1,(iy+$13) L0C55: jr z,L0C6F ld hl,L0D2C call L0D18 bit 2,(iy+$13) jr z,L0C85 ld a,(LD1C6) and a jr nz,L0C85 inc b inc b inc b inc b jr L0C85 L0C6F: ld hl,L0D3C call L0D18 bit 2,(iy+$13) jr z,L0C85 ld a,(LD1C6) and a jr nz,L0C85 inc d inc d L0C83: inc d inc d L0C85: push bc xor a ld h,a ld b,a ld l,(ix+$1e) ld c,(iy+$15) sbc hl,bc pop bc ld a,l jr c,L0C98 cp $EA ret nc L0C98: add a,c cp b ret nc ld a,(ix+$1f) sub (iy+$17) add a,e cp d ret nc call L0D4C bit 2,(iy+$07) ret nz ld a,(LD1C6) and a jr nz,L0CB6 set 3,(ix+$13) L0CB6: bit 2,(iy+$08) ld hl,LD1E1 ld a,$04 jr nz,L0CC2 rlca L0CC2: or (hl) ld (hl),a bit 3,(iy+$08) ld hl,LD31B jr z,L0CCF inc hl inc hl L0CCF: ld d,$00 ld a,$10 bit 2,(ix+$07) jr z,L0CF3 ld e,$05 ld a,(ix+$08) and $0C jp pe,L0CFC ld e,$01 bit 2,a jr nz,L0CEA inc e L0CEA: ld a,(LD351) and a ld a,e jr z,L0CF3 add a,a daa L0CF3: add a,(hl) daa ld (hl),a inc hl ld a,d adc a,(hl) daa ld (hl),a ret L0CFC: ld a,(LD1EB) and a jr z,L0CEA L0D02: ld (LD352),a ld a,(LD1C6) and a ld e,$10 jr z,L0CEA ld (LD1C8),a xor a ld (LD1D8),a ld e,$25 jr L0CEA L0D18: ld a,(ix+$07) and $03 ld c,a ld b,$00 add hl,bc add hl,bc add hl,bc add hl,bc ld c,(hl) inc hl ld b,(hl) inc hl ld e,(hl) inc hl ld d,(hl) ret L0D2C: inc d add hl,de ld d,$15 inc d add hl,de inc d dec d ld d,$1B inc d inc de inc d dec de inc d L0D3B: inc de L0D3C: ld de,L1613 dec de ld de,L1413 dec de inc de dec d inc d add hl,de ld de,L1415 add hl,de L0D4C: res 7,(ix+$08) set 3,(ix+$00) ld (ix+$1d),$01 ret L0D59: ld (ix+$1d),$00 call L0DD6 ld (ix+$03),$01 ld (ix+$05),$06 ld b,(ix+$07) ld a,b rrca rrca rrca and $80 ld (ix+$07),a ld c,$00 ld a,b and $03 cp $02 jr c,L0D87 ex af,af' in a,($10) bit 7,a jr nz,L0D86 set 7,c L0D86: ex af,af' L0D87: cp $01 jr nz,L0D8D set 7,c L0D8D: cp $02 jr z,L0D9D cp $03 L0D93: jr z,L0D9B ld a,(LD1DA) and a jr z,L0D9D L0D9B: set 6,c L0D9D: ld (ix+$01),c ld c,(ix+$08) bit 2,b ld a,(LD1C6) jr nz,L0DCF and a jr z,L0DB0 ld (LD1C8),a L0DB0: ld a,c rlca rlca rlca and $20 ld h,a ld a,b rlca rlca rlca and $10 or h ld (ix+$07),a ld (ix+$05),$0F bit 3,c ld hl,LD301 jr nz,L0DCD dec hl L0DCD: dec (hl) ret L0DCF: and a ret z ld (ix+$05),$01 ret L0DD6: bit 2,(ix+$07) ld hl,LD241 jr z,L0DFA inc hl ld a,(LD1EB) and a ld a,$02 jr z,L0DF7 rra ld b,a ld a,(LD1C6) and a ld a,b jr z,L0DF7 ld hl,LD243 set 0,(hl) ret L0DF7: or (hl) ld (hl),a ret L0DFA: set 0,(hl) ld a,(LD1C6) and a ret z call L0F39 and $07 or $38 jp L8009 L0E0B: ld a,(ix+$15) sub (iy+$15) add a,$08 cp $11 ret nc ld a,(ix+$17) sub (iy+$17) add a,$08 cp $11 ret nc set 3,(ix+$13) ld (ix+$1c),$0F ret nop L0E2B: ld hl,LD341 ld d,$00 call L0F00 ld hl,LD343 ld d,$02 call L0F00 ld hl,LD345 L0E3E: ld d,$0E call L0F00 ld a,(LD347) in a,($13) ld b,a exx ld de,L0F1A bit 3,a jr nz,L0E54 ld de,LC004 L0E54: exx xor a ex af,af' ld c,$01 ld e,$00 call L0EBB call L0EC0 ld hl,LD342 call c,L0EF4 ld c,$02 ld e,c call L0EBB bit 3,b jr z,L0E77 ld a,b cpl and $06 rra ld e,a L0E77: call L0EC0 ld hl,LD344 call c,L0EE3 ld a,(LD1C5) L0E83: and a jr nz,L0E8A bit 3,b jr nz,L0E99 L0E8A: ld c,$04 ld e,c call L0EBB call L0EC0 ld hl,LD346 call c,L0EF4 L0E99: ex af,af' ld hl,LD03D add a,(hl) push af and $0F ld c,a L0EA2: call L0F6A pop af rrca rrca rrca rrca and $0F ret z dec hl add a,(hl) cp $1F ret nc ld c,a call L0F6A ld hl,LD340 inc (hl) ret L0EBB: ld a,b and c ret nz inc e ret L0EC0: ld hl,LD03B in a,($10) and c ld d,(hl) ld a,$A5 out ($5B),a jr nz,L0ED1 ld a,d or c ld (hl),a ret L0ED1: ld a,d and c ret z ld a,d xor c ld (hl),a ld a,e exx ld l,a ld h,$00 add hl,de ex af,af' add a,(hl) ex af,af' exx scf ret L0EE3: bit 3,b jr z,L0EF4 bit 2,b jr z,L0EF4 ld a,b and $03 jp po,L0EF4 ld hl,LD342 L0EF4: inc (hl) ld hl,LD240 set 5,(hl) ld a,$01 ld (LD244),a ; Turn on sounds in attract mode variable ret L0F00: ld a,(hl) L0F01: and a jr z,L0F0C dec (hl) cp $0F L0F07: ret nz ld a,d in a,($15) L0F0B: ret L0F0C: inc hl ld a,(hl) and a ret z dec (hl) dec hl ld (hl),$1E ld a,d set 0,a in a,($15) ret L0F1A: djnz L0F24 jr nc,L0F6E nop L0F1F: ld ix,LD06E ld bc,L0026 L0F26: add ix,bc dec a jr nz,L0F26 ret L0F2C: ld iy,LD06E ld bc,L0026 L0F33: add iy,bc dec a jr nz,L0F33 ret L0F39: exx ld bc,(LD34A) ld hl,L1321 add hl,bc push hl L0F43: ld hl,L2776 L0F46: adc hl,bc ld de,(LD34C) add hl,de ex (sp),hl add hl,bc ex (sp),hl L0F50: adc hl,de ex (sp),hl add hl,bc ex (sp),hl adc hl,de L0F57: ex (sp),hl ld d,e ld e,b ld b,c ld c,$00 add hl,bc ld (LD34A),hl pop hl adc hl,de ld (LD34C),hl ld a,h exx ret ; ;************************************************************ ; ; Write protected memory byte ; HL= ; C = ; ; ;************************************************************ ; L0F6A: ld a,$A5 out ($5B),a ; Protected memory port L0F6E: ld (hl),c ret ; ;************************************************************ ; ; ; ; ;************************************************************ ; ; L0F70: rlca ; This is data... much of it subroutine call table ex af,af' nop ld c,c out ($81),a rla sub d rla add a,h ld d,$A0 ex af,af' cp $15 inc c ex af,af' nop nop nop out ($D5),a jr L0F8F ex af,af' inc c pop hl pop de jp z,LDA07 L0F8F: ld (L1414),a nop dec bc ex af,af' inc b jp z,L2307 inc sp inc de dec d dec b ld a,(bc) inc bc inc b call po,L0207 jr z,L0F46 inc c sub a ld d,$07 ex af,af' ld (LD1CB),a jr nz,L0FB7 ld c,a out ($B8),a rrca rlca ex af,af' inc sp set 2,c jp z,LCB07 pop de ld a,(bc) adc a,c ld de,L2D6E inc c rlca ex af,af' dec (hl) set 2,c jr nz,L0FD1 ld c,a out ($D2),a rrca rlca ex af,af' scf set 2,c jp z,LCB07 pop de ld a,(bc) or c ld de,L2D96 inc c call nc,L5A19 ex af,af' ex af,af' ld a,$10 jr nz,L0FED L0FE5: inc a L0FE6: ret nc di rrca rlca ex af,af' ld bc,LD244 ld e,d ex af,af' inc bc ld a,$10 add a,h ld d,$2B ex af,af' inc a ret nc inc (hl) djnz L1027 ex af,af' ld c,b out ($34),a L1000: djnz L0FE6 rlca ld bc,LB9B0 L1006: inc c L1007: adc a,a L1008: add hl,de and b ex af,af' inc hl dec d dec hl ex af,af' L100F: inc bc out ($E6),a djnz L1063 ex af,af' ld e,$61 rra add a,c rlca L101A: rrca add hl,de scf ld b,$3A sub h add hl,de and b ex af,af' inc hl dec d dec hl ex af,af' L1027: inc bc out ($E6),a L102A: djnz L107B ex af,af' ld e,$61 rra ld l,b ex af,af' di rrca call po,L0F07 or b cp c inc c ld l,b ex af,af' rlca djnz L106A ex af,af' L1040: inc a ret nc ld d,d djnz L0FE5 ex af,af' ld a,e inc de dec hl ex af,af' inc bc out ($E6),a djnz L10B7 ex af,af' L1050: ld (hl),b rrca L1052: ld (hl),e rla sub e L1055: nop add a,h ld d,$BC ld d,$61 rra xor (hl) ex af,af' inc c ex af,af' nop nop dec de L1063: out ($0C),a ex af,af' nop nop dec e out ($07),a ex af,af' nop ld (bc),a out ($52),a rla ex af,af' rlca call po,L0A07 jr nz,L101A inc c call po,L0507 jr c,L1008 inc c ld e,d ex af,af' rrca ld l,b inc de inc bc rla jp z,LCB07 pop de ld (bc),a ld (LCD00),hl inc a ex af,af' L1090: exx rlca ld (de),a jr z,L1095 L1095: rst 00H inc a inc c call po,L0307 ld d,b ld (hl),d ex af,af' call po,L0507 ld a,b ld c,d inc c ld (hl),$08 ld bc,LD03C or l djnz L1090 rlca inc b sub b ld (L6804),a ex af,af' rst 00H djnz L109A L10B6: rlca L10B7: ld b,$90 ld (LE404),a rlca rlca and b ld (LE404),hl rlca rla or b ld (de),a inc b rst 00H ld d,$2F ld e,$EC ld d,$20 jr nz,L10D8 ld d,e out ($D7),a djnz L10C1 ld d,$08 and b L10D8: ex af,af' inc hl dec d ld c,a ex af,af' ld (bc),a ld h,c rra jr nz,L10EA inc bc out ($D7),a djnz L10EE ex af,af' ld bc,LD244 sub e nop and b L10EE: ex af,af' cp $15 inc c ex af,af' nop nop dec de out ($0C),a ex af,af' nop nop dec e out ($2B),a ex af,af' exx pop de call L7512 ld d,$84 ld d,$A3 ld d,$E0 L110A: ex af,af' add hl,bc xor d ld h,c ld (L52C4),a ei ld l,h rlca ex af,af' ld bc,LD349 jr nz,L1122 ld d,b out ($2B),a ld de,L0781 inc d ld h,h L1122: dec l ld e,e jr nc,L110A rlca inc d sub c sbc a,d ex af,af' call pe,L0116 ld c,a ex af,af' ld a,b ld h,c L1132: rra ret po ex af,af' ld (bc),a xor d jp L8032 ld h,d ccf ld e,l ld c,a ex af,af' inc a ld h,c rra cp h ld d,$61 rra xor (hl) ex af,af' jr nz,L1152 ld d,c out ($74),a ld de,L0807 ld bc,LD1EC L1153: call pe,L0216 ret po ex af,af' ld b,$55 push bc ld (L4010),a xor a ld a,a ret po ex af,af' dec b xor d ld b,e ld sp,L4F14 xor e ld (hl),b ret po ex af,af' rlca rst 38H pop af ld (L5E0C),a or e ld h,c ld b,d ld d,$20 ex af,af' jp z,L87D1 ld de,L07E4 add hl,bc sub b ld (L070C),a ex af,af' ld bc,LD1EC jr nz,L1191 call pe,LAED1 ld de,L16C7 dec hl ex af,af' L1191: jr L1166 and e ld de,L084F inc a ld h,c rra ld d,d rla jr nz,L11A5 ld c,a ex af,af' or h L11A1: ld h,c rra ld c,a ex af,af' L11A5: ld a,b ld h,c rra cp h ld d,$61 rra xor (hl) ex af,af' ld a,c ld a,(de) cpl jr L1153 ex af,af' dec a inc de rlca ex af,af' add a,b ld b,c jp nc,L0807 rlca ld b,l L11BF: ret nc ld (hl),$08 nop ld d,b out ($E4),a ld de,L0836 ld bc,LD350 call c,L5211 rla ld c,b rlca call po,L1607 sub c sbc a,d inc c ld l,b ex af,af' ld (de),a ld (de),a ld d,d rla ld b,b rlca ld l,b ex af,af' ret m ld de,L1752 djnz L11F7 dec hl ex af,af' jr L11BF ret m ld de,L07E4 dec d L11F1: sub c sbc a,d inc c ld l,b ex af,af' ld (de),a L11F7: ld (de),a and b ex af,af' rrca ld d,$1F rla ld d,$08 ld bc,LD302 ld (de),a ld (de),a add a,c rlca inc d ld h,h dec l ld e,e jr nc,L11F1 rlca djnz L11A1 sbc a,d L1211: inc c ld h,c rra ld c,a ex af,af' ld e,$61 rra ld l,b ex af,af' .db $fd,$10 L121D: dec hl ex af,af' pop af pop de dec h ld (de),a ld d,b rra dec hl ex af,af' jp p,L2DD1 ld (de),a inc h rra push bc rla dec hl ex af,af' pop af pop de scf ld (de),a ld d,b rra dec hl ex af,af' jp p,L3FD1 ld (de),a inc h rra add a,c rlca inc d ld h,h dec l L1244: ld e,e jr nc,L1211 rlca dec bc inc sp ld b,$72 dec l ld c,l jr nc,L1258 ld h,c rra L1252: jr nz,L125C ret c pop de sbc a,l ld (de),a L1258: add a,c rlca inc d ld h,h L125C: dec l ld e,e jr nc,L1244 rlca ld de,L9A91 ex af,af' ld c,a L1266: ex af,af' ld a,(bc) ld h,c rra dec hl ex af,af' add a,$D1 ld a,c L126F: ld (de),a ld c,a ex af,af' ld a,b ld h,c rra ld l,b ex af,af' .db $fd,$10 jp z,L1107 inc sp dec c ld l,h dec l ld d,e jr nc,L128F jr nz,L128D inc bc L1286: out ($FD),a djnz L12EB rra dec hl ex af,af' L128D: ret c pop de L128F: or b ld (de),a rlca ex af,af' jr nz,L1252 pop de ld e,d ex af,af' dec b .db $fd,$10 ld h,c rra jp z,LC507 ld (L6D0C),a dec l ld d,e jr nc,L12AF rlca ex af,af' jr nz,L1266 pop de ld l,b ex af,af' ld h,l L12AF: ld (de),a rlca ex af,af' jr nz,L126F pop de add a,c rlca inc d ld h,h dec l ld e,e jr nc,L12A1 rlca ld de,L9A91 ex af,af' adc a,h rla ld c,a ex af,af' or h ld h,c rra ld l,b ex af,af' .db $fd,$10 add a,h ld d,$07 ex af,af' inc c pop hl pop de ret po ex af,af' add hl,bc jp m,L32D1 and h ld e,c dec de ld h,(hl) add a,c rlca inc d ld h,h dec l ld e,e jr nc,L1286 ex af,af' rrca ld d,$1F rla L12EB: ld d,d rla jr nc,L12F6 L12EF: ld c,a ex af,af' ld bc,L1F61 dec hl ex af,af' L12F6: ld b,l jp nc,L12EF ld e,d ex af,af' rlca ld (hl),b rrca call pe,L1016 L1302: jr nz,L130C inc a ret nc ld c,$13 call po,L0F07 or b L130C: cp c inc c and b L130F: ex af,af' inc hl dec d dec hl ex af,af' inc bc out ($E6),a djnz L1368 ex af,af' ld e,$61 rra jr nz,L1327 inc a ret nc L1321: ld (bc),a inc de add a,c rlca rrca add hl,de L1327: scf ld b,$3A and b ex af,af' inc hl dec d dec hl ex af,af' L1330: inc bc out ($E6),a djnz L1384 ex af,af' ld e,$61 rra ld l,b ex af,af' ld (bc),a inc de xor d rla adc a,$1C push de jr L134B ex af,af' inc c pop hl pop de rlca ex af,af' ld bc,LD047 rst 00H ld d,$4F ex af,af' inc bc ld h,c rra dec hl ex af,af' pop bc pop de ld c,a inc de or e add hl,hl rlca ex af,af' ld bc,LD1DB rlca ex af,af' ld bc,LD1D7 xor d ex af,af' L1368: and b ex af,af' ld a,e inc de cp h ld d,$61 rra xor (hl) ex af,af' rlca ex af,af' ld bc,LD353 ld l,b ex af,af' add a,h djnz L130F nop ld b,d dec l xor (hl) ex af,af' rst 00H ld d,$ED L1384: inc e jp z,LF807 ld (L5606),a ld bc,L3E69 inc b jp z,L3607 inc sp inc bc ld l,(hl) ld bc,L3E51 inc b exx rlca ex af,af' ld a,b ld bc,L3E47 inc b jp z,LFE07 ld (L1606),a ld a,(bc) xor c dec (hl) ex af,af' jp z,L3907 inc sp inc bc ld l,$0A sub c dec (hl) ex af,af' exx rlca ex af,af' jr c,L13C4 add a,a dec (hl) ex af,af' jp z,L0407 ; ??? This is in the middle of a string! L13C0: inc sp rlca call nc,LEB12 inc l inc c jp z,L3C07 inc sp inc bc xor $12 pop de inc l inc c exx rlca ex af,af' ret m ld (de),a rst 00H inc l inc c jp z,L1B07 inc sp rlca sub h dec de dec hl inc h inc b jp z,L3F07 inc sp inc b xor h dec de inc de inc h inc b exx rlca ex af,af' cp b dec de rlca inc h inc b jp z,L1B07 inc sp rlca ld d,h inc h ld l,e dec de ex af,af' jp z,L3F07 inc sp L1403: inc b ld l,h inc h ld d,e dec de ex af,af' exx rlca L140B: ex af,af' ld a,b inc h ld b,a dec de ex af,af' jp z,L0B07 L1414: inc sp L1415: ld b,$16 dec l xor c ld (de),a inc c jp z,L3F07 inc sp inc b inc l dec l sub e ld (de),a inc c exx rlca L1427: ex af,af' jr c,L1457 add a,a ld (de),a inc c jp z,LC507 ld (L2C0C),a ld (L0D93),a inc c jp z,L1107 inc sp dec c ret z ld a,($04F7) L1440: ex af,af' jp z,L4307 inc sp L1445: inc b call pe,LD33A inc b ex af,af' exx rlca ex af,af' ret m ld a,(L04C7) ex af,af' ld h,e L1454: rla ld e,d ex af,af' L1457: ld a,(bc) ld e,(hl) inc d ld l,b ex af,af' ex af,af' dec d sub e nop xor (hl) ex af,af' call po,L0B07 ld b,b ld e,c inc c call po,L0C07 ld d,b ld c,c inc c cp c rlca ret p ld (L2701),a ld e,$0C cpl jr L1440 ld d,$5A ex af,af' rlca add a,e inc d ld l,b ex af,af' ex af,af' dec d cp h ld d,$61 rra xor (hl) ex af,af' ld a,c ld a,(de) cp c rlca rst 28H ld (L2701),a ld (LE40C),a rlca L1495: dec c or b ret inc c call po,L0E07 ret nz cp c inc c xor d rla rlca ex af,af' ld bc,LD047 rst 00H ld d,$4F ex af,af' inc bc ld h,c rra dec hl ex af,af' pop bc pop de xor b inc d inc c ex af,af' inc b inc b nop out ($20),a ex af,af' ld c,a out ($C5),a inc d inc c ex af,af' ld b,$06 nop out ($CE),a inc e ld e,$16 or e add hl,hl rlca ex af,af' ld bc,LD1DB rlca ex af,af' ld bc,LD1D7 rlca ex af,af' ld bc,LD1C9 rlca ex af,af' ld bc,LD046 ld e,d ex af,af' ld a,(bc) ret pe inc d ld l,b ex af,af' ex af,af' dec d cp h ld d,$61 rra xor (hl) ex af,af' ld a,c ld a,(de) ld e,$16 cpl jr L1495 ex af,af' dec a inc de call po,L1007 sub c sbc a,d inc c rlca ex af,af' L1500: ld bc,LD046 ld e,d ex af,af' ld a,(bc) ld hl,L0715 ex af,af' inc b ld b,b L150C: jp nc,L08A0 inc hl dec d ld c,a ex af,af' ld (bc),a ld h,c rra jr nz,L1520 inc bc out ($0D),a dec d L151C: rlca ex af,af' ld bc,LD053 xor d ex af,af' ld b,d ex af,af' ld b,b add a,c dec d dec hl ex af,af' ld c,b L152B: out ($35),a dec d ld (hl),$08 L1530: ld bc,LD03C jp c,L0715 ex af,af' ld (bc),a inc bc out ($0C),a ex af,af' djnz L154E add hl,de out ($0C),a ex af,af' ld (bc),a ld (bc),a nop out ($20),a ex af,af' ld c,a out ($52),a dec d inc c ex af,af' L154E: inc bc inc bc L1550: nop out ($2B),a ex af,af' L1554: ld c,b L1555: out ($5F),a dec d ld (hl),$08 inc bc inc a ret nc ld a,e dec d L155F: inc c ex af,af' jr nz,L1583 add hl,de out ($0C),a ex af,af' dec b dec b nop out ($20),a ex af,af' ld c,a out ($77),a dec d inc c ex af,af' rlca rlca nop out ($AC),a ld d,$AC ld d,$AC ld d,$AC ld d,$AA ex af,af' ld b,d ex af,af' L1583: jr nz,L155F dec d dec hl ex af,af' ld c,b out ($93),a dec d ld (hl),$08 nop inc a ret nc jp c,L0715 ex af,af' ld bc,LD303 inc c ex af,af' ld (bc),a ld (bc),a nop out ($20),a ex af,af' ld c,a out ($AA),a dec d inc c ex af,af' inc bc inc bc nop out ($0C),a ex af,af' nop djnz L15C8 out ($2B),a ex af,af' ld c,b out ($BD),a dec d ld (hl),$08 ld bc,LD03C sub $15 rlca ex af,af' jr nz,L15DB out ($0C),a ex af,af' dec b dec b nop out ($20),a ex af,af' ld c,a out ($D4),a dec d inc c ex af,af' rlca rlca nop out ($AC),a ld d,$AC ld d,$AA ex af,af' dec hl L15DB: ex af,af' inc a ret nc call m,LDE15 ld d,$20 ex af,af' sbc a,$D1 call m,L2B15 ex af,af' call po,LFCD1 dec d rlca ex af,af' ld bc,LD244 rlca ex af,af' ld bc,LD1E4 ld d,d rla nop rlca xor d ex af,af' sbc a,(hl) rla L1600: jp nc,LAE16 ex af,af' ld a,c rla L1606: rlca L1607: ex af,af' nop ld (bc),a out ($42),a dec l xor d ex af,af' ret m ld d,$E4 rlca L1613: inc de sub c sbc a,d inc c rlca ex af,af' nop jp po,LAAD1 ex af,af' ;L161D ; ; Is this the end of the data (subroutine jumps)??? ; xor a L161F: ld (LD302),a ld a,$06 ld de,L0C0C call L162E ld a,$04 ld e,$08 L162E: push af call L0F1F call L26EB pop af dec a jr nz,L162E ret ; L163A: ld a,(LD302) cp $0C jr z,L1657 ret ld a,(LD347) in a,($13) ld b,$03 bit 5,a ; Dipswitch: Bonus Lives active HIGH ; Off = 4th Level, On = 3rd Level jr nz,L164E inc b ; L164E: ld a,(LD302) sub b jr nz,L163A ld (LD318),a ; L1657: ld hl,LD300 ld a,(LD303) ld (LD1CA),a dec a jr z,L166D ld a,(hl) and a jr z,L166D inc (hl) exx call L1CFA exx ; L166D: inc hl ld a,(hl) and a ret z inc (hl) jp L1D06 ld hl,LD354 ld a,$FF ld b,$0C L167C: and (hl) inc hl L167E: djnz L167C jp nz,L179E ret ; ;***************************************************************************** ; Called this routine from L007E routine ; Move $24 (36) bytes of data from $D300 to $D000 ??? ;***************************************************************************** ;L1684: di ld hl,LD000 ld de,LD300 ld b,$24 ; 36 decimal L168D: ld a,(de) inc de ld c,a call L0F6A ; Write protected memory byte (HL)=C inc hl djnz L168D ret ; ;***************************************************************************** ; Called this routine from L007E routine ; ??? ;***************************************************************************** ;L1697: ld hl,L331A ld de,LD1CC ld bc,L0009 ldir ret ; ld hl,LD352 ld a,(hl) ld (hl),$00 dec hl ld (hl),a ret ld a,(LD347) in a,($13) ; Check for Free Play - Active HIGH ??? ; Bit 6: Free Play ; Off=No Free Play, On=Free Play bit 6,a ret z ld hl,LD03C ld c,(hl) dec c jp L0F6A ;Write protected memory byte ld a,$CC out ($0F),a ld hl,L0109 ld (LD1BF),hl ret L16C7: ld a,$CC L16C9: out ($0F),a ld hl,L0109 ld (LD1C1),hl ret ; ;***************************************************************************** ; Called this routine from L007E routine ; Check dip switch for free play ;***************************************************************************** ; L16D2: ld a,(LD347) in a,($13) cpl and $40 ld (LD348),a ret ; ;***************************************************************************** ; This routine looks like it will check for any activity on player1 and ; player 2 controls and stores the result in $D1DE. Since P1 and P2 ; control 'bits' are identical, I assume the result saved will tell the program ; if a certain control has been used by either P1 or P2. ??? ; ;***************************************************************************** ; in a,($11) ; Check P2 controls - all active LOW cpl ; Convert to active HIGH ld b,a ; in a,($12) ; Now check P1 Controls - all active LOW cpl ; Make active HIGH or b ; Combine with P2 controls and %00111111 ; Mask unused input bits (see port description) ld (LD1DE),a ; Save it .. ret ; ;***************************************************************************** ; ; ;***************************************************************************** ; ld a,(iy+$00) inc iy ld (LD240),a ld (LD244),a ; Dip switch - Bit 7 - "Sounds in Attract Mode" ret in a,($10) bit 7,a ; Check to see if is active ret nz ; ld a,$02 ld (LD1E2),a ret ; ;***************************************************************************** ; ; ;***************************************************************************** ; ld a,(LD03C) ld e,$FF L1708: inc e sub $0A jr nc,L1708 add a,$3A ld hl,LD1CC L1712: ld (hl),a ld a,e or $30 cp $30 jr nz,L171C add a,$10 L171C: dec hl ld (hl),a ret ld a,(LD302) ld b,a xor a L1724: inc a daa djnz L1724 push af and $0F or $30 ld hl,LD1CC ld (hl),a pop af rrca rrca rrca rrca and $0F ld b,$01 jr z,L1741 dec hl inc b or $30 ld (hl),a L1741: dec de dec de in a,($10) bit 7,a jr nz,L174D inc de inc de inc de inc de L174D: ld a,$0C jp L045C L1752: ld b,(iy+$00) inc iy call L0F39 and (iy+$00) inc iy or b jp L8009 in a,($10) bit 7,a ld a,$88 jr nz,L176D ld a,$18 L176D: ld (LD1C4),a jp L00A0 ld sp,$D400 jp L007E ; ;***************************************************************************** ; Called this routine from L007E routine ; ??? ;***************************************************************************** ; ;L1779: ld hl,LD03A ld c,$00 jp L0F6A ;Write protected memory byte ; ;***************************************************************************** ; Called this routine from L007E routine ; Check if dip switch set to "Demo Sounds Active" ;***************************************************************************** ;L1781: ld a,(LD347) ; Why load this? The next command wipes it out ??? in a,($13) and $80 ; Check bit 7 - Demo Sounds active high ??? ld (LD244),a ; Save demo sound status, A=$80 if active, $00 if not ret ; ;***************************************************************************** ; ??? ;***************************************************************************** ; ld a,$08 ld (LD243),a ret ; ;***************************************************************************** ; Called this routine from L007E routine ; Check how many lives at beginning of game (dip switch) ;***************************************************************************** ;L1792: ld a,(LD347) ; Why load this? The next command wipes it out ??? in a,($13) cpl and $10 ; Normally active HIGH, but complemented is active LOW ld (LD34F),a ; $10=3/7 lives, $00=2/5 ret ; ;***************************************************************************** ; Called this routine from L007E routine ; Zero $D350 to $D36E ;***************************************************************************** ; L179E: ld hl,LD350 ld bc,L1E00 L17A4: ld (hl),c inc hl djnz L17A4 ret ; nop call L17C5 ld a,$0C out ($19),a ld a,$18 out ($0C),a ld hl,L0F07 ld a,$0B call L185F ld hl,L0F43 ld a,$07 jp L185F L17C5: call L181D ld hl,L0781 call L1855 ld hl,L07C9 call L1855 ld hl,L0F01 call L1859 ld hl,L0F49 call L1859 ld hl,L1681 call L185D ld hl,L16C9 call L185D ld c,$17 ld hl,L0007 exx ld hl,LD178 ld c,$06 L17F7: ld b,$0B L17F9: ld a,(hl) inc hl exx call L1813 exx djnz L17F9 exx ld de,L073E add hl,de exx dec c jr nz,L17F7 exx call L1812 ld hl,L2D43 L1812: xor a L1813: push hl call L185F pop hl ld de,L0006 add hl,de ret ; L181D: di ld a,(LD1EB) and a ld a,$0C jr nz,L1828 ld a,$04 L1828: out ($19),a ld a,$18 out ($0C),a ret call L181D ld hl,L30DD ld de,L18D0 ld c,$2F call L18A8 ld hl,L30F4 call L18A8 ld hl,L30DD call L184C ld hl,L3F8D L184C: ld a,$FF ld b,$17 L1850: ld (hl),a inc hl djnz L1850 ret L1855: ld a,$0D jr L185F L1859: ld a,$0C jr L185F L185D: ld a,$0E L185F: bit 2,a jr nz,L186B ex af,af' ld de,L18D2 call L18A8 ex af,af' L186B: bit 3,a jr nz,L187D ex af,af' push hl ld de,L0005 add hl,de ld de,L18D3 call L18A8 pop hl ex af,af' L187D: bit 0,a call z,L1889 bit 1,a ret nz ld de,L06E0 add hl,de L1889: push hl call L1896 ld de,L004B add hl,de call L1896 pop hl ret L1896: ld (hl),$FF inc hl ld (hl),$FF inc hl ld (hl),$FF inc hl ld (hl),$FF inc hl ld (hl),$FF inc hl ld (hl),$FF ret ; ;***************************************************************************** ; This routine seems to be used to draw vertical lines on the screen ; First used in drawing the radar box in the demo screens. ; Also called when drawing the maze... more details as they are available ??? ; Uses DE, HL, C for parameters for source, dest and height. ;***************************************************************************** ; L18A8: ld a,$22 out ($7A),a ld a,e out ($78),a ld a,d out ($79),a ld a,l out ($7B),a ld a,h out ($7C),a ld a,$4F out ($7B),a ld a,$01 out ($7D),a ld a,c out ($7E),a ret ; L18C4: ld a,h ld (hl),c call m,L7C73 halt call m,L7C78 ld a,e call m,L807D djnz L1893 L18D3: jr nc,L18D5 ; ;***************************************************************************** ; Called this routine from L007E routine ; ??? ;***************************************************************************** ; L18D5: di ld a,$08 out ($0C),a ld de,L1937 ld a,$04 out ($19),a ld bc,L1107 ld hl,L3522 call L191B ld hl,L3D42 call L191B ld bc,L0111 ld hl,L37A2 call L191B ld hl,L37B2 call L191B ld a,$08 out ($19),a L1903: ld hl,L37DC call L191B ld hl,L37EC call L191B ld bc,L1107 ld hl,L355C call L191B ld hl,L3D7C L191B: ld a,$22 out ($7A),a ld a,e out ($78),a ld a,d out ($79),a ld a,l out ($7B),a ld a,h out ($7C),a ld a,$50 sub b out ($7B),a ld a,b out ($7D),a ld a,c out ($7E),a ret ; L1937: rst 38H nop L1939: ld hl,(LD31B) push hl ld de,LD319 push de ld de,(LD31D) xor a sbc hl,de ld hl,LD31A ex de,hl jr c,L1953 pop bc ex (sp),hl push de ld d,b ld e,c L1953: ld b,h ld c,l call L195A pop de pop bc L195A: ld a,(de) and a ret z sub $10 ld hl,LD304 jr z,L1967 ld hl,LD30E L1967: push de exx ld bc,$0500 L196C: exx ld e,(hl) inc hl ld d,(hl) ex de,hl xor a sbc hl,bc ex de,hl jr nc,L1986 ld a,(hl) ld (hl),b ld b,a dec hl ld a,(hl) ld (hl),c ld c,a inc hl exx ld a,c and a jr nz,L1985 ld c,b L1985: exx L1986: inc hl exx djnz L196C pop hl ld a,c or (hl) ld (hl),a ret ld de,L32EE jr L1997 ld de,L3138 L1997: ld a,(LD319) ld b,$04 push de call L19A6 pop de ld a,(LD31A) ld b,$08 L19A6: and a ret z bit 4,a ld hl,L2F9C jr nz,L19B1 ld l,$C4 L19B1: and $07 ret z push bc ld bc,LFB00 ex af,af' in a,($10) bit 7,a jr nz,L19C8 ld h,$0A ld a,l sub $92 ld l,a ld bc,$0500 L19C8: ex af,af' L19C9: add hl,bc dec a jr nz,L19C9 ex de,hl pop af ld b,$01 jp L045C ld hl,L168D ld de,LD304 call L19E3 ld hl,L16B5 ld de,LD30E L19E3: in a,($10) bit 7,a jr nz,L19EB ld h,$20 L19EB: ld b,$05 L19ED: push bc push de push hl ld a,$0C call L1A2D pop hl pop de inc de inc de in a,($10) bit 7,a ld bc,$0500 jr nz,L1A05 ld bc,LFB00 L1A05: add hl,bc pop bc djnz L19ED ret nop L1A0B: ld hl,LD1E1 bit 2,(hl) res 2,(hl) ld hl,L38E5 ld de,LD31B ld a,$04 call L1A2C ld hl,LD1E1 bit 3,(hl) res 3,(hl) ld hl,L391F ld de,LD31D ld a,$08 L1A2C: ret z L1A2D: ex af,af' in a,($10) bit 7,a jr nz,L1A38 ld bc,L02DB add hl,bc L1A38: push hl ld hl,LD1D0 ld (hl),$30 dec hl ld (hl),$30 dec hl ld a,(de) call L1A6D ld a,(de) call L1A69 inc de ld a,(de) call L1A6D ld a,(de) call L1A69 inc hl push hl ld b,$05 L1A57: ld a,(hl) cp $30 jr nz,L1A61 ld (hl),$40 inc hl djnz L1A57 L1A61: pop hl ex af,af' ld b,$06 pop de jp L045C L1A69: rrca rrca rrca rrca L1A6D: and $0F add a,$90 daa adc a,$40 daa ld (hl),a dec hl ret nop ld hl,LD302 inc (hl) ld a,(LD318) ld c,a ld b,$00 ld hl,L1AED add hl,bc add hl,bc ld c,(hl) inc hl ld b,(hl) ld hl,LD172 ld a,$06 L1A90: ex af,af' ld de,L0006 add hl,de push hl add hl,de add hl,de ex de,hl dec de pop hl call L1AB4 call L1ABB call L1AB4 call L1ABB call L1AB4 ld a,(bc) inc bc and $0F ld (hl),a ex af,af' dec a jr nz,L1A90 ret L1AB4: ld a,(bc) rrca rrca rrca rrca jr L1ABD L1ABB: ld a,(bc) inc bc L1ABD: and $0F ld (hl),a and $0C ld a,(hl) inc hl jp pe,L1AC9 xor $0C L1AC9: dec de ld (de),a ret L1ACC: ld a,e ld e,$FF L1ACF: inc e sub $18 jr nc,L1ACF ld a,d ld d,$00 L1AD7: inc d sub $18 jr nc,L1AD7 ld l,$0B ld a,$F5 L1AE0: add a,l dec d jr nz,L1AE0 add a,e ld e,a ld d,$00 ld hl,LD178 add hl,de ret L1AED: dec e dec de add hl,de inc e cpl dec de ld b,c dec de ld d,e dec de ld h,l dec de ld (hl),a dec de adc a,c dec de sbc a,e dec de xor l dec de cp a dec de pop de dec de ex (sp),hl dec de L1B07: push af dec de rlca inc e dec hl inc e dec a inc e ld c,a inc e ld h,c inc e ld (hl),e inc e add a,l inc e sub a inc e xor c inc e cp e inc e xor h call pe,LBCCE ld e,d rst 28H cp h rst 28H rst 38H or (hl) sbc a,a L1B28: .db $dd,$3b rst 28H call pe,L9595 sbc a,h xor h xor $CE ld a,(LADD7) sub a xor a call m,L73AD sbc a,(hl) cp h ld a,e .db $ed,$9c push de sbc a,h xor h ld l,d adc a,$BC rst 10H xor l sbc a,(hl) rst 28H cp $A5 inc sp inc sp cp h rst 30H sbc a,a sbc a,h ld e,c call L6AAC adc a,$3A rst 18H rst 08H sub a xor a ld h,e xor l ld (hl),e inc sp cp h push af cp a sbc a,h call c,LAC51 add a,$AE ld a,(L73CD) sub a xor (hl) rst 18H and a dec sp call LFF3B adc a,$9D ld e,c call L6AAC adc a,$BC rst 18H ld h,e sbc a,(hl) rst 00H cp a xor l ld l,e ld d,e cp h ld a,e .db $ed,$9c push de sbc a,h and (hl) xor h call pe,L5A3B call m,LE79F cp h and a inc sp cp (hl) inc sp cp a ld d,e sbc a,l ld e,c call LEEAE xor $33 inc sp inc sp sbc a,a ld a,c ld (hl),e and a sbc a,(hl) rst 38H dec sp ld l,e ld d,e sub l sbc a,l call LCEAC call pe,LE5BC cp h sbc a,(hl) ld a,d sbc a,$A5 or a xor a ld a,(L735B) sbc a,l push bc sbc a,l xor h ld l,d adc a,$BC rst 38H rst 28H sbc a,(hl) ld d,e inc sp and l and l cp a cp h ld e,d ld (hl),e sbc a,h push bc sbc a,l xor h ld l,d call pe,L73BC sbc a,(hl) sub (hl) cp a .db $ed,$ad ld d,e cp h cp h rst 28H call m,LD59C sbc a,h and (hl) xor h call pe,LFC3B call m,LB697 sbc a,(hl) and a sub a xor l dec sp rst 28H sbc a,$9D ld e,c call L6AAC adc a,$3A .db $fd,$cf or a cp h ld h,e or l ld a,(L3ADF) rst 18H ld h,e sbc a,l push bc sbc a,l and (hl) xor h call pe,L7A3B sbc a,$95 add hl,sp ld h,e xor (hl) call c,L3B73 L1C14: xor $FD sub l sub l sbc a,h xor (hl) xor $EE cp a rst 38H rst 38H cp a rst 38H rst 38H cp a rst 38H rst 38H cp a rst 38H rst 38H sbc a,l .db $dd,$dd L1C2B: xor h xor $EE or (hl) cp l ld d,e or l L1C32: ld a,(LBEEF) push de cp a or a xor (hl) rst 38H sbc a,l .db $dd,$dd xor (hl) L1C3E: xor $CE cp a push af xor a cp a ld e,d rst 38H or l xor a ld d,e cp (hl) push af xor a sbc a,l call c,LAEDD xor $EE dec sp ld (hl),e cp a inc sp or a inc sp or a dec sp ld (hl),e cp a ld (hl),e cp a sbc a,l .db $dd,$dd xor (hl) xor $EE add hl,sp push af cp a or (hl) cp (hl) ld (hl),e cp l ld a,c ld (hl),e ld a,(LBFF6) sbc a,l .db $dd,$dd xor (hl) xor $CE add hl,sp push af xor a or (hl) sbc a,(hl) rst 38H cp a ld l,e rst 18H cp a push af xor a sbc a,l call c,LAEDD xor $CE or l sbc a,a ld h,e or (hl) and l sbc a,a add hl,sp or $AF or (hl) sbc a,l rst 38H sbc a,l call z,LACDD xor $EE or (hl) sbc a,a ld d,e cp a ld h,e xor a cp a ld d,e sbc a,a or l xor a ld h,e sbc a,h .db $dd,$dd xor h xor $CE or (hl) sbc a,a .db $ed,$bf ld l,c cp $BF or $9F or a cp a ld h,e sbc a,l .db $dd,$dd xor h xor $EC cp (hl) rst 10H cp h dec sp .db $ed,$fe dec sp sbc a,$FD cp l rst 20H cp h sbc a,h .db $dd,$dc nop call L1D12 ld a,(LD300) call L1CDD call L1D1A ld a,(LD301) L1CDD: and a ret z cp $08 jr c,L1CE5 ld a,$07 L1CE5: ld b,a L1CE6: call L0B92 inc hl djnz L1CE6 ret ld hl,L1DB3 ld de,L1DD6 call L1D20 ld b,$07 jr L1CE6 L1CFA: ld hl,L1DF9 ld de,L1DFE call L1D20 jp L0B92 L1D06: ld hl,L1E03 ld de,L1E08 call L1D20 jp L0B92 L1D12: ld hl,L1D27 ld de,L1D4A jr L1D20 L1D1A: ld hl,L1D6D ld de,L1D90 L1D20: in a,($10) bit 7,a ret nz ex de,hl L1D26: ret L1D27: ld h,d sbc a,h jr c,L1D27 dec l ld h,d sbc a,h jr c,L1D26 L1D30: dec l ld h,d sbc a,h jr c,L1DAB ld h,$62 sbc a,h jr c,L1D30 ld e,$62 sbc a,h jr c,L1DB5 L1D3F: rla ld h,d sbc a,h jr c,L1DBA ex af,af' ld h,d sbc a,h jr c,L1D3F nop L1D4A: jp po,L389C ld c,h inc sp jp po,L389C ld b,(hl) inc sp jp po,L389C add a,$2B jp po,L389C ld b,(hl) inc h jp po,L389C add a,$1C jp po,L389C add a,$0D jp po,L389C ld b,(hl) ld b,$22 or $38 inc sp ld l,$22 or $38 add hl,sp ld l,$22 or $38 L1D7A: cp c ld h,$22 or $38 add hl,sp rra L1D81: ld (L38F6),hl cp c rla ld (L38F6),hl cp c ex af,af' ld (L38F6),hl add hl,sp ld bc,LF6A2 jr c,L1D17 inc sp and d or $38 adc a,c inc sp and d or $38 add hl,bc inc l and d or $38 adc a,c inc h and d or $38 add hl,bc dec e and d or $38 add hl,bc ld c,$A2 or $38 adc a,c ld b,$22 xor (hl) L1DB5: sbc a,(hl) inc h nop ld (L9600),hl call po,L2208 cpl dec a and h ld de,L9C22 jr c,L1E2A ld a,(de) ld (L38F6),hl inc h inc hl ld (LA39A),hl call po,L222B djnz L1D7A L1DD4: and h add hl,sp L1DD6: jp po,L9EAE sbc a,e ccf jp po,L9600 in a,($36) jp po,L3D2F dec de ld l,$E2 sbc a,h jr c,L1E44 dec h jp po,L38F6 sbc a,e inc e jp po,LA39A in a,($13) jp po,LA610 dec de ld b,$60 sbc a,h jr c,L1DD4 dec hl L1DFE: ret po sbc a,h L1E00: jr c,L1DF9 djnz L1E26 or $38 ret m dec hl L1E08: and d or $38 L1E0B: jr L1E1E L1E0D: ld a,(LD03C) dec a jr z,L1E2F ld hl,L1E7B ld de,L1E90 call L1D20 ld b,$04 L1E1E: call L1E3F ld hl,L1E82 ld de,L1E97 call L1D20 L1E2A: ld b,$04 call L1E3F L1E2F: ld a,$78 ld (LD04C),a ld hl,L1E74 ld de,L1E89 call L1D20 ld b,$02 L1E3F: ld a,(LD03C) cp b ld b,$02 jr c,L1E49 ld b,$05 L1E49: ld a,(LD34F) and a ld a,b jr z,L1E52 or $03 L1E52: ld c,a ld b,$05 ld de,LD1CB L1E58: ld a,(hl) inc hl ld (de),a inc de djnz L1E58 ld e,(hl) inc hl ld d,(hl) ld b,c L1E62: push de ld hl,LD1CB call L0B92 pop de ld hl,(LD1CE) add hl,de ld (LD1CE),hl djnz L1E62 ret L1E74: ld (L38F6),hl ld c,d ld e,$FB rst 38H L1E7B: ld h,d sbc a,h jr c,L1E85 ld (L0005),a L1E82: ld (L38F6),hl L1E85: ld c,d ld (LFFFB),a L1E89: and d or $38 jp pe,LFB1E rst 38H L1E90: jp po,L389C and (hl) ld a,(bc) dec b nop L1E97: and d or $38 jp pe,LFB0A rst 38H nop L1E9F: ld a,(LD1D7) and a ret z ld hl,LD054 bit 7,(hl) jr nz,L1ED6 ld a,(LD300) and a jr z,L1ED6 ld b,$00 ld de,L0344 call L1F55 dec c jr nz,L1EBE ld a,$03 L1EBE: ld (LD1EF),a ld a,$02 ld (LD043),a xor a ld (LD1ED),a ld (LD1DC),a ld a,$10 jr z,L1ED3 ld a,$20 L1ED3: call L1EF3 L1ED6: ld hl,LD074 bit 7,(hl) ret nz ld a,(LD301) and a ret z ld b,$F0 ld de,L0248 call L1F55 ld (LD1F0),a ld a,$02 ld (LD044),a ld a,$20 L1EF3: ld c,$00 push hl inc hl ld (hl),c inc hl ld (hl),a inc hl ld (hl),c inc hl ld (hl),b inc hl ld (hl),c L1F00: inc hl ld (hl),$90 inc hl ld (hl),d inc hl ld (hl),e push bc push hl call L1D12 ld a,b L1F0D: and a call nz,L1D1A ex de,hl pop hl ld b,$05 L1F15: ld a,(de) inc de inc hl ld (hl),a djnz L1F15 pop bc pop hl ld (hl),$94 L1F1F: ld a,b cp $78 jr c,L1F50 ld hl,L2CA3 L1F27: ld de,L004B L1F2A: ld b,$04 di ld a,$20 out ($0C),a ld a,(LD1EB) and a ld c,$55 L1F37: jr z,L1F3B ld c,$FF L1F3B: ld a,c and $0F L1F3E: ld (hl),a inc hl ld (hl),c inc hl ld (hl),c inc hl ld (hl),c inc hl ld (hl),c inc hl ld a,c and $F0 ld (hl),a add hl,de djnz L1F3B ret L1F50: ld hl,L2C67 jr L1F27 L1F55: ld a,(LD303) ld c,a and a ld a,$01 ret z ld a,$0A ret nop L1F61: dec iy dec iy ei call L2081 call L2BFD call L203B ld hl,LD1C3 bit 0,(hl) jr z,L1F94 res 0,(hl) push hl ld ix,LD054 call L21B8 call L2259 call L2132 call L2633 call L2D9A ld a,(LD1DF) and a L1F90: call z,L231F pop hl L1F94: bit 1,(hl) jr z,L1FBC res 1,(hl) push hl ld ix,LD074 call L2274 ld a,$01 ld (LD1DA),a call L2132 call L2633 call L2D9A xor a ld (LD1DA),a ld a,(LD1DF) and a call z,L2327 pop hl L1FBC: push hl call L0BF7 L1FC0: ld hl,LD1E0 dec (hl) pop hl jr z,L2014 ld a,(hl) and $03 ret nz bit 2,(hl) jr z,L1FEE res 2,(hl) push hl ld a,$05 L1FD4: push af ld hl,LD054 ld de,LD074 call L0F1F call L256E call L2633 call L2D9A pop af dec a dec a jp p,L1FD4 pop hl L1FEE: bit 3,(hl) L1FF0: jr z,L2010 res 3,(hl) push hl ld a,$06 L1FF7: push af ld hl,LD074 ld de,LD054 call L0F1F L2001: call L256E L2004: call L2633 call L2D9A pop af dec a L200C: dec a jr nz,L1FF7 pop hl L2010: ld a,(hl) and $03 ret nz L2014: ld a,$04 ld (LD1E0),a call L0F39 call L2B8B call L2A38 call L22FD call L2740 call L1E9F call L8003 call L2D6B call L2C15 call L1A0B jp L22A8 nop L203B: ld a,(LD1DB) and a ret z ld ix,LD054 ld a,(LD1DC) call L2051 ld ix,LD074 ld a,(LD1DD) L2051: and $0F ld c,a ld b,(ix+$00) bit 7,b ret z bit 3,b ret nz bit 4,b jr nz,L2070 bit 5,(ix+$08) jr nz,L2070 ld a,(ix+$01) and $F0 or c ld (ix+$01),a L2070: bit 0,c ret z bit 2,b ret z res 2,(ix+$00) ld hl,LD241 set 6,(hl) ret L2080: nop L2081: ld hl,LD040 ld a,(hl) and a jr z,L20AE ld (hl),$00 rra push af call c,L283D pop af rra push af call c,L27C0 pop af rra push af call c,L284D pop af rra push af call c,L27F3 pop af rra push af call c,L27DF pop af rra push af call c,L20E8 pop af L20AE: ld hl,LD041 ld a,(hl) and a jr z,L20E7 ld (hl),$00 rra push af call c,L2113 pop af rra push af call c,L28CD pop af rra push af call c,L2100 pop af rra push af call c,L1E0D pop af rra push af call c,L20E7 pop af rra push af call c,L20E7 pop af rra push af call c,L20E7 pop af rra push af call c,L20F6 pop af L20E7: ret L20E8: ld a,(LD053) and a ret nz inc a ld (LD050),a ld iy,(LD051) ret L20F6: ld a,(LD050) and a ret nz inc iy inc iy ret L2100: xor a ld (LD1E8),a ld hl,LD096 ld (hl),$40 call L210C L210C: inc hl inc hl ld a,(hl) and $FC ld (hl),a ret L2113: ld ix,LD094 ld hl,LD04F bit 7,(ix+$13) jr z,L2123 L2120: ld (hl),$01 ret L2123: ld a,(ix+$00) and $88 cp $80 jr nz,L2120 ld (hl),$14 jp L2342 nop L2132: push iy ld a,$06 L2136: push af call L0F2C call L2144 pop af dec a jr nz,L2136 pop iy ret L2144: ld a,(ix+$00) and $98 cp $80 ret nz ld a,(iy+$00) and $9A cp $80 ret nz ld a,(iy+$04) sub (ix+$04) ld h,a add a,$0E cp $1C ret nc ld a,(iy+$06) sub (ix+$06) ld d,a add a,$0E cp $1C ret nc ld b,(iy+$07) bit 1,b jr z,L2174 ex de,hl L2174: ld a,h and a jr nz,L2189 ld a,d bit 0,b ld h,$FF jr z,L2181 inc h cpl L2181: cp $0E jp c,L0D4C ld a,b cpl ld b,a L2189: ld a,h and a ld d,$00 ld h,d jp p,L2198 ld d,$18 bit 1,b jr z,L2198 ex de,hl L2198: ld a,(ix+$04) call L244D add a,d jr c,L21A4 ld (ix+$04),a L21A4: ld a,(ix+$06) call L244D add a,h cp $79 jr nc,L21B2 ld (ix+$06),a L21B2: set 5,(ix+$00) ret nop L21B8: ld a,(LD303) dec a ret nz ld a,(LD074) ld b,a rla jr c,L21D0 ld a,(LD301) and a jr nz,L21D0 ld (ix+$00),a ld (LD300),a L21D0: ld a,(ix+$00) and $9C cp $80 ret nz ld a,(ix+$01) and $F0 jr nz,L21EB ld a,r bit 3,a ld a,$09 jr z,L2237 ld a,$06 jr L2237 L21EB: ld hl,LD049 ld a,(hl) and a jr nz,L223A ld (hl),$90 push iy ld de,L00FF ld a,$06 L21FB: push af call L0F2C bit 7,(iy+$00) jr z,L2230 ld a,(ix+$04) L2208: sub (iy+$04) ld l,$04 jr nc,L2213 L220F: ld l,$08 neg L2213: rra and $7F ld b,a ld a,(ix+$06) sub (iy+$06) ld h,$01 jr nc,L2225 ld h,$02 neg L2225: rra and $7F add a,b L2229: cp e jr nc,L2230 ld e,a ld a,h or l ld d,a L2230: pop af dec a jr nz,L21FB pop iy ld a,d L2237: ld (LD1ED),a L223A: bit 7,(ix+$13) ret nz push iy ld a,$06 L2243: push af L2244: call L0F2C ld a,(iy+$00) and $8A cp $80 call z,L24B8 pop af dec a jr nz,L2243 pop iy ret nop L2259: ld a,(LD1ED) ld d,a ld a,(LD303) cp $02 jr nz,L226F in a,($11) ld hl,LD04A call L228E call c,L289D L226F: ld a,d ld (LD1DC),a ret L2274: ld a,(LD1EE) ld d,a ld a,(LD303) and a jr z,L2289 in a,($12) ld hl,LD04B call L228E call c,L289D L2289: ld a,d ld (LD1DD),a ret L228E: cpl and $3F ld d,a bit 3,(ix+$00) ret nz ld a,$20 bit 4,d jr nz,L22A3 ld a,(hl) and a jr z,L22A5 dec (hl) ret L22A3: ld (hl),$02 L22A5: scf ret nop L22A8: ld hl,LD1E5 bit 1,(hl) res 1,(hl) ld a,$0C push hl call nz,L22C0 pop hl bit 0,(hl) res 0,(hl) ld a,$00 call nz,L22C0 ret L22C0: ld hl,L22FA ld de,L1132 push af call L22F4 pop af ld de,L117C call L22F4 ld c,$F0 ld de,L0050 di ld a,$20 out ($0C),a ld hl,L0F57 call L22E4 ld hl,L0F98 L22E4: ld b,$08 L22E6: ld (hl),c add hl,de ld (hl),c add hl,de add hl,de djnz L22E6 ld a,c rrca rrca rrca rrca ld c,a ret L22F4: ld bc,L01FF jp L0460 L22FA: ld e,h ld h,c nop L22FD: ld a,(LD1C6) L2300: and a ret nz ld a,$06 push iy L2306: push af L2307: call L0F1F ld iy,LD054 call L2498 ld iy,LD074 call L2498 L2318: pop af dec a jr nz,L2306 pop iy ret L231F: ld a,(LD1DC) ld hl,LD1E6 jr L232D L2327: ld a,(LD1DD) ld hl,LD1E7 L232D: bit 5,(hl) ld (hl),a ret nz bit 5,a ret z ld a,(ix+$00) bit 7,a ret z and $18 ret nz bit 7,(ix+$13) ret nz L2342: ld e,(ix+$04) ld d,(ix+$06) ld bc,$0000 ld a,(ix+$07) bit 1,a rra jp z,L239B jr nc,L236D call L254C L2359: call L2463 L235C: ret m cp b ret c call L2422 ld a,(ix+$04) add a,$16 jr nc,L2382 ld a,$FF jr L2382 L236D: call L2547 L2370: call L246D ret m cp b ret c call L240E ld a,(ix+$04) bit 2,c jr z,L2382 sub $06 L2382: and $F8 jr nz,L2388 ld a,$08 L2388: ld b,a ld a,(ix+$06) add a,$0B bit 2,(ix+$07) jr z,L2396 add a,$03 L2396: ld h,a ld l,$00 jr L23D2 L239B: jr nc,L23B1 call L2542 L23A0: call L2477 ret m cp b ret c call L2422 ld a,(ix+$06) L23AC: ld l,c add a,$16 jr L23C7 L23B1: call L253D L23B4: call L2481 ret m cp b ret c call L240E ld a,(ix+$06) ld l,c bit 2,c jr z,L23C7 sub $06 L23C7: and $F8 ld h,a ld a,(ix+$04) add a,$08 ld b,a ld c,$00 L23D2: ld (ix+$14),c ld (ix+$16),l ld (ix+$15),b ld (ix+$17),h ld a,(ix+$07) and $07 or d ld (ix+$13),a bit 2,(ix+$07) ld hl,LD241 jr nz,L23F3 set 1,(hl) ret L23F3: inc hl ld a,(LD1EB) and a ld a,$08 jr z,L240A ld b,a L23FD: ld a,(LD1C6) and a ld a,b jr z,L240A ld hl,LD243 set 2,(hl) ret L240A: rrca or (hl) ld (hl),a ret L240E: ld c,$F8 ld a,(LD1C6) and a jr nz,L2418 ld c,$FC L2418: bit 2,(ix+$07) jr nz,L2434 ld c,$F8 jr L2434 L2422: ld c,$08 ld a,(LD1C6) and a jr nz,L242C ld c,$04 L242C: bit 2,(ix+$07) jr nz,L2434 ld c,$08 L2434: set 1,(ix+$08) ld (ix+$1a),$03 ld (ix+$1b),$01 set 5,(ix+$00) ret L2445: ld hl,L2458 L2448: cp (hl) inc hl jr c,L2448 ret L244D: exx ld hl,L2457 L2451: inc hl cp (hl) jr c,L2451 ld a,(hl) exx L2457: ret L2458: ret p ret c ret nz xor b sub b ld a,b ld h,b ld c,b jr nc,L247A nop L2463: call L1ACC ld de,$0001 ld a,$08 jr L2489 L246D: call L1ACC ld de,LFFFF ld a,$04 jr L2489 L2477: call L1ACC L247A: ld de,L000B ld a,$02 jr L2489 L2481: call L1ACC ld de,LFFF5 ld a,$01 L2489: and (hl) jr z,L2490 add hl,de inc c jr L2489 L2490: ld a,c and a ld d,$80 ret nz ld d,$A0 ret L2498: ld a,(ix+$00) and $8A cp $80 ret nz bit 7,(ix+$13) ret nz ld a,(ix+$02) cp $40 ret z ld a,(LD1E8) and a ret nz ld a,(iy+$00) and $98 cp $80 ret nz L24B8: ld a,(ix+$1c) and a ret nz ld d,(ix+$06) ld e,(ix+$04) ld h,(iy+$06) ld l,(iy+$04) ld a,(ix+$07) bit 1,a rra jr z,L24FD jr nc,L24E8 ld a,h sub d add a,$0E cp $1C ret nc ld a,l sub e ret c call L254C ld c,e ld b,l call L2529 jp L2359 L24E8: ld a,d sub h add a,$0E cp $1C ret nc ld a,e sub l ret c ld c,l call L2547 ld b,e call L2529 jp L2370 L24FD: jr nc,L2514 ld a,l sub e add a,$0E cp $1C ret nc ld a,h sub d ret c call L2542 ld c,d ld b,h call L2529 jp L23A0 L2514: ld a,e sub l add a,$0E L2518: cp $1C ret nc ld a,d sub h ret c call L253D ld c,h ld b,d call L2529 jp L23B4 L2529: ld a,c call L244D ld c,a ld a,b call L244D sub c ld b,$FF L2535: inc b sub $18 jr nc,L2535 ld c,$00 ret L253D: ld a,d add a,$02 ld d,a ret L2542: ld a,d add a,$14 ld d,a ret L2547: ld a,e add a,$02 ld e,a ret L254C: ld a,e add a,$14 jr nc,L2553 ld a,$FF L2553: ld e,a ret nop L2556: ld a,(ix+$06) cp $30 ld b,$01 jr nc,L2561 ld b,$02 L2561: ld a,(LD1EA) and a ld a,$04 jr z,L256B ld a,$08 L256B: jp L2609 L256E: ld a,(ix+$00) ld b,a and $88 cp $80 ret nz ld a,(ix+$24) and a jr z,L2580 dec (ix+$24) L2580: ld a,(ix+$23) and a jr z,L258A dec (ix+$23) ex af,af' L258A: bit 6,b jr z,L2598 res 6,(ix+$00) ld a,(ix+$25) ld (ix+$02),a L2598: ld a,(ix+$01) and a jr z,L25A4 and $F0 jr z,L25C9 ex af,af' ret nz L25A4: ld a,(LD1C6) and a jr nz,L25B2 ld a,(LD1EB) and a jr nz,L2556 jr L25B9 L25B2: ld a,(LD1EA) and a jr z,L25B9 ex de,hl L25B9: ld a,(hl) and $98 cp $80 jr z,L25ED ex de,hl ld a,(hl) ex de,hl and $98 cp $80 jr z,L25E7 L25C9: ld a,(ix+$06) cp $30 ld c,$02 jr c,L25D4 ld c,$01 L25D4: ld a,r bit 4,a ld b,$01 jr z,L25DD ld b,c L25DD: bit 2,a ld a,$04 jr z,L25E5 ld a,$08 L25E5: jr L2609 L25E7: ex de,hl call L25ED ex de,hl ret L25ED: push hl ld bc,$0004 add hl,bc ld a,(hl) sub (ix+$04) ld b,$08 jr nc,L25FC ld b,$04 L25FC: inc hl inc hl ld a,(hl) sub (ix+$06) ld a,$02 jr nc,L2608 ld a,$01 L2608: pop hl L2609: or b ld b,a ld a,(ix+$01) and $F0 or b ld (ix+$01),a L2614: ld a,(ix+$02) ld b,$FF cp $10 jr c,L262B ld b,$7F cp $20 jr c,L262B ld b,$3F cp $40 jr c,L262B ld b,$1F L262B: ld a,r and b ld (ix+$23),a ret nop L2633: bit 3,(ix+$00) ret z bit 7,(ix+$08) ret nz ld a,(ix+$1d) and a jp nz,L0D59 dec (ix+$03) ret nz ld a,(ix+$05) and a jr z,L26AC ld (ix+$03),$04 dec (ix+$05) jr z,L26A7 ld a,(ix+$07) inc (ix+$07) bit 7,a ld hl,L3348 jr nz,L2667 ld hl,L3352 L2667: and $3F ld c,a ld b,$00 add hl,bc add hl,bc ld c,(hl) inc hl ld b,(hl) call L30C7 ld a,(ix+$01) or $23 ld (hl),a inc hl ld (hl),c inc hl ld (hl),b inc d inc d inc d inc e inc e call L0938 ld bc,$0000 bit 7,(ix+$01) jr z,L2692 ld bc,$0550 L2692: bit 6,(ix+$01) jr z,L269C ld a,c add a,$05 ld c,a L269C: ex de,hl add hl,bc ex de,hl inc hl ld (hl),e inc hl ld (hl),d set 5,(ix+$08) L26A7: set 7,(ix+$08) ret L26AC: ld (ix+$00),$00 bit 7,(ix+$07) ret z ld a,(ix+$08) and $0C cp $0C ret z ld e,$0C cp $08 jr z,L26E8 ld e,$08 ld a,(LD302) cp $07 jr c,L26CE ld a,$06 L26CE: sub $07 ld hl,LD1D6 inc (hl) add a,(hl) ret m ld hl,LD1E3 ld a,(hl) and a jr nz,L26E8 call L0F39 and $07 or $28 ld (hl),a call L8009 L26E8: ld d,(ix+$02) L26EB: call L0F39 and $07 inc a ld b,a xor a L26F3: add a,$18 djnz L26F3 ld c,a ld a,(LD058) sub c add a,$18 cp $30 jr c,L26EB ld a,(LD078) sub c add a,$18 cp $30 jr c,L26EB L270C: call L0F39 and $03 inc a ld b,a L2713: xor a L2714: add a,$18 djnz L2714 ld b,a ld a,(LD05A) sub b add a,$0C cp $18 jr c,L270C ld a,(LD07A) sub b add a,$0C cp $18 jr c,L270C L272D: ld a,c cp $78 ld a,$01 jr c,L2735 xor a L2735: ld (LD1EA),a ld (ix+$24),$1E jp L2A0B nop L2740: ld a,(LD1C9) and a ret nz ld a,$06 L2747: push af call L0F1F call L2754 pop af dec a jr nz,L2747 ei ret L2754: bit 7,(ix+$20) res 7,(ix+$20) ld l,(ix+$21) ld h,(ix+$22) ld c,$00 call nz,L27B5 ld a,(ix+$00) and $88 cp $80 ret nz set 7,(ix+$20) ld a,(ix+$06) L2776: add a,$0C ld c,$FF L277A: inc c sub $18 jr nc,L277A ld b,$00 ld hl,L18C4 add hl,bc add hl,bc ld e,(hl) inc hl ld d,(hl) ld a,(ix+$04) add a,$0C ld b,$00 ld h,b L2791: inc b sub $18 jr nc,L2791 xor a L2797: add a,$02 djnz L2797 ld l,a add hl,de ld (ix+$21),l ld (ix+$22),h ld a,(ix+$08) and $0C ld c,$FF jp pe,L27B5 ld c,$AA bit 3,a jr nz,L27B5 ld c,$55 L27B5: ld de,L0050 ld b,$04 L27BA: ld (hl),c add hl,de djnz L27BA ret nop L27C0: ld a,$02 ld (LD046),a call L27D0 ld l,h call L27D0 ld (LD1ED),hl ret L27D0: ld a,r bit 2,a ld h,$05 jr nz,L27DA ld h,$09 L27DA: bit 3,a ret z inc h ret L27DF: ld hl,LD043 ld de,L2F90 exx ld hl,LD054 ld de,LD1EF ld bc,LD1DC ld a,$04 jr L2805 L27F3: ld hl,LD044 ld de,L2FBE exx ld hl,LD074 ld de,LD1F0 ld bc,LD1DD L2803: ld a,$08 L2805: ex af,af' ld a,(LD1DB) and a ret z L280B: bit 7,(hl) ld a,$40 jr z,L2825 bit 2,(hl) jr z,L2825 ex de,hl dec (hl) jr nz,L281F ld h,b ld l,c ld (hl),$01 jr L2825 L281F: exx inc (hl) exx ld a,(hl) or $30 L2825: exx ld hl,LD1CB ld (hl),a L282A: in a,($10) bit 7,a jr nz,L2837 push hl ld hl,L02D1 add hl,de ex de,hl L2836: pop hl L2837: ld b,$01 ex af,af' jp L045C L283D: ld hl,LD18E set 2,(hl) ld hl,LD198 set 3,(hl) ld hl,LD1E5 set 1,(hl) ret L284D: ld a,$07 ld (LD045),a ; ld a,(LD302) dec a ld d,$21 jr nz,L285C ld d,$01 L285C: cp $05 ld e,$01 jr nc,L286A ld c,a ld b,$00 ld hl,L2882 add hl,bc ld e,(hl) L286A: ld hl,LD1E9 inc (hl) ld a,(hl) cp e jr c,L2874 ld d,$41 L2874: ld a,$06 L2876: push af call L0F1F call L2887 pop af dec a jr nz,L2876 ret L2882: dec b ld b,$04 inc bc ld (bc),a L2887: ld a,(ix+$00) and $88 cp $80 ret nz L288F: ld a,(ix+$02) add a,a cp d ret nc res 6,(ix+$00) cp $10 jr c,L289F L289D: and $F0 L289F: ld (ix+$02),a cp $20 ret c ld b,$FE jr z,L28AB ld b,$FC L28AB: ld a,(ix+$04) and b ld (ix+$04),a ld a,(ix+$06) and b ld (ix+$06),a ret L28BA: ld a,$2D ld (hl),a ld (LD04E),a L28C0: ld ix,LD094 ld (ix+$00),$00 set 7,(ix+$08) ret L28CD: ld hl,LD1C7 ld a,(hl) and a jr z,L28BA ld (hl),$00 ld a,(LD1C8) and a ret nz ld hl,LD243 set 1,(hl) ld a,(LD302) ld b,a ld a,$B0 L28E6: sub $0A djnz L28E6 cp $3C jr nc,L28F0 ld a,$3C L28F0: ld (LD04E),a inc a ld (LD045),a ; ??? ld hl,LD054 ld de,LD074 call L0F39 bit 3,a jr z,L2905 ex de,hl L2905: ld a,(hl) and $98 cp $80 jr z,L2918 ex de,hl ld a,(hl) and $98 cp $80 ld bc,L0078 jp nz,L2998 L2918: ld a,l ld de,LD054 sub e ld (LD1EA),a push hl pop ix ld hl,LD1F3 call L29AB ld c,a inc hl call L29AB ld h,a ld l,c ld a,(ix+$04) add a,$0C call L244D ld c,a ld a,(ix+$06) add a,$0C call L244D ld b,a ld de,LD1F3 L2945: call L0F39 bit 2,a jr nz,L2971 bit 4,a ld a,(ix+$07) jr nz,L295E and $03 cp $03 call z,L29A2 ld a,c add a,h jr L2967 L295E: and $03 cp $02 call z,L29A2 ld a,c sub h L2967: jr c,L2945 cp $F1 jr nc,L2945 ld c,a inc de jr L2991 L2971: bit 4,a ld a,(ix+$07) jr nz,L2983 and $03 cp $01 call z,L29A2 ld a,b add a,l jr L298A L2983: and $03 call z,L29A2 ld a,b sub l L298A: jr c,L2945 cp $79 jr nc,L2945 ld b,a L2991: ex de,hl ld a,(hl) cp $02 jr c,L2998 dec (hl) L2998: ld de,L200C ld ix,LD094 jp L2A0B L29A2: call L0F39 and $03 ret z pop af jr L2945 L29AB: ld b,(hl) xor a L29AD: add a,$18 djnz L29AD ret nop ld a,(LD302) and a jr z,L29C5 cp $04 jr nc,L29D3 add a,a add a,$03 ld d,a ld a,$06 jr L29C9 L29C5: ld d,$06 ld a,$02 L29C9: push af call L29E6 pop af inc d dec a jr nz,L29C9 ret L29D3: ld d,$20 cp $07 jr c,L29DB ld d,$40 L29DB: ld a,$06 L29DD: push af call L29E6 pop af dec a jr nz,L29DD ret L29E6: ld e,$04 ld h,a call L0F1F ld c,h ld hl,L2A29 add hl,bc add hl,bc call L0F39 bit 4,a ld a,$18 jr z,L29FC xor a L29FC: add a,(hl) ld c,a call L0F39 bit 2,a ld a,$18 jr z,L2A08 xor a L2A08: inc hl add a,(hl) ld b,a L2A0B: push ix pop hl inc hl ld (hl),$00 inc hl ld (hl),d inc hl ld (hl),$00 inc hl ld (hl),c inc hl ld (hl),$00 inc hl ld (hl),b inc hl ld (hl),$04 inc hl ld (hl),e ld (ix+$1f),$E0 ld (ix+$00),$80 ret jr L2A2D L2A2D: ld c,b nop sub b nop ret nz nop ld c,b jr nc,L29C6 jr nc,L2A38 L2A38: push iy ld a,$06 L2A3C: push af call L0F1F ld c,$FF ld iy,LD054 call L2AF6 ld a,c and a jp p,L2A90 ld iy,LD074 call L2AF6 ld a,c and a jp p,L2A90 ld a,(ix+$02) cp $10 jr nc,L2A63 ld a,$10 L2A63: ld b,$1E sub $10 jr z,L2A6B ld b,$0F L2A6B: ld a,(LD1C6) and a jr z,L2A73 ld b,$00 L2A73: ld (ix+$1c),b ld a,(ix+$24) and a jr nz,L2AE3 bit 5,(ix+$00) jr nz,L2AE3 set 1,(ix+$00) set 7,(ix+$08) ld (ix+$1f),$E0 jr L2AE3 L2A90: ld a,(LD1C6) and a jr nz,L2AE3 res 1,(ix+$00) ld a,(ix+$24) and a ld (ix+$24),$1E jr nz,L2AE3 ld hl,LD241 ld a,(ix+$08) and $0C jp pe,L2AEB bit 2,a ld a,$10 jr nz,L2AB7 L2AB5: or (hl) ld (hl),a L2AB7: call L2614 ld a,r ld b,a ld a,(LD1E9) cp $04 jr nc,L2AD0 bit 3,b jr z,L2AD0 ld a,(ix+$01) xor $0F ld (ix+$01),a L2AD0: bit 4,b jr z,L2AE3 ld a,(ix+$02) ld (ix+$25),a ld d,$20 call L288F set 6,(ix+$00) L2AE3: pop af dec a jp nz,L2A3C pop iy ret L2AEB: ld a,(LD1EB) and a ld a,$08 jr z,L2AB5 rrca jr L2AB5 L2AF6: ld a,(ix+$00) and $88 cp $80 ret nz ld a,(iy+$00) and $98 cp $80 ret nz call L2B7D ld a,e L2B0A: sub l cp $F1 jr nc,L2B14 cp $0F jr nc,L2B48 ex de,hl L2B14: ld a,h L2B15: call L244D ld h,a ld a,d call L244D L2B1D: sub h jr nc,L2B23 ld h,d neg L2B23: ld c,$02 L2B25: dec c sub $18 jr nc,L2B25 ld d,h push hl ld a,c push af ld a,e add a,$11 jr nc,L2B35 ld a,$FF L2B35: ld e,a call L2477 pop af pop de dec c ret p ld c,a call L2477 dec c ret p ld c,$FF call L2B7D L2B48: ld a,d sub h cp $EF jr nc,L2B52 cp $11 ret nc ex de,hl L2B52: ld a,l call L244D ld l,a ld a,e call L244D sub l jr nc,L2B61 ld l,e neg L2B61: ld c,$02 L2B63: dec c sub $18 jr nc,L2B63 ld e,l push hl ld a,c push af ld a,d add a,$11 ld d,a call L2463 pop af pop de dec c ret p ld c,a call L2463 dec c ret L2B7D: ld d,(ix+$06) ld e,(ix+$04) ld h,(iy+$06) ld l,(iy+$04) ret nop L2B8B: ld d,$00 ld ix,LD054 bit 4,(ix+$00) jr z,L2B99 set 0,d L2B99: ld ix,LD074 bit 4,(ix+$00) jr z,L2BA5 set 1,d L2BA5: ld a,(LD1EB) and a jr z,L2BAD ld d,$03 L2BAD: ld a,$06 L2BAF: push af call L0F1F ld a,(ix+$00) and $88 cp $80 jr nz,L2BF7 res 5,(ix+$00) ld a,(ix+$04) cp $78 ld a,$01 jr c,L2BCB ld a,$02 L2BCB: and d jr nz,L2BE5 ld a,(ix+$08) and $0C cp $04 jr z,L2BE5 ld a,(ix+$02) cp $40 jr nz,L2BF7 ld a,(LD302) cp $05 jr nc,L2BF7 L2BE5: set 5,(ix+$00) bit 1,(ix+$00) jr z,L2BF3 ld (ix+$1f),$E0 L2BF3: res 1,(ix+$00) L2BF7: pop af dec a jr nz,L2BAF ret nop L2BFD: ld hl,LD340 ld a,(hl) and a ret z dec (hl) ld a,(LD349) and a ret nz ld iy,L1052 inc a L2C0E: ld (LD050),a ld (LD053),a ret L2C15: ld a,(LD303) and a ret z ld a,(LD1DB) and a ret z in a,($10) and $28 jp z,L2D12 ld a,$06 L2C28: push af call L0F1F pop af bit 7,(ix+$00) ret nz dec a jr nz,L2C28 ld a,(LD1BB) and a ret nz ld hl,LD1EB ld a,(hl) and a jr nz,L2C78 ld a,(LD302) dec a jp z,L2CF9 call L2CF0 ld (hl),a call L3125 ld a,(L6C68) ld (LD1F1),a ld a,(L6CA4) ld (LD1F2),a ld a,$03 ld (LD047),a ld hl,LD242 set 7,(hl) ld iy,L121D ld a,$20 ld (LD04D),a ld hl,LD1E8 inc (hl) ld de,$010C jp L26EB L2C78: ld a,(LD054) ld hl,LD074 or (hl) bit 3,a ret nz ld a,(LD1DF) and a jr nz,L2CF9 ld hl,LD1C7 ld a,(hl) and a ret nz dec hl ld a,(hl) and a jr nz,L2CF9 ld a,(LD302) cp $07 jr c,L2CA3 call L0F39 and $03 jr z,L2CF9 jr L2CD6 L2CA3: ld d,$FF ld a,(LD300) ld b,a ld a,(LD301) ld c,a ld a,(LD303) dec a jr nz,L2CB7 ld b,$00 sla c L2CB7: ld a,c add a,b rrca rrca and $3F jr z,L2CC4 L2CBF: srl d dec a jr nz,L2CBF L2CC4: ld a,(LD302) cp $03 jr c,L2CF9 L2CCB: srl d dec a jr nz,L2CCB call L0F39 and d jr nz,L2CF9 L2CD6: ld a,$03 ld (LD04E),a ld (LD04F),a ld (hl),a inc hl ld (hl),a ld (LD1D8),a ld (LD1C9),a ld (LD048),a ld hl,$0403 ld (LD1F3),hl L2CF0: ld a,$0A in a,($15) ld a,$52 out ($07),a ret L2CF9: ld a,$01 ld (LD1DF),a ld hl,LD067 ld a,(LD087) or (hl) and $80 ret nz ld hl,LD054 L2D0B: ld a,(LD074) or (hl) and $08 ret nz L2D12: ld (LD1DB),a inc a ld (LD048),a ld a,(LD302) sub $07 jr c,L2D42 L2D20: sub $06 L2D22: jr nc,L2D20 add a,$06 cp $05 jr nz,L2D3D ld a,$02 ld (LD350),a ld hl,LD354 ld bc,L1700 L2D35: ld (hl),c inc hl djnz L2D35 ld a,$01 jr L2D67 L2D3D: ld a,$01 ld (LD350),a ; ;***************************************************************************** ; Called this routine from L007E routine ; ??? ;***************************************************************************** ; L2D42: ld a,(LD302) cp $07 ld de,L000D jr c,L2D4F ld d,e ld e,$09 L2D4F: call L0F39 and $0F cp e jr nc,L2D4F add a,d ld hl,LD354 ld c,a ld b,$00 add hl,bc ld a,(hl) and a jr nz,L2D4F inc (hl) ld a,c inc a inc a L2D67: ld (LD318),a ret ; L2D6B: ld a,(LD303) L2D6E: and a ret z ld a,(LD1D7) and a ret z ld a,(LD054) ld hl,LD074 or (hl) ret m ld hl,LD300 ld a,(hl) inc hl or (hl) ret nz call L1939 xor a ld (LD303),a ld (LD1D7),a ld (LD1DB),a inc a ld (LD048),a ld (LD1D9),a ret nop L2D9A: ld a,(LD1DB) and a ret z ld a,(ix+$00) ld b,a and $8C cp $80 ret nz bit 7,(ix+$08) ret nz bit 4,b jp nz,L30DD ld a,(ix+$1c) and a jr z,L2DBB dec (ix+$1c) L2DBB: ld a,(ix+$01) and $0F ld (ix+$01),a call L2E4F ld a,(ix+$01) and $F0 ret nz call L2E4F bit 2,(ix+$07) ret nz ld a,(ix+$01) ld b,a and $F0 ret nz ld a,b and $0F jp po,L2DF6 bit 5,(ix+$00) ret z res 5,(ix+$00) ld a,(ix+$07) inc c exx jp L2FE2 L2DF2: ld bc,$0402 ex af,af' L2DF6: call L30D6 cp $04 jr c,L2E14 ld a,d add a,$18 L2E00: sub $18 jr z,L2E34 jr nc,L2E00 cp $F4 ld c,$01 jr c,L2E2D ld c,$02 ld a,d add a,$0C ld d,a jr L2E2D L2E14: ld a,e add a,$18 jr nc,L2E1B ld a,$FF L2E1B: sub $18 jr z,L2E34 jr nc,L2E1B cp $F4 ld c,$04 jr c,L2E2D ld c,$08 ld a,e add a,$0C ld e,a L2E2D: call L1ACC ld a,b and (hl) jr nz,L2E41 L2E34: ld a,(ix+$07) and $03 ld c,a ld b,$00 ld hl,L2DF2 add hl,bc ld c,(hl) L2E41: call L2E4C ld a,(ix+$01) and $F0 ret nz jr L2E4F L2E4C: ld (ix+$01),c L2E4F: ld c,$00 exx call L30D6 ld a,(ix+$01) ld b,a and $0F ret z ld c,a ld (ix+$01),a ld a,b rrca rrca rrca rrca and $0F ld b,a and c jr z,L2E75 ld a,b xor c jr z,L2E75 cp $03 jr c,L2E7B jr L2EA7 L2E75: bit 0,(ix+$00) jr z,L2EA7 L2E7B: res 0,(ix+$00) ld a,e call L2445 ret nz bit 1,c jr z,L2E94 call L1ACC bit 1,(hl) ret z ld b,$01 set 5,c jr L2ED5 L2E94: bit 0,c ret z ld a,$17 add a,d ld d,a call L1ACC bit 0,(hl) ret z ld b,$00 set 4,c jr L2ED5 L2EA7: set 0,(ix+$00) ld a,d call L2445 ret nz bit 3,c jr z,L2EC0 call L1ACC bit 3,(hl) ret z ld b,$03 set 7,c jr L2ED5 L2EC0: bit 2,c ret z ld a,$17 add a,e jr nc,L2ECA ld a,$FF L2ECA: ld e,a call L1ACC bit 2,(hl) ret z ld b,$02 set 6,c L2ED5: ld (ix+$01),c ld a,c and $50 ld a,(ix+$02) jr z,L2EE2 neg L2EE2: and a jr nz,L2EE9 exx set 0,c exx L2EE9: ld l,a rla ld h,$00 jr nc,L2EF0 dec h L2EF0: add hl,hl add hl,hl add hl,hl add hl,hl ld a,c cp $40 jr c,L2F58 ld e,(ix+$03) ld d,(ix+$04) add hl,de ld (ix+$03),l ld (ix+$04),h ld a,h cp $F1 jr c,L2F65 ld a,h L2F0C: cp $F8 ld h,$00 jr c,L2F14 ld h,$F0 L2F14: ld (ix+$04),h ld a,(LD1EB) and a L2F1B: jr z,L2F42 ld a,(LD1C6) and a jr nz,L2F42 bit 2,(ix+$07) jr z,L2F65 xor a ld (ix+$00),a ld a,$F3 out ($07),a ld (LD1BA),a ld (LD1D8),a ld hl,LD242 set 5,(hl) call L06CC jp L30BA L2F42: ld a,$0A ld (LD047),a exx ld hl,LD1E5 set 0,(hl) call L3125 ld hl,LD242 set 4,(hl) exx jr L2F65 L2F58: ld e,(ix+$05) ld d,(ix+$06) add hl,de ld (ix+$05),l ld (ix+$06),h L2F65: ld a,h cp d ld c,$FF jr z,L2F70 inc c exx set 0,c exx L2F70: bit 2,(ix+$07) jr z,L2F82 ld hl,LD1E8 ld a,(hl) dec a jr nz,L2F82 inc (hl) exx set 0,c exx L2F82: ld a,(ix+$02) and a jr z,L2F89 inc c L2F89: ld d,(ix+$07) ld a,d and $03 xor b L2F90: cp $01 jr nz,L2FA2 bit 2,d jr z,L2F9E ld a,(LD1E8) and a L2F9C: jr nz,L2FA2 L2F9E: exx set 0,c exx L2FA2: ld a,(ix+$08) and $0C bit 2,d jr z,L2FC8 ld hl,L30BF sub $04 jr z,L2FD7 inc hl sub $04 jr z,L2FD7 inc hl ld a,(LD1EB) and a jr z,L2FD7 L2FBE: inc hl ld a,(LD1C6) and a jr z,L2FD7 inc hl jr L2FD7 L2FC8: ld hl,L30C4 sub $04 jr nz,L2FD7 inc hl ld a,(LD303) dec a jr nz,L2FD7 inc hl L2FD7: ld a,d dec c jr nz,L2FDC add a,(hl) L2FDC: and $FC or b ld (ix+$07),a L2FE2: ld de,L0008 bit 2,a ld hl,L385C jr z,L2FEF ld hl,L3F4C L2FEF: bit 1,(ix+$08) jr z,L2FF6 add hl,de L2FF6: bit 1,a ld bc,$0550 jr z,L3002 add hl,de add hl,de ld bc,L0005 L3002: bit 0,a jr nz,L3009 ld bc,$0000 L3009: ld e,a bit 1,a L300C: jr nz,L301A ld a,(LD1DA) and a jr z,L3026 ld a,c add a,$05 ld c,a jr L3026 L301A: in a,($10) bit 7,a jr nz,L3026 ld b,$05 ld a,c add a,$50 ld c,a L3026: ld a,e push bc rlca rlca bit 1,(ix+$08) jr z,L3033 L3030: ld a,(ix+$1a) L3033: and $03 ld e,a add hl,de add hl,de ld e,$20 ld a,(ix+$08) and $0C sub $04 jr z,L3057 add hl,de sub $04 jr z,L3057 add hl,de ld a,(LD1EB) and a jr z,L3057 add hl,de ld a,(LD1C6) and a jr z,L3057 add hl,de L3057: ld c,(hl) inc hl ld b,(hl) call L30C7 ex (sp),hl bit 2,l jr nz,L3063 inc e L3063: inc e inc d inc d inc d ld a,e and $03 or $20 bit 4,l jr z,L3072 or $80 L3072: bit 2,l jr z,L3078 xor $43 L3078: ex (sp),hl ld (hl),a inc hl ld (hl),c inc hl ld (hl),b call L0938 ex de,hl pop bc add hl,bc ex de,hl inc hl ld (hl),e inc hl ld (hl),d bit 1,(ix+$00) ret nz exx bit 0,c ret z bit 1,(ix+$08) jr z,L30B6 set 5,(ix+$00) dec (ix+$1b) ret nz ld a,$01 bit 2,(ix+$07) jr z,L30AA ld a,$02 L30AA: ld (ix+$1b),a de