start tok64 d64-WNPXyH 10 *=$c800 20 pmx = $cfff 40 ; 50 ; ********************** 60 ; ** ** 70 ; ** high resolutiON ** 80 ; ** graphics package ** 90 ; ** ** 100 ;********************** 110 ; 120 ; modIFied FOR asm 64 by: mr.p. 130 ; 140 ; rom jump addresses 150 ; ******************* 160 ; 170 GETbyt=$b79e ; GET byte VALue 180 chkcom=$aefd ; check FOR comma 190 chkGET=$b7f1 ; chkcom+GETbyt 200 GETcOR=$b7eb ; GET coORdinates 210 qerr= $b248 ; illegal quantity 220 v= $d000 ; video CONTroller 230 ; 240 ; zero page registers 250 ; ******************** 260 ; 270 offx =$63 280 msc =$ab ; mask 290 dIF0 =$69 300 dIF1 =$6a 310 dIF2 =$6b 320 dIF3 =$6c 330 dIF4 =$6d 340 dIF5 =$6e 350 temp =$6f 360 ctr =$70 370 aa =$ac 380 b =aa+1 390 xc =$14 400 flg =$97 410 use =$fd ; misc 420 ; 430 ; cONsTANts 440 ; ********* 450 ; 460 graph =$2000 ; start of graphics 470 video =$0400 ; start of video ram 480 gstart=$21 ; grstart+1-msb 490 gEND =$3e ; grEND-1-msb 500 ; 510 ; 520 ; CONTrol addresses 530 ; ***************** 540 ; 550 jmp init ; graphics ON 560 jmp GOff ; graphics off 570 jmp gclear ; clear screen 580 jmp scolOR ; set colOR (clear) 590 jmp pcolOR ; plot colOR 600 jmp plot ; set poINT 610 jmp unplot ; erase poINT 620 jmp sline ; draw line 630 jmp clline ; clear line 640 jmp gLOAD ; LOAD graphics 650 jmp gSAVE ; SAVE graphics 660 jmp hardc ;hardcopy(cbm1525 etc) 670 ; 680 ; 690 ; turn graphics ON 700 ; ***************** 710 ; 720 init nop ; no blockade 730 lda v+17 740 sta sTOre1 750 lda v+24 760 sta sTOre2 770 lda #$3b ;(%00111011) 780 sta v+17 ; SAVE all CONTents 790 lda #$18 ;(%00011000) 800 sta v+24 ; TO $2000 810 lda #$60 ; $60 FOR rts as blockade 820 sta init ; init will be blocked 830 rts 840 ; 850 ; 860 ; turn graphics off 870 ; ****************** 880 ; 890 GOff lda sTOre1 900 sta v+17 910 lda sTOre2 920 sta v+24 930 lda #$ea ; code FOR nop 940 sta init ; FOR blockade 950 jmp $e544 ; clear screen 960 ; 970 ; 980 ; erase poINT 990 ; ************ 1000 ; 1010 unplot ldx #0; erase flag 1020 byt $2c 1030 ; 1040 ; 1050 ; set poINT 1060 ; ********** 1070 ; 1080 plot ldx #$80; set flag 1090 pl1 stx flg 1100 jsr chkcom 1110 jsr tescOR ; GET coORdinates 1120 jsr hPOSn ; calculate address 1130 jmp plt ; set/erase poINT 1140 ; 1150 ; 1160 ; erase line 1170 ; *********** 1180 ; 1190 clline ldx #0; erase-flag 1200 byt $2c 1210 ; 1220 ; 1230 ; draw line 1240 ; ********** 1250 ; 1260 sline ldx #$80; set-flag 1270 jsr pl1 ; set first poINT 1280 jsr chkcom 1290 jsr tescOR ; GET secONd coORd. 1300 jmp hline ; draw line 1310 ; 1320 ; 1330 ; test coORdinates 1340 ; ***************** 1350 ; 1360 tescOR jsr GETcOR;GET 1370 txa 1380 tay 1390 ldx xc+1 1400 cpy #200 ;"y-coord.>=200? 1410 bcs illff ; yes! 1420 lda xc 1430 cpx #>320 ;"x-coord.>=320? 1440 bcc t1 ; yes! 1450 bne illff ; a xc-low 1460 cmp #<320 ; x xc-high 1470 bcs illff ; y yc 1480 t1 rts 1490 illff jmp qerr; illegal quantity 1500 ; 1510 ; 1520 ; calvulate address 1530 ; ****************** 1540 ; 1550 hPOSn sty yc ; y-c 1560 sta xcl ; x-cl 1570 stx xch ; x-ch (tempORary) 1580 sta xc 1590 stx xc+1 1600 tya 1610 lsr a 1620 lsr a 1630 lsr a ; INT(y/8) 1640 tax 1650 lda mulh,x ; 320*INT(y/8) (hb) 1660 sta b 1670 txa 1680 AND #3 ; isolate bits 0 & 1 1690 tax 1700 lda mull,x ; 320*INT(y/8) (lb) 1710 sta aa 1720 tya ; y-coORd. 1730 AND #7 ; (y AND 7) 1740 clc 1750 adc aa ; off y=320*INT(y/8)+ 1760 sta aa ; (y AND 7) 1770 lda xc 1780 AND #$f8 ; off x=8*INT(x/8) 1790 sta offx 1800 lda #>graph ; graphic page 1810 ORa b 1820 sta b ; +sa 1830 clc 1840 lda aa 1850 adc offx ; ad+oofy+offx+sa 1860 sta aa 1870 lda b 1880 adc xc+1 1890 sta b 1900 lda xc 1910 AND #7 1920 eOR #7 ; 7-(x AND 7) 1930 tax 1940 lda msctab,x ; mask table 1950 sta msc ; 2(7-(x AND 7)) 1960 rts 1970 ; 1980 ; 1990 ; dot poINT 2000 ; ********** 2010 ; 2020 plt ldy #0 2030 php ; SAVE carry flag 2040 lda msc ; mask 2050 bit flg ; plot/unplot flag 2060 bmi pl2 ; plot 2070 eOR #$ff ; unplot 2080 AND (aa),y 2090 byt $2c ; skip NEXT commAND 2100 pl2 ORa (aa),y; plot 2110 sta (aa),y 2120 lda aa ; set colOR 2130 sta use 2140 lda b 2150 lsr a 2160 rOR use 2170 lsr a 2180 rOR use 2190 lsr a 2200 rOR use ; address/8 2210 AND #3 2220 ORa #4 ; video ram at $0400 2230 sta use+1 2240 lda colOR ; colOR in 2250 sta (use),y ; video ram 2260 plp ; carry flag 2270 ldy temp 2280 rts 2290 ; 2300 ; 2310 ; clear graphics screen 2320 ; ********************** 2330 ; 2340 gclear lda #>graph 2350 sta use+1 2360 ldy #video 2640 sta use+1 2650 ldy #