Classic Computer Magazine Archive PROGRAM LISTING: 84-11/PMCURSOR.ASM


1000 ; LISTING 2 PMCURSOR.SRC
1010 ; PLAYER CURSOR BY JERRY WHITE
1020 ; AND CARLOS REYES
1030 ;
1040 ;System Equates
1050 ;
1060 ROWCRS=$54
1070 COLCRS=$55
1080 DINDEX=$57
1090 FR0=$D4
1100 SRTIMR=$22B
1110 SDMCTL=$22F
1120 GPRIOR=$26F
1130 TXTROW=$290
1140 TXTCOL=$291
1150 TINDEX=$293
1160 BOTSCR=$2BF
1170 PCOLR2=$2C2
1180 CRSINH=$2F0
1190 HPOSP2=$D002
1200 SIZEP2=$D00A
1210 COLPM2=$D014
1220 GRACTL=$D01D
1230 PRIOR=$D01B
1240 DMACTL=$D400
1250 PMBASE=$D407
1260 SETVBV=$E45C
1270 XITVBV=$E462
1280 ;
1290 ;Program Equates
1300 ;
1310 PSTART=0
1320 PLAYER2=PSTART+$600
1330 PSHAPE=PSTART+$600 ;Shape data
1340 PCOLOR=10
1350 PRATE=8
1360 PFLASH=PSHAPE+8
1370 ;
1380 ;Call from BASIC where ROUTINE
1390 ;is the address of this routine
1400 ;CURSOR=USR(ROUTINE)
1410 ;
1420  *=$4000        ;Relocatable
1430 ;
1440 INIT
1450  PLA            ;# arguments=0
1460  LDA FR0        ;FR0=INIT
1470  CLC
1480  ADC #MAIN-INIT&$FF
1490  STA FR0
1500  LDA FR0+1
1510  ADC #MAIN-INIT/$100
1520  STA FR0+1      ;FR0=MAIN
1530  LDX #8-1       ;Move cursor data
1540  LDY #SHAPE-MAIN+7
1550 LOOP
1560  LDA (FR0),Y
1570  STA PSHAPE,X
1580  DEY
1590  DEX
1600  BPL LOOP
1610  LDY FR0        ;Enable VBLANK
1620  LDX FR0+1
1630  LDA #7         ;Deferred
1640  JMP SETVBV     ;Return
1650 ;
1660 ;Start of the VBLANK routine
1670 ;
1680 MAIN
1690  LDA CRSINH     ;PEEK(752)
1700  BEQ ERASE      ;No PM cursor
1710  LDA SRTIMR     ;Key pressed?
1720  BEQ SKIP
1730  LDA #0         ;Yes, show cursor
1740  BEQ SKIP1      ;Forced branch
1750 SKIP
1760  LDA PFLASH     ;Flashing logic
1770  CLC
1780  ADC #PRATE
1790 SKIP1
1800  STA PFLASH
1810  BMI ERASE      ;Cursor invisible
1820  LDY #255       ;Clear the player RAM
1830  LDA #0
1840 LOOP1
1850  STA PLAYER2,Y
1860  DEY
1870  CPY #8
1880  BNE LOOP1
1890  LDA #PCOLOR    ;Init PM variables
1900  STA PCOLR2     ;Player 2 color
1910  STA COLPM2
1920  LDA #1
1930  STA GPRIOR
1940  STA PRIOR
1950  LDA #0
1960  STA SIZEP2
1970  LDA #PSTART/$100
1980  STA PMBASE
1990  LDA #2
2000  STA GRACTL
2010  LDA #2+32+8+16
2020  STA SDMCTL
2030  STA DMACTL
2040  LDX COLCRS     ;Check screen mode
2050  LDY ROWCRS
2060  LDA DINDEX
2070  ORA TINDEX
2080  BEQ SKIP2      ;Full screen
2090  LDA BOTSCR
2100  CMP #4
2110  BNE ERASE      ;No text window
2120  TYA            ;Add offset to line
2130  CLC
2140  ADC #20
2150  TAY
2160 SKIP2
2170  TXA            ;Find hor. pos.
2180  ASL A
2190  ASL A
2200  ADC #48
2210  STA HPOSP2
2220  TYA            ;Find vert. pos.
2230  ASL A
2240  ASL A
2250  ASL A
2260  ADC #32+7
2270  TAY            ;Move cursor into
2280  LDX #7         ;position
2290 LOOP2
2300  LDA PSHAPE,X
2310  STA PLAYER2,Y
2320  DEY
2330  DEX
2340  BPL LOOP2
2350  JMP XITVBV     ;RETURN
2380 ;
2390 ERASE
2400  LDA #0         ;Move player
2410  STA HPOSP2     ;off screen
2420  JMP XITVBV
2430 ;
2440 ;Data for underline shape
2450 ;
2460 SHAPE
2470  .BYTE 0,0,0,0,0,0,0,240

Back to previous page