; +-------------------------+ ; | POPCORN! | ; | | ; | Mark and Cathy Sloatman | ; | | ; | ANALOG Computing | ; +-------------------------+ ; ;SYSTEM EQUATES ; BOOT = $09 DOSINI = $0C ATRACT = $4D VDSLST = $0200 DMA = $022F SDLSTL = $0230 GPRIOR = $026F STICK0 = $0278 STRIG = $0284 PCOLR0 = $02C0 PCOLR2 = $02C2 COLOR1 = $02C5 COLOR2 = $02C6 CHSET = $02F4 CH = $02FC HPOSP0 = $D000 HPOSP1 = $D001 HPOSP2 = $D002 P1PF = $D005 SIZEP1 = $D009 SIZEP2 = $D00A COLPM0 = $D012 COLPM1 = $D013 COLPF0 = $D016 COLPF1 = $D017 COLPF2 = $D018 COLBK = $D01A PRIOR = $D01B GRACTL = $D01D HITCLR = $D01E CONSOL = $D01F AUDF1 = $D200 AUDC1 = $D201 AUDF2 = $D202 AUDC2 = $D203 AUDF3 = $D204 AUDC3 = $D205 AUDCTL = $D208 RAND = $D20A SKCTL = $D20F PMBASE = $D407 CHBASE = $D409 WSYNC = $D40A NMIEN = $D40E CHORG = $E000 XITVBV = $E462 SETVBV = $E45C ; ;P/M AND SCRN MEMORY USE ; CHARORG = $3000 CHARORG2 = CHARORG+$0100 CHARORG3 = CHARORG+$0200 SCRN = $1000 SCORELN = SCRN-$2A CANESCRN = SCRN+$0EB0 SHOWLEV = SCORELN+$1B SHOWLIFE = SHOWLEV+$04 ; PM = $00 PM0 = PM+1234 PM1 = PM+1485 PM2 = PM+1751 POSITION = $0600 ; ;ZERO PAGE VARIABLES ; *= $80 CLR *= *+2 CATCHSND *= *+1 CATCHSND1 *= *+1 SNDFLAGPOP *= *+1 SNDDELAY *= *+1 HORIZ *= *+1 CHR *= *+1 CHAROFS *= *+2 CHECK *= *+1 HPOSCANE *= *+1 FREQ *= *+1 XFLAGPOP *= *+1 DELAYPOP *= *+1 LENGTH *= *+1 SNGFLAG *= *+1 HPOS1 *= *+1 XREG *= *+1 SETDELAY *= *+1 TEMP *= *+2 TEMP1 *= *+1 TEMP2 *= *+1 TEMPA *= *+1 TIMER *= *+1 LEVEL *= *+1 NUMBER *= *+1 HPOS *= *+1 SONGXREG *= *+1 VERT *= *+1 MISSPOP *= *+1 PLUS *= *+1 LOADCHAR *= *+1 LIVES *= *+1 LASTPOP *= *+1 PAUSEON *= *+1 OFFSET *= *+2 CHAR *= *+2 ; ;INITALIZE GAME ; *= $2000 ;RUN ADDRESS ; START LDA #1 ;TELL SYSTEM STA BOOT ;DSK BOOT OCCURED ; ;FOR CASSETTE USERS ; LDA START ;START THE STA DOSINI+1 ;GAME OVER! LDA #14 ;SET UP COVER STA COLOR1 ;COLORS LDA #50 STA COLOR2 JSR INITVBLANK ;TURN ON VBI LDA #0 STA DMA ;CLEANER SWITCHING STA HPOS ;PLAYERS OFF SCRN STA AUDCTL ;TURN OFF SOUND STA AUDC1 STA AUDC2 LDX #41 ;41 BYTES TO CLR CLRZERO STA $80,X ;CLR DEX ;ZERO PAGE BPL CLRZERO ;VARIABLES JSR ERASEPOPCORN ;CLR SCRN JSR CLRPM ;CLR PM GRAPHICS ; ;CLR TITLE PAGE ; LDA SCORELN ;HIGH BYTE STA CLR+1 LDX #5 ;5 PAGES JSR CLR0 ;CLR IT! LDX #0 PUTPOP LDA POPCORNSCRN,X ;PUTPOP STA SCRN+$78,X ;AND PUTPOP1 INX ;PUTS "POPCORN" BNE PUTPOP ;TITLE PUTPOP1 LDA POPCORNSCRN+$0100,X STA SCRN+$0178,X ;ON SCRN INX CPX #24 BNE PUTPOP1 LDX #0 PUTCREDS LDA MESSAGE,X ;GIVES STA SCRN+$02FF,X ;CATHY INX ;AND I CPX #27 ;THE GLORY! BNE PUTCREDS LDX #23 PUTSCORE LDA MESSAGE1,X ;PUTS "SCORE" STA SCORELN+1,X ;AND "LEVEL" DEX ;ON SCRN BNE PUTSCORE ;NOT DONE JSR PUTCHAR ;REDEFINES CHAR. SET LDA >CHARORG ;TELL ANTIC STA CHSET ;WHERE NEW CHAR. SET IS LDA DLI ;BYTES OF DISPLAY STA VDSLST+1 ;LIST INTERRUPT LDA COVER STA SDLSTL+1 LDA #192 ;ENABLE DISPLAY STA NMIEN ;AND VB INTERRUPTS LDA #58 ;TURN SCRN STA DMA ;BACK ON JSR SETSCORE ;PUT ZEROS IN SCORE LDA #1 ;START AT STA LEVEL ;LEVEL ONE LDA #2 ;FALLING POPCORN STA LOADCHAR ;CHRS LDA #17 ;INTERNAL CODE STA SHOWLEV ;FOR "0" LDA #3 ;3 LIVES STA LIVES STA SKCTL ;INIT SOUND JSR SHOWLIVES ;PUT LIVES ON SCRN ; ;ALL SET, WANT TO PLAY A GAME? ; WAIT LDA CONSOL ;START KEY CMP #6 ;PRESSED? BEQ INIT ;YES! CMP #5 ;NO-HOW ABOUT SELECT? BNE DFD ;NO,CHECK TRIGGER STA LEVEL ;YES, START AT LDA #21 ;LEVEL 5 STA SHOWLEV ;SHOW IT! DFD LDA STRIG ;TRIGGER PRESSED? BNE WAIT ;NO DO IT AGAIN INIT LDA #30 ;DEBOUNCE JSR LONGPAUSE INIT1 LDA CONSOL ; CMP #6 ;START KEY RELEASED? BEQ INIT1 ;NO! ; ;SET UP GAME ; JSR CLRSCRN JSR WRITEPM ;WRITE PLAYERS LDA #136 ;SHUT OFF STA SONGXREG ;SONG STA SIZEP2 LDA #64 ;DISABLE DLI'S STA NMIEN LDA #1 ;PRIORITY STA GPRIOR STA SIZEP1 LDA #3 ;ENABLE PM STA GRACTL ;GRAPHICS LDA >PM ;GET PM ADDRESS STA PMBASE ;AND TELL ANTIC JSR SETDL ;SET UP GAME DLI'S JSR WRITECOLORS ;SET UP COLORS LDA #119 ;CENTER OF SCRN STA HPOS STA HITCLR ;CLR COLLISIONS LDY LEVEL ;GET LEVEL LDA DELAYTABLE,Y ; AND DELAY NO. STA SETDELAY ;NEW SPEED OF GAME ; ;PRINT POT (BODY-LEFT SIDE) ; LDA #4 ;CHR VALUE LDX #18 ;X POSITION LDY #9 ;Y POSITION JSR PRINTCHR ;PRINT IT! LDA #6 ;NOW THE RIGHT LDX #20 ;SIDE LDY #9 JSR PRINTCHR ;DITTO! ; ;ACTUAL GAME LOOP ; GAME LDA CONSOL ;START KEYPRESSED? CMP #6 BNE RR1 ;NO ERT LDA CONSOL ;YES, NOW CMP #6 ;WAIT FOR BEQ ERT ;RELEASE JMP START ;GOTO TITLE PAGE ; RR1 LDA CH ;SPACE BAR PRESSED? BMI CONT ;NOPE! PAUSEING LDA #255 ;YES , LETS PAUSE STA CH ;CLR KEYBOARD LDA PAUSEON ;GET FLAG EOR $01 ;AND SWICH IT STA PAUSEON BEQ CONT ;IF ZERO THEN CONT. CHKPAUSE LDA CH ;PAUSE UNTIL BMI CHKPAUSE ;TOUCHED AGAIN JMP PAUSEING CONT JSR DELAY ;CONT. WITH GAME JSR CHARPOLL ;MOVE POPCORN LDA TIMER ;LENGTH OF LID OPEN BNE WWQ ;STILL COUNTING DOWN LDA RAND ;MAYBE LETS POP SOME POPCORN CMP #20 BCC AA ;<20 BCS WWA ;>=20 WWQ DEC TIMER BNE OUT4 ;STILL NOT READY TO POP ; ;PRINT LID DOWN - LEFT SIDE ; WWA LDA #8 ;CHR VALUE LDY #1 ;Y POSISTION LDX #18 ;X POSITION JSR PRINTCHR ;PRINT LDA #10 ;RIGHT SIDE LDY #1 LDX #20 JSR PRINTCHR ;PRINT OUT4 JMP OUT6 ; ;PRINT LID UP - RIGHT SIDE ; AA LDA #12 ;CHAR. VALUE LDX #18 ;X POS. LDY #1 ;Y POS. JSR PRINTCHR LDA #14 ;LEFT SIDE LDX #20 LDY #1 JSR PRINTCHR LDA #1 ;MAKE A VB STA SNDFLAGPOP ;"POP" SOUND LDA LEVEL ;RESETS TIMER ASL A ;SO THAT LID CLC ;POPPING DOESN'T ADC #4 ;INCREASE TOO STA TIMER ;MUCH IN SPEED LDX #0 CKCHAR LDA POSITION,X ;ANY POPCORNS NEEDED? BEQ NN4 ;YES INX ;NOT YET INX CPX #12 ;DONE CHECKING BEQ OUT6 ;YES,NONE NEEDED JMP CKCHAR ;NO, CHECK AGAIN ; NN4 STX TEMP ;SAVE X REG LDA LEVEL ;GET LEVEL ASL A ;MULT. BY 2 STA TEMP1 ;STORE IT LDX #1 ;GET POSITION NNX LDA POSITION,X BEQ NEXTONE ;SKIP CHECK CMP TEMP1 ;LEVEL*2 BCC OUT6 ;PM+1024 ;HIGH STA CLR+1 ;BYTES LDX #5 ;5 PAGES JMP CLR0 ;CLR THEM! ; ;PUT PLAYERS INTO MEMORY ; WRITEPM LDA PMDATA0,X ;GET STA PM0,X ;PLAYER LDA PMDATA1,X ;DATA STA PM1,X ;AND PUT LDA PMDATA2,X ;INTO P/M STA PM2,X ;MEMORY INX CPX #15 ;15 BYTES BNE WRITEPM ; ;FILL COLOR REGS. ; WRITECOLORS LDX #7 ;SET UP COLORS LDA COLORTABLE,X STA PCOLR0,X ;COLORS DEX BPL COLORS RTS ; ;CLR GAME SCRN ; CLRSCRN LDA SCRN ;CLR STA CLR+1 ;SCRN FOR PLAY LDX #15 JMP CLR0 ; COLORTABLE .BYTE 58,72,15,0,40,14,0 ; ;SET UP DL AND DLI'S ; SETDL LDA DLIST ;LIST IS STA SDLSTL+1 LDA DLI1 ;INTERRUPT IS STA VDSLST+1 LDA #1 ;1/60 OF A SEC. JSR LONGPAUSE ;WAIT UNTIL LDA #192 ;NEXT VBI TO STA NMIEN ;ENABLE DLI RTS ; ;LOAD REDEFINED CHR SET ; PUTCHAR LDX #0 PUTCHAR1 LDA CHORG,X ;LOAD STA CHARORG,X ;CHR LDA CHORG+$0100,X ;DATA AND PUT STA CHARORG2,X ;INTO LDA CHORG+$0200,X ;REDEFINED STA CHARORG3,X ;CHR SET INX BNE PUTCHAR1 REDEFINE LDA CHARDATA,X ;NOW STA CHARORG3,X ;CHANGE INX ;CHRS TO CPX #161 ;WHAT WE WANT BNE REDEFINE ; ; DELAY LDY #0 LDX #32 ;SLIGHT DELAY DELAY1 INY ;USED MAINLY CPY SETDELAY ;TO TIME BNE DELAY1 ;FALLING POPCORN LDY #0 DEX BNE DELAY1 RTS ; DELAYTABLE .BYTE 0,200,150,120,100,80,70,65,60 .BYTE 55,50,45,40,35,30,25,22,18,13,10 ; PAUSE TYA ;A LONGER PAUSE PHA ;THAT SAVES THE LDA #0 ;Y REG TAY PAUSE1 CLC ADC #1 CMP #22 BEQ DONE7 PAUSE2 INY BNE PAUSE2 JMP PAUSE1 ; DONE7 PLA TAY RTS ; ;JIFFY TIMER ; LONGPAUSE STA TEMP ;A REG LDA #0 ;CONTAINS JIFFIES STA 20 ;(1/60 SEC) FOR WAIT1 LDA 20 ;LENGTH OF PAUSE CMP TEMP BNE WAIT1 RTS ; ;GET A RANDOM NUMBER ; RANDOM_ STA TEMPA LDA RAND ;RANDOM NUMBER AND TEMPA ;KNOCK OFF STY TEMPA ;THEN CLC ;THEN ADD ADC TEMPA ;SPECIFIED NUMBER RTS ; ;TAKE POPCORN OFF OF SCRN ; ERASEPOPCORN LDA #15 ;BLANK CHAR STA LOADCHAR JSR CHARPOLL ;ALL OFF SCRN! LDA #0 TAX LOOP9A STA POSITION,X ;NOW CLR INX ;POS. TABLE CPX #12 BCC LOOP9A LDA #2 STA LOADCHAR RTS ;ALL DONE ; ;YOU GET TO SEE THE BOSS! ; SEEBOSS LDA #64 ;DISABLE DLI'S STA NMIEN JSR CLRPM LDA SCRN STA CLR+1 LDX #5 JSR CLR0 LDX #48 ;CHANGE PLAYER 2 LDA #126 ;TO DOOR WRITEDOOR STA PM+1694,X DEX BPL WRITEDOOR LDX #0 REDEFINE1 LDA BOSSCHAR1,X ;ALTERNATE STA CHARORG,X ;CHR INX ;SET CPX #48 BNE REDEFINE1 LDX #0 REDEFINE2 LDA BOSSCHAR2,X STA CHARORG2,X INX CPX #152 BNE REDEFINE2 LDA #1 ;CHANGE PRIORITY STA GPRIOR LDA #3 ;PLAYER 2 SIZE STA SIZEP2 LDA #228 ;PLAYER2 COLOR STA PCOLR2 LDA #136 STA COLOR1 LDA BOSSFLAG BNE DONTCHANGE LDA #13 ;RND(0)*13+1 LDY #1 JSR RANDOM_ ASL A ;*16 ASL A ASL A ASL A CLC ADC #14 STA COLOR2 ;COLOR OF LETTERS DONTCHANGE LDA BOSSDLIST ;LIST STA SDLSTL+1 LDA BOSSDLI STA VDSLST+1 LDA #192 ;ENABLE INTERR. STA NMIEN LDA SCRN STA TEMP+1 INC TEMP+1 ;ADD 255 CLC LDA TEMP ADC #93 ;+93 = STA TEMP ;SCRN+348 BCC DC1 INC TEMP+1 DC1 LDA BOSSFLAG BNE LOSEFACE FINDNUM LDA RAND ;GET MESSAGE CMP #6 ;RANDOM NO. BCS FINDNUM TAX LDA BOSSTABLE,X ;FIRST BYTE STA BOSSXREG ;OF MESSAGE LDA #37 ;HAPPY FACE JMP STOREFACE ; LOSEFACE LDA #0 ;SAD SONG STA BOSSXREG STA COLOR2 ;BLACK MESSAGE LDA #41 ;SAD FACE STOREFACE STA FACE LDX #0 LOOPX LDY #0 ;PUT CHRS LDA BOSS1,X ;THAT MAKE STA (TEMP),Y ;UP BOSS ON INX ;SCRN INY ;(2 WIDE*9 HIGH) LDA BOSS1,X ;NEXT CHAR STA (TEMP),Y ;PUT ON SCRN CLC LDA TEMP ADC #20 ;20 BYTES PER LINE STA TEMP ;(ADD TO OFFSET) BCC LPX INC TEMP+1 LPX INX CPX #10 ;9 HIGH BNE LOOPX LDX #0 FRAMEDOOR LDA #1 STA SCRN+348,X ;LEFT SIDE LDA #2 STA SCRN+351,X ;RIGHT SIDE CLC TXA ADC #20 ;20 BYTES PER LINE TAX CPX #100 ;DONE? BNE FRAMEDOOR ;NO! LDA #3 ;NOW FRAME IN STA SCRN+329 ;TOP OF DOOR STA SCRN+330 LDA #4 STA SCRN+328 LDA #5 STA SCRN+331 LDA #112 STA HPOSP2 ;CENTER DOOR JSR LONGPAUSE LDA #100 ;MAKE MECH. STA AUDC1 ;SOUND FOR DOOR STA AUDC2 ;BEAT VOICES LDA #24 ;ONE AND TWO STA AUDF1 ;TOGETHER LDA #25 STA AUDF2 LDA #113 STA TEMP1 OPEN JSR PAUSE LDA TEMP1 STA HPOSP2 ;MOVE DOOR CMP #135 ;DONE? BEQ DONEA ;YES! JSR PAUSE INC TEMP1 JSR PAUSE JMP OPEN ; DONEA LDA #0 ;SHUT OFF SOUND STA AUDC1 STA AUDC2 LDA #30 JSR LONGPAUSE LDA BOSSFLAG BNE PLAYSAD ;WHICH SONG? LDA #138 ;HAPPY! BNE SONGSTART ; PLAYSAD LDA #153 ;SAD SONGSTART STA SONGXREG ;NOW PLAY LDY FACE ;SONG AND PUT STY SCRN+349 ;CORRECT INY ;FACE ON SCRN STY SCRN+350 INY ;EACH FACE MADE STY SCRN+369 ;UP OF FOUR INY ;CHRS STY SCRN+370 LDX BOSSXREG ;WHICH MESSAGE? LDY #0 PRINT1 LDA MESSAGE8,X STA SCRN+464,Y ;PUT ON SCRN CMP #129 ;INVERSE ! BEQ GOBACK ;NOT DONE! INX INY JMP PRINT1 ; GOBACK LDA #255 JSR LONGPAUSE LDA #0 STA DMA ;SHUT OFF DMA LDA #1 ;(CLEANER SWICHING) JSR LONGPAUSE ;PAUSE 1 JIFFY ; ;RESET TO ORIGINAL ; LDA #0 ;CLR VARIABLES STA HPOSP2 ;DOOR HORIZ STA SIZEP2 STA BOSSFLAG LDA #64 ;DISABLE STA NMIEN ;DLI'S JSR CLRPM ;PUT PROPER JSR WRITEPM ;PLAYERS BACK JSR PUTCHAR ;AND CHAR SET JSR WRITECOLORS JSR SETDL ;SET DISPLAY LIST LDX TEMPXREG ;GET BACK X AND LDY TEMPYREG ;Y REGS RTS ; TEMPXREG .BYTE 0 TEMPYREG .BYTE 0 BOSS1 .BYTE 33,34,35,36,109,110 .BYTE 111,112,113,114,1,1 ; ;MESSAGES WHEN SEEING THE BOSS ; MESSAGE8 DS 'YOURE FIRED!' .SBYTE ' GREAT JOB! ' .SBYTE ' WAY TO GO!' .SBYTE ' WOWEE! ' .SBYTE ' FANTASTIC!' .SBYTE 'LIKE, AWESOME!' .SBYTE ' GOOD WORK!' ; ; BOSSXREG .BYTE 0 BOSSFLAG .BYTE 0 ;HAPPY OR SAD BOSS BOSSTABLE .BYTE 13,25,36,46,57,71 FACE .BYTE 0 ;HAPPY OR SAD VALUE .BYTE 1,5,21,85 ; ;THEME SONG DATA ; SONG .BYTE 121,4,96,4,162,4,144,2 .BYTE 128,2,121,4,96,4,162,4 .BYTE 144,2,128,2,121,4,96,4 .BYTE 121,4,96,4,108,4,128,4 .BYTE 162,4,144,2,128,2,121,4 .BYTE 96,4,162,4,144,2,128,2 .BYTE 121,4,96,4,162,4,144,2 .BYTE 128,2,121,4,96,4,108,4 .BYTE 96,4,121,8 .BYTE 162,4,128,4,217,4,193 .BYTE 2,173,2,162,4,128,4 .BYTE 217,4,193,2,173,2,162,4 .BYTE 128,4,162,4,128,4,144,4 .BYTE 173,4,217,4,193,2,173,2 .BYTE 162,4,128,4,217,4,193,2 .BYTE 173,2,162,4,128,4,217,4 .BYTE 193,2,173,2,162,4,128,4 .BYTE 144,4,128,4,162,8,0,0 ; ;SONG VALUES WHEN CONGRADULATED! ; .BYTE 60,2,53,2,47,4,60,4,53 .BYTE 4,64,4,60,8,0 ; ;SONG WHEN YOU LOST THE GAME! ; .BYTE 81,2,81,6,81,8,108,4 .BYTE 96,6,121,16,243,16,0 ; ;SONG WHEN YOU LOSE 3 CHANCES ; .BYTE 243,8,217,4,204,12,217 .BYTE 12,243,2,255,2,243,2,255,2 .BYTE 243,8,217,4,243,8,0,0 ; ;DIDDLE WHEN A CHANCE IS GAINED ; .BYTE 33,2,37,2,33,2,37,2,0,0 ;POPCORN! IN BIG LETTERS ; POPCORNSCRN .BYTE 0,0,65,65,65,65,0,65 .BYTE 65,65,65,0,65,65,65,65 .BYTE 0,65,65,65,65,0,65,65 .BYTE 65,65,0,65,65,65,65,0 .BYTE 65,0,0,65,0,65,0,0 .BYTE 0,0,65,0,0,65,0,65 .BYTE 0,0,65,0,65,0,0,65 .BYTE 0,65,0,0,0,0,65,0 .BYTE 0,65,0,65,0,0,65,0 .BYTE 65,0,0,65,0,65,0,0 .BYTE 0,0,65,0,0,65,0,65 .BYTE 0,0,65,0,65,0,0,65 .BYTE 0,65,0,0,0,0,65,0 .BYTE 0,65,0,65,0,0,65,0 .BYTE 65,0,0,65,0,65,0,0 .BYTE 0,0,65,65,65,65,0,65 .BYTE 0,0,65,0,65,65,65,65 .BYTE 0,65,0,0,0,0,65,0 .BYTE 0,65,0,65,65,65,0,0 .BYTE 65,65,0,65,0,65,0,0 .BYTE 0,0,65,0,0,0,0,65 .BYTE 0,0,65,0,65,0,0,0 .BYTE 0,65,0,0,0,0,65,0 .BYTE 0,65,0,65,0,0,65,0 .BYTE 65,0,65,65,0,65,0,0 .BYTE 0,0,65,0,0,0,0,65 .BYTE 0,0,65,0,65,0,0,0 .BYTE 0,65,0,0,0,0,65,0 .BYTE 0,65,0,65,0,0,65,0 .BYTE 65,0,0,65,0,0,0,0 .BYTE 0,0,65,0,0,0,0,65 .BYTE 65,65,65,0,65,0,0,0 .BYTE 0,65,65,65,65,0,65,65 .BYTE 65,65,0,65,0,0,65,0 .BYTE 65,0,0,65,0,65,0,0 ; MESSAGE .SBYTE 'By Mark and ' .SBYTE 'Cathy Sloatman' ; MESSAGE1 .SBYTE ' SCORE LEVEL' ; ;DISPLAY LISTS ; ;TITLE PAGE ; COVER .BYTE 112,112,66 .WORD SCRN .BYTE 2,2,2,2,2,2,2,2 .BYTE 2,2,2,2,130,2,2,2 .BYTE 2,2,2,2,2,65 .WORD COVER ; ;SCRN WHEN SEEING BOSS ; BOSSDLIST .BYTE 112,112,112,70 .WORD SCRN .BYTE 6,6,6,6,6,6,6,6 .BYTE 6,6,6,6,6,6,6,6 .BYTE 6,6,6,6,134,6 .BYTE 6,112,65 .WORD BOSSDLIST ; ;GAME SCRN ; DLIST .BYTE 112,112,194 .WORD SCORELN .BYTE 77 .WORD SCRN .BYTE 13,13,13,13,13,13,13,13 .BYTE 13,13,13,13,13,13,13,13 .BYTE 13,13,13,13,13,13,13,13 .BYTE 13,13,13,13,13,13,13,13 .BYTE 13,13,13,13,13,13,13,13 .BYTE 13,13,13,13,13,13,13,13 .BYTE 13,13,13,13,13,13,13,13 .BYTE 13,13,13,13,13,13,13,13 .BYTE 13,13,13,13,13,13,13,13 .BYTE 13,13,13,13,13,13,13,13 .BYTE 13,13,13,13,13,13,141,13 .BYTE 13,13,13,141,13,13,141,65 .WORD DLIST ; ;DISPLAY LIST INTERRUPTS ; ;CHANGE SCORELINE COLOR ; DLI1 PHA LDA #218 STA WSYNC ;CLEAN BREAK STA COLPF2 ;NEW COLOR LDA # DLI2 STA VDSLST+1 PLA RTI ; ;CHANGE POT COLOR ; DLI2 PHA LDA #228 STA WSYNC ;CLEAN BREAK STA COLPM1 ;POT LDA PCOLR2 ;CANEHEAD COLOR STA COLPF0 ;PUT IN CANE LDA # DLI3 STA VDSLST+1 PLA RTI ; ;PUT A CUFF ON THE ARM ; DLI3 PHA LDA #10 STA WSYNC STA COLPM0 ;CUFF WHITE LDA #4 ;MAKE CANE PASS STA PRIOR ;BEFORE PLAYER LDA # DLI4 STA VDSLST+1 PLA RTI ; ;MAKE GREEN TABLE ; DLI4 PHA LDA #200 STA WSYNC STA COLBK ;BACKGRND LDA # DLI1 STA VDSLST+1 PLA RTI ; ;DLI FOR TITLE SCRN ; DLI PHA LDA #224 ;DEFAULT CHARSET STA WSYNC ;CLEAN BREAK STA CHBASE ;SWITCH CHAR SET LDA #10 ;NEW CHAR. COLOR STA COLPF1 LDA #0 ;BACKGRND STA COLPF2 PLA RTI ; ;FOR BOSS'S SCRN ; BOSSDLI PHA LDA #224 STA WSYNC STA CHBASE ;CHBAS HARDWARE LDA #8 ;GREY FLOOR STA COLBK PLA RTI ; ;DATA FOR NEW CHAR. SET ; CHARDATA .BYTE 0,0,0,0,0,0,0,0 .BYTE 96,246,255,127,62,120,120,0,0,0 .BYTE 0,56,239,239,42,10,46,47,10 .BYTE 0,0,40,174,250,232,192,128,0 .BYTE 0,0,170,170,170,170,170,85,0 .BYTE 0,0,170,40,40,0,170,85,0 .BYTE 0,0,170,170,170,170,170,85,0 .BYTE 0,0,0,0,0,0,0,0,0 .BYTE 0,0,0,0,0,0,0,0,85 .BYTE 0,0,0,0,0,0,0,40,85 .BYTE 0,0,0,0,0,0,0,0,85 .BYTE 0,0,0,0,0,0,0,0,0 .BYTE 0,0,85,0,0,0,0,0,0 .BYTE 0,40,85,0,0,0,0,0,0 .BYTE 0,0,85,0,0,0,0,0,0 .BYTE 0,0,0,0,0,0,0,0,0 ; ;FOR BOSS'S CHAR. SET ; .BYTE 0,0,0,0,0,0,0,0,0 BOSSCHAR1 .BYTE 0,247,247,247,0,127,127,127 .BYTE 56,248,248,248,56,120,120,120 .BYTE 28,31,31,31,28,31,31,31 .BYTE 255,255,0,0,0,0,0,0 .BYTE 127,255,252,252,120,120,120,120 .BYTE 254,255,63,63,31,31,31,31 BOSSCHAR2 .BYTE 0,0,0,0,0,0,0,0 .BYTE 0,7,15,25,63,61,125,127 .BYTE 0,224,240,152,252,188,190,254 .BYTE 63,60,31,15,7,3,3,0 .BYTE 252,60,248,240,224,192,192,0 .BYTE 0,7,13,27,55,61,125,127 .BYTE 0,224,176,216,236,188,190,254 .BYTE 59,60,31,15,7,3,3,0 .BYTE 220,60,248,240,224,192,192,0 .BYTE 0,7,15,27,61,62,125,125 .BYTE 0,224,240,216,188,124,190,190 .BYTE 63,60,27,15,7,3,3,0 .BYTE 252,60,216,240,224,192,192,0 .BYTE 63,127,127,111,111,111,111,111 .BYTE 252,254,254,246,246,246,246,246 .BYTE 96,111,15,110,110,14,14,14 .BYTE 6,246,240,118,118,112,112,112 .BYTE 14,14,14,14,14,14,30,62 .BYTE 112,112,112,112,112,112,120,124 ; ;VERTICAL BLANK INTERRUPT ROUTINE ; SNDVALUE .BYTE 142,9,138,13,134,17,130,21 ; VBROUTINE CLD LDA LENGTH ;LENGTH OF NOTE BEQ NEXTNOTE ;TIME TO PLAY NEXT NOTE DEC LENGTH ;DEC. TIMER JMP END1 ;SKIP THE REST ; NEXTNOTE LDA SNGFLAG ;NOTE OR SILENCE EOR #1 ;FLIP IT STA SNGFLAG BNE SNDOFF ;SILENCE LDX SONGXREG ;GET NOTE P LDA SONG,X ;THEN NOTE BEQ END1 ;IF 0 DON'T PLAY STA AUDF3 ;AND SOUND OFF LDA #170 ;PURE TONE STA AUDC3 ;IN CONTROL INX ;GET LENGTH LDA SONG,X ;OF NOTE STA LENGTH ;AND STORE IT! INX STX SONGXREG ;UPDATE NOTE POS. JMP END1 ;DONE ; SNDOFF LDA #0 ;SHUT OFF SOUND STA AUDC3 ;( REST) LDX SONGXREG ;POS. IN TABLE DEX ;GET LENGTH LDA SONG,X ;( SAME AS PREVIOUS STA LENGTH ;NOTE) END1 LDA STICK0 ;STICK POS.? CMP #7 ;RIGHT! BEQ FORWARD CMP #11 ;YOU GUESSED IT! BNE DONEX ;IF NOT-DON'T MOVE LDA HPOS ;POS. OF HAND CMP #50 ;TOO FAR LEFT? BCC DONE ;YES! LDY LEVEL ;GET LEVEL CPY #5 ;IF UNDER 5, BCC SLOWER ;NEED TO SLOW IT DEC HPOS ;DOWN SLOWER DEC HPOS ;MOVE TWICE DEC HPOS JMP DONE ; FORWARD LDA HPOS CMP #195 ;TOO FAR RIGHT? BCS DONE ;YES! LDY LEVEL ;SAME AS ABOVE CPY #5 BCC SLOWER1 INC HPOS SLOWER1 INC HPOS INC HPOS DONE LDA #0 STA ATRACT ;KILL ATTRACT MODE DONEX LDA HPOS STA HPOSP1 ;POT CLC ADC #5 STA HPOSP0 ;HAND PART TWO LDA SNDFLAGPOP ;POPCORN POPING? BEQ DONE9 ;NO! INC DELAYPOP ;YES, INC. COUNTER LDA DELAYPOP ;NEXT SOUND CMP #2 ;EVERY 2 VBI'S BNE DONE9 ;READY LDX XFLAGPOP ;GET NEXT VALUE LDA SNDVALUE,X STA AUDC2 ;SOUND 2 INX ;GET NEXT LDA SNDVALUE,X ;FREQUENCY STA AUDF2 ;VALUE LDA #0 ;RESET TIMER STA DELAYPOP INX STX XFLAGPOP ;NEXT VALUE CPX #8 ;DONE WITH POP? BNE DONE9 ;NOPE. LDA #0 ;RESET STA AUDC2 ;SOUND STA XFLAGPOP ;NEXT VALUE STA SNDFLAGPOP ;'POP' FLAG DONE9 LDA CATCHSND ;ANY CAUGHT? BEQ NOTCAUGHT ;NOPE! INC SNDDELAY ;YES! LDA SNDDELAY ;EVERY TWO VBI'S CMP #1 BNE NOTCAUGHT LDA CATCHSND1 ;IF IN MIDDLE OF BNE RR ;POP, START LDA #240 ;ONE STA FREQ RR LDA #170 ;PURE TONE STA AUDC1 LDA FREQ ;NEXT VALUE STA AUDF1 BEQ DONE2 ;DONE? YES. SEC ;NEXT NOTE SBC #40 STA FREQ LDA #0 ;RESET DELAY STA SNDDELAY LDA #1 ;SHOW SOUND IS STA CATCHSND1 ;IN PROGRESS BNE NOTCAUGHT ;ALL DONE! ; DONE2 LDA #240 ;GET SOUND STA FREQ ;READY FOR NEXT LDA #0 ;CATCH STA CATCHSND STA CATCHSND1 STA SNDDELAY NOTCAUGHT JMP XITVBV ; INITVBLANK LDA #7 ;DEFFERRED VBI LDX # >VBROUTINE ;ADDRESS OF LDY # CHARORG3 ;CTRL CHAR STA CHAR+1 PRINT LDA CHECK BNE AAA INC HORIZ ;2ND PART INC CHR AAA LDA #0 STA CHAROFS+1 ;RESET STA PLUS ;VARIABLES STA OFFSET+1 STA TEMP+1 LDA VERT ;VERTICAL VALUE ASL A ;*2 ROL TEMP+1 ;SAVE CARRY ASL A ;*4 ROL TEMP+1 ASL A ;*8 ROL TEMP+1 LDX TEMP+1 STX OFFSET+1 ;SAVE HIGH&LOW STA OFFSET ;BYTES ASL A ;*16 ROL TEMP+1 ASL A ;*32 ROL TEMP+1 CLC ADC OFFSET ;ADD VERT*8 STA OFFSET LDA TEMP+1 ;TO GET VERT*40 ADC OFFSET+1 STA OFFSET+1 LDA OFFSET CLC ADC HORIZ ;SIMPLY ADD STA OFFSET ;HORIZ. VALUE BCC BBB ;OVERFLOW? NO. INC OFFSET+1 BBB CLC LDA OFFSET ADC # SCRN ;FIRST BYTE ADC OFFSET+1 ;ON SCRN STA OFFSET+1 LDA #0 STA TEMP+1 LDA CHR ;CHAR TO PRINT ASL A ;OFFSET= CHAR*9 ROL CHAROFS+1 ASL A ROL CHAROFS+1 ASL A ROL CHAROFS+1 CLC ADC CHR STA CHAR LDA CHAROFS+1 ;ADD IN LOC ADC CHAR+1 ;OF CHR SET STA CHAR+1 LOOP2 LDY PLUS ;BYTE OF CHAR. LDA (CHAR),Y ;NUMBER FOR BYTE LDY #0 STA (OFFSET),Y ;PUT ON SCRN LDA OFFSET CLC ADC #40 ;40 BYTES PER LINE STA OFFSET BCC CCC ;OVERFLOW? NO. INC OFFSET+1 CCC INC PLUS ;9 BYTES PER LDA PLUS ;CHR CMP #9 BNE LOOP2 DEC CHECK ;NEXT CHR LDA CHECK CMP #255 ;WOULD BE THIRD BEQ MMM ;CHR JMP PRINT ;(TWO PER POPCORN) ; MMM RTS ; ;ROUTINE TO ERASE POPCORN ;THAT TOUCHED POT ; ERASECHR LDA HPOS ;PLAYER HORIZ POS SEC ; ;ROUTINE FINDS CHAR POSITION ;BY HORIZ LOCATION OF PLAYER ; SBC #36 LSR A ;DIVIDE BY FOUR LSR A SEC SBC #4 STA HPOS1 LDY #0 LDX #0 CHKPLAYER LDA POSITION,X BEQ CHECKED ;IF O SKIP CHECK CMP HPOS1 BEQ ERASE ;ERASE POPCORN CHECKED INX INX CPX #12 ;COMP. ALL POPCORN BNE CHKPLAYER INC HPOS1 ;CHECK AROUND PLAYER INY LDX #0 CPY #6 ;ALL DONE? BNE CHKPLAYER ;NO! RTS ; ERASE INX LDA POSITION,X ;VERT POS OF POPCORN DEX CMP #78 ;AT LOC OF POT (VERT)? BCC CHECKED ;TO HIGH UP ON SCRN STA VERT ;STORE IT LDA POSITION,X ;STORE STA HORIZ ;HORIZ POS LDA #15 ;BLANK CHR STA CHR LDA #0 STA POSITION,X ;PUT THAT POPCORN STA POSITION+1,X ;OUT OF PLAY JMP PRINTCHAR ;ERASE CHR ; ;CLR MEMORY ROUTINE ; CLR0 LDY #0 TYA CLR1 STA (CLR),Y INY ;LOW BYTE OF BNE CLR1 ;BEG. MEM IN CLR INC CLR+1 ;HIGH BYTE IN DEX BNE CLR1 ;CLR+1 RTS ; ;PLAYER DATA ; PMDATA0 .BYTE 32,112,240,242,242,254,126 .BYTE 62,15,15,15,15,15,15,15 PMDATA1 .BYTE 255,255,255,126,126,126 .BYTE 126,126,126,126,0,0,0,0,0 PMDATA2 .BYTE 0,120,248,128,128,0,0,0 .BYTE 0,0,0,0,0,0,0 ; ;RUN ADDRESS ; *= $02E0 .WORD START End