8-Bit Software Online Conversion
:0.S.3to7 - Listing
10REM "3to7" 80 column to 40
20REM V1.30
30REM Modified JGH 20-Jun-1996
40REM Improved RPS 29-Mar-1997
50REM Modified JGH 18-Jun-1998
60IFINKEY(0)=0:INPUT""A$:$&A00=A$
70A$=$&600:I%=INSTR(A$," "):IFI%:A$=M
ID$(A$,I%+1):$&A00=A$
80*FX229
90*FX4,2
100*KEY15 B
110*KEY14 F
120MODE7:VDU23;8202;0;0;0;
130HIMEM=&2FFF
140DIMscr%(20),code 350,string 80
150PROCassemble:F%=0
160ONERROROSCLI"FX4,0":CLOSE#0:IFERR=1
7 THENOSCLI"Exec $.!BOOT":END ELSEMODE7:
REPORT:PRINT:END
170A$=$&A00:IFA$="" ORLENA$>80 ORASCA$
<32 ORASCA$>126:PROCfile ELSE $&A00=""
180PROCheader("Add colour to text ? (Y
/N)")
190?&74=(INSTR("Yy",GET$)>0)AND1
200?&72=130 AND(?&74>0)
210F%=OPENIN A$:IFF%=0:PROCheader(A$+"
not found"):key%=INKEY(150):PROCfile:GO
TO180
220B%=&900:times%=0:back%=0:new%=0
230?&76=?&74:?&71=0
240:
250REPEAT
260IF NOTEOF#F%:new%=1:PROCld
270G%=&3000
280REPEAT:CLS:?&73=0
290REPEAT:CALLcode
300PRINT'CHR$(?&72)$string;
310UNTIL?&73>22 OR G%>=T%
320depth%=(&4000*(times%-1)+G%-&3000)/
(EXT#F%/100)
330PROCheader(RIGHT$(" "+STR$depth%,2)
+"%"+" Arrow keys : up & down Esc : end"
)
340*FX21
350REPEATG$=GET$:UNTILINSTR("BbFb:*/?"
,G$)
360IFINSTR("Bb*:",G$) ANDG%>&3000:PROC
jumpback
370IFINSTR("Ff?/",G$):PROCjumpforward
380UNTILG%>=T%:UNTILFALSE
390END
400:
410DEFPROCld
420IFback%:times%=times%-1:PTR#F%=scr%
(times%)
430IFnew%:times%=times%+1:scr%(times%)
=PTR#F%
440H%=EXT#F%-PTR#F%:IFH%>&3FFF:H%=&400
0
450PROCheader("Loading file...")
460A%=4:X%=B% MOD256:Y%=B% DIV256
470?B%=F%:B%!1=&3000:B%!5=H%
480CALL&FFD1
490D%=0:back%=0:new%=0:T%=&3000+H%+D%
500IFPTR#F%=EXT#F% THENENDPROC
510S%=&6FFF
520REPEAT:D%=D%+1:S%=S%+1:R%=BGET#F%:?
S%=R%:UNTILR%=13 ORR%=10 OREOF#F%
530S%?1=&FF:T%=&3000+H%+D%
540ENDPROC
550:
560DEFPROCfile:REPEAT:CLS
570PRINTTAB(0,2);" 8-Bit Software 80 t
o 40 Column"'" Text Conversion. By C.J.R
ichardson."'" Please enter filename to c
onvert, or"'" '*' to goto the command li
ne."'
580*.
590A$="":*FX138,0,13
600REPEAT
610key%=GET:IF(key%<8 ORkey%>127)ANDke
y%<>13 THENGOTO610
620IFkey%=ASC"*" THENkey%=0:VDU&16,7:R
EPEAT:PRINT"*";:INPUT""A$:OSCLIA$:UNTILL
EN(A$)=0
630IF(key%=127 ORkey%=8)ANDLEN(A$)=0 T
HENVDU7
640IF(key%=127 ORkey%=8)ANDLEN(A$)>=1
THENA$=LEFT$(A$,LEN(A$)-1)
650IFLEN(A$)=21 THENVDU7:GOTO680
660IFkey%>32 ANDkey%<127 THENA$=A$+CHR
$(key%)
670PROCheader("Enter filename: "+A$)
680UNTILkey%=13 ANDLEN(A$)>0
690ENDPROC
700:
710DEFPROCjumpback
720IFG%<=&3600 AND times%=1:G%=&3000:E
NDPROC
730IFG%>&3600:G%=G%-&500:REPEAT:G%=G%-
1:UNTIL ?G%=13 OR G%=&3000:ENDPROC
740back%=1
750PROCld:G%=&6A00:REPEAT:G%=G%-1:UNTI
L ?G%=13
760ENDPROC
770:
780DEFPROCjumpforward
790IFG%>(T%-&380):ENDPROC
800REPEAT:G%=G%-1:UNTIL?G%=13
810G%=G%+1:ENDPROC
820:
830DEFPROCheader(line$)
840PRINTTAB(0,0);CHR$157;CHR$132;LEFT$
(line$,37);STRING$(37-LEN(line$)," ")
850ENDPROC
860:
870DEFPROCassemble
880strpos=string
890FOR I%=0TO2STEP2
900P%=code
910[OPTI%
920JSR clear
930.loop
940JSR get
950LDX &74:BEQ a1
960LDA &404:CMP #13:BNE a1
970LDX &75:BEQ a1
980JSR chcol:JMP a2
990.a1
1000LDX #0:STX &75
1010LDA &404:CMP #13:BNE a2
1020LDX #1:STX &75
1030.a2
1040LDA &404:CMP #13:BEQ a3
1050CMP #126:BCS a3
1060CMP #29:BEQ high
1070CMP #32:BCC a3
1080JSR atob:JMP a3
1090.high
1100LDA &71:BMI a3:½ View type
1110ASL A:BMI skip:½ Extended
1120½ Not yet set:
1130LDY #1:LDA (&80),Y:PHA:INY
1140.highLP
1150LDA (&80),Y:CMP #29:BEQ high2
1160INY:BPL highLP:STY &71:BMI a3
1170.high2
1180INY:LDA (&80),Y:AND #&DF:STA &70
1190LDA #&80:STA &71
1200PLA:AND #&DF:CMP &70:BNE a3
1210LSR &71
1220.skip
1230JSR g0:½ Skip
1240.a3
1250LDA &404:CMP #13:BEQ a5
1260LDX &76:CPX #40:BEQ a5
1270LDX &41D:CPX &451:BCC a4
1280LDX &41C:CPX &450:BCS a5
1290.a4
1300JMP loop
1310.a5
1320LDX &76:CPX #40:BNE a6
1330JSR back:JMP a7
1340.a6
1350LDA &404:CMP #13:BNE a8
1360.a7
1370LDX &74:STX &76:INC &73
1380.a8
1390RTS
1400½ ******* subroutines ********
1410.clear
1420LDX #0:STX &77
1430LDA #13:STA string,X:RTS
1440.get
1450LDX &41C:STX &80
1460LDX &41D:STX &81
1470LDY #0:LDA (&80),Y:STA &404
1480.g0
1490INC &41C:BNE g1:INC &41D
1500.g1
1510RTS
1520.atob
1530INC &76
1540LDX &77:LDA &404:STA string,X
1550INX:STX &77:LDA #13:STA string,X
1560RTS
1570.chcol
1580INC &72:LDX &72
1590CPX #132:BNE c1
1600LDY #133:STY &72
1610.c1
1620CPX #135:BNE c2
1630LDY #130:STY &72
1640.c2
1650RTS
1660.back
1670LDX &41C:STX &82:LDX &41D:STX &83
1680LDX &77:STX &84
1690.bloop
1700LDY #2
1710.b0
1720LDX &41C:BNE b1:DEC &41D
1730.b1
1740DEC &41C:DEY:BNE b0
1750JSR get
1760DEC &77
1770LDA &404:CMP #32:BEQ b2
1780LDX &77:CPX#1:BNE bloop
1790LDX &84:STX &77
1800LDA #127:STA string,X
1810INX:LDA #13:STA string,X
1820LDX &82:STX &41C
1830LDX &83:STX &41D
1840RTS
1850.b2
1860LDX &77:LDA #13:STA string,X
1870.b3
1880RTS
1890]
1900NEXT:ENDPROC