MSX BASIC: How to combine .BAS and .SC1 to one (.BAS?) .ROM file?

صفحة 2/2
1 |

بواسطة jltursan

Prophet (2619)

صورة jltursan

11-02-2011, 18:54

- And when you say 'just transfer the data from RAM to VRAM' you mean I have to call/do/include this in my BASIC code? How to do that? Is there a possible ML routine I can use in my BASIC code to speed this process up?

You can include ML routines in your bin file (check assembler example below). If you know where is located every routine, you can simply call it from your BASIC program using USR() calls. VRAM dumping routines are extremely easy to program and they don't need input parameters; so you don't need to mess you up with parameter parsing routines in your assembler code, just call USR(0), USR(1) and so on...

- Like you said a ROM with BASIC is limited to 16KB (I faced that problem while making Mission2Mir also). Does this simply mean that file size .BAS + file size .SC1 =< 16KB -in theory- will be workable?

Right. I must add that ROMCreator needs a tokenized BASIC listing. I usually get it saving the BASIC program with OpenMSX to a disk image and extracting it with DiskExplorer. You can also convert the ASCII listing with OpenMSX and a TCL script that was developed some time ago....don't remember the thread.

- So BLOAD-ing it into my computers RAM memory and then BSAVE-ing it (as .BIN file I asume) will give me a pure binair file (suitable for adding it to BASIC using ROMcreator)?

That's correct. The programs searches for a valid header data.

You can create a bin data/code file right from a cross-assembler like sjasm using the following pattern:

	OUTPUT xxxxx.bin
        DB      $FE
        DW      MAIN,ENDPROG,MAIN
        ORG $AB59

MAIN:

ROUTINE1:
.
.
.

ROUTINE2:
.
.
.
.

ANIMATION_DATA:
	DB 12,16,28,12,20,24,52,48,44,76,72,68,8,0,28,8,4,24,40,36,32,64,60,56,100,96,112,100,104,108,144,140,160,136,132,152,84,80,108,92,88,112,128,124,156,120,116,148
	DB 18,19,18,19,22,25,24,25,20,23,21,23

ENDPROG: equ $

END

Unfortunately the tool doesn't like raw files and sizes above 16KB; but I've some work done on a new version with support for bigger BASIC ROMs, raw data adding and some other features. It will be released in a far distant future, you know what I mean, not much spare time lately...Tongue

To easily convert bin data to ASCII listing you can use the tool included with asMSX called "binDB". It creates a file with assembler DB commands that can be assembled with your favourite assembler.

بواسطة Tanni

Hero (556)

صورة Tanni

12-02-2011, 01:08

cq. (casu quo) means something like and/or

Thanks for the info. Sounds easy, but to programm that is I think difficult (for me). I have to try.

Do you know if there is such programm (which converts into the RAM bloaded DATA to MSX BASIC DATA-lines) for MSX to find on the internet maybe?

My description was somewhat messed up, yesterday.

110 l=1000:' line number
120 REM Here comes opening the SC1-file or loading the file to an appropriate VRAM location
130 CLS
140 PRINT l;
150 PRINT " DATA ";
160 REM Here comes file read and generating the output string s$
170 REM This may take some lines
180 PRINT s$
190 PRINT"GOTO130''
200 LOCATE x,y
210 l=l+10

Here is a template for the program you're supposed to write. Note that I worte that kind of program really long times ago,
and that I've never done much file handling in BASIC, so I'm not sure if it works in the expected way. I don't think that I
read the data to be converted from an input file back then. So, if the termination of the program after the last line will close
the input file automatically, then it will not work. But then, you could first load the screen file into the VRAM and then read
from there, what will be easier anyway. You have to load it somewhere else, not in the actual output screen, which is
needed for the data line generation.

The variable l is the line number. It is initialized to 1000 in line 100, so the data block will be located behind the program.
Line 210 increments the line number by 10, which is quite usual.

Line 130 clears the screen because maybe the lines will be of different lenght.
Then, there should be nothing left form the previous line.

Note that the semicolons in line 140 and 150 are essential.

Line 180 prints out the data values generated in the lines before and added up into the string s$.
Here, the lack of the semicolon is essential.

Line 190 prints out the direct mode statement to continue the program in line 130.

Line 200 is supposed to put the cursor somewhere into the first line.
Put it at the first charater of the line number.
Unfortunately, I don't know the exact syntax and semantics by heart.

