Blip Blop


Below is the source code and design documents for Blip Blop, as well as a virtual +3 disk containing the original code and the full game.

Source Code

Blip Blop’s source code comes in five separate blocks. CODE.TEX contains *F instructions which tell the assembler to include the other four blocks.

CODE.TEX

   10 *D+
   20 WKSPB  EQU  61440
   30 A1     EQU  53248
   40 A2     EQU  57344
   50 OBGRAP EQU  40000
   60 COLBUF EQU  38464
   70 LECSET EQU  47496
   80 DRIGRA EQU  47456
   90 DROGRA EQU  47488
  100 MANGRA EQU  47392
  110 DEATHG EQU  38976
  120 ENTRY  ORG  40640
  130        DI
  140        LD   IY,XPOS
  150        JP   RESET
  160 XPOS   DEFB " ","@",#00
  170        DEFB #01,#01,#01
  180 OLSPPO DEFB #00,#00
  190 OLSPRI DEFB #00,#00,#00
  200        DEFB "l",#00,#00
  210 ADDST  DEFW 0
  220 ADDST2 DEFW 0
  230 CARRY  DEFB 255,255,255
  240 CARPOI DEFB 0
  250 FLAGS2 DEFB 0
  260 BORCOL DEFB 0
  270 SCSLEF DEFB 1
  280 SCSUP  DEFB 1
  290 OLDOBJ DEFB 255
  300 DXPOS  DEFB 32
  310 DYPOS  DEFB 64
  320 DLDIR  DEFB 0
  330 DROOM  DEFB 108
  340 FLAGS3 DEFB %00000011
  350 STADRI DEFB 0
  360 POSDRO DEFW WKSPB+1811+256
  370 POSDR2 DEFW 64275
  380 POSDR3 DEFW 0
  390 WHIDRI DEFB 2
  400 DEFFRA DEFB 0
  410 LIVES  DEFB 5
  420 MAINLO CALL SCRCH
  430        CALL A2TOB
  440        CALL BALLOO
  450        CALL MOVMAI
  460        CALL SPACE
  470        CALL USE
  480 DRACAL
  490        CALL DRIP
  500        CALL MAN
  510        CALL DRAWMA
  520        CALL OBJECT
  530        CALL BTOSC
  540        CALL MANCOL
  550        CALL OBCOLS
  560        CALL DRICOL
  570        CALL DIE
  580        CALL QUIT
  590        CALL METCAR
  600        CALL RELKEY
  610        CALL SELOBJ
  620        CALL PAUSE
  630        CALL 08020
  640        RET  NC
  650        JR   MAINLO
  660 A2TOB  LD   HL,A2
  670        LD   DE,WKSPB
  680        LD   BC,04096
  690        LDIR
  700        RET
  710 BTOSC  LD   HL,WKSPB
  720        LD   DE,16384
  730        LD   B,#80
  740 BTOSC2 PUSH BC
  750        LD   BC,00032
  760        PUSH DE
  770        LDIR
  780        POP  DE
  790        CALL SDSCR
  800        POP  BC
  810        DJNZ BTOSC2
  820        LD   IY,23610
  830        EI
  840        HALT
  850        DI
  860        LD   IY,XPOS
  870 COLTOS LD   HL,COLBUF
  880        LD   DE,22528
  890        LD   BC,512
  900        LDIR
  910        RET
  920 DRAWMA LD   D,(IY+1)
  930        LD   E,#00
  940        SRL  D
  950        RR   E
  960        SRL  D
  970        RR   E
  980        SRL  D
  990        RR   E
 1000        LD   L,(IY+0)
 1010        SRL  L
 1020        LD   H,#00
 1030        ADD  HL,DE
 1040        LD   DE,WKSPB
 1050        ADD  HL,DE
 1060        PUSH HL
 1070        LD   (IY+6),L
 1080        LD   (IY+7),H
 1090        LD   HL,49408
 1100        LD   D,(IY+2)
 1110        LD   E,#00
 1120        SRL  D
 1130        RR   E
 1140        ADD  HL,DE
 1150        BIT  0,(IY+0)
 1160        JR   Z,DRAW6
 1170        LD   DE,00384
 1180        ADD  HL,DE
 1190 DRAW6  POP  DE
 1200        PUSH DE
 1210        EX   DE,HL
 1220        LD   C,#20
 1230 DRAW7  LD   B,#04
 1240 MASKIN LD   A,(DE)
 1250        AND  (HL)
 1260        LD   (HL),A
 1270        INC  DE
 1280        INC  HL
 1290        DJNZ MASKIN
 1300        PUSH BC
 1310        LD   BC,00028
 1320        ADD  HL,BC
 1330        POP  BC
 1340        DEC  C
 1350        JR   NZ,DRAW7
 1360        DEC  (IY+3)
 1370        JR   NZ,DRAW8
 1380        LD   (IY+3),#04
 1390 DRAW8  CALL GETGRA
 1400        POP  DE
 1410        EX   DE,HL
 1420        LD   (IY+8),E
 1430        LD   (IY+9),D
 1440 DRAW9  LD   B,#04
 1450 DRAING LD   A,(DE)
 1460        OR   (HL)
 1470        LD   (HL),A
 1480        INC  DE
 1490        INC  HL
 1500        DJNZ DRAING
 1510        PUSH BC
 1520        LD   BC,00028
 1530        ADD  HL,BC
 1540        POP  BC
 1550        DEC  C
 1560        JR   NZ,DRAW9
 1570        RET
 1580 SPACE  LD   A,(IY+5)
 1590        CP   #00
 1600        RET  NZ
 1610        LD   BC,32766
 1620        IN   A,(C)
 1630        BIT  0,A
 1640        RET  NZ
 1650        LD   A,(IY+10)
 1660        CP   #00
 1670        RET  NZ
 1680        LD   (IY+10),#09
 1690        SET  1,(IY+13)
 1700        RET
 1710 CONTRO LD   (IY+10),#00
 1720        LD   A,(IY+2)
 1730        LD   (IY+4),A
 1740        LD   BC,32766
 1750        IN   A,(C)
 1760        LD   HL,(OLSPPO)
 1770        LD   DE,A2
 1780        ADD  HL,DE
 1790        PUSH HL
 1800        BIT  3,A
 1810        JR   NZ,RIGHT
 1820        XOR  A
 1830        CP   (IY+2)
 1840        JR   NZ,LEFTNO
 1850        DEC  (IY+0)
 1860        BIT  0,(IY+0)
 1870        JR   Z,LEFT2
 1880        DEC  HL
 1890 LEFT2  LD   (IY+4),#80
 1900        PUSH HL
 1910        CALL GETGRA
 1920        POP  DE
 1930        EX   DE,HL
 1940        CALL TESTIT
 1950        JR   C,RIGHT
 1960        INC  (IY+0)
 1970        JR   RIGHT
 1980 LEFTNO DEC  (IY+2)
 1990 RIGHT  LD   BC,32766
 2000        IN   A,(C)
 2010        BIT  2,A
 2020        POP  HL
 2030        JR   NZ,MOVRET
 2040        LD   A,#02
 2050        CP   (IY+2)
 2060        JR   NZ,RIGHNO
 2070        INC  (IY+0)
 2080        BIT  0,(IY+0)
 2090        JR   NZ,RIGHT2
 2100        INC  HL
 2110 RIGHT2 LD   (IY+4),#80
 2120        PUSH HL
 2130        CALL GETGRA
 2140        POP  DE
 2150        EX   DE,HL
 2160        CALL TESTIT
 2170        JR   C,MOVRET
 2180        DEC  (IY+0)
 2190        JR   MOVRET
 2200 RIGHNO INC  (IY+2)
 2210 MOVRET LD   A,(IY+2)
 2220        CP   (IY+4)
 2230        RET  NZ
 2240        LD   (IY+2),#01
 2250        RET
 2260 MOVMAI LD   (IY+5),#01
 2270        LD   HL,(OLSPPO)
 2280        LD   DE,A2
 2290        ADD  HL,DE
 2300        PUSH HL
 2310        LD   DE,(OLSPRI)
 2320        DEC  (IY+1)
 2330        BIT  1,(IY+13)
 2340        JR   Z,RISEOK
 2350        BIT  4,(IY+13)
 2360        JR   Z,RISEOK
 2370        INC  (IY+1)
 2380        INC  (IY+1)
 2390 RISEOK
 2400        LD   A,(IY+10)
 2410        LD   (IY+10),#00
 2420        PUSH AF
 2430        CALL TESTIT
 2440        POP  BC
 2450        POP  HL
 2460        SET  5,(IY+22)
 2470        RET  NC
 2480        RES  5,(IY+22)
 2490        BIT  1,(IY+13)
 2500        JR   Z,FLOAT
 2510        BIT  4,(IY+13)
 2520        JR   Z,FLOAT
 2530        DEC  (IY+1)
 2540        DEC  (IY+1)
 2550 FLOAT
 2560        LD   A,B
 2570        CP   #00
 2580        JP   NZ,JUMP
 2590        PUSH HL
 2600        INC  (IY+1)
 2610        LD   DE,00032
 2620        ADD  HL,DE
 2630        LD   DE,(OLSPRI)
 2640        CALL TESTIT
 2650        POP  HL
 2660        RES  1,(IY+13)
 2670        LD   (IY+5),0
 2680        JP   NC,CONTRO
 2690        PUSH HL
 2700        LD   (IY+5),1
 2710        LD   A,(IY+0)
 2720        LD   (IY+4),A
 2730        AND  #02
 2740        LD   B,A
 2750        LD   A,(IY+2)
 2760        DEC  A
 2770        ADD  A,(IY+0)
 2780        LD   (IY+0),A
 2790        AND  #02
 2800        CP   B
 2810        JR   Z,FLY4
 2820        LD   D,#00
 2830        LD   E,(IY+2)
 2840        DEC  DE
 2850        ADD  HL,DE
 2860 FLY4   LD   DE,00128
 2870        ADD  HL,DE
 2880        PUSH HL
 2890        CALL GETGRA
 2900        POP  DE
 2910        EX   DE,HL
 2920        INC  (IY+1)
 2930        INC  (IY+1)
 2940        INC  (IY+1)
 2950        INC  (IY+1)
 2960        CALL TESTIT
 2970        POP  HL
 2980        RET  C
 2990        PUSH HL
 3000        LD   DE,00128
 3010        ADD  HL,DE
 3020        LD   D,(IY+9)
 3030        LD   E,(IY+8)
 3040        LD   A,(IY+4)
 3050        LD   (IY+0),A
 3060        CALL TESTIT
 3070        POP  HL
 3080        RET  C
 3090        PUSH HL
 3100        LD   DE,00096
 3110        ADD  HL,DE
 3120        LD   D,(IY+9)
 3130        LD   E,(IY+8)
 3140        DEC  (IY+1)
 3150        CALL TESTIT
 3160        POP  HL
 3170        RET  C
 3180        LD   DE,00064
 3190        ADD  HL,DE
 3200        LD   D,(IY+9)
 3210        LD   E,(IY+8)
 3220        DEC  (IY+1)
 3230        CALL TESTIT
 3240        RET  C
 3250        DEC  (IY+1)
 3260        RET
 3270 JUMP   SET  1,(IY+13)
 3280        PUSH HL
 3290        DEC  A
 3300        JR   NZ,JUMP12
 3310        BIT  4,(IY+13)
 3320        JR   NZ,JUMP12
 3330        RES  1,(IY+13)
 3340 JUMP12
 3350        LD   (IY+10),A
 3360        LD   A,(IY+0)
 3370        LD   (IY+4),A
 3380        AND  #02
 3390        LD   B,A
 3400        LD   A,(IY+2)
 3410        DEC  A
 3420        ADD  A,(IY+0)
 3430        LD   (IY+0),A
 3440        AND  #02
 3450        CP   B
 3460        JR   Z,JUMP4
 3470        LD   D,#00
 3480        LD   E,(IY+2)
 3490        DEC  DE
 3500        ADD  HL,DE
 3510 JUMP4  LD   DE,00128
 3520        AND  A
 3530        SBC  HL,DE
 3540        PUSH HL
 3550        CALL GETGRA
 3560        POP  DE
 3570        EX   DE,HL
 3580        DEC  (IY+1)
 3590        DEC  (IY+1)
 3600        DEC  (IY+1)
 3610        CALL TESTIT
 3620        POP  HL
 3630        RET  C
 3640        PUSH HL
 3650        LD   DE,00128
 3660        AND  A
 3670        SBC  HL,DE
 3680        LD   DE,(OLSPRI)
 3690        LD   A,(IY+4)
 3700        LD   (IY+0),A
 3710        CALL TESTIT
 3720        POP  HL
 3730        RET  C
 3740        PUSH HL
 3750        LD   DE,00096
 3760        AND  A
 3770        SBC  HL,DE
 3780        LD   DE,(OLSPRI)
 3790        INC  (IY+1)
 3800        CALL TESTIT
 3810        POP  HL
 3820        RET  C
 3830        PUSH HL
 3840        LD   DE,00064
 3850        AND  A
 3860        SBC  HL,DE
 3870        LD   DE,(OLSPRI)
 3880        INC  (IY+1)
 3890        CALL TESTIT
 3900        POP  HL
 3910        RET  C
 3920        LD   DE,00032
 3930        AND  A
 3940        SBC  HL,DE
 3950        LD   DE,(OLSPRI)
 3960        INC  (IY+1)
 3970        CALL TESTIT
 3980        RET  C
 3990        LD   (IY+10),#00
 4000        INC  (IY+1)
 4010        RET
 4020 SSETU  LD   HL,A1
 4030        LD   DE,53249
 4040        LD   BC,04095
 4050        LD   (HL),#00
 4060        LDIR
 4070        LD   L,(IY+11)
 4080        LD   H,#00
 4090        SLA  L
 4100        RL   H
 4110        LD   DE,47744
 4120        ADD  HL,DE
 4130        LD   E,(HL)
 4140        INC  HL
 4150        LD   D,(HL)
 4160        CALL PRINTI
 4170        LD   HL,A2
 4180        LD   BC,COLBUF
 4190        LD   (PRINST),BC
 4200        LD   BC,08208
 4210 SSETU2 LD   A,(DE)
 4220        CP   #00
 4230        JR   Z,NOUGHT
 4240        CP   #09
 4250        JR   Z,WATER
 4260        CP   #7E
 4270        JP   Z,MOONRO
 4280        PUSH BC
 4290        LD   BC,(PRINST)
 4300        PUSH DE
 4310        CALL PRICH
 4320        POP  DE
 4330        INC  BC
 4340        INC  HL
 4350        INC  DE
 4360        LD   (PRINST),BC
 4370        POP  BC
 4380 SSETU3 DJNZ SSETU2
 4390        LD   B,#20
 4400        PUSH BC
 4410        LD   BC,00224
 4420        ADD  HL,BC
 4430        POP  BC
 4440        DEC  C
 4450        JR   NZ,SSETU2
 4460 EXTADD LD   L,(IY+11)
 4470        LD   H,0
 4480        SLA  L
 4490        RL   H
 4500        LD   DE,EXTRAT
 4510        ADD  HL,DE
 4520        LD   E,(HL)
 4530        INC  HL
 4540        LD   D,(HL)
 4550 EXTAD2 LD   A,(DE)
 4560        CP   254
 4570        RET  Z
 4580        BIT  7,A
 4590        JP   NZ,ADDIT
 4600        LD   A,253
 4610        LD   H,D
 4620        LD   L,E
 4630        LD   BC,0
 4640        CPIR
 4650        LD   D,H
 4660        LD   E,L
 4670        JR   EXTAD2
 4680 NOUGHT INC  DE
 4690        LD   A,(DE)
 4700        LD   (IY+12),A
 4710        INC  DE
 4720        XOR  A
 4730 NOUGH2 PUSH BC
 4740        LD   BC,(PRINST)
 4750        PUSH DE
 4760        CALL PRICH
 4770        POP  DE
 4780        INC  BC
 4790        INC  HL
 4800        LD   (PRINST),BC
 4810        POP  BC
 4820        DEC  (IY+12)
 4830        JR   Z,SSETU3
 4840        DJNZ NOUGH2
 4850        LD   B,#20
 4860        DEC  C
 4870        PUSH BC
 4880        LD   BC,00224
 4890        ADD  HL,BC
 4900        POP  BC
 4910        JR   NOUGH2
 4920 WATER  INC  DE
 4930        LD   A,(DE)
 4940        LD   (IY+12),A
 4950        INC  DE
 4960        LD   A,#09
 4970 WATER2 PUSH BC
 4980        LD   BC,(PRINST)
 4990        PUSH DE
 5000        CALL PRICH
 5010        POP  DE
 5020        INC  BC
 5030        INC  HL
 5040        LD   (PRINST),BC
 5050        POP  BC
 5060        DEC  (IY+12)
 5070        JR   Z,SSETU3
 5080        DJNZ WATER2
 5090        LD   B,#20
 5100        DEC  C
 5110        PUSH BC
 5120        LD   BC,00224
 5130        ADD  HL,BC
 5140        POP  BC
 5150        JR   WATER2
 5160 MOONRO INC  DE
 5170        LD   A,(DE)
 5180        LD   (IY+12),A
 5190        INC  DE
 5200        LD   A,#7E
 5210 MOONR2 PUSH BC
 5220        LD   BC,(PRINST)
 5230        PUSH DE
 5240        CALL PRICH
 5250        POP  DE
 5260        INC  BC
 5270        INC  HL
 5280        LD   (PRINST),BC
 5290        POP  BC
 5300        DEC  (IY+12)
 5310        JP   Z,SSETU3
 5320        DJNZ MOONR2
 5330        LD   B,#20
 5340        DEC  C
 5350        PUSH BC
 5360        LD   BC,00224
 5370        ADD  HL,BC
 5380        POP  BC
 5390        JR   MOONR2
 5400 SCRCH  RES  0,(IY+13)
 5410        LD   A,(IY+11)
 5420        LD   (IY+12),A
 5430        LD   A,(IY+0)
 5440        CP   #00
 5450        CALL Z,SCLEFT
 5460        LD   A,(IY+0)
 5470        CP   #3A
 5480        CALL Z,SCRIGH
 5490        LD   A,(IY+1)
 5500        CP   #04
 5510        CALL C,SCUP
 5520        LD   A,(IY+1)
 5530        CP   #5C
 5540        CALL NC,SCDOWN
 5550        BIT  0,(IY+13)
 5560        RET  Z
 5570        POP  AF
 5580        CALL SCRADJ
 5590 SCRCH3 CALL SSETU
 5600        CALL A2TOB
 5610        CALL GETVAL
 5620        JP   DRACAL
 5630 SCLEFT LD   A,#00
 5640        CP   (IY+2)
 5650        RET  NZ
 5660        DEC  (IY+11)
 5670        LD   (IY+0),#3A
 5680        SET  0,(IY+13)
 5690        LD   A,(IY+12)
 5700        CALL LEFEDG
 5710        JR   C,SCLEF2
 5720        LD   (IY+11),A
 5730 SCLEF2 LD   A,(IY+11)
 5740        CALL LEFEDG
 5750        RET  C
 5760        INC  (IY+24)
 5770        RET  NZ
 5780        LD   (IY+24),255
 5790        RET
 5800 SCRIGH LD   A,#02
 5810        CP   (IY+2)
 5820        RET  NZ
 5830        INC  (IY+11)
 5840        LD   (IY+0),#00
 5850        SET  0,(IY+13)
 5860        LD   A,(IY+12)
 5870        CALL LEFEDG
 5880        JR   C,SCRIG2
 5890        DEC  (IY+24)
 5900        JR   Z,SCRIG2
 5910        LD   (IY+11),A
 5920 SCRIG2
 5930        RET
 5940 SCUP   BIT  1,(IY+13)
 5950        RET  Z
 5960        LD   A,(IY+11)
 5970        SUB  #19
 5980        LD   (IY+11),A
 5990        LD   (IY+1),#60
 6000        SET  0,(IY+13)
 6010        LD   A,(IY+12)
 6020        CALL TOP
 6030        JR   NC,SCUP2
 6040        LD   (IY+11),A
 6050 SCUP2  LD   A,(IY+11)
 6060        CP   174
 6070        RET  NC
 6080        CP   156
 6090        RET  C
 6100        INC  (IY+25)
 6110        RET  NZ
 6120        LD   (IY+25),255
 6130        RET
 6140 SCDOWN BIT  1,(IY+13)
 6150        RET  NZ
 6160        LD   DE,A1
 6170        LD   L,(IY)
 6180        SRA  L
 6190        LD   H,0
 6200        ADD  HL,DE
 6210        LD   A,(IY+11)
 6220        ADD  A,#19
 6230        LD   (IY+11),A
 6240        CALL SCRADJ
 6250        LD   A,(IY+12)
 6260        CALL TOP
 6270        JR   NC,SCDOW2
 6280        DEC  (IY+25)
 6290        JR   Z,SCDOW2
 6300        LD   (IY+11),A
 6310 SCDOW2 PUSH HL
 6320        CALL SSETU
 6330        POP  HL
 6340        CALL TESTIT
 6350        JR   NC,SCDONO
 6360        LD   (IY+1),#00
 6370        SET  0,(IY+13)
 6380        POP  AF
 6390        POP  AF
 6400        CALL A2TOB
 6410        CALL GETVAL
 6420        JP   DRACAL
 6430 SCDONO LD   A,(IY+11)
 6440        SUB  #19
 6450        LD   (IY+11),A
 6460        CALL SSETU
 6470        RET
 6480 GETGRA LD   D,(IY+3)
 6490        DEC  D
 6500        LD   E,#00
 6510        LD   L,E
 6520        SRL  D
 6530        RR   E
 6540        LD   H,(IY+2)
 6550        SLA  L
 6560        RL   H
 6570        ADD  HL,DE
 6580        LD   DE,50176
 6590        ADD  HL,DE
 6600        LD   C,#20
 6610        BIT  0,(IY+0)
 6620        RET  Z
 6630        LD   DE,01536
 6640        ADD  HL,DE
 6650        RET
 6660 SDSCR  INC  D
 6670        LD   A,D
 6680        AND  #07
 6690        RET  NZ
 6700        LD   A,E
 6710        ADD  A,#20
 6720        LD   E,A
 6730        RET  C
 6740        LD   A,D
 6750        SUB  #08
 6760        LD   D,A
 6770        RET
 6780 TESTIT LD   DE,(OLSPRI)
 6790        LD   C,#20
 6800        LD   A,(IY+3)
 6810        LD   (IY+12),A
 6820        BIT  4,(IY+13)
 6830        JR   NZ,TESTI1
 6840        LD   A,#01
 6850        CP   (IY+2)
 6860        JR   Z,TESTI2
 6870 TESTI1 PUSH BC
 6880        PUSH HL
 6890        LD   (IY+3),#04
 6900        CALL GETGRA
 6910        LD   D,H
 6920        LD   E,L
 6930        POP  HL
 6940        POP  BC
 6950 TESTI2 LD   A,(IY+12)
 6960        LD   (IY+3),A
 6970        LD   B,#04
 6980 TESTI3 LD   A,(DE)
 6990        AND  (HL)
 7000        CP   #00
 7010        RET  NZ
 7020        INC  DE
 7030        INC  HL
 7040        DJNZ TESTI3
 7050        PUSH DE
 7060        LD   DE,00028
 7070        ADD  HL,DE
 7080        POP  DE
 7090        DEC  C
 7100        JR   NZ,TESTI2
 7110        SCF
 7120        RET
 7130 PRINST DEFW 0
 7140 PRICH  PUSH AF
 7150        LD   (PRINST),BC
 7160        PUSH HL
 7170        RES  7,A
 7180        LD   E,A
 7190        LD   D,#00
 7200        SLA  E
 7210        RL   D
 7220        SLA  E
 7230        RL   D
 7240        SLA  E
 7250        RL   D
 7260        LD   HL,48256
 7270        ADD  HL,DE
 7280        LD   E,A
 7290        LD   D,#00
 7300        ADD  HL,DE
 7310        EX   DE,HL
 7320        POP  HL
 7330        PUSH DE
 7340        PUSH HL
 7350        LD   B,#08
 7360 PRICH2 LD   A,(DE)
 7370        LD   (HL),A
 7380        INC  DE
 7390        PUSH BC
 7400        LD   BC,00032
 7410        ADD  HL,BC
 7420        POP  BC
 7430        DJNZ PRICH2
 7440        LD   BC,(PRINST)
 7450        LD   A,(DE)
 7460        LD   (BC),A
 7470        POP  HL
 7480        POP  DE
 7490        POP  AF
 7500        BIT  7,A
 7510        RET  Z
 7520        PUSH HL
 7530        LD   BC,WKSPB
 7540        ADD  HL,BC
 7550        LD   B,#08
 7560 PRICH3 LD   A,(DE)
 7570        LD   (HL),A
 7580        INC  DE
 7590        PUSH BC
 7600        LD   BC,00032
 7610        ADD  HL,BC
 7620        POP  BC
 7630        DJNZ PRICH3
 7640        LD   BC,(PRINST)
 7650        POP  HL
 7660        RET
 7670 PAUSE  LD   BC,57342
 7680        BIT  5,(IY+13)
 7690        RET  NZ
 7700        IN   A,(C)
 7710        BIT  0,A      ;0=P PRESSED
 7720        RET  NZ
 7730 PWAIT  IN   A,(C)    ;WAIT TILL RELEASED
 7740        BIT  0,A
 7750        JR   Z,PWAIT  
 7760 PWAIT2 LD   BC,61438
 7770        IN   A,(C)
 7780        AND  %00011111
 7790        CP   %00001010
 7800        JR   NZ,NOCHEA
 7810        SET  3,(IY+31)
 7820 NOCHEA LD   BC,63486
 7830        IN   A,(C)
 7840        BIT  3,(IY+31)
 7850        JR   Z,PWAI27
 7860        BIT  0,A
 7870        JR   NZ,PWAI25
 7880        DEC  (IY+11)
 7890        CALL SSETU
 7900        CALL A2TOB
 7910        CALL BTOSC
 7920 PWAI25
 7930        LD   BC,63486
 7940        IN   A,(C)
 7950        BIT  1,A
 7960        JR   NZ,PWAI27
 7970        INC  (IY+11)
 7980        CALL SSETU
 7990        CALL A2TOB
 8000        CALL BTOSC
 8010 PWAI27 LD   BC,57342
 8020        IN   A,(C)    ;WAIT TILL PRESSED
 8030        BIT  0,A
 8040        JR   NZ,PWAIT2
 8050        SET  5,(IY+13)
 8060        RET
 8070 TEMP   DEFB 254
 8080 SCREXT
 8090 *F   SCREXTRA.TEX
 8100 EXTRAT
 8110 JUNE   MAC
 8120        DEFW TEMP,TEMP,TEMP,TEMP,TEMP
 8130        DEFW TEMP,TEMP,TEMP,TEMP,TEMP
 8140        ENDM
 8150        JUNE
 8160        JUNE
 8170        JUNE
 8180        JUNE
 8190        JUNE
 8200        DEFW TEMP,SCRE51,TEMP,TEMP,TEMP,TEMP,TEMP,TEMP,TEMP,TEMP
 8210        JUNE
 8220        JUNE
 8230        JUNE
 8240        JUNE
 8250        DEFW TEMP,TEMP,SCR102,SCR103,TEMP,TEMP
 8260        DEFW TEMP,TEMP,TEMP,TEMP,SCR110,SCR111,SCR112,TEMP
 8270        DEFW SCR114,SCR115
 8280        JUNE
 8290        DEFW SCR126,TEMP,TEMP,TEMP,TEMP,TEMP,TEMP,TEMP,TEMP
 8300        DEFW TEMP
 8310        JUNE
 8320        JUNE
 8330        JUNE
 8340        JUNE
 8350        JUNE
 8360        JUNE
 8370        JUNE
 8380        JUNE
 8390        JUNE
 8400        JUNE
 8410        JUNE
 8420        JUNE
 8430 ADDIT
 8440        INC  DE
 8450        PUSH DE
 8460        POP  IX
 8470        LD   L,(IX)
 8480        INC  IX
 8490        LD   H,(IX)
 8500        INC  IX
 8510        LD   C,(IX)
 8520        INC  IX
 8530        LD   B,(IX)
 8540        LD   (ADDST),BC
 8550        LD   (ADDST2),BC
 8560        RES  7,A
 8570        LD   C,A
 8580        INC  DE
 8590        INC  DE
 8600        INC  DE
 8610        INC  DE
 8620 ADDIT2 LD   B,C
 8630        PUSH HL
 8640 ADDIT3 LD   A,(DE)
 8650        PUSH DE
 8660        PUSH BC
 8670        LD   BC,(ADDST)
 8680        CALL PRICH
 8690        INC  BC
 8700        LD   (ADDST),BC
 8710        POP  BC
 8720        POP  DE
 8730        INC  HL
 8740        INC  DE
 8750        DJNZ ADDIT3
 8760        POP  HL
 8770        PUSH DE
 8780        LD   DE,256
 8790        ADD  HL,DE
 8800        LD   IX,(ADDST2)
 8810        LD   DE,32
 8820        ADD  IX,DE
 8830        LD   (ADDST2),IX
 8840        LD   (ADDST),IX
 8850        POP  DE
 8860        LD   A,(DE)
 8870        CP   253
 8880        JR   NZ,ADDIT2
 8890        INC  DE
 8900        JP   EXTAD2
 8910 OBJECT LD   IX,OBDATA
 8920 OBJEC2 LD   A,255
 8930        CP   (IX)
 8940        RET  Z
 8950        LD   A,(IY+11)
 8960        CP   (IX)
 8970        CALL Z,@OBDRAW
 8980        LD   DE,8
 8990        ADD  IX,DE
 9000        JR   OBJEC2
 9010 OBDATA DEFB 125;SCREEN(255=END,106=CARRIED)
 9020        DEFW OBGRAP
 9030        DEFB 96,7
 9040        DEFB 7;COLOUR
 9050        DEFW METALW
 9060 BALLON DEFB 106
 9070        DEFW OBGRAP+32
 9080        DEFB 104,15
 9090        DEFB 66
 9100        DEFW BALLOW
 9110        DEFB 77
 9120        DEFW OBGRAP+64
 9130        DEFB 72,8,71
 9140        DEFW WEIGHW
 9150 COIN   DEFB 106
 9160        DEFW OBGRAP+96
 9170        DEFB 104,4,70
 9180        DEFW COINW
 9190        DEFB 101
 9200        DEFW OBGRAP+128
 9210        DEFB 40,27,6
 9220        DEFW SPADEW
 9230        DEFB 109
 9240        DEFW OBGRAP+160
 9250        DEFB 104,13,2
 9260        DEFW AXEW
 9270 KEY    DEFB 107
 9280        DEFW OBGRAP+192
 9290        DEFB 40,3
 9300        DEFB 7
 9310        DEFW KEYW
 9320 CHKNIF DEFB 77
 9330        DEFW OBGRAP+224
 9340        DEFB 72,5,7
 9350        DEFW CHKNIW
 9360 TIGROP DEFB 104
 9370        DEFW OBGRAP+256
 9380        DEFB 72,2,6
 9390        DEFW TIGROW
 9400 CHEESE DEFB 106
 9410        DEFW OBGRAP+288
 9420        DEFB 0,14,6
 9430        DEFW CHEESW
 9440 RUBUNG DEFB 106
 9450        DEFW OBGRAP+320
 9460        DEFB 80,15,2
 9470        DEFW RUBUNW
 9480        DEFB 104
 9490        DEFW OBGRAP+352
 9500        DEFB 56,17,2
 9510        DEFW WATERW
 9520 CROBAR DEFB 116
 9530        DEFW OBGRAP+384
 9540        DEFB 96,16,71
 9550        DEFW CROBAW
 9560 SLEDGE DEFB 26
 9570        DEFW OBGRAP+416
 9580        DEFB 104,20,7
 9590        DEFW SLEDGW
 9600 MAGNET DEFB 81
 9610        DEFW OBGRAP+448
 9620        DEFB 88,5,2
 9630        DEFW MAGNEW
 9640        DEFB 110
 9650        DEFW OBGRAP+480
 9660        DEFB 104,2,6
 9670        DEFW SPOONW
 9680 RUBBER DEFB 105
 9690        DEFW OBGRAP+512
 9700        DEFB 104,11,65
 9710        DEFW RUBBEW
 9720 KEG    DEFB 117
 9730        DEFW OBGRAP+544
 9740        DEFB 104,25,2
 9750        DEFW KEGW
 9760 PICKAX DEFB 113
 9770        DEFW OBGRAP+576
 9780        DEFB 104,10,2
 9790        DEFW PICKAW
 9800 PLANK  DEFB 115
 9810        DEFW OBGRAP+608
 9820        DEFB 104,6,2
 9830        DEFW PLANKW
 9840        DEFB 255;LAST GRAPHIC
 9850 OBDRAW LD   H,(IX+3)
 9860        LD   L,0
 9870        SRL  H
 9880        RR   L
 9890        SRL  H
 9900        RR   L
 9910        SRL  H
 9920        RR   L
 9930        LD   D,0
 9940        LD   E,(IX+4)
 9950        ADD  HL,DE
 9960        LD   DE,WKSPB
 9970        ADD  HL,DE
 9980        LD   D,(IX+2)
 9990        LD   E,(IX+1)
