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


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

Back to previous page