Line 210 increments the line number by 10.

And, since there is no more line in the first lap, the program terminates here.

Now, if you run the program, the first data line is displayed, followed by the goto to line 130.
The DATA line actually may take more than one physical lines, depending on the length of the string s$.
The cursor is on the first position of the first line, and you have to press RETURN.
Then, the BASIC interpreter will scan the line there and add it to the program as line 1000.
The cursor is located in the screen after the converted line, i.e. on the goto statement.
If you now press RETURN again, the program will contiue at line 130 and prepare the next lap.
Note, that the program form now on must skip the generated DATA lines to reach the end,
so execution doesn't terminate at line 210 anymore.

بواسطة Tanni

Hero (556)

صورة Tanni

12-02-2011, 02:18

Ah, forgotten that it will print out the OK prompt, so the program must be modified accordingly.

بواسطة Tanni

Hero (556)

صورة Tanni

12-02-2011, 16:52

ray2day, I've remembered the filename of the data generator program
I've once written back in the 80's and searched the dsk-files I got copied
form my 3.5'' disks in Bussum, so here are some tidbits for you:

Data Generator

Variable ZN denotes Zeilennummer (line number).

This seems to be the oldest and most basic version:

datagen0

10 REM Data Generator
60 REM
100 CLEAR1000:ZN=1000:I=32
110 CLS:BEEP:PRINTI;CHR$(I)
120 PRINT
130 PRINT"....5....1....5....2....5....3....5.."
140 LINEINPUTX$
150 LINEINPUT"comment: ";C$
160 CLS:BEEP:PRINT:PRINT:PRINT
170 PRINTUSING"#### DATA";ZN;
180 IFINSTR(X$,":")=0THENX$=" "+X$ELSEX$=CHR$(34)+X$+CHR$(34)
190 PRINTX$","C$
200 I=I+1
210 ZN=ZN+10
220 PRINT"ZN=";ZN;":i=";I;":GOTO110"
230 LOCATE0,2
240 END

In line 70, key 6 is assigned to a string to easily delete the program
after the job is done, so that only the generated data lines are left.

dtagen

10 REM Data Generator
60 REM
70 'KEY6,"delete10-240"
100 CLEAR1000:ZN=10010
110 CLS:BEEP:PRINT
130 PRINT"....5....1....5....2....5....3....5.."
140 LINEINPUTX$
160 CLS:BEEP:PRINT:PRINT:PRINT
170 PRINTUSING"##### DATA";ZN;
180 X$=CHR$(34)+X$+CHR$(34)
190 PRINTX$
210 ZN=ZN+10
220 PRINT"ZN=";ZN;":GOTO110"
230 LOCATE0,2
240 END

Data Generator to delete trailing blanks

dta-blk

10 REM Datagen zur Entfernung
15 REM von Blank am Zeilenende
20 CLS:CLEAR1000:DEFINT A-Z
50 :
100 ZN=1000
110 CLS:READA$:IFA$="ende"THENEND
120 PRINTA$
130 PRINT
140 :
142 IFRIGHT$(A$,1)=" "THENA$=LEFT$(A$,LEN(A$)-1)
160 :
170 E$=CHR$(34)+A$+CHR$(34)
180 LOCATE0,8
190 PRINTUSING"#### DATA";ZN+4000;
200 PRINTE$
210 :
220 PRINTUSING"####";ZN
230 ZN=ZN+10
240 PRINT"ZN=";ZN;":GOTO110"
250 LOCATE0,7
260 END
990 :
4990 DATA ende

Data Generator for experiment 10 in a Physik practical

datagen (Disk 8)

10 REM Data Generator fr Versuch 10
12 REM Physik II
60 REM
70 'KEY6,"delete10-240"
100 CLEAR1000:ZN=10010
110 CLS:BEEP:PRINT
112 DEFFN F$(S$,L)=SPACE$(L-LEN(S$))+S$
130 PRINT"....5....1....5....2....5....3....5.."
140 LINEINPUT"Einschubtiefe :";E$
141 E$=FN F$(E$,4)
142 LINEINPUT"Strom         :";I$
143 I$=FN F$(I$,6)
144 LINEINPUT"Spannung Cond.:";UC$
145 UC$=FN F$(UC$,6)
146 LINEINPUT"Spannung Spule:";US$
147 USE$=FN F$(US$,6)
160 CLS:BEEP:PRINT:PRINT:PRINT
170 PRINTUSING"##### DATA";ZN;
180 X$=E$+","+I$+","+UC$+","+US$
190 PRINTX$
210 ZN=ZN+10
220 PRINT"ZN=";ZN;":GOTO110"
230 LOCATE0,2
240 END

