Author Topic: Load Address problem * SOLVED *  (Read 5577 times)

0 Members and 1 Guest are viewing this topic.

Offline ervin

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.393
  • Country: au
    • index.php?action=treasury
  • Liked: 1081
  • Likes Given: 1257
Load Address problem * SOLVED *
« on: 03:53, 07 June 12 »
Hi everyone.
 
As I'm developing my game, I'm trying to create regular DSK files in order to test on my 6128.
My game will eventually need a lot of memory, so I'd like to load the BIN file at &200.
 
When I assemble directly to memory inside WinAPE, &200 works nicely.
But when I try to run it from disk, I'm getting a memory full error.
 
I'm using this BAS file to load the BIN file:
 
Code: [Select]
10 MEMORY 511
20 LOAD"cpc.bin",512
30 CALL 512

When I run that code, I get "Memory full in 20".
 
Thanks for any suggestions.
 
[EDIT] Solved!

After a bunch more searching, I found a thread where the solution presented itself (thanks to Axelay).
I'm now able to put an executable BIN file on disk, without faffing around with the BAS file, thanks to this code in WinAPE's assembler window:
 
Code: [Select]
org &200
run &200
write direct "a:may2012.bin"
incbin "c:\ccz80 3.x\chunky pixel collision\may2012\may2012.bin"
« Last Edit: 04:43, 07 June 12 by ervin »
My (cancelled) entry for the CPCRetroDev 2017 Competition http://www.cpcwiki.eu/forum/programming/my-cpcretrodev-2017-entry/
FAST line drawing in CPCtelera http://www.cpcwiki.eu/forum/programming/drawing-lines-with-cpctelera-sdcc/
RUNCPC My entry for the CPCRetroDev 2015 Competition http://www.cpc-power.com/index.php?page=detail&num=12494

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.035
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
  • Liked: 1016
  • Likes Given: 926
Re: Load Address problem * SOLVED *
« Reply #1 on: 13:27, 07 June 12 »
In other cases use:

Code: [Select]
10 OPENOUT"D":MEMORY 511
20 LOAD"cpc.bin",512
30 CALL 512
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.035
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
  • Liked: 1016
  • Likes Given: 926
Re: Load Address problem * SOLVED *
« Reply #2 on: 13:36, 07 June 12 »
It's not always good to use executable binary files.
Especially, when you use Firmware-routines.
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Offline ervin

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.393
  • Country: au
    • index.php?action=treasury
  • Liked: 1081
  • Likes Given: 1257
Re: Load Address problem * SOLVED *
« Reply #3 on: 14:23, 07 June 12 »
In other cases use:

Code: [Select]
10 OPENOUT"D":MEMORY 511
20 LOAD"cpc.bin",512
30 CALL 512

Interesting, I'll give it a go.
Thanks.

I don't know what OPENOUT does, but I'll find out shortly.
My (cancelled) entry for the CPCRetroDev 2017 Competition http://www.cpcwiki.eu/forum/programming/my-cpcretrodev-2017-entry/
FAST line drawing in CPCtelera http://www.cpcwiki.eu/forum/programming/drawing-lines-with-cpctelera-sdcc/
RUNCPC My entry for the CPCRetroDev 2015 Competition http://www.cpc-power.com/index.php?page=detail&num=12494

Offline ervin

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.393
  • Country: au
    • index.php?action=treasury
  • Liked: 1081
  • Likes Given: 1257
Re: Load Address problem * SOLVED *
« Reply #4 on: 14:24, 07 June 12 »
It's not always good to use executable binary files.
Especially, when you use Firmware-routines.

What kind of problems could occur by doing this?
This is all still all quite new to me, so every bit of information helps.  :)
My (cancelled) entry for the CPCRetroDev 2017 Competition http://www.cpcwiki.eu/forum/programming/my-cpcretrodev-2017-entry/
FAST line drawing in CPCtelera http://www.cpcwiki.eu/forum/programming/drawing-lines-with-cpctelera-sdcc/
RUNCPC My entry for the CPCRetroDev 2015 Competition http://www.cpc-power.com/index.php?page=detail&num=12494

