Binary .BIN file not loading correctly.

Page 1/2
| 2

By M2X_E1

Rookie (21)

M2X_E1's picture

23-08-2018, 21:32

Hi Folks,
I've been attempting to create new assembly code to run in the blueMSX emulator. I've created the binary file with the 7 byte header and followed by machine code and popped it onto a disk image using disk manager.
Loading using BLOAD "MYFILE.BIN", R (sometimes without the R) but no luck. The odd thing is that it sometimes loads and in other cases the memory location is filled with 0xFF.

I am attempting to load the file at location 32768 ( 0x8000) and thereabouts as I know this is available ram (or is it? could the MSX bios be overwriting my program once it is loaded?).

looking forward to any ideas and solutions,

Regards

Login or register to post comments

By Manuel

Ascended (15750)

Manuel's picture

23-08-2018, 23:52

Better change the header to make it start at 0xC000. At 0x8000 the BASIC program area starts.

With ,R the program will be started at the specified start address in the header.

Try at 0xC000 and tell us in detail what exactly happens.

By gdx

Prophet (3035)

gdx's picture

24-08-2018, 11:46

You must reserve the area with CLEAR before load a binary file.

Example for a file that starts at &HD000

CLEAR,&HCFFF:BLOAD"NAME",R

By M2X_E1

Rookie (21)

M2X_E1's picture

24-08-2018, 19:26

I should mention my binary file is 26KBytes approx, moving it further up the memory address would probably cause another set of issues. I did however try to cut it down to 16KB and it seems to load ok into the 0x8000 location with a smaller size, I will try 0xC000 on the smaller size, I've a feeling it will probably work, but it still want my 26KB file to be loaded at 0x8000.
does using the clear function prevent the msx from using the memory location for its own variables, or does it just clear the memory?
One other thing i'm thinking is that the page could be getting swapped out somehow and replaced with the blank ram, I'm not overly familiar with the page memory at this stage but i believe to the paging registers are safe away from my program data?

Regards

By gdx

Prophet (3035)

gdx's picture

25-08-2018, 10:37

Look the memory map below:
https://www.msx.org/wiki/The_Memory
BASIC program starts (is loaded) at address specified by the variable BOTTOM (contains 8000h by default on MSXs of 32K or more).
MEMSIZ will tell you the BASIC variable aera. Address of MEMSIZ is changed only by the first parameter of the instruction CLEAR.
Take these parameters into account and your program will work well.

By hit9918

Prophet (2867)

hit9918's picture

25-08-2018, 20:37

move BASIC up, then can use all the space below
autoexec.bas:

10 poke &hf677,&hc4 : poke &hf676,&h01 : poke &hc400,0 'some page3 memory below
20 run"loader.bas"

one needs to run another file because the basic has been moved
loader.bas:

10 '?"set mapper..."
20 out &hfc,3 : out &hfd,2 : out &hfe,1
30 bload"name",r

the OUT make mapped RAM cartridges work on MSX1

By hit9918

Prophet (2867)

hit9918's picture

25-08-2018, 20:53

https://www.msx.org/wiki/The_Memory
the diagram is misleading because it says "free RAM available" but it is BASIC program.

By gdx

Prophet (3035)

gdx's picture

26-08-2018, 02:56

This area is not just for the BASIC program. It the free RAM available in Main-RAM for BASIC program, binary programs or any data. Even some system routines use this area for temporary data (eg PAINT). The BASIC program can be moved as you indicate above to put machine routines and data in the front. We can also put them after the BASIC program or both.

By hit9918

Prophet (2867)

hit9918's picture

26-08-2018, 16:54

10 ?"hello"

poke &h8000,1

run

the SYNTAX ERROR BEEP!

I have used one byte of what the diagram calls "free RAM" and the machine is crashed.
therefore it was no free RAM.

By gdx

Prophet (3035)

gdx's picture

26-08-2018, 17:09

The first byte of the BASIC program must always be 0.

gdx wrote:

Even some system routines use this area for temporary data (eg PAINT).

In fact, I think PAINT uses the stack.

By M2X_E1

Rookie (21)

M2X_E1's picture

29-08-2018, 22:15

hit9918 wrote:
10 ?"hello"

poke &h8000,1

run

the SYNTAX ERROR BEEP!

I have used one byte of what the diagram calls "free RAM" and the machine is crashed.
therefore it was no free RAM.

Fascinating, I Just tried this, putting '1' in this location results in syntax error, returning it to 0 and re-running removes the error, so is actively being used Smile

i'm getting a syntax error when using CLEAR,&HCFFF:BLOAD"NAME",R
I wonder if is possible to tell the msx to use another location after 0x8000 and the 26KB which follows?

Regards

Page 1/2
| 2