8-Bit Software Online Conversion
Diary 1997. K6N - Listing
10*TV255
20*FX18
30*FX21
40*KEY10"OLD|MPROCfinish|M"
50*FX4,1
60*FX229,1
70*FX225,200
80*FX226,210
90*FX227,220
100MODE7
120DIM dd%(12,2)
130RESTORE
140FOR N%=0TO12:READdd%(N%,1),dd%(N%,2
):NEXT
150days$="MONDAY TUESDAY WEDNESDAYT
HURSDAY FRIDAY SATURDAY SUNDAY "
160months$="JANUARY FEBRUARY MARCH
APRIL MAY JUNE JULY AUG
UST SEPTEMBEROCTOBER NOVEMBER DECEMBE
R "
180epson%=0
182sysclk%=0
184L%=1:P%=1
185PROCckdisc
186ONERROR:GOTO194
190F%=OPENIN":0.$.DIDATA":INPUT#F%,L%,
P%,epson%,sysclk%:CLOSE#F%
194ONERROR:VDU7
196VDU23;10,&60;0;0;0
200PROCstart
210PROCinit
220:
230REPEAT
240REPEAT
250H%=0
260PROCnewpage(L%,P%)
270$W%=MID$(months$,P%*9-8,3)
280PROCload
290PROCgettop
300VDU30,157,129
310PRINT"<H>elp <I>ndex <P>rint <['> <
Esc> [ ] "
320REPEAT
330Q%=GET
340UNTILINSTR("HIPhip",CHR$(Q%))ORQ%=1
3ORQ%=27ORQ%>135
350IFQ%>127:T%=0
360IFQ%=72ORQ%=104:PROChelp1
370IFQ%=73ORQ%=105:PROCindex
380IFQ%=80ORQ%=112:PROCvprint
390IFQ%=27:run
400IFQ%=136:L%=L%-1
410IFQ%=137:L%=L%+1
420IFQ%=138:P%=P%-1
430IFQ%=139:P%=P%+1:IFP%>12:P%=1:L%=1
440IFL%<1:P%=P%-1:L%=dd%(P%,2)
450IFL%>dd%(P%,2):L%=1:P%=P%+1
460IFP%<1:P%=12:L%=dd%(P%,2)
470IFP%>12:P%=1:L%=1
480UNTILQ%=13 AND H%=0
490VDU30:PRINT$&A00:PRINTTAB(2,2);
500E%=E%EOR1:VDU23,1,E%;0;0;0;
510REPEAT
520a%=GET:A%=a%
530IFA%<>27:PROCkeys
540UNTILA%=27
550PROCsave
560E%=E%EOR1:VDU23,1,E%;0;0;0;
570UNTILFALSE
580:
590DEFPROCgettop
600$&A00=""
610FORI%=0TO39
620$&A00=$&A00+CHR$(?(&7C00+I%))
630NEXT
640ENDPROC
650:
660DEFPROCvprint
670VDU30:PRINT$&A00:VDU30,9,9
680PROCprint
690ENDPROC
700:
710DEFPROCkeys
720IFA%=16:PROCprint:ENDPROC
730IFA%=3:PROCnewpage(L%,P%):PROCgetto
p:ENDPROC
740IFA%=13ANDVPOS=24:VDU7:ENDPROC
750IFA%=13:VDU10,13,8:PROCright:ENDPRO
C
760IFINSTR("QWASZXqwaszx",CHR$(a%))<>0
ANDt%:PROCpixel:ENDPROC
770IFA%=136:PROCleft:ENDPROC
780IFA%=137:PROCright:ENDPROC
790IFA%=138:PROCdown:ENDPROC
800IFA%=139:PROCup:ENDPROC
810IFa%>=200ANDa%<=229:PROCfkeys
820IFA%=127:PROCdelete:ENDPROC
830IFA%=226:PROCinspc:ENDPROC
840IFA%=227:PROCinsline:ENDPROC
850IFA%=228:PROCdelline:ENDPROC
860IFA%=209ORA%=219ORA%=229:PROCptog:E
NDPROC
870IFE%=0:VDU7:ENDPROC
880IFVPOS=24ANDPOS=39ANDt%=0:?(&7C27+4
0*24)=A%:VDU7:ENDPROC
890IFt%=0:VDUA%,8:PROCright
900ENDPROC
910:
920DEFPROCfkeys
930IFa%>=200ANDa%<=208:A%=a%-71
940IFa%>=210ANDa%<=216:A%=a%-65
950IFa%>=217ANDa%<=218:A%=a%-61
960IFa%>=220ANDa%<=221:A%=a%-67
970IFa%>=222ANDa%<=223:A%=a%-64
980IFa%>=224ANDa%<=225:A%=365-a%
990ENDPROC
1000:
1010DEFPROCpixel
1020LOCALW%
1030W%=2^((INSTR("QWASZ X",CHR$(A%AND22
3)))-1)
1040K%=&7C00+40*VPOS+POS
1050IF(?K%AND160)<>160:?K%=?K%OR160
1060IF?(K%ANDW%)=W%:?K%=?K%AND(255-W%)E
LSE?K%=?K%EORW%
1070ENDPROC
1080:
1090DEFPROCptog
1100t%=t%EOR1
1110IFt%:VDU23;10,&70;0;0;0 ELSE VDU23;
10,&60;0;0;0
1120ENDPROC
1130:
1140DEFPROCleft
1150IFPOS>2:VDU8:ENDPROC
1160IFVPOS>2:VDU31,39,VPOS-1ELSEVDU7
1170ENDPROC
1180:
1190DEFPROCright
1200IFPOS<39:VDU9:ENDPROC
1210IFVPOS<24:VDU9,9,9ELSEVDU7
1220ENDPROC
1230:
1240DEFPROCdown
1250IFVPOS<24:VDU10ELSEVDU7
1260ENDPROC
1270:
1280DEFPROCup
1290IFVPOS>2:VDU11ELSEVDU7
1300ENDPROC
1310:
1320DEFPROCdelete
1330IFPOS=2ANDVPOS=2:VDU7:ENDPROC
1340org%=&7C00+40*VPOS
1350IFPOS=2:PROCleft ELSE FORI%=POS TO
39:?(org%+I%-1)=?(org%+I%):NEXT:VDU8
1360?(&7C27+VPOS*40)=32
1370ENDPROC
1380:
1390DEFPROCinspc
1400dest%=&7C27+40*VPOS
1410org%=&7C00+40*VPOS+POS
1420diff%=dest%-org%
1430FORI%=0TOdiff%
1440?(dest%-I%)=?(dest%-I%-1)
1450NEXT
1460?org%=32
1470ENDPROC
1480:
1490DEFPROCinsline
1500LOCALP%
1510org%=&70:dest%=&74:end%=&78:stop%=&
7C
1520!org%=&7C27+40*23
1530!dest%=&7C27+40*24
1540!end%=&7C02+40*VPOS
1550!stop%=&7C27+40*VPOS
1560FORI%=0TO2STEP2
1570P%=&980
1580[OPTI%
1590LDY#0
1600.loop
1610LDA(org%),Y:STA(dest%),Y
1620LDAorg%::BNEd1
1630DECorg%+1
1640.d1
1650DECorg%
1660LDAdest%:BNEd2
1670DECdest%+1
1680.d2
1690DECdest%
1700LDAorg%+1:CMPend%+1:BNEloop
1710LDAorg%:CMPend%:BCSloop
1720RTS
1730]NEXT
1740CALL&980
1750REPEAT
1760?!end%=32
1770!end%=!end%+1
1780UNTIL!end%=!stop%+1
1790ENDPROC
1800:
1810DEFPROCdelline
1820LOCALP%
1830org%=&70:dest%=&74:end%=&78:stop%=&
7C
1840!org%=&7C02+40*(VPOS+1)
1850!dest%=&7C02+40*VPOS
1860!end%=&7C27+40*24
1870!stop%=&7C02+40*24
1880FORI%=0TO2STEP2
1890P%=&980
1900[OPTI%
1910LDY#0
1920.loop
1930LDA(org%),Y:STA(dest%),Y
1940INCorg%::BNEd1:INCorg%+1
1950.d1
1960INCdest%:BNEd2:INCdest%+1
1970.d2
1980LDAend%+1:CMPorg%+1:BNEloop
1990LDAend%:CMPorg%:BCSloop
2000RTS
2010]NEXT
2020CALL&980
2030REPEAT
2040?!end%=32
2050!end%=!end%-1
2060UNTIL!end%=!stop%-1
2070ENDPROC
2080:
2090DEFPROCprint
2100O%=&7C00:o%=0:graphic%=0:sep%=0
2110VDU2
2120IFepson%:VDU1,27,1,48
2130FORl%=1TO25
2140FORc%=1TO40
2150d%=?(O%+o%)
2160IFd%<32:d%=32
2170IFepson%=0 AND (d%<32ORd%>126):d%=3
2
2180IFd%>127ANDepson%:PROCeprint
2190IFd%=91ANDepson%:d%=0:VDU1,27,1,75,
1,8,1,0,1,0,1,&10,1,&38,1,&54,1,&10,1,&1
0,1,&10,1,&10
2200IFd%=93ANDepson%:d%=0:VDU1,27,1,75,
1,8,1,0,1,0,1,&10,1,&10,1,&10,1,&10,1,&5
4,1,&38,1,&10
2210VDU1,d%
2220o%=o%+1
2230NEXT
2240REM IFepson%:VDU1,10
2250VDU1,13:graphic%=0:sep%=0
2260NEXT
2270IFepson%:VDU1,27,1,50
2280VDU1,13,3
2290ENDPROC
2300:
2310DEFPROCeprint
2320IFd%=&80:d%=32:ENDPROC
2330IFd%>&80 AND d%<&88:graphic%=0:d%=3
2:ENDPROC
2340IFd%>&87 AND d%<&91:d%=32:ENDPROC
2350IFd%>&90 AND d%<&98:graphic%=1:d%=3
2:ENDPROC
2360IFd%=&99:sep%=0
2370IFd%=&9A:sep%=1
2380IFd%>&97 AND d%<&A0:d%=32:ENDPROC
2390IFd%>&BF AND d%<&E0:d%=32:ENDPROC
2400IFgraphic%=0:d%=32:ENDPROC
2410PROCpixprint:d%=0
2420ENDPROC
2430:
2440DEFPROCpixprint
2450REM******* FOR EPSON PRINTER ******
2460flag%=0
2470FORn%=0TO6
2480flag%=flag%+(d%AND2^n%)
2490NEXT
2500:
2510VDU1,27,1,ASC"^",1,0,1,6,1,0
2520pr%=0
2530IFflag%AND1:pr%=pr%+&E0-(sep%*&20)
2540IFflag%AND4:pr%=pr%+&1C-(sep%*&04)
2550IFflag%AND16:pr%=pr%+&8003-(sep%*&8
000)
2560IFsep%:VDU1,0,1,0
2570FORn%=sep%TO2
2580VDU1,pr%AND&FF
2590VDU1,(pr%AND&FF00)DIV&100
2600NEXT
2610pr%=0
2620IFflag%AND2:pr%=pr%+&E0-(sep%*&20)
2630IFflag%AND8:pr%=pr%+&1C-(sep%*&04)
2640IFflag%AND64:pr%=pr%+&8003-(sep%*&8
000)
2650IFsep%:VDU1,0,1,0
2660FORn%=sep%TO2
2670VDU1,pr%AND&FF
2680VDU1,(pr%AND&FF00)DIV&100
2690NEXT
2700ENDPROC
2710:
2720DEFPROCnewpage(d%,m%)
2730VDU30
2740FORD%=1TO24
2750PRINTCHR$(157)CHR$(132)STRING$(38,"
");
2760NEXT
2770PRINTCHR$(157)CHR$(132)STRING$(37,"
");
2780?(&7C27+40*24)=32
2790PRINTTAB(0,1);
2800day%=(dd%(m%,1)+d%-1)MOD7:IFday%=0
day%=7
2810PRINTCHR$(157)CHR$(133)" "MID$(da
ys$,day%*9-8,9)" "STR$(d%)" "MID$(months
$,m%*9-8,9)" "STR$(dd%(0,1))
2820PRINTTAB(2,2);
2830ENDPROC
2840:
2850DEFPROCindex
2860oldL%=L%:oldP%=P%
2870P%=1:REPEAT:L%=1:REPEAT
2880PROCnewpage(L%,P%)
2890$W%=MID$(months$,P%*9-8,3)
2900T%=0:PROCload
2910Q%=INKEY(100)
2920IFQ%=27:P%=12:L%=31
2930IFQ%=135:oldL%=L%:oldP%=P%:P%=12:L%
=31
2940IFQ%=136:IFL%>=2:L%=L%-2:Q%=0
2950IFQ%=136:IFL%=1ANDP%>1:P%=P%-1:L%=d
d%(P%,2)-1
2960IFQ%=137:IFL%<dd%(P%,2):L%=L%+1
2970IFQ%=138:IFP%>1:P%=P%-1:L%=L%-1:IFL
%>dd%(P%,2)-1:L%=dd%(P%,2)-1
2980IFQ%=139:L%=dd%(P%,2)
2990L%=L%+1:UNTILL%>dd%(P%,2):P%=P%+1:U
NTILP%>12
3000L%=oldL%:P%=oldP%
3010T%=0:Q%=0
3020ENDPROC
3030:
3040DEFPROCload
3050IFP%<7ANDdfs%:*DR.0
3060IFP%>6ANDdfs%:*DR.2
3070X%=W%MOD256
3080Y%=W%DIV256
3090A%=&C0
3100F%=(USR&FFCE)AND&FF
3110PROCdisc(4,&398)
3120PRINTTAB(2,2);
3130VDU23,1,E%;0;0;0;
3140CLOSE#F%
3150ENDPROC
3160:
3170DEFPROCsave
3180IFP%<7ANDdfs%:*DR.0
3190IFP%>6ANDdfs%:*DR.2
3200X%=W%MOD256
3210Y%=W%DIV256
3220A%=&C0
3230F%=(USR&FFCE)AND&FF
3240T%=0
3250IFE%:PROCdisc(2,&398)
3260CLOSE#F%
3262F%=OPENOUT":0.$.DIDATA":PRINT#F%,L%
,P%,epson%,sysclk%:CLOSE#F%
3270ENDPROC
3280:
3290DEFPROCdisc(A%,K%)
3300PTR#F%=(L%-1)*&398
3310B%?0=F%
3320B%!1=&7C50
3330B%!5=K%
3340X%=B%MOD256
3350Y%=B%DIV256
3360CALL&FFD1
3370ENDPROC
3380:
3390DEFPROCstart
3400REM "
3410REM " 0 1 2 3 4 5 6
3420E%=0:VDU23,1,0;0;0;0;
3430REPEAT
3440VDU30
3450PRINT"
";
3460PRINT"
3470PRINT" Instructions
3480PRINT"
3490PRINT" Install your
3500PRINT" preprepared disc
3510PRINT" before running
3520PRINT" the program or
6i 6!5j
3530PRINT" install a blank
e:05 ez
3540PRINT" formatted disc
j
3550PRINT" and select item
£!
3560PRINT" 5 to prepare a
3570PRINT" new disc.
3580PRINT" Requires either
3582PRINT" 80T double sided
3584PRINT" disc for DFS or
3586PRINT" L formatted ADFS
3588PRINT"
3590PRINT"
3610PRINT" Open Diary
3612PRINT" Read TIME$ NO
3620PRINT" Epson 9pin NO
3630PRINT" * Command
3640PRINT" Prepare Disc
3690PRINT"
";
3700PRINTTAB(32,5)STR$(dd%(0,1))
3702IFsysclk%:PRINTTAB(16,20)"YES";
3710IFepson%:PRINTTAB(16,21)"YES";
3720O%=&7C00+40*19:S%=-1
3730REPEAT
3740S%=S%+1:IFS%=5:S%=0
3750?(O%+S%*40)=32
3760Q%=GET
3770?(O%+S%*40)=131
3780UNTILQ%=13
3790IFS%=0:ENDPROC
3792IFS%=1:sysclk%=sysclk%EOR1:GOTO 395
0
3800IFS%=2:epson%=epson%EOR1:GOTO 3950
3810IFS%=3:PROCoscli
3820CLS
3830B%=&900:W%=&9F0
3840FORP%=1TO12
3850IFP%<7ANDdfs%:*DR.0
3860IFP%>6ANDdfs%:*DR.2
3870file$=MID$(months$,P%*9-8,3)
3880F%=OPENOUTfile$
3890FORL%=1TOdd%(P%,2)
3900PROCnewpage(L%,P%)
3910PROCdisc(2,&398)
3920NEXT
3930CLOSE#F%
3940NEXT
3941L%=1:P%=1
3942IFdfs%:*DR.0
3950UNTILFALSE
3960ENDPROC
3970:
5000REM "
5010REM " 0 1 2 3 4 5 6
5020DEFPROChelp1
5030VDU30,23,1,0;0;0;0;
5040PRINT"
";
5050PRINT"
";
5060PRINT"
";
5070PRINT"
`0 ";
5080PRINT"
u: ";
5090PRINT"
5 ";
5100PRINT"
! ";
5110PRINT" INDEX
";
5120PRINT"
";
5130PRINT" Cycles through the whole Di
ary ";
5140PRINT" use the cursor keys to jump
:- ";
5150PRINT"
";
5160PRINT" Left...back a day
";
5170PRINT"
";
5180PRINT" Right...forward a day
";
5190PRINT"
";
5200PRINT" Down...back a month
";
5210PRINT"
";
5220PRINT" Up...forward a month
";
5230PRINT"
";
5240PRINT" <Copy> Exit to current dat
e ";
5250PRINT"
";
5260PRINT" <Escape> Exit returning to
the ";
5270PRINT" initial date
";
5280PRINT"
";
5290?(&7C27+40*24)=32
5300Q%=GET
5310IFQ%<>27:PROChelp2
5320H%=1:Q%=13
5330ENDPROC
5340:
5350REM "
5360REM " 0 1 2 3 4 5 6
5370DEFPROChelp2
5380PRINTTAB(0,7);
5390PRINT"
";
5400PRINT" View Mode Cursor O
FF ";
5410PRINT"
";
5420PRINT" H.....This help
";
5430PRINT" I.....Index see previou
s page ";
5440PRINT" P.....Print Page
";
5450PRINT" <['>.....Enter edit mode
";
5460PRINT" <Esc>.....Close the Diary
";
5470PRINT"
";
5480PRINT" Edit Mode Cursor O
N ";
5490PRINT"
";
5500PRINT" Once here, any changes you
make will ";
5510PRINT" be saved on leaving i.e. af
ter you ";
5520PRINT" hit <Esc>, no prompt is ask
ed for ";
5530PRINT" before saving. So should yo
u not wish ";
5540PRINT" to save the changes you hav
e made, hit";
5550PRINT" the <Break> key.
";
5560PRINT"
";
5570Q%=GET
5580IFQ%<>27:PROChelp3
5590H%=1:Q%=13
5600ENDPROC
5610:
5620REM "
5630REM " 0 1 2 3 4 5 6
5640DEFPROChelp3
5650PRINTTAB(0,7);
5660PRINT" Function Keys 1
";
5670PRINT"
";
5680PRINT" Ctrl+C....Clear screen
";
5690PRINT" Ctrl+P....Print page
";
5700PRINT"
";
5710PRINT" f0...Red text
";
5720PRINT" f1...Green text
";
5730PRINT" f2...Yellow text
";
5740PRINT" f3...Blue text
";
5750PRINT" f4...Magenta text
";
5760PRINT" f5...Cyan text
";
5770PRINT" f6...White text
";
5780PRINT" f7...Flashing
";
5790PRINT" f8...Steady
";
5800PRINT" f9...Pixel editor
";
5810PRINT"
";
5820PRINT" <Esc>...Save, Return to
View Mode ";
5830PRINT"
";
5840Q%=GET
5850IFQ%<>27:PROChelp4
5860H%=1:Q%=13
5870ENDPROC
5880:
5890REM "
5900REM " 0 1 2 3 4 5 6
5910DEFPROChelp4
5920PRINTTAB(0,7);
5930PRINT" Function Keys 2
";
5940PRINT"
";
5950PRINT" Ctrl+C....Clear screen
";
5960PRINT" Ctrl+P....Print page
";
5970PRINT"
";
5980PRINT" Shift+f0...Red graphics
";
5990PRINT" Shift+f1...Green graphics
";
6000PRINT" Shift+f2...Yellow graphics
";
6010PRINT" Shift+f3...Blue graphics
";
6020PRINT" Shift+f4...Magenta graphic
s ";
6030PRINT" Shift+f5...Cyan graphics
";
6040PRINT" Shift+f6...White graphics
";
6050PRINT" Shift+f7...Black backgroun
d ";
6060PRINT" Shift+f8...Colour backgrou
nd ";
6070PRINT" Shift+f9...Pixel editor
";
6080PRINT"
";
6090PRINT" <Esc>...Save, Return to
View Mode ";
6100PRINT"
";
6110Q%=GET
6120IFQ%<>27:PROChelp5
6130H%=1:Q%=13
6140ENDPROC
6150:
6160REM "
6170REM " 0 1 2 3 4 5 6
6180DEFPROChelp5
6190PRINTTAB(0,7);
6200PRINT" Function Keys 3
";
6210PRINT"
";
6220PRINT" Ctrl+C....Clear screen
";
6230PRINT" Ctrl+P....Print page
";
6240PRINT"
";
6250PRINT" Ctrl+f0...Contiguous grap
hics ";
6260PRINT" Ctrl+f1...Seperated graph
ics ";
6270PRINT" Ctrl+f2...Hold graphics
";
6280PRINT" Ctrl+f3...Release graphic
s ";
6290PRINT" Ctrl+f4...Double height
";
6300PRINT" Ctrl+f5...Single height
";
6310PRINT" Ctrl+f6...Insert space
";
6320PRINT" Ctrl+f7...Insert line
";
6330PRINT" Ctrl+f8...Delete line
";
6340PRINT" Ctrl+f9...Pixel editor
";
6350PRINT"
";
6360PRINT" <Esc>...Save, Return to
View Mode ";
6370PRINT"
";
6380Q%=GET
6390ENDPROC
7000:
7010DEFPROCoscli
7020CLS:PRINT"*";:INPUT""L$:OSCLIL$
7030PRINT'"Hit Any Key":Q%=GET:RUN
7040ENDPROC
7050:
7060DEFPROCinit
7071t%=0
7072B%=&900:W%=&9F0
7073T%=0:M%=0
7091IFsysclk%=0:ENDPROC
7092T$=TIME$:D$=MID$(T$,5,2):M$=MID$(T$
,8,3)
7093L%=VALD$:P%=INSTR(" JanFebMarAprMa
yJunJulAugSepOctNovDec",M$)/3
7100ENDPROC
7110:
7120DEFPROCfinish
7130A%=0:Y%=0:CALL&FFCE
7140*FX4,0
7150*FX229,0
7160VDU23;10,&70;0;0;0
7170END
7180ENDPROC
7190:
7200DEFPROCckdisc
7210REM J.RIPLEY's format checker
7220B%=&100
7230?B%=0:B%!1=&E000
7240B%!5=&5303:B%!9=33
7250X%=0:Y%=1:A%=&7F
7260CALL&FFF1
7270IFB%?10=0:dfs%=1ELSEdfs%=0
7280ENDPROC
7290:
7300REM first day of the month, number
of days in the month
7310DATA1997,1997
7320DATA3,31
7330DATA6,28
7340DATA6,31
7350DATA2,30
7360DATA4,31
7370DATA7,30
7380DATA2,31
7390DATA5,31
7400DATA1,30
7410DATA3,31
7420DATA6,30
7430DATA1,31