* * Pac-Man * * (c) 1983, Atari * (s) 2024, Antoine Vignau * TYP BIN ORG $4000 MX %11 USE PACMAN.E *----------------------------------- * FIRMWARE EQUATES *----------------------------------- SOFTEV EQU $03F2 PWREDUP EQU $03F4 NMILOC EQU $03FB IRQLOC EQU $03FE KBD EQU $C000 KBDSTROBE EQU $C010 SPKR EQU $C030 TXTCLR EQU $C050 TXTSET EQU $C051 MIXCLR EQU $C052 TXTPAGE1 EQU $C054 TXTPAGE2 EQU $C055 LORES EQU $C056 HIRES EQU $C057 SETAN0 EQU $C058 CLRAN0 EQU $C059 SETAN1 EQU $C05A CLRAN1 EQU $C05B SETAN2 EQU $C05C BUTN0 EQU $C061 PADDL0 EQU $C064 PADDL1 EQU $C065 PTRIG EQU $C070 VTAB EQU $FC22 VTABZ EQU $FC24 RDKEY EQU $FD0C GETLN1 EQU $FD6F COUT1 EQU $FDF0 SETKBD EQU $FE89 SETVID EQU $FE93 *----------------------------------- * ENTRY POINT *----------------------------------- LDA #$AF ; relocate from $1000 to $4000 STA zpPTR2+1 LDA #$7F STA zpPTR1+1 LDY #$00 STY zpPTR2 STY zpPTR1 LDX #$70 L4010 LDA (zpPTR1),Y STA (zpPTR2),Y INY BNE L4010 DEC zpPTR2+1 DEC zpPTR1+1 DEX BPL L4010 JSR SETKBD JSR SETVID JMP L4027 L4027 LDA #$01 STA zpNBPLAYERS JSR L54D4 LDA #$00 STA zpHISCORE STA zpHISCORE+1 STA zpHISCORE+2 STA zpNBLIVES LDA #$01 STA zpMONITOR ; ZP - color monitor if 1 STA zpDEMO ; ZP - demo if 1 LDA #welcomePAGE STA SOFTEV+1 STA NMILOC+2 STA IRQLOC+1 EOR #$A5 STA PWREDUP LDA #$4C STA NMILOC JSR selectMONITOR JMP welcomePAGE ; show LOGO ASC "(C) 1983 ATARI, INC.ALL RIGHTS RESERVED." ASC "UNAUTHORIZED REPRODUCTION, ADAPTATION, D" ASC "ISTRIBUTION, PERFORMANCE, OR DISPLAY OF " ASC "THIS DOCUMENT, THE ASSOCIATED COMPUTER P" ASC "ROGRAM, OR THE AUDIOVISUAL WORK IS STRIC" ASC "TLY PROHIBITED." DB $02 DB $BB DB $5A DB $30 DB $5F DB $EE DB $3D DB $A8 DB $17 *----------------------------------- * MAIN ENTRY POINT *----------------------------------- selectRANKCARTOON bit selecNBPLAYERS ; LoGo L4147 JSR setTEXT2 ; set text mode JSR clearTEXT2 ; clear text screen LDA #$00 STA CH LDA #$05 JSR gotoXY LDX #$00 L4158 LDA L41DC,X ; RANK OR CARTOON? JSR printCHAR INX CPX #$11 BCC L4158 JSR GETLN1 LDA #$07 JSR gotoXY LDA #$00 STA CH LDA $0200 CMP #"C" BNE L419F *--- Choose cartoon LDX #$00 L4178 LDA L4201,X ; CARTOON NUMBER (1-3) JSR printCHAR INX CPX #$16 BCC L4178 JSR GETLN1 LDX $0200 LDA #$02 CPX #"1" BEQ L4197 LDA #$05 CPX #"2" BEQ L4197 LDA #$09 L4197 STA zpRANK ; ZP JSR playCARTOON JMP selectRANKCARTOON *--- Choose rank L419F LDX #$00 L41A1 LDA L41ED,X ; RANK NUMBER (1-21) JSR printCHAR INX CPX #$14 BCC L41A1 JSR GETLN1 CPX #$01 BEQ L41D2 LDA $0200 AND #$0F TAX LDA $0201 AND #$0F CPX #$00 BEQ L41C8 L41C2 CLC ADC #$0A DEX BNE L41C2 L41C8 CMP #$16 BCS L41D9 L41CC STA L54E0+1 JMP selecNBPLAYERS L41D2 LDA $0200 AND #$0F BNE L41CC L41D9 JMP selectRANKCARTOON L41DC ASC "RANK OR CARTOON? " L41ED ASC "RANK NUMBER? (1-21) " L4201 ASC "CARTOON NUMBER? (1-3) " *----------------------------------- * SELECT NUMBER OF PLAYERS *----------------------------------- selecNBPLAYERS JSR setTEXT2 JSR clearTEXT2 LDA #$00 STA CH LDA #$06 JSR gotoXY LDX #$00 L4228 LDA L427C,X ; HOW MANY PLAYERS? JSR printCHAR INX CPX #$1D BNE L4228 L4233 JSR RDKEY CMP #$96 ; ctrl-v BEQ L4272 CMP #"1" BCC L4233 CMP #"5"+1 BCS L4233 JSR printCHAR AND #$07 STA zpNBPLAYERS ; ZP LDA #$00 STA CH LDA #$0B STA CV JSR gotoXY LDX #$00 L4256 LDA L4299,X ; SPACE OR RETURN JSR printCHAR INX CPX #$37 BNE L4256 L4261 JSR RDKEY CMP #" " BNE L426B JMP welcomePAGE ; space means the end L426B CMP #$8D BNE L4261 JMP L52FC ; RETURN TO PLAY L4272 JSR RDKEY CMP #$83 ; ctrl-c BNE L4233 JMP L4147 L427C ASC "HOW MANY PLAYERS? (1 - 5) " L4299 ASC "PRESS TO PLAY"8D ASC "OR TO GO BACK TO DEMO. " *----------------------------------- * DECODE WELCOME SCRIPT *----------------------------------- decodeSCRIPT LDA (zpPTR1),Y ; get X STA zpXCOL INY LDA (zpPTR1),Y ; get Y STA zpY1 STA zpTEMP3 ; save Y INY STY zpTEMP4 ; save index L42DE LDY zpTEMP4 ; get index LDA (zpPTR1),Y ; get value BMI L4303 BEQ L42F6 ; 0, 3..1F CMP #$20 BEQ L42F9 CMP #$21 ; b comes from another font BEQ L4306 ; b/c we exceed 256! CMP #$03 BCS L42F6 INC zpY1 ; +=2 INC zpY1 L42F6 JSR L4316 ; draw sprite L42F9 LDA zpTEMP3 ; #$20: space character STA zpY1 ; restore Y INC zpTEMP4 ; next index INC zpXCOL ; next X BNE L42DE ; loop L4303 INC zpTEMP4 ; exit RTS L4306 LDA #sprFONT2 STA L55B1+2 JSR L4338 JMP L42F9 L4316 STA zpTEMP2 ASL ASL ASL ; *8 ADC zpTEMP2 ; +1 = *9 STA L55B1+1 LDA #>sprFONT STA L55B1+2 BCC L432A INC L55B1+2 L432A CLC LDA L55B1+1 ADC #welcomeSCRIPT STA zpPTR1+1 * 1. Character / Nickname LDY #$00 JSR decodeSCRIPT JSR welcomeTAB * 2. Draw Shadow / Inky sprite LDA #$22 STA zpY1 LDA #$01 STA $E0 JSR L88A2 LDY zpTEMP4 ; Shadow JSR decodeSCRIPT LDY zpTEMP4 ; Inky JSR decodeSCRIPT JSR welcomeTAB * 3. Draw Bashful / Blinky LDA #$31 STA zpY1 LDA #$03 STA $E0 JSR L88A2 LDY zpTEMP4 ; Bashful JSR decodeSCRIPT LDY zpTEMP4 ; Blinky JSR decodeSCRIPT JSR welcomeTAB * 4. Draw Speedy / Pinky LDA #$40 STA zpY1 LDA #$02 STA $E0 JSR L88A2 LDY zpTEMP4 ; Speedy JSR decodeSCRIPT LDY zpTEMP4 ; Pinky JSR decodeSCRIPT JSR welcomeTAB * 5. Pokey / Clyde LDA #$4F STA zpY1 LDA #$04 STA $E0 JSR L88A2 LDY zpTEMP4 ; Pokey JSR decodeSCRIPT LDY zpTEMP4 ; Clyde JSR decodeSCRIPT * 6. Draw normal dot and its associated 10 points LDA #$74 STA zpX1 LDA #$78 STA zpY1 JSR drawNORMALDOT LDA #$7C STA zpX2 LDA #$00 STA zpX2+1 LDA #$75 STA zpY2 LDA #$01 JSR printDIGIT CLC LDA zpX2 ADC #$06 STA zpX2 LDA #$00 JSR printDIGIT LDA #$14 ; draw the Points sprite STA zpXCOL LDA #$75 STA zpY1 JSR welcomePOINTS * 7. Draw energizer dot and its associated 50 points LDA #$73 STA zpX1 LDA #$81 STA zpY1 JSR drawENERGIZERDOT LDA #$7C STA zpX2 LDA #$80 STA zpY2 LDA #$05 JSR printDIGIT CLC LDA zpX2 ADC #$06 STA zpX2 LDA #$00 JSR printDIGIT LDA #$14 ; draw the Points sprite STA zpXCOL LDA #$80 STA zpY1 JSR welcomePOINTS * 8. Draw the (c) 1983 sprite LDA #$0C STA zpXCOL LDA #$9A STA zpY1 LDA #$00 STA zpXBIT LDA #$05 STA zpSPRWIDTH LDA #$09 STA zpSPRHEIGHT LDA #sprC1983 STA L55B1+2 JSR drawCOLORSPRITE * 9. Print Pacman LDY zpTEMP4 JSR decodeSCRIPT * 10. Print Atari Inc. LDY zpTEMP4 JSR decodeSCRIPT * 11. Print Press Space bar LDY zpTEMP4 JSR decodeSCRIPT JMP L4689 *--- welcomeTAB LDA #$49 ; set X STA zpX1 LDA #$00 STA zpX1+1 RTS *--- welcomePOINTS LDA #$04 ; Draw the Points sprite STA zpSPRWIDTH LDA #$07 STA zpSPRHEIGHT LDA #sprPOINTS STA L55B1+2 LDA #$00 STA zpXBIT JMP drawCOLORSPRITE *--- Sprite for POINTS sprPOINTS HEX 0F002000 HEX 11102000 HEX 1100701C HEX 0F532302 HEX 4154241C HEX 41542420 HEX 0153441C *--- Sprites for the Welcome page sprC1983 HEX 7C40707138 HEX 0261080A45 HEX 3942080A41 HEX 0542080A41 HEX 0542707138 HEX 0542000941 HEX 3942400841 HEX 0241200845 HEX 7C70137038 sprFONT HEX 00000011111515150A ; 00 w HEX 00111111111E10110E ; 01 y HEX 001D2222221E020202 ; 02 p HEX 0C1221213F21212121 ; 03 A HEX 1E210101010101211E ; 04 C HEX 3F0101010F01010101 ; 05 F HEX 3F0C0C0C0C0C0C0C3F ; 06 I HEX 212121213F21212121 ; 07 H HEX 01010101010101013F ; 08 L HEX 232325252929293131 ; 09 N HEX 1F2121211F01010101 ; 0A P HEX 1F2121211F2121211F ; 0B B HEX 1E2101011E2020211E ; 0C S HEX 0000000E11101E112E ; 0D a HEX 0000001E010101011E ; 0E c HEX 101010101E1111113E ; 0F d HEX 0000001E211F01211E ; 10 e HEX 182404041F04040404 ; 11 f HEX 0101011D2321212121 ; 12 h HEX 000400040404040408 ; 13 i HEX 010101090503050911 ; 14 k HEX 020404040404040408 ; 15 l HEX 000000152A2A2A2A2A ; 16 m HEX 0000001D2222222222 ; 17 n HEX 0000001E212121211E ; 18 o HEX 0000001D2202020202 ; 19 r HEX 0000001E011E20211E ; 1A s HEX 0404041E0404040418 ; 1B t HEX 00000011121212122C ; 1C u HEX 000000003F00000000 ; 1D - HEX 004020100804020100 ; 1E / HEX 000000000000000606 ; 1F . ; 20 space character sprFONT2 HEX 01010101011F21211F ; 21 b *----------------------------------- * *----------------------------------- L467C JSR L7DB8 CLC SED LDA $68 ADC $68 STA $68 CLD RTS *----------------------------------- * ANIMATION ON THE WELCOME PAGE *----------------------------------- L4689 LDA #$70 STA zpDOTTEMPO LDA #$20 STA $59 LDA #$18 STA $80 LDA #$03 STA $62 LDA #$00 STA $66 STA $78 STA $79 LDA #$01 STA $81 STA zpDOTFLAG LDA #$8D STA $60 LDA #$68 STA $71 STA $61 LDA #$04 STA $E0 L46B5 JSR L8712 DEC $E0 BNE L46B5 LDA #$B1 STA $84 LDA #$C1 STA $98 LDA #$D1 STA $AC LDA #$E1 STA $C0 L46CC DEC $59 BNE L46EC JSR getINPUT LDA #$20 STA $59 JSR L7D80 JSR eraseSPRITE44 SEC LDA $60 SBC #$02 STA $60 JSR L7D80 INC $66 JSR L79A4 L46EC JSR L6CF3 LDA #$04 STA $E0 L46F3 JSR L86FC DEC $80 BNE L4711 LDA #$18 STA $80 JSR L7D8D JSR eraseSPRITE44 SEC LDA $70 SBC #$02 STA $70 JSR L7D8D JSR L88A2 L4711 JSR L8712 DEC $E0 BNE L46F3 DEC $5E BNE L4742 LDA #$60 STA zpDOTTEMPO LDA zpDOTFLAG BEQ L4733 LDA #$67 STA zpY1 LDA #$4B STA zpX1 JSR drawENERGIZERDOT LDA #$00 BEQ L4740 L4733 LDA #$66 STA zpY1 LDA #$4A STA zpX1 JSR L7819 LDA #$01 L4740 STA zpDOTFLAG L4742 LDA $60 CMP #$4F BCC L474B JMP L46CC L474B LDA #$01 STA $8C STA $A0 STA $B4 STA $C8 LDA #$FF STA $E2 LDA #$02 STA $68 STA $62 L475F DEC $59 BNE L477F JSR getINPUT LDA #$20 STA $59 JSR L7D80 JSR eraseSPRITE44 CLC LDA $60 ADC #$02 STA $60 JSR L7D80 INC $66 JSR L79A4 L477F JSR L6CF3 LDA #$04 STA $E0 L4786 JSR L86FC DEC $80 BNE L47C0 LDA #$40 STA $80 LDA $79 BNE L47C0 SEC LDA $70 SBC $60 CMP #$05 BCS L47AD JSR L467C LDA $68 CMP #$32 BEQ L47C9 LDA #$01 STA $79 BNE L47C0 L47AD JSR L7D8D JSR eraseSPRITE44 CLC LDA $70 ADC #$02 STA $70 JSR L7D8D JSR L88A2 L47C0 JSR L8712 DEC $E0 BNE L4786 BEQ L475F L47C9 LDA #L47DA STA zpPTR3 STY zpPTR3+1 LDA #$01 STA zpDEMO STA zpRANK JMP L5303 L47DA DB $03 DB $03 DB $03 DB $00 DB $03 DB $03 DB $00 DB $02 DB $02 DB $01 DB $02 DB $01 DB $03 DB $03 DB $01 DB $03 DB $03 DB $01 DB $01 DB $01 DB $01 DB $03 DB $00 DB $02 DB $00 DB $00 DB $02 DB $00 DB $02 DB $01 DB $02 DB $02 DB $00 DB $00 DB $02 DB $00 DB $02 DB $00 DB $02 DB $01 DB $02 DB $01 DB $02 DB $01 DB $02 DB $00 DB $03 DB $00 DB $03 DB $01 DB $03 DB $03 DB $03 DB $03 DB $03 DB $01 DB $01 DB $01 DB $03 DB $01 DB $02 DB $00 DB $00 DB $03 DB $03 DB $01 DB $00 DB $01 DB $00 DB $01 DB $00 *----------------------------------- * SELECT MONITOR TYPE *----------------------------------- selectMONITOR bit L48A6 ; LoGo JSR setTEXT2 ; set text mode JSR clearTEXT2 ; clear text screen LDA #$0A STA CV JSR gotoXY LDA #$00 STA CH LDX #$00 L4837 LDA L4886,X ; B&W OR COLOR MONITOR? JSR printCHAR INX CPX #$20 BNE L4837 L4842 JSR RDKEY CMP #"B" ; BLACK BCC L4842 CMP #"C"+1 ; COLOR BCS L4842 AND #$01 STA $1D ; ZP MONITOR JMP L48A6 *----------------------------------- * *----------------------------------- LDA CV JSR VTABZ JMP L485F *----------------------------------- * GOTO X/Y *----------------------------------- gotoXY JSR VTAB L485F LDA $29 AND #$03 ORA #$08 STA $29 RTS *----------------------------------- * CLER TEXT PAGE 2 *----------------------------------- clearTEXT2 LDA #$00 STA CV STA CH LDX #$04 LDY #$00 L4872 LDA #" " L4874 STA TEXT2,Y INY BNE L4874 INC L4874+2 DEX BNE L4872 LDA #>TEXT2 STA L4874+2 RTS L4886 ASC "BLACK & WHITE OR COLOR? (B / C) " *----------------------------------- * SELECT INPUT DEVICE *----------------------------------- L48A6 JSR setTEXT2 JSR clearTEXT2 LDA #$00 STA CH STA CV JSR gotoXY LDX #$00 L48B7 LDA L48D9,X ; KEYBOARD OR JOYSTICK BEQ L48C2 JSR printCHAR INX BNE L48B7 L48C2 JSR RDKEY CMP #$B1 BEQ L48D2 CMP #$B2 BNE L48C2 LDA #$01 ; ZP joystick STA zpDEVICE RTS L48D2 LDA #$00 ; ZP keyboard STA zpDEVICE JMP L492F L48D9 ASC " PACMAN CAN BE PLAYED WITH"8D8D ASC " 1. KEYBOARD"8D ASC " 2. APPLE JOYSTICK"8D8D8D8D ASC "CHOOSE A MODE (1 - 2) "00 *----------------------------------- * *----------------------------------- L492F JSR clearTEXT2 JSR setTEXT2 LDA #$00 STA CH STA CV JSR gotoXY LDX #$00 L4940 LDA L4A01,X JSR printCHAR INX CPX #$26 BCC L4940 JSR RDKEY CMP #$C3 BEQ L4955 JMP L4A00 L4955 JSR printCHAR LDA #$04 STA CV LDA #$00 STA CH JSR gotoXY LDX #$00 L4965 LDA L4A26,X JSR printCHAR INX CPX #$14 BCC L4965 LDA #$16 STA CH LDA #$06 STA CV JSR gotoXY LDX #$00 L497D LDA L4A3A,X JSR printCHAR INX CPX #$0C BCC L497D JSR RDKEY STA L6FB9+1 INC CV LDA #$16 STA CH JSR gotoXY LDX #$00 L4999 LDA L4A46,X JSR printCHAR INX CPX #$0C BCC L4999 L49A4 JSR RDKEY CMP L6FB9+1 BEQ L49A4 STA L6FB5+1 INC CV LDA #$16 STA CH JSR gotoXY LDX #$00 L49BA LDA L4A52,X JSR printCHAR INX CPX #$0C BCC L49BA L49C5 JSR RDKEY CMP L6FB9+1 BEQ L49C5 CMP L6FB5+1 BEQ L49C5 STA L6FB1+1 INC CV LDA #$16 STA CH JSR gotoXY LDX #$00 L49E0 LDA L4A5E,X JSR printCHAR INX CPX #$0C BCC L49E0 L49EB JSR RDKEY CMP L6FB9+1 BEQ L49EB CMP L6FB5+1 BEQ L49EB CMP L6FB1+1 BEQ L49EB STA L6FBD+1 L4A00 RTS L4A01 ASC "NORMAL OR CUSTOMIZED KEYBOARD (N/C)? " L4A26 ASC " PRESS KEY USED TO" L4A3A ASC "MOVE LEFT " L4A46 ASC "MOVE RIGHT " L4A52 ASC "MOVE UP " L4A5E ASC "MOVE DOWN " *----------------------------------- * OUTPUT CHARACTER *----------------------------------- printCHAR CMP #$8D BNE L4A77 INC CV LDA #$00 STA CH JMP gotoXY L4A77 JMP COUT1 *----------------------------------- * PACMAN LOGO *----------------------------------- * +0 goes to $0C: X start * +1 goes to $0E: X end * +2 goes to $10: Y theLOGO HEX FFFFFE01410101450301450501470701 HEX 4909014B0B014D0D014F0F014F110151 HEX 13015115015317012419012B11295319 HEX 01211B2B531B01201F011F1D2D531D2D HEX 531F0121212B5321012323295323FFFF HEX FE01532501532701532901512B01512D HEX 014F2F014F31014D3301493501453701 HEX 4339012B3B012B3D012B3F012B41012B HEX 43012B45012B47012B49012B49012B4B HEX 012B4D012B4F012B51012B53012B55FF HEX FFFF014302014504014706014908014B HEX 0A014B0C014D0E014F10014F12015114 HEX 01511601511801221A2B531A011F1C2D HEX 531C01201E2D53202D531E0120200121 HEX 222B5322012424255324015326015328 HEX 01512C01512A014F30014F2E014D3201 HEX 4934014536014338014338012B3A012B HEX 3C012B3E012B3E012B40012B42012B44 HEX 012B46012B48012B4A012B4E012B4C01 HEX 2B50012B52012B54FFFFFFFFFFFFFFFF HEX FE737301737303737305717507717509 HEX 6F770B6F770D6D790F6D7911697D176B HEX 7B136B7B15677F1B697D19677F1F677F HEX 1D658123658121638325637127718327 HEX 616F29778529616D2B79852B5F6B2D7B HEX 872D5F6B2F7B872F5D6D317989317789 HEX 335D6F335B8B355B8B37598D39598D3B HEX 598D3D578F3F578F4155914355914553 HEX 934753934951954B51954D4F974F4F97 HEX 514D99534D9955FFFFFF737302737304 HEX 73730671750871750A71750A6F770C6F HEX 770E6F770E6D79106D79126B7B146B7B HEX 146B7B16697D18697D1A677F1C677F1E HEX 658120658122638324638326616F2875 HEX 8528616D2A77852A5F6B2C79872C5F6B HEX 2E7B872E5F6B307B87305D6D325D7134 HEX 5B8B365B8B36598D3A5B8B38598D3C59 HEX 8D3E578F40758934798932578F425591 HEX 4455914653934853934A51954C51954E HEX 4F97504F97524D9954FFFFFEC1D501BB HEX DB03B7DF05B5E107B1E509AFE70BADE9 HEX 0DABEB11ABEB0FA9ED13A7EF17A7EF15 HEX A5EB19A3E71BA3E31DA3DF1FA1DB21A1 HEX D723A1CF27A1CF27A1D325A1CB29A1C9 HEX 2BA1CD2DA1D12FA1D531A1D933A1DB35 HEX A3E137A3E73BA3E339A7EF3FA7EB3DA9 HEX ED43A7EF41ADEB49ABEB47ABEB45AFE7 HEX 4BB1E54DB5E14FC1D555BBDB53B7DF51 HEX FFFFFFBDD902B9DD04B5E106B3E308B1 HEX E50AAFE70C0D490EA7EF16ADE90EABEB HEX 10A9ED12A9ED14BDD954B9DD52B5E150 HEX B3E34EB1E54CAFE74AADE948ABEB46A9 HEX ED44A9ED42A7EF40A7EF40A5ED3EA5E9 HEX 3CA3E53AA3E138A1DD36A1D934A1CF2E HEX A1D330A1D732A1C92AA1CB2CA1D922A1 HEX D126A1CD28A1DD20A1D524A3E51CA3E1 HEX 1EA5E91AA5ED18FFFFFE01010101016A HEX 01036C01056E010770010972010B7401 HEX 0D76010F7801117A01137C01157E0117 HEX 80011982011B84011D86011F8801218A HEX 01238C01258E01279001299201559401 HEX 559601559801559A01559C0155A00155 HEX A20155A40155A60155A80155AA0155A0 HEX 0155A20155A401559E2D55922F559031 HEX 558E33558C35558A3755883955863B55 HEX 843D55823F558041567E43557C45557A HEX 4755784955764B55744D55724F557051 HEX 556E53556C55556AFFFFFF01016B0103 HEX 6D01056F010771010973010B75010D77 HEX 010F7901117B01137D01157F01178101 HEX 1983011B8501218B011F89011D870123 HEX 8D01258F012791015593015595015597 HEX 01559901559B01559D01559F0155A101 HEX 55A30155A50155A70155A92F558F2D55 HEX 9131558D33558B355589375587395585 HEX 3B55833D55813F557F41557D43557B45 HEX 55794755774955754B55734D55714F55 HEX 6F51556D53556B0155BD0155BB0155B9 HEX 0155B70155B50155B30155B10155AF01 HEX 55AD0155ABFFFFFE0155BE0155BC0155 HEX BA0155B80155B60155B40155B20155B0 HEX 0155AE0155ACFFFFFE81816A81816C81 HEX 816E7F83707F83727D85767D85747B87 HEX 787B877A79897C79897E778B80778B82 HEX 758D84758D86758D88758D86738F8A73 HEX 8F8C71918E717F908391906F7D928593 HEX 926F7B948793946D79968995966D7998 HEX 8995986B7B9A87979A6B7D9C85979C81 HEX 819069999E6999A0679BA6679BA4679B HEX A2659DA8659DAA639FAC639FAE61A1B0 HEX 61A1B25FA3B65FA3B45DA5B85DA5BA5B HEX A7BE5DA7BCFFFFFF81816B81816D8181 HEX 6F7F83717F83737D85757D85777B8779 HEX 7B877B79897D79897F778B81778B8375 HEX 8D85758D87738F89738F8B71918D7191 HEX 8F6F7D918391916F7B938591936D7995 HEX 8793956D79978995976B7B9B6D799989 HEX 959987979B6B7F9D83979D69999F7F7F HEX 915BA7BD5DA5BB5DA5B95FA3B55FA3B7 HEX 639FAD639FAF61A1B361A1B1659DAB65 HEX 9DA9679BA7679BA36999A1679BA5FFFF HEX FEABAB69ABAF6BABB16DABB36FABB771 HEX ABB973ABBB75ABBD77ABC179ABC37BAB HEX C57DABC97FABCB81ABCD83ABD185ABD3 HEX 87ABD589ABD98BABDB8DABDD8FABE191 HEX ABFF93ABFF95ABFF97ABFF99ABFF9DAB HEX FF9BABFF9FABFFA1ABFFA3ABFFA5ABFF HEX A9ABFFA7ABFFABABFFADABFFAFABFFB1 HEX ABFFB3ABFFB5ABFFB7ABFFB9ABFFBBAB HEX FFBDE3FF69E3FF6BE3FF6DE3FF6FE3FF HEX 71E3FF73E3FF77E3FF75E3FF79E3FF7B HEX E3FF7DE3FF7FE3FF81E3FF83E3FF85E3 HEX FF89E3FF87E3FF8BE3FF8DE3FF8FE3FF HEX 91FFFFFEFFFFFE0B0101FFFFFFABAD6A HEX ABAF6CABB36EABB570ABB772ABB974AB HEX BD76ABBF78ABC17AABC57CABC77EABC9 HEX 80ABCD82ABCF84ABD186ABD588ABD78A HEX ABD98CABDD8EABDF90ABE192ABFF94AB HEX FF96ABFF98ABFF9AABFF9CABFF9EABFF HEX A0ABFFA2ABFFA4ABFFA6ABFFA8ABFFAA HEX ABFFACABFFAEABFFB0ABFFB2ABFFB4AB HEX FFB6ABFFB8ABFFBAABFFBCABFFBEE3FF HEX 6AE3FF6CE3FF6EE3FF70E3FF72E3FF74 HEX E3FF76E3FF78E3FF7AE3FF7CE3FF7EE3 HEX FF80E3FF82E3FF84E3FF86E3FF88E3FF HEX 8AE3FF8CE3FF8EE3FF92E3FF90FDFDFD ASC 'THIS W' *----------------------------------- * DECODE LOGO *----------------------------------- decodeLOGO STA zpPTR2 STY zpPTR2+1 LDA zpMONITOR ; save monitor type PHA LDA #$01 ; force color STA zpMONITOR LDA #$00 STA $1E ; no high-bit STA zpX1+1 STA zpX2+1 L5273 LDY #$00 LDA (zpPTR2),Y STA zpX1 INY LDA (zpPTR2),Y STA zpX2 INY LDA (zpPTR2),Y ; line STA zpY1 CMP #$FD ; exit BEQ L52A7 CMP #$FE ; reset high-bit BEQ L52AD CMP #$FF ; set high-bit BEQ L52B4 JSR drawHLINE LDA KBD CMP #" " BEQ L52A7 L5299 CLC ; ptr +=3 LDA zpPTR2 ADC #$03 STA zpPTR2 BCC L52A4 INC zpPTR2+1 L52A4 JMP L5273 L52A7 PLA ; restore monitor type STA zpMONITOR JMP getINPUT ; exit L52AD LDA #$00 ; reset high-bit STA $1E JMP L5299 L52B4 LDA #$80 ; set high-bit STA $1E JMP L5299 *----------------------------------- * SHOW TITLE SCREEN *----------------------------------- showTITLESCREEN LDA TXTCLR ; set GR MODE PAGE 2 LDA LORES LDA MIXCLR LDA TXTPAGE2 LDA #$DD ; make it yellow LDY #$00 L52CB STA TEXT2,Y STA TEXT2+$100,Y STA TEXT2+$200,Y STA TEXT2+$300,Y INY BNE L52CB JSR clearHGR LDA #theLOGO JSR decodeLOGO JSR setHGR LDY #$0A L52E9 LDX #$FA JSR doWAIT2 LDA KBD CMP #" " BEQ L52F9 DEY BPL L52E9 RTS L52F9 JMP getINPUT *----------------------------------- * *----------------------------------- L52FC JSR L54D4 LDA #$00 STA zpFGMUSIC L5303 JSR L531E L5306 JSR prepareLEVEL JSR getREADY JSR L53E6 L530F JSR L7861 JSR L86EA JSR L6A7C JSR blinkTHINGS JMP L530F L531E LDA #$01 STA $59 JSR setDEFAULTBOARD LDA #nbDOTS STA zpNBDOTS LDA #$40 STA $57 JSR savePLAYERDATA RTS *----------------------------------- * SET DEFAULT BOARD *----------------------------------- setDEFAULTBOARD LDA #dftBOARD STA zpPTR1+1 LDA #theBOARD STA zpPTR2+1 LDY #$00 L5343 LDA (zpPTR1),Y STA (zpPTR2),Y INC zpPTR2 BNE L534D INC zpPTR2+1 L534D INC zpPTR1 BNE L5353 INC zpPTR1+1 L5353 LDA zpPTR2+1 CMP #>dftBOARD BNE L5343 LDA zpPTR2 CMP #theBOARD CLC ADC #$03 STA zpPTR2+1 *----------------------------------- * COPY FROM/TO BOARD BUFFER *----------------------------------- L537C LDX #$03 ; $copy $380 bytes of buffer data LDY #$7F ; this is a player's board L5380 LDA (zpPTR1),Y STA (zpPTR2),Y DEY BNE L5380 LDA (zpPTR1),Y STA (zpPTR2),Y DEY DEC zpPTR2+1 DEC zpPTR1+1 DEX BPL L5380 RTS *----------------------------------- * SAVE PLAYER BOARD *----------------------------------- savePLAYERBOARD LDA zpCURPLAYER ASL TAX LDA L53B2,X STA zpPTR2 LDA L53B2+1,X CLC ADC #$03 STA zpPTR2+1 LDA #theBOARD CLC ADC #$03 STA zpPTR1+1 BNE L537C L53B2 DA $0666 ; board buffers ($380) per player DA L0C00 DA L1000 DA L1380 DA L1700 DA L1A80 *----------------------------------- * SAVE PLAYER DATA *----------------------------------- savePLAYERDATA LDX zpCURPLAYER LDY L53E0,X LDX #$07 L53C5 LDA zpCURSCORE,X STA L0300,Y DEY DEX BPL L53C5 RTS *----------------------------------- * LOAD PLAYER DATA *----------------------------------- loadPLAYERDATA LDX zpCURPLAYER LDY L53E0,X LDX #$07 L53D6 LDA L0300,Y STA zpCURSCORE,X DEY DEX BPL L53D6 RTS L53E0 DB $00 ; offset of player data DB $07 DB $0F DB $17 DB $1F DB $27 *----------------------------------- * *----------------------------------- L53E6 JSR showPACMAN LDX #$0D L53EB LDA L5446,X STA $60,X DEX BPL L53EB LDY #$53 L53F5 LDA L5454,Y STA |$0084,Y DEY BPL L53F5 LDA #$00 LDY #$06 L5402 STA |$0059,Y DEY BPL L5402 JSR L6E79 JSR loadPLAYERDATA LDA #$01 STA $E9 LDA #$A0 STA $EA LDA #$00 STA $EB STA $E4 STA $E7 STA $1F JSR getMAXRANK15 TAX LDY #$12 LDA L54A4,X STA |$0098,Y LDA L54B4,X STA |$00AC,Y LDA L54C4,X STA |$00C0,Y LDY #$03 L543A LDX #$FF JSR doWAIT2 DEY BPL L543A JSR getINPUT RTS L5446 DB $8B DB $8F DB $03 DB $03 DB $2C DB $2D DB $00 DB $00 DB $02 DB $00 DB $0D DB $17 DB $02 DB $00 L5454 DB $8B DB $47 DB $03 DB $17 DB $18 DB $00 DB $08 DB $FF DB $00 DB $00 DB $00 DB $0D DB $0B DB $02 DB $00 DB $01 DB $01 DB $00 DB $00 DB $00 DB $7F DB $5D DB $01 DB $17 DB $18 DB $00 DB $09 DB $FF DB $00 DB $00 DB $00 DB $0D DB $0B DB $02 DB $00 DB $02 DB $01 DB $01 DB $80 DB $00 DB $8B DB $55 DB $00 DB $17 DB $18 DB $00 DB $0A DB $FF DB $00 DB $00 DB $00 DB $0D DB $0B DB $02 DB $00 DB $03 DB $01 DB $01 DB $40 DB $00 DB $99 DB $5D DB $01 DB $17 DB $18 DB $00 DB $0B DB $FF DB $00 DB $00 DB $00 DB $0D DB $0B DB $02 DB $00 DB $04 DB $01 DB $01 DB $A0 DB $00 L54A4 DB $00 DB $70 DB $50 DB $30 DB $30 DB $14 DB $14 DB $10 DB $10 DB $0E DB $0E DB $10 DB $10 DB $08 DB $08 DB $08 L54B4 DB $00 DB $30 DB $28 DB $20 DB $20 DB $10 DB $10 DB $08 DB $08 DB $05 DB $05 DB $08 DB $08 DB $08 DB $04 DB $04 L54C4 DB $00 DB $90 DB $70 DB $40 DB $40 DB $18 DB $18 DB $14 DB $14 DB $12 DB $12 DB $10 DB $12 DB $04 DB $0A DB $09 *----------------------------------- * *----------------------------------- L54D4 LDA #$00 STA zpCURSCORE STA zpCURSCORE+1 STA zpCURSCORE+2 STA zpDEMO STA $F3 L54E0 LDA #$01 ; ZP - RANK STA zpRANK LDA #$01 STA $59 LDA #$83 ; 3 lives! STA zpNBLIVES LDA #nbDOTS STA zpNBDOTS LDA #$40 STA $57 LDA zpNBPLAYERS STA zpCURPLAYER JSR setDEFAULTBOARD L54FB JSR savePLAYERDATA JSR savePLAYERBOARD DEC zpCURPLAYER BNE L54FB LDA #$01 STA zpCURPLAYER RTS *----------------------------------- * DRAW ALL SCORES *----------------------------------- drawSCORES LDA zpNBPLAYERS ; get nb players STA zpCURPLAYER ; make it current L550E LDA zpCURPLAYER ASL ASL ASL ; *8 TAX LDA L55C7+5,X STA zpTEMP4 LDA L55C7+6,X STA zpTEMP3 JSR L556E LDA #$00 STA zpX1+1 STA zpX2+1 LDA zpTEMP4 STA zpX1 CLC ADC #$31 STA zpX2 BCC L5534 INC zpX2+1 L5534 JSR L5CF6 LDA zpCURPLAYER BEQ L553E JSR loadPLAYERDATA L553E JSR L70CC DEC zpCURPLAYER ; next player BMI L5563 BEQ L554A JMP L550E L554A LDA #sprHISCORE STA L5596+1 LDA zpHISCORE STA zpCURSCORE LDA zpHISCORE+1 STA zpCURSCORE+1 LDA zpHISCORE+2 STA zpCURSCORE+2 JMP L550E L5563 LDA #sprPLAYER STA L5596+1 RTS L556E LDA L55C7,X ; X on screen STA zpXCOL LDA L55C7+1,X ; Y on screen STA zpY1 LDA L55C7+2,X ; X2 STA zpX2 LDA L55C7+3,X STA zpX2+1 LDA L55C7+4,X ; Y2 STA zpY2 LDA #$00 STA zpXBIT LDA #$07 ; 7w and 7h STA zpSPRHEIGHT STA zpSPRWIDTH L5591 LDA #sprPLAYER STA L55B1+2 JSR drawCOLORSPRITE LDA zpCURPLAYER ; skip if player 0 BEQ L55A5 JSR printDIGIT L55A5 RTS *----------------------------------- * DRAW A SPRITE IN COLOR *----------------------------------- drawCOLORSPRITE JSR setHGRADDRESS LDX zpXBIT LDY zpXCOL LDA zpSPRWIDTH ; number of bytes per line to output STA zpTEMP2 L55B1 LDA $0666,X ORA (zpHGR),Y STA (zpHGR),Y INX INY DEC zpTEMP2 BNE L55B1 STX zpXBIT ; next X bit INC zpY1 ; next Y DEC zpSPRHEIGHT ; data-- BNE drawCOLORSPRITE RTS *--- Structure (7-bytes) to display PLAYER X data L55C7 HEX 00,54,2F,00,54,04,5C,00 ; High score HEX 00,06,2F,00,06,04,0E,00 ; P1 HEX 20,06,0F,01,06,E4,0E,00 ; P2 HEX 00,29,2F,00,29,04,31,00 ; P3 HEX 20,29,0F,01,29,E4,31,00 ; P4 HEX 20,54,0F,01,54,E4,5C,00 ; P5 * PLAYER sprite (7*7) sprPLAYER HEX 700910225F070A HEX 100A282241080A HEX 100A441441081F HEX 70097C085F070A HEX 1008440841021F HEX 1008440841040A HEX 107845085F080A * HISCORE sprite (7*7) sprHISCORE HEX 307B7978383E38 HEX 102A8D44444422 HEX 10220402044502 HEX 70227802043D1E HEX 10224002041502 HEX 102A4544442422 HEX 307B7C78384638 *----------------------------------- * PREPARE THE COMPLETE LEVEL *----------------------------------- prepareLEVEL JSR clearHGR STA KBDSTROBE JSR setHGR JSR drawGAMEBOARD JSR drawGHOSTDOOR LDA zpCURPLAYER ; save current player index STA $F1 JSR loadPLAYERDATA JSR drawDOTS JSR drawSCORES LDA $F1 ; restore current player index STA zpCURPLAYER JSR loadPLAYERDATA JSR printRANK JSR printNBLIVES LDA zpDEMO BNE L5691 LDA zpFGMUSIC ; did we already play the intro music? BNE L5691 JSR playINTROMUSIC LDA #$01 STA zpFGMUSIC L5691 RTS *----------------------------------- * PRINT RANK (LEVEL) *----------------------------------- printRANK JMP showFRUITEDRANK ; LoGo LDA #$E1 ; display the rank number, aka the level STA zpX2 ; it was replaced on the released game LDA #$00 ; by the equivalent fruit! STA zpX2+1 LDA #$B0 STA zpY2 LDA zpRANK JSR L56C3 STA $19 AND #$F0 BEQ L56B3 ROR ROR ROR ROR JSR printDIGIT L56B3 LDA #$E7 STA zpX2 LDA #$B0 STA zpY2 LDA $19 AND #$0F JSR printDIGIT RTS L56C3 TAX ; from hex to dec LDA #$00 SED CLC L56C8 ADC #$01 DEX BNE L56C8 CLD RTS *----------------------------------- * PRINT NB LIVES *----------------------------------- printNBLIVES LDA zpNBLIVES ; Show 2 Pacman if we have 3 lives AND #$7F STA $19 ; save nb lives LDA zpDEMO BNE L56FC ; if demo, skip LDA #$09 ; set coordinates STA zpX2 LDA #$00 STA zpX1+1 LDA #$B2 STA zpY2 LDA $19 ; do we have lives? BNE L56EA RTS ; no L56EA DEC $19 ; yes BEQ L56FC L56EE JSR L56FD ; print Pacman CLC ; next one LDA zpX2 ADC #$0C STA zpX2 DEC $19 BNE L56EE L56FC RTS L56FD LDA zpX2 ; draw Pacman sprite STA zpX1 LDA zpY2 STA zpY1 LDA #L9CB8 JMP L6A20 *----------------------------------- * BLINK THINGS! *----------------------------------- blinkTHINGS JSR blinkPLAYERNAME LDA zpDOTTEMPO ; blink dots BEQ L5716 DEC zpDOTTEMPO RTS L5716 JSR getMAXRANK15 TAX LDA L5733,X STA zpDOTTEMPO LDA zpDOTFLAG BEQ L572B JSR hideENERGIZERS LDA #$00 STA zpDOTFLAG RTS L572B JSR showENERGIZERS LDA #$01 STA zpDOTFLAG RTS L5733 DB $50 ; Tempo table DB $50 DB $50 DB $50 DB $50 DB $50 DB $50 DB $50 DB $50 DB $50 DB $50 DB $50 DB $50 DB $50 DB $50 DB $50 *----------------------------------- * HIDE ENERGIZERS *----------------------------------- hideENERGIZERS LDA #$00 ; fixed address STA zpX1+1 LDA #>theBOARD ; go to dot 1 STA zpPTR2+1 CLC LDA #theBOARD ADC #$03 STA zpPTR2+1 LDY #$00 LDA (zpPTR2),Y BEQ L57A1 LDA #$D6 STA zpX1 LDA #$15 STA zpY1 JSR L7819 L57A1 CLC ; go to dot 4 LDA zpPTR2 ADC #$14 STA zpPTR2 BCC L57AC INC zpPTR2+1 L57AC LDY #$00 LDA (zpPTR2),Y BEQ L57BD LDA #$D6 STA zpX1 LDA #$8D STA zpY1 JSR L7819 L57BD RTS *----------------------------------- * DRAW ENERGIZERS *----------------------------------- showENERGIZERS LDA #$00 ; same process as above STA zpX1+1 ; but routine draws an energizer dot LDA #>theBOARD STA zpPTR2+1 CLC LDA #theBOARD ADC #$03 STA zpPTR2+1 LDY #$00 LDA (zpPTR2),Y BEQ L581C LDA #$D6 STA zpX1 LDA #$16 STA zpY1 JSR drawENERGIZERDOT L581C CLC LDA zpPTR2 ADC #$14 STA zpPTR2 BCC L5827 INC zpPTR2+1 L5827 LDY #$00 LDA (zpPTR2),Y BEQ L5838 LDA #$D6 STA zpX1 LDA #$8E STA zpY1 JSR drawENERGIZERDOT L5838 RTS *----------------------------------- * SHOW PACMAN (at its initial pos) *----------------------------------- showPACMAN LDA #$8B ; draw Pacman at its initial position STA zpX1 LDA #$8F STA zpY1 LDA #$00 STA zpX1+1 LDA #$00 STA $1E LDA #sprPACMAN0 ; fully closed JMP L6A20 *----------------------------------- * GET READY!! *----------------------------------- getREADY JSR showPACMAN LDA zpDEMO ; are we playing? BEQ L585A JMP showGAMEOVER ; no, demo L585A LDA #$68 ; yes... STA zpY1 LDA #$00 STA zpXBIT LDA #$05 STA zpSPRWIDTH LDA #$07 STA zpSPRHEIGHT LDA #$11 STA zpXCOL LDA #sprREADY STA L55B1+2 JSR drawCOLORSPRITE LDY #$08 L587D LDX #$FF JSR doWAIT2 DEY BNE L587D LDA #$10 ; and now, erase the sprite STA zpXCOL LDA #$66 STA zpY1 JMP eraseBLOCK * Ready! sprite sprREADY HEX 787C0C0F49 HEX 0805125148 HEX 4402524824 HEX 3C1E4F0823 HEX 0641280411 HEX 4A40144200 HEX 312F742104 *----------------------------------- * BLINK PLAYER NAME *----------------------------------- blinkPLAYERNAME LDA $59 CMP #$01 BNE L58C6 LDA zpDEMO BEQ L58C0 JSR showGAMEOVER L58C0 LDA $E5 BEQ L58C7 DEC $E5 L58C6 RTS *----------------------------------- * *----------------------------------- L58C7 JSR getMAXRANK15 TAX LDA L5903,X STA $E5 LDA $E6 BEQ L58DF JSR erasePLAYER LDA #$00 STA $E6 CLC ROR $E5 RTS L58DF JSR L58FA LDA #$01 STA $E6 RTS *----------------------------------- * ERASE PLAYER# ON SCREEN (BLINK) *----------------------------------- erasePLAYER LDA zpCURPLAYER ; get player index ASL TAX LDA L6992,X ; get X STA zpXCOL LDA L6992+1,X ; and Y SBC #$0E ; - 14 STA zpY1 JMP eraseBLOCK ; erase PLAYER# sprite *----------------------------------- * *----------------------------------- L58FA LDA zpCURPLAYER ASL ASL ASL ; *8 TAX JMP L556E L5903 DB $08 DB $08 DB $08 DB $08 DB $08 DB $08 DB $08 DB $08 DB $08 DB $08 DB $08 DB $08 DB $08 DB $08 DB $08 DB $08 *----------------------------------- * DRAW A DOT ON SCREEN *----------------------------------- drawDOT LDA L5925,X ORA (zpHGR),Y STA (zpHGR),Y RTS LDA L592C,X AND (zpHGR),Y ORA $1E STA (zpHGR),Y RTS L5925 DB $01 DB $02 DB $04 DB $08 DB $10 DB $20 DB $40 L592C DB $FE DB $FD DB $FB DB $F7 DB $EF DB $DF DB $BF *----------------------------------- * CALCULATE HGR X-COORDS *----------------------------------- calcXYHGR LDA zpX1+1 ; address in board? BEQ L594B ; yup CLC ; no, after LDA zpX1 ADC #$04 TAX CLC LDA L5A58,X ADC #$24 STA zpXCOL ; to the right of the board LDA L5958,X STA zpXBIT ; the x-sprite offset RTS L594B LDX zpX1 ; from x-coord LDA L5A58,X STA zpXCOL ; to x-screen LDA L5958,X STA zpXBIT ; and x-sprite offset RTS *--- X-coord to Y-byte L5958 HEX 00010203040506000102030405060001 HEX 02030405060001020304050600010203 HEX 04050600010203040506000102030405 HEX 06000102030405060001020304050600 HEX 01020304050600010203040506000102 HEX 03040506000102030405060001020304 HEX 05060001020304050600010203040506 HEX 00010203040506000102030405060001 HEX 02030405060001020304050600010203 HEX 04050600010203040506000102030405 HEX 06000102030405060001020304050600 HEX 01020304050600010203040506000102 HEX 03040506000102030405060001020304 HEX 05060001020304050600010203040506 HEX 00010203040506000102030405060001 HEX 02030405060001020304050600010203 *--- X-coord to Y-col L5A58 HEX 00000000000000010101010101010202 HEX 02020202020303030303030304040404 HEX 04040405050505050505060606060606 HEX 06070707070707070808080808080809 HEX 0909090909090A0A0A0A0A0A0A0B0B0B HEX 0B0B0B0B0C0C0C0C0C0C0C0D0D0D0D0D HEX 0D0D0E0E0E0E0E0E0E0F0F0F0F0F0F0F HEX 10101010101010111111111111111212 HEX 12121212121313131313131314141414 HEX 14141415151515151515161616161616 HEX 16171717171717171818181818181819 HEX 1919191919191A1A1A1A1A1A1A1B1B1B HEX 1B1B1B1B1C1C1C1C1C1C1C1D1D1D1D1D HEX 1D1D1E1E1E1E1E1E1E1F1F1F1F1F1F1F HEX 20202020202020212121212121212222 HEX 22222222222323232323232324242424 *----------------------------------- * SET HGR ADDRESS *----------------------------------- setHGRADDRESS LDX zpY1 LDA L5B67,X STA zpHGR LDA L5C27,X ORA #>HGR STA zpHGR+1 RTS *--- The HGR tables L5B67 HEX 00000000000000008080808080808080 HEX 00000000000000008080808080808080 HEX 00000000000000008080808080808080 HEX 00000000000000008080808080808080 HEX 2828282828282828A8A8A8A8A8A8A8A8 HEX 2828282828282828A8A8A8A8A8A8A8A8 HEX 2828282828282828A8A8A8A8A8A8A8A8 HEX 2828282828282828A8A8A8A8A8A8A8A8 HEX 5050505050505050D0D0D0D0D0D0D0D0 HEX 5050505050505050D0D0D0D0D0D0D0D0 HEX 5050505050505050D0D0D0D0D0D0D0D0 HEX 5050505050505050D0D0D0D0D0D0D0D0 L5C27 HEX 0004080C1014181C0004080C1014181C HEX 0105090D1115191D0105090D1115191D HEX 02060A0E12161A1E02060A0E12161A1E HEX 03070B0F13171B1F03070B0F13171B1F HEX 0004080C1014181C0004080C1014181C HEX 0105090D1115191D0105090D1115191D HEX 02060A0E12161A1E02060A0E12161A1E HEX 03070B0F13171B1F03070B0F13171B1F HEX 0004080C1014181C0004080C1014181C HEX 0105090D1115191D0105090D1115191D HEX 02060A0E12161A1E02060A0E12161A1E HEX 03070B0F13171B1F03070B0F13171B1F *----------------------------------- * GET NEXT X BIT (0..7) *----------------------------------- getNEXTXBIT INX ; next X-bit CPX #$07 BCC L5CEF LDX #$00 ; loop done INY ; next Y-coord L5CEF RTS *----------------------------------- * DRAW LINE *----------------------------------- drawHLINE LDA #$00 STA zpX1+1 STA zpX2+1 L5CF6 JSR setHGRADDRESS JSR calcXYHGR LDX zpXBIT LDY zpXCOL L5D00 JSR drawDOT LDA (zpHGR),Y AND #$7F ORA $1E STA (zpHGR),Y LDA zpMONITOR BEQ L5D31 JSR getNEXTXBIT JSR getNEXTXBIT CLC LDA zpX1 ADC #$02 STA zpX1 BCC L5D20 INC zpX1+1 L5D20 LDA zpX1+1 ; end of X? CMP zpX2+1 BCC L5D00 BEQ L5D2A BCS L5D30 L5D2A LDA zpX2 CMP zpX1 BCS L5D00 L5D30 RTS ; yes! L5D31 JSR getNEXTXBIT INC zpX1 BNE L5D20 INC zpX1+1 JMP L5D20 *----------------------------------- * DRAW A VERTICAL LINE *----------------------------------- drawVLINE JSR calcXYHGR L5D40 JSR setHGRADDRESS LDX zpXBIT LDY zpXCOL JSR drawDOT INC zpY1 ; next Y LDA zpY2 ; Y-end reached? CMP zpY1 BCS L5D40 ; no, loop RTS ; yes, exit *----------------------------------- * DRAW GAME BOARD *----------------------------------- drawGAMEBOARD LDA #$80 STA $1E LDA zpMONITOR BEQ L5D66 LDA #boardBW STA zpPTR2+1 JMP L5D6E L5D66 LDA #boardCOLOR STA zpPTR2+1 L5D6E LDA #$00 STA zpX1+1 LDA #$48 ; $48 entries for horizontal line STA zpTEMP1 L5D76 LDY #$00 LDA (zpPTR2),Y STA zpX1 ; x from INY LDA (zpPTR2),Y STA zpX2 ; x to INY LDA (zpPTR2),Y STA zpY1 ; y JSR drawHLINE CLC LDA #$03 ADC zpPTR2 STA zpPTR2 BCC L5D94 INC zpPTR2+1 L5D94 DEC zpTEMP1 BNE L5D76 LDA #$46 ; $46 entries for vertical line STA zpTEMP1 L5D9C LDY #$00 LDA (zpPTR2),Y STA zpX1 INY LDA (zpPTR2),Y STA zpY1 INY LDA (zpPTR2),Y STA zpY2 JSR drawVLINE CLC LDA zpPTR2 ADC #$03 STA zpPTR2 BCC L5DBA INC zpPTR2+1 L5DBA DEC zpTEMP1 BNE L5D9C RTS *--- The board in color boardCOLOR HEX 3C89058B8E1D90DD05C1DD3CC1E153C1 HEX E160C1DD77D3DD96D3DD9B3CDDBA3C46 HEX 9B3C46963C58773958603958533C583C HEX 49581249581D677C12677C1D9DB2129D HEX B21DC1D012C1D01D49582A49582FC1D0 HEX 2AC1D02F79A04E79A065676A60686A77 HEX AFB260AFB277677C84677C899DB2849D HEX B28949588455589B495389C1D084C6D0 HEX 89C1C49B676A2A6C7C3C6C7C41676A53 HEX 79A02A90A02F8B8E4179892FAFB22AAF HEX B2539DAD419DAD3C79A07290A0778B8E HEX 89798977676A966C7CA8497CAD4965A8 HEX 79A09690A09B8B8EAD79899BAFB296B4 HEX D0A89DD0AD9DADA88A061C8F061CDE06 HEX 3BC03D52C06176DE7895D2979ADE9CB9 HEX 3B9CB947979A3B7895596176593D523B HEX 063B59131C48131C7D131C66131CB313 HEX 1C9C131CD1131CC0131C592B2E482B2E HEX D12B2EC02B2EA14F64784F646B617666 HEX 6176B36176AE61767D8588668588B385 HEX 889C858859859A548A9A488588D18588 HEX C58A9AC0859A6B2B3B7D3D406B425266 HEX 2B52A12B2E8F30408A3040782B2EB32B HEX 52AE42529C3D40AE2B3BA173768F7888 HEX 8A78887873766B97A77DA9AC48A9AC66 HEX 97A7A1979A8F9CAC8A9CAC78979AB397 HEX A7D1A9AC9CA9ACAE97A7 *--- The board in black & white boardBW HEX 3C88058C8E1D90DC05C2DC3CC2E253C2 HEX E260C2DC77D4DC96D4DC9B3CDCBA3C44 HEX 9B3C44963C56773856603856533C563C HEX 4A56124A561D687A12687A1D9EB0129E HEX B01DC2CE12C2CE1D4A562A4A562FC2CE HEX 2AC2CE2F7A9E4E7A9E65686A60686A77 HEX B0B260B0B277687A84687A899EB0849E HEX B0894A568456589B4A5289C2CE84C8CE HEX 89C2C49B686A2A6C7A3C6C7A41686A53 HEX 7A9E2A909E2F8C8E417A882FB0B22AB0 HEX B2539EAC419EAC3C7A9E72909E778C8E HEX 897A8877686A966C7AA84A7AAD4A64A8 HEX 7A9E96909E9B8C8EAD7A889BB0B296B4 HEX CEA89ECEAD9EACA88A061C8E061CDE06 HEX 3BC03D52C06176DE7895D2979ADE9CB9 HEX 3A9CB946979A3A7895586176583D523A HEX 063B58131C48131C7C131C66131CB213 HEX 1C9C131CD0131CC0131C582B2E482B2E HEX D02B2EC02B2EA04F64784F646A617666 HEX 6176B26176AE61767C8588668588B285 HEX 889C858858859A548A9A488588D08588 HEX C48A9AC0859A6A2B3B7C3D406A425266 HEX 2B52A02B2E8E30408A3040782B2EB22B HEX 52AE42529C3D40AE2B3BA073768E7888 HEX 8A78887873766A97A77CA9AC48A9AC66 HEX 97A7A0979A8E9CAC8A9CAC78979AB297 HEX A7D0A9AC9CA9ACAE97A7 *----------------------------------- * DRAW ALL REMAINING DOTS *----------------------------------- * 0: empty * 1: normal dot * 2: energy dot * * The board is stored per column!! drawDOTS LDA #theBOARD STA zpPTR2+1 LDA #$3B ; draw at X=$3B STA zpX2 L611F LDA #$01 ; index in board STA $19 LDA #$0B ; draw at Y=$B STA zpY2 L6127 LDY $19 LDA (zpPTR2),Y BEQ L614D ; empty ROR BCS L6142 LDA zpX2 ; move X/Y coord STA zpX1 ; by -1 DEC zpX1 LDA zpY2 STA zpY1 DEC zpY1 JSR drawENERGIZERDOT ; draw energizer dot CLC BCC L614D L6142 LDA zpX2 STA zpX1 LDA zpY2 STA zpY1 JSR drawNORMALDOT ; draw standard dot L614D CLC ; next Y on board LDA zpY2 ADC #$06 STA zpY2 INC $19 ; next X-board LDA $19 ; end of line? CMP #$1F BCC L6127 LDA zpPTR2 ; yes, next board line ADC #$1F STA zpPTR2 BCC L6166 INC zpPTR2+1 L6166 CLC ; next X LDA zpX2 ADC #$06 STA zpX2 CMP #$DD ; until last line BCC L611F RTS *----------------------------------- * DRAW DOT *----------------------------------- drawNORMALDOT JSR calcXYHGR ; calculate address ASL zpXBIT ; word table (two bytes to draw) JSR setHGRADDRESS ; make it a HGR address LDX zpXBIT ; offset in X LDY zpXCOL ; destination X in Y LDA L61A8,X ; output first byte ORA (zpHGR),Y STA (zpHGR),Y INX INY LDA L61A8,X ; output second byte ORA (zpHGR),Y STA (zpHGR),Y INC zpY1 ; next line JSR setHGRADDRESS LDX zpXBIT LDY zpXCOL LDA L61A8,X ; output same first byte ORA (zpHGR),Y STA (zpHGR),Y INX INY LDA L61A8,X ; output same second byte ORA (zpHGR),Y STA (zpHGR),Y RTS *--- Dot sprite (value depends on bit position) L61A8 HEX 0300 ; x=0 HEX 0600 ; x=1 HEX 0C00 ; etc... HEX 1800 HEX 3000 HEX 6000 HEX 4001 *----------------------------------- * DRAW ENERGIZER DOT *----------------------------------- drawENERGIZERDOT LDA #L61CA STA L6950+2 STA L6959+2 JSR L693A RTS *--- Energizer dot sprite (value depends on bit position) L61CA HEX 8680 ; bit 0 HEX 8F80 HEX 8F80 HEX 8680 HEX 8080 HEX 8080 HEX 8080 HEX 8080 HEX 8C80 ; bit 1 HEX 9E80 HEX 9E80 HEX 8C80 HEX 8080 HEX 8080 HEX 8080 HEX 8080 HEX 9880 ; bit 2 HEX BC80 HEX BC80 HEX 9880 HEX 8080 HEX 8080 HEX 8080 HEX 8080 HEX B080 ; bit 3 HEX F880 HEX F880 HEX B080 HEX 8080 HEX 8080 HEX 8080 HEX 8080 HEX E080 ; bit 4 HEX F081 HEX F081 HEX E080 HEX 8080 HEX 8080 HEX 8080 HEX 8080 HEX C081 ; bit 5 HEX E083 HEX E083 HEX C081 HEX 8080 HEX 8080 HEX 8080 HEX 8080 HEX 8083 ; bit 6 HEX C087 HEX C087 HEX 8083 HEX 8080 HEX 8080 HEX 8080 HEX 8080 *----------------------------------- * CURRENT BOARD (32-Y x 28-X) *----------------------------------- theBOARD HEX 1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF HEX 1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF HEX 1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF HEX 1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF HEX 1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF HEX 1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF HEX 1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF HEX 1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF HEX 1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF HEX 1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF HEX 1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010FFBF1010BFBF1010BFBF HEX 1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF HEX 1010BFBF1010AFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF HEX 1010BFBF1010AFBF1010BFBF1010BFBF1010BFBF1010AFBF1010BFBF1010BFBF HEX 1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF HEX 1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF HEX 1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF HEX 1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF HEX 1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF HEX 1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF HEX 1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF HEX 1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF HEX 1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF HEX 1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF HEX 1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF HEX 1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF HEX 1010BFBF1010AFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF HEX 1010BFBF1010AFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF1010BFBF *----------------------------------- * DEFAULT BOARD (STORED PER COLUMN) *----------------------------------- * The first byte is not used to make 32b wide * Turn your head 90¡ to the left to see where the dots are dftBOARD HEX 0000000000000000000000000000000000000000000000000000000000000000 HEX 0001010201010101010000000000000000000000010101020000010101010000 HEX 0001000000010000010000000000000000000000010000010000010000010000 HEX 0001000000010000010000000000000000000000010000010101010000010000 HEX 0001000000010000010000000000000000000000010000000000010000010000 HEX 0001000000010000010000000000000000000000010000000000010000010000 HEX 0001010101010101010101010101010101010101010101010101010000010000 HEX 0001000000010000000000000000000000000000010000010000000000010000 HEX 0001000000010000000000000000000000000000010000010000000000010000 HEX 0001000000010101010000000000000000000000010000010101010000010000 HEX 0001000000010000010000000000000000000000010000010000010000010000 HEX 0001000000010000010000000000000000000000010000010000010000010000 HEX 0001010101010000010101000000000000000000010101010000010101010000 HEX 0000000000010000000000000000000000000000000000000000000000010000 HEX 0000000000010000000000000000000000000000000000000000000000010000 HEX 0001010101010000010101000000000000000000010101010000010101010000 HEX 0001000000010000010000000000000000000000010000010000010000010000 HEX 0001000000010000010000000000000000000000010000010000010000010000 HEX 0001000000010101010000000000000000000000010000010101010000010000 HEX 0001000000010000000000000000000000000000010000010000000000010000 HEX 0001000000010000000000000000000000000000010000010000000000010000 HEX 0001010101010101010101010101010101010101010101010101010000010000 HEX 0001000000010000010000000000000000000000010000000000010000010000 HEX 0001000000010000010000000000000000000000010000000000010000010000 HEX 0001000000010000010000000000000000000000010000010101010000010000 HEX 0001000000010000010000000000000000000000010000010000010000010000 HEX 0001010201010101010000000000000000000000010101020000010101010000 HEX 0000000000000000000000000000000000000000000000000000000000000000 *----------------------------------- * DRAW BIG SPRITE (8 LINES) *----------------------------------- L693A LDA #$F8 STA zpSPRHEIGHT JSR calcXYHGR LDA zpXBIT ASL ASL ASL ASL ; *16 STA zpXBIT L6949 JSR setHGRADDRESS LDX zpXBIT LDY zpXCOL L6950 LDA $0666,X ORA (zpHGR),Y STA (zpHGR),Y INY INX L6959 LDA $0666,X ORA (zpHGR),Y STA (zpHGR),Y INX STX zpXBIT INC zpY1 INC zpSPRHEIGHT BNE L6949 RTS *----------------------------------- * ERASE SCORE *----------------------------------- eraseSCORE LDA zpCURPLAYER ; get current player ASL ; and set the coordinates TAX LDA L6992,X STA zpXCOL LDA L6992+1,X STA zpY1 *----------------------------------- * ERASE BLOCK *----------------------------------- eraseBLOCK LDA #$0C ; 12 lines to erase STA zpSPRHEIGHT L697C JSR setHGRADDRESS LDY zpXCOL LDX #$08 ; clear 8 bytes LDA #$80 L6985 STA (zpHGR),Y INY DEX BNE L6985 INC zpY1 ; screen line++ DEC zpSPRHEIGHT ; nb lines-- BNE L697C RTS *--- X/Y of each score on scren L6992 HEX 00,5E ; High score HEX 00,10 ; P1 HEX 20,10 ; P2 HEX 00,33 ; P3 HEX 20,33 ; P4 HEX 20,5E ; P5 *----------------------------------- * ERASE A SPRITE *----------------------------------- eraseSPRITE44 JSR moveCURSOR44 L69A1 LDA #$F6 ; 10 lines to erase STA zpSPRHEIGHT JSR calcXYHGR ASL zpXBIT ASL zpXBIT L69AC JSR setHGRADDRESS LDA #$03 ; width STA zpTEMP2 LDX zpXBIT LDY zpXCOL L69B7 LDA L69CD,X AND (zpHGR),Y ORA #$80 STA (zpHGR),Y INY INX DEC zpTEMP2 BNE L69B7 INC zpY1 ; Y+=1 INC zpSPRHEIGHT ; data++ BNE L69AC RTS L69CD HEX 00787F00 HEX 01707F00 HEX 03607F00 HEX 07407F00 HEX 0F007F00 HEX 1F007E00 HEX 3F007C00 *----------------------------------- * ERASE A SPRITE *----------------------------------- eraseSPRITE54 JSR moveCURSOR54 LDA #L6A04 STA L69B7+1 STY L69B7+2 JSR L69A1 ; erase it LDA #L69CD STA L69B7+1 STY L69B7+2 RTS L6A04 HEX 00607F00 HEX 01407F00 HEX 03007F00 HEX 07007E00 HEX 0F007C00 HEX 1F007800 HEX 3F007000 *----------------------------------- * *----------------------------------- L6A20 LDX zpMONITOR BEQ L6A28 LDX $1E BNE L6A62 L6A28 STA L6A4A+1 ; b&w STY L6A4A+2 JSR moveCURSOR44 LDA #$0A STA zpSPRHEIGHT LDA #$03 STA zpSPRWIDTH JSR calcXYHGR JSR calcSPROFFSET L6A3F JSR setHGRADDRESS LDX zpXBIT LDY zpXCOL LDA zpSPRWIDTH STA zpTEMP2 L6A4A LDA $0666,X ORA (zpHGR),Y AND #$7F STA (zpHGR),Y INX INY DEC zpTEMP2 BNE L6A4A STX zpXBIT INC zpY1 DEC zpSPRHEIGHT BNE L6A3F RTS L6A62 STA L55B1+1 ; color STY L55B1+2 JSR moveCURSOR44 LDA #$0A STA zpSPRHEIGHT JSR calcXYHGR JSR calcSPROFFSET LDA #$03 STA zpSPRWIDTH JMP drawCOLORSPRITE *----------------------------------- * *----------------------------------- L6A7C LDA $57 BNE L6AA7 LDA zpRANK CMP #$1A BCC L6A88 LDA #$1A L6A88 ASL ASL TAX LDA L6AFE,X STA $5C LDA L6AFF,X STA $5D LDA L6B00,X STA $5A LDA L6B01,X STA $5B LDA #$60 STA $57 LDA #$01 STA $E7 L6AA7 LDA $59 CMP #$01 BNE L6AFA LDA $E7 BEQ L6AFA LDA $5A BNE L6AB7 DEC $5B L6AB7 DEC $5A CLC LDA $5A ADC $5B BNE L6AC2 BCC L6AEB L6AC2 LDA $E7 CMP #$01 BEQ L6AE4 LDA #$91 STA zpX2 LDA #$00 STA zpX2+1 STA zpDECSCORE STA zpDECSCORE+2 LDA #$68 STA zpY2 JSR getMAXRANK15 TAX LDA tblSCORE,X STA zpDECSCORE+1 JMP L70F5 L6AE4 LDA $5C LDY $5D JMP showFRUIT L6AEB LDA #$10 STA zpXCOL LDA #$66 STA zpY1 LDA #$00 STA $E7 JSR eraseBLOCK L6AFA RTS L6AFB JMP L6AEB *----------------------------------- * FRUIT SPRITES *----------------------------------- L6AFE DB $00 L6AFF DB $00 L6B00 DB $00 L6B01 DB $00 DB $6E DA L6B6E DB $00 DB $01 DB $92 DA L6B92 DB $00 DB $01 DB $B6 DA L6BB6 DB $00 DB $01 DB $B6 DA L6BB6 DB $00 DB $01 DB $DA DA L6BDA DB $20 DB $01 DB $DA DA L6BDA DB $20 DB $01 DB $FE DA L6BFE DB $30 DB $01 DB $FE DA L6BFE DB $30 DB $01 DB $22 DA L6C22 DB $40 DB $01 DB $22 DA L6C22 DB $40 DB $01 DB $46 DA L6C46 DB $60 DB $01 DB $46 DA L6C46 DB $60 DB $01 DB $6A DA L6C6A DB $60 DB $01 DB $6A DA L6C6A DB $60 DB $01 DB $6A DA L6C6A DB $60 DB $01 DB $6A DA L6C6A DB $60 DB $01 DB $6A DA L6C6A DB $60 DB $01 DB $6A DA L6C6A DB $60 DB $01 DB $6A DA L6C6A DB $60 DB $01 DB $6A DA L6C6A DB $60 DB $01 DB $6A DA L6C6A DB $60 DB $01 DB $6A DA L6C6A DB $60 DB $01 DB $8E DA L6C8E DB $00 DB $02 DB $6A DA L6C6A DB $00 DB $02 DB $6A DA L6C6A DB $00 DB $02 DB $6A DA L6C6A DB $00 DB $02 DB $6A DA L6C6A DB $00 DB $02 L6B6E HEX 550000040200040800102000902085D4 HEX 0095DC0097DDA2D7D5A2D5D40095D400 HEX 95900094 L6B92 HEX 002A05102A1540A41140A286509A8500 HEX AE8700B285008A8600EC8500A8840088 HEX 8100A081 L6BB6 HEX 002A00402000C08200500A00D4AE0054 HEX E300D4AA00542A00D4AA00500A00C082 HEX 00400200 L6BDA HEX 000A00000100B89D00D4AB00D4AA00D4 HEX AA00D4AA00D4AA00C89200D08A009089 HEX 00E08600 L6BFE HEX 000A0040000040000050020050020054 HEX 0B00540E005C0A00540A005002004000 HEX 00000000 L6C22 HEX 000000900000B40000928100B28100BA HEX 8100BA8100BA8100928100B80000B800 HEX 00900000 L6C46 HEX 900000900000E08100E08100F08200F0 HEX 8200F88600E88700EC8F00EE9F00C000 HEX 00C00000 L6C6A HEX B88100888100888100B00000F08100B0 HEX 0000F08000B00000F08100F00000B000 HEX 00F00000 L6C8E HEX 0000004A04002A05006E05002A1D0000 HEX 00005B3B00552A00552A005B3B000000 HEX 00000000 *----------------------------------- * ADD TO SCORE *----------------------------------- addTOSCORE LDX zpDEMO BNE L6CD3 JSR getMAXRANK15 TAX CLC SED LDA zpCURSCORE+1 ADC tblSCORE,X STA zpCURSCORE+1 LDA zpCURSCORE+2 ADC #$00 STA zpCURSCORE+2 CLD JSR eraseSCORE JSR displayPLAYERSCORE JSR L7C61 L6CD3 RTS tblSCORE HEX 00,01,03,05,05,07,07,10,10,20,20,30,30,50,50,50,50,50 *----------------------------------- * PATIENTLY WAIT *----------------------------------- doWAIT LDX #$01 doWAIT2 LDA #$8F L6CEA SEC SBC #$01 BCS L6CEA DEX BNE doWAIT2 RTS L6CF3 RTS *----------------------------------- * WE WON! GO TO NEXT LEVEL *----------------------------------- gotoNEXTLEVEL JSR L58FA JSR L7D80 JSR eraseSPRITE44 JSR L7D80 JSR L79A4 LDY #$0B L6D05 LDX #$FF JSR doWAIT2 DEY BNE L6D05 JSR playCARTOON INC zpRANK ; ZP next level? JSR L531E JSR prepareLEVEL JSR L53E6 JMP L530F *----------------------------------- * GET MAX RANK MOD 15 *----------------------------------- getMAXRANK15 LDA zpRANK CMP #$0F BCC L6D26 LDA #$0F L6D26 RTS *----------------------------------- * GET MAX RANK MOD 21 *----------------------------------- getMAXRANK21 LDA zpRANK CMP #$15 BCC L6D2F LDA #$15 L6D2F RTS *----------------------------------- * *----------------------------------- L6D30 LDA $E0 ASL TAX LDA L6D3F,X STA $70 LDA L6D40,X STA $71 RTS L6D3F DB $00 L6D40 DB $00 DB $8B DB $55 DB $7F DB $5D DB $8B DB $55 DB $99 DB $5D *----------------------------------- * *----------------------------------- L6D49 LDA #$00 LDX #$08 STA $84,X STA $98,X STA $AC,X STA $C0,X STA $78 STA $E4 STA $E9 LDA #$02 STA $68 RTS L6D60 LDX zpRANK CPX #$15 BCS L6DA0 LDA #$04 STA $E0 L6D6A JSR L86FC LDA $79 BNE L6D75 LDA #$01 STA $78 L6D75 JSR L8712 DEC $E0 BNE L6D6A LDA #$02 STA $68 LDA #$01 STA $E4 JSR getMAXRANK21 ASL TAX LDA L6DEF,X STA $E1 LDA L6DEF+1,X STA $E2 LDA #$04 STA $EA STA $EB LDA #$01 STA $E9 JSR L80C1 L6DA0 RTS L6DA1 LDY $77 INY LDA $E0 CMP #$01 BEQ L6DDE CMP #$03 BEQ L6DDE LDA #$01 STA ($75),Y INY LDA #$00 STA ($75),Y INY LDA $E0 CMP #$02 BEQ L6DC4 LDA #$03 STA ($75),Y BNE L6DC8 L6DC4 LDA #$02 STA ($75),Y L6DC8 INY LDA #$01 STA ($75),Y INY STA ($75),Y INY LDA #$03 STA ($75),Y INY LDA #$FF STA ($75),Y JSR L8712 RTS L6DDE LDA #$00 STA ($75),Y INY LDA #$01 STA ($75),Y INY LDA #$00 STA ($75),Y BEQ L6DC8 RTS L6DEF DB $00 DB $00 DB $60 DB $01 DB $00 DB $01 DB $00 DB $01 DB $C0 DB $00 DB $C0 DB $00 DB $40 DB $00 DB $00 DB $01 DB $50 DB $00 DB $50 DB $00 DB $40 DB $00 DB $C0 DB $00 DB $40 DB $00 DB $40 DB $00 DB $40 DB $00 DB $FF DB $FF DB $B0 DB $00 DB $10 DB $00 DB $30 DB $00 DB $30 DB $00 DB $B0 DB $00 L6E19 DB $40 L6E1A DB $00 DB $30 DB $00 DB $20 DB $00 DB $20 DB $00 DB $18 DB $00 DB $18 DB $00 DB $18 DB $00 DB $18 DB $00 DB $10 DB $00 DB $10 DB $00 DB $10 DB $00 DB $10 DB $00 DB $10 DB $00 DB $10 DB $00 DB $10 DB $00 DB $10 DB $00 DB $02 DB $00 DB $03 DB $02 DB $00 DB $03 DB $01 DB $00 DB $03 DB $01 DB $01 DB $02 DB $00 DB $01 DB $01 DB $03 DB $01 DB $03 DB $02 DB $01 DB $02 DB $01 DB $02 DB $01 DB $01 DB $03 DB $01 DB $00 DB $01 DB $00 DB $00 DB $01 DB $00 DB $03 DB $03 DB $00 DB $00 DB $02 DB $02 DB $00 DB $02 DB $00 DB $01 DB $03 DB $03 DB $02 DB $02 DB $01 DB $00 DB $03 DB $00 DB $03 DB $01 DB $01 DB $03 DB $02 DB $01 DB $01 DB $02 DB $00 DB $02 DB $01 DB $01 DB $03 *----------------------------------- * *----------------------------------- L6E79 LDY #$0E L6E7B LDA L8A44,Y STA TEXT2,Y DEY BPL L6E7B LDY #$00 LDX #$01 L6E88 LDA #$00 STA TEXT2+$200,Y STA TEXT2+$100,X STA TEXT2+$300,X INX INY LDA #$01 STA TEXT2+$200,Y STA TEXT2+$100,X STA TEXT2+$300,X INX INY BNE L6E88 RTS L6EA5 LDA $E0 ASL TAX LDA L8A3A,X STA L6EB7+1 LDA L8A3A+1,X STA L6EB7+2 LDX #$00 L6EB7 LDA $0666,X STA ($75),Y INY INX CPX #$10 BNE L6EB7 RTS L6EC3 JSR L6AFB JSR showGAMEOVER LDA #$01 STA zpDEMO LDY #$30 L6ECF LDX #$64 JSR doWAIT2 DEY BNE L6ECF JMP welcomePAGE *----------------------------------- * SHOW FRUIT *----------------------------------- showFRUIT LDX #$66 STX zpY1 LDX #$13 STX zpXCOL *----------------------------------- * DISPLAY FRUIT SPRITE *----------------------------------- L6EE2 STA L6EFF+1 STY L6EFF+2 LDA #$0C STA zpSPRHEIGHT LDA #$00 STA zpXBIT L6EF0 JSR setHGRADDRESS LDX zpXBIT LDY zpXCOL LDA #$03 STA zpTEMP2 L6EFB LDA (zpHGR),Y AND #$7F L6EFF ORA $0666,X STA (zpHGR),Y INX INY DEC zpTEMP2 BNE L6EFB STX zpXBIT INC zpY1 DEC zpSPRHEIGHT BNE L6EF0 RTS *----------------------------------- * SHOW FRUITED RANK *----------------------------------- showFRUITEDRANK LDA zpRANK CMP #$1A ; 26 BCC L6F1B LDA #$1A L6F1B ASL ; show the rank as a fruit ASL TAX LDA #$B0 STA zpY1 LDA #$21 STA zpXCOL LDA L6AFE,X LDY L6AFF,X JMP L6EE2 *----------------------------------- * SET THE HGR SCREEN *----------------------------------- setHGR LDA TXTCLR LDA MIXCLR LDA HIRES LDA TXTPAGE1 RTS *----------------------------------- * SET THE TEXT SCREEN *----------------------------------- setTEXT2 LDA TXTSET LDA TXTPAGE2 LDA MIXCLR RTS *----------------------------------- * CLEAR THE HGR SCREEN *----------------------------------- clearHGR LDA #>HGR STA zpPTR2+1 LDY #HGR2 BNE L6F4E RTS *----------------------------------- * GET INPUT FROM SELECTED DEVICE *----------------------------------- getINPUT JSR readKEYBOARD ; read keyboard BCS L6F65 STA $63 L6F65 LDA zpDEVICE ; which device? BNE L6F6F JSR readJOYPAD ; read joypad JMP L6F72 L6F6F JSR readJOYSTICK ; read joystick L6F72 BCS L6F76 STA $63 ; save movement L6F76 RTS *----------------------------------- * READ KEYBOARD *----------------------------------- readKEYBOARD LDA KBD BPL L6FCE STA KBDSTROBE CMP #$93 ; ctrl-s BNE L6F96 ; speaker or tape out LDA L7BB5+1 EOR #$10 STA L7BB5+1 LDA L7D06+1 EOR #$10 STA L7D06+1 JMP L6FCE L6F96 CMP #$9B ; ESC BNE L6FA2 L6F9A LDA KBD BPL L6F9A STA KBDSTROBE L6FA2 LDX zpDEMO BEQ L6FB1 CMP #" " BEQ L6FAE CMP #" " BNE L6FCE L6FAE JMP selectRANKCARTOON ; space resets the game * 0: down * 1: up * 2: right * 3: left L6FB1 CMP #$C1 ; A BEQ L6FCA L6FB5 CMP #$95 ; right-arrow BEQ L6FC7 L6FB9 CMP #$88 ; left-arrow BEQ L6FC4 L6FBD CMP #$DA ; Z BNE L6FCE LDA #$00 ; down HEX 2C L6FC4 LDA #$03 ; up HEX 2C L6FC7 LDA #$02 ; right HEX 2C L6FCA LDA #$01 ; left CLC RTS L6FCE SEC RTS *----------------------------------- * READ ATARI JOYPAD *----------------------------------- readJOYPAD LDA zpDEMO BNE L700A LDA #$00 BIT SETAN0 BIT SETAN1 BIT SETAN2 LDX BUTN0 BPL L6FE6 ORA #$04 L6FE6 BIT CLRAN0 LDX BUTN0 BPL L6FF0 ORA #$08 L6FF0 BIT CLRAN1 LDX BUTN0 BPL L6FFA ORA #$02 L6FFA BIT SETAN0 LDX BUTN0 BPL L7004 ORA #$01 L7004 TAX LDA L700E,X BPL L700C L700A SEC RTS L700C CLC RTS L700E DB $FF DB $00 ; down DB $01 ; up DB $FF DB $02 ; right DB $FF DB $FF DB $FF DB $03 ; left DB $FF DB $FF DB $FF DB $FF DB $FF DB $FF DB $FF *----------------------------------- * GET JOYSTICK VALUES *----------------------------------- getLLJOYSTICK LDA PTRIG SEC LDA #$63 LDX #$00 LDY #$00 L7028 BIT PADDL0 BPL L7030 INX BNE L7032 L7030 NOP NOP L7032 BIT PADDL1 BPL L703A INY BNE L703C L703A NOP NOP L703C SBC #$01 BNE L7028 RTS *----------------------------------- * READ JOYSTICK *----------------------------------- readJOYSTICK LDA zpDEMO BNE L708D JSR getLLJOYSTICK ; read joystick LDA $62 LSR BNE L7065 BCS L705E CPY #$1C BCC L7081 L7053 CPX #$1C BCC L7089 CPX #$44 BCS L7085 LDA #$80 RTS L705E CPY #$44 BCS L707D JMP L7053 L7065 BCS L7076 CPX #$1C BCC L7089 L706B CPY #$1C BCC L7081 CPY #$44 BCS L707D LDA #$80 RTS L7076 CPX #$44 BCS L7085 JMP L706B * 0: down * 1: up * 2: right * 3: left * 80: none L707D CLC LDA #$00 RTS L7081 CLC LDA #$01 RTS L7085 CLC LDA #$02 RTS L7089 CLC LDA #$03 RTS L708D CLC LDA #$80 RTS *----------------------------------- * DISPLAY CURRENT PLAYER'S SCORE *----------------------------------- displayPLAYERSCORE LDA zpCURSCORE+2 ; compare current score with high score CMP zpHISCORE+2 BEQ L709B BCC L70CC BCS L70AB L709B LDA zpCURSCORE+1 CMP zpHISCORE+1 BEQ L70A5 BCC L70CC BCS L70AB L70A5 LDA zpCURSCORE CMP zpHISCORE BCC L70CC L70AB LDA zpCURSCORE ; save score as high score STA zpHISCORE STA zpDECSCORE LDA zpCURSCORE+1 STA zpHISCORE+1 STA zpDECSCORE+1 LDA zpCURSCORE+2 STA zpHISCORE+2 STA zpDECSCORE+2 LDA zpCURPLAYER ; save current player STA $F0 LDA #$00 ; force high score player STA zpCURPLAYER JSR L70D8 ; output score LDA $F0 ; restore current player STA zpCURPLAYER L70CC LDA zpCURSCORE ; current player score STA zpDECSCORE LDA zpCURSCORE+1 STA zpDECSCORE+1 LDA zpCURSCORE+2 STA zpDECSCORE+2 L70D8 JSR eraseSCORE ; erase the area LDA zpCURPLAYER ; set the coordinates ASL ASL TAX LDA L7141,X STA zpX2 LDA L7142,X STA zpX2+1 LDA L7143,X STA zpY2 JSR L70F5 JMP L7124 L70F5 LDA #$00 ; calculate the score LDY #$04 L70F9 CLC ROR zpDECSCORE+2 ROR zpDECSCORE+1 ROR zpDECSCORE ROR DEY BNE L70F9 CLC ROR ROR ROR ROR JSR printDIGIT SEC LDA zpX2 SBC #$06 STA zpX2 BCS L7117 DEC zpX2+1 L7117 LDA zpDECSCORE+2 BNE L70F5 LDA zpDECSCORE+1 BNE L70F5 LDA zpDECSCORE BNE L70F5 RTS *----------------------------------- * *----------------------------------- L7124 LDA zpCURPLAYER ; high score player? BEQ L7140 BIT zpNBLIVES ; no life already? BPL L7140 LDA zpCURSCORE+2 ; 10000? CMP #$01 BCC L7140 ; no JSR sndEXTRALIFE ; play a happy sound INC zpNBLIVES ; life++ LDA zpNBLIVES AND #$7F STA zpNBLIVES JSR printNBLIVES L7140 RTS L7141 DB $28 L7142 DB $00 L7143 DB $5E DB $00 DB $28 DB $00 DB $10 DB $00 DB $0A DB $01 DB $10 DB $00 DB $28 DB $00 DB $33 DB $00 DB $0A DB $01 DB $33 DB $00 DB $0A DB $01 DB $5E DB $00 *----------------------------------- * PRINT DIGIT (0 TO 9) *----------------------------------- printDIGIT ASL TAX LDA L717D,X ; get the pointer to the digit STA L6950+1 STA L6959+1 LDA L717D+1,X STA L6950+2 STA L6959+2 LDA zpX2 ; where to output it STA zpX1 LDA zpX2+1 STA zpX1+1 LDA zpY2 STA zpY1 JSR L693A ; print "sprite" RTS L717D DA L7191 ; 0 DA L7201 ; 1 DA L7271 ; 2 DA L72E1 ; 3 DA L7351 ; 4 DA L73C1 ; 5 DA L7431 ; 6 DA L74A1 ; 7 DA L7511 ; 8 DA L7581 ; 9 L7191 HEX 8E80918091809180918091808E808080 HEX 9C80A280A280A280A280A2809C808080 HEX B880C480C480C480C480C480B8808080 HEX F08088818881888188818881F0808080 HEX E08190829082908290829082E0818080 HEX C083A084A084A084A084A084C0838080 HEX 8087C088C088C088C088C08880878080 L7201 HEX 8480868084808480848084808E808080 HEX 88808C8088808880888088809C808080 HEX 908098809080908090809080B8808080 HEX A080B080A080A080A080A080F0808080 HEX C080E080C080C080C080C080E0818080 HEX 8081C0818081808180818081C0838080 HEX 80828083808280828082808280878080 L7271 HEX 8E80918090808C80828081809F808080 HEX 9C80A280A080988084808280BE808080 HEX B880C480C080B08088808480FC808080 HEX F08088818081E08090808880F8818080 HEX E08190828082C081A0809080F0838080 HEX C083A08480848083C080A080E0878080 HEX 8087C088808880868081C080C08F8080 L72E1 HEX 9F80908088808C80908091808E808080 HEX BE80A08090809880A080A2809C808080 HEX FC80C080A080B080C080C480B8808080 HEX F8818081C080E08080818881F0808080 HEX F08380828081C08180829082E0818080 HEX E0878084808280838084A084C0838080 HEX C08F8088808480868088C08880878080 L7351 HEX 8C808A8089809F808880888088808080 HEX 988094809280BE809080908090808080 HEX B080A880A480FC80A080A080A0808080 HEX E080D080C880F881C080C080C0808080 HEX C081A0819081F0838081808180818080 HEX 8083C082A082E0878082808280828080 HEX 80868085C084C08F8084808480848080 L73C1 HEX 9F8081808E809080908091808E808080 HEX BE8082809C80A080A080A2809C808080 HEX FC808480B880C080C080C480B8808080 HEX F8818880F080808180818881F0808080 HEX F0839080E081808280829082E0818080 HEX E087A080C08380848084A084C0838080 HEX C08FC080808780888088C08880878080 L7431 HEX 9C80828081808F80918091808E808080 HEX B880848082809E80A280A2809C808080 HEX F08088808480BC80C480C480B8808080 HEX E08190808880F88088818881F0808080 HEX C083A0809080F08190829082E0818080 HEX 8087C080A080E083A084A084C0838080 HEX 808E8081C080C087C088C08880878080 L74A1 HEX 9F809080888084808280828082808080 HEX BE80A080908088808480848084808080 HEX FC80C080A08090808880888088808080 HEX F8818081C080A0809080908090808080 HEX F08380828081C080A080A080A0808080 HEX E087808480828081C080C080C0808080 HEX C08F8088808480828081808180818080 L7511 HEX 8E80918091808E80918091808E808080 HEX 9C80A280A2809C80A280A2809C808080 HEX B880C480C480B880C480C480B8808080 HEX F08088818881F08088818881F0808080 HEX E08190829082E08190829082E0818080 HEX C083A084A084C083A084A084C0838080 HEX 8087C088C0888087C088C08880878080 L7581 HEX 8E80918091809E809080888087808080 HEX 9C80A280A280BC80A08090808E808080 HEX B880C480C480F880C080A0809C808080 HEX F08088818881F0818081C080B8808080 HEX E08190829082E08380828081F0808080 HEX C083A084A084C08780848082E0818080 HEX 8087C088C088808F80888084C0838080 *----------------------------------- * *----------------------------------- L75F1 STA zpPTR2 LDA #>L760A STA zpPTR2+1 LDA zpPTR2 ASL ASL ASL BCC L7600 INC zpPTR2+1 L7600 CLC ADC #theBOARD STA zpPTR2+1 LDA $6A ASL ASL ASL ASL BCC L7A7B INC zpPTR2+1 INC zpPTR2+1 L7A7B ASL BCC L7A80 INC zpPTR2+1 L7A80 CLC ADC $6B ADC #L7BE3 JMP playSOUNDFX L7BE3 DB $30 DB $1C DB $00 *----------------------------------- * *----------------------------------- L7BE6 LDA #L7BED JMP playSOUNDFX L7BED DB $50 DB $50 DB $50 DB $50 DB $50 DB $49 DB $49 DB $49 DB $48 DB $48 DB $48 DB $47 DB $47 DB $47 DB $46 DB $46 DB $46 DB $45 DB $45 DB $45 DB $44 DB $44 DB $44 DB $43 DB $43 DB $43 DB $42 DB $42 DB $42 DB $41 DB $41 DB $41 DB $40 DB $40 DB $40 DB $40 DB $40 DB $40 DB $39 DB $39 DB $39 DB $38 DB $38 DB $38 DB $37 DB $37 DB $37 DB $36 DB $36 DB $36 DB $35 DB $35 DB $35 DB $34 DB $34 DB $34 DB $30 DB $30 DB $30 DB $30 DB $30 DB $30 DB $30 DB $30 DB $30 DB $30 DB $30 DB $30 DB $28 DB $28 DB $27 DB $27 DB $26 DB $26 DB $25 DB $25 DB $24 DB $24 DB $23 DB $23 DB $23 DB $10 DB $10 DB $10 DB $10 DB $10 DB $10 DB $00 *----------------------------------- * WE ATE AN ENERGIZER DOT *----------------------------------- sndENERGIZERDOT LDA #L7C4C JMP playSOUNDFX L7C4C DB $40 DB $40 DB $40 DB $30 DB $00 *----------------------------------- * WE HAVE AN EXTRA LIFE *----------------------------------- sndEXTRALIFE LDY #$50 STY $06 L7C55 LDA #$20 STA $05 JSR playNOTE DEC $06 BNE L7C55 RTS *----------------------------------- * *----------------------------------- L7C61 LDA #L7C68 JMP playSOUNDFX L7C68 DB $70 DB $70 DB $70 DB $70 DB $69 DB $69 DB $69 DB $69 DB $69 DB $69 DB $69 DB $69 DB $60 DB $60 DB $60 DB $60 DB $60 DB $60 DB $60 DB $50 DB $50 DB $50 DB $50 DB $50 DB $50 DB $00 *----------------------------------- * PLAY HIGHER BEEPS *----------------------------------- L7C82 LDA zpTEMP3 ASL TAX LDA L7C8F,X LDY L7C8F+1,X JMP playSOUNDFX L7C8F DA $0000 DA L7CE4 DA L7CD7 DA L7CCA DA L7CBD DA L7CB0 DA L7C9D L7C9D DB $20 DB $20 DB $20 DB $19 DB $19 DB $20 DB $20 DB $19 DB $19 DB $16 DB $16 DB $16 DB $14 DB $14 DB $14 DB $14 DB $12 DB $12 DB $00 L7CB0 DB $20 DB $20 DB $22 DB $24 DB $25 DB $28 DB $29 DB $2A DB $2C DB $2D DB $2D DB $2E DB $00 L7CBD DB $28 DB $28 DB $2A DB $2A DB $2B DB $2F DB $2F DB $30 DB $34 DB $35 DB $39 DB $39 DB $00 L7CCA DB $30 DB $39 DB $36 DB $36 DB $39 DB $40 DB $42 DB $43 DB $43 DB $43 DB $44 DB $47 DB $00 L7CD7 DB $40 DB $40 DB $42 DB $43 DB $43 DB $44 DB $46 DB $48 DB $48 DB $48 DB $49 DB $49 DB $00 L7CE4 DB $10 DB $10 DB $08 DB $07 DB $07 DB $09 DB $20 DB $07 DB $06 DB $03 DB $03 DB $00 *----------------------------------- * *----------------------------------- L7CF0 LDA #L7C9D JMP playSOUNDFX *----------------------------------- * PLAY LONGER NOTE *----------------------------------- playNOTE2 LDX #$04 L7CF9 LDY $05 L7CFB DEY INY PHA PLA PHA PLA PHA PLA DEY BNE L7CFB L7D06 BIT SPKR DEX BNE L7CF9 RTS *----------------------------------- * PLAY SONG *----------------------------------- playSONG STA zpPTR1 STY zpPTR1+1 LDA #$00 STA $06 L7D15 LDY $06 LDA (zpPTR1),Y BEQ L7D32 STA $05 ; height INY LDA (zpPTR1),Y STA playNOTE2+1 ; duration JSR playNOTE2 JSR getINPUT JSR sndWAIT INC $06 INC $06 BNE L7D15 L7D32 LDA #$04 STA playNOTE2+1 RTS *----------------------------------- * PLAY INTRO MUSIC *----------------------------------- playINTROMUSIC LDA #L7D3F JMP playSONG L7D3F DB $41 DB $60 DB $41 DB $30 DB $41 DB $20 DB $49 DB $24 DB $57 DB $26 DB $41 DB $60 DB $37 DB $A0 DB $41 DB $60 DB $41 DB $30 DB $41 DB $20 DB $49 DB $24 DB $57 DB $26 DB $41 DB $60 DB $49 DB $70 DB $41 DB $60 DB $41 DB $30 DB $41 DB $20 DB $49 DB $24 DB $57 DB $26 DB $41 DB $60 DB $39 DB $80 DB $39 DB $20 DB $31 DB $24 DB $2E DB $A0 DB $31 DB $90 DB $39 DB $60 DB $41 DB $30 DB $34 DB $80 DB $41 DB $82 DB $00 DB $00 *----------------------------------- * WAIT FOR THE SONG ROUTINE *----------------------------------- sndWAIT LDX #$1E JMP doWAIT2 *----------------------------------- * *----------------------------------- L7D80 LDA $60 STA zpX1 LDA $61 STA zpY1 LDA #$00 STA zpX1+1 RTS L7D8D LDA $70 STA zpX1 LDA $71 STA zpY1 LDA #$00 STA zpX1+1 RTS *----------------------------------- * MOVE CURSOR -4,-4 *----------------------------------- moveCURSOR44 SEC ; X1 - 4 LDA zpX1 SBC #$04 STA zpX1 SEC ; Y1 - 4 LDA zpY1 SBC #$04 STA zpY1 RTS *----------------------------------- * MOVE CURSOR -5,-4 *----------------------------------- moveCURSOR54 SEC ; X1 - 5 LDA zpX1 SBC #$05 STA zpX1 SEC ; Y1 - 4 LDA zpY1 SBC #$04 STA zpY1 RTS *----------------------------------- * *----------------------------------- L7DB8 LDA $68 CMP #$02 BEQ L7DCC CMP #$04 BEQ L7DD2 CMP #$08 BEQ L7DD8 LDA #$21 LDY #$80 BNE L7DDC L7DCC LDA #L7FC7 BNE L7DDC L7DD2 LDA #L7FE5 BNE L7DDC L7DD8 LDA #L8003 L7DDC STA zpPTR2 STY zpPTR2+1 JSR L7D80 JSR eraseSPRITE44 JSR L7D8D JSR eraseSPRITE44 JSR L7D8D JSR L7E1F LDA zpDEMO BNE L7E0E JSR L805D JSR L805D JSR L7BE6 JSR L805D JSR L805D JSR L805D JSR L805D JMP L7E13 L7E0E LDX #$FF JSR doWAIT2 L7E13 JSR L7D8D JSR eraseSPRITE54 JSR L7D80 JMP L79A4 L7E1F JSR moveCURSOR54 JSR calcXYHGR LDY #$1D L7E27 LDA (zpPTR2),Y STA L7E70,Y DEY BPL L7E27 LDA zpXBIT BEQ L7E3C STA zpTEMP4 L7E35 JSR L7E4F DEC zpTEMP4 BNE L7E35 L7E3C JSR calcSPROFFSET JSR L804E LDA #L7E70 SEC SBC zpXBIT BCS L7E4C DEY L7E4C JMP L6A20 L7E4F LDX #$1B L7E51 ASL L7E70,X ASL L7E70,X INX ROL L7E70,X ASL L7E70,X INX ROL L7E70,X DEX ROR L7E70,X DEX ROR L7E70,X DEX DEX DEX BPL L7E51 RTS *--- Array of data is $50 bytes L7E70 DB $CB L7E71 DB $A0 L7E72 DB $D4 L7E73 DB $CF DB $A0 DB $C4 DB $C5 DB $CD DB $CF DB $AE DB $A0 DB $A0 DB $B1 DB $14 DB $85 DB $04 DB $C8 DB $B1 DB $14 DB $85 DB $10 DB $85 DB $0A DB $C8 DB $84 DB $0B DB $A4 DB $0B DB $B1 DB $14 DB $30 DB $1F DB $F0 DB $10 DB $C9 DB $20 DB $F0 DB $0F DB $C9 DB $21 DB $F0 DB $18 DB $C9 DB $03 DB $B0 DB $04 DB $E6 DB $10 DB $E6 DB $10 DB $20 DB $16 DB $43 DB $A5 DB $0A DB $85 DB $10 DB $E6 DB $0B DB $E6 DB $04 DB $D0 DB $DB DB $E6 DB $0B DB $60 DB $A9 DB $73 DB $8D DB $B2 DB $55 DB $A9 DB $46 DB $8D DB $B3 DB $55 DB $20 DB $38 DB $43 DB $4C *----------------------------------- * *----------------------------------- L7EC0 JSR L7D80 LDA #L9BE6 JSR L6A20 LDY #$03 L7ECC LDX #$FF JSR doWAIT2 DEY BNE L7ECC JSR L7D80 JSR eraseSPRITE44 LDA #$06 STA zpTEMP3 L7EDE LDA zpTEMP3 ASL TAX JSR L7D80 LDA L7F05,X LDY L7F05+1,X STA zpPTR2 STY zpPTR2+1 JSR L7E1F JSR L7C82 LDX #$80 JSR doWAIT2 JSR L7D80 JSR eraseSPRITE54 DEC zpTEMP3 BNE L7EDE RTS L7F05 DA $0000 DA L7FA9 DA L7F8B DA L7F6D DA L7F4F DA L7F31 DA L7F13 L7F13 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $06 DB $0C DB $00 DB $1E DB $0F DB $00 DB $7E DB $0F DB $00 DB $7E DB $0F DB $00 DB $7C DB $07 DB $00 DB $78 DB $03 DB $00 DB $70 DB $01 DB $00 L7F31 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $7E DB $0F DB $00 DB $7E DB $0F DB $00 DB $7C DB $07 DB $00 DB $78 DB $03 DB $00 DB $70 DB $01 DB $00 L7F4F DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $78 DB $03 DB $00 DB $7C DB $07 DB $00 DB $7C DB $07 DB $00 DB $78 DB $03 DB $00 DB $70 DB $01 DB $00 L7F6D DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $70 DB $01 DB $00 DB $78 DB $03 DB $00 DB $78 DB $03 DB $00 DB $70 DB $01 DB $00 DB $60 DB $00 DB $00 L7F8B DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $60 DB $00 DB $00 DB $60 DB $00 DB $00 DB $60 DB $00 DB $00 DB $60 DB $00 DB $00 DB $60 DB $00 DB $00 L7FA9 DB $00 DB $00 DB $00 DB $24 DB $02 DB $00 DB $28 DB $01 DB $00 DB $00 DB $00 DB $00 DB $2C DB $03 DB $00 DB $00 DB $00 DB $00 DB $28 DB $01 DB $00 DB $24 DB $02 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 L7FC7 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $77 DB $0E DB $00 DB $54 DB $0A DB $00 DB $56 DB $0A DB $00 DB $51 DB $0A DB $00 DB $77 DB $0E DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 L7FE5 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $75 DB $0E DB $00 DB $55 DB $0A DB $00 DB $57 DB $0A DB $00 DB $54 DB $0A DB $00 DB $74 DB $0E DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 L8003 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $77 DB $0E DB $00 DB $55 DB $0A DB $00 DB $57 DB $0A DB $00 DB $55 DB $0A DB $00 DB $77 DB $0E DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 L8020 DB $00 DB $44 DB $00 DB $00 DB $44 DB $00 DB $00 DB $44 DB $03 DB $00 DB $44 DB $02 DB $00 DB $44 DB $03 DB $00 DB $00 DB $00 DB $00 DB $5C DB $03 DB $00 DB $54 DB $02 DB $00 DB $54 DB $02 DB $00 DB $5C DB $03 DB $00 DB $18 *----------------------------------- * *----------------------------------- LDA zpX1 ADC #$05 STA zpX1 CLC LDA zpY1 ADC #$04 STA zpY1 RTS L804E CLC LDA zpX1 ADC #$04 STA zpX1 CLC LDA zpY1 ADC #$04 STA zpY1 RTS L805D LDA $E0 STA $F1 JSR L8712 LDA #$04 STA $E0 L8068 JSR L86FC LDA $79 BEQ L807D LDA #$01 STA $80 JSR L8763 LDA #$01 STA $80 JSR L8763 L807D JSR L8712 DEC $E0 BNE L8068 LDA $F1 STA $E0 JSR L86FC RTS L808C LDA $EA BNE L8092 DEC $EB L8092 DEC $EA CLC LDA $EA ADC $EB BCS L80C0 BNE L80C0 LDA $E9 BNE L80B1 JSR L80C1 LDA #$01 STA $E9 LDA #$8C STA $EA LDA #$00 STA $EB RTS L80B1 JSR L80C1 LDA #$00 STA $E9 LDA #$02 STA $EB LDA #$58 STA $EA L80C0 RTS L80C1 LDA #$04 STA $E0 L80C5 JSR L86FC LDA $81 BNE L80DB LDA $72 EOR #$01 STA $72 LDY $77 STA ($75),Y LDA #$FF INY STA ($75),Y L80DB JSR L8712 DEC $E0 BNE L80C5 RTS *----------------------------------- * SHOW GAME OVER *----------------------------------- showGAMEOVER LDA #$69 ; Y LDX #$04 ; width in bytes LDY #$0F ; X JSR prepareGO LDX #$07 ; nb lines LDA #sprGAME JSR drawGO LDA #$69 LDX #$04 LDY #$15 JSR prepareGO LDX #$07 LDA #sprOVER JMP drawGO prepareGO STA zpY1 STX zpSPRWIDTH STY zpXCOL LDA #$00 STA zpXBIT RTS drawGO STX zpSPRHEIGHT STA L55B1+1 STY L55B1+2 JMP drawCOLORSPRITE *--- Sprite for GAME sprGAME HEX 6023443E HEX 10506C02 HEX 10085502 HEX 507B550E HEX 100A4502 HEX 100A4502 HEX 600B453E *--- Sprite for OVER sprOVER HEX 4E687701 HEX 51281002 HEX 51281002 HEX 51687101 HEX 51285000 HEX 11251001 HEX 0E621702 *----------------------------------- * WHICH CARTOON TO PLAY? *----------------------------------- playCARTOON LDA zpRANK L8157 CMP #$02 BNE L815E JMP playCARTOON1 L815E CMP #$05 BNE L8165 JMP playCARTOON2 L8165 CMP #$09 BNE L816C JMP playCARTOON3 L816C BCC L8172 SBC #$0D BCS L8157 L8172 RTS *----------------------------------- * DRAW AN HORIZONTAL LINE *----------------------------------- cartoonHLINE STA zpX1 ; X STY zpX2 ; Y from STX zpY1 ; Y to LDA #$80 ; mode STA $1E JMP drawHLINE *----------------------------------- * DRAW A VERTICAL LINE *----------------------------------- cartoonVLINE STA zpX1 ; X STY zpY1 ; Y-from STX zpY2 ; Y-to JMP drawVLINE *----------------------------------- * CARTOON INIT *----------------------------------- initCARTOON LDA #$C1 ; start X STA $60 LDA #$7A ; Y STA $61 STA $71 LDA #$E5 STA $70 LDA #$00 STA $79 STA $78 STA $66 LDA #$01 STA $E0 STA $81 STA $59 STA $80 LDA #$03 STA $62 RTS *----------------------------------- * PLAY CARTOON 1 *----------------------------------- playCARTOON1 JSR clearHGR JSR setHGR JSR initCARTOON L81B7 DEC $59 BNE L81DB LDA #$20 STA $59 JSR L7D80 JSR eraseSPRITE44 SEC LDA $60 ; x -= 2 SBC #$02 STA $60 STA zpX1 CMP #$21 BCC L81FC LDA $61 STA zpY1 INC $66 JSR L79A4 L81DB JSR doWAIT DEC $80 BNE L81F9 LDA #$1D STA $80 JSR L7D8D JSR eraseSPRITE44 SEC LDA $70 SBC #$02 STA $70 JSR L7D8D JSR L88A2 L81F9 JMP L81B7 L81FC JSR L7D80 JSR eraseSPRITE44 JSR L7D8D JSR eraseSPRITE44 LDY #$08 L820A LDX #$64 JSR doWAIT2 DEY BNE L820A LDA #$00 STA $60 SEC LDA $61 SBC #$0E STA $61 LDA #$38 STA $70 L8221 DEC $59 BNE L8237 LDA #$06 STA $59 CLC LDA $60 ADC #$02 STA $60 CMP #$A0 BCS L8258 JSR L8259 L8237 JSR doWAIT DEC $80 BNE L8255 LDA #$07 STA $80 JSR L7D8D JSR eraseSPRITE44 CLC LDA $70 ADC #$02 STA $70 JSR L7D8D JSR L88A2 L8255 JMP L8221 L8258 RTS L8259 INC $66 LDA $66 AND #$03 ASL TAX LDA L82D8,X LDY L82D8+1,X STA L827A+1 STY L827A+2 LDA $61 STA zpY1 LDA $60 STA zpX1 JSR calcXYHGR LDY #$4F L827A LDA $0666,Y STA L7E70,Y DEY BPL L827A LDA #$14 STA zpSPRHEIGHT LDA zpXBIT BEQ L8292 L828B JSR L82B1 DEC zpXBIT BNE L828B L8292 JSR setHGRADDRESS LDX zpXBIT LDY zpXCOL LDA #$04 STA zpTEMP2 L829D LDA L7E70,X STA (zpHGR),Y INX INY DEC zpTEMP2 BNE L829D STX zpXBIT INC zpY1 DEC zpSPRHEIGHT BNE L8292 RTS L82B1 LDX #$4C L82B3 ASL L7E70,X ASL L7E70,X ROL L7E71,X ASL L7E71,X ROL L7E72,X ASL L7E72,X ROL L7E73,X ROR L7E72,X ROR L7E71,X ROR L7E70,X DEX DEX DEX DEX BPL L82B3 RTS L82D8 DA L82E0 DA L8330 DA L8380 DA L8330 L82E0 HEX 00000000007E0100407F0700607F0F00 HEX 707F1F00787F3F00787F3F007C7F7F00 HEX 7C7F7F007C7F7F007C7F7F007C7F7F00 HEX 7C7F7F007C7F7F00787F3F00787F3F00 HEX 707F1F00607F0F00407F0700007E0100 L8330 HEX 00000000007E0100407F0700607F0F00 HEX 707F1F00787F3F00787F3F007C7F1F00 HEX 7C7F03007C3F00007C0F00007C3F0000 HEX 7C7F03007C7F1F00787F3F00787F3F00 HEX 707F1F00607F0F00407F0700007E0100 L8380 HEX 00000000007E0100407F0700607F0300 HEX 707F0100787F0000783F00007C1F0000 HEX 7C0F00007C0700007C0300007C070000 HEX 7C0F00007C1F0000783F0000787F0000 HEX 707F0100607F0300407F0700007E0100 *----------------------------------- * PLAY CARTOON 2 *----------------------------------- playCARTOON2 JSR clearHGR JSR setHGR JSR initCARTOON L83D9 DEC $59 BNE L840C LDA #$28 STA $59 LDA #$80 LDY #$7C LDX #$81 JSR cartoonVLINE LDA #$81 LDY #$7C LDX #$81 JSR cartoonVLINE JSR L7D80 JSR eraseSPRITE44 SEC LDA $60 SBC #$02 STA $60 CMP #$10 BCC L847D JSR L7D80 INC $66 JSR L79A4 L840C JSR doWAIT DEC $80 BNE L83D9 LDA #$21 STA $80 LDA $70 CMP #$71 BEQ L83D9 JSR L7D8D JSR eraseSPRITE44 SEC LDA $70 SBC #$02 STA $70 JSR L7D8D JSR L88A2 LDA $70 CMP #$7B BCS L83D9 CMP #$71 BEQ L844F SBC #$73 TAX LDA #$A0 STA $80 LDA L847E,X LDY L847F,X LDX #$7F JSR cartoonVLINE JMP L83D9 L844F JSR L7D8D JSR eraseSPRITE44 JSR L7D8D CLC LDA zpX1 ADC #$0A STA zpX1 JSR eraseSPRITE44 JSR L7D8D JSR L88A2 LDA #$74 LDY #$7D LDX #$7F JSR cartoonVLINE LDA #$76 LDY #$7E LDX #$7F JSR cartoonVLINE JMP L83D9 L847D RTS L847E DB $79 L847F DB $7B DB $7B DB $7C DB $7D DB $7D DB $7F DB $7E *----------------------------------- * PLAY CARTOON 3 *----------------------------------- playCARTOON3 JSR clearHGR JSR setHGR JSR initCARTOON L848F DEC $59 BNE L84B0 LDA #$26 STA $59 JSR L7D80 JSR eraseSPRITE44 SEC LDA $60 SBC #$02 STA $60 CMP #$20 BCC L84DD JSR L7D80 INC $66 JSR L79A4 L84B0 JSR doWAIT DEC $80 BNE L848F LDA #$21 STA $80 JSR L7D8D JSR eraseSPRITE44 SEC LDA $70 SBC #$02 STA $70 JSR L7D8D JSR L88A2 CLC LDA $70 ADC #$03 LDY #$7D LDX #$7F JSR cartoonVLINE JMP L848F *--- Play 2nd part of the cartoon L84DD JSR L7D8D JSR eraseSPRITE44 LDY #$08 L84E5 LDX #$64 JSR doWAIT2 DEY BNE L84E5 LDA #$37 STA $70 LDA #$10 STA $60 LDA #$02 STA $62 L84F9 DEC $59 BNE L8519 LDA #$22 STA $59 JSR L7D80 JSR eraseSPRITE44 LDA $60 CMP #$B0 BCS L8549 ADC #$02 STA $60 JSR L7D80 INC $66 JSR L79A4 L8519 JSR doWAIT DEC $80 BNE L8546 LDA #$27 STA $80 JSR L7D8D JSR eraseSPRITE54 CLC LDA $70 ADC #$02 STA $70 JSR L7D8D LDA $66 AND #$02 TAX LDA L854A,X LDY L854A+1,X STA zpPTR2 STY zpPTR2+1 JSR L7E1F L8546 JMP L84F9 L8549 RTS L854A DA L856C DA L854E L854E DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $61 DB $05 DB $00 DB $23 DB $07 DB $00 DB $33 DB $02 DB $00 DB $1E DB $00 DB $00 DB $0C DB $00 DB $00 L856C DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $00 DB $07 DB $00 DB $4E DB $05 DB $00 DB $6F DB $00 DB $00 DB $39 DB $00 DB $00 DB $30 DB $00 DB $00 DB $60 DB $60 *----------------------------------- * PACMAN IS TRAPPED (DEAD CODE) *----------------------------------- L858C JSR clearHGR JSR setHGR LDA #$80 STA $1E LDA #$00 LDY #$7A LDX #$51 JSR cartoonHLINE LDA #$00 LDY #$7A LDX #$5E JSR cartoonHLINE LDA #$88 LDY #$FC LDX #$51 JSR cartoonHLINE LDA #$88 LDY #$FC LDX #$5E JSR cartoonHLINE LDA #$7A LDY #$00 LDX #$51 JSR cartoonVLINE LDA #$88 LDY #$00 LDX #$51 JSR cartoonVLINE LDA #$7A LDY #$5E LDX #$BE JSR cartoonVLINE LDA #$88 LDY #$5E LDX #$BE JSR cartoonVLINE JSR initCARTOON LDA #$02 STA $66 LDA #$04 STA $E0 L85E9 JSR L8712 DEC $E0 BNE L85E9 LDA #$81 STA $60 STA $84 STA $98 LDA #$31 STA $AC LDA #$D1 STA $C0 LDA #$57 STA $61 STA $AD STA $C1 LDA #$07 STA $85 LDA #$A7 STA $99 JSR L7D80 JSR L79A4 L8616 LDA #$04 STA $E0 L861A JSR L86FC DEC $80 BNE L8662 LDA #$12 STA $80 JSR L7D8D JSR eraseSPRITE44 LDA $E0 CMP #$03 BCS L8649 CMP #$02 BEQ L863F CLC LDA $71 ADC #$02 STA $71 JMP L865C L863F LDA $71 SEC SBC #$02 STA $71 JMP L865C L8649 BEQ L8655 SEC LDA $70 SBC #$02 STA $70 JMP L865C L8655 CLC LDA $70 ADC #$02 STA $70 L865C JSR L7D8D JSR L88A2 L8662 JSR L8712 DEC $E0 BNE L861A LDA $85 CMP #$43 BCC L8616 JSR L7CF0 LDA #$8D LDY #$8F LDX #$57 JSR cartoonHLINE LDX #$50 JSR doWAIT2 JSR L7D80 JSR eraseSPRITE44 LDA #$01 STA $62 JSR L7D80 JSR L79A4 JSR L7CF0 LDA #$81 LDY #$49 LDX #$4C JSR cartoonVLINE LDX #$50 JSR doWAIT2 JSR L7D80 JSR eraseSPRITE44 LDA #$03 STA $62 JSR L7D80 JSR L79A4 JSR L7CF0 LDA #$73 LDY #$75 LDX #$57 JSR cartoonHLINE LDX #$50 JSR doWAIT2 LDA #$00 STA $62 JSR L7D80 JSR eraseSPRITE44 JSR L7D80 JSR L79A4 JSR L7CF0 LDA #$81 LDY #$63 LDX #$66 JSR cartoonVLINE LDY #$19 L86E0 NOP LDX #$64 JSR doWAIT2 DEY BNE L86E0 RTS L86EA LDA #$04 STA $E0 L86EE JSR L86FC JSR L8763 JSR L8712 DEC $E0 BNE L86EE RTS L86FC LDY $E0 LDX L870D,Y LDY #$13 L8703 LDA $84,X STA |$0070,Y DEX DEY BPL L8703 RTS L870D DB $00 DB $13 DB $27 DB $3B DB $4F L8712 LDY $E0 LDX L870D,Y LDY #$13 L8719 LDA |$0070,Y STA $84,X DEX DEY BPL L8719 RTS L8723 DB $0A DB $0A DB $09 DB $08 DB $08 DB $07 DB $07 DB $07 DB $07 DB $06 DB $06 DB $06 DB $06 DB $05 DB $05 DB $04 L8733 DB $13 DB $13 DB $11 DB $10 DB $10 DB $0D DB $0D DB $0C DB $0C DB $09 DB $09 DB $09 DB $09 DB $07 DB $06 DB $05 L8743 DB $13 DB $13 DB $12 DB $11 DB $11 DB $10 DB $10 DB $0F DB $0F DB $0D DB $0D DB $0D DB $0D DB $0B DB $0B DB $07 L8753 DB $04 DB $04 DB $04 DB $04 DB $03 DB $03 DB $03 DB $03 DB $03 DB $02 DB $02 DB $02 DB $02 DB $02 DB $01 DB $01 *----------------------------------- * *----------------------------------- L8763 DEC $80 BEQ L8768 RTS L8768 LDA $E4 BEQ L8780 LDA $E1 BNE L8772 DEC $E2 L8772 DEC $E1 CLC LDA $E1 ADC $E2 BNE L8780 BCS L8780 JSR L6D49 L8780 JSR getMAXRANK15 TAX LDA $78 BNE L8793 LDA $79 BNE L879A LDA L8723,X STA $80 BNE L879F L8793 LDA L8743,X STA $80 BNE L879F L879A LDA L8753,X STA $80 L879F CLC LDA $E0 ROR TAX DEX LDA $72 AND #$02 BEQ L87AF LDA $71 BNE L87B1 L87AF LDA $70 L87B1 AND #$02 BNE L87BA TXA ADC $80 STA $80 L87BA LDA $7A BEQ L87C0 ASL $80 L87C0 LDA $73 TAX JSR L75F1 LDY #$00 LDA (zpPTR2),Y CMP $70 BNE L87D5 INY LDA (zpPTR2),Y CMP $71 BEQ L87ED L87D5 LDA $74 TAX JSR L75F1 LDY #$00 LDA (zpPTR2),Y CMP $70 BNE L87EA INY LDA (zpPTR2),Y CMP $71 BEQ L87ED L87EA JMP L8866 L87ED STX $73 JSR L8C50 INC $77 LDY $77 LDA ($75),Y CMP $72 STA $72 BEQ L880B LDA $79 BNE L880B JSR getMAXRANK15 TAX LDA L8733,X STA $80 L880B LDY $72 INY INY LDA (zpPTR2),Y STA $74 LDA $73 CMP #$17 BEQ L8839 CMP #$18 BEQ L8839 CMP #$1A BEQ L8854 CMP #$1D BNE L8866 LDA #$15 STA $7B LDA #$00 STA $7D LDA $72 CMP #$02 BNE L8862 L8833 LDA #$01 STA $7A BNE L8866 L8839 LDA $79 BEQ L8866 LDA #$00 STA $79 LDA #$01 STA $81 JSR L7D8D JSR eraseSPRITE44 JSR L6D30 JSR L6DA1 JMP L8866 L8854 LDA #$06 STA $7B LDA #$00 STA $7D LDA $72 CMP #$03 BEQ L8833 L8862 LDA #$00 STA $7A L8866 LDA $7A BEQ L886D JMP L8A9C L886D LDA $81 BEQ L8874 JMP L8988 L8874 JSR L7D8D JSR eraseSPRITE44 CLC LDA $72 ROR BNE L888C LDA $71 BCS L8888 ADC #$02 BCC L889A L8888 SBC #$02 BCS L889A L888C LDA $70 BCS L8894 ADC #$02 BCC L8896 L8894 SBC #$02 L8896 STA $70 LDA $71 L889A STA $71 STA zpY1 LDA $70 STA zpX1 L88A2 LDA $E0 ASL TAX LDA $78 BEQ L88BC LDA $E2 BNE L88BA LDA $E1 CMP #$80 BCS L88BA LDX #$06 AND #$10 BEQ L88C2 L88BA LDX #$00 L88BC LDA $79 BEQ L88C2 LDX #$0A L88C2 LDA zpMONITOR BEQ L88D3 CLC TXA ROR TAY LDA L88E1,Y STA $1E TXA ADC #$0C TAX L88D3 LDA sprGHOSTS,X LDY sprGHOSTS+1,X JSR L6A20 LDA $81 BEQ L88E6 RTS L88E1 DB $01 DB $01 DB $00 DB $00 DB $00 L88E6 LDA $79 BNE L88ED JSR L8B34 L88ED CLC LDA $72 ROR BEQ L8929 BCS L890F LDA #$02 ADC $7D CMP #$06 BNE L8901 LDA #$00 INC $7B L8901 STA $7D CMP #$00 BNE L890E DEC $7B JSR L895F INC $7B L890E RTS L890F LDA $7D SBC #$02 CMP #$FE BNE L891B LDA #$04 DEC $7B L891B STA $7D CMP #$00 BNE L890E INC $7B JSR L895F DEC $7B RTS L8929 BCS L8945 LDA $7E ADC #$02 CMP #$06 BNE L8937 LDA #$00 INC $7C L8937 STA $7E CMP #$00 BNE L890E DEC $7C JSR L895F INC $7C RTS L8945 LDA $7E SBC #$02 CMP #$FE BNE L8951 LDA #$04 DEC $7C L8951 STA $7E CMP #$00 BNE L890E INC $7C JSR L895F DEC $7C RTS L895F JSR L8B13 LDY #$00 LDA (zpPTR2),Y ROR BCC L8980 LDA $7B JSR L8981 CLC ADC #$3B STA zpX1 LDA $7C JSR L8981 CLC ADC #$05 STA zpY1 JSR drawNORMALDOT L8980 RTS L8981 ASL ; *2 STA zpTEMP4 ASL ; *4 ADC zpTEMP4 ; +6 RTS L8988 DEC $82 BNE L89DA LDY $77 LDA $E0 ROR BCC L89A6 LDA $72 CMP #$00 BNE L899E L8999 LDA #$01 INY STA ($75),Y L899E LDA #$01 INY STA ($75),Y JMP L89C7 L89A6 LDA $72 CMP #$01 BNE L89B1 INY LDA #$00 STA ($75),Y L89B1 LDA $E0 CMP #$02 BNE L89BF LDA #$02 INY STA ($75),Y JMP L8999 L89BF LDA #$03 INY STA ($75),Y JMP L8999 L89C7 INY LDA $E9 BNE L89D7 LDA #$03 STA ($75),Y INY LDA #$FF STA ($75),Y BNE L89DA L89D7 JSR L6EA5 L89DA LDA $E0 ROR BCC L89E1 BCS L8A05 L89E1 ROR BCC L89E8 LDA #$7F BNE L89EA L89E8 LDA #$99 L89EA CMP $70 BNE L8A05 LDA $71 CMP #$55 BNE L89FF L89F4 INC $77 LDY $77 LDA ($75),Y STA $72 L89FC JMP L8874 L89FF CMP #$5D BEQ L89F4 BNE L89FC L8A05 LDA $70 CMP #$8B BNE L89FC LDA $71 CMP #$5D BEQ L89F4 CMP #$55 BEQ L89F4 CMP #$47 BNE L89FC JSR drawGHOSTDOOR LDA #$17 STA $73 LDA #$18 STA $74 LDA #$0D STA $7B LDA #$0B STA $7C LDA #$02 STA $7D LDA #$00 STA $7E LDA #$00 STA $81 BEQ L89F4 *----------------------------------- * *----------------------------------- L8A3A DA $0000 DA L8A44 DA L8A53 DA L8A61 DA L8A6F L8A44 HEX 0300030101020202020201020003FF L8A53 HEX 03030000000300000303000201FF L8A61 HEX 03030003010103000200030002FF L8A6F HEX 03030000020002000002020003FF *----------------------------------- * DRAW GHOST DOOR *----------------------------------- drawGHOSTDOOR LDA #$87 STA zpX1 LDA #$93 STA zpX2 LDA #$4D STA zpY1 JSR drawHLINE LDA #$87 STA zpX1 LDA #$93 STA zpX2 LDA #$4E STA zpY1 JSR drawHLINE RTS *----------------------------------- * *----------------------------------- L8A9C JSR L7D8D JSR eraseSPRITE44 LDA $70 CMP #$60 BCC L8AE0 LDA $72 ROR BCC L8ABC LDA $70 SBC #$02 STA $70 STA zpX1 L8AB5 LDA $71 STA zpY1 JMP L88A2 L8ABC LDA $70 ADC #$02 STA $70 STA zpX1 CMP #$DD BNE L8AB5 LDA $74 STA $73 LDA #$1D STA $74 LDA #$3D STA $70 STA zpX1 LDA #$00 STA $7B LDA #$00 STA $7D BEQ L8AB5 L8AE0 LDA $72 ROR BCS L8AEF LDA $70 ADC #$02 STA $70 STA zpX1 BNE L8AB5 L8AEF LDA $70 SBC #$02 STA $70 STA zpX1 CMP #$3B BNE L8AB5 LDA $74 STA $73 LDA #$1A STA $74 LDA #$DB STA $70 STA zpX1 LDA #$1C STA $7B LDA #$00 STA $7D BEQ L8AB5 L8B13 LDA #>theBOARD STA zpPTR2+1 LDA $7B ASL ASL ASL ASL BCC L8B23 INC zpPTR2+1 INC zpPTR2+1 L8B23 ASL BCC L8B28 INC zpPTR2+1 L8B28 CLC ADC $7C ADC #