Offline arnoldemu

  • Supporter
  • 6128 Plus
  • *
  • Posts: 5.336
  • Country: gb
    • Unofficial Amstrad WWW Resource
  • Liked: 2275
  • Likes Given: 3478
Re: Load Address problem * SOLVED *
« Reply #5 on: 15:12, 07 June 12 »
What kind of problems could occur by doing this?
This is all still all quite new to me, so every bit of information helps.  :)
Unofficial Amstrad WWW Resource

When RUN is done, MC BOOT PROGRAM is called. This calls SOUND RESET, KL CHOKE OFF, KM RESET, TXT RESET, SCR RESET. These reset the current state of the firmware.
In addition it resets the firmware jumpblock, meaning the disc functions are no longer patched in and you have to then re-enable the disc rom to do furthur loading.

If you use basic, everything remains as it is.

My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Offline arnoldemu

  • Supporter
  • 6128 Plus
  • *
  • Posts: 5.336
  • Country: gb
    • Unofficial Amstrad WWW Resource
  • Liked: 2275
  • Likes Given: 3478
Re: Load Address problem * SOLVED *
« Reply #6 on: 15:15, 07 June 12 »
Interesting, I'll give it a go.
Thanks.

I don't know what OPENOUT does, but I'll find out shortly.
Unofficial Amstrad WWW Resource

It effectively allows memory addresses lower than about &1173. In terms of what OPENOUT actually does... not sure exactly but it does effect HIMEM.
The MEMORY command tells BASIC the upper HIMEM value, and where redefineable characters can be.. see the programming thread about basic tips.


My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Offline ervin

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.393
  • Country: au
    • index.php?action=treasury
  • Liked: 1081
  • Likes Given: 1257
Re: Load Address problem * SOLVED *
« Reply #7 on: 01:35, 08 June 12 »
Unofficial Amstrad WWW Resource

When RUN is done, MC BOOT PROGRAM is called. This calls SOUND RESET, KL CHOKE OFF, KM RESET, TXT RESET, SCR RESET. These reset the current state of the firmware.
In addition it resets the firmware jumpblock, meaning the disc functions are no longer patched in and you have to then re-enable the disc rom to do furthur loading.

If you use basic, everything remains as it is.

Excellent - thanks for all the info.
My (cancelled) entry for the CPCRetroDev 2017 Competition http://www.cpcwiki.eu/forum/programming/my-cpcretrodev-2017-entry/
FAST line drawing in CPCtelera http://www.cpcwiki.eu/forum/programming/drawing-lines-with-cpctelera-sdcc/
RUNCPC My entry for the CPCRetroDev 2015 Competition http://www.cpc-power.com/index.php?page=detail&num=12494

Offline ervin

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.393
  • Country: au
    • index.php?action=treasury
  • Liked: 1081
  • Likes Given: 1257
Re: Load Address problem * SOLVED *
« Reply #8 on: 01:36, 08 June 12 »
Unofficial Amstrad WWW Resource

It effectively allows memory addresses lower than about &1173. In terms of what OPENOUT actually does... not sure exactly but it does effect HIMEM.
The MEMORY command tells BASIC the upper HIMEM value, and where redefineable characters can be.. see the programming thread about basic tips.

Thanks again.
Sounds like OPENOUT is the way to go.
My (cancelled) entry for the CPCRetroDev 2017 Competition http://www.cpcwiki.eu/forum/programming/my-cpcretrodev-2017-entry/
FAST line drawing in CPCtelera http://www.cpcwiki.eu/forum/programming/drawing-lines-with-cpctelera-sdcc/
RUNCPC My entry for the CPCRetroDev 2015 Competition http://www.cpc-power.com/index.php?page=detail&num=12494

Offline arnoldemu

  • Supporter
  • 6128 Plus
  • *
  • Posts: 5.336
  • Country: gb
    • Unofficial Amstrad WWW Resource
  • Liked: 2275
  • Likes Given: 3478