10000        LD   B,16
10010 OBDRA2 LD   A,(DE)
10020        LD   (HL),A
10030        INC  DE
10040        INC  HL
10050        LD   A,(DE)
10060        LD   (HL),A
10070        INC  DE
10080        PUSH BC
10090        LD   BC,31
10100        ADD  HL,BC
10110        POP  BC
10120        DJNZ OBDRA2
10130        RET
10140 *F     SOUND.TEX
10150 *F     OVER.TEX
10160 *F    NEXT.TEX
10170 MUSIC  RET

OVER.TEX

   10 PRINTI PUSH DE
   20        EX   DE,HL
   30        LD   E,(HL)
   40        INC  HL
   50        LD   D,(HL)
   60        LD   B,30
   70        LD   HL,21505
   80        CALL PRITEX
   90        POP  DE
  100        INC  DE
  110        INC  DE
  120        RET
  130 ALTVAR DEFB 23,64,0,1,0,1,0,0,0,0,0,108,0,0,0,0,0,0,255
  140        DEFB 255,255,0,0,0,1,0,255,23,64,0,108,3,0
  150        DEFW WKSPB+1811+256,64275,0
  160        DEFB 2,0,5
  170 RESET
  180        LD   HL,31659
  190        LD   DE,16384+4096
  200        LD   BC,2048
  210        LDIR
  220        LD   HL,33707
  230        LD   DE,22528+512
  240        LD   BC,256
  250        LDIR
  260        LD   HL,TREE1
  270        SET  7,(HL)
  280        LD   HL,TREE2
  290        RES  7,(HL)
  300        LD   HL,CADOOR
  310        SET  7,(HL)
  320        LD   HL,TIGHT1
  330        RES  7,(HL)
  340        LD   HL,SCR111
  350        RES  7,(HL)
  360        LD   HL,TRAP1
  370        RES  7,(HL)
  380        LD   HL,TRAP2
  390        SET  7,(HL)
  400        LD   HL,BLOCK
  410        SET  7,(HL)
  420        LD   HL,SCR115
  430        SET  7,(HL)
  440        LD   HL,SCR114
  450        RES  7,(HL)
  460        LD   HL,SCRE51
  470        RES  7,(HL)
  480 
  490        LD   HL,ALTOB
  500        LD   DE,OBDATA
  510        LD   BC,8*20
  520        LDIR
  530        LD   A,64+5
  540        LD   HL,22528+609
  550        LD   C,4
  560 RECOL  LD   B,16
  570 RECOLI LD   (HL),A
  580        INC  HL
  590        DJNZ RECOLI
  600        LD   DE,16
  610        ADD  HL,DE
  620        DEC  C
  630        JR   NZ,RECOL
  640 
  650        LD   IY,XPOS
  660        LD   (IY+11),128
  670        CALL SSETU
  680 RESETL CALL A2TOB
  690        LD   IY,BLIP1
  700        CALL DRAWMA
  710        LD   A,(IY)
  720        CP   1
  730        JR   NZ,BLINT
  740        LD   A,(IY+2)
  750        DEC  A
  760        NEG
  770        INC  A
  780        LD   (IY+2),A
  790        LD   A,(IY)
  800 BLINT  CP   22
  810        JR   NZ,BLNT2
  820        LD   A,(IY+2)
  830        DEC  A
  840        NEG
  850        INC  A
  860        LD   (IY+2),A
  870        LD   A,(IY)
  880 BLNT2  LD   B,(IY+2)
  890        DEC  B
  900        ADD  A,B
  910        LD   (IY),A
  920        LD   IY,BLIP2
  930        CALL DRAWMA
  940        LD   A,(IY)
  950        CP   30
  960        JR   NZ,BLINT8
  970        LD   A,(IY+2)
  980        DEC  A
  990        NEG
 1000        INC  A
 1010        LD   (IY+2),A
 1020        LD   A,(IY)
 1030 BLINT8 CP   57
 1040        JR   NZ,BLNT28
 1050        LD   A,(IY+2)
 1060        DEC  A
 1070        NEG
 1080        INC  A
 1090        LD   (IY+2),A
 1100        LD   A,(IY)
 1110 BLNT28 LD   B,(IY+2)
 1120        DEC  B
 1130        ADD  A,B
 1140        LD   (IY),A
 1150        LD   IY,XPOS
 1160        CALL BTOSC
 1170        LD   B,1
 1180        LD   HL,32*1+6+16384+2048
 1190        LD   DE,NAME
 1200        CALL PRITEX
 1210        CALL MUSIC
 1220        LD   BC,49150
 1230        IN   A,(C)
 1240        BIT  0,A
 1250        JP   NZ,RESETL
 1260        LD   HL,ALTVAR
 1270        LD   DE,XPOS
 1280        LD   BC,42
 1290        LDIR
 1300        CALL CLEICO
 1310        LD   (IY+21),1
 1320        CALL CLEICO
 1330        LD   (IY+21),2
 1340        CALL CLEICO
 1350        LD   (IY+21),0
 1360        CALL SELCOL
 1370        CALL SSETU
 1380        CALL MAINLO
 1390        JP   C,VICTOR
 1400        LD   (IY+11),129
 1410        CALL SSETU
 1420 RESEL2 CALL A2TOB
 1430        CALL BTOSC
 1440        LD   BC,49150
 1450        IN   A,(C)
 1460        BIT  0,A
 1470        JR   NZ,RESEL2
 1480        JP   RESET
 1490 ALTOB  DEFB 125;SCREEN(255=END,106=CARRIED)
 1500        DEFW OBGRAP
 1510        DEFB 96,7
 1520        DEFB 7;COLOUR
 1530        DEFW METALW
 1540        DEFB 106
 1550        DEFW OBGRAP+32
 1560        DEFB 104,15
 1570        DEFB 66
 1580        DEFW BALLOW
 1590        DEFB 77
 1600        DEFW OBGRAP+64
 1610        DEFB 72,8,71
 1620        DEFW WEIGHW
 1630        DEFB 106
 1640        DEFW OBGRAP+96
 1650        DEFB 104,4,70
 1660        DEFW COINW
 1670        DEFB 101
 1680        DEFW OBGRAP+128
 1690        DEFB 40,27,6
 1700        DEFW SPADEW
 1710        DEFB 109
 1720        DEFW OBGRAP+160
 1730        DEFB 104,13,2
 1740        DEFW AXEW
 1750        DEFB 107
 1760        DEFW OBGRAP+192
 1770        DEFB 40,3
 1780        DEFB 7
 1790        DEFW KEYW
 1800        DEFB 77
 1810        DEFW OBGRAP+224
 1820        DEFB 72,5,7
 1830        DEFW CHKNIW
 1840        DEFB 104
 1850        DEFW OBGRAP+256
 1860        DEFB 72,2,6
 1870        DEFW TIGROW
 1880        DEFB 106
 1890        DEFW OBGRAP+288
 1900        DEFB 0,14,6
 1910        DEFW CHEESW
 1920        DEFB 106
 1930        DEFW OBGRAP+320
 1940        DEFB 80,15,2
 1950        DEFW RUBUNW
 1960        DEFB 104
 1970        DEFW OBGRAP+352
 1980        DEFB 56,17,2
 1990        DEFW WATERW
 2000        DEFB 116
 2010        DEFW OBGRAP+384
 2020        DEFB 96,16,71
 2030        DEFW CROBAW
 2040        DEFB 26
 2050        DEFW OBGRAP+416
 2060        DEFB 104,20,7
 2070        DEFW SLEDGW
 2080        DEFB 81
 2090        DEFW OBGRAP+448
 2100        DEFB 88,5,2
 2110        DEFW MAGNEW
 2120        DEFB 110
 2130        DEFW OBGRAP+480
 2140        DEFB 104,2,6
 2150        DEFW SPOONW
 2160        DEFB 105
 2170        DEFW OBGRAP+512
 2180        DEFB 104,11,65
 2190        DEFW RUBBEW
 2200        DEFB 117
 2210        DEFW OBGRAP+544
 2220        DEFB 104,25,2
 2230        DEFW KEGW
 2240        DEFB 113
 2250        DEFW OBGRAP+576
 2260        DEFB 104,10,2
 2270        DEFW PICKAW
 2280        DEFB 115
 2290        DEFW OBGRAP+608
 2300        DEFB 104,6,2
 2310        DEFW PLANKW
 2320 BLIP1  DEFB 2
 2330        DEFB 89,2,1,2,0,0,0,0,0
 2340 BLIP3  DEFB 0,40,1,1,1,0,0,0,0,0
 2350 BLIP2  DEFB 31,89,2,3,2,0,0,0,0,0
 2360 BLIP4  DEFB 52,72,1,3,1,0,0,0,0,0
 2370 BLIP5  DEFB 58,72,1,4,1,0,0,0,0,0
 2380 NAME   DEFB 1
 2390        DEFM "BY@M[@DOWMAN@\^^]"
 2400        DEFB 255
 2410 REFSPA LD   A,(IY)
 2420        CP   18
 2430        RET  C
 2440        CP   46
 2450        RET  NC
 2460        LD   A,(IY+1)
 2470        CP   16
 2480        RET  C
 2490        CP   89
 2500        RET  NC
 2510        CALL GETOBJ
 2520        CP   9
 2530        RET  NZ
 2540        LD   (HL),255
 2550        CALL CLEICO
 2560        POP  AF
 2570        POP  AF
 2580        BIT  2,(IY+31)
 2590        SCF
 2600        RET  Z
 2610        POP  BC
 2620        RET
 2630 VICTOR LD   (IY+11),130
 2640        CALL SSETU
 2650 VICLOO CALL A2TOB
 2660        LD   IY,BLIP3
 2670        CALL DRAWMA
 2680        LD   IY,BLIP4
 2690        CALL DRAWMA
 2700        LD   IY,BLIP5
 2710        CALL DRAWMA
 2720        CALL BTOSC
 2730        LD   BC,49150
 2740        IN   A,(C)
 2750        BIT  0,A
 2760        JR   NZ,VICLOO
 2770        JP   RESET
 2780 DRAWDE CALL A2TOB
 2790        CALL DRIP
 2800        CALL MAN
 2810        LD   D,(IY+40)
 2820        LD   E,0
 2830        SRA  D
 2840        RR   E
 2850        LD   HL,DEATHG
 2860        ADD  HL,DE
 2870        BIT  0,(IY)
 2880        JR   Z,SKIPAD
 2890        INC  H
 2900        INC  H
 2910 SKIPAD
 2920        INC  (IY+40)
 2930        LD   DE,(OLSPPO)
 2940        LD   C,32
 2950 DRAWDL LD   B,4
 2960 DRAL2  LD   A,(DE)
 2970        OR   (HL)
 2980        LD   (DE),A
 2990        INC  DE
 3000        INC  HL
 3010        DJNZ DRAL2
 3020        PUSH BC
 3030        LD   BC,28
 3040        EX   DE,HL
 3050        ADD  HL,BC
 3060        EX   DE,HL
 3070        POP  BC
 3080        DEC  C
 3090        JR   NZ,DRAWDL
 3100        CALL OBJECT
 3110        CALL BTOSC
 3120        CALL MANCOL
 3130        CALL OBCOLS
 3140        CALL DRICOL
 3150        CALL RELKEY
 3160        CALL SELOBJ
 3170        RET
 3180 LIFLOS DEC  (IY+41)
 3190        JR   NZ,LOSLIB
 3200        POP  AF
 3210        AND  A
 3220        RET
 3230 LOSLIB LD   E,(IY+41)
 3240        DEC  E
 3250        LD   D,0
 3260        SLA  E
 3270        RL   D
 3280        SLA  E
 3290        RL   D
 3300        LD   HL,22528+609
 3310        ADD  HL,DE
 3320        LD   DE,28
 3330        LD   C,4
 3340        LD   A,0
 3350 LOSLI2 LD   B,4
 3360 LOSLI3 LD   (HL),A
 3370        INC  HL
 3380        DJNZ LOSLI3
 3390        ADD  HL,DE
 3400        DEC  C
 3410        JR   NZ,LOSLI2
 3420        RET

