CPCWiki forum

General Category => Programming => Topic started by: tony on 20:54, 18 July 09

Title: ASM 2 BIN
Post by: tony on 20:54, 18 July 09
I'm using WinApe and I'm using the built in assembler.  My code assembles and runs okay.
Can some one advice me on how I now turn my .asm to a .bin file?  I cannot seem to find a reference on how to do this (even using Maxam, it is not clear)
Am I missing a newbie trick here?
Title: Re: ASM 2 BIN
Post by: Ynot.zer0 on 21:59, 18 July 09
(typical, as soon as I post I find a reference)  :-[
All I have to do is make the first line of the ASM to read:
write "output.bin"
is that correct?
Title: Re: ASM 2 BIN
Post by: Grim on 00:11, 19 July 09
That's correct but the binary file will be saved on your PC hard drive. You will have to copy it into a DSK image in order to use it within WinAPE (But you can do that with WinAPE too, just select a DSK for Drive A, press SHIFT+CTRL+F1 to open the Disc Editor window, check the box to Add/Remove AMSDOS headers then drag'n'drop your file in the window, and that's it, phew... :).

You can also assemble directly into the emulated CPC memory and save your binary from BASIC with something like this (assuming you're not compiling your program into the reserved Firmware areas):
Code: [Select]
SAVE"FILENAME",b,<start address of your program>,<lenght of your program in byte>[,<execution address>]The <execution address> allow you to execute your program with a RUN"FILENAME, otherwise you will have to LOAD it from BASIC and CALL it manually.
Title: Re: ASM 2 BIN
Post by: Axelay on 07:12, 19 July 09
If you want it on a CPC disk image rather than the PC hard drive you can also use the following as the first three lines in your asm file:

org &8000
run &8000
write direct "a:output.bin"

which will give you a file called "output.bin" on the disk image in drive A with load & execution addresses of &8000