0100  *=$4000
0110  JMP START
0120 ;CIO
0130 ICCMD=$342 ;COMMAND NUMBER
0140 ICSTA=$343 ;STATUS
0150 ICBAL=$344 ;BUFFER ADDRESS
0160 ICBAH=$345
0170 ICBLL=$348 ;BUFFER LENGTH
0180 ICBLH=$349
0190 ICAX1=$34A ;AUX
0200 ICAX2=$34B
0210 CIOV=$E456
0220 ;
0230 EOL=$9B
0240 LOW=$CB
0250 HIGH=$CC
0260 SAVEY=$CD
0270 SAVEX=$CE
0280 SAVEA=$CF
0290 ;PLAYER-MISSILE BASE POINTER
0300 PMBASE=$D407
0310 ;OS TOP OF RAM POINTER
0320 RAMTOP=$6A 
0330 ;RAM SHADOW OF DMACTL REGISTER
0340 SDMCTL=$22F
0350 ;CTIA GRAPHICS CONTROL REGISTER
0360 GRACTL=$D01D
0370 ;HORIZONTAL POS OF MISSILE 0
0380 HPOSM0=$D004 
0390 ;HORIZONTAL POSITION OF PLAYER 0
0400 HPOSP0=$D000 
0410 ;SHADOW OF PLAYER 0 COLOR
0420 PCOLR0=$2C0 
0430 ;CHARACTER MODE REGISTER
0440 CHACT=$2F3 
0450 ;SAVED MEMORY SCAN COUNTER
0460 SAVMSC=$58 
0470 GPRIOR=$26F ;SPRITE PRIORITY
0480 RTCLOK=$14 ;CHANGES EVERY FRAME
0490 VCOUNT=$D40B ;VERTICAL COUNT/2
0500 LINES=130 ;NTSC LINES
0510 ;
0520 ;DRAWS THE PLAYER
0530 ;SET HIGH AND A
0540 DRAWP
0550  STA LOW
0560  LDY #0
0570 DRAWP2 LDA DATA,Y
0580  STA (LOW),Y
0590  INY
0600  CPY #8 ;HEIGHT OF DATA
0610  BNE DRAWP2
0620  RTS
0630 ;
0640 ;CLEARS THE PLAYER
0650 ;SET HIGH AND A
0660 CLEARP
0670  STA LOW
0680  LDY #0
0690  LDA #0
0700 CLEARP2 STA (LOW),Y
0710  INY
0720  CPY #8 ;HEIGHT OF DATA
0730  BNE CLEARP2
0740  RTS
0750 ;
0760 VSYNC
0770  LDA VCOUNT
0780  CMP #LINES
0790  BNE VSYNC
0800  RTS
0810 ;
0820 FILENAME .BYTE "S:",EOL
0830 PLAYER0L .BYTE 0
0840 PLAYER0H .BYTE 0
0850 YPOS0 .BYTE 0
0860 YPOS1 .BYTE 0
0870 YPOS2 .BYTE 0
0880 YPOS3 .BYTE 0
0890 XPOS0 .BYTE 0
0900 XPOS1 .BYTE 0
0910 XPOS2 .BYTE 0
0920 XPOS3 .BYTE 0
0930 ;
0940 DATA
0950  .BYTE $3C ;00111100
0960  .BYTE $7E ;01111110
0970  .BYTE $DB ;11011011
0980  .BYTE $FF ;11111111
0990  .BYTE $DB ;11011011
1000  .BYTE $E7 ;11100111
1010  .BYTE $7E ;01111110
1020  .BYTE $3C ;00111100
1030 ;
1040 START
1050  LDA #$10
1060  STA YPOS0
1070  LDA #$40
1080  STA YPOS2
1090  LDA #$90
1100  STA YPOS1
1110  LDA #$A0
1120  STA YPOS3
1130 ;
1140 ;OPEN S:
1150  LDX #$10
1160  LDA #$03 ;OPEN
1170  STA ICCMD,X
1180  LDA #FILENAME&255
1190  STA ICBAL,X
1200  LDA #FILENAME/256
1210  STA ICBAH,X
1220  LDA #$FF
1230  STA ICBLL,X
1240  STA ICBLH,X
1250  LDA #4+8+16 ;RW AND SPLIT
1260  STA ICAX1,X
1270  LDA #7 ;MODE 7
1280  STA ICAX2,X
1290  JSR CIOV
1300 ;
1310 ;GET RAM 6K BELOW TOP OF RAM
1320  LDA RAMTOP 
1330  SEC
1340  SBC #6*4 ;4 PAGES IN 1K
1350  STA HIGH
1360  STA PMBASE
1370  INC HIGH ;2 PAGES + PMBASE
1380  INC HIGH
1390  LDA HIGH
1400  STA PLAYER0H
1410  LDA #$0
1420  STA LOW
1430  STA PLAYER0L
1440 ;STA CHACT ;TURN OFF CURSOR
1450  LDA #1 ;PLAYER PRIORITY
1460  STA GPRIOR
1470 ;
1480 ;ENABLE PM DMA WITH 2-LINE RES
1490  LDA #$2E
1500  STA SDMCTL
1510 ;
1520 ;ENABLE PM DISPLAY
1530  LDA #3
1540  STA GRACTL
1550 ;
1560 ;THIS LOOP CLEARS ALL PLAYERS
1570  LDY #0
1580  LDX #0
1590  LDA #0
1600 CLEAR STA (LOW),Y
1610  INY
1620  BNE CLEAR
1630  INX
1640  INC HIGH
1650  CPX #2
1660  BNE CLEAR
1670 ;
1680 ;COLOR THE PLAYERS
1690  LDA #$58 ;PINK
1700  STA PCOLR0
1710  LDA #$38
1720  STA PCOLR0+1
1730  LDA #$18
1740  STA PCOLR0+2
1750  LDA #$78
1760  STA PCOLR0+3
1770 ;
1780  LDA #$30 ;X OFFSET
1790  STA HPOSP0
1800  STA XPOS0
1810  LDA #$60
1820  STA HPOSP0+1
1830  STA XPOS1
1840  LDA #$90
1850  STA HPOSP0+2
1860  STA XPOS2
1870  LDA #$B0
1880  STA HPOSP0+3
1890  STA XPOS3
1900 ;
1910 ;ROWS 80 COLS 160 COLORS 4
1920 ;PATTERN ON THE GRAPHICS SCREEN
1930  LDA SAVMSC
1940  STA LOW
1950  LDA SAVMSC+1
1960  STA HIGH
1970  LDX #0
1980 PATTERN1
1990  LDY #0
2000  LDA #0
2010 PATTERN2
2020  STA (LOW),Y
2030  CLC
2040  ADC #1
2050  INY
2060  CPY #80
2070  BNE PATTERN2
2080  LDA LOW
2090  CLC
2100  ADC #80
2110  STA LOW
2120  BCC PATTERN3
2130  INC HIGH
2140 PATTERN3
2150  INX
2160  CPX #40
2170  BNE PATTERN1
2180 ;
2190 LOOP
2200  LDA PLAYER0H
2210  STA HIGH
2220  JSR VSYNC
2230  LDX #0
2240 CLEARPLOOP
2250  LDA YPOS0,X
2260  JSR CLEARP
2270  INX
2280  CPX #2
2290  BNE CLEARLOOP2
2300  INC HIGH
2310 CLEARLOOP2
2320  CPX #4
2330  BNE CLEARPLOOP
2340  LDA PLAYER0H
2350  STA HIGH
2360 ;CHANGE POSITIONS
2370  INC YPOS0
2380  LDA YPOS0
2390  CMP #120
2400  BNE LOOP2
2410  LDA #0
2420  STA YPOS0
2430 LOOP2
2440  DEC YPOS1
2450  LDA YPOS1
2460  CMP #128
2470  BNE LOOP3
2480  LDA #255-7
2490  STA YPOS1
2500 LOOP3
2510  INC YPOS2
2520  LDA YPOS2
2530  CMP #120
2540  BNE LOOP4
2550  LDA #0
2560  STA YPOS2
2570 LOOP4
2580  DEC YPOS3
2590  LDA YPOS3
2600  CMP #128
2610  BNE LOOP5
2620  LDA #255-7
2630  STA YPOS3
2640 LOOP5
2650 ;
2660  LDX #0
2670 DRAWPLOOP
2680  LDA YPOS0,X
2690  JSR DRAWP
2700  INX
2710  CPX #2
2720  BNE DRAWLOOP2
2730  INC HIGH
2740 DRAWLOOP2
2750  CPX #4
2760  BNE DRAWPLOOP
2770 ;
2780  JMP LOOP
