Author Topic: WinApe assembler  (Read 3832 times)

0 Members and 1 Guest are viewing this topic.

Offline redbox

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.751
  • Country: gb
    • redbox
  • Liked: 326
  • Likes Given: 267
WinApe assembler
« on: 12:03, 06 June 11 »
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?
« Last Edit: 12:06, 06 June 11 by redbox »

Offline Axelay

  • 6128 Plus
  • ******
  • Posts: 579
  • Country: au
  • Liked: 375
  • Likes Given: 87
Re: WinApe assembler
« Reply #1 on: 12:15, 06 June 11 »
Just use something like this at the beginning of your code:


Code: [Select]
org &4000
nolist
run start

; etc

start:


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

Offline redbox

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.751
  • Country: gb
    • redbox
  • Liked: 326
  • Likes Given: 267
Re: WinApe assembler
« Reply #2 on: 12:52, 06 June 11 »
That's great, thanks Axelay.


Any ideas on turning data into assembler DEFB/DEFWs?

Offline AMSDOS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 3.893
  • Country: au
    • index.php?action=treasury
    • Programs for Turbo Pascal 3
  • Liked: 1104
  • Likes Given: 1871
Re: WinApe assembler
« Reply #3 on: 12:57, 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

Offline arnoldemu

  • Supporter
  • 6128 Plus
  • *
  • Posts: 5.336
  • Country: gb
    • Unofficial Amstrad WWW Resource
  • Liked: 2274
  • Likes Given: 3478
Re: WinApe assembler
« Reply #4 on: 13:03, 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

Offline redbox

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.751
  • Country: gb
    • redbox
  • Liked: 326
  • Likes Given: 267
Re: WinApe assembler
« Reply #5 on: 13:54, 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?



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?

Offline arnoldemu

  • Supporter
  • 6128 Plus
  • *
  • Posts: 5.336
  • Country: gb
    • Unofficial Amstrad WWW Resource
  • Liked: 2274
  • Likes Given: 3478
Re: WinApe assembler
« Reply #6 on: 14:04, 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

Offline redbox

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.751
  • Country: gb
    • redbox
  • Liked: 326
  • Likes Given: 267
Re: WinApe assembler
« Reply #7 on: 14:31, 06 June 11 »
datamaker file.bin >file.asm


Superb.  Thanks, this will be a great help.

Offline AMSDOS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 3.893
  • Country: au
    • index.php?action=treasury
    • Programs for Turbo Pascal 3
  • Liked: 1104
  • Likes Given: 1871
Re: WinApe assembler
« Reply #8 on: 10:27, 07 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.
« Last Edit: 10:31, 07 June 11 by CP/M User »
* 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

Offline redbox

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.751
  • Country: gb
    • redbox
  • Liked: 326
  • Likes Given: 267
Re: WinApe assembler
« Reply #9 on: 13:36, 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.

Offline AMSDOS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 3.893
  • Country: au
    • index.php?action=treasury
    • Programs for Turbo Pascal 3
  • Liked: 1104
  • Likes Given: 1871
Re: WinApe assembler
« Reply #10 on: 14:43, 08 June 11 »

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

Well this is what I came up with:
 
Code: [Select]
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

Offline redbox

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.751
  • Country: gb
    • redbox
  • Liked: 326
  • Likes Given: 267
Re: WinApe assembler
« Reply #11 on: 22:41, 09 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!

Offline AMSDOS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 3.893
  • Country: au
    • index.php?action=treasury
    • Programs for Turbo Pascal 3
  • Liked: 1104
  • Likes Given: 1871
Re: WinApe assembler
« Reply #12 on: 11:12, 11 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

Offline Executioner

  • Supporter
  • 6128 Plus
  • *
  • Posts: 783
  • Country: au
  • WinAPE Developer
    • WinAPE
  • Liked: 391
  • Likes Given: 60
Re: WinApe assembler
« Reply #13 on: 03:59, 13 June 11 »
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.