News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_redbox

WinApe assembler

Started by redbox, 10:03, 06 June 11

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

redbox

Is there anyway to assemble something in WinApe and then have just execute straight away in the emulator?

I'm want to use all the CPC's memory (and disable firmware etc) so don't want to have to CALL it from basic - I just want it to run it.


Also, can anyone recommend a way of turning data in memory into assembler DEFBs (e.g. graphical data) so it can easily be relocated?

Any ideas?

Axelay

Just use something like this at the beginning of your code:


org &4000
nolist
run start

; etc

start:



and hit F9 in the editor to have it assemble and execute.

redbox

That's great, thanks Axelay.


Any ideas on turning data into assembler DEFB/DEFWs?

AMSDOS

Quote from: redbox on 10:03, 06 June 11

Also, can anyone recommend a way of turning data in memory into assembler DEFBs (e.g. graphical data) so it can easily be relocated?

I could probably knock up a BASIC program (if that's sufficent) that would take data somewhere in memory and put it into DEFB statements which would saving it to text file.
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

arnoldemu

Quote from: redbox on 10:52, 06 June 11
That's great, thanks Axelay.


Any ideas on turning data into assembler DEFB/DEFWs?
I made a tool to do that on the pc.

"datamaker.exe"

http://www.cpctech.org.uk/tools.7z

download this... there are some other useful ones in here including my gfx converter (converts 16 colour bitmap to various formats)... I'll post info about how to use this later if your interested (it takes a command file, a bitmap image, and outputs palette and binary data).

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

redbox

Quote from: arnoldemu on 11:03, 06 June 11
"datamaker.exe"


That's cool, thanks.  When I use it in the command prompt, it outputs the DEFBs onto the screen.  How do I then copy and paste this, or can it also output to a text file?



Quote from: CP/M User on 10:57, 06 June 11
I could probably knock up a BASIC program (if that's sufficent) that would take data somewhere in memory and put it into DEFB statements which would saving it to text file.


That's also a good idea, always nice to have CPC based utilities.  I guess a BASIC program that PEEKs the memory, spools it into a string and then outputs to a file would do it?

arnoldemu

Quote from: redbox on 11:54, 06 June 11

That's cool, thanks.  When I use it in the command prompt, it outputs the DEFBs onto the screen.  How do I then copy and paste this, or can it also output to a text file?

datamaker file.bin >file.asm


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

redbox

Quote from: arnoldemu on 12:04, 06 June 11
datamaker file.bin >file.asm


Superb.  Thanks, this will be a great help.

AMSDOS

#8
Quote from: redbox on 11:54, 06 June 11

That's also a good idea, always nice to have CPC based utilities.  I guess a BASIC program that PEEKs the memory, spools it into a string and then outputs to a file would do it?

It's merely as straightforward as a Data Maker. AA had a couple of these programs in Type-Ins one was in AA50 the other in AA56 (which was more comprehensive), which would simply take your compiled assembly and put them into BASIC M/C. All you'd really need to change is the DATA to DEFB, eliminate the Line numbering & M/C loader and make it so one row represents one line of the graphic.

I'll probably do one myself shortly cause I've got a couple of programs which save data straight to binary files which may possibly come in real handy in that format.
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

redbox

Quote from: CP/M User on 08:27, 07 June 11
I'll probably do one myself shortly cause I've got a couple of programs which save data straight to binary files which may possibly come in real handy in that format.


Do let me know if you make one, I'd like a copy.

AMSDOS

Quote from: redbox on 11:36, 07 June 11

Do let me know if you make one, I'd like a copy.

Well this is what I came up with:

10 CLS:INK 0,0:INK 1,13: BORDER 0:xbit=0: ybit=0
20 INPUT"Start Address: ";saddr
30 INPUT"Length: ";length
40 INPUT"Filename (incl. extension): ";filename$
50 MEMORY saddr-1
60 LOAD filename$,saddr
70 INPUT"Save file as (no extension required): ";filename2$
80 OPENOUT filename2$+".dat"
90 INPUT"Enter name of Label Data (e.g. sprite1, rocket, alien): ";namlabel$
100 ylabel=PEEK(saddr):xlabel=PEEK(saddr+1):endadr=saddr+length
110 PRINT#9,"ylabel: defb &";HEX$(ylabel)
120 PRINT#9,"xlabel: defb &";HEX$(xlabel)
130 PRINT#9
140 PRINT#9,namlabel$
150 PRINT#9
160 begin=saddr+2:PRINT#9,"defb &";:FOR loop=begin TO endadr
170 PRINT#9,HEX$(PEEK(begin),2);
180 begin=begin+1:xbit=xbit+1:IF loop<>endaddr AND xbit<>xlabel THEN PRINT#9,", &";
190 IF xbit=xlabel THEN PRINT#9:PRINT#9,"defb &";:xbit=0
200 NEXT loop
210 CLOSEOUT


which simply asks you what the start address & length is, prompts for a file and asks for a filename to save that as and finally it asks for a name to label the data. This program is quite handy if you're using Sean McManus' Sprite Defining routine cause that program has some additional information about the Sprite which is what I've put under xlabel & ylabel labels. x relating to the number of bytes across the sprite is and y relating to how many lines. In this example I've used those labels to define how the information is to be shown, will have to test this on a wider sprite to see it works alright though I suspect it will. The funny bit in this program is the length, cause it asks for it you really need to make sure you've allowed enough bytes so your sprite doesn't get cut off midway through. I've just found a simple routine (only works on binary files) which will collect the header information (start address & length of the file) which would eliminate that fuss. In the meantime, this is what I've done.
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

redbox

Quote from: CP/M User on 12:43, 08 June 11
Well this is what I came up with:

That's cool, very nice to have a CPC version.  Will transfer it to my Plus and have quite a few uses for it, thanks!

AMSDOS

Quote from: redbox on 20:41, 09 June 11
That's cool, very nice to have a CPC version.  Will transfer it to my Plus and have quite a few uses for it, thanks!

I'll see if I can knock up something more generic so it can read a file of a sprite or something (that's been saved using TUSS or whatever) and just ask for the width, the height would be based on the length of the file, so once the width is known it should be known how many lines to put into defb statements (if that makes sense).

At the moment I've got this other Sprite Editor program from AA43 (by Pat McDonald) which is really good in some ways and awful in other ways, the Sprite Editor itself is quite handy for coming up with large images and was thinking of setting up an array which would store the pen inks and save that information into that format.
* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

Executioner

To turn data into DB's from WinAPE, either define a Data Area and disassemble the memory, or use the copy and paste from the graphics editor if it's graphics.

Powered by SMFPacks Menu Editor Mod