CPCWiki forum

General Category => Programming => Topic started by: SkulleateR on 12:13, 27 May 21

Title: Write BIN file to DSK
Post by: SkulleateR on 12:13, 27 May 21
Ok, I'm doing some testing here in ASM but I cannot write a BIN file to DSK it seems ....


The code is very simple :



org &4000
ld a,99
ld (&4FFF),a
ret



So, if I assemble it, everythings fine, I can also call it from basic and execute it, but I cannot write the bin file on the DSK ... what I tried :


1.) put a WRITE"B:TEST.BIN" in the asm code
2.) assemble it and in basic do a SAVE"B:TEST.BIN",B,&4000


Now if I try to load it from disk it ALWAYS gives me "Memory Full" Error ??? Help ...

Title: Re: Write BIN file to DSK
Post by: arnolde on 12:16, 27 May 21
Yes, you have to tell Basic first to make space for your binary by typing
MEMORY &3FFF
(3FFF being destination of bin - 1)
Title: Re: Write BIN file to DSK
Post by: arnolde on 12:21, 27 May 21

But I just realized that your problem occurs when saving the bin. And that's because you have to specify the size of your program. In your case, I guess it's 6 bytes, so:
SAVE"B:TEST.BIN",B,&4000,6

(The "memory" bit is what you will need when loading...)
Title: Re: Write BIN file to DSK
Post by: SkulleateR on 12:38, 27 May 21
Quote from: arnolde on 12:16, 27 May 21
Yes, you have to tell Basic first to make space for your binary by typing
MEMORY &3FFF
(3FFF being destination of bin - 1)


Thx, got nearly no sleep for 3 days now, guess my brain already begins to melt  :picard: :picard: :picard:


QuoteBut I just realized that your problem occurs when saving the bin. And that's because you have to specify the size of your program. In your case, I guess it's 6 bytes, so:SAVE"B:TEST.BIN",B,&4000,6(The "memory" bit is what you will need when loading...)


Yes, did that, just forgot to post it above .... but anyway -> SOLVED  :laugh:
Powered by SMFPacks Menu Editor Mod