NEXT.TEX

   10 OBCOLO LD   L,(IX+3)
   20        LD   H,0
   30        SLA  L
   40        RL   H
   50        SLA  L
   60        RL   H
   70        LD   D,0
   80        LD   E,(IX+4)
   90        ADD  HL,DE
  100        LD   DE,22528 
  110        ADD  HL,DE
  120        PUSH HL
  130        POP  IY
  140        LD   A,(IX+5)
  150        LD   (HL),A
  160        LD   (IY+1),A
  170        LD   (IY+32),A
  180        LD   (IY+33),A
  190        LD   IY,XPOS
  200        RET
  210 PICK   LD   HL,CARRY
  220        LD   D,0
  230        LD   E,(IY+21)
  240        ADD  HL,DE
  250        LD   A,(HL)
  260        CP   255
  270        JP   NZ,DROP
  280 PICKOK LD   IX,OBDATA
  290        LD   (IY+12),0
  300 PICK2  LD   A,(IX)
  310        CP   255
  320        RET  Z
  330        CP   (IY+11)
  340        JR   Z,PICK4
  350 PICK3  LD   DE,8
  360        ADD  IX,DE
  370        INC  (IY+12)
  380        JR   PICK2
  390 PICK4  LD   A,(IY)
  400        SRL  A
  410        SUB  (IX+4)
  420        JR   C,PICK5
  430        CP   2
  440        JR   NC,PICK3
  450        JR   PICK7
  460 PICK5  CP   253
  470        JR   C,PICK3
  480 PICK7  LD   A,(IY+1)
  490        SUB  (IX+3)
  500        JR   C,PICK9
  510        CP   18
  520        JR   NC,PICK3
  530        JR   PICK10
  540 PICK9  CP   226
  550        JR   C,PICK3
  560 PICK10 LD   (IX),106
  570        LD   A,(IY+12)
  580        LD   (HL),A
  590        SET  2,(IY+13)
  600        CP   0
  610        JR   NZ,PICBAL
  620        SET  1,(IY+22)
  630 PICBAL CP   1
  640        JP   NZ,PICBAN
  650        SET  4,(IY+13)
  660 PICBAN CALL ADDICO
  670        JP   PIDRSO
  680 DROP   PUSH AF
  690        LD   A,(IY+11)
  700        CALL LEFEDG
  710        JP   NC,DROTOP
  720        CALL TOP
  730        JP   C,DROTOP
  740        POP  AF
  750        LD   (HL),255
  760 DROP11 LD   IX,OBDATA
  770        CP   0
  780        JR   NZ,DROP13
  790        RES  1,(IY+22)
  800 DROP13
  810        CP   1
  820        JR   NZ,DROP15
  830        RES  4,(IY+13)
  840 DROP15 LD   E,A
  850        LD   D,0
  860        SLA  E
  870        RL   D
  880        SLA  E
  890        RL   D
  900        SLA  E
  910        RL   D
  920        ADD  IX,DE
  930        LD   A,(IY+11)
  940        LD   (IX),A
  950        LD   A,(IY)
  960        SRL  A
  970        INC  A
  980        LD   (IX+4),A
  990        LD   A,(IY+1)
 1000        AND  %11111000
 1010        ADD  A,16
 1020        LD   (IX+3),A
 1030        SET  2,(IY+13)
 1040        LD   DE,CLEARW
 1050        CALL PRIOWI
 1060 CLEICO LD   E,(IY+21)
 1070        LD   D,0
 1080        SLA  E
 1090        SLA  E
 1100        LD   IX,22528+691
 1110        ADD  IX,DE
 1120        LD   E,(IY+21)
 1130        ADD  IX,DE
 1140        LD   (IX),0
 1150        LD   (IX+1),0
 1160        LD   (IX+32),0
 1170        LD   (IX+33),0
 1180        LD   DE,CLEARW
 1190        CALL PRIOWI
 1200        JP   PIDRSO
 1210 OBCOLS LD   IX,OBDATA
 1220 OBCLS2 LD   A,255
 1230        CP   (IX)
 1240        RET  Z
 1250        LD   A,(IY+11)
 1260        CP   (IX)
 1270        CALL Z,@OBCOLO
 1280        LD   DE,8
 1290        ADD  IX,DE
 1300        JR   OBCLS2
 1310 RELKEY BIT  2,(IY+13)
 1320        JR   Z,REL2
 1330        LD   BC,49150
 1340        IN   A,(C)
 1350        BIT  0,A
 1360        JR   Z,REL2
 1370        RES  2,(IY+13)
 1380 REL2   BIT  3,(IY+13)
 1390        JR   Z,REL3
 1400        LD   BC,49150
 1410        IN   A,(C)
 1420        BIT  2,A
 1430        JR   Z,REL3
 1440        BIT  3,A
 1450        JR   Z,REL3
 1460        RES  3,(IY+13)
 1470 REL3   LD   BC,64510
 1480        IN   A,(C)
 1490        BIT  0,A
 1500        JR   Z,REL4
 1510        RES  7,(IY+22)
 1520 REL4   LD   BC,57342
 1530        IN   A,(C)
 1540        BIT  0,A
 1550        RET  Z
 1560        RES  5,(IY+13)
 1570        RET
 1580 SELOBJ BIT  3,(IY+13)
 1590        RET  NZ
 1600        BIT  4,(IY+13)
 1610        JR   Z,SELOB1
 1620        BIT  5,(IY+22)
 1630        RET  NZ
 1640 SELOB1
 1650        LD   BC,49150
 1660        IN   A,(C)
 1670        BIT  2,A
 1680        JR   NZ,SELOB2
 1690        LD   A,2
 1700        CP   (IY+21)
 1710        RET  Z
 1720        INC  (IY+21)
 1730        JR   SELCOL
 1740 SELOB2 BIT  3,A
 1750        RET  NZ
 1760        XOR  A
 1770        CP   (IY+21)
 1780        RET  Z
 1790        DEC  (IY+21)
 1800 SELCOL LD   IX,22528+658
 1810        SET  3,(IY+13)
 1820        LD   B,3
 1830 SELCO2 LD   (IX),7
 1840        LD   (IX+1),7
 1850        LD   (IX+2),7
 1860        LD   (IX+3),7
 1870        LD   (IX+32),7
 1880        LD   (IX+35),7
 1890        LD   (IX+64),7
 1900        LD   (IX+67),7
 1910        LD   (IX+96),7
 1920        LD   (IX+97),7
 1930        LD   (IX+98),7
 1940        LD   (IX+99),7
 1950        LD   DE,5
 1960        ADD  IX,DE
 1970        DJNZ SELCO2
 1980        LD   E,(IY+21)
 1990        LD   D,0
 2000        SLA  E
 2010        SLA  E
 2020        LD   IX,22528+658
 2030        ADD  IX,DE
 2040        LD   E,(IY+21)
 2050        ADD  IX,DE
 2060        LD   (IX),95
 2070        LD   (IX+1),95
 2080        LD   (IX+2),95
 2090        LD   (IX+3),95
 2100        LD   (IX+32),95
 2110        LD   (IX+35),95
 2120        LD   (IX+64),95
 2130        LD   (IX+67),95
 2140        LD   (IX+96),95
 2150        LD   (IX+97),95
 2160        LD   (IX+98),95
 2170        LD   (IX+99),95
 2180 CHAWIN LD   HL,CARRY
 2190        LD   E,(IY+21)
 2200        LD   D,0
 2210        ADD  HL,DE
 2220        LD   E,(HL)
 2230        LD   A,E
 2240        CP   255
 2250        JR   Z,NOOBJ
 2260        LD   D,0
 2270        SLA  E
 2280        RL   D
 2290        SLA  E
 2300        RL   D
 2310        SLA  E
 2320        RL   D
 2330        LD   IX,OBDATA
 2340        ADD  IX,DE
 2350        JP   PRIOBJ
 2360 NOOBJ  LD   DE,CLEARW
 2370        JP   PRIOWI
 2380 ADDICO CALL PRIOBJ
 2390        LD   E,(IY+21)
 2400        LD   D,0
 2410        SLA  E
 2420        SLA  E
 2430        LD   HL,20659
 2440        ADD  HL,DE
 2450        LD   E,(IY+21)
 2460        ADD  HL,DE
 2470        LD   E,(IX+1)
 2480        LD   D,(IX+2)
 2490        LD   B,16
 2500 ADDIC2 LD   A,(DE)
 2510        LD   (HL),A
 2520        INC  DE
 2530        INC  HL
 2540        LD   A,(DE)
 2550        LD   (HL),A
 2560        INC  DE
 2570        DEC  HL
 2580        EX   DE,HL
 2590        CALL SDSCR
 2600        EX   DE,HL
 2610        DJNZ ADDIC2
 2620        LD   D,0
 2630        LD   E,(IY+21)
 2640        SLA  E
 2650        SLA  E
 2660        LD   A,(IX+5)
 2670        LD   IX,691+22528
 2680        ADD  IX,DE
 2690        LD   E,(IY+21)
 2700        ADD  IX,DE
 2710        LD   (IX),A
 2720        LD   (IX+1),A
 2730        LD   (IX+32),A
 2740        LD   (IX+33),A
 2750        RET
 2760 USE    BIT  0,(IY+5)
 2770        RET  NZ
 2780 USEBAL BIT  2,(IY+13)
 2790        RET  NZ
 2800        LD   BC,49150
 2810        IN   A,(C)
 2820        BIT  0,A
 2830        RET  NZ
 2840        SET  2,(IY+13)
 2850        LD   A,(IY+11)
 2860        CP   103
 2870        CALL Z,CHOPTR
 2880        LD   A,(IY+11)
 2890        CP   103
 2900        CALL Z,OPCADO
 2910        LD   A,(IY+11)
 2920        CP   81
 2930        CALL Z,TELESC
 2940        LD   A,(IY+11)
 2950        CP   115
 2960        CALL Z,DEWALL
 2970        LD   A,(IY+11)
 2980        CP   116
 2990        CALL Z,USEMAG
 3000        LD   A,(IY+11)
 3010        CP   117
 3020        CALL Z,CHOPEN
 3030        LD   A,(IY+11)
 3040        CP   114
 3050        CALL Z,PLARUB
 3060        LD   A,(IY+11)
 3070        CP   114
 3080        CALL Z,WATRUB
 3090        LD   A,(IY+11)
 3100        CP   110
 3110        CALL Z,TIEROP
 3120        LD   A,(IY+11)
 3130        CP   239
 3140        CALL Z,CUTCHE
 3150        LD   A,(IY+11)
 3160        CP   105
 3170        CALL Z,CHOBIG
 3180        LD   A,(IY+11)
 3190        CP   104
 3200        CALL Z,BUYBAL
 3210        LD   A,(IY+11)
 3220        CP   102
 3230        CALL Z,OPTRAP
 3240        LD   A,(IY+11)
 3250        CP   126
 3260        CALL Z,REBLOC
 3270        LD   A,(IY+11)
 3280        CP   109
 3290        CALL Z,DIGCOI
 3300        LD   A,(IY+11)
 3310        CP   125
 3320        CALL Z,BUNDRI
 3330        LD   A,(IY+11)
 3340        CP   51
 3350        CALL Z,USEPLA
 3360        LD   A,(IY+11)
 3370        CP   108
 3380        CALL Z,REFSPA
 3390        RES  2,(IY+13)
 3400        JP   PICK
 3410 CHOPTR LD   E,(IY+21)
 3420        LD   D,0
 3430        LD   HL,CARRY
 3440        ADD  HL,DE
 3450        LD   A,(HL)
 3460        CP   5
 3470        RET  NZ
 3480        LD   HL,TREE1
 3490        BIT  7,(HL)
 3500        RET  Z
 3510        LD   A,(IY)
 3520        CP   50
 3530        RET  C
 3540        CP   58
 3550        RET  NC
 3560        LD   A,(IY+1)
 3570        CP   40
 3580        RET  NZ
 3590        SET  2,(IY+13)
 3600        RES  7,(HL)
 3610        LD   HL,TREE2
 3620        SET  7,(HL)
 3630        POP  AF
 3640        JP   SSETU
 3650 OPCADO LD   HL,CADOOR
 3660        BIT  7,(HL)
 3670        RET  Z
 3680        LD   E,(IY+21)
 3690        LD   D,0
 3700        LD   HL,CARRY
 3710        ADD  HL,DE
 3720        LD   A,(HL)
 3730        CP   6
 3740        RET  NZ
 3750        LD   A,(IY)
 3760        CP   6
 3770        RET  NZ
 3780        LD   A,(IY+1)
 3790        CP   26
 3800        RET  C
 3810        CP   28
 3820        RET  NC
 3830        SET  2,(IY+13)
 3840        LD   HL,CADOOR
 3850        RES  7,(HL)
 3860        POP  AF
 3870        JP   SSETU
 3880 TELESC LD   A,(IY)
 3890        CP   22
 3900        RET  C
 3910        CP   30
 3920        RET  NC
 3930        LD   A,(IY+1)
 3940        CP   32
 3950        RET  C
 3960        CP   41
 3970        RET  NC
 3980        SET  2,(IY+13)
 3990        POP  AF
 4000        LD   DE,TELWO1
 4010        LD   HL,18570
 4020        LD   B,11
 4030        CALL PRITEX
 4040        LD   DE,TELWO2
 4050        LD   HL,18602
 4060        LD   B,11
 4070        CALL PRITEX
 4080        LD   DE,TELWO3
 4090        LD   HL,18634
 4100        LD   B,11
 4110        CALL PRITEX
 4120        LD   DE,TELWO4
 4130        LD   HL,18666
 4140        LD   B,11
 4150        CALL PRITEX
 4160        LD   B,4
 4170        LD   IX,22922
 4180 OUTCOL LD   (IX),7
 4190        LD   (IX+1),7
 4200        LD   (IX+2),7
 4210        LD   (IX+3),7
 4220        LD   (IX+4),7
 4230        LD   (IX+5),7
 4240        LD   (IX+6),7
 4250        LD   (IX+7),7
 4260        LD   (IX+8),7
 4270        LD   (IX+9),7
 4280        LD   (IX+10),7
 4290        LD   DE,32
 4300        ADD  IX,DE
 4310        DJNZ OUTCOL
 4320        LD   BC,49150
 4330 TELWOL IN   A,(C)
 4340        BIT  0,A
 4350        JR   Z,TELWOL
 4360 TELWOM IN   A,(C)
 4370        BIT  0,A
 4380        JR   NZ,TELWOM
 4390        RET
 4400 TELWO1 DEFB 0
 4410        DEFM "THROUGH@THE"
 4420        DEFB 255
 4430 TELWO2 DEFB 0
 4440        DEFM "TELESCOPE"
 4450        DEFB 255
 4460 TELWO3 DEFB 0
 4470        DEFM "YOU@CAN@SEE"
 4480        DEFB 255
 4490 TELWO4 DEFB 0
 4500        DEFM "THE@MOON["
 4510        DEFB 255
 4520 BALLOO BIT  4,(IY+13)
 4530        RET  Z
 4540        LD   (IY+2),1
 4550        CALL CONTRO
 4560        LD   E,(IY+21)
 4570        LD   D,0
 4580        LD   HL,CARRY
 4590        ADD  HL,DE
 4600        LD   A,(IY+26)
 4610        LD   B,(HL)
 4620        BIT  5,(IY+22)
 4630        JR   NZ,BALL2
 4640        LD   (IY+26),B
 4650 BALL2
 4660        CP   2
 4670        JR   Z,BALLDO
 4680        LD   (IY+10),1
 4690        SET  1,(IY+13)
 4700        SET  2,(IY+31)
 4710        CALL USEBAL
 4720        RES  2,(IY+31)
 4730        JP   SCRCH
 4740 BALLDO RES  1,(IY+13)
 4750        SET  2,(IY+31)
 4760        CALL USEBAL
 4770        RES  2,(IY+31)
 4780        JP   SCRCH
 4790 GETOBJ LD   E,(IY+21)
 4800        LD   D,0
 4810        LD   HL,CARRY
 4820        ADD  HL,DE
 4830        LD   A,(HL)
 4840        RET
 4850 DEWALL LD   A,(IY)
 4860        CP   25
 4870        RET  NZ
 4880        LD   A,(IY+1)
 4890        CP   88
 4900        RET  NZ
 4910        CALL GETOBJ
 4920        CP   13       
 4930        RET  NZ
 4940        LD   HL,SCR115
 4950        BIT  7,(HL)
 4960        RET  Z
 4970        RES  7,(HL)
 4980        POP  AF
 4990        JP   SSETU
 5000 USEMAG
 5010        LD   A,(IY)
 5020        CP   26
 5030        RET  C
 5040        CP   37
 5050        RET  NC
 5060        LD   A,(IY+1)
 5070        CP   8
 5080        RET  C
 5090        CP   69
 5100        RET  NC
 5110        BIT  6,(IY+13)
 5120        RET  NZ
 5130        CALL GETOBJ
 5140        CP   14
 5150        RET  NZ
 5160        SET  6,(IY+13)
 5170        POP  AF
 5180        LD   IX,CROBAR
 5190 PLAOBJ LD   A,(IY+11)
 5200        LD   (IX),A
 5210        LD   A,(IY)
 5220        INC  A
 5230        SRL  A
 5240        LD   (IX+4),A
 5250        LD   A,(IY+1)
 5260        AND  %11111000
 5270        ADD  A,16
 5280        LD   (IX+3),A
 5290        RET
 5300 CHOPEN RET
 5310 TIEROP CALL GETOBJ
 5320        CP   8
 5330        RET  NZ
 5340        LD   A,(IY)
 5350        CP   25
 5360        RET  C
 5370        CP   34
 5380        RET  NC
 5390        LD   A,(IY+1)
 5400        CP   88
 5410        RET  NZ
 5420        LD   HL,TIGHT1
 5430        BIT  7,(HL)
 5440        RET  NZ
 5450        SET  7,(HL)
 5460        LD   HL,SCR111
 5470        SET  7,(HL)
 5480        LD   HL,TIGHT3
 5490        SET  7,(HL)
 5500        CALL SSETU
 5510        POP  AF
 5520        CALL GETOBJ
 5530        LD   (HL),255
 5540        JP   CLEICO
 5550 CUTCHE BIT  0,(IY+5)
 5560        RET  NZ
 5570        BIT  7,(IY+13)
 5580        RET  NZ
 5590        CALL GETOBJ
 5600        CP   7
 5610        RET  NZ
 5620        LD   IX,CHEESE
 5630        POP  AF
 5640        SET  7,(IY+13)
 5650        JP   PLAOBJ
 5660 CHOBIG RET
 5670 BUYBAL BIT  0,(IY+22)
 5680        RET  NZ
 5690        LD   A,(IY)
 5700        CP   29
 5710        RET  C
 5720        CP   38
 5730        RET  NC
 5740        LD   A,(IY+1)
 5750        CP   88
 5760        RET  NZ
 5770        CALL GETOBJ
 5780        CP   3
 5790        JR   NZ,TRYBUY
 5800        LD   (HL),1
 5810        LD   IX,BALLON
 5820        SET  0,(IY+22)
 5830        SET  4,(IY+13)
 5840        POP  AF
 5850        JP   ADDICO
 5860 TRYBUY POP  AF;TEXTSHOULD BE HERE
 5870        LD   HL,16586
 5880        LD   DE,TRYWO1
 5890        LD   B,18
 5900        CALL PRITEX
 5910        LD   HL,16619
 5920        LD   DE,TRYWO2
 5930        LD   B,15
 5940        CALL PRITEX
 5950        LD   HL,18444
 5960        LD   DE,TRYWO3
 5970        LD   B,13
 5980        CALL PRITEX
 5990        LD   C,3
 6000        LD   HL,22730
 6010 TRYOUL PUSH HL
 6020        LD   B,18
 6030 TRYINL LD   (HL),7
 6040        INC  HL
 6050        DJNZ TRYINL
 6060        POP  HL
 6070        LD   DE,32
 6080        ADD  HL,DE
 6090        DEC  C
 6100        JR   NZ,TRYOUL
 6110        LD   BC,49150
 6120 TRYKE1 IN   A,(C)
 6130        BIT  0,A
 6140        JR   Z,TRYKE1
 6150 TRYKE2 IN   A,(C)
 6160        BIT  0,A
 6170        JR   NZ,TRYKE2
 6180        RET
 6190 TRYWO1 DEFB 0
 6200        DEFM "BALLOONS@FOR@SALE["
 6210        DEFB 255
 6220 TRYWO2 DEFB 0
 6230        DEFM "ONLY@TEN@GOLDEN"
 6240        DEFB 255
 6250 TRYWO3 DEFB 0
 6260        DEFM "PENNIES@EACH["
 6270        DEFB 255
 6280 OPTRAP CALL GETOBJ
 6290        CP   12
 6300        RET  NZ
 6310        LD   A,(IY)
 6320        CP   41
 6330        RET  C
 6340        CP   59
 6350        RET  NC
 6360        LD   A,(IY+1)
 6370        CP   24
 6380        RET  C
 6390        CP   26
 6400        RET  NC
 6410        LD   HL,TRAP1
 6420        BIT  7,(HL)
 6430        RET  NZ
 6440        SET  7,(HL)
 6450        LD   HL,TRAP2
 6460        RES  7,(HL)
 6470        POP  AF
 6480        JP   SSETU
 6490 REBLOC CALL GETOBJ
 6500        CP   18
 6510        RET  NZ
 6520        LD   A,(IY)
 6530        CP   47
 6540        RET  NC
 6550        LD   HL,SCR126
 6560        BIT  7,(HL)
 6570        RET  Z
 6580        RES  7,(HL)
 6590        POP  AF
 6600        JP   SSETU
 6610 METCAR LD   BC,254
 6620        XOR  A
 6630        OUT  (C),A
 6640        LD   A,(IY+23)
 6650        LD   (IY+23),0
 6660        LD   (IY+12),A
 6670        BIT  1,(IY+22)
 6680        RET  Z
 6690        BIT  2,(IY+22)
 6700        RET  NZ
 6710        LD   A,(IY+11)
 6720        CP   109
 6730        RET  NZ
 6740        LD   A,(IY+1)
 6750        CP   88
 6760        RET  NZ
 6770        LD   A,(IY)
 6780        CP   26
 6790        RET  C
 6800        CP   33
 6810        RET  NC
 6820        SET  3,(IY+22)
 6830        LD   A,(IY+12)
 6840        LD   BC,254
 6850        OUT  (C),A
 6860        DEC  A
 6870        LD   (IY+23),A
 6880        JP   METALS
 6890 DIGCOI BIT  2,(IY+22)
 6900        RET  NZ
 6910        BIT  3,(IY+22)
 6920        RET  Z
 6930        CALL GETOBJ
 6940        CP   4
 6950        RET  NZ
 6960        LD   A,(IY+1)
 6970        CP   88
 6980        RET  NZ
 6990        LD   A,(IY)
 7000        CP   26
 7010        RET  C
 7020        CP   33
 7030        RET  NC
 7040        SET  2,(IY+22)
 7050        LD   IX,COIN
 7060        POP  AF
 7070        JP   PLAOBJ
 7080 SCRADJ LD   A,(IY+12)
 7090        CP   136
 7100        JR   NZ,SCRAJ2
 7110 SCRAJ3 LD   (IY+11),A
 7120        RET
 7130 SCRAJ2
 7140        CP   135
 7150        JR   Z,SCRAJ3
 7160        RET
 7170 PLARUB LD   A,(IY)
 7180        CP   24
 7190        RET  C
 7200        CP   35
 7210        RET  NC
 7220        LD   A,(IY+1)
 7230        CP   88
 7240        RET  NZ
 7250        CALL GETOBJ
 7260        CP   16
 7270        RET  NZ
 7280        LD   (HL),255
 7290        LD   HL,RUBBER
 7300        LD   (HL),106
 7310        CALL CLEICO
 7320        SET  4,(IY+22)
 7330        POP  AF
 7340        RET
 7350 WATRUB BIT  4,(IY+22)
 7360        RET  Z
 7370        LD   A,(IY)
 7380        CP   24
 7390        RET  C
 7400        CP   35
 7410        RET  NC
 7420        LD   A,(IY+1)
 7430        CP   88
 7440        RET  NZ
 7450        CALL GETOBJ
 7460        CP   11
 7470        RET  NZ
 7480        LD   HL,RUBTRE
 7490        BIT  7,(HL)
 7500        RET  NZ
 7510        SET  7,(HL)
 7520        POP  AF
 7530        LD   HL,RUBUNG
 7540        LD   (HL),114
 7550        JP   SSETU
 7560 LEFEDG CP   0
 7570        RET  Z
 7580        CP   25
 7590        RET  Z
 7600        CP   75
 7610        RET  Z
 7620        CP   100
 7630        RET  Z
 7640        CP   50
 7650        RET  Z
 7660        CP   231
 7670        RET  Z
 7680        CP   206
 7690        RET  Z
 7700        CP   181
 7710        RET  Z
 7720        CP   156      
 7730        RET  Z
 7740        SCF
 7750        RET
 7760 METALW DEFB 0
 7770        DEFM "METAL@DETECTOR"
 7780        DEFB 255
 7790 BALLOW DEFB 3
 7800        DEFM "BALLOON"
 7810        DEFB 255
 7820 WEIGHW DEFB 1
 7830        DEFM "LEAD@WEIGHT"
 7840        DEFB 255
 7850 COINW  DEFB 5
 7860        DEFM "COIN"
 7870        DEFB 255
 7880 SPADEW DEFB 4
 7890        DEFM "SPADE"
 7900        DEFB 255
 7910 AXEW   DEFB 3
 7920        DEFM "HATCHET"
 7930        DEFB 255
 7940 KEYW   DEFB 2
 7950        DEFM "CASTLE@KEY"
 7960        DEFB 255
 7970 CHKNIW DEFB 1
 7980        DEFM "CHEESE@KNIFE"
 7990        DEFB 255
 8000 TIGROW DEFB 2
 8010        DEFM "TIGHTROPE"
 8020        DEFB 255
 8030 CHEESW DEFB 1
 8040        DEFM "SWISS@CHEESE"
 8050        DEFB 255
 8060 RUBUNW DEFB 1
 8070        DEFM "RUBBER@BUNG"
 8080        DEFB 255
 8090 WATERW DEFB 1
 8100        DEFM "WATERING@CAN"
 8110        DEFB 255
 8120 CROBAW DEFB 1
 8130        DEFM "IRON@CROWBAR"
 8140        DEFB 255
 8150 SLEDGW DEFB 0
 8160        DEFM "SLEDGE@HAMMER"
 8170        DEFB 255
 8180 MAGNEW DEFB 4
 8190        DEFM "MAGNET"
 8200        DEFB 255
 8210 SPOONW DEFB 1
 8220        DEFM "WOODEN@SPOON"
 8230        DEFB 255
 8240 RUBBEW DEFB 1
 8250        DEFM "SMALL@RUBBER"
 8260        DEFB 255
 8270 KEGW   DEFB 0
 8280        DEFM "KEG@OF@BRANDY"
 8290        DEFB 255
 8300 PICKAW DEFB 3
 8310        DEFM "PICKAXE"
 8320        DEFB 255
 8330 PLANKW DEFB 1
 8340        DEFM "THICK@PLANK"
 8350        DEFB 255
 8360 CLEARW DEFB 0
 8370        DEFB 255
 8380 PRILET LD   E,A
 8390        LD   D,0
 8400        SLA  E
 8410        RL   D
 8420        SLA  E
 8430        RL   D
 8440        SLA  E
 8450        RL   D
 8460        PUSH HL
 8470        LD   HL,LECSET-512
 8480        ADD  HL,DE
 8490        POP  DE
 8500        LD   B,8
 8510 PRILE2 LD   A,(HL)
 8520        LD   (DE),A
 8530        CALL SDSCR
 8540        INC  HL
 8550        DJNZ PRILE2
 8560        RET
 8570 PRIOBJ
 8580        LD   E,(IX+6)
 8590        LD   D,(IX+7)
 8600 PRIOWI LD   HL,21586
 8610        LD   B,14
 8620 PRITEX PUSH HL
 8630        PUSH DE
 8640 PRITE2 LD   A,64
 8650        PUSH HL
 8660        PUSH BC
 8670        CALL PRILET
 8680        POP  BC
 8690        POP  HL
 8700        INC  HL
 8710        DJNZ PRITE2
 8720        POP  HL
 8730        LD   E,(HL)
 8740        LD   D,0
 8750        EX   (SP),HL
 8760        ADD  HL,DE
 8770        POP  DE
 8780        INC  DE
 8790 PRITE3 LD   A,(DE)
 8800        CP   255
 8810        RET  Z
 8820        PUSH HL
 8830        PUSH DE
 8840        CALL PRILET
 8850        POP  DE
 8860        POP  HL
 8870        INC  DE
 8880        INC  HL
 8890        JR   PRITE3
 8900 DEATH
 8910        CALL A2TOB
 8920        LD   (IY+2),1
 8930        LD   (IY+3),1
 8940        CALL DRIP
 8950        CALL MAN
 8960        CALL DRAWMA
 8970        CALL OBJECT
 8980        CALL BTOSC
 8990        CALL MANCOL
 9000        CALL OBCOLS
 9010        CALL DRICOL
 9020        CALL RELKEY
 9030        CALL SELOBJ
 9040        POP  AF
 9050        CALL 8020
 9060        RET  NC
 9070        LD   (IY+40),0
 9080 DEALOP LD   BC,8000
 9090 DEALO2 DEC  BC
 9100        LD   A,B
 9110        OR   C
 9120        JR   NZ,DEALO2
 9130        CALL DRAWDE
 9140        CALL 8020
 9150        RET  NC
 9160        LD   A,(IY+40)
 9170        CP   4
 9180        JR   NZ,DEALOP
 9190        LD   A,(IY+27)
 9200        LD   (IY),A
 9210        LD   A,(IY+28)
 9220        LD   (IY+1),A
 9230        LD   A,(IY+29)
 9240        LD   (IY+2),A
 9250        LD   (IY+10),0
 9260        LD   (IY+24),0
 9270        LD   (IY+25),0
 9280        LD   A,(IY+30)
 9290        LD   (IY+11),A
 9300        CALL DEATHS ;AROUND HERE SHOULD BE                       ;FANCY EFF
