8-Bit Software Online Conversion
Mode 7 display program - Listing
10DEFFNS="MO7DIS"
20MODE128+7:LOMEM=&6000
30ONERROR:VDU3:CLS:REPORT:PRINTERL:PR
INT"PRESS A KEY":REPEATUNTILGET
40req$="OFF":REPEAT:CLS:PRINT" MODE 7
TEXT DISPLAY By C.Richardson."
50PRINT''" 1. Convert text file to di
splay file"
60PRINT" 2. Print a display file"
70PRINT" 3. Convert a display file to
ASCII"
80PRINT" 4. Toggle EDIT converter, no
w "req$
90REPEATa$=GET$:UNTILINSTR("1234",a$)
100IFa$="1"PROCz
110IFa$="2"PROCp
120IFa$="3"PROCd
130IFa$="4"IF req$="OFF" req$="ON ":PR
INTTAB(30,3)req$:a$=""
140IFa$="4"IF req$="ON "req$="OFF":PRI
NTTAB(30,3)req$
150UNTILFALSE
160DEFPROCz
170*EX
180PRINT" PAGE is &";÷PAGE':PRINT" Fin
al code to load at? &";:R%=FNh
190IFR%<TOP IF R%>(PAGE-&200)PRINT" R
ELOAD PROGRAM!":END
200REPEAT:PRINT" Length of text file?
Min &3E8 &";:B%=FNh:UNTILB%>&3E7:B%=B%-&
3C0
210B%=B%-1:REPEAT:B%=B%+1:UNTILB%MOD40
=0
220PROCa
230U%=P%MOD256:S%=P%DIV256:G%=B%MOD256
:E%=B%DIV256
240s$=STR$÷R%:PRINT" Saving ";s$'" Pr
ess a key":REPEATUNTILGET
250?R%=U%:?(R%+1)=S%
260E%=E%+S%+(G%+U%)DIV256:G%=(G%+U%)MO
D256
270?(R%+2)=G%:?(R%+3)=E%
280OSCLI"SA. "+s$+" "+STR$÷R%+" "+STR$
÷P%+" "+STR$÷b%
290PROCc
300ENDPROC
310DEFPROCa
320FORl%=0TO2STEP2
330P%=R%
340[:OPT l%:.h%:NOP:.i%:NOP:.j%:NOP:.k
%:NOP
350.e%:STX&70:STY&71:LDA#&13:JSR&FFF4:
LDX#&4:LDA#&7C:STA&73:LDA#&0:STA&72
360.g%:LDY#&0:.f%:LDA(&70),Y:]:IF req$
="ON ":[:OPT l%:JSRq%:] ELSE [:OPT l%:NO
P:NOP:NOP:]
370[:OPT l%:STA(&72),Y:INY:BNEf%:INC&7
3:INC&71:DEX:BNEg%:RTS
380.b%:LDA#&0E:LDX#1:JSR&FFF4
390LDA#&0F:LDX#0:JSR&FFF4:LDA#&0C:LDX#
1:JSR&FFF4
400LDA h%:STA&80:LDA i%:STA&81:LDA#&16
:JSR&FFEE:LDA#7:JSR&FFEE
410LDX&80:LDY&81:JSRe%
420.r%:LDY#&FF:LDX#&C6:LDA#&81:JSR&FFF
4:CPY#&FF:BEQm%:LDY#&FF:LDX#&D6:LDA#&81:
JSR&FFF4
430CPY#&FF:BEQn%:JMPr%
440.m%:LDA&81:CMPi%:BNEp%:LDA&80:CMPh%
:BNEp%:JMPr%
450.p%:LDA&80:SEC:SBC#&28:STA&80:LDA&8
1:SBC#&0:STA&81
460.s%:LDX&80:LDY&81:JSRe%:JMPr%
470.n%:LDA&80:CLC:ADC#&28:STA&80:LDA&8
1:ADC#&0:STA&81:CMPk%:BCCs%:LDA&80:CMPj%
:BCCs%
480LDAj%:STA&80:LDAk%:STA&81:JMPr%
490.q%:PHA:SBC#&1B:BMIt%:PLA:RTS
500.t%:PLA:CMP#&A:BNEz%:LDA#&8D:.z%:CM
P#&B:BNEy%:LDA#&99:.y%:CMP#&E:BNEx%:LDA#
&9A
510.x%:CMP#&F:BNEw%:LDA#&9D:.w%:CMP#&1
0:BNEv%:LDA#&9E:.v%:CMP#&19:BNEu%:LDA#&9
F:.u%:CMP#26:BNEo%:LDA#156:.o%:RTS
520]:NEXT
530ENDPROC
540DEFFNh:INPUT""a$
550a$="000"+a$:a$=RIGHT$(a$,4):A%=0:FO
RL%=1TO4:T%=ASC(MID$(a$,L%)):IFT%>57 T%=
T%-55 ELSE T%=T%-48
560A%=A%*16+T%:NEXT:=A%
570DEFPROCc:CLS:*EX
580C%=(E%*256)+G%+&3C0
590INPUT" Text file name to load ";l$:
INPUT" *RUN file name to save ";r$
600OSCLI"K.0*LO."+s$+"|M*LO."+l$+" "+S
TR$÷P%+"|M*SA."+r$+" "+STR$÷R%+" "+STR$÷
C%+" "+STR$÷b%+"|M*/"+r$+"|M"
610OSCLI"FX 138 0 128":END
620ENDPROC
630DEFPROCp:CLS:*.
640PRINT" Print out a mode 7 display f
ile"':INPUT" Print out which file? "f$
650F%=OPENIN f$:PTR#F%=&F9:VDU2,1,27,1
,108,1,20,1,27,1,81,1,60:REPEAT:a%=BGET#
F%:IFa%>126 OR a%<32 a%=32
660VDUa%:UNTILEOF#F%:CLOSE#F%:VDU3:END
PROC
670DEFPROCd:CLS:*.
680PRINT" Convert mode 7 display file
to ASCII"
690INPUT" Convert which file? "f$:F%=O
PENIN f$:PTR#F%=&F9
700INPUT" Name for new file? "n$:f2%=O
PENOUT n$:REPEAT:A%=BGET#F%:IFA%>126 OR
A%<32 A%=32
710BPUT#f2%,A%:UNTILEOF#F%:CLOSE#F%:CL
OSE#f2%:ENDPROC