Data Generator for producing a list of Perry Rhodan novels including sequence number, Author and title.
(There's also a version for Ren Dhark novels.)

dtagenpr

10 CLS:CLEAR1000:SCREEN0:WIDTH40
20 ZN=1010:I=1
30 CLS:DIM AN$(20):
40 ON INTERVAL=9 GOSUB 560
50 :
60 READN$
70 IFN$="^fin"THEN110
80 H=H+1:P=INSTR(N$," ")
90 AN$(H)=MID$(N$,P):GOTO 60
100 :
110 CLS
120 FORY=0TO4
130 FORX=0TO3:H=Y*4+X+1
140 LOCATEX*10,Y:PRINTAN$(H)
150 NEXTX
160 NEXTY
170 X=1:Y=1:H=Y*4+X+1
180 LOCATE1,10:PRINT"Perry-Rhodan-Band Nr.:";I
190 LOCATE17,11:PRINT"Autor: "
200 INTERVAL ON
210 :
220 INTERVALOFF:LOCATE1,6:PRINTUSING"X:# y:# h:##";X,Y,H:INTERVALON
230 Z$=INKEY$
240 IFZ$=CHR$(13)THEN310ELSEH=Y*4+X+1
250 IFZ$=CHR$(&H1C)THENGOSUB490
260 IFZ$=CHR$(&H1D)THENGOSUB500
270 IFZ$=CHR$(&H1E)THENGOSUB520
280 IFZ$=CHR$(&H1F)THENGOSUB540
290 GOTO220
300 :
310 INTERVAL OFF
320 LOCATEX*10,Y:PRINTAN$(H)
330 LOCATE23,11:PRINTAN$(H)
340 :
350 PRINT:PRINT" Titel: ";:LINEINPUTTI$
360 :
370 PRINT:INPUT" alles richtig";Z$:IFZ$="n"THEN110
380 X$=CHR$(34)+RIGHT$("    "+STR$(I),4)+CHR$(H+48)+TI$+CHR$(34)
390 :
400 CLS:PRINT:PRINT:PRINT
410 PRINTUSING"#### DATA";ZN;
420 PRINTX$
430 I=I+1
440 ZN=ZN+10
450 PRINT"CLEAR1000:ZN=";ZN;":i=";I;":GOTO30"
460 LOCATE0,2
470 END
480 :
490 INTERVALOFF:LOCATEX*10,Y:PRINTAN$(H):X=X+1:X=XMOD4:H=Y*4+X+1:INTERVALON:RETURN
500 INTERVALOFF:LOCATEX*10,Y:PRINTAN$(H):X=X-1:IFX<0THENX=3
510 H=Y*4+X+1:INTERVALON:RETURN
520 INTERVALOFF:LOCATEX*10,Y:PRINTAN$(H):Y=Y-1:IFY<0THENY=4
530 H=Y*4+X+1:INTERVALON:RETURN
540 INTERVALOFF:LOCATEX*10,Y:PRINTAN$(H):Y=Y+1:Y=YMOD5:H=Y*4+X+1:INTERVALON:RETURN
550 :
560 IFS=0THENLOCATEX*10,Y:PRINTSPACE$(10)
570 IFS=1THENLOCATEX*10,Y:PRINTAN$(H)
580 S=1-S:RETURN
590 :
600 DATA K.H. Scheer,   Clark Darlton
610 DATA Kurt Mahr,     W.W. Shols
620 DATA Kurt Brand,    William Voltz
630 DATA H.G. Ewers,    Conrad Shepherd
640 DATA Hans Kneifel,  Ernst Vlcek
650 DATA H.G. Francis,  Harvey Patton
660 DATA Peter Terrid,  Marianne Sydow
670 DATA Peter Griese,  Detlev G. Winter
680 DATA Horst Hoffmann
690 DATA"^fin"
700 :
1000 DATA""

بواسطة ray2day

Paladin (752)

صورة ray2day

12-02-2011, 19:05

@JLTurSan & Tanni; This is very useful information. Thanks for the info guys!

صفحة 2/2
1 |