ECTS 
 9310        CALL LIFLOS
 9320        CALL SSETU
 9330        CALL A2TOB
 9340        JP   DRACAL
 9350 GETVAL BIT  0,(IY+5)
 9360        RET  NZ
 9370        LD   A,(IY)
 9380        LD   (IY+27),A
 9390        LD   A,(IY+1)
 9400        LD   (IY+28),A
 9410        LD   A,(IY+2)
 9420        LD   (IY+29,A)
 9430        LD   A,(IY+11)
 9440        LD   (IY+30),A
 9450        RET
 9460 DIE    LD   A,(IY+11)
 9470        CP   103
 9480        JR   NZ,DIE2
 9490        LD   A,(IY+1)
 9500        CP   59
 9510        RET  C
 9520        JP   DEATH
 9530 DIE2   CP   101
 9540        JR   NZ,DIE3
 9550 DIE4   LD   A,(IY+1)
 9560        CP   44
 9570        RET  C
 9580        JP   DEATH
 9590 DIE3   CP   100
 9600        JR   Z,DIE4
 9610        CP   138
 9620        JR   NZ,DIE5
 9630        LD   A,(IY+1)
 9640        CP   71
 9650        RET  C
 9660        JP   DEATH
 9670 DIE5   CP   125
 9680        JR   NZ,DIE6
 9690        BIT  0,(IY+31)
 9700        RET  Z
 9710        LD   A,(IY)
 9720        CP   39
 9730        RET  NC
 9740        JP   DEATH
 9750 DIE6
 9760        RET
 9770 QUIT   BIT  7,(IY+22)
 9780        RET  NZ
 9790        LD   BC,64510
 9800        IN   A,(C)
 9810        BIT  0,A
 9820        RET  NZ
 9830        SET  7,(IY+22)
 9840        JP   DEATH
 9850 DRIP   BIT  0,(IY+31)
 9860        RET  Z
 9870        LD   A,(IY+11)
 9880        CP   125
 9890        RET  NZ
 9900        LD   A,(IY+32)
 9910        CP   8
 9920        JR   NZ,DRIP2
 9930        XOR  A
 9940        LD   (IY+32),A
 9950        LD   DE,WKSPB+1811+128
 9960        LD   H,A
 9970        DEC  (IY+39)
 9980        LD   L,(IY+39)
 9990        JR   NZ,DRIP15
