A.N.A.L.O.G. ISSUE 15 / JANUARY 1984 / PAGE 111

Bricklayer’s Nightmare

16K Cassette or Disk

by Gordon Robson

Bricklayer’s Nightmare is a machine-language action game that turns your TV screen into a construction site, and you into a blue-collar hero. Your job is to move a wall of bricks from the middle of the screen to the right edge, one brick at a time. Your efforts will be constantly hampered by a pack of bloodthirsty neighborhood dogs, who will chase you around for a chance to sink a tooth into your leg.

45 points are awarded every, time a brick is moved one position to the right. When you finish moving an entire wall of bricks, another will appear along with an even more relentless pack of mutts. The game has seven levels of difficulty; should you manage to complete all of them, the most difficult level will repeat.

Your construction worker is moved around the screen with joystick #1; Each brick must be “pulled” across the screen with the worker’s electromagnetic attraction field. The procedure for moving a brick is as follows:

  1. Position the worker to within touching distance of the right side of a brick;
  2. Push the red fire button to activate the attraction field;
  3. Move the joystick to the right while holding down the fire button. The brick will follow the worker across the screen.

Bricks can only be moved from left to right, so be careful!

Your bricklayer begins the game with three lives. You will lose a life if one of the dogs touches you. An extra life is earned for every 10,000 points, up to a maximum of four. If all lives are lost and the “GAME OVER” prompt appears, the game can be restarted by pushing the fire button.

Typing the program.

Before typing anything into your computer, let’s look at the program listings included with this article and see what they do.

Listing 1 is the main data and data checking routine. This BASIC program is used to create both the disk and cassette versions of Bricklayer’s Nightmare. The DATA statements are listed in hexadecimal format (base 16) so that the program will fit in a 16K cassette system.

Listing 2 must be added to Listing 1 if you are using a 410 or 1010 program recorder.

Listing 3 must be added to Listing 1 if you are using a disk drive.

Listing 4 is the assembly-language source code for Bricklayer’s Nightmare. You do NOT have to type in this listing to play the game! It is provided for those readers interested in seeing how the program works.

Follow the instructions below to make either a cassette or disk version of Bricklayer’s Nightmare.

Cassette instructions.

  1. Type Listing 1 into your computer using the BASIC cartridge, and verify your typing with C:CHECK (see page 70).
  2. With Listing 1 still in the computer, carefully type in Listing 2. The program lines will automatically merge together with Listing 1. It’s a good idea to CSAVE the entire program at this point.
  3. Type RUN and press RETURN. The program will begin checking the DATA statements, printing the line number of each statement as it goes. It will alert you if it finds any problems. Fix incorrect lines and re-RUN the program if necessary until all errors are eliminated.
  4. When all DATA lines are correct, the computer will beep twice and prompt you to “READY CASSETTE AND PRESS RETURN.” Insert a blank cassette in your recorder, press the RECORD and PLAY buttons simultaneously and hit RETURN. The message “WRITING FILE” will appear and the program will create a machine-language boot tape version of Bricklayer’s Nightmare, printing each DATA line number as it goes. When the READY prompt appears, the game is recorded and ready to play. CSAVE the BASIC program onto a separate tape before continuing.
  5. To play the game, rewind the tape created by the BASIC program to the beginning. Turn your computer OFF and remove all cartridges. Press the PLAY button on your recorder and turn ON your computer while holding down the START key. The computer will “beep” once. Hit the RETURN key and Bricklayer’s Nightmare will load and run automatically.

Disk instructions.

  1. Type Listing 1 into your computer using the BASIC cartridge, and verify your typing with D:CHECK2 (see page 70).
  2. With Listing 1 still in the computer, carefully type in Listing 3. The program lines will automatically merge together with Listing 1. It’s a good idea to SAVE the entire BASIC program at this point.
  3. Type RUN and press RETURN. The program will begin checking the DATA statements, printing the line number of each statement as it goes. It will alert you if it finds any problems. Fix incorrect lines and re-RUN the program if necessary until all errors are eliminated.
  4. When all DATA lines are correct, you will be prompted to “INSERT DISK WITH DOS, PRESS RETURN.” Put a disk containing DOS 2.0S into drive #1 and press RETURN. The message “WRITING FILE” will appear and the program will create an AUTORUN.SYS file on the disk, displaying each DATA line number as it goes. When the READY prompt appears, the game is ready to play. Be sure the BASIC program is SAVEd before continuing.
  5. To play the game, insert the disk containing the AUTORUN.SYS file into drive #1. Turn your computer OFF, remove all cartridges and turn the computer back ON. Bricklayer’s Nightmare will load and run automatically.

Listing 1.

1 REM *** BRICKLAYER'S NIGHTMARE ***
10 DATA 0,1,2,3,4,5,6,7,8,9,0,0,0,0,0,0,0,10,11,12,13,14,15
20 DIM DAT$(91),HEX(22):FOR X=0 TO 22:READ N:HEX(X)=N:NEXT X:LINE=990:RESTORE 1000:TRAP 60:? "CHECKING DATA"
25 LINE=LINE+10:? "LINE:";LINE:READ DAT$:IF LEN(DAT$)<>90 THEN 110
28 DATLIN=PEEK(183)+PEEK(184)*256:IF DATLIN<>LINE THEN ? "LINE ";LINE;" MISSING!":END 
30 FOR X=1 TO 89 STEP 2:D1=ASC(DAT$(X,X))-48:D2=ASC(DAT$(X+1,X+1))-48:BYTE=HEX(D1)*16+HEX(D2)
35 IF PASS=2 THEN PUT #1,BYTE:NEXT X:READ CHKSUM:GOTO 25
40 TOTAL=TOTAL+BYTE:IF TOTAL>999 THEN TOTAL=TOTAL-1000
45 NEXT X:READ CHKSUM:IF TOTAL=CHKSUM THEN 25
50 GOTO 110
60 IF PEEK(195)<>6 THEN 110
100 ? "WRITING FILE":PASS=2:LINE=990:RESTORE 1000:TRAP 60:GOTO 25
110 ? "BAD DATA: LINE ";LINE:END 
1000 DATA 3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F7070707047802C44002A040404040404040404040404040404,121
1010 DATA 47802C46473341942CA9008D1DD0A9228D2F02A9208D3002A9BC8D3102A9E08DF40220C12D20422D20A0322008,169
1020 DATA 32208B2E20422D20F03120B731D03520BB2EADE933D0034CD52CCEFE33D01AADFC338DFE33AD8402D006ADFD33,356
1030 DATA 8DFE33204D30205C30206B3020AA31ADEA33D0C94CE42C206132CEEB3310B8A200BD3D33C9FFF00909C09D4A33,306
1040 DATA E84C282DAD8402D0FB854D4CCF2CA9008580A9238581A9008584A9058585A200206931A204A9009D07D0CAD0FA,487
1050 DATA A9868DC002A9488DC1028DC2028DC302A9508DF4338D00D0A9788DF6338D01D0A98C8DF7338D02D0A9A08DF833,356
1060 DATA 8D03D0A9AF8DF5338DF9338DFA338DFB33A9018DF33320F22FA208BDC4339DAE259DAE269DAE27CAD0F1A9208D,447
1070 DATA 07D48D1ED060A9008582ADF4028583A9008580A9288581A9008584A9028585205731A218BD64339DE729CAD0F7,808
1080 DATA A9288DF40220752EA9948D3002A92C8D3102A9008DC802A9288DC402A90A8DC502A9D88DC602A9388DC702A93E,615
1090 DATA 8D2F02A9038D1DD0A214A9009D4633CAD0FAAD5B33A2069D5333CAD0FAAD5B3309408D4833A9038DEB33A93F8D,702
1100 DATA EE338D002AA210A9008580A92A8581A92720622ECAF008A90120622E4C512E601865808580A58169008581ADEE,320
1110 DATA 33A000918060A9008580A92A8581A9808584A9028585A20020693160AD4833290FAAA900CAF0061869044C932E,787
1120 DATA AABDCD338DFC33BDCE338DFD33BDCF338DEC33BDD0338DED33A9FA8DE93360AD7802C90BD03120D32ECEF333D0,190
1130 DATA 05A9058DF33320F22F60CEF433A933CDF433F012ACF433AEF53320D92FD007ADF4338D00D060EEF43360C907F0,138
1140 DATA 0BC90EF034C90DF0664C842F200B2F20C1324CC52EEEF433A9C6CDF433F016AEF533ADF433186907A820D92FD0,559
1150 DATA 07ADF4338D00D060CEF43360CEF533A938CDF533F00BACF433AEF53320B12FF003EEF533EEF333A90ACDF333D0,943
1160 DATA 05A9068DF333AEF533A9009D08249DFF2320F22F60EEF533A9B0CDF533F00FACF433ADF533186907AA20B12FF0,635
1170 DATA C9CEF5334C472FC90AF00DC906F010C909F013C905F0166020D32E202F2F60200B2F202F2F6020D32E20652F60,880
1180 DATA 200B2F20652F608CEE338EEF33201230D01CAEEF33ADEE33186904A8201230D00DAEEF33ADEE33186906A82012,266
1190 DATA 30608CEE338EEF33201230D00DACEE33ADEF33186907AA20123060AEF333A9F8186908CAD0FAA8A9088584AEF5,725
1200 DATA 33B97D339D0024E8C8C684D0F4608A38E9384A4A4AAA9838E9304A4AA8A9008580A92A8581CA301018A5806928,951
1210 DATA 8580A581690085814C2930981865808580A90065818581A000B18060A9008DFF33201231F0016020773060A901,443
1220 DATA 8DFF33207730F0016020123160A9028DFF3320123120773060A9008580A9258581ACFF33F006E681884C8230AE,178
1230 DATA FF33BDF933CDF533D00160B041A58048A58148BDF633A8BDF933186908AA20B12FF0056868A90060AEFF336885,892
1240 DATA 81688580BCF9339180FEF933C8A200A9088584BDC5339180E8C8C684D0F5A90160AEFF33A58048A58148BDF633,393
1250 DATA A8BDF933AACA20B12FF0056868A90060AEFF33688581688580DEF933BDF93348186908A8A900918068A84CC530,30
1260 DATA AEFF33BDF633CDF433D00160B017BDF633186908A8204731F00160FEF633BDF6339D01D060BCF63388204731F0,792
1270 DATA 0160DEF6334C30318CF033BDF933AA20D92F08AEFF332860A000B1829180207731208531209331D0F1608AA000,816
1280 DATA 9180208531209331D0F36018A58269018582A583690085836018A58069018580A581690085816038A584E90185,688
1290 DATA 84D005A585D00360A585E9008585A90160AEEC33ACED3388D0FDCAD0FA60AD0CD0290E60AD55338DEE33A205FE,679
1300 DATA 5433BD5433C91AD008A9109D5433CA10EE88D0E9ADEE33CD5533F00DADEB33C904F006EEEB3320F03160A004A9,331
1310 DATA 00994F3388D0FAACEB33F008A9BD994F3388D0FA60AD4833290FC907F003EE4833ADC50248A9058DEE33A90C8D,779
1320 DATA C502A9808D00D2A9A68D01D2A000A200205832A9368DC502A9C08D00D2A9A68D01D2A000A200205832CEEE33D0,962
1330 DATA CF688DC502A9008D01D2608AAACAD0FD88D0F960A9098DEE338D00D2A9A08DF2338D01D2A90548A2FFA0FF8EC0,376
1340 DATA 0288D0FDADF23338E9038DF2338D01D2CAD0E9EEEE33ADEE338D00D26838E901D0D78D01D26020752E203F2EA9,272
1350 DATA 3E8DEE338D5B2AA209A95B8580A92A8581A92820622ECAD0F860A9008DEA33AD8402D047A900854DADF4332903,414
1360 DATA D03CADF43338E908A88DF133AEF533201230C93EF011ADF533186908AAACF133201230C93ED017A000A9009180,570
1370 DATA A93EA0019180A02D20BD31CEE93320133360A9708DF233A9088D00D2ADF2338D01D2A005A240CAD0FD88D0F8CE,311
1380 DATA F233ADF233C958D0E6A9018DEA336027212D25002F362532FF0000000000000000000000000000000000000000,86
1390 DATA 101112131415161718198090783C1A384848AA8282AAAA8282AAFF999999999999FF1010387CBA488482101038,417
1400 DATA 3878AC484410103838382828101010387CBA381028101038387C3848488090783C1A3848480010FC3A18242400,279
1410 DATA 0010FC3A1824240002123C78B038242266951C22363E143608080C0003030C8003020B0002020B0002010B5002,7
1420 DATA 010B8002010A000000000000000000000000000000000000000000000000000000000000000000000000000000,160