Re: Load Address problem * SOLVED *
« Reply #9 on: 11:30, 08 June 12 »
Thanks again.
you are welcome! :)
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Offline Axelay

  • 6128 Plus
  • ******
  • Posts: 586
  • Country: au
  • Liked: 383
  • Likes Given: 87
Re: Load Address problem * SOLVED *
« Reply #10 on: 11:56, 08 June 12 »
Unofficial Amstrad WWW Resource

When RUN is done, MC BOOT PROGRAM is called. This calls SOUND RESET, KL CHOKE OFF, KM RESET, TXT RESET, SCR RESET. These reset the current state of the firmware.
In addition it resets the firmware jumpblock, meaning the disc functions are no longer patched in and you have to then re-enable the disc rom to do furthur loading.

If you use basic, everything remains as it is.


Having to re-enble the the disc rom aside, under what circumstances would any of the rest of it be a problem?  Just wondering as I've been using the first few lines of this for, um, a while.  ;)

Offline SuTeKH/Epyteor

  • 6128 Plus
  • ******
  • Posts: 1.383
  • Country: 00
  • Liked: 1295
  • Likes Given: 2031
Re: Load Address problem * SOLVED *
« Reply #11 on: 12:17, 08 June 12 »
I beginning to get a little concerned, too. I have always started my "programs" with the following;

Code: [Select]
ORG &xxxx

 LD HL,(&BE7D)
 LD A,(HL)
 LD (Disk_Drive+1),A

 LD C,&FF
 LD HL,Restart_ROMs
 CALL &BD16

.Restart_ROMs
 CALL &BB57
 CALL &BCCB
 CALL &BB54

.Disk_Drive
 LD A,0
 LD HL,(&BE7D)
 LD (HL),A

Is there some other code that's required to make sure .BIN files run without any unforseen errors?

Offline arnoldemu

  • Supporter
  • 6128 Plus
  • *
  • Posts: 5.336
  • Country: gb
    • Unofficial Amstrad WWW Resource
  • Liked: 2275
  • Likes Given: 3478
Re: Load Address problem * SOLVED *
« Reply #12 on: 15:12, 08 June 12 »
I beginning to get a little concerned, too. I have always started my "programs" with the following;

Code: [Select]
ORG &xxxx

 LD HL,(&BE7D)
 LD A,(HL)
 LD (Disk_Drive+1),A

 LD C,&FF
 LD HL,Restart_ROMs
 CALL &BD16

.Restart_ROMs
 CALL &BB57
 CALL &BCCB
 CALL &BB54

.Disk_Drive
 LD A,0
 LD HL,(&BE7D)
 LD (HL),A

Is there some other code that's required to make sure .BIN files run without any unforseen errors?
that seems ok to me and it's what I have done in the past.
You're reenabling all roms so that should be ok, because they will all patch firmware. So I think it's ok.


My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Offline SyX

  • 6128 Plus
  • ******
  • Posts: 1.129
  • Country: br
  • Liked: 1121
  • Likes Given: 1871
Re: Load Address problem * SOLVED *
« Reply #13 on: 16:15, 08 June 12 »
I use that method too, and i prefer to reinitialize all the roms, instead of only the rom 7, because i have ParaDOS in the rom position 6.

Offline arnoldemu

  • Supporter
  • 6128 Plus
  • *
  • Posts: 5.336
  • Country: gb
    • Unofficial Amstrad WWW Resource
  • Liked: 2275
  • Likes Given: 3478
Re: Load Address problem * SOLVED *
« Reply #14 on: 19:56, 08 June 12 »

Having to re-enble the the disc rom aside, under what circumstances would any of the rest of it be a problem?  Just wondering as I've been using the first few lines of this for, um, a while.  ;)
well, the only problem I could see is if you wanted the program to be runnable from alternative media (harddrive, cpcsd) as these would patch into the load routines to allow amsdos to load data.

So if you initialise just the disc rom you are missing out on this, in addition you are missing out on using extended formats (parados).