10000        LD   (IY+39),3
10010 DRIP15 SLA  L
10020        LD   BC,POSDRO
10030        ADD  HL,BC
10040        LD   (HL),E
10050        INC  HL
10060        LD   (HL),D
10070 DRIP2  LD   L,(IY+32)
10080        LD   H,0
10090        RES  0,L
10100        SLA  L
10110        SLA  L
10120        LD   DE,DRIGRA
10130        ADD  HL,DE
10140        EX   DE,HL
10150        LD   HL,WKSPB+1811
10160        LD   B,8
10170 DRLOOP LD   A,(DE)
10180        LD   (HL),A
10190        INC  DE
10200        PUSH BC
10210        LD   BC,32
10220        ADD  HL,BC
10230        POP  BC
10240        DJNZ DRLOOP
10250        INC  (IY+32)
10260 DRIDRO
10270        LD   C,3
10280        LD   IX,POSDRO
10290 ODRLO  LD   H,(IX+1)
10300        LD   L,(IX)
10310        XOR  A
10320        CP   H
10330        JR   Z,NODRI
10340        LD   DE,DROGRA
10350        LD   B,8
10360 DILOOP LD   A,(DE)
10370        LD   (HL),A
10380        INC  DE
10390        PUSH BC
10400        LD   BC,32
10410        ADD  HL,BC
10420        POP  BC
10430        DJNZ DILOOP
10440        LD   H,(IX+1)
10450        LD   L,(IX)
10460        LD   DE,128
10470        ADD  HL,DE
10480        LD   (IX+1),H
10490        LD   (IX),L
10500 NODRI  INC  IX
10510        INC  IX
10520        DEC  C
10530        JR   NZ,ODRLO
10540        RET
10550 DRICOL BIT  0,(IY+31)
10560        RET  Z
10570        LD   A,(IY+11)
10580        CP   125
10590        RET  NZ
10600        LD   A,65
10610        LD   (22528+243),A
10620        RET
10630 BUNDRI BIT  0,(IY+31)
10640        RET  Z
10650        LD   A,(IY)
10660        CP   44
10670        RET  NC
10680        CALL GETOBJ
10690        CP   10
10700        RET  NZ
10710        RES  0,(IY+31)
10720        LD   (HL),255
10730        JP   CLEICO
10740 DROTOP POP  AF
10750        CP   1
10760        RET  NZ
10770        LD   A,106
10780        LD   (BALLON),A
10790        LD   (HL),255
10800        RES  4,(IY+13)
10810        JP   CLEICO
10820 MAN    LD   A,(IY+11)
10830        CP   104
10840        JR   NZ,MAN3
10850        BIT  1,(IY+31)
10860        RET  Z
10870        LD   HL,2833+WKSPB
10880        LD   DE,MANGRA
10890        LD   B,32
10900 MANLOO LD   A,(DE)
10910        LD   (HL),A
10920        INC  DE
10930        INC  HL
10940        LD   A,(DE)
10950        LD   (HL),A
10960        PUSH BC
10970        LD   BC,31
10980        ADD  HL,BC
10990        POP  BC
11000        INC  DE
11010        DJNZ MANLOO
11020        RET
11030 MAN3   BIT  0,(IY+22)
11040        RET  Z
11050        RES  1,(IY+31)
11060        RET
11070 MANCOL LD   IX,369+22528
11080        LD   A,(IY+11)
11090        CP   104
11100        RET  NZ
11110        BIT  1,(IY+31)
11120        RET  Z
11130        LD   A,7
11140        LD   (IX),A
11150        LD   (IX+1),A
11160        LD   (IX+32),A
11170        LD   (IX+33),A
11180        LD   (IX+64),A
11190        LD   (IX+65),A
11200        LD   (IX+96),A
11210        LD   (IX+97),A
11220        RET
11230 USEPLA LD   A,(IY)
11240        CP   28
11250        RET  C
11260        CP   35
11270        RET  NC
11280        LD   A,(IY+1)
11290        CP   48
11300        RET  C
11310        CP   50
11320        RET  NC
11330        CALL GETOBJ
11340        CP   19
11350        RET  NZ
11360        LD   (HL),255
11370        LD   HL,SCRE51
11380        SET  7,(HL)
11390        CALL CLEICO
11400        JP   SSETU
11410 TOP    CP   174
11420        RET  NC
11430        CP   156
11440        CCF
11450        RET

