MBimport
Description of the page content
Tool to import MasterBASIC source code (in standard text files) into the SimCoupe emulator.
MBimport 1
The first version uses the option provided by SimCoupe to import host system files into the SAM Coupé's memory.
After many tries, I decided to low the RAMTOP to 32768 and use the whole memory page. That means the maximum length of the source code is 16 KiB.
First, the procedure v2f
("Vim to file") reads the memory region, extracts the source code lines, edit and join them if needed an prints them out into a serial file in the current disk. Second, the procedure f2s
("file to SAM") reads every line of the serial file and adds it into the current program using KEYIN
.
It's possible to import programs longer than 16 KiB, dividing them into parts. The parts will be joined in the second step of the process.
10 REM MBimport 1 (Version A-20110907)
(C) 2011 Marcos Cruz (programandala.net)
License programandala.net/license
15 MODE 1
20 OPEN BLOCKS 1
25 DEF FN nn$(n)=CHR$ (n MOD 256)+CHR$ INT (n/256)
30 DEF FN min(a,b)=a*(a<b)+b*(b<a)
35 DEF FN max(a,b)=a*(a>b)+b*(b>a)
40 DEF PROC addExtensionTo REF file$
45 LOCAL drive$
LET drive$=""
50 IF LEN file$>4
55 IF EQU(file$(1),"d") AND file$(3)=":"
60 LET drive$=file$(2),drive$=file$( TO 3) AND (drive$>="1" AND drive$<="9")
65 END IF
70 END IF
75 IF LEN drive$ THEN LET file$=file$(4 TO )
80 LET file$=drive$+TRUNC$ ((file$+" ")(1 TO 6))+".mb"
85 END PROC
90 DEF PROC about
CLS #
PRINT PEN 5;"MBimport 1"'"Copyright (C) 2011 Marcos Cruz"'"(programandala.net)"''
END PROC
95 DEF PROC v2fs DATA
REM "From Vim to files"
100 LOCAL file$,file
105 DO WHILE ITEM
IF ITEM=2
READ file
LET file$=STR$ file
ELSE READ file$
END IF
v2f file$
LOOP
110 END PROC
115 DEF PROC v2f file$
REM "From Vim to file"
120 DEFAULT file$="tmp"
125 LOCAL line$,start,end,eol$,eol,stream,clear$
LET start=RAMTOP,eol$=CHR$ 10,eol=LEN eol$,stream=4
addExtensionTo file$
130 LET clear$=CHR$ &21+FN nn$(32768)+CHR$ &11+FN nn$(32769)+CHR$ &01+FN nn$(16383)+CHR$ &36+CHR$ 0+CHR$ &ED+CHR$ &B0+CHR$ &C9
REM machine code to clear 16 KiB at 32768
135 about
140 IF start<>32768 THEN PRINT "Error: RAMTOP<>32768"'"Press any key to do "; BRIGHT 1;"CLEAR 32768"; BRIGHT 0'"and then try again."
PAUSE
CLEAR 32768
STOP
ELSE CALL LENGTH(0,clear$)
145 PRINT "The file "; BRIGHT 1;file$; BRIGHT 0;" will be"'"created with the content of the"'"memory (address range from"'"32768 to 49151)."''"Now please import the host"'"system file into the BASIC"'"address 32768, using the"'"SimCoupe's data import
option"'"(PC key F4)."''"After importing the file, press any key to continue."
150 PAUSE
155 CLOSE #stream
IF FSTAT(file$,1)
PRINT "erased"
ERASE file$
END IF
OPEN #stream;file$ OUT
160 PRINT "Copying the lines from memory"'"into the temporary file..."
165 DO
170 LET end=LOCN(start, 49151,eol$,ABS )
175 EXIT IF NOT end
180 PRINT #stream;MEM$(start TO end-1)
LET start=end+eol
185 LOOP
190 CLOSE #stream
195 PRINT "Done!"
200 END PROC
205 DEF PROC fs2s DATA
REM "From files to SAM"
210 LOCAL file$,file
215 DO WHILE ITEM
IF ITEM=2
READ file
LET file$=STR$ file
ELSE READ file$
END IF
f2s file$
LOOP
220 END PROC
225 DEF PROC f2s file$,lineN
REM "From file to SAM"
230 DEFAULT file$="tmp",lineN=lastLineByMBimport+1
235 LOCAL srcLine$,srcLineL,line$,stream,tabChars$,tail$
LET line$="",stream=4,tabChars$=CHR$ 9+CHR$ 32
addExtensionTo file$
240 about
245 IF RAMTOP<81919 THEN PRINT "Error: RAMTOP<81919"'"Press any key to do "; BRIGHT 1;"CLEAR 81919"; BRIGHT 0'"and then try again."
PAUSE
CLEAR 81919
STOP
250 SCROLL CLEAR
255 CLOSE #stream
OPEN #stream,file$ RND
260 DO WHILE NOT EOF stream
265 REM LET srcLine$=INP$(#stream,0)
rem fails with lines longer than 255
270 INPUT #stream; LINE srcLine$
275 REM PRINT "raw srcLine$="; PEN 5;srcLine$
rem debug!!!
280 FOR first=1 TO LEN srcLine$
IF NOT INSTR(tabChars$,srcLine$(first)) THEN EXIT FOR
285 NEXT first
IF first>1 THEN LET srcLine$=srcLine$(first TO )
290 REM PRINT "srcLine$="; PEN 2;srcLine$
PRINT "line$="; PEN 6;line$
295 LET srcLineL=LEN srcLine$
300 IF srcLineL
PRINT PEN 6;srcLine$
IF srcLine$(srcLineL)=CHR$ 92
LET tail$=srcLine$( TO srcLineL-1)
JOIN TO line$,tail$
ELSE
keyinLine line$+srcLine$
LET line$=""
END IF
END IF
305 LOOP
IF LEN line$ THEN keyinLine line$
310 keyinLine "label lastLineByMBimport"
315 SCROLL RESTORE
320 CLOSE #stream
325 END PROC
330 DEF PROC keyinLine l$
335 LOCAL color
LET color=4
340 ON ERROR GO TO syntaxError
KEYIN STR$ lineN+l$
ON ERROR STOP
GO TO printLine
345 LABEL syntaxError
350 ON ERROR STOP
KEYIN STR$ lineN+"REM MIS"+"TAKE "+l$
LET color=2
355 LABEL printLine
PRINT lineN; PEN color;l$
360 LET lineN=lineN+1
365 END PROC
370 DEF PROC si
REM Show input (for debugging)
375 LOCAL pointer,first,last
LET pointer=PTR stream,first=FN max(pointer-16,0),last=FN min(pointer+16,LENGTH#stream)
380 FOR pos=first TO last
POINT#stream,pos
LET char$=INP$(#stream,1),color=7-5*(pos=pointer)
PRINT PEN color;SHIFT$(char$,4);"(";CODE char$;")";
NEXT pos
385 POINT#stream,pointer
390 END PROC
395 DEF PROC sr
SCROLL RESTORE
END PROC
400 DEF PROC c
REM Clear after an error
405 sr
CLOSE *
CLEAR
STOP
END PROC
410 DEF PROC cat drive
DEFAULT drive=DSTAT(*,8)
DIR "d"+STR$ (drive)+":*.mb"
END PROC
415 DEF PROC d
REM Delete the imported code
420 DELETE 1e3 TO
END PROC
425 DEF PROC dMBimport
REM Delete MBimport
430 DELETE TO VAL "999"
END PROC
435 DEF PROC r
REM Renum MBimport
440 RENUM TO endOFMBimport LINE 10 STEP 5
END PROC
445 DEF PROC s
REM Save MBimport 1
450 d
ERASE "MBimport1~"
RENAME "MBimport1","MBimport1~"
SAVE "MBimport1"
END PROC
455 LABEL endOfMBimport
999 LABEL lastLineByMBimport
REM This line must be 999
-------------------------
MBimport 2
The second version is faster and easier to use. It allows to import programs bigger than 16 KiB in a single step. The source code is extracted from the sectors of a fake MGT disk image. That means the maximum length of the source code is 800 KiB, the raw capacity of an MGT disk.
The procedure d2s
("disk to SAM") does all the work.
To increase the speed, this version doesn't join the splitted lines or remove indentation. Those tasks must be done by the host system.
10 REM MBimport 2 (version A-20110907)
(C) 2011 Marcos Cruz (programandala.net)
License programandala.net/license
15 MODE 1
20 DEF PROC about
CLS #
PRINT PEN 5;"MBimport 2"'"Copyright (C) 2011 Marcos Cruz"'"(programandala.net)"''
END PROC
25 DEF PROC import drive,lineN
REM "From disk image to SAM"
30 DEFAULT drive=2,lineN=endOfMBimport+1
35 LOCAL srcLine$,buffer,bufferEnd,cr$,endOfSource
40 LET cr$=CHR$ 13,endOfSource=0
45 LOCAL sectorLen,track,sector,sliceStart,CRPos,lastTrack
50 LET sectorLen=512,track=0,sector=1,CRPos=0,lastTrack=79 BOR 128
55 IF RAMTOP<81919 THEN PRINT "Error: RAMTOP<81919"'"Press any key to do "; BRIGHT 1;"CLEAR 81919"; BRIGHT 0'"and then try again."
PAUSE
CLEAR 81919
STOP
60 LET buffer=RAMTOP,bufferEnd=buffer+sectorLen-1
65 SCROLL CLEAR
70 loadSector
75 DO
80 diskTo srcLine$
85 EXIT IF endOfSource
90 PRINT AT 0,0;lineN
95 KEYIN STR$ lineN+srcLine$
100 LET lineN=lineN+1
105 LOOP
110 keyinLine "label lastLineByMBimport"
115 SCROLL RESTORE
120 END PROC
125 DEF PROC diskTo REF diskLine$
130 LET diskLine$=""
135 IF NOT PEEK (sliceStart) THEN debug "Zero found"
LET endOfSource=1
EXIT PROC
140 DO
145 LET crPos=LOCN(sliceStart,bufferEnd,cr$,ABS )
150 debug "crPos="+STR$ crPos+(" (+"+STR$ (crPos-buffer)+")") AND crPos
155 IF crPos
160 LET diskLine$=diskLine$+MEM$(sliceStart TO crPos-1)
165 IF crPos=bufferEnd THEN feedBuffer
ELSE LET sliceStart=crPos+1
170 ELSE
175 LET diskLine$=diskLine$+MEM$(sliceStart TO bufferEnd)
feedBuffer
180 END IF
185 LOOP UNTIL crPos
190 END PROC
195 DEF PROC feedBuffer
200 debug "feedBuffer (current sector is "+STR$ sector+"/"+STR$ track+")"
205 nextSector
loadSector
210 END PROC
215 DEF PROC loadSector d,t,s
220 DEFAULT d=drive,t=track,s=sector
225 debug "loadSector ("+STR$ sector+"/"+STR$ track+")"
230 READ AT d,t,s,buffer,1
235 LET sliceStart=buffer
240 END PROC
245 DEF PROC nextSector
250 debug "nextSector (current is "+STR$ sector+")"
255 IF sector<10 THEN LET sector=sector+1
ELSE nextTrack
260 END PROC
265 DEF PROC nextTrack
270 debug "nextTrack (current is "+STR$ track+")"
275 IF track=lastTrack THEN wipeBuffer
LET endOfSource=1
EXIT PROC
280 IF FN side0(track)
285 DoSide1 track
290 ELSE doSide0 track
LET track=track+1
295 END IF
300 LET sector=1
305 END PROC
310 DEF FN side0(t)=t<80
315 DEF PROC doSide1 REF track
320 debug "doSide1"
325 LET track=track+128
330 END PROC
335 DEF PROC doSide0 REF track
340 debug "doSide0"
345 LET track=track-128
350 END PROC
355 DEF PROC debug message$,color
360 DEFAULT color=2
365 REM PRINT PEN color;message$
REM PAUSE
370 END PROC
375 DEF PROC keyinLine l$
380 LOCAL color
LET color=4
385 ON ERROR GO TO syntaxError
KEYIN STR$ lineN+l$
ON ERROR STOP
GO TO printLine
390 LABEL syntaxError
395 ON ERROR STOP
KEYIN STR$ lineN+"REM MIS"+"TAKE "+l$
LET color=2
400 LABEL printLine
PRINT lineN; PEN color;l$
405 LET lineN=lineN+1
410 END PROC
415 DEF PROC sr
SCROLL RESTORE
END PROC
420 DEF PROC c
REM Clear after an error
425 sr
CLOSE *
CLEAR
STOP
END PROC
430 DEF PROC d
REM Delete the imported code
435 DELETE endOfMBimport+1 TO
END PROC
440 DEF PROC dMBimport
REM Delete MBimport
445 DELETE TO endOfMBimport
END PROC
450 DEF PROC r
REM Renum MBimport
455 RENUM TO endOFMBimport-1 LINE 10 STEP 5
END PROC
460 DEF PROC s
REM Save MBimport
465 d
ERASE "MBimport2~"
RENAME "MBimport2","MBimport2~"
SAVE "MBimport2"
END PROC
999 LABEL endOfMBimport
REM The first line of the imported code will be one more than this one.
--------------------------
MBimport 3
The third version is the simplest method: It reads the source code from a serial file, line after line, from a real MGT disk image.
The source code has to be copied into the MGT disk image using the program SAM Diskimage Manager, (written by Edwin Blink in 2000). It's a program for Windows 95/95, but it works fine on GNU/Linux with Wine.
The source code will be added by SAM Diskimage Manager as a SAM CODE file; but MasterBASIC can open it like an OPENTYPE file. Unlike with normal OPENTYPE files, this way the first nine bytes must be skipped (they are the file header): OPEN #4,"filename" IN:let useless$=INP$(#4,9)
.
1 REM MBimport 3 (Version A-20110907)
(C) 2011 Marcos Cruz (programandala.net)
License programandala.net/license
2 MODE 1
OPEN BLOCKS 1
3 DEF PROC about
CLS #
PRINT PEN 5;"MBimport 3"'"Copyright (C) 2011 Marcos Cruz"'"(programandala.net)"''
END PROC
4 DEF PROC import file$,lineN
5 DEFAULT lineN=lastLineByMBimport+1
6 LOCAL line$,stream
LET line$="",stream=4
7 about
8 SCROLL CLEAR
ON ERROR STOP
9 CLOSE #stream
OPEN #stream,file$ IN
LET line$=INP$(#stream,9)
10 DO WHILE NOT EOF stream
11 INPUT #stream; LINE line$
12 REM LET line$=STR$ lineN+" "+line$
PRINT line$
KEYIN line$
REM Alternative 1, no error checking
13 KeyinLine line$
REM Alternative 2, with error checking
14 LET lineN=lineN+1
15 LOOP
16 KEYIN "label lastLineByMBimport"
17 CLOSE #stream
18 SCROLL RESTORE
19 DEF PROC keyinLine l$
20 ON ERROR GO TO syntaxError
KEYIN STR$ lineN+l$
ON ERROR STOP
EXIT PROC
21 LABEL syntaxError
ON ERROR STOP
PRINT lineN; PEN 2;l$
KEYIN STR$ lineN+"REM MIS"+"TAKE "+l$
22 END PROC
23 DEF PROC sr
SCROLL RESTORE
END PROC
24 DEF PROC c
REM Clear after an error
25 sr
CLOSE *
CLEAR
STOP
END PROC
26 DEF PROC d
REM Delete the imported code
27 DELETE lastLineByMBimport+1 TO
END PROC
28 DEF PROC dMBimport
REM Delete MBimport
29 DELETE TO VAL "99"
END PROC
30 DEF PROC r
REM Renum MBimport
31 RENUM TO endOFMBimport LINE 1 STEP 1
END PROC
32 DEF PROC s
REM Save MBimport 3
33 d
ERASE "MBimport3~"
RENAME "MBimport3","MBimport3~"
SAVE "MBimport3"
END PROC
34 LABEL endOfMBimport
99 LABEL lastLineByMBimport
REM This line must be 99
MBimport 4
The fourth version is a modified copy of the second version. It was created in 2012-11 in order to check the influence of label
in the keyin
's errors. Every label
was removed from the program. Also the debug code was removed, what makes the program a bit faster.
1 REM MBimport 4 (version A-20121208)
(C) 2012 Marcos Cruz (programandala.net)
License programandala.net/license
2 REM Change log
2012-11-15, first version, copy of MBimport 2 without labels
2012-11-16, debug checks removed.
2012-11-20, instructions,error report.
2012-12-06, better instructions; mode 3.
2012-12-08, better instructions; better final error message.
3 screenConfig
about
STOP
4 DEF PROC screenConfig scrMode
DEFAULT scrMode=3
5 MODE scrMode
IF scrMode=1
LET black=0,green=4,red=2,white=7
ELSE
LET black=0,green=1,red=2,white=3
PALETTE black,0
PALETTE green,68
PALETTE red,2
PALETTE white,15
END IF
6 PAPER black
PEN white
BORDER black
CLS
END PROC
7 DEF PROC about
PRINT "MBimport 4"'"Copyright (C) 2012 Marcos Cruz (programandala.net)"''"Usage:"
8 PRINT '"1) Make sure there's enough memory for your program to be imported."'" Use FREE, FPAGES, OPEN and CLEAR if needed."
9 PRINT '"2) Insert into drive 2 the fake MGT disk image created by MBim2MB."
10 PRINT '"3) Type the command 'IMPORT'."'" If the disk image is in drive 1, use 'IMPORT 1' instead."
11 PRINT '"If the import process fails with the error message ""Not understood"" and the source"'"line is right (it's in 'srcLine$'), simply try CONTINUE. It's a KEYIN's bug."
12 PRINT '"For more details see:"'"<http://programandala.net/en.program.mbim>"
13 END PROC
14 DEF PROC import drive,lineN
DEFAULT drive=2,lineN=MBimport4Top+1
15 LOCAL srcLine$,buffer,bufferEnd,cr$,endOfSource,sectorLen,track,sector,sliceStart,CRPos,lastTrack,errors
16 LET cr$=CHR$ 13,endOfSource=0,sectorLen=512,track=0,sector=1,CRPos=0,lastTrack=79 BOR 128,buffer=RAMTOP,bufferEnd=buffer+sectorLen-1,errors=0
17 CLS
SCROLL CLEAR
loadSector
18 DO
diskTo srcLine$
EXIT IF endOfSource
keyinLine srcLine$
LOOP
19 done
SCROLL RESTORE
20 END PROC
21 DEF PROC done
22 PRINT '"Done!"
23 errorReport
24 PRINT '"Press the space bar to delete"'"MBimport and renumber your"'"program, or any other key to"'"stop and do it manually"'"(DELETE TO ";MBimport4Top;")."
25 GET key$
IF key$=" " THEN KEYIN "delete to mbimport4top:renum:scroll restore:list:stop"
ELSE STOP
26 END PROC
27 DEF PROC errorReport
28 IF NOT errors THEN EXIT PROC
29 PRINT ' PAPER red; BRIGHT 1;"Warning:"
30 IF errors=1
PRINT "There was one syntax error.";
ELSE IF errors>1
PRINT "There were ";errors;" syntax errors.";
END IF
31 PRINT " 'REM MISTAKE' has been prefixed to the wrong line";"s" AND (errors>1);"."'
32 END PROC
33 DEF PROC diskTo REF diskLine$
34 LET diskLine$=""
35 IF NOT PEEK (sliceStart) THEN
LET endOfSource=1
EXIT PROC
36 DO
37 LET crPos=LOCN(sliceStart,bufferEnd,cr$,ABS )
38 IF crPos
39 LET diskLine$=diskLine$+MEM$(sliceStart TO crPos-1)
40 IF crPos=bufferEnd THEN feedBuffer
ELSE LET sliceStart=crPos+1
41 ELSE
42 LET diskLine$=diskLine$+MEM$(sliceStart TO bufferEnd)
feedBuffer
43 END IF
44 LOOP UNTIL crPos
45 END PROC
46 DEF PROC feedBuffer
nextSector
loadSector
END PROC
47 DEF PROC loadSector d,t,s
DEFAULT d=drive,t=track,s=sector
READ AT d,t,s,buffer,1
LET sliceStart=buffer
END PROC
48 DEF PROC nextSector
IF sector<10 THEN LET sector=sector+1
ELSE nextTrack
49 END PROC
50 DEF PROC nextTrack
51 IF track=lastTrack THEN wipeBuffer
LET endOfSource=1
EXIT PROC
52 IF FN side0(track)
DoSide1 track
ELSE doSide0 track
LET track=track+1
END IF
53 LET sector=1
54 END PROC
55 DEF FN side0(t)=t<80
56 DEF PROC doSide1 REF track
LET track=track+128
END PROC
57 DEF PROC doSide0 REF track
LET track=track-128
END PROC
58 DEF PROC debug message$,color
59 DEFAULT color=red
60 PRINT PEN color;message$
61 PAUSE
62 END PROC
63 DEF PROC keyinLine l$
64 LOCAL color
LET color=green
65 ON ERROR GO TO syntaxError
KEYIN STR$ lineN+" "+l$
ON ERROR STOP
GO TO printLine
66 LABEL syntaxError
ON ERROR STOP
LET errors=errors+1
KEYIN STR$ lineN+"REM MISTAKE "+l$
LET color=red
67 LABEL printLine
PRINT lineN-MBimport4Top; PEN color;l$
68 LET lineN=lineN+1
69 END PROC
70 DEF PROC d4
DELETE TO MBimport4Top
END PROC
71 DEF PROC r4
RENUM TO MBimport4Top LINE 1 STEP 1
END PROC
72 DEF PROC s4
r4
ERASE "MBimport4~"
RENAME "MBimport4","MBimport4~"
SAVE "MBimport4" LINE 1
END PROC
73 LABEL MBimport4Top
REM The first line number of the imported code will be one more than this one.
--------------------------
MBimport 5
1 REM MBimport 5 (version A-02-201212081830)
(C) 2012 Marcos Cruz (programandala.net)
License programandala.net/license
2 MODE 3
CLS #
MOVE "usage5" TO #2
3 DEF PROC import drive
DEFAULT drive=2
LET cr$=CHR$ 13,endOfSource=0,sectorLen=512,sectorsPerTrack=10,trackLen=sectorsPerTrack*sectorLen,track=127,crPos=0,lastTrack=79 BOR 128,buffer=RAMTOP,bufferEnd=buffer+trackLen-1,lineN=1
MODE 2
CLS #
feedBuffer
4 DO
EXIT IF NOT PEEK (sliceStart)
LET l$=""
DO
LET crPos=LOCN(sliceStart,bufferEnd,cr$,ABS )
IF crPos
LET l$=l$+MEM$(sliceStart TO crPos-1)
IF crPos=bufferEnd
feedBuffer
ELSE LET sliceStart=crPos+1
END IF
ELSE LET l$=l$+MEM$(sliceStart TO bufferEnd)
feedBuffer
END IF
LOOP UNTIL crPos
PRINT AT 0,0;lineN
KEYIN l$
LET lineN=lineN+1
LOOP
KEYIN "delete to MBimport5Top:renum line 1 step 1:cls#:print ""Done!"":scroll restore:list:stop"
END PROC
5 DEF PROC feedBuffer
IF track=lastTrack
LET endOfSource=1
ELSE
IF track<80
LET track=track BOR 128
ELSE LET track=track-127
END IF
READ AT drive,track,1,buffer,10
LET sliceStart=buffer
END IF
END PROC
6 DEF PROC s5
DELETE MBimport5Top+1 TO
RENUM LINE 1 STEP 1
SAVE OVER "MBimport5" LINE 1
END PROC
7 LABEL MBimport5Top
mkusage5
This tool creates a text file in the disk, containing the usage instructions of MBimport 5. This make MBimport 5 smaller.
// mkusage5.mbim
rem mkusage5 (version A-00-20121208):\
(C) 2012 Marcos Cruz (programandala.net):\
"License: http://programandala.net/license"
/*
This program creates a disk file with the usage instructions of MBimport 5.
See <http://programandala.net/en.program.mbim.mbimport>.
History
2012-12-08. First version. Texts taken from MBimport 5.
*/
#firstline 0 // no line numbers; MBimport 4 will be used to import the code
// Config
mode 3:\
cls#
let file=4,file$="usage5" // destination file
// About
print "mkusage5"
print "(C) 2012 Marcos Cruz (programandala.net)"
print '"This program creates a disk file with the usage instructions of MBimport 5."
print '"See <http://programandala.net/en.program.mbim> for more details."
print '"Type 'go' to run"
defproc go
// Create the usage file.
if fstat(file$,1) then erase file$
close#file
open#file;file$ out
type "MBimport 5"
type "Copyright (C) 2012 Marcos Cruz (programandala.net)"
type ""
type "Usage:"
type "1) Make sure there's enough memory for your program."
type " Use 'OPEN n' to add more 16 KiB pages to BASIC, and 'CLEAR x' to set the RAMTOP."
type " Example: PRINT FREE: REM free memory available for BASIC"
type " PRINT FPAGES: REM unused 16 KiB memory pages"
type " OPEN 3: REM reserve 3 more pages for BASIC"
type " CLEAR RAMTOP+3*16384: REM move the RAMTOP accordingly"
type "2) Introduce your '*.mbim.mb.mgt.gz' or '*.mbim.mb.mgt.zip' file into drive 2."
type "3) Use 'IMPORT' to import the source from drive 2."
type ""
type "If the program stops with the error 'Not understood', you can examine the latest"
type "imported line with 'PRINT l$'. If it's wrong, you can fix it with 'EDIT l$' and"
type "'CONTINUE'. If it's right, the problem is some bug in 'KEYIN', but 'CONTINUE'"
type "works and the line is added to the program."
type ""
type "See <http://programandala.net/en.program.mbim> for more details."
close#file
cls#
print "Done!"
print "Type 'show' to see the result."
endproc
defproc type line$
// Create a line of the usage file.
print #file;line$
rem print line$
endproc
defproc show
// Show the usage file.
cls#
close#file
open#file;file$ in
do until eof file
input#file; line l$
print l$
loop
close#file
endproc
defproc s:\
renum:\
save over "mkusage5" line 10:\
endproc
Downloads
- mbimport.mgt.gz (149.93 KiB) MBimport in an MGT disk image, compressed with gzip.
- mbimport_5.mbim (3.20 KiB).
- mkusage5.mbim (2.37 KiB).
The MGT disk image contains:
- MasterBASIC 1.7 (>1990) combined with Master DOS 2.3 (1990) (in the file MDOS+MBAS).
- Autoload file Auto (and its secondary file Init, that configures some system variables and access keys).
- Programs MBimport 1, MBimport 2, MBimport 3 and MBimport 4.
- Some OPENTYPE files with extension "V2S"; they are import tests created with MBimport 1.