The loader code in that example allows loading from extended formats and which ever drive it was run from which is also nice. it's really annoying when a loader forces loading from drive a for example.

Generally, other patching (such as making the firmware use 6 pixel wide font for example) may not be preferable to you, so resetting stuff like this is ok so you ensure you get the firmware as you expect.


generally the main problem of running a binary program from basic is the well known one - disc loading is not activated and you must do it yourself to continue loading.

My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Offline SuTeKH/Epyteor

  • 6128 Plus
  • ******
  • Posts: 1.383
  • Country: 00
  • Liked: 1295
  • Likes Given: 2031
Re: Load Address problem * SOLVED *
« Reply #15 on: 09:55, 09 June 12 »
Just to clarify; am I right in saying that if you do not wish to load anything else (ie, a single file program), you do not really need to reset the ROMs at the beginning of the program? Most normal Firmware functions (MODE, INK, etc) will still work as documented!

I use that method too, and i prefer to reinitialize all the roms, instead of only the rom 7, because i have ParaDOS in the rom position 6.
That code I posted was, after all, your code... like 90% of the stuff I do! ^_^ The other 10% is from arnoldemu, axelay, redbox and many others here!

Offline Axelay

  • 6128 Plus
  • ******
  • Posts: 586
  • Country: au
  • Liked: 383
  • Likes Given: 87
Re: Load Address problem * SOLVED *
« Reply #16 on: 11:14, 09 June 12 »
well, the only problem I could see is if you wanted the program to be runnable from alternative media (harddrive, cpcsd) as these would patch into the load routines to allow amsdos to load data.

So if you initialise just the disc rom you are missing out on this, in addition you are missing out on using extended formats (parados).

The loader code in that example allows loading from extended formats and which ever drive it was run from which is also nice. it's really annoying when a loader forces loading from drive a for example.

Generally, other patching (such as making the firmware use 6 pixel wide font for example) may not be preferable to you, so resetting stuff like this is ok so you ensure you get the firmware as you expect.


generally the main problem of running a binary program from basic is the well known one - disc loading is not activated and you must do it yourself to continue loading.





Thanks for the explanation.  Booting from either A or B is the main reason I use that bit of source, because I find only working from the A drive pretty annoying too.  :)


Nothing I've released has left the firmware in place though, that's why I only initialise the disk ROM, and any ROMs I wanted to use would need to be supported specifically in the code.  Sometimes I need to remove the firmware before I've finished loading too, so supporting a variety of media that needs to patch the firmware load routines would seem to become pretty messy.  But in future I'll try and produce CPCSD compatible versions where that's the case because the driver on PushNPop looked pretty straight forward, though from what I can tell there's a file format that's still a WIP at this point.

Offline dragon

  • 6128 Plus
  • ******
  • Posts: 1.499
  • Country: es
  • Liked: 654
  • Likes Given: 495
Re: Load Address problem * SOLVED *
« Reply #17 on: 15:08, 26 January 16 »
up!

In other cases use:

Code: [Select]
10 OPENOUT"D":MEMORY 511
20 LOAD"cpc.bin",512
30 CALL 512

An what happend if your search load a cpc.bin  out of range of memory instruction?

Example: 10 OPENOUT "D": MEMORY  &6D ->returns memory full.
                20 LOAD"cpc.bin",&6E
                30 rem "I don't want run it", only store it at &6E.

Impossible from basic?. So the only way is execute the .bin in &4000 for example and made a ldir to copy the code  to &6e?

Offline Ast

  • 6128 Plus
  • ******
  • Posts: 1.101
  • Country: fr
    • Amstrad cpc Website of Ast/iMPACT
  • Liked: 1001
  • Likes Given: 741
Re: Load Address problem * SOLVED *
« Reply #18 on: 15:33, 26 January 16 »
Or make a bin loader ... Better way to load this kind of file....
Or use the arkos rom which allows to use ├╣ld,"my file.bin",&6e
But it's an other story, isn't it ?
_____________________

Ast/iMP4CT. "By the power of Grayskull, i've the power"


Amstrad Plus French Forum

All friends are welcomed !