SOUND.TEX

   10 METALS
   20        LD   BC,#00FE
   30        LD   DE,150
   40 OLOOP  LD   A,(IY+23)
   50        LD   HL,75
   60        XOR  16
   70        LD   (IY+23),A
   80        OUT  (C),A
   90 SWAIT  DEC  HL
  100        LD   A,H
  110        OR   L
  120        JR   NZ,SWAIT
  130        DEC  DE
  140        LD   A,D
  150        OR   E
  160        JR   NZ,OLOOP
  170        RET
  180 PIDRSO LD   BC,#00FE
  190        LD   DE,170
  200 OULOOP LD   H,D
  210        LD   L,E
  220        LD   A,(IY+23)
  230        XOR  16
  240        OUT  (C),A
  250        LD   (IY+23),A
  260 SWAIT2 DEC  HL
  270        LD   A,H
  280        OR   L
  290        JR   NZ,SWAIT2
  300        DEC  DE
  310        LD   A,D
  320        OR   E
  330        JR   NZ,OULOOP
  340        RET
  350 DEATHS LD   BC,#00FE
  360        LD   DE,200
  370 DEOULO LD   H,D
  380        LD   L,E
  390        LD   A,(IY+23)
  400        XOR  16
  410        OUT  (C),A
  420        LD   (IY+23),A
  430 DESWAI DEC  HL
  440        LD   A,H
  450        OR   L
  460        JR   NZ,DESWAI
  470        INC  DE
  480        LD   A,D
  490        CP   3
  500        JR   NZ,DEOULO
  510        RET

