Classic Computer Magazine Archive PROGRAM LISTING: 85-06/GUP.ASM


10 ;  G.U.P.
20 ;  BY DAREK MIHOCKA
30 ;  (c) 1985, ANTIC PUBLISHING
40 START =   $4000
50       *=  START
60       JSR INIT
70       .WORD RANDOM
80       .WORD SQUARE
90       .WORD DRAWTO
0100     .WORD LINE
0110     .WORD CIRCLE
0120     .WORD COLOR
0130     .WORD GRAPHICS
0140     .WORD C128
0150     .WORD CIRF
0160     .WORD TEXTPLOT
0170     .WORD ONEPLOT
0180     .WORD COLORN
0190     .WORD SETCOLOR
0200 ;FUTURE EXPANSION
0210     .WORD END
0220     .WORD END
0230 TITLE .SBYTE " GRAPHICS UTILITY PACKAGE. DAREK MIHOCKA"
0240 ;ZERO PAGE VARIABLES
0250 XLOC =  203
0260 YLOC =  204
0270 COL =   205
0280 OFFSET = 206
0290 ONEORMANY = 207
0300 XLOCOFFSET = 208
0310 HBYTES = 209
0320 ;THE FOLLOWING ARE TEMPORARY
0330 ;VARIABLES STORED IN FR0
0340 REG1 =  212
0350 REG2 =  214
0360 REG3 =  216
0370 SLOPE = 218
0380 MASK =  220
0390 XMAX =  221
0400 YMAX =  222
0410 XTEMP = 223
0420 YTEMP = 224
0430 IDEAL = 225
0440 RAD =   227
0450 ORAD =  228
0460 RADS =  229
0470 XC  =   230
0480 YC  =   231
0490 YTEMP2 = 232
0500 STRHI = 233
0510 STRLO = 234
0520 STRLEN = 235
0530 LCOUNT = 236
0540 ;THE SUPERFAST PLOT
0550 PLOT LDA XLOC
0560     AND #$07    ;0-7
0570     ORA OFFSET  ;8n
0580     TAX         ;=MASK OFFSET
0590     LDA YLOC
0600     AND #3
0610     TAY 
0620     LDA MASKTABLE,X
0630     AND ONEORMANY ;0 MAKES MANY
0640     STA MASK
0650     EOR #255
0660     AND COLOR,Y
0670     STA COL
0680 ;ENTER HERE FOR MORE SPEED
0690 MINIPLOT LDX YLOC
0700     CPX #192
0710     BCS PLOTFIN
0720     LDA XLOC
0730 YDIV
0740     LDY #2
0750     BEQ MEM87
0760     LSR A
0770     DEY 
0780     BEQ MEM87
0790     LSR A
0800     DEY 
0810     BEQ MEM87
0820     LSR A
0830 MEM87 TAY 
0840 MEM88
0850     LDA SCR.TABLE,X
0860     STA REG2
0870     LDA SCR.TABLE+$C0,X
0880 MEM89
0890     STA REG2+1
0900     LDA (REG2),Y
0910     AND MASK
0920     ORA COL
0930     STA (REG2),Y ;THE PLOT
0940 PLOTFIN RTS 
0950 XINT .WORD 0
0960 COLOR .WORD $FFFF,$FFFF
0970 MUL .WORD 0
0980 ;MASK FOR PLOT
0990 MASKTABLE .BYTE 0,0,0,0,0,0,0,0,15,240,15,240,15,240,15,240,$3F,$CF,$F3,$FC,$3F,$CF,$F3,$FC
1000     .BYTE $7F,$BF,$DF,$EF,$F7,$FB,$FD,$FE
1010 HLINMACH
1020     LDA XMAX    ;NO ENTRY FROM BASIC
1030     CMP XLOC    ;MAKE SURE
1040     BEQ FINI.2  ;XLOC<XMAX
1050     BCS HLIN2
1060     LDX XLOC
1070     STX XMAX
1080     STA XLOC
1090 HLIN2 LDA XMAX
1100     AND MASKFORHLIN
1110     STA XTEMP
1120     LDA XLOC
1130     AND MASKFORHLIN
1140     CMP XTEMP
1150     BEQ HLIN4.4
1160     CMP XLOC
1170     BEQ HLIN3.2
1180     ADC HBYTES
1190     STA YTEMP   ;XLOC/4+1
1200 HLIN2.2
1210     JSR PLOT
1220     INC XLOC
1230     LDA XLOC
1240     CMP XMAX
1250 FINI.2
1260     BEQ HLIN4.4
1270     CMP XTEMP
1280     BEQ HLIN4.4
1290     CMP YTEMP
1300     BNE HLIN2.2
1310 HLIN3.2
1320     LDA #0
1330     STA ONEORMANY
1340     JSR PLOT
1350     LDA XLOC
1360     CLC 
1370     ADC HBYTES
1380     STA XLOC
1390     JMP HLIN3.5
1400 HLIN3.3
1410     INC REG2
1420     BNE HLIN3.4
1430     INC REG2+1
1440 HLIN3.4
1450     LDA COL
1460     STA (REG2),Y
1470     LDA XLOC
1480     CLC 
1490     ADC HBYTES
1500     STA XLOC
1510 HLIN3.5
1520     CMP XTEMP
1530     BNE HLIN3.3
1540     LDA #$FF
1550     STA ONEORMANY
1560 HLIN4.4
1570     JSR PLOT
1580     LDA XLOC
1590     CMP XMAX
1600     BEQ FINI
1610     INC XLOC
1620     JMP HLIN4.4
1630 FINI
1640     RTS 
1650 MASKFORHLIN .BYTE 0
1660 SQUARE PLA      ;A=USR(BOX,A,B,C,D)
1670     PLA 
1680     PLA 
1690     STA XMIN
1700     PLA 
1710     PLA 
1720     STA YLOC
1730     PLA 
1740     PLA 
1750     STA XMAX
1760     PLA 
1770     PLA 
1780     STA YMAX
1790 SQRMACH
1800     LDA XMIN
1810     CMP XMAX
1820     BCC S01
1830     LDX XMAX
1840     STX XMIN
1850     STA XMAX
1860 S01 LDA YLOC
1870     CMP YMAX
1880     BCC S02
1890     LDX YMAX
1900     STX YLOC
1910     STA YMAX
1920 S02
1930     LDA XMIN
1940     STA XLOC
1950     JSR HLIN2
1960     INC YLOC
1970     LDA YLOC
1980     CMP YMAX
1990     BNE S02
2000     LDA XMIN
2010     STA XLOC
2020     JSR HLIN2
2030 END2 RTS 
2040 YMIN .WORD 0
2050 XMIN .WORD 0
2060 DRAWTO PLA      ;BASIC DR.
2070     STA NARG
2080     INC NARG
2090     INC NARG
2100     LDA TYMAX
2110     PHA 
2120     LDA #0
2130     PHA 
2140     LDA TXMAX
2150     PHA 
2160     LDA #0
2170     PHA 
2180     LDA NARG
2190     PHA 
2200 LINE
2210     PLA         ;LINE X,Y,A,B...
2220     LSR A
2230     BEQ END2
2240     CMP #1
2250     BNE LINE3
2260     JMP PLOT
2270 LINE3 STA NARG
2280     DEC NARG
2290     PLA 
2300     PLA 
2310     STA XLOC
2320     PLA 
2330     PLA 
2340     STA YLOC
2350     STA IDEAL+1
2360     JMP ARGLOOPINIT
2370 ARGLOOP
2380     LDA TXMAX
2390     STA XLOC
2400     LDA TYMAX
2410     STA YLOC
2420     STA IDEAL+1
2430 ARGLOOPINIT
2440     PLA 
2450     STA NEGSL
2460     PLA 
2470     STA XMAX
2480     STA TXMAX
2490     PLA 
2500     PLA 
2510     STA YMAX
2520     STA TYMAX
2530     JSR DRAWTOMACH
2540     DEC NARG
2550     BNE ARGLOOP
2560     RTS 
2570 NARG .WORD 0
2580 TXMAX .WORD 0
2590 TYMAX .WORD 0
2600 DRAWTOMACH LDA YMAX
2610     CMP YLOC
2620     BNE DIV1    ;SAME Y?
2630     JMP HLINMACH ;YES, DO HLIN
2640 DIV1
2650     LDA XMAX
2660     CMP XLOC
2670     BNE DIV2    ;SAME X?
2680     JMP VLINMACH ;YES, DO VLIN
2690 DIV2 BCS DIV22
2700     LDX XLOC
2710     STX XMAX
2720     STA XLOC
2730     LDA YLOC
2740     LDY YMAX
2750     STA YMAX
2760     STY YLOC
2770     STY IDEAL+1
2780     LDA XMAX
2790 DIV22 SEC 
2800     SBC XLOC
2810     STA DIV     ;DIVISOR
2820     PHA 
2830     LDA YLOC
2840     STA IDEAL+1
2850     LDA #0
2860     STA G128
2870     STA NEGSL
2880     PLA 
2890     BPL DIV.OK
2900     STA G128
2910     LSR DIV
2920 DIV.OK
2930     INC DIV
2940     LDA YMAX
2950     SEC 
2960     SBC YLOC
2970     BCS DIV23
2980     PHA 
2990     LDA #1
3000     STA NEGSL
3010     PLA 
3020     EOR #255
3030 DIV23 CLC       ;DIVIDEND
3040     ADC #1
3050     STA LOBYT
3060     LDA #0
3070     JSR DIV3    ;M=Y/X
3080     PHA 
3090     STA LOBYT
3100     LDA QUT
3110     STA SLOPE+1 ;M-HI BYTE
3120     LDA #0
3130     STA LOBYT
3140     PLA 
3150     CLC 
3160     ADC #0
3170     JSR DIV3
3180     LDA QUT
3190     STA SLOPE   ;M-LO BYTE
3200     LDA #128    ;XLOC+1
3210     STA IDEAL   ;TO ROUND OFF
3220     LDA #$E6
3230     STA INYLOC
3240     STA INYLOC2
3250     LDA G128
3260     BEQ L128
3270     CLC 
3280     ROR SLOPE+1
3290     ROR SLOPE
3300 L128
3310     LDA SLOPE+1
3320     STA MSMALL
3330     CMP #1
3340     BNE L129
3350     LDA SLOPE
3360     STA MSMALL
3370 ;IF SLOPE <=1 THEN MSMALL=0
3380 L129
3390     LDA NEGSL
3400     BEQ FIRSTPLOT
3410     LDA SLOPE
3420     EOR #255
3430     STA SLOPE
3440     LDA SLOPE+1
3450     EOR #255
3460     STA SLOPE+1
3470     LDA #$C6
3480     STA INYLOC
3490     STA INYLOC2
3500 FIRSTPLOT LDA MSMALL
3510     BEQ CHECK1
3520     JSR PLOT
3530 NEXTIDEAL CLC   ;CALCULATE
3540     LDA IDEAL   ;IDEAL POS.
3550     ADC SLOPE
3560     STA IDEAL
3570     LDA IDEAL+1
3580     ADC SLOPE+1
3590     STA IDEAL+1
3600     LDA YLOC
3610     CMP IDEAL+1
3620     BEQ CHECK1
3630 INYLOC2 INC YLOC
3640 DRAWLOOP LDA YLOC
3650     CMP IDEAL+1
3660     BEQ CHECK1  ;Y=IDEAL?
3670     CMP YMAX
3680     BEQ CHECK1  ;Y=MAX?
3690     JSR PLOT
3700 INYLOC INC YLOC
3710     JMP DRAWLOOP
3720 CHECK1
3730     JSR PLOT
3740     LDA XLOC
3750     CMP XMAX
3760     BEQ DRDONE
3770     INC XLOC
3780     JMP NEXTIDEAL
3790 DRDONE RTS 
3800 DIV .WORD 0
3810 QUT .WORD 0
3820 LOBYT .WORD 0
3830 REMDR .WORD 0
3840 NEGSL .WORD 0
3850 MSMALL .BYTE 0
3860 DIV3
3870     LDY #8
3880     SEC 
3890     SBC DIV
3900 DLOOP
3910     PHP 
3920     ROL QUT
3930     ASL LOBYT
3940     ROL A
3950     PLP 
3960     BCC WORDDD
3970     SBC DIV
3980     JMP DNEXT
3990 WORDDD ADC DIV
4000 DNEXT DEY 
4010     BNE DLOOP
4020     BCS DLAST
4030     ADC DIV
4040     CLC 
4050 DLAST ROL QUT
4060     RTS 
4070 VLINMACH LDA YLOC
4080     CMP YMAX
4090     BCC VLIN22
4100     LDY YMAX
4110     STA YMAX
4120     STY YLOC
4130 VLIN22 JSR PLOT
4140     LDA YLOC
4150     CMP YMAX
4160     BEQ VEND
4170 VLINLOOP INC YLOC
4180     JSR PLOT
4190     LDA YLOC
4200     CMP YMAX
4210     BNE VLINLOOP
4220 VEND RTS 
4230 CIRCLE
4240     PLA         ;A=USR(CIRCLE,X,Y,R)
4250     PLA 
4260     PLA 
4270     STA XC
4280     PLA 
4290     PLA 
4300     STA YC
4310     PLA 
4320     STA IDEAL
4330     STA IDEAL+1
4340     PLA 
4350     STA RAD
4360     BEQ VEND
4370 CIRMACH
4380     STA DIV     ;DIV=RAD
4390     LDA #128
4400     STA LOBYT
4410     LDA #0
4420     JSR DIV3
4430     PHA 
4440     LDA #0
4450     STA LOBYT
4460     LDA QUT
4470     STA SLOPE+1 ;HI BYTE OF /
4480     PLA 
4490     JSR DIV3
4500     LDA QUT
4510     STA SLOPE   ;LO BYTE
4520     LDA #255
4530     STA LCOUNT
4540 YLOOP
4550     LDA IDEAL
4560     CLC 
4570     ADC SLOPE
4580     STA IDEAL
4590     LDA IDEAL+1
4600     ADC SLOPE+1
4610     STA IDEAL+1
4620     TAX 
4630     BIT IDEAL+1
4640     BMI VEND    ;FINISHED?
4650     INC LCOUNT
4660     LDA YC
4670     SEC 
4680     SBC LCOUNT
4690     STA YLOC
4700     LDA CIRWORD,X
4710     STA MUL
4720     LDA #0
4730     STA LOBYT
4740     LDX #8
4750 MULOOP LSR MUL
4760     BCC NOADD
4770     CLC 
4780     ADC RAD
4790 NOADD ROR A
4800     ROR LOBYT
4810     DEX 
4820     BNE MULOOP
4830 CIRCLESTRETCH.1 NOP 
4840 CIRCLESTRETCH.2 NOP 
4850     STA RADS
4860     LDA CIRF
4870     BEQ RING
4880     LDA XC
4890     CLC 
4900     ADC RADS
4910     STA XMAX
4920     LDA XC
4930     SEC 
4940     SBC RADS
4950     STA XLOC
4960     JSR HLIN2   ;UPPER LINE
4970     LDA YC
4980     CLC 
4990     ADC LCOUNT
5000     STA YLOC
5010     LDA XC
5020     SEC 
5030     SBC RADS
5040     STA XLOC
5050     JSR HLIN2   ;LOWER LINE
5060     JMP YLOOP
5070 RING
5080     LDA LCOUNT
5090     BNE RING2
5100     LDA YC
5110     STA YLOC
5120     LDA XC
5130     CLC 
5140     ADC RADS
5150     STA XLOC
5160     JSR PLOT
5170     LDA XC
5180     SEC 
5190     SBC RADS
5200     STA XLOC
5210     JSR PLOT
5220 RING4 LDA RADS
5230     STA ORAD
5240     JMP YLOOP
5250 RING2
5260     LDA YC
5270     CLC 
5280     ADC LCOUNT
5290     STA YLOC
5300     JSR RING3
5310     LDA YC
5320     SEC 
5330     SBC LCOUNT
5340     STA YLOC
5350     JSR RING3
5360     JMP RING4
5370 RING3 LDA XC
5380     SEC         ;DOES THE LEFT
5390     SBC ORAD    ;SIDE OF
5400     STA XLOC    ;THE RING
5410     LDA XC
5420     SEC 
5430     SBC RADS
5440     STA XMAX
5450     JSR HLINMACH
5460     LDA XC
5470     CLC         ;DOES THE RIGHT
5480     ADC ORAD    ;SIDE OF
5490     STA XMAX    ;THE RING
5500     LDA XC
5510     CLC 
5520     ADC RADS
5530     STA XLOC
5540     JSR HLINMACH ;DRAWIT
5550     RTS 
5560 CIRF .WORD 1
5570 NUMDIV .BYTE 0
5580 ;DATA FOR OFFSET TO BIT MASK
5590 TABOFFSET .BYTE 0,0,0,16,24,16,24,16,24,8,8,8,0,0,24,16
5600 ;DATA FOR CIRCLE RATIO
5610 TABRATIO .BYTE 255,0,1,255,255,255,255,255,255,1,1,1,255,255,1,0
5620 GRAPHICS
5630     PLA         ;BASIC GR. (0-63)
5640     PLA 
5650     PLA 
5660     STA GRMODE
5670     AND #$0F
5680     TAX 
5690     LDA TABOFFSET,X
5700     STA OFFSET
5710     LDA #$EA
5720     STA CIRCLESTRETCH.1
5730     STA CIRCLESTRETCH.2 ;NOP'S
5740     LDA TABRATIO,X
5750     BEQ NOSTRETCH
5760     CMP #255
5770     BEQ GR8
5780     CMP #2
5790     BEQ STRETCH2
5800 STRETCH1 LDA #$4A
5810     STA CIRCLESTRETCH.1
5820     JMP NOSTRETCH
5830 STRETCH2 LDA #$4A
5840     STA CIRCLESTRETCH.2
5850     JMP STRETCH1
5860 GR8 LDA #$0A
5870     JMP STRETCH1+2
5880 NOSTRETCH
5890     LDA BYTAB,X
5900     STA BYTES
5910     LDA TABHLIN,X
5920     STA MASKFORHLIN
5930     LDA DTAB,X
5940     STA YDIV+1  ;� OF ROT'S
5950     STA NUMDIV
5960     LDA HBTAB,X
5970     STA HBYTES  ;�OF PIXELS/BYTE
5980     TXA 
5990     CMP #12
6000     BPL OK12
6010     LDA GRMODE
6020     JSR GRAPHICSMACH ;EXIT TO OS
6030     LDA GRMODE
6040     AND #$0F
6050     CMP #9
6060     BMI CALC
6070     LDA #4
6080     STA 703     ;SUPPRESS GR.0
6090     BNE CALC
6100 OK12 LDA GRMODE
6110     AND #$30
6120     STA TEMP
6130     LDA GRMODE
6140     AND #3      ;SUB 12
6150     TAX 
6160     PHA         ;SAVE X
6170     LDA GTAB,X
6180     ORA TEMP
6190     JSR GRAPHICSMACH ;DO GR.
6200     PLA         ;GET X
6210     TAX 
6220     LDA ATAB,X
6230     STA ANTICMOD+1
6240     LDX GRMODE
6250     LDY #202
6260 ANTICLOOP LDA (REG2),Y
6270     AND #$BF    ;LDA FROM DL
6280     CMP ANTICMOD ;NEW MODE?
6290     BNE NEXTANTIC
6300     LDA (REG2),Y
6310     AND #$F0
6320     ORA ANTICMOD+1 ;CHANGE MODE
6330     STA (REG2),Y
6340 NEXTANTIC DEY 
6350     BNE ANTICLOOP
6360 CALC
6370     LDX #8
6380 CALC.COL
6390     LDA SETCOLOR,X
6400     STA 704,X
6410     DEX 
6420     BPL CALC.COL
6430     LDA 88
6440     CLC 
6450     ADC XLOCOFFSET
6460     STA IDEAL
6470     STA SCR.TABLE
6480     LDA 89
6490     STA IDEAL+1
6500     STA SCR.TABLE+$C0
6510     LDY #1
6520 CALCLOOP CLC 
6530     LDA IDEAL
6540     ADC BYTES
6550     STA IDEAL
6560     STA SCR.TABLE,Y
6570     LDA IDEAL+1
6580     ADC #0
6590     STA IDEAL+1
6600     STA SCR.TABLE+$C0,Y
6610     INY 
6620     CPY #192
6630     BNE CALCLOOP
6640     RTS 
6650 ;IMITATE GR.12-15 WITH 0 OR 8
6660 GTAB .BYTE 0,0,8,8
6670 ANTICMOD .WORD 0
6680 ATAB .BYTE 4,5,12,14
6690 GRMODE .WORD 0
6700 BYTAB .BYTE 40,20,20,10,10,20,20,40,40,40,40,40,40,40,20,40
6710 ;BYTES PER SCREEN
6720 TABHLIN .BYTE 255,255,255,$FC,$F8,$FC,$F8,$FC,$F8,$FE,$FE,$FE,255,255,$F8,$FC
6730 BYTES .WORD 0
6740 C128
6750 TDLO =  544     ;TIMER 5
6760     PLA 
6770     PLA 
6780     STA TDLO+1  ;TIME DELAY HI
6790     PLA 
6800     STA TDLO    ;TIME DELAY LO
6810     PLA 
6820     PLA 
6830     TAX         ;COLOR REGISTER
6840     LDA #255
6850     STA 558
6860 CLOOP
6870     LDA 54283
6880     CLC 
6890     ADC 20
6900     ASL A
6910     STA 54282
6920     STA 53266,X
6930     LDA 558
6940     BNE CLOOP
6950     RTS 
6960 GRAPHICSMACH PHA 
6970     LDX #$60
6980     LDA #255&CCLOSE
6990     STA ICCOM,X
7000     JSR CIO
7010     LDX #$60
7020     LDA #255&COPEN
7030     STA ICCOM,X
7040     LDA #SCREENNAME&255
7050     STA ICBADR,X
7060     LDA #SCREENNAME/256
7070     STA ICBADR+1,X
7080     PLA 
7090     STA ICAUX2,X
7100     AND #$F0
7110     EOR #$1C
7120     STA ICAUX1,X
7130     JSR CIO
7140     LDA 560
7150     STA REG2
7160     LDA 561
7170     STA REG2+1
7180     LDY #7
7190     LDA (REG2),Y
7200     STA ANTICMOD
7210     RTS 
7220 CIO =   $E456
7230 ICCOM = $0342
7240 ICBADR = $0344
7250 ICAUX1 = $034A
7260 ICAUX2 = $034B
7270 COPEN = 3
7280 CCLOSE = 12
7290 SCREENNAME .BYTE "S:"
7300 CIRWORD
7310 ;THE CIRCLE DATA. HERE GOES:
7320     .BYTE 153,153,153,153,153,153,153,153,153,153,153,152,152,152,152,152,152,152,151,151
7330     .BYTE 151,151,151,150,150,150,150,150,149,149,149,148,148,148,147,147,147,146,146,146
7340     .BYTE 145,145,144,144,144,143,143,142,142,141,141,140,140,139,138,138,137,137,136,135
7350     .BYTE 135,134,134,133,132,131,131,130,129,128,128,127,126,125,124,123,123,122,121,120
7360     .BYTE 119,118,117,116,115,114,113,111,110,109,108,107,105,104,103,102,100,99,97,96
7370     .BYTE 94,93,91,90,88,86,84,82,81,79,76,74,72,70,67,65,62,60,57,53
7380     .BYTE 50,46,43,38,33,27,19,0
7390 TEXTPLOT
7400     PLA 
7410     PLA 
7420     PLA 
7430     STA XLOC
7440     PLA 
7450     PLA 
7460     STA YLOC
7470     PLA 
7480     STA STRHI
7490     PLA 
7500     STA STRLO
7510     PLA 
7520     PLA 
7530     STA STRLEN
7540     DEC STRLEN
7550     LDY #0
7560 TEXT.1
7570     LDA STRLO
7580     STA REG2
7590     LDA STRHI
7600     STA REG2+1
7610     LDA (REG2),Y
7620     STY YTEMP
7630     PHA         ; STORE LETTER
7640     AND #$60
7650     LSR A
7660     LSR A
7670     LSR A
7680     LSR A
7690     LSR A
7700     TAY         ;CONVERSION
7710     LDA CONV,Y
7720     STA XTEMP
7730     PLA 
7740     AND #$9F
7750     ORA XTEMP   ;DONE!
7760     STA SLOPE
7770     LDA #0
7780     STA SLOPE+1
7790     CLC 
7800     ROL SLOPE
7810     ROL SLOPE+1
7820     ROL SLOPE
7830     ROL SLOPE+1
7840     ROL SLOPE
7850     ROL SLOPE+1
7860     LDA SLOPE
7870     STA REG2
7880     LDA SLOPE+1
7890     CLC 
7900     ADC #57344/256
7910     STA REG2+1  ;REG2=CHS+8*ASC
7920     LDY #7
7930 TEXT.2 STY YTEMP2
7940     TYA 
7950     CLC 
7960     ADC YLOC
7970     TAX 
7980     LDA XLOC
7990     LSR A
8000     LSR A
8010     CLC 
8020 MEM88.1
8030     ADC SCR.TABLE,X
8040     STA REG1
8050     LDA SCR.TABLE+$C0,X
8060     ADC #0
8070 MEM89.1
8080     STA REG1+1  ;REG1=SCR.BYTE
8090     LDA XLOC
8100     AND #$03
8110     TAX 
8120     CLC 
8130     LDY YTEMP2
8140     LDA (REG2),Y
8150     STA REG3
8160     LDA #0
8170     STA REG3+1
8180 TEXT.3
8190     ROR REG3
8200     ROR REG3+1
8210     DEX 
8220     BPL TEXT.3
8230     LDY #0
8240     LDA TEXT.CLEAR
8250     AND (REG1),Y
8260     EOR REG3
8270     STA (REG1),Y
8280     INY 
8290     LDA TEXT.CLEAR
8300     AND (REG1),Y
8310     EOR REG3+1
8320     STA (REG1),Y
8330     LDY YTEMP2
8340     DEY 
8350     BPL TEXT.2
8360     INC XLOC
8370     INC XLOC
8380     INC XLOC
8390     INC XLOC
8400     LDA XLOC
8410     CMP #152
8420     BCC TEXT.5
8430     SEC 
8440     SBC #152
8450     STA XLOC
8460     LDA YLOC
8470     CLC 
8480     ADC #8
8490     STA YLOC
8500     CMP #184
8510     BCC TEXT.5
8520 TEXT.5
8530     LDY YTEMP
8540     CPY STRLEN
8550     BEQ TEXT.4
8560     INY 
8570     JMP TEXT.1
8580 TEXT.4
8590     RTS 
8600 TEXT.CLEAR .WORD 255
8610 CONV .BYTE $40,$00,$20,$60
8620 G128 .WORD 0
8630 DTAB .BYTE 0,0,0,2,3,2,3,2,3,1,1,1,0,0,3,2
8640 ;LOG2 OF HBTAB
8650 HBTAB .BYTE 1,1,1,4,8,4,8,4,8,2,2,2,1,1,8,4
8660 ;PIXELS PER BYTE
8670 TEMP .WORD 0
8680 ONEPLOT
8690     PLA         ;BASIC ENTRY - PLOT
8700     PLA 
8710     PLA 
8720     STA XLOC
8730     PLA 
8740     PLA 
8750     STA YLOC
8760     JMP PLOT
8770 COLORN
8780     PLA         ;A=USR(SET,A1,A2,A3,A4)
8790     LDX #4
8800     LDY #0
8810 COLOR.2
8820     PLA 
8830     PLA 
8840     STA COLOR,Y
8850     INY 
8860     DEX 
8870     BNE COLOR.2
8880     RTS 
8890 RANDOM
8900     PLA 
8910     LDX #3
8920 RND.LOOP
8930     LDA 53770
8940     STA COLOR,X
8950     DEX 
8960     BPL RND.LOOP
8970     RTS 
8980 INIT
8990     LDA 88
9000     STA REG1
9010     LDA 89
9020     STA REG1+1
9030     LDY #39
9040 INITLOOP
9050     LDA TITLE,Y
9060     STA (REG1),Y
9070     DEY 
9080     BPL INITLOOP
9090     LDA #255
9100     STA ONEORMANY
9110     LDA #$24
9120     STA 710
9130     RTS 
9140 SETCOLOR
9150     *=  *+9
9160 SCR.TABLE
9170     *=  *+384
9180 END

Back to previous page