Compucolor.org – Virtual Media

Listing of file='BOOT68.BAS;01' on disk='vmedia/terminal-sector.ccvf'

10 REM  **************************************************
20 REM
30 REM  BOOT68 - This program will get a Start Address, Byte
40 REM  Count or End Address and send a formatted block to the
50 REM  6800 as a valid 6800 program. The 6800 must have the BOOT
60 REM  program up and after loading, control will be transferred
70 REM  to the loaded program.
80 REM  Transfer is at 300 baud with 2 stop bits.
90 REM
100 REM  **************************************************
110 REM
120 REM  Variables used by this program:-
130 REM
140 REM 		SA - Start Address
150 REM 		SA$ - Start Address String
160 REM 		EA - End Address
170 REM 		EA$ - End Address String
180 REM 		BC - Byte Count
190 REM 		BC$ - Byte Count String
200 REM 		DM$ - Delimiter String
210 REM 		HM(3) - Header, Start of Message
220 REM 		DM(261) - Data Array
230 REM 		EM(3) - Header, End of Message
240 REM 		DM - Number of Data Message elements
250 REM 		NOTE: 5 plus Actual No. of Data Bytes
255 REM 		equals DM
260 REM 		LA - Load Address
270 REM 		LA$ - Load Address String
280 REM
290 REM 		HX,HX$,H$,H,H1,H2,H3,H4 all used by
300 REM 		decimal to hex/hex to decimal
310 REM
1000 REM  BOOT68 INITIALIZE
1005 REM
1010 PLOT  12,6,7,15
1020 PRINT  "BOOT68":PRINT :PRINT
1030 PLOT  14,6,2
1050 PRINT  "Enter Start Address-End Address in hex - ";
1060 INPUT  "";IP$
1070 SA$= LEFT$ (IP$,4)
1100 EA$= MID$ (IP$,6,4)
1110 HX$= SA$
1120 GOSUB 64000
1130 SA= HX
1140 HX$= EA$
1150 GOSUB 64000
1160 EA= HX
1170 BC= EA- SA
1180 PRINT
1190 PRINT  "Enter Load Address in hex"
1200 INPUT  "( <CR> if same as Start Address ) - ";IP$
1210 IF  LEN (IP$)= 0 THEN LA= SA
1220 LA$= LEFT$ (IP$,4)
1230 HX$= LA$
1240 GOSUB 64000
1250 LA= HX
64000 H= 0:HX= 0:RESTORE 64000
64010 FOR  I = LEN (HX$) TO  1 STEP  - 1
64020 READ  M
64030 H$ =  MID$ (HX$,I,1)
64040 GOSUB 64090
64050 H(I) =  H *  M :HX= HX +  H(I)
64060 NEXT  I
64070 DATA  1,16,256,4096,65536,1048576
64080 RETURN
64090 IF  H$ = >  "0" AND  H$ = <  "9" THEN H= ASC (H$) -  48:RETURN
64100 IF  H$ = >  "A" AND  H$ = <  "F" THEN H= ASC (H$) -  55:RETURN
64110 PRINT  "INVALID HEX CHARACTER":RETURN
64120 IF  H$ = >  "0" AND  H$ = <  "9" THEN H= ASC (H$) -  48:RETURN
64130 IF  H$ = >  "A" AND  H$ = <  "F" THEN H= ASC (H$) -  55:RETURN
64140 PRINT  "INVALID HEX CHARACTER":RETURN
64150 H1= INT (HX/ 4096)
64160 H2= INT ((HX -  H1* 4096)/ 256)
64170 H3= INT ((HX -  ((H1* 4096)+ (H2* 256)))/ 16)
64180 H4= INT (HX -  ((H1* 4096)+ (H2* 256)+ (H3* 16)))
64190 H1= H1+ 48:IF  H1> 57 THEN H1= H1+ 7
64200 H2= H2+ 48:IF  H2> 57 THEN H2= H2+ 7
64210 H3= H3+ 48:IF  H3> 57 THEN H3= H3+ 7
64220 H4= H4+ 48:IF  H4> 57 THEN H4= H4+ 7
64230 HX$= CHR$ (H1)+ CHR$ (H2)+ CHR$ (H3)+ CHR$ (H4)
64240 RETURN