SCREXTRA.TEX

   10 SCR103
   20 TREE1  DEFB 2+128;WIDTH/APPEAR
   30        DEFW 27+A2,COLBUF+27;POS IN A2,POS ATTR
   40        DEFB 90,95,94,93,90,95,94,93,94,93,90,95,94,95
   50        DEFB 90,93,90,95,253
   60 TREE2  DEFB 18;TEMPORARY CHANGE
   70        DEFW 2310+A2,COLBUF+294
   80        DEFB 167,168,167,169,167,168,169,168,169
   90        DEFB 168,167,167,169,167,168,167,168,169
  100        DEFB 168,169,167,168,169,168,167,169,167
  110        DEFB 169,167,168,167,169,169,167,167,168,253
  120 CADOOR DEFB 2+128
  130        DEFW 257+A2,COLBUF+33
  140        DEFB 219,220,219,220,220,219,220,219,220,219,220,220
  150        DEFB 253
  160        DEFB 254
  170 SCR110
  180 TIGHT1 DEFB 15
  190        DEFW 11*256+17+A2,COLBUF+369
  200        DEFB 255,255,255,255,255,255,255,255,255,255
  210        DEFB 255,255,255,255,255,253,254
  220 SCR111 DEFB 32
  230        DEFW 2816+A2,352+COLBUF
  240        DEFB 255,255,255,255,255,255,255,255
  250        DEFB 255,255,255,255,255,255,255,255
  260        DEFB 255,255,255,255,255,255,255,255
  270        DEFB 255,255,255,255,255,255,255,255
  280        DEFB 253,254
  290 SCR112
  300 TIGHT3 DEFB 26
  310        DEFW 2816+A2,352+COLBUF
  320        DEFB 255,255
  330        DEFB 255,255,255,255,255,255,255,255
  340        DEFB 255,255,255,255,255,255,255,255
  350        DEFB 255,255,255,255,255,255,255,255
  360        DEFB 253,254
  370 SCR102
  380 TRAP1  DEFB 5
  390        DEFW 1554+A2,210+COLBUF
  400        DEFB 39+128,41+128,40+128,40+128,39+128,253
  410 TRAP2  DEFB 5+128
  420        DEFW 1815+A2,247+COLBUF
  430        DEFB 39+128,40+128,40+128,41+128,39+128,253,254
  440 SCR126
  450 BLOCK  DEFB 3+128
  460        DEFW 2836+A2,372+COLBUF
  470        DEFB 201,203,204,205,206,208,253,254
  480 SCR115 DEFB 2+128
  490        DEFW 1039+A2,143+COLBUF
  500        DEFB 209,211,215,216,212,214,209,211,212,214,209
  510        DEFB 211,215,216,212,214,209,211,215,216,212,214
  520        DEFB 253
  530        DEFB 254
  540 SCR114
  550 RUBTRE DEFB 2
  560        DEFW 3087+A2,399+COLBUF
  570        DEFB 90,95,94,95,90,93,253,254
  580 SCRE51 DEFB 7
  590        DEFW 2578+A2,338+COLBUF
  600        DEFB 167,169,168,167,167,169,168,253,254

