8-Bit Software Online Conversion
LED Demo - Listing
10MODE1
20DIMdispdata% 18
30DIMdigits% 12
40PROCinit
50ONERROR:MODE3:END
60TIME=&FFFFCFFF
70REM TIME=&80000000
80PROCfront
90:
100REPEAT
110PROCtop
120PROCmid
130PROCbottom
140K%=INKEY(20)
150IFK%=68 OR K%=100:hex%=0
160IFK%=72 OR K%=104:hex%=1
170IFK%=32:pause%=pause%EOR1
180COLOURhex%EOR1+2
190PRINTTAB(14,30)CHR$(243)
200COLOURhex%+2
210PRINTTAB(23,30)CHR$(243)
220UNTILcnt%=0
222*EXEC !BOOT
230END
240:
250DEFPROCtop
260IFhex%:T$=STR$÷(TIME)ELSET$=STR$(TI
ME)
270PROCld`display(T$)
280PROCdodisplay(15)
290COLOUR2
300VDU9,11,243
310ENDPROC
320:
330DEFPROCmid
340IFpause%=0:cnt%=cnt%-1
350IFhex%:cnt$=STR$÷(cnt%)ELSEcnt$=STR
$(cnt%)
360PROCld`display(cnt$)
370PROCdodisplay(20)
380COLOURpause%+2
390VDU9,11,243
400ENDPROC
410:
420DEFPROCbottom
430PROCld`display(title$)
440PROCdodisplay(25)
450c$=MID$(title$,1,1):title$=MID$(tit
le$,2)+c$
460COLOUR2
470VDU9,11,243
480ENDPROC
490:
500DEFPROCld`display(display$)
510PROCcleardigits
520FORI%=1TOLEN(display$)
530d$=MID$(RIGHT$(display$,I%),1,1)
540d%=INSTR("0123456789ABCDEF-.",d$)
550?(digits%+I%-1)=dispdata%?d%
560NEXT
570ENDPROC
580:
590DEFPROCdodisplay(J%)
600N%=10
610FORI%=3TO33STEP3
620PRINTTAB(I%,J%);:PROCdisplay(digits
%?N%)
630N%=N%-1
640NEXT
650REM PRINT'
660ENDPROC
670:
680DEFPROCdisplay(n)
690COLOURSGN(n AND&01)+1:VDU32,95,32,1
0,8,8,8
700COLOURSGN(n AND&20)+1:VDU240
710COLOURSGN(n AND&40)+1:VDU95
720COLOURSGN(n AND&02)+1:VDU241,10,8,8
,8
730COLOURSGN(n AND&10)+1:VDU240
740COLOURSGN(n AND&08)+1:VDU95
750COLOURSGN(n AND&04)+1:VDU241
760COLOURSGN(n AND&80)+1:VDU10,8,8,8,3
2,32,242
770COLOUR3
780ENDPROC
790:
800DEFPROCcleardigits
810!digits%=0:digits%!4=0:digits%!8=0
820ENDPROC
830:
840DEFPROCfront
850GCOL0,3
860MOVE 1279,0:PLOT85,1279,600
870MOVE 0,600:PLOT85,0,0
880MOVE 0,610:MOVE 200,810:PLOT85,200,
610
890MOVE 1279,610:MOVE 1079,810:PLOT85,
1079,610
900COLOURhex%EOR1+2
910PRINTTAB(14,30)CHR$(243)
920COLOURhex%+2
930PRINTTAB(23,30)CHR$(243)
940VDU5:GCOL4,3
950MOVE 100,580:PRINT"LED Digital Disp
lay"
960MOVE 500,60:PRINT"Hex"
970MOVE 800,60:PRINT"Decimal"
980VDU4:
990PROCbottom
1000PROCmid
1010PRINTTAB(0,2)"Active Keys"
1020PRINTTAB(8,4)"Space..toggle countdo
wn"
1030PRINTTAB(12,6)"D..decimal display"
1040PRINTTAB(12,8)"H..hex display"
1050ENDPROC
1060:
1070DEFPROCinit
1080REM Load dispdata
1090FORI%=0TO18:READ?(dispdata%+I%):NEX
T
1100VDU23,240,&01,&01,&01,&01,&01,&01,&
01,&00
1110VDU23,241,&80,&80,&80,&80,&80,&80,&
80,&00
1120VDU23,242,&0C,&0C,&00,&00,&00,&00,&
00,&00
1130VDU23,243,&00,&7E,&7E,&7E,&7E,&7E,&
7E,&00
1140VDU23;8202;0;0;0;
1150VDU19,1,4;0;
1160VDU19,2,7;0;
1170VDU19,3,5;0;
1180@%=&50A
1190hex%=0:pause%=0:cnt%=45
1200title$=".....8B5-60"
1210PROCcleardigits
1220ENDPROC
1230:
1240REM - a - Bi
t Map
1250REM f | | b
1260REM - g - pg
fedcba
1270REM e | | c
1280REM - d - . p
1290:
1300DATA&00,&3F,&06,&5B,&4F,&66,&6D,&7D
,&07,&7F,&67,&77,&7C,&39,&5E,&79,&71,&40
,&80