Listing 2.

2 REM *** CASSETTE VERSION ***
65 IF PASS=2 THEN FOR X=1 TO 73:PUT #1,0:NEXT X:CLOSE #1:END 
70 ? "READY CASSETTE AND PRESS RETURN";:OPEN #1,8,128,"C:":RESTORE 200:FOR X=1 TO 40:READ N:PUT #1,N:NEXT X
200 DATA 0,16,88,44,127,44,169,0,141,47,2,169,60,141,2,211,169,0,141,231,2,133,14,169,56,141,232,2
210 DATA 133,15,169,207,133,10,169,44,133,11,24,96

Listing 3.

2 REM *** DISK VERSION ***
65 IF PASS=2 THEN PUT #1,224:PUT #1,2:PUT #1,225:PUT #1,2:PUT #1,207:PUT #1,44:CLOSE #1:END 
70 ? "INSERT DISK WITH DOS, PRESS RETURN";:DIM IN$(1):INPUT IN$:OPEN #1,8,0,"D:AUTORUN.SYS"
90 PUT #1,255:PUT #1,255:PUT #1,128:PUT #1,44:PUT #1,14:PUT #1,52

Listing 4.

0100 ;        BRICKLAYER'S NIGHTMARE
0101 ;        ######################
0102 ;        BY G.M. ROBSON
0103 ;        ANALOG COMPUTING #15
0104 ;
0105 ;        DISPLAY LIST VALUES
0106 ;        -------------------
0107 BL8    =   $70         BLANK 8 SCAN LINES
0108 CH2    =   $02         CHAR LINE 40H X 8V, 2 COLOR
0109 CH4    =   $04         CHAR LINE 40H X 8V, 4 COLOR
0110 CH6    =   $06         CHAR LINE 20H X 8V, 5 COLOR
0111 CH7    =   $07         CHAR LINE 20H X 16V, 5 COLOR
0112 JVB    =   $41         JMP ON VERT BLANK INST
0113 LMS    =   $40         MASK TO LOAD MEM SCAN ADR
0114 ;
0115 ;        OS EQUATES
0116 ;        ----------
0117 ATRACT =   $4D         ATTRACT MODE COUNTER
0118 AUDC1  =   $D201       AUDIO CONTROL 1
0119 AUDF1  =   $D200       AUDIO FREQ 1
0120 GRACTL =   $D01D       GRAPHICS CTRL REG
0121 HITCLR =   $D01E       COLLISION CLEAR
0122 HPOSP0 =   $D000       MAN HORIZ POS
0123 HPOSP1 =   $D001       DOG 1 HORIZ POS
0124 HPOSP2 =   $D002       DOG 2 HORIZ POS
0125 P0PL   =   $D00C       PLYR 0(MAN) AND PLAYER COLLISIONS
0126 PMBASE =   $D407       PM BASE ADR
0127 SIZEP0 =   $D008       SIZE OF PLAYER 0
0128 HPOSP3 =   $D003       DOG 3 HORIZ POS
0129 ;
0130 ;        SYSTEM SHADOW REGS
0131 ;        ------------------
0132 CHBAS  =   $02F4       CHAR SET HO ADR
0133 COLOR0 =   $02C4       PLAYFIELD 0 COLOR REG
0134 COLOR1 =   $02C5       PLAYFIELD 1 COLOR REG
0135 COLOR2 =   $02C6       PLAYFIELD 2 COLOR REG
0136 COLOR3 =   $02C7       PLAYFIELD 3 COLOR REG
0137 COLOR4 =   $02C8       BACKGROUND COLOR
0138 ;
0139 SDLSTL =   $0230       DISPLAY LIST PNTR
0140 PCOLR0 =   $02C0       MAN COLOR REG
0141 PCOLR1 =   $02C1       DOG 1 COLOR REG
0142 PCOLR2 =   $02C2       DOG 2 COLOR REG
0143 PCOLR3 =   $02C3       DOG 3 COLOR REG
0144 SDMCTL =   $022F       DMA CTRL
0145 STICK0 =   $0278       JOYSTICK 1
0146 STRIG0 =   $0284       TRIGGER 1
0147 ;
0148 ;        PAGE ZERO VARIABLES
0149 ;        -------------------
0150 DESADR =   $80         DEST ADR
0151 SRCADR =   $82         SRCE ADR
0152 SIZE   =   $84         # OF BYTES INVOLVED
0153 ;
0154 ;        JOYSTICK VALUES
0155 ;        ---------------
0156 DOWN   =   13
0157 DOWNLEFT = 9
0158 DOWNRGT =  5
0159 LEFT   =   11
0160 RIGHT  =   7
0161 UP     =   14
0162 ;
0163 UPLEFT =   10
0164 UPRIGHT =  6
0165 ;
0166 ;        BRICKLAYER VALUES
0167 ;        -----------------
0168 BMPS   =   250         BRICK MOVES PER SCREEN
0169 BRKPOINT = 45          POINTS FOR 1 BRICK MOVE
0170 ;
0171 CHSIZE =   512         SIZE OF CHAR SET (ONLY 512 NEEDED)
0172 DMAVAL =   62          ENABLE INSTRUCTION FETCH DMA
0173 ;                      1 LINE P/M RESOLUTION
0174 ;                      ENABLE PLAYER DMA
0175 ;                      ENABLE MISSILE DMA
0176 ;                      160 COLOR CLOCK PLAYFIELD DMA
0177 ;
0178 GRAVAL =   3           SET TRIG0-TRIG3 NORMAL INPUTS
0179 ;                      ENABLE DMA TO PLAYER GRAPHICS REGS
0180 ;                      ENABLE DMA TO MISSILE GRAPHICS REGS
0181 ;
0182 INDOG1H =  120         INITIAL DOG 1 HORIZ POS
0183 INDOG2H =  140         INITIAL DOG 2 HORIZ POS
0184 INDOG3H =  160         INITIAL DOG 3 HORIZ POS
0185 INMANH =   80          INITIAL MAN HORIZ POS
0186 INMANV =   175         INITIAL MAN VERT POS
0187 ;
0188 M2LSIZE =  40          MODE 2 LINE SIZE
0189 M4LSIZE =  40          MODE 4 LINE SIZE
0190 M7LSIZE =  20          MODE 7 LINE SIZE
0191 ;
0192 PF0CMASK = $00         MASK TO USE PLAYFIELD 0 COLOR
0193 PF1CMASK = $40         MASK TO USE PLAYFIELD 1 COLOR
0194 PF2CMASK = $80         MASK TO USE PLAYFIELD 2 COLOR
0195 PF3CMASK = $C0         MASK TO USE PLAYFIELD 3 COLOR
0196 ;
0197 PFLINES =  16          # OF LINES WHERE PLAY OCCURS
0198 SCRSIZ =   640         # OF BYTES IN DISPLAY AREA
0199 ;
0200 BC     =   62          BRICK CHAR
0201 LC     =   61          MAN LIFE CHAR
0202 WC     =   63          WALL CHARACTER
0203 ;
0204 ;        SCREEN VALUES
0205 ;        -------------
0206 BORDB  =   $B0         BOTTOM BORDER LINE FOR PLAY AREA
0207 BORDL  =   $33         LEFT BORDER COL FOR PLAY AREA
0208 BORDR  =   $C6         RIGHT BORDER COL FOR PLAY AREA
0209 BORDT  =   $38         TOP BORDER LINE FOR PLAY AREA
0210 ;
0211 ;        COLORS
0212 ;        ------
0213 GREY   =   $00
0214 ORANGE =   $20
0215 REDORG =   $30
0216 PINK   =   $40
0217 BLUE   =   $80
0218 YELGRN =   $D0
0219 ;
0220 COLPF2 =   $D018
0221 COLOR  =   $80
0222 WSYNC  =   $D40A
0223 ;
0224        *=  $2000
0225 ;
0226 ;        P/M RAM SPACE
0227 ;        -------------
0228 PM     *=  *+768       1ST AREA NOT USED
0229 MISL   *=  *+256       MISSILE GRAPHICS AREA
0230 PLR0   *=  *+256       PLAYER 0 GRAPHICS AREA
0231 PLR1   *=  *+256       PLAYER 1 GRAPHICS AREA
0232 PLR2   *=  *+256       PLAYER 2 GRAPHICS AREA
0233 PLR3   *=  *+256       PLAYER 3 GRAPHICS AREA
0234 ;
0235 PLEND  =   *
0236 PLDIFF =   PLEND-MISL
0237 ;
0238 CUSCS  *=  *+512       CUSTOM CHAR SET
0239 DISP   *=  *+SCRSIZ    ACTUAL PLAY AREA
0240 FIRSTBR =  DISP+91     ADDR OF 1ST BRICK
0241 ;
0242 WALLLINE
0243        .BYTE WC,WC,WC,WC,WC,WC,WC,WC,WC,WC
0244        .BYTE WC,WC,WC,WC,WC,WC,WC,WC,WC,WC
0245 ;
0246 ;        BRICKLAYER DISPLAY LIST
0247 ;        -----------------------
0248 DL     .BYTE BL8,BL8 BLANK SCRN TOP
0249        .BYTE BL8,BL8
0250 ;
0251        .BYTE CH7+LMS
0252        .WORD WALLLINE SHOW WALL LINE
0253        .BYTE CH4+LMS SET MAIN SCRN DISPLAY ADR
0254        .WORD DISP
0255 ;
0256        .BYTE CH4,CH4 DEFINE MAIN SCREEN DISPLAY AREA
0257        .BYTE CH4,CH4
0258        .BYTE CH4,CH4
0259        .BYTE CH4,CH4
0260        .BYTE CH4,CH4
0261        .BYTE CH4,CH4
0262        .BYTE CH4,CH4
0263        .BYTE CH4
0264        .BYTE CH7+LMS
0265        .WORD WALLLINE SHOW WALL LINE
0266 ;
0267        .BYTE CH6+LMS SET SCORE LINE ADR
0268        .WORD SLINE
0269 ;
0270        .BYTE JVB JMP ON VERT BLANK
0271        .WORD DL TO DISPLAY LIST START
0272 ;
0273 ;        RETURN SCREEN TO NORMAL
0274 ;        -----------------------
0275 NORMAL
0276        LDA #$00
0277        STA GRACTL
0278        LDA #$22
0279        STA SDMCTL
0280        LDA #$20
0281        STA SDLSTL
0282        LDA #$BC
0283        STA SDLSTL+1
0284 ;
0285        LDA #$E0
0286        STA CHBAS
0287 ;
0288 ;        MAIN LINE
0289 ;        ---------
0290 MAINRTN
0291        JSR INIT        INITIALIZE
0292        JSR INITPM      INIT PLAYERS
0293 ;
0294 ;        START NEW LEVEL
0295 ;        ---------------
0296 STARTLEV JSR INITBRKS  SETUP INITIAL BRICKS
0297        JSR SETNLEV     SET NEXT LEVEL
0298        JSR INITLEV     INIT LEVEL VALUES
0299 ;
0300 ;        START NEW LIFE
0301 ;        --------------
0302 STLIFE JSR INITPM      INIT PLAYERS
0303        JSR SHOWLIVS    SHOW LIVES REMAINING
0304 MAIN1  JSR CHKMANOK    DID MAN COLLIDE WITH DOG ?
0305        BNE REMMAN      YES, SO REMOVE MAN
0306        JSR MOVMAN      MOVE THE MAN
0307        LDA BMOVES      GET # OF BRICKS LEFT
0308        BNE MAIN2       MORE, SO CONTINUE
0309        JMP STARTLEV    START NEXT LEVEL
0310 ;
0311 MAIN2  DEC DOGMOVCT    CAN DOGS MOVE YET ?
0312        BNE Q1          NO
0313        LDA DOGFREQ1    YES, RESET NORMAL DOG MOVE CNT
0314        STA DOGMOVCT
0315        LDA STRIG0      IS TRIG DOWN ?
0316        BNE Q2          NO, LEAVE NORMAL DOG MOVE CNT
0317        LDA DOGFREQ2    ELSE, SET FASTER DOG COUNT
0318        STA DOGMOVCT    AND SAVE
0319 ;
0320 Q2     JSR MOVDOG1     MOVE DOG 1
0321        JSR MOVDOG2     MOVE DOG 2
0322        JSR MOVDOG3     MOVE DOG 3
0323 Q1     JSR MDELAY      DO MAIN DELAY
0324        LDA BSNDFLAG    DID BRICK JUST MAKE SOUND ?
0325        BNE MAIN1       YES, SO DON'T DELAY
0326        JMP MAIN1
0327 ;
0328 REMMAN
0329        JSR KILLMAN     SHOW MAN'S DOWNFALL
0330        DEC LIVES       REDUCE # OF LIVES LEFT
0331        BPL STLIFE      START NEW LIFE
0332 ;
0333 ;        END OF GAME
0334 ;        -----------
0335        LDX #0          INIT INDEX
0336 SHOWOVER LDA ENDMSG,X  GET 'GAME OVER' BYTE
0337        CMP #$FF        END OF MSG ?
0338        BEQ WAITSTRT    YES, SO WAIT TO START AGAIN
0339        ORA #PF3CMASK   MAKE CHAR PLAYFIELD 3 COLOR
0340        STA SLINE+3,X   PUT MSG BYTE ON SCRN
0341        INX             PNT TO NEXT BYTE
0342        JMP SHOWOVER    SHOW NEXT BYTE
0343 ;
0344 WAITSTRT LDA STRIG0    IS TRIGGER PRESSED ?
0345        BNE WAITSTRT    NO, SO WAIT
0346        STA ATRACT      TRIG PUSHED, SO DISABLE ATTRACT
0347        JMP MAINRTN     YES, SO START AGAIN
0348 ;
0349 ;        CLEAR PM AREA
0350 ;        -------------
0351 INITPM
0352        LDA #MISL&255
0353        STA DESADR      SET START ADR LO
0354        LDA #MISL/256
0355        STA DESADR+1    SET START ADR HO
0356        LDA #PLDIFF&255
0357        STA SIZE        SET SIZE LO
0358        LDA #PLDIFF/256
0359        STA SIZE+1      SET SIZE HO
0360        LDX #0          SET FILL CHAR
0361        JSR FILL        CLEAR PM AREA
0362 ;
0363 ;        INIT PLAYERS COLORS & POSITIONS
0364 ;        -------------------------------
0365        LDX #4          SET # OF PLAYERS
0366        LDA #0
0367 INITPSIZ STA SIZEP0-1,X SET NORMAL PLAYER SIZE
0368        DEX             MORE PLAYER SIZES TO INIT ?
0369        BNE INITPSIZ    YES
0370 ;
0371        LDA #BLUE+6     SET COLOR & LUM
0372        STA PCOLR0      SET PLAYER 0 COLOR
0373        LDA #PINK+8     SET COLOR & LUM
0374        STA PCOLR1      FOR DOG
0375        STA PCOLR2      SET DOG 2 COLOR & LUM
0376        STA PCOLR3      SET DOG 3 COLOR & LUM
0377 ;
0378        LDA #INMANH     GET MAN'S INITIAL HORIZ POS
0379        STA MANPOSH     SAVE HORIZ POS
0380        STA HPOSP0      SET IT
0381        LDA #INDOG1H    GET DOG 1'S INITIAL HORIZ POS
0382        STA DOG1POSH    SAVE HORIZ POS
0383        STA HPOSP1      SET IT
0384        LDA #INDOG2H    GET DOG 2'S INITIAL HORIZ POS
0385        STA DOG2POSH    SAVE HORIZ POS
0386        STA HPOSP2      SET IT
0387        LDA #INDOG3H    GET DOG 3'S INITIAL HORIZ POS
0388        STA DOG3POSH    SAVE HORIZ POS
0389        STA HPOSP3      SET IT
0390 ;
0391        LDA #INMANV     GET MAN'S INITIAL VERT POS
0392        STA MANPOSV     SAVE MAN'S VERT POS
0393        STA DOG1POSV    SAVE DOG 1'S VERT POS
0394        STA DOG2POSV    SAVE DOG 2'S VERT POS
0395        STA DOG3POSV    SAVE DOG 3'S VERT POS
0396 ;
0397 ;        PUT INITIAL MAN IMAGE ON SCREEN
0398 ;        -------------------------------
0399        LDA #1
0400        STA MANPICNO    PNT TO 1ST MAN IMAGE
0401        JSR PUTMAN      PUT MAN IN PLAYER AREA
0402 ;
0403 ;        PUT INITIAL DOGS ON SCREEN
0404 ;        --------------------------
0405 INITDOG LDX #8         SET # OF BYTES IN DOG IMAGE
0406 Q3     LDA DOGIMAGE-1,X GET DOG IMAGE BYTE
0407        STA PLR1+INMANV-1,X PUT DOG BYTE IN PLAYER 1
0408        STA PLR2+INMANV-1,X PUT DOG BYTE IN PLAYER 2
0409        STA PLR3+INMANV-1,X PUT DOG BYTE IN PLAYER 3
0410        DEX             MORE BYTES IN PLAYER ?
0411        BNE Q3          YES
0412 ;
0413        LDA #PM/256     GET HI BYTE OF PM ADR
0414        STA PMBASE      SET PM ADR
0415 ;
0416        STA HITCLR      CLEAR COLLISIONS
0417 ;
0418        RTS             RET TO MAIN RTN
0419 ;
0420 ;        SETUP CHAR SET
0421 ;        --------------
0422 INIT
0423        LDA #0
0424        STA SRCADR      SET ORIG CHAR SET LO ADR
0425        LDA CHBAS
0426        STA SRCADR+1    SET ORIG CHAR SET HO ADR
0427        LDA #CUSCS&255
0428        STA DESADR      SET CUSTOM CHAR SET LO ADR
0429        LDA #CUSCS/256
0430        STA DESADR+1    SET CUSTOM CHAR SET HO ADR
0431        LDA #CHSIZE&255 GET SIZE OF CHSET LO BYTE
0432        STA SIZE        SAVE FOR MOVE
0433        LDA #CHSIZE/256 SET # OF 256 BYTE BLOCKS TO MOVE
0434        STA SIZE+1      SAVE SIZE HO BYTE
0435        JSR MOVE        MOVE CHAR SET TO RAM
0436 ;
0437 ;        REDEFINE CHARACTERS
0438 ;        -------------------
0439        LDX #24         SET # OF BYTES IN CHARS
0440 Q4     LDA LIFEPAT-1,X GET NEW CHAR BYTE
0441        STA CUSCS+488-1,X PUT INTO CUSTOM CHAR SET
0442        DEX             MORE BYTES ?
0443        BNE Q4          YES
0444 ;
0445        LDA #CUSCS/256 GET CUSTOM CHSET H0 ADR
0446        STA CHBAS SET NEW CHAR SET ADR
0447 ;
0448 ;        INIT SCREEN
0449 ;        -----------
0450        JSR CLSCRN      CLEAR SCREEN
0451        LDA #DL&255    SET DL LO BYTE
0452        STA SDLSTL
0453        LDA #DL/256     SET DL HI BYTE
0454        STA SDLSTL+1
0455 ;
0456 ;        SET PLAYFIELD COLORS
0457 ;        --------------------
0458        LDA #GREY+0
0459        STA COLOR4      SET BACKGROUND COLOR
0460        LDA #ORANGE+8
0461        STA COLOR0      SET PLAYFIELD 0 COLOR
0462        LDA #GREY+$0A
0463        STA COLOR1      SET PLAYFIELD 1 COLOR
0464        LDA #YELGRN+8
0465        STA COLOR2      SET PLAYFIELD 2 COLOR
0466        LDA #REDORG+8
0467        STA COLOR3      SET PLAYFIELD 3 COLOR
0468 ;
0469        LDA #DMAVAL     SET DMA CONTROL
0470        STA SDMCTL
0471        LDA #GRAVAL     SET GRAPHICS CONTROL
0472        STA GRACTL
0473 ;
0474 ;        INIT SCORE LINE
0475 ;        ---------------
0476        LDX #SLEND-SLINE SET SIZE OF SCORE LINE
0477        LDA #0          SET BLANK CHAR
0478 Q5     STA SLINE-1,X   BLANK SCORE LINE
0479        DEX             MORE TO BLANK ?
0480        BNE Q5          YES
0481 ;
0482        LDA DIGITS+0    GET ATASCII FOR '0'
0483        LDX #6          SET # OF DIGITS IN SCORE
0484 INITSCOR STA SCORE-1,X PUT 0 SCORE DIGIT
0485        DEX             MORE DIGITS ?
0486        BNE INITSCOR    YES
0487 ;
0488        LDA DIGITS+0    GET ATASCII FOR '0'
0489        ORA #PF1CMASK   MAKE IT PLAYFIELD 1 COLOR
0490        STA LEVEL       SET LEVEL 1
0491 ;
0492        LDA #3
0493        STA LIVES       INIT # OF LIVES
0494 ;
0495 ;        DRAW WALLS
0496 ;        ----------
0497 DRAWWALL
0498        LDA #WC         GET WALL CHAR
0499        STA TEMP        SAVE FOR TRANSFER
0500        STA DISP        PUT WALL CHAR ON SCRN
0501        LDX #PFLINES    SET # OF LINES TO PUT WALL ON
0502        LDA #DISP&255
0503        STA DESADR      SAVE LO ADR
0504        LDA #DISP/256
0505        STA DESADR+1    SAVE HO ADR
0506 PNTWALL LDA #M4LSIZE-1 SET VALUE TO PNT TO LINE END
0507        JSR PUTSCRCH    PUT WALL CHAR AT LINE END
0508        DEX             MORE WALL CHARS ?
0509        BEQ Q6          NO, SO EXIT
0510        LDA #1          SET VALUE TO PNT TO NEXT LINE
0511        JSR PUTSCRCH    PUT WALL CHAR AT NEXT LINE START
0512        JMP PNTWALL     PUT NEXT WALL CHAR
0513 Q6     RTS             RET TO MAIN PROGRAM
0514 ;
0515 PUTSCRCH CLC           SETUP FOR ADD
0516        ADC DESADR      ADD TO DEST LO ADR
0517        STA DESADR      SAVE DEST LO ADR
0518        LDA DESADR+1    GET DEST HO ADR
0519        ADC #0          ADD CARRY IF ANY
0520        STA DESADR+1    SAVE DEST HO ADR
0521        LDA TEMP        GET CHAR TO PUT ON SCRN
0522        LDY #0          ZERO INDEX
0523        STA (DESADR),Y  PUT WALL CHAR ON SCRN
0524        RTS 
0525 ;
0526 ;        CLEAR PLAYFIELD
0527 ;        ---------------
0528 CLSCRN
0529        LDA #DISP&255
0530        STA DESADR      SET DEST LO ADR
0531        LDA #DISP/256
0532        STA DESADR+1    SET DEST HO ADR
0533        LDA #SCRSIZ&255
0534        STA SIZE        SET SIZE OF FILL LO BYTE
0535        LDA #SCRSIZ/256
0536        STA SIZE+1      SET SIZE OF FILL HO BYTE
0537        LDX #0          SET FILL CHAR
0538        JSR FILL        CLEAR THE SCRN AREA
0539        RTS 
0540 ;
0541 ;        INIT LEVEL VALUES
0542 ;        -----------------
0543 INITLEV LDA LEVEL      GET CURRENT LEVEL
0544        AND #$0F        MAKE IT BINARY #
0545        TAX 
0546        LDA #0          INIT OFFSET
0547 Q7     DEX             IS THIS THE LEVEL ?
0548        BEQ Q8          YES,SET LEVEL VALUES
0549        CLC             SETUP FOR ADD
0550        ADC #4          PNT TO NEXT LEVEL VALUES
0551        JMP Q7          SEE IF THIS IS THE LEVEL
0552 Q8     TAX             GET OFFSET
0553        LDA LEVTBL,X    GET NORMAL DOG MOVES/MAN MOVE
0554        STA DOGFREQ1    SET IT
0555        LDA LEVTBL+1,X  GET DOG/MAN MOVES (PULLING WALL)
0556        STA DOGFREQ2    SAVE IT
0557        LDA LEVTBL+2,X  GET MAIN LOOP HO VALUE
0558        STA MDELHO      SET IT
0559        LDA LEVTBL+3,X  GET MAIN LOOP LO VALUE
0560        STA MDELLO      SET IT
0561 ;
0562        LDA #BMPS       GET # OF BRICKS TO MOVE
0563        STA BMOVES
0564 ;
0565        RTS   EXIT
0566 ;
0567 ;        READ JOYSTICK & MOVE MAN
0568 ;        ------------------------
0569 MOVMAN LDA STICK0      READ JOYSTICK
0570        CMP #LEFT       MOVE LEFT ?
0571        BNE CHKJSR      NO, SO CHECK RIGHT
0572 ;
0573 ;
0574 MOVMANL JSR SETMANL    SET MAN LEFT
0575 SETHIM DEC MANPICNO    ELSE, SET NEXT MAN IMAGE #
0576        BNE SHONEWM     IF VALID, SHOW NEW MAN
0577        LDA #5          ELSE, SET VALID MAN IMAGE
0578        STA MANPICNO    SAVE MAN IMAGE #
0579 SHONEWM JSR PUTMAN     SHOW MAN
0580        RTS             EXIT
0581 ;
0582 SETMANL DEC MANPOSH    PNT TO COL TO LEFT
0583        LDA #BORDL      GET LEFT LIMIT
0584        CMP MANPOSH     AT LEFT LIMIT ?
0585        BEQ MOVLERR     YES, SO ERROR
0586        LDY MANPOSH     GET HORIZ POS
0587        LDX MANPOSV     GET VERT POS
0588        JSR CHKLRM      SEE IF MOVE IS OK
0589        BNE MOVLERR     SOMETHING THERE, CAN'T MOVE
0590 ;
0591        LDA MANPOSH     GET CURRENT MAN HORIZ POS
0592        STA HPOSP0      SET HARDWARE HORIZ REG
0593        RTS 
0594 ;
0595 MOVLERR INC MANPOSH    SET ORIG COL
0596        RTS             EXIT
0597 ;
0598 CHKJSR CMP #RIGHT      MOVE RIGHT ?
0599        BEQ MOVMANR     YES, SO MOVE MAN RIGHT
0600 ;
0601        CMP #UP         MOVE UP ?
0602        BEQ MOVMANU     YES, MOVE MAN UP
0603 ;
0604        CMP #DOWN       MOVE DOWN ?
0605        BEQ MOVMAND     YES, MOVE MAN DOWN
0606        JMP CHKANGLS    CHECK JOYSTICK ANGLES
0607 ;
0608 ;
0609 MOVMANR JSR SETMANR    SET MAN TO RIGHT
0610        JSR MOVBRICK    MOVE BRICK IF APPROPRIATE
0611        JMP SETHIM      SET NEW HORIZ IMAGE
0612 ;
0613 SETMANR INC MANPOSH    SET COL TO RIGHT
0614        LDA #BORDR      GET # OF RIGHT BORDER
0615        CMP MANPOSH     AT RIGHT BORDER ?
0616        BEQ MOVRERR     YES, SO ERROR
0617 ;
0618        LDX MANPOSV     GET MAN VERT POS
0619        LDA MANPOSH     GET HORIZ POS
0620        CLC             SETUP FOR ADD
0621        ADC #7          PNT TO RIGHT SIDE OF PLAYER
0622        TAY 
0623        JSR CHKLRM      SEE IF MOVE OK
0624        BNE MOVRERR     CHAR THERE, SO ERROR
0625 ;
0626 ;
0627        LDA MANPOSH     GET CURRENT MAN HORIZ POS
0628        STA HPOSP0      SET HARDWARE HORIZ REG
0629        RTS 
0630 MOVRERR DEC MANPOSH    SET ORIGINAL MAN HORIZ POS
0631        RTS             EXIT
0632 ;
0633 MOVMANU DEC MANPOSV    SET LINE ABOVE
0634        LDA #BORDT      GET # OF TOP BORDER
0635        CMP MANPOSV     AT TOP BORDER ?
0636        BEQ MOVUERR     YES, SO RESET PNTR
0637 ;
0638        LDY MANPOSH     GET HORIZ POS
0639        LDX MANPOSV     GET VERT POS
0640        JSR CHKUDM      CHK UP DOWN MOVE
0641        BEQ SETVIM      BLANK, SO MOVE OK
0642 MOVUERR INC MANPOSV    SET ORIGINAL POS
0643 SETVIM INC MANPICNO    SET NEXT VERT IMAGE
0644        LDA #10         GET 1 BEYOND MAX IMAGE #
0645        CMP MANPICNO    IS MAN IMAGE # VALID ?
0646        BNE Q9          YES
0647        LDA #6          NO, SO SET VALID IMAGE #
0648        STA MANPICNO    SAVE NEW MAN IMAGE #
0649 Q9     LDX MANPOSV     GET MAN POSITION FOR INDEX
0650        LDA #0
0651        STA PLR0+8,X    BLANK BYTES AROUND OLD MAN IMAGE
0652        STA PLR0-1,X
0653        JSR PUTMAN      PUT NEW IMAGE IN PLAYER AREA
0654        RTS             EXIT
0655 ;
0656 ;
0657 MOVMAND INC MANPOSV    SET LINE BELOW
0658        LDA #BORDB      GET # OF BOTTOM BORDER
0659        CMP MANPOSV     AT BOTTOM BORDER ?
0660        BEQ MOVDERR     YES, SO RESET PNTR
0661 ;
0662        LDY MANPOSH     SET HORIZ POS
0663        LDA MANPOSV     GET VERT POS
0664        CLC             PREPARE FOR ADD
0665        ADC #7          PNT TO LINE BELOW
0666        TAX             SAVE VERT POS
0667        JSR CHKUDM      CHK UP DOWN MOVE
0668        BEQ SETVIM      BLANK, SO MOVE OK
0669 ;
0670 MOVDERR DEC MANPOSV YES, SO SET ORIGINAL LINE #
0671        JMP SETVIM SET NEW VERT IMAGE
0672 ;
0673 CHKANGLS CMP #UPLEFT   MOVE UP LEFT ?
0674        BEQ MOVMANUL    YES
0675 ;
0676        CMP #UPRIGHT    MOVE UP RIGHT ?
0677        BEQ MOVMANUR    YES
0678 ;
0679        CMP #DOWNLEFT   MOVE DOWN LEFT ?
0680        BEQ MOVMANDL    YES
0681 ;
0682        CMP #DOWNRGT    MOVE DOWN RIGHT ?
0683        BEQ MOVMANDR    YES
0684 ;
0685        RTS             EXIT TO MAIN LINE
0686 ;
0687 MOVMANUL JSR SETMANL SET MAN LEFT
0688        JSR MOVMANU MOVE MAN UP
0689        RTS 
0690 ;
0691 MOVMANUR JSR SETMANR SET MAN RIGHT
0692        JSR MOVMANU MOVE MAN UP
0693        RTS 
0694 ;
0695 MOVMANDL JSR SETMANL SET MAN LEFT
0696        JSR MOVMAND MOVE MAN DOWN
0697        RTS 
0698 ;
0699 MOVMANDR JSR SETMANR SET MAN RIGHT
0700        JSR MOVMAND MOVE MAN DOWN
0701        RTS 
0702 ;
0703 ;        CHECK UP DOWN MOVE
0704 ;        ------------------
0705 CHKUDM
0706        STY TEMP        SAV HORIZ POS
0707        STX TEMP+1      SAV VERT POS
0708        JSR GETSCRN     GET SCRN CHAR
0709        BNE Q10         CHAR THERE, SO EXIT
0710        LDX TEMP+1      GET VERT POS
0711        LDA TEMP        GET HORIZ POS
0712        CLC             SETUP FOR ADD
0713        ADC #4          PNT TO MIDDLE OF PLAYER
0714        TAY 
0715        JSR GETSCRN     GET SCRN CHAR
0716        BNE Q10         CHAR THERE, SO EXIT
0717        LDX TEMP+1      GET VERT POS
0718        LDA TEMP        GET HORIZ POS
0719        CLC             SETUP FOR ADD
0720        ADC #6          PNT TO RIGHT SIDE OF PLAYER
0721        TAY 
0722        JSR GETSCRN GET SCRN CHAR
0723 Q10    RTS 
0724 ;
0725 ;        CHECK LEFT RIGHT MOVE
0726 ;        ---------------------
0727 CHKLRM STY TEMP        SAVE HORIZ POS
0728        STX TEMP+1      SAVE VERT POS
0729        JSR GETSCRN     GET SCRN CHAR
0730        BNE Q11         SOMETHING THERE, SO EXIT
0731        LDY TEMP        GET HORIZ POS
0732        LDA TEMP+1      GET VERT POS
0733        CLC             PREPARE FOR ADD
0734        ADC #7          PNT TO PLAYER BOTTOM LINE
0735        TAX 
0736        JSR GETSCRN     GET SCRN CHAR
0737 Q11    RTS             EXIT
0738 ;
0739 ;        PUT MAN IMAGE IN PLAYER AREA
0740 ;        ----------------------------
0741 PUTMAN LDX MANPICNO GET CURRENT MAN IMAGE #
0742        LDA #-8
0743 Q12    CLC 
0744        ADC #8          CALC
0745        DEX             IMAGE
0746        BNE Q12         OFFSET
0747 ;
0748        TAY             SET IMAGE OFFSET
0749        LDA #8          SET # OF BYTES IN IMAGE
0750        STA SIZE        AND SAVE
0751        LDX MANPOSV     GET CURRENT VERT POS
0752 ;
0753 Q13    LDA MANH1,Y     GET MAN IMAGE BYTE
0754        STA PLR0,X      PUT IN PLAYER AREA
0755        INX             PNT TO NEXT PLAYER AREA BYTE
0756        INY             PNT TO NEXT IMAGE BYTE
0757        DEC SIZE        MORE TO MOVE ?
0758        BNE Q13         YES, SO MOVE THEM
0759        RTS 
0760 ;
0761 ;        GET SCREEN CHAR
0762 ;        ---------------
0763 ;        ENTER WITH:
0764 ;
0765 ;        REG X = SCAN LINE #
0766 ;        REG Y = COLOR CLOCK #
0767 ;
0768 GETSCRN TXA            GET LINE #
0769        SEC             SETUP FOR SUBT
0770        SBC #$38        PNT TO PLAY AREA
0771        LSR A           DIVIDE LINE # BY 8
0772        LSR A           # OF LINES IN CHAR
0773        LSR A
0774        TAX             AND SAVE
0775        TYA             GET COL #
0776        SEC             SETUP FOR SUBT
0777        SBC #$30        COMPENSATE FOR SCRN LEFT EDGE
0778        LSR A           DIVIDE COL BY 4
0779        LSR A           # OF COLS IN CHAR
0780        TAY             AND SAVE
0781        LDA #DISP&255   GET PLAY AREA START (LO)
0782        STA DESADR      ; & SAVE
0783        LDA #DISP/256   GET PLAY AREA START (HO)
0784        STA DESADR+1    ; & SAVE
0785 Q14    DEX             IS LINE # 0 ?
0786        BMI Q15         YES, SO ADD COL VALUE
0787        CLC             SETUP FOR ADD
0788        LDA DESADR      GET PLAY AREA ADR (LO)
0789        ADC #M4LSIZE    PNT TO NEXT LINE
0790        STA DESADR      ; & SAVE
0791        LDA DESADR+1    GET PLAY AREA ADR (HO)
0792        ADC #0          ADD CARRY IF ANY
0793        STA DESADR+1    ; & SAVE
0794        JMP Q14         SEE IF LINES ACCOUNTED FOR
0795 ;
0796 Q15    TYA             GET COL #
0797        CLC             SETUP FOR ADD
0798        ADC DESADR      ADD COL TO ADR (LO)
0799        STA DESADR      ; & SAVE
0800        LDA #0
0801        ADC DESADR+1    ADD CARRY IF ANY TO HO ADR
0802        STA DESADR+1    ; & SAVE
0803        LDY #0          CLEAR INDEX
0804        LDA (DESADR),Y  GET SCREEN CHAR
0805        RTS             ELSE, EXIT
0806 ;
0807 ;        MOVE DOG 1
0808 ;        ----------
0809 ;        DOG 1 ALIGNS ITSELF ON MAN'S HORIZ AXIS
0810 ;        AND ATTACKS ON VERT AXIS
0811 ;
0812 MOVDOG1
0813        LDA #0
0814        STA DOGNO       SET DOG 1 OFFSET
0815        JSR MOVDOGH     MOVE DOG HORIZ
0816        BEQ CHKDOG1V    NO MOVE, SO TRY VERTICAL
0817        RTS             EXIT
0818 CHKDOG1V JSR CHKDOGV   MOVE DOG VERTICAL
0819        RTS             EXIT
0820 ;
0821 ;        MOVE DOG 2
0822 ;        ----------
0823 ;        DOG 2 ALIGNS ITSELF ON MAN'S VERT AXIS
0824 ;        AND ATTACKS ON HORIZ AXIS
0825 ;
0826 MOVDOG2
0827        LDA #1
0828        STA DOGNO       SET DOG 2 OFFSET
0829        JSR CHKDOGV     MOVE DOG VERT IF POSSIBLE
0830        BEQ CHKDOG2H    NO MOVE, SO TRY HORIZ
0831        RTS             ELSE, EXIT
0832 CHKDOG2H
0833        JSR MOVDOGH     MOVE DOG HORIZ
0834        RTS             EXIT
0835 ;
0836 ;        MOVE DOG 3
0837 ;        ----------
0838 ;        DOG 3 MOVES ON VERT & HORIZ PLANES ON SAME TURN
0839 ;        TO REACH THE MAN
0840 ;
0841 MOVDOG3
0842        LDA #2
0843        STA DOGNO       SET DOG 3 OFFSET
0844        JSR MOVDOGH     MOVE DOG HORIZ
0845        JSR CHKDOGV     MOVE DOG 3 VERT IF POSSIBLE
0846        RTS             EXIT
0847 ;
0848 ;        MOVE DOG VERTICALLY
0849 ;        -------------------
0850 CHKDOGV
0851        LDA #PLR1&255   GET 1ST DOG PLAY ADR (LO)
0852        STA DESADR      ; & SAVE
0853        LDA #PLR1/256   GET 1ST DOG PLAY ADR (HO)
0854        STA DESADR+1    ; & SAVE
0855        LDY DOGNO        GET CURRENT DOG #
0856 Q16    BEQ Q17         MATCH, SO START MOVE
0857        INC DESADR+1    ELSE, SET NEXT DOG PLAY AREA
0858        DEY             SET Z FLAG IF MATCH
0859        JMP Q16         SEE IF MATCH NOW
0860 ;
0861 Q17    LDX DOGNO       GET CURRENT DOG #
0862        LDA DOGPOSV,X   GET DOG VERT POS
0863        CMP MANPOSV     COMPARE WITH MAN VERT POS
0864        BNE Q18         NOT SAME, SO MOVE VERTICAL
0865        RTS             SAME, SO EXIT
0866 Q18    BCS MOVDOGU     MAN ABOVE, MOVE DOG UP
0867 MOVDOGD LDA DESADR
0868        PHA             SAVE DOG PLAY AREA (LO)
0869        LDA DESADR+1
0870        PHA             SAVE DOG PLAY AREA (HO)
0871        LDA DOGPOSH,X   GET DOG HORIZ POS
0872        TAY 
0873        LDA DOGPOSV,X   GET DOG VERT POS
0874        CLC             SETUP ADD
0875        ADC #8          PNT TO LINE BELOW
0876        TAX 
0877        JSR CHKUDM      CHECK FOR BRICKS
0878        BEQ Q19         NO BRICKS, SO CONTINUE
0879        PLA 
0880        PLA             CLEAR STACK
0881        LDA #0          ELSE, SET Z FLAG(NO MOVE)
0882        RTS             AND EXIT
0883 Q19    LDX DOGNO       GET CURRENT DOG #
0884        PLA             GET DOG PLAY ADR (HO)
0885        STA DESADR+1
0886        PLA             GET DOG PLAY ADR (LO)
0887        STA DESADR
0888        LDY DOGPOSV,X   GET LINE #
0889        STA (DESADR),Y  BLANK AROUND OLD DOG
0890        INC DOGPOSV,X   PNT TO NEW LINE
0891        INY 
0892 SHONEWD LDX #0         SET SRCE INDEX
0893        LDA #8          SET # OF BYTES IN DOG IMAGE
0894        STA SIZE        SAVE # OF BYTES
0895 Q20    LDA DOGIMAGE,X  GET DOG IMAGE BYTE
0896        STA (DESADR),Y  PUT IN DOG PLAY AREA
0897        INX             PNT TO NEXT PLAYER AREA BYTE
0898        INY             PNT TO NEXT DOG IMAGE BYTE
0899        DEC SIZE        MORE BYTES TO MOVE ?
0900        BNE Q20         YES
0901        LDA #1          NO, SET NZ FLAG(MOVE OCCURRED)
0902        RTS 
0903 ;
0904 MOVDOGU LDX DOGNO GET CURRENT DOG #
0905        LDA DESADR
0906        PHA             SAVE DOG PLAY AREA (LO)
0907        LDA DESADR+1
0908        PHA             SAVE DOG PLAY AREA (HO)
0909        LDA DOGPOSH,X   GET DOG HORIZ POS
0910        TAY 
0911        LDA DOGPOSV,X   GET DOG VERT POS
0912        TAX 
0913        DEX             PNT TO LINE ABOVE
0914        JSR CHKUDM      SEE IF ANY BRICKS
0915        BEQ Q21         NO BRICKS, SO OK
0916        PLA 
0917        PLA             CLEAR STACK
0918        LDA #0          SET Z FLAG (NO MOVE)
0919        RTS 
0920 Q21    LDX DOGNO       GET CURRENT DOG #
0921        PLA             GET DOG PLAY ADR (HO)
0922        STA DESADR+1
0923        PLA             GET DOG PLAY ADR (LO)
0924        STA DESADR
0925        DEC DOGPOSV,X   PNT TO LINE ABOVE
0926        LDA DOGPOSV,X   GET NEW LINE #
0927        PHA             SAVE IT
0928        CLC             SETUP ADD
0929        ADC #8          PNT TO END OF DOG
0930        TAY             SET INDEX REG
0931        LDA #0          SET VALUE TO BLANK DOG CHAR
0932        STA (DESADR),Y  BLANK AROUND OLD DOG
0933        PLA             GET NEW LINE #
0934        TAY 
0935        JMP SHONEWD     SHOW NEW DOG IMAGE
0936 ;
0937 ;        MOVE DOG HORIZONTALLY
0938 ;        ---------------------
0939 MOVDOGH
0940        LDX DOGNO       GET CURRENT DOG #
0941        LDA DOGPOSH,X   GET HORIZ POS
0942        CMP MANPOSH     COMPARE WITH MAN'S HORIZ POS
0943        BNE Q22         NOT SAME, SO MOVE
0944        RTS             ELSE, EXIT
0945 ;
0946 Q22    BCS MOVDOGL     MAN TO LEFT, SO MOVE LEFT
0947 MOVDOGR LDA DOGPOSH,X  GET DOG HORIZ POS
0948        CLC             SETUP ADD
0949        ADC #8          PNT TO DOG RIGHT SIDE
0950        TAY             SAVE IN INDEX
0951        JSR CHKBRKH     CHECK FOR BRICKS THERE
0952        BEQ Q23         NO CHAR SO CONTINUE
0953        RTS             CAN'T MOVE SO EXIT
0954 Q23    INC DOGPOSH,X   SET COL TO RIGHT
0955 SAVDOGH LDA DOGPOSH,X  GET NEW COL
0956        STA HPOSP1,X    SET HARDWARE HORIZ POS
0957        RTS             EXIT
0958 ;
0959 MOVDOGL LDY DOGPOSH,X GET DOG HORIZ POS
0960        DEY             SET COL TO LEFT
0961        JSR CHKBRKH     CHECK FOR BRICKS
0962        BEQ Q24         NO BRICKS, SO CONTINUE
0963        RTS             ELSE, EXIT
0964 Q24    DEC DOGPOSH,X   SET COL TO LEFT
0965        JMP SAVDOGH     SET DOG HORIZ POS
0966 ;
0967 ;        CHECK FOR BRICKS (HORIZ)
0968 ;        ------------------------
0969 CHKBRKH STY TEMP+2     SAVE HORIZ POS TO CHECK
0970        LDA DOGPOSV,X   GET DOG VERT POS
0971        TAX             PUT IN INDEX REG
0972        JSR CHKLRM      CHK IF MOVE OK
0973        PHP             SAVE Z FLAG
0974        LDX DOGNO       GET CURRENT DOG #
0975        PLP             RESTORE Z FLAG
0976        RTS             ELSE, CAN'T MOVE
0977 ;
0978 ;        MOVE BLOCK OF DATA
0979 ;        ------------------
0980 ;        ENTER WITH:
0981 ;         LOC 80,81 = DEST
0982 ;         LOC 82,83 = SRCE
0983 ;         LOC 84,85 = SIZE
0984 ;
0985 MOVE
0986        LDY #0
0987 Q25    LDA (SRCADR),Y  GET SRCE CHAR
0988        STA (DESADR),Y  MOVE TO DEST
0989        JSR BUMPSRC     PNT TO NEXT SRCE ADR
0990        JSR BUMPDES     PNT TO NEXT DEST ADR
0991        JSR DECSIZE     MORE TO MOVE ?
0992        BNE Q25         YES, SO MOVE THEM
0993        RTS             NO, SO EXIT
0994 ;
0995 ;        FILL BLOCK OF MEMORY
0996 ;        --------------------
0997 ;        ENTER WITH:
0998 ;         LOC 80,81 = DEST
0999 ;         LOC 84,85 = SIZE
1000 ;         REG X  = FILL CHAR
1001 ;
1002 FILL
1003        TXA             GET FILL CHAR
1004        LDY #0
1005        STA (DESADR),Y  PUT CHAR IN MEMORY
1006        JSR BUMPDES     PNT TO NEXT DEST ADR
1007        JSR DECSIZE     MORE TO FILL ?
1008        BNE FILL        YES, SO FILL THEM
1009        RTS             NO, SO EXIT
1010 ;
1011 BUMPSRC
1012        CLC             SETUP FOR ADD
1013        LDA SRCADR      GET LO SRCE ADR
1014        ADC #1          ADJUST LO BYTE
1015        STA SRCADR      SAVE LO SRCE ADR
1016        LDA SRCADR+1    GET HO SRCE ADR
1017        ADC #0          ADD CARRY IF ANY
1018        STA SRCADR+1    SAVE HO SRCE ADR
1019 ;
1020        RTS 
1021 ;
1022 BUMPDES
1023        CLC             SETUP FOR ADD
1024        LDA DESADR      GET LO DEST ADR
1025        ADC #1          ADJUST LO BYTE
1026        STA DESADR      SAVE LO DEST ADR
1027        LDA DESADR+1    GET HO DEST ADR
1028        ADC #0          ADD CARRY IF ANY
1029        STA DESADR+1    SAVE HO DEST ADR
1030        RTS 
1031 ;
1032 DECSIZE
1033        SEC             PREPARE FOR SUBTRACT
1034        LDA SIZE        GET LO BYTE OF SIZE
1035        SBC #1          ADJUST LO SIZE BYTE
1036        STA SIZE        SAVE LO SIZE
1037        BNE Q26         LO BYTE NOT 0, SO CONTINUE
1038        LDA SIZE+1      GET HO SIZE BYTE
1039        BNE Q27         NOT 0, SO CONTINUE
1040        RTS             SIZE NOW 0, EXIT WITH Z FLAG
1041 Q26    LDA SIZE+1      GET HO BYTE OF SIZE
1042 Q27    SBC #0          ADJUST HO SIZE BYTE
1043        STA SIZE+1      SAVE HO SIZE BYTE
1044        LDA #1          SIZE NOT 0, SET NZ FLAG
1045        RTS             EXIT
1046 ;
1047 ;        MAIN DELAY
1048 ;        ----------
1049 MDELAY LDX MDELHO      GET DELAY HO VALUE
1050        LDY MDELLO      GET DELAY LO VALUE
1051 Q28    DEY             LO COUNT DONE ?
1052        BNE Q28         NO
1053        DEX             LO COUNT DONE ?
1054        BNE Q28         NO
1055        RTS             YES, SO EXIT
1056 ;
1057 ;        CHECK IF MAN COLLIDED WITH DOG
1058 ;        ------------------------------
1059 CHKMANOK
1060        LDA P0PL        GET MAN/DOG COLLISION INDICATOR
1061        AND #$0E        GET RID OF UNUSED BITS
1062        RTS             EXIT WITH Z FLAG SET IF NO HITS
1063 ;
1064 ;        UPDATE THE SCORE
1065 ;        ----------------
1066 ;
1067 ;        REG Y=VALUE TO ADD TO SCORE
1068 ;
1069 ADDSCORE LDA SCORE+1   GET 10,000 UNIT VALUE
1070        STA TEMP        ; & SAVE
1071 ADDSCOR1 LDX #5        SET TO PNT TO LO DIGIT
1072 Q29    INC SCORE,X     INC DIGIT
1073        LDA SCORE,X     GET DIGIT
1074        CMP #$1A        PAST '9' ?
1075        BNE Q30         NO, SO CONTINUE ADDING
1076        LDA #$10        YES, SO SET ATASCII 0
1077        STA SCORE,X     SAVE DIGIT
1078        DEX             PNT TO NEXT HIGHER DIGIT
1079        BPL Q29         IF WITHIN 6 DIGITS, CONTINUE
1080 Q30    DEY             MORE TO ADD ?
1081        BNE ADDSCOR1    YES
1082 ;
1083        LDA TEMP        GET ORIGINAL 10,000 UNIT VALUE
1084        CMP SCORE+1     HAS ANOTHER 10,000 BEEN REACHED?
1085        BEQ Q31         NO, SO EXIT
1086        LDA LIVES       YES, SO GET # OF LIVES
1087        CMP #4          ALREADY HAVE MAXIMUM ?
1088        BEQ Q31         YES
1089        INC LIVES       NO, SO ADD A LIFE
1090        JSR SHOWLIVS    SHOW EXTRA LIFE ON SCRN
1091 Q31    RTS             ELSE, EXIT
1092 ;
1093 ;        SHOW LIVES REMAINING
1094 ;        --------------------
1095 SHOWLIVS LDY #4        SET MAX # OF LIVES
1096        LDA #0
1097 Q32    STA SLINE+8,Y   BLANK SCRN LIVES
1098        DEY             MORE TO BLANK ?
1099        BNE Q32         YES
1100 ;
1101        LDY LIVES       GET # OF LIVES
1102        BEQ Q33         NO LIVES LEFT, SO EXIT
1103        LDA #LC+PF2CMASK GET LIFE CHAR
1104 Q34    STA SLINE+8,Y   PUT LIFE CHAR ON SCRN
1105        DEY             MORE TO SHOW ?
1106        BNE Q34         YES
1107 Q33    RTS 
1108 ;
1109 ;        SET NEXT LEVEL
1110 ;        --------------
1111 SETNLEV LDA LEVEL      GET CURRENT LEVEL
1112        AND #$0F        MAKE IT BINARY
1113        CMP #7          HIGHEST LEVEL ?
1114        BEQ Q35         YES
1115 ;
1116        INC LEVEL       NO, SO SET NEXT LEVEL
1117 Q35    LDA COLOR1      GET ORIG PLAYFIELD 1 COLOR
1118        PHA             SAVE ON STACK
1119        LDA #5          SET # OF TIMES TO LOOP
1120        STA TEMP
1121 Q36    LDA #GREY+12    SET COLOR & LUMINANCE
1122        STA COLOR1
1123 ;
1124        LDA #$80
1125        STA AUDF1       SET FREQ
1126        LDA #$A6
1127        STA AUDC1       SET DISTORTION & VOLUME
1128        LDY #0          SET OUTER LOOP VAL
1129        LDX #0          SET INNER LOOP VAL
1130        JSR WAIT
1131 ;
1132        LDA #REDORG+6   SET NEW COLOR & LUMINANCE
1133        STA COLOR1
1134 ;
1135        LDA #$C0
1136        STA AUDF1       SET FREQ
1137        LDA #$A6
1138        STA AUDC1       SET DISTORTION & VOLUME
1139        LDY #0          SET OUTER LOOP VAL
1140        LDX #0          SET INNER LOOP VAL
1141        JSR WAIT
1142 ;
1143        DEC TEMP        CHANGE COLORS AGAIN ?
1144        BNE Q36         YES
1145 ;
1146        PLA             GET ORIG PLAYFIELD 1 COLOR
1147        STA COLOR1      RESTORE IT
1148        LDA #0
1149        STA AUDC1       SET 0 VOLUME
1150        RTS 
1151 ;
1152 WAIT   TXA             SAVE INNER LOOP VAL
1153 Q37    TAX             GET INNER LOOP VAL
1154 Q38    DEX             INNER LOOP DONE ?
1155        BNE Q38         NO
1156        DEY             OUTER LOOP DONE ?
1157        BNE Q37         NO
1158        RTS 
1159 ;
1160 ;        KILL MAN
1161 ;        --------
1162 KILLMAN
1163        LDA #9          SET INITIAL FREQUENCY
1164        STA TEMP        SAVE FREQ
1165        STA AUDF1       SET FREQUENCY
1166        LDA #$A0        SET INITIAL VOLUME
1167        STA VOLUME      SAVE FOR LATER
1168        STA AUDC1       SET HARDWARE DIST & VOL
1169        LDA #5          SET # OF TIMES TO DO COLOR CHANGE
1170 Q39    PHA             SAVE ON STACK
1171        LDX #$FF        SET INITIAL COLOR
1172 Q40    LDY #$FF        SET DELAY VALUE
1173        STX             PCOLR0 SET MAN COLOR
1174 Q41    DEY             DELAY
1175        BNE Q41
1176        LDA VOLUME      GET VOLUME
1177        SEC             SETUP SUBTRACT
1178        SBC #3          SET NEW VOLUME
1179        STA VOLUME      ; & SAVE
1180        STA AUDC1       SET HARDWARE DIST & VOL
1181        DEX             MORE COLORS ?
1182        BNE Q40         YES, SO SHOW THEM
1183        INC TEMP        SET NEW FREQ
1184        LDA TEMP        GET IT
1185        STA AUDF1       SET HARDWARE FREQ
1186        PLA             GET COLOR CHANGE COUNT
1187        SEC             SETUP FOR SUBTRACT
1188        SBC #1          SHOW COLOR CHANGE AGAIN ?
1189        BNE Q39         YES
1190        STA AUDC1       SET 0 VOLUME
1191        RTS 
1192 ;
1193 ;        SETUP INITIAL BRICKS
1194 ;        --------------------
1195 INITBRKS JSR CLSCRN    CLEAR THE PLAY AREA
1196        JSR DRAWWALL    DRAW LEFT/RIGHT WALL
1197        LDA #BC         GET BRICK CHAR
1198        STA TEMP        SAVE IT
1199        STA DISP+91     PUT BRICK ON SCREEN
1200        LDX #9          SET # OF BRICKS TO PUT ON SCRN
1201        LDA #FIRSTBR&255 GET LO ADR OF 1ST BRICK
1202        STA DESADR      SAVE IT
1203        LDA #FIRSTBR/256 GET HO ADR OF 1ST BRICK
1204        STA DESADR+1    SAVE IT
1205 Q42    LDA #M4LSIZE    SET AMT TO GET TO NEXT LINE
1206        JSR PUTSCRCH    PUT BRICK ON SCRN
1207        DEX             MORE BRICKS ?
1208        BNE Q42         YES
1209        RTS             EXIT
1210 ;
1211 ;        MOVE BRICK CHAR
1212 ;        ---------------
1213 MOVBRICK LDA #0
1214        STA BSNDFLAG    CLEAR BRICK SOUND FLAG
1215        LDA STRIG0      IS TRIG DOWN ?
1216        BNE Q43         NO, SO EXIT
1217 ;
1218        LDA #0          TRIG DOWN, SO
1219        STA ATRACT      DISABLE ATTRACT MODE
1220 ;
1221        LDA MANPOSH     GET MAN HORIZ POS
1222        AND #3          IS MAN AT START OF CHAR BYTE ?
1223        BNE Q43         NO, SO EXIT
1224        LDA MANPOSH     GET MAN HORIZ POS
1225        SEC             PREPARE FOR SUBT
1226        SBC #8          PNT TO CHAR BEFORE MAN
1227        TAY 
1228        STA TEMP+3      SAVE IN CASE ITS NEEDED
1229        LDX MANPOSV     GET MAN VERT POS
1230        JSR GETSCRN     GET CHAR THERE
1231        CMP #BC         IS IT A BRICK ?
1232        BEQ Q44         YES, SO MOVE BRICK
1233 ;
1234        LDA MANPOSV     GET VERT POS
1235        CLC             SETUP ADD
1236        ADC #8          PNT 1 CHAR DOWN
1237        TAX             SET VERT POS
1238        LDY TEMP+3      GET HORIZ POS
1239        JSR GETSCRN     GET SCRN CHAR
1240        CMP #BC         BRICK ?
1241        BNE Q43         NO, SO EXIT
1242 Q44    LDY #0          SET INDEX
1243        LDA #0          SET BLANK CHAR
1244        STA (DESADR),Y  BLANK OLD BRICK CHAR
1245        LDA #BC         GET BRICK CHAR
1246        LDY #1          SET INDEX FOR CHAR TO RIGHT
1247        STA (DESADR),Y  PUT BRICK AT NEW LOC
1248        LDY #BRKPOINT   GET POINTS FOR BRICK MOVE
1249        JSR ADDSCORE    ADD TO SCORE
1250        DEC BMOVES      REDUCE # OF BRICKS TO MOVE
1251        JSR BRKSND      MAKE BRICK SOUND
1252 Q43 RTS 
1253 ;
1254 ;        MAKE BRICK SOUND
1255 ;        ----------------
1256 BRKSND LDA #$70        SET INITIAL VOL,DISTORTION
1257        STA VOLUME
1258        LDA #$08        SET FREQUENCY
1259        STA AUDF1
1260 Q45    LDA VOLUME
1261        STA AUDC1       SET VOL & DISTORTION
1262        LDY #5          SET OUTER LOOP COUNT
1263 Q46    LDX #$40        SET INNER LOOP COUNT
1264 Q47    DEX             INNER LOOP DONE ?
1265        BNE Q47         NO
1266        DEY             OUTER LOOP DONE ?
1267        BNE Q46         NO
1268        DEC VOLUME      MORE SOUND ?
1269        LDA VOLUME
1270        CMP #$58
1271        BNE Q45         YES
1272        LDA #1
1273        STA BSNDFLAG    BRICK MADE SOUND,SO SET FLAG
1274        RTS 
1275 ;
1276 ENDMSG .BYTE 39,33,45,37,0,47,54,37,50,255 ; "GAME OVER"
1277 ;
1278 ;        SCORE LINE
1279 ;        ----------
1280 SLINE  .BYTE 0
1281 LEVEL  .BYTE 0,0,0,0,0,0,0,0,0,0,0,0
1282 SCORE  .BYTE 0,0,0,0,0,0,0
1283 ;
1284 SLEND  =   *
1285 ;
1286 DIGITS .BYTE 16,17,18,19,20,21,22,23,24,25
1287 ;
1288 LIFEPAT .BYTE $80,$90,$78,$3C,$1A,$38,$48,$48
1289 ;
1290 BRICKPAT .BYTE $AA,$82,$82,$AA,$AA,$82,$82,$AA
1291 ;
1292 WALLPAT .BYTE $FF,$99,$99,$99,$99,$99,$99,$FF
1293 ;
1294 ;        HORIZ MOVING MAN IMAGES
1295 ;        -----------------------
1296 MANH1  .BYTE $10,$10,$38,$7C,$BA,$48,$84,$82
1297 MANH2  .BYTE $10,$10,$38,$38,$78,$AC,$48,$44
1298 MANH3  .BYTE $10,$10,$38,$38,$38,$28,$28,$10
1299 MANH4  .BYTE $10,$10,$38,$7C,$BA,$38,$10,$28
1300 MANH5  .BYTE $10,$10,$38,$38,$7C,$38,$48,$48
1301 ;
1302 ;        VERTICAL MOVING MAN IMAGES
1303 ;        --------------------------
1304        .BYTE $80,$90,$78,$3C,$1A,$38,$48,$48
1305        .BYTE $00,$10,$FC,$3A,$18,$24,$24,$00
1306        .BYTE $00,$10,$FC,$3A,$18,$24,$24,$00
1307        .BYTE $02,$12,$3C,$78,$B0,$38,$24,$22
1308 ;
1309 ;        DOG IMAGE
1310 ;        ---------
1311 DOGIMAGE .BYTE $66,$95,$1C,$22,$36,$3E,$14,$36
1312 ;
1313 ;        LEVEL CHARACTERISTICS TABLE
1314 ;        ---------------------------
1315 ;        EACH ENTRY CONSISTS OF:
1316 ;
1317 ;        E1,E2,E3,E4
1318 ;
1319 ;        E1 = NORMAL DOG MOVES / MAN MOVE
1320 ;        E2 = MAN PULLING WALL DOG MOVES/MAN MOVE
1321 ;        E3 = OUTER LOOP DELAY VALUE (MAIN LOOP)
1322 ;        E4 = INNER LOOP DELAY VALUE (MAIN LOOP)
1323 ;
1324 LEVTBL .BYTE 8,8,12,0  LEVEL 1
1325        .BYTE 3,3,12,$80 LEVEL 2
1326        .BYTE 3,2,11,0  LEVEL 3
1327        .BYTE 2,2,11,0  LEVEL 4
1328        .BYTE 2,1,11,80 LEVEL 5
1329        .BYTE 2,1,11,$80 LEVEL 6
1330        .BYTE 2,1,10,0  LEVEL 7
1331 ;
1332 BMOVES *=  *+1         # OF BRICKS TO BE MOVED
1333 BSNDFLAG *= *+1        0 IF NO BRICK SOUND MADE
1334 ;                      1 IF BRICK SOUND MADE
1335 LIVES  *=  *+1         # OF LIVES REMAINING
1336 MDELHO *=  *+1         MAIN DELAY HO VALUE
1337 MDELLO *=  *+1         MAIN DELAY LO VALUE
1338 TEMP   *=  *+4         TEMPORARY WORK STORAGE
1339 VOLUME *=  *+1         VOLUME FOR SOUNDS
1340 ;
1341 ;        MAN VARIABLES
1342 ;        -------------
1343 MANPICNO *= *+1        MAN'S CURRENT IMAGE #
1344 MANPOSH *= *+1         MAN'S CURRENT HORIZ POS
1345 MANPOSV *= *+1         MAN'S CURRENT VERT POS
1346 ;
1347 ;        DOG VARIABLES
1348 ;        -------------
1349 DOGPOSH =  *
1350 DOG1POSH *= *+1        DOG 1 HORIZ POS
1351 DOG2POSH *= *+1        DOG 2 HORIZ POS
1352 DOG3POSH *= *+1        DOG 3 HORIZ POS
1353 ;
1354 DOGPOSV =  *
1355 DOG1POSV *= *+1        DOG 1 VERT POS
1356 DOG2POSV *= *+1        DOG 2 VERT POS
1357 DOG3POSV *= *+1        DOG 3 VERT POS
1358 ;
1359 DOGFREQ1 *= *+1        # OF TIMES MAN MOVES BEFORE DOG DOES
1360 ;                    WHEN MAN NOT PULLING WALL
1361 DOGFREQ2 *= *+1        # OF TIMES MAN MOVES BEFORE DOG
1362 ;                    WHEN MAN PULLING WALL
1363 DOGMOVCT *= *+1        INDICATES WHEN DOG CAN MOVE
1364 DOGNO *=  *+1          CURRENT DOG #
1365 ;