Design Documents

Here are all the design documents I used when writing the game.

Variables

This lists the names and purposes of all the variables used in Blip Blop.

Subroutines

Here are the subroutines used with descriptions of the purpose of each.

Memory Map and Workspaces

This details where all the data for the game is stored in memory. This includes the data for the screens, the graphic blocks each screen is built from, the graphics for the objects that can be picked up and moved and the machine code itself, which is stored at 40,640.

This document describes the main workspaces. A1 contains the solid background to each screen – so what you see minus the objects (trees, grass etcetera) that Blip Blop can walk past. A2 contains the whole screen including the non-solid elements. If you play the game, you will be able to see that the way the main sprite interacts with the background is very unusual – almost all games treat the main sprite as a rectangle for the purposes of collision detection, but in Blip Blop I used the actual shape of Blip Blop himself. This means that he can, for example, rest supported only by the edge of the bulge of his main body. Also, if he stands on one foot, he will wobble up and down a bit as he raises and lowers his foot. I did it this way because I hadn’t realised that other games took a short cut and did it a much simpler way.

In every frame of the game, workspace A2 is then copied to workspace B, where Blip Blop is added, before workspace B is in turn copied to the screen.

Objects Data

This shows how the data for each object is structured in memory. The ix register is used to point at the object allowing easy access to all its data. The first byte indicates which screen the object is currently on. (If you have picked an object up or it is not currently in the world for another reason, its location is set to a room you can’t get to under the hill. If you activate the cheat mode, you can teleport there and see them all.)

Bytes 2 and 3 point to the object’s graphic in memory, while 4 and 5 give its coordinates within its current screen. Byte 6 specifies the objects colour, while the last two bytes point to the text that gives the object’s name.

This table lists all the objects, which are identified by the numbers on the left. It also gives the starting location of each object, in terms of coordinates and starting screen.

Screen Lengths and Addresses

The spectrum screen takes up 6.75K, so on the 48K, or even the 128K spectrums, you wouldn’t manage to fit many rooms into memory if you didn’t use some clever tricks. In practice, game screens were always made up from a limited range of graphics blocks – sometimes 8 by 8 pixels, sometimes bigger. Blip Blop uses 8 by 8 or one character size blocks, and as the main part of the screen is 32 by 16 blocks in size, that would make each screen take up 512 bytes=0.5K, still quite a bit of memory. Therefore, I wrote a compression algorithm that further compressed screens – by, for example, replacing a long run of blank blocks with simply a count of how many blank blocks were in a row. (Most screens had large amounts of black space in them.)

The difficulty with this is that each screen is now a different size. This document kept track of the screens, their sizes and where each one was stored in memory. To actually create the screens, I had to write screen design software, as well as software for designing the individual blocks they were made up from. I haven’t included all these utility programs in the source code here, mainly because I didn’t want to have to go through the process of tracking them all down on my ancient +3 disks or working out exactly what was what – it’s a veeeery long time since I used any of them.

Action Positions

Various things in the game can only happen if you are in the right place in a particular room. Often this is using an object, but it can be dying in water or looking through the telescope. This list contains the conditions under which certain actions will occur.

Additions to Screens

Most elements of a screen are permanent, but several things can come or go as you progress through the game. This list contains those elements that must be added to a screen in addition to the permanent elements, including where on the screen this is, and in some cases it also gives the graphic blocks that the object is made up of.

Screen Bottom Panel Layout and Memory Map

This shows the design for the bottom third of the screen, including the memory locations of various parts of the display.

Character Set

This is the Blip Blop character set. There are only 31 characters – upper case letters, full stop, space and the numbers 1, 2 and 9. There are no numbers in the game itself, so the only numbers needed are the ones needed to specify the year the game was written (1992). A to Z are mapped to their normal ASCII values, but the other characters correspond to ASCII @[\] and ^.

The Source Code on a Spectrum +3 Disk

Below is the game Blip Blop along with its source code on a virtual +3 disk that you can load with an emulator. For details of how to do so see the Triblox page.

From +3 Basic, load”blipblop” will load and run the game. PICTURE is the loading screen, while BLOCK1 and BLOCK2 both contain the game data (graphics, screens etcetera). The Blip Blop machine code is contained within BLOCK2 from address 40,640.

If you want to assemble Blip Blop’s code yourself, first start GENP351 (see the Triblox page). Then type g,,code.tex Once the code is loaded type c and enter 1000, then type a16,4000,m:code This will assemble the code and save it to the ram disk. 16 tells the assembler that while the code is designed to be placed at 40,640, for now it can just put it anywhere. 4000 just reserves enough space for all the symbol names used in the code – the default setting isn’t enough for Blip Blop.

To use this code, type b to return to basic, then use merge”blipblop” to load Blip Blop’s loader program without running it. After the code from the disk has been loaded, we now want to load in the code we have just assembled, so add:

25 load”m:code”code40640

Now if you type run, Blip Blop should load and run as before.

Why not try making some edits to the code before assembling and seeing what happens?

Blip Blop on the Web

You can find Blip Blop at World of Spectrum here and at Spectrum Computing here. To play it in your browser without downloading it, click here.

Instructions and Solution

Here is the plot of the game, the instructions and a solution. If you’re still stuck, or you want to see a map of the whole game, visit The Tipshop.

Leave a Reply

Your email address will not be published. Required fields are marked *