Classic Computer Magazine Archive PROGRAM LISTING: 87-07/ARTCONVR.M65


0100 ;ASCII ART CONVERTER (v 2.0)
0105 ;BY PAUL TUPACZEWSKI
0110 ;(c)1987, ANTIC PUBLISHING INC.
0115     .OPT NO LIST
0120     .OPT OBJ
0125 ;
0130 LOHI1 = $CF     ;Page 0
0135 LOHI =  $CB     ;variables.
0140 POINTER = $CD
0145 ICCOM = $0342   ;CIO command
0150 ICBAL = $0344   ;CIO lo and
0155 ICBAH = $0345   ;Hi buffer adrs
0160 ICBLL = $0348   ;CIO lo and
0165 ICBLH = $0349   ;hi buffer lens
0170 CIOV =  $E456   ;OS CIO routine
0175 ICAX1 = $034A   ;CIO aux1
0180 ICAX2 = $034B   ;CIO aux2
0185 SDLSTL = $0230  ;Dlist pointer
0190 SDMCTL = $022F  ;DMA
0195 VDSLST = $0200  ;DLI pointer
0200 NMIEN = $D40E   ;DLI switch
0205 WSYNC = $D40A   ;Wait for sync
0210 ;
0215     *=  $2000
0220 ;
0225 START
0230     LDX #$30    ;First,
0235     LDA #3      ;open our
0240     STA ICCOM,X ;keyboard
0245     LDA # <KH   ;channel.
0250     STA ICBAL,X
0255     LDA # >KH
0260     STA ICBAH,X
0265     LDA #4
0270     STA ICAX1,X
0275     LDA #0
0280     STA ICAX2,X
0285     JSR CIOV    ;Do it!
0290 ;
0295 ;Main loop.
0300 ST1
0305     JSR CLEARFN ;Clear the
0310 ;               filename area.
0315     JSR CLRBIGBUF ;Clear our
0320 ;                 screen memory
0325     JSR CLEARALLELSE
0330     JSR CLOSE   ;Close channels
0335 ;
0340     LDX #$20    ;Close disk
0345     LDA #$0C    ;channel.
0350     STA ICCOM,X
0355     JSR CIOV
0360     LDA # <DLIST1 ;Show the
0365     STA SDLSTL  ;  main display
0370     LDA # >DLIST1 ;list.
0375     STA SDLSTL+1
0380     LDA #33     ;Smaller
0385     STA SDMCTL  ;screen
0390     LDA #$C4    ;green
0395     STA 710     ;GR.0 lines
0400     LDA # <DLI  ;start our
0405     STA VDSLST  ;DLI's
0410     LDA # >DLI
0415     STA VDSLST+1
0420     LDA #$C0
0425     STA NMIEN
0430     LDA # <ST1  ; Where we go
0435     STA MNUJMP+1 ;after an
0440     LDA # >ST1  ; error.
0445     STA MNUJMP+2
0450 ;
0455 GETKEYS
0460     JSR GETKEY  ;Get a key.
0465     LDA KEY     ;Is it a
0470     CMP #32     ;space?
0475     BEQ CONVERT ;Yes, convert.
0480 ;
0485     CMP #'G     ;Is it G?
0490     BNE NO1     ;No.
0495 ;
0500     LDA #'+-32  ;Toggle from
0505     SEC         ;GR.7 to
0510     SBC L5+19   ;GR.7+ or
0515     STA L5+19   ;vice versa.
0520     JMP GETKEYS ;back.
0525 ;
0530 NO1
0535     CMP #'P     ;Is it P?
0540     BNE NO2     ;No.
0545 ;
0550     INC POS     ;Yes, change
0555     LDA POS     ;picture
0560     CMP #4      ;positioning.
0565     BNE NOTOVER
0570 ;
0575     LDA #0
0580     STA POS
0585 ;
0590 NOTOVER
0595     LDX POS     ;Show arrow.
0600     LDA ARWS,X
0605     STA L4+23
0610     JMP GETKEYS
0615 ;
0620 NO2
0625     CMP #'C     ;Is it C?
0630     BNE NO3     ;No.
0635 ;
0640     LDA #1      ;Toggle column
0645     SEC         ;from 80-132 and
0650     SBC COL     ;vice versa.
0655     STA COL
0660     ASL A
0665     ASL A
0670     LDY #0
0675     TAX 
0680 LOOPQ
0685     LDA COLS,X  ; Show our
0690     STA L1+23,Y ;columns.
0695     INX 
0700     INY 
0705     CPY #4
0710     BNE LOOPQ
0715 ;
0720     JMP GETKEYS
0725 ;
0730 NO3
0735     CMP #'D     ;Is it D?
0740     BNE NO4     ;No.
0745 ;
0750     INC FILENAME+1 ;Increment
0755     LDA FILENAME+1 ;default
0760     CMP #'9     ;   drive.
0765     BNE OKDRIVE
0770 ;
0775     LDA #'1
0780     STA FILENAME+1
0785 OKDRIVE
0790     LDA FILENAME+1
0795     SEC 
0800     SBC #$20
0805     STA L2+14
0810     JMP GETKEYS
0815 ;
0820 NO4
0825     CMP #'L     ;Is it L?
0830     BNE GETKEYS ;No. Start over.
0835 ;
0840     JSR INPUT   ;Get filename.
0845     JMP GETKEYS ;Back.
0850 ;
0855 ;  Start conversion.
0860 ;
0865 CONVERT
0870     LDA FILENAME+3 ;Is there
0875     CMP #32     ;  a filename?
0880     BNE GOTAF1  ;  Yes.
0885 ;
0890     JMP GETKEYS ; Do over.
0895 GOTAF1
0900     JSR SETMD   ; Set borders.
0905     LDA # <SELECT ;Prompt for
0910     STA SDLSTL  ; "Default or
0915     LDA # >SELECT ;Edit?"
0920     STA SDLSTL+1
0925 DEFRNT
0930     JSR GETKEY  ;Get a key.
0935     LDA KEY
0940     CMP #'U     ;Is it U?
0945     BEQ USEDEFS ;Yes!
0950 ;
0955     CMP #'E     ;Is it E?
0960     BNE DEFRNT  ;No, try again.
0965 ;
0970     JMP GOTAFILENM ;edit them.
0975 ;
0980 USEDEFS
0985     LDX #0      ;Copy default to
0990 USE1
0995     LDA DEFAULTS,X ;gray shade
1000     STA CHARCOLR+32,X ;chart.
1005     INX 
1010     CPX #64
1015     BNE USE1
1020 ;
1025     JMP DONEFIGR ;Good, convert.
1030 ;
1035 GOTAFILENM
1040     LDA # <DLIST3 ; Show
1045     STA SDLSTL  ;   our
1050     LDA # >DLIST3 ;"Edit"
1055     STA SDLSTL+1 ;  screen.
1060     LDA #0      ;Black-out
1065     STA 711     ;extra text.
1070     LDA #$40    ;DLI's
1075     STA NMIEN   ;off.
1080     JSR OPEN    ;Open disk
1085     JSR CLRBUFF ;Clear buffer
1090     JSR CLRCOLS ;Clear gray
1095 ;                shade chart.
1100     LDA #0      ;Temp var.
1105     STA TEMP
1110 GETLOOP
1115     LDX #$10    ;   OK, get
1120     LDA #7      ;256 bytes off
1125     STA ICCOM,X ;the file.
1130     LDA # <BUFFER
1135     STA ICBAL,X
1140     LDA # >BUFFER
1145     STA ICBAH,X
1150     LDA #0
1155     STA ICBLL,X
1160     LDA #1
1165     STA ICBLH,X
1170     JSR CIOV
1175     LDY #0
1180 SRCHLOOP
1185     LDA BUFFER,Y ;  Check for
1190     JMP CHECK4RTN ; a RETURN.
1195 ;
1200 BACKHR
1205     TAX         ;Find individual
1210     LDA CHARCOLR,X ;occurences.
1215     BNE SRCHCONT
1220 ;
1225     INC CHARCOLR,X
1230     LDA BUFFER,Y
1235     SEC 
1240     SBC #32
1245     LDX TEMP
1250     STA DISPLINE,X
1255     JMP LOP
1260 ;
1265 SRCHCONT
1270     INY         ; Continue it.
1275     BNE SRCHLOOP
1280 ;
1285     LDX #$10
1290     LDA ICCOM+1,X
1295     CMP #136    ; End Of File?
1300     BNE GETLOOP ; No.
1305 ;
1310 EOF
1315     JSR CLOSE   ; Close disk.
1320     LDA #$46    ; Turn the text
1325 ;                 on again.
1330     STA 711
1335     LDA #0      ; Clear temp var
1340     STA TEMP
1345 INPUT1
1350     LDX TEMP    ; Show arrow.
1355     LDA #$40+'^ ; ^ is actually
1360 ;                 CTRL-UPARROW.
1365     STA ARL,X
1370     LDA CRL,X   ; Show cursor.
1375     CLC 
1380     ADC #$80
1385     STA CRL,X
1390 KEYGET
1395     JSR GETKEY  ; Get a key.
1400     LDA KEY
1405     CMP #155    ; Is it RETURN?
1410     BEQ DONEFIGR ;Yes.
1415 ;
1420     CMP #126    ;Is it BKSPACE?
1425     BNE NOBK    ;No.
1430 ;
1435     LDA TEMP    ;At start?
1440     BEQ KEYGET  ;Yes.
1445 ;
1450     JSR ERASECR ;Erase cursor.
1455     DEC TEMP    ;Back up!
1460     JMP INPUT1  ;get key...
1465 ;
1470 NOBK
1475     CMP #32     ;Is it a SPACE?
1480     BNE NOSPC   ;No.
1485 ;
1490     LDA TEMP    ;At end?
1495     CMP #31
1500     BEQ KEYGET  ;Yes.
1505 ;
1510     JSR ERASECR ;Erase cursor.
1515     INC TEMP    ;Onward!
1520     JMP INPUT1  ;Get key...
1525 ;
1530 NOSPC
1535     CMP #48     ;Have
1540     BCC KEYGET  ;a
1545 ;                number
1550     CMP #'4     ;from 0
1555     BCS KEYGET  ;to 3?
1560 ;
1565     SEC 
1570     SBC #48     ;Good, change
1575     STA TEMP+1  ;ATASCII to #.
1580     LDX TEMP    ;Show it.
1585     LDA ARL-32,X
1590     CLC 
1595     ADC #$20
1600     TAX 
1605     LDA TEMP+1  ;   Store value
1610     STA CHARCOLR,X ;in gray
1615 ;                   shade chart.
1620     LDX TEMP
1625     LDA TEMP+1
1630     CLC 
1635     ADC #$10
1640     STA CRL,X   ;Next cursor pos
1645     LDA #0
1650     STA ARL,X
1655     INC TEMP
1660     JMP INPUT1
1665 ;
1670 DONEFIGR
1675     JSR OPEN    ;OK, open again.
1680 GR7SCRN
1685     JSR OPENS   ;Let the OS
1690 ;               take care of the
1695 ;               screen mem.
1700 REST
1705     LDA #34     ;Normal screen.
1710     STA SDMCTL
1715     LDA #0      ;Start at
1720     STA XX      ;0,0
1725     STA YY
1730     LDA #12     ;Our colors...
1735     STA 712     ;(wonderful
1740     LDA #10     ;grays.)
1745     STA 708
1750     LDA #7
1755     STA 709
1760     LDA #2
1765     STA 710
1770     LDA #$40    ;No DLI's.
1775     STA NMIEN
1780 GETLOOP2
1785     LDX #$10    ;Get 256
1790     LDA #7      ;bytes off
1795     STA ICCOM,X ;the disk...
1800     LDA # <BUFFER
1805     STA ICBAL,X
1810     LDA # >BUFFER
1815     STA ICBAH,X
1820     LDA #0
1825     STA ICBLL,X
1830     LDA #1
1835     STA ICBLH,X
1840     JSR CIOV
1845 ;
1850     LDX #$10    ;End Of File?
1855     LDA ICCOM+1,X
1860     CMP #136
1865     BNE ZZZZOOM ;No.
1870 ;
1875     JSR CLREST  ;Clear the rest.
1880 ZZZZOOM
1885     LDA #0      ;Temp. pointer
1890     STA P256
1895 PLOTLOOP
1900     LDX P256
1905     LDA BUFFER,X ;Get chr by chr
1910     CMP #155    ;Is it ATASCII
1915 ;                      RETURN ?
1920     BEQ LF      ;Yes.
1925 ;
1930     CMP #13     ;Is it ASCII
1935 ;                      RETURN ?
1940     BEQ LF      ;Yes.
1945 ;
1950     CMP #10     ;Is it ASCII
1955 ;                     linefeed?
1960     BEQ IT      ;Yes.
1965 ;
1970     TAX 
1975     LDY COL     ;  OK. Offset
1980     LDA COLAMT,Y ; the X
1985     CLC         ;  values.
1990     ADC XX
1995     STA TEMP+1
2000     LDA CHARCOLR,X ; Get gray
2005     LDX TEMP+1  ; shade color.
2010     LDY YY
2015     JSR PLOTROUT ;Plot it.
2020     INC XX      ; Next X.
2025 IT
2030     INC P256    ;Inc. buffer.
2035     LDA P256    ;Done?
2040     BNE PLOTLOOP ;No.
2045 ;
2050     JMP GETLOOP3 ;Get more.
2055 ;
2060 LF
2065     LDA #0      ;RETURN handler.
2070     STA XX      ;X=0,
2075     INC YY      ;Y=Y+1.
2080     JMP ITZNEET ;Next!
2085 ;
2090 GETLOOP3
2095     LDA $0353   ;EOF?
2100     CMP #136
2105     BNE GETLOOP2 ;No.
2110 ;
2115     JSR CLOSE   ;Close disk.
2120 ENDIT
2125     JMP TOGLS   ;Done, wait
2130 ;                for toggles.
2135 ;
2140 ; Plotting handler.
2145 ;
2150 PLOTROUT
2155     STA TEMP+2  ;  Store
2160     LDA POS     ;  all our
2165     BNE PLOTROUT1 ;X and Y
2170 ;                  and offset
2175     LDA TEMP+2  ;  for
2180     JMP PLOT    ;  positioning.
2185 ;
2190 PLOTROUT1
2195     CMP #1
2200     BNE PLOTROUT2
2205 ;
2210     TXA 
2215     STA TEMP+1
2220     TYA 
2225     STA TEMP
2230 MD
2235     LDA #128
2240     SEC 
2245     SBC TEMP+1
2250     TAY 
2255     LDA TEMP
2260     TAX 
2265     LDA TEMP+2
2270     JMP PLOT
2275 ;
2280 PLOTROUT2
2285     CMP #2
2290     BNE PLOTROUT3
2295 ;
2300     STX TEMP+1
2305     STY TEMP
2310     LDA #159
2315     SEC 
2320     SBC TEMP+1
2325     TAX 
2330     LDA #95
2335     SEC 
2340     SBC TEMP
2345     TAY 
2350     LDA TEMP+2
2355     JMP PLOT
2360 ;
2365 PLOTROUT3
2370     TXA 
2375     STA TEMP+1
2380     TYA 
2385     STA TEMP
2390 MD2
2395     LDA #-$20
2400     CLC 
2405     ADC TEMP+1
2410     TAY 
2415     LDA #159
2420     SEC 
2425     SBC TEMP
2430     TAX 
2435     LDA TEMP+2
2440     JMP PLOT
2445 ;
2450 ; Final finish.
2455 ;
2460 TOGLS
2465     LDA 53279   ; OPTION?
2470     CMP #3
2475     BEQ MENYOU  ;Yes.
2480 ;
2485     LDA #7
2490     STA 709
2495     LDA 764     ;Keypress?
2500     CMP #255
2505     BEQ NOSLCT  ;no.
2510 ;
2515     LDA L5+19   ;Toggle screens.
2520     BEQ HIR
2525 ;
2530     LDA #192
2535     STA BTM+1
2540     BNE YUMP
2545 ;
2550 HIR
2555     LDA #96
2560     STA BTM+1
2565 YUMP
2570     JSR TRANSFER7
2575     LDA #255
2580     STA 764
2585 ;
2590 NOSLCT
2595     LDA # <MENYOU ; Where we go
2600     STA MNUJMP+1 ;  if we get
2605     LDA # >MENYOU ; an error.
2610     STA MNUJMP+2
2615     JMP TOGLS   ;Back!
2620 ;
2625 MENYOU
2630     LDA SDLSTL  ;Another
2635     STA LOHI1   ;menu.
2640     LDA SDLSTL+1 ;Show it.
2645     STA LOHI1+1
2650     LDA # <DLIST0
2655     STA SDLSTL
2660     LDA # >DLIST0
2665     STA SDLSTL+1
2670     LDA #12
2675     STA 709
2680     LDA L2+14
2685     STA LSAVE+20
2690 ;
2695 CONSKYS
2700     LDA 53279   ;START key?
2705     CMP #6
2710     BNE MORECONS ;No.
2715 ;
2720     LDA LOHI1   ;Otherwise,
2725     STA SDLSTL
2730     LDA LOHI1+1
2735     STA SDLSTL+1
2740     JMP TOGLS   ;Back!
2745 ;
2750 MORECONS
2755     LDA 764     ;Key?
2760     CMP #$FF
2765     BEQ CONSKYS ;No.
2770 ;
2775     JSR GETKEY  ;Get a key.
2780     LDA KEY     ;Is it 1-4?
2785     CMP #'1
2790     BCC CONSKYS
2795 ;
2800     CMP #'5
2805     BCS CONSKYS
2810 ;
2815     CMP #'3     ;YES! Is it 3?
2820     BNE NOPEY2  ;No.
2825 ;
2830     JSR INPUTQ  ;Get filename.
2835     JMP CONSKYS ;try again.
2840 ;
2845 NOPEY2
2850     CMP #'4     ;Is it 4?
2855     BNE NOPEY   ;No.
2860 ;
2865     JMP ST1     ;Restart.
2870 ;
2875 NOPEY
2880     LDA LSAVE+22 ;First, is
2885     BEQ CONSKYS ; there a
2890 ;                a filename? No!
2895 ;
2900     LDA KEY     ;Yes, but which
2905     CMP #'1     ;mode? 1?
2910     BNE NOPEY1  ;No...
2915 ;
2920     JSR OPENSVE ;Open save file
2925     LDA #0      ;temp...
2930     STA TEMP
2935     LDA 88      ;Start screen
2940     STA LOHI    ;address.
2945     LDA 89
2950     STA LOHI+1
2955 LB
2960     LDY #0
2965 LOADBUFF
2970     LDA (LOHI),Y ;Our EXPAND
2975     STA BUFFER,Y ;routine...
2980 ;                 Changes GR.7
2985     STA BUFFER+40,Y ;into GR.7+
2990     INY 
2995     CPY #40
3000     BNE LOADBUFF
3005 ;
3010     LDX #$10    ;Save to disk.
3015     LDA #11
3020     STA ICCOM,X
3025     LDA # <BUFFER
3030     STA ICBAL,X
3035     LDA # >BUFFER
3040     STA ICBAH,X
3045     LDA #80
3050     STA ICBLL,X
3055     LDA #0
3060     STA ICBLH,X
3065     JSR CIOV
3070     LDA $0353
3075     CMP #1      ;Any errors?
3080     BNE OHOH1   ;Yes.
3085 ;
3090     LDA LOHI    ;Next screen
3095 ;                bytes.
3100     CLC 
3105     ADC #40
3110     STA LOHI
3115     LDA LOHI+1
3120     ADC #0
3125     STA LOHI+1
3130     INC TEMP
3135     LDA TEMP
3140     CMP #96     ;End of screen?
3145     BNE LB      ;No.
3150 ;
3155     JMP CLOSESAVE ;Yes, close.
3160 ;
3165 NOPEY1
3170     CMP #'2     ; Not this one!
3175     BNE CONSKYSQ ;ARRRGH!
3180 ;
3185     JSR OPENSVE ;Open for save.
3190     LDX #$10    ;Plain 62 sector
3195     LDA #11     ;save.
3200     STA ICCOM,X
3205     LDA 88
3210     STA ICBAL,X
3215     LDA 89
3220     STA ICBAH,X
3225     LDA # <7680
3230     STA ICBLL,X
3235     LDA # >7680
3240     STA ICBLH,X
3245     JSR CIOV
3250     JMP CHECKERR ;Done.
3255 ;
3260 CONSKYSQ
3265     JMP CONSKYS ;Loop back.
3270 ;
3275 OHOH1
3280     JMP OHOH    ;Ditto.
3285 ;
3290 CHECKERR
3295     LDA $0353   ;Error?
3300     CMP #1
3305     BNE OHOH1   ;Yes.
3310 ;
3315     JMP CLOSESAVE ;Close disk.
3320 ;
3325 MORECONS1
3330     JMP MORECONS ;Back.
3335 ;
3340 CLEARALLELSE
3345     LDX #0      ;Clear all else!
3350 CAE1
3355     LDA #0
3360     STA DISPLINE,X ;Show lines.
3365     INX 
3370     CPX #96
3375     BNE CAE1
3380 ;
3385     LDA #0      ;colors!
3390     STA 712
3395     LDA #10
3400     STA 709
3405     LDX #0
3410     TXA 
3415 CLEARCHCLS
3420     STA CHARCOLR,X ;Gray shades!
3425     INX 
3430     CPX #120
3435     BNE CLEARCHCLS
3440 ;
3445     RTS 
3450 ;
3455 ITZNEET
3460     LDX POS     ;Other stuff!
3465     LDA L5+19
3470     BNE UDDER1
3475 ;
3480     LDA ENDZ,X
3485     CMP YY
3490     BNE LEEVE
3495 ;
3500     JMP NXTSCRN
3505 ;
3510 UDDER1
3515     LDA ENDZZ,X
3520     CMP YY
3525     BNE LEEVE
3530 ;
3535     JMP NXTSCRN2
3540 ;
3545 LEEVE
3550     JMP IT
3555 ;
3560 NXTSCRN
3565     LDA #96
3570     STA BTM+1
3575     JSR TRANSFER7
3580 NX
3585     LDA #0      ;Clear screens!
3590     STA XX
3595     STA YY
3600     JMP IT
3605 ;
3610 NXTSCRN2
3615     LDA #192
3620     STA BTM+1
3625     JSR TRANSFER7
3630     JMP NX
3635 ;
3640 CLOSESAVE
3645     LDX #$10    ;Close the save
3650     LDA #11     ;by appending
3655 ;                color info.
3660     STA ICCOM,X
3665     LDA # <COLORSD
3670     STA ICBAL,X
3675     LDA # >COLORSD
3680     STA ICBAH,X
3685     LDA #4
3690     STA ICBLL,X
3695     LDA #0
3700     STA ICBLH,X
3705     JSR CIOV
3710     LDX #$10
3715     LDA #$0C
3720     STA ICCOM,X
3725     JSR CIOV
3730     JMP CONSKYS ;Back.
3735 ;
3740 COLORSD
3745     .BYTE 12,10,6,2 ;Our screen
3750 ;                   gray shades.
3755 ;
3760 OPENSVE
3765     LDX #$10    ;Open for
3770     LDA #3      ;disk write.
3775     STA ICCOM,X
3780     LDA # <FILENAME
3785     STA ICBAL,X
3790     LDA # >FILENAME
3795     STA ICBAH,X
3800     LDA #8
3805     STA ICAX1,X
3810     LDA #0
3815     STA ICAX2,X
3820     JSR CIOV
3825     LDA $0353   ;Error?
3830     CMP #1
3835     BNE OHOH    ;YES!!!
3840 ;
3845     RTS 
3850 ;
3855 OHOH
3860     PLA 
3865     JMP ERROR
3870 ;
3875 ; Input filename
3880 ;
3885 INPUTQ
3890     JSR CLEARFN ;Clear filename
3895     LDX #0
3900 INPLOOPQ
3905     STX TEMP
3910     LDA #$80
3915     LDX TEMP
3920     STA LSAVE+22,X
3925     JSR GETKEY  ;Get loop.
3930     LDX TEMP
3935     LDA KEY
3940     CMP #126    ;Backspace??
3945     BNE NOTBKSPQ ;No.
3950 ;
3955     CPX #0      ; First spot?
3960     BEQ INPLOOPQ ;Yes.
3965 ;
3970     LDA #0      ; Back up.
3975     STA LSAVE+22,X
3980     LDA #32
3985     STA FILENAME+3,X
3990     DEX 
3995     JMP INPLOOPQ
4000 ;
4005 NOTBKSPQ
4010     CMP #155    ;RETURN?
4015     BEQ FINIQ   ;Yes.
4020 ;
4025     CPX #12     ;At end?
4030     BEQ INPLOOPQ ;Yes.
4035 ;
4040     STA FILENAME+3,X ;Save chr.
4045     SEC 
4050     SBC #32
4055     STA LSAVE+22,X
4060     INX 
4065     JMP INPLOOPQ
4070 ;
4075 FINIQ
4080     LDA #0      ;End it.
4085     STA LSAVE+22,X
4090     RTS 
4095 ;
4100 ; Open S: device
4105 ;
4110 OPENS
4115     LDX #$20    ;Open it.
4120     LDA #3
4125     STA ICCOM,X
4130     LDA # <SH
4135     STA ICBAL,X
4140     LDA # >SH
4145     STA ICBAH,X
4150     LDA #8
4155     STA ICAX1,X
4160     LDA L5+19   ;Pick a mode,
4165     BNE EIGHT   ;any mode.
4170 ;
4175     LDA #7
4180     STA ICAX2,X
4185     JMP OPENIT
4190 ;
4195 EIGHT
4200     LDA #8
4205     STA ICAX2,X
4210 OPENIT
4215     JSR CIOV
4220     LDA L5+19
4225     BEQ LATERONDUDES
4230 ;
4235     LDA SDLSTL  ;Store DL addr.
4240     CLC 
4245     ADC #3
4250     STA LOHI
4255     LDA SDLSTL+1
4260     ADC #0
4265     STA LOHI+1
4270     LDY #0
4275 SRCHDL
4280     LDA (LOHI),Y ;Change GR.8
4285 ;                 to GR.7+
4290     CMP #$4F
4295     BNE NOMLD
4300 ;
4305     LDA #$4E
4310     STA (LOHI),Y
4315     LDA LOHI
4320     CLC 
4325     ADC #2
4330     STA LOHI
4335     LDA LOHI+1
4340     ADC #0
4345     STA LOHI+1
4350     JMP NXTDLB
4355 ;
4360 NOMLD
4365     CMP #$0F
4370     BNE NOREGL
4375 ;
4380     LDA #$0E
4385     STA (LOHI),Y
4390     BNE NXTDLB
4395 ;
4400 NOREGL
4405     CMP #$41
4410     BNE NXTDLB
4415 ;
4420     RTS 
4425 ;
4430 NXTDLB
4435     LDA LOHI
4440     CLC 
4445     ADC #1
4450     STA LOHI
4455     LDA LOHI+1
4460     STA POINTER+1
4465     STA LOHI+1
4470     JMP SRCHDL
4475 ;
4480 LATERONDUDES
4485     RTS 
4490 ;
4495 SH
4500     .BYTE "S:"  ;Screen handler.
4505 ;
4510 TRANSFER7
4515     LDA #0      ;Move screens.
4520     STA TEMP
4525     LDA 88
4530     STA LOHI
4535     LDA 89
4540     STA LOHI+1
4545     LDA # <SCRN2
4550     STA POINTER
4555     LDA # >SCRN2
4560     STA POINTER+1
4565 TR1
4570     LDY #0
4575 TR2
4580     LDA (LOHI),Y
4585     PHA 
4590     LDA (POINTER),Y
4595     STA (LOHI),Y
4600     PLA 
4605     STA (POINTER),Y
4610     INY 
4615     CPY #40
4620     BNE TR2
4625 ;
4630     INC TEMP
4635     LDA TEMP
4640 BTM
4645     CMP #96
4650     BEQ DONETRNS
4655     LDA LOHI
4660     CLC 
4665     ADC #40
4670     STA LOHI
4675     LDA LOHI+1
4680     ADC #0
4685     STA LOHI+1
4690     LDA POINTER
4695     CLC 
4700     ADC #40
4705     STA POINTER
4710     LDA POINTER+1
4715     ADC #0
4720     STA POINTER+1
4725     JMP TR1
4730 ;
4735 DONETRNS
4740     RTS 
4745 ;
4750 CLRBIGBUF
4755     LDA #0      ;Clear screens.
4760     STA TEMP
4765     LDA # <SCRN2
4770     STA LOHI
4775     LDA # >SCRN2
4780     STA LOHI+1
4785 CLRB1
4790     LDY #0
4795     TYA 
4800 CLRB2
4805     STA (LOHI),Y
4810     INY 
4815     CPY #40
4820     BNE CLRB2
4825 ;
4830     INC TEMP
4835     LDA TEMP
4840     CMP #192
4845     BEQ DONECLRING
4850 ;
4855     LDA LOHI
4860     CLC 
4865     ADC #40
4870     STA LOHI
4875     LDA LOHI+1
4880     ADC #0
4885     STA LOHI+1
4890     JMP CLRB1
4895 ;
4900 DONECLRING
4905     RTS 
4910 ;
4915 SETMD
4920     LDA L5+19   ;Offset borders.
4925     BNE PLUSG
4930 ;
4935     LDA #128
4940     STA MD+1
4945     LDA #-32
4950     STA MD2+1
4955     RTS 
4960 ;
4965 PLUSG
4970     LDA #176
4975     STA MD+1
4980     LDA #16
4985     STA MD2+1
4990     RTS 
4995 ;
5000 CLREST
5005     LDX $0358   ;Buffer pointer.
5010     LDA #32
5015 RESTLP
5020     STA BUFFER,X
5025     INX 
5030     BNE RESTLP
5035 ;
5040     RTS 
5045 ;
5050 CHECK4RTN
5055     CMP #155    ;ATASCII RETURN?
5060     BNE NEXT1
5065 ;
5070     JMP SRCHCONT
5075 ;
5080 NEXT1
5085     CMP #13     ;ASCII RETURN?
5090     BNE NEXT2
5095 ;
5100     JMP SRCHCONT
5105 ;
5110 NEXT2
5115     CMP #10     ;ASCII LF?
5120     BNE XIT1
5125 ;
5130     JMP SRCHCONT
5135 ;
5140 XIT1
5145     JMP BACKHR
5150 ;
5155 ERASECR
5160     LDA #0      ;Erase cursor.
5165     LDX TEMP
5170     STA ARL,X
5175     LDA CRL,X
5180     SEC 
5185     SBC #$80
5190     STA CRL,X
5195     RTS 
5200 ;
5205 CLRBUFF
5210     LDX #0
5215     TXA 
5220 CLROOP
5225     STA BUFFER,X
5230     INX 
5235     BNE CLROOP
5240 ;
5245     RTS 
5250 ;
5255 CLRCOLS
5260     LDX #0
5265     TXA 
5270 CLRCLOOP
5275     STA CHARCOLR,X
5280     INX 
5285     CPX #120
5290     BNE CLRCLOOP
5295 ;
5300     RTS 
5305 ;
5310 OPEN
5315     LDX #$10    ;Open disk file.
5320     LDA #3
5325     STA ICCOM,X
5330     LDA # <FILENAME
5335     STA ICBAL,X
5340     LDA # >FILENAME
5345     STA ICBAH,X
5350     LDA #4
5355     STA ICAX1,X
5360     LDA #0
5365     STA ICAX2,X
5370     JSR CIOV
5375     LDA $0353   ;Error?
5380     CMP #1
5385     BNE ERROR   ;Yes.
5390 ;
5395     RTS 
5400 ;
5405 CLOSE
5410     LDX #$10    ;Close it!
5415     LDA #$0C
5420     STA ICCOM,X
5425     JMP CIOV
5430 ;
5435 ERROR
5440     LDA # <ERR  ;ERROR!!!
5445     STA SDLSTL
5450     LDA # >ERR
5455     STA SDLSTL+1
5460     LDA $0353
5465     STA $D4
5470     LDA #0
5475     STA $D5
5480     JSR $D9AA   ;Convert ERR #
5485     JSR $D8E6   ;to screen mem.
5490     CLD 
5495     LDY #$FF
5500 PNUM
5505     INY 
5510     LDA ($F3),Y
5515     AND #$1F
5520     STA ERRLIN+10,Y
5525     LDA ($F3),Y
5530     BPL PNUM
5535 ;
5540     JSR RAZZ    ;Buzz.
5545     JSR CLOSE   ;Close.
5550     JSR GETKEY  ;Get a key.
5555 MNUJMP
5560     JMP ST1
5565 ;
5570 INPUT
5575     JSR CLEARFN ;Clear filename.
5580     LDX #0
5585 INPLOOP
5590     STX TEMP
5595     LDA #$80
5600     LDX TEMP
5605     STA L2+16,X
5610     JSR GETKEY  ;This
5615     LDX TEMP    ;input
5620     LDA KEY     ;loop
5625     CMP #126    ;is
5630     BNE NOTBKSP ;identical
5635 ;                to
5640     CPX #0      ;the
5645     BEQ INPLOOP ;other
5650 ;                input
5655     LDA #0      ;loop.
5660     STA L2+16,X
5665     LDA #32
5670     STA FILENAME+3,X
5675     DEX 
5680     JMP INPLOOP
5685 ;
5690 NOTBKSP
5695     CMP #155
5700     BEQ FINI
5705 ;
5710     CPX #12
5715     BEQ INPLOOP
5720 ;
5725     STA FILENAME+3,X
5730     SEC 
5735     SBC #32
5740     STA L2+16,X
5745     INX 
5750     JMP INPLOOP
5755 ;
5760 FINI
5765     LDA #0
5770     STA L2+16,X
5775     RTS 
5780 ;
5785 CLEARFN
5790     LDX #0      ;Clear
5795 LOOPCLR
5800     LDA #32     ;filename.
5805     STA FILENAME+3,X
5810     LDA #0
5815     STA L2+16,X
5820     STA LSAVE+22,X
5825     INX 
5830     CPX #13
5835     BNE LOOPCLR
5840 ;
5845     RTS 
5850 ;
5855 RAZZ
5860     LDY #$20    ;Razz routine.
5865 RAZZ1
5870     LDX #$7F    ;Same as CTRL-2
5875 RAZZ2
5880     STX 53279
5885     STX WSYNC
5890     DEX 
5895     BPL RAZZ2
5900 ;
5905     DEY 
5910     BPL RAZZ1
5915 ;
5920     RTS 
5925 ;
5930 TEMP
5935     .BYTE 0,0,0 ;Temp. Vars.
5940 ;
5945 PLOT
5950     STA COLOR   ;Plot routines.
5955     STX XSTOR
5960     STY YSTOR
5965     LDA YSTOR
5970     ASL A
5975     STA POINTER
5980     LDA #0
5985     ROL A
5990     STA POINTER+1
5995     JMP CONT
6000 ;
6005 COLOR
6010     .BYTE 0     ;Color hold
6015 XSTOR
6020     .BYTE 0     ;storage...
6025 ;
6030 GETKEY
6035     LDX #$30    ;Get a key
6040     LDA #7      ;routine.
6045     STA ICCOM,X
6050     LDA # <KEY
6055     STA ICBAL,X
6060     LDA # >KEY
6065     STA ICBAH,X
6070     LDA #1
6075     STA ICBLL,X
6080     LDA #0
6085     STA ICBLH,X
6090     JMP CIOV
6095 ;
6100 KEY
6105     .BYTE 0     ;Key value.
6110 ;
6115 CONT
6120     ASL POINTER ; The plot
6125     ROL POINTER+1 ;routine.
6130     ASL POINTER ;(Kinda complex)
6135     LDA POINTER
6140     STA STOR1
6145     ROL POINTER+1
6150     LDA POINTER+1
6155     STA STOR2
6160     ASL POINTER
6165     ROL POINTER+1
6170     ASL POINTER
6175     ROL POINTER+1
6180     LDA POINTER
6185     CLC 
6190     ADC STOR1
6195     STA POINTER
6200     LDA POINTER+1
6205     ADC STOR2
6210     STA POINTER+1
6215     LDA 88
6220     CLC 
6225     ADC POINTER
6230     STA POINTER
6235     LDA 89
6240     ADC POINTER+1
6245     STA POINTER+1
6250     LDA XSTOR
6255     AND #3
6260     TAX 
6265     LDA XSTOR
6270     LSR A
6275     LSR A
6280     CLC 
6285     ADC POINTER
6290     STA POINTER
6295     LDA POINTER+1
6300     ADC #0
6305     STA POINTER+1
6310     LDY COLOR
6315     LDA BMASK2,X
6320     AND COLORS,Y
6325     STA STOR1
6330     LDA BMASK1,X
6335     LDY #0
6340     AND (POINTER),Y
6345     ORA STOR1
6350     STA (POINTER),Y
6355     RTS 
6360 ;
6365 ; Various stuff.
6370 ;
6375 COLORS
6380     .BYTE $00,$55,$AA,$FF ;plot
6385 ;                         colors
6390 BMASK1
6395     .BYTE $3F,$CF,$F3,$FC ;Masks
6400 ;                          for
6405 BMASK2
6410     .BYTE $C0,$30,$0C,$03 ;plot
6415 ;                      routines.
6420 YSTOR
6425     .BYTE 0     ;Storage
6430 STOR1
6435     .BYTE 0     ;for
6440 STOR2
6445     .BYTE 1     ;plot routine
6450 KH
6455     .BYTE "K:"  ;Keybd handler.
6460 COLS
6465     .SBYTE "80  132 " ;Columns.
6470 COL
6475     .BYTE 0     ;Col. toggle.
6480 ARWS
6485     .SBYTE "" ;Our arrows
6490 POS
6495     .BYTE 0     ;Position code.
6500 FILENAME
6505     .BYTE "D1:               "
6510 ;    Filename buffer
6515 CHARCOLR
6520     *=  *+120   ;Where we place
6525 ;       our edited gray shades.
6530 BUFFER
6535     *=  *+256   ;Load-in buffer
6540 COLAMT
6545     .BYTE 40,14 ;Col. amounts.
6550 ;DEFAULTS are our default
6555 ;gray shades.
6560 DEFAULTS
6565     .BYTE 0,2,1,3,2,2,3,1,2,2
6570     .BYTE 3,2,1,1,1,1,3,3,3,3
6575     .BYTE 3,3,3,3,3,2,2,2,2,2,2
6580     .BYTE 3,3,3,3,3,3,3,3,3,3
6585     .BYTE 3,3,3,3,3,3,3,3,3,3
6590     .BYTE 3,3,3,3,3,3,3,2,2,2
6595     .BYTE 1,1
6600 ;
6605 LOP
6610     INC TEMP
6615     LDA TEMP
6620     CMP #32
6625     BEQ DONELDING
6630 ;
6635     JMP SRCHCONT
6640 ;
6645 DONELDING
6650     JMP EOF
6655 ;
6660 ; Our display lists/data.
6665 ;
6670 DLIST1
6675     .BYTE $70,$70,$70,$70,$70
6680     .BYTE $70,$F0,$47
6685     .BYTE  <LINES, >LINES
6690     .BYTE $90,$02,$70,$02,$00
6695     .BYTE $02,$00,$02,$00,$02
6700     .BYTE $00,$02,$00,$02
6705     .BYTE $41, <DLIST1, >DLIST1
6710 SELECT
6715     .BYTE $70,$70,$70,$70,$47
6720     .BYTE  <SLCTLINE, >SLCTLINE
6725     .BYTE $07,$41
6730     .BYTE  <SELECT, >SELECT
6735 SLCTLINE
6740     .SBYTE "�SE DEFAULTS OR "
6745     .SBYTE "�DIT YOUR OWN?  "
6750 LINES
6755     .SBYTE +$C0," ART CONVERTER! "
6760     .SBYTE " (c)1987, Antic Publishing Inc. "
6765 L1
6770     .SBYTE "   �olumn of printout: 80       "
6775 L2
6780     .SBYTE "   �oad file D1:                "
6785     .SBYTE "   �efault drive number         "
6790 L4
6795     .SBYTE "   �icture postioning:         "
6800 L5
6805     .SBYTE "   �raphics mode: 7             "
6810     .SBYTE "   ���� starts the conversion  "
6815 ;
6820 ;* Our DLI's.
6825 ;
6830 DLI
6835     PHA 
6840     TXA 
6845     PHA 
6850     LDX #$90
6855 LLL
6860     STX WSYNC
6865     STX $D019
6870     INX 
6875     CPX #$A0
6880     BNE LLL
6885 ;
6890     LDA # <DLI1
6895     STA VDSLST
6900     LDA # >DLI1
6905     STA VDSLST+1
6910     PLA 
6915     TAX 
6920     PLA 
6925     RTI 
6930 ;
6935 DLI1
6940     PHA 
6945     TXA 
6950     PHA 
6955     LDX #0
6960     LDY #$0E
6965 LLL1
6970     STX WSYNC
6975     LDA #$4A
6980     STA $D018
6985     LDA #0
6990     STA $D017
6995     INX 
7000     CPX #9
7005     BNE LLL1
7010 ;
7015     LDA #$C4
7020     STA $D018
7025     LDA #10
7030     STA $D017
7035     LDA # <DLI
7040     STA VDSLST
7045     LDA # >DLI
7050     STA VDSLST+1
7055     PLA 
7060     TAX 
7065     PLA 
7070     RTI 
7075 ;
7080 ; More display lists.
7085 ;
7090 DLIST3
7095     .BYTE $70,$70,$70,$70,$47
7100     .BYTE  <LINES2, >LINES2
7105     .BYTE $07,$70,$70,$70,$70
7110     .BYTE $70,$02,$00,$02,$00
7115     .BYTE $02,$70,$70,$70,$70
7120     .BYTE $70,$06,$00,$06
7125     .BYTE $41, <DLIST3, >DLIST3
7130 LINES2
7135     .SBYTE +$80," NOW SEARCHING  "
7140     .SBYTE +$80,"FILE FOR BYTES.."
7145 DISPLINE
7150     .SBYTE "                                "
7155 ARL
7160     .SBYTE "                                "
7165 CRL
7170     .SBYTE "                                "
7175     .SBYTE +$C0,"  ENTER DATA:   "
7180     .SBYTE +$C0,"0=WHITE, 3=BLACK"
7185 XX
7190     .BYTE 1     ;Our screen X
7195 YY
7200     .BYTE 1     ;and Y values.
7205 P256
7210     .BYTE 1     ;Pointer...
7215 ;
7220 ; Yet another display list.
7225 ;
7230 DLIST0
7235     .BYTE $70,$70,$70,$70,$70
7240     .BYTE $70,$70,$47
7245     .BYTE  <LINESF, >LINESF,$30
7250     .BYTE $70,$02,$00,$02,$00
7255     .BYTE $02,$00,$02,$00,$02
7260     .BYTE $20,$02
7265     .BYTE $41, <DLIST0, >DLIST0
7270 LINESF
7275     .SBYTE +$80,"  CHOOSE AN OPTION: " 12345678901234567890
7280     .SBYTE "         � Save screen - mode 7         "
7285     .SBYTE "         � Save screen - mode 7+        "
7290     .SBYTE "         � Enter save filename          "
7295     .SBYTE "         � Restart program              "
7300     .SBYTE " ��٠��� toggles screens, ���� for scrn"
7305 LSAVE
7310     .SBYTE "     Save filename D1:                  "
7315 ;
7320 ; Our screen boundaries for all
7325 ; positioning modes.
7330 ;
7335 ENDZ
7340     .BYTE 96,160,96,160
7345 ENDZZ
7350     .BYTE 192,160,192,160
7355 SCRN2 = $4000   ;Buffer screen.
7360 ;
7365 ; Guess what. A display list
7370 ; to handle errors.
7375 ;
7380 ERR
7385     .BYTE $70,$70,$70,$70,$70
7390     .BYTE $70,$70,$70,$70,$70
7395     .BYTE $47, <ERRLIN, >ERRLIN
7400     .BYTE $41, <ERR, >ERR
7405 ERRLIN
7410     .SBYTE "  ERROR -                     "
7415 ;
7420 ;* Where we start from.
7425     *=  $02E0   ;Init addr.
7430 ;
7435     .WORD START
7440     .END 

Back to previous page