News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_Bryce

Best Emulator with assembly code editor.

Started by Bryce, 12:10, 31 May 14

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Bryce

Hi All,
     I'm writing some assembly code on a real CPC with Maxam, but I want to continue writing it on my laptop when I'm not at home. As I don't normally use emulators at all, which Emulator would you recommend for editing/testing assembly code? And do I need any other software tools installed to write/test the code?

Bryce.

Devilmarkus

WinCPC, WinApe and also JavaCPC have an integrated assembler code editor and compiler.

Usually you don't need anything else.
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

Bryce

Quote from: Devilmarkus on 12:22, 31 May 14
WinCPC, WinApe and also JavaCPC have an integrated assembler code editor and compiler.

Usually you don't need anything else.

Ok, I've installed WinApe for now. For JavaCPC I need to be online don't I? Not that useful for me as I intend to use it on long flights.

Bryce.

Devilmarkus

No need to be online when you use JavaCPC... Who told that? :D
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

redbox

If you've been using Maxam then I'd recommend using the inbuilt WinAPE assembler as the syntax is the same.

However, it's a good idea to use an external text editor along with WinAPE, such as PSPad or Notepad++. There is a guide for this on Grim's website.

Gryzor

I think Bryce is confusing JavaCPC (the stand-alone emulator/suite) with WebCPC (which is the applet that runs on sites)...

ralferoo

I find the editor in WinAPE pretty much unusable, although you might get away by following Grim's guide (linked above). But the editor... No undo and control keys usually just insert a literal control character into the source! So, if you select a block and accidentally delete something (e.g. pressing C rather than ctrl-C for copy), there's no way to revert the delete. It's crazy!

The editor in WinCPC is more sane, but still very "unusual". It insists on auto-tabbing for you at a seeming random indent level but at least undo works, so there's little damage you can do! You can't really follow Grim's guide for this though - as soon as the file is open in the editor (e.g. clicking on an error), it'll use that copy in preference the disk version and you need to close the window to get it to forget the file.

Devilmarkus

AFAIK, Richard is working at the code editor in WinApe...
So, I'm sure, those things like undo etc will work soon...
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

AMSDOS

Quote from: ralferoo on 20:02, 31 May 14
I find the editor in WinAPE pretty much unusable, although you might get away by following Grim's guide (linked above). But the editor... No undo and control keys usually just insert a literal control character into the source! So, if you select a block and accidentally delete something (e.g. pressing C rather than ctrl-C for copy), there's no way to revert the delete. It's crazy!


I usually just stick it in from Notepad if I want to protect it, or use comments ";;" to take out lines without taking them out.
* 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

Prodatron

#9
I use WinApe for developing Z80 software for more than 13 years (not only CPC but also MSX and more platforms). After all this time its still the best for developing and debugging IMHO. It doesnt make sense to use the editor for writing code, as specialized tools like Notepad++ will always be better (I am still in love with UltraEdit). But the editor is great to hold and remember my "make" files, which mostly contain different "includes" (like Grim described it), writes and global definitions.

CU,
Prodatron

GRAPHICAL Z80 MULTITASKING OPERATING SYSTEM

Bryce

Thanks for all the tips. Actually I usually do all the typing in Windows editor and just copy the code over to test it, so the perculiaralities of the editors won't bother me too much, main thing is that I have a method of editing and testing CPC Z80 ASM on my laptop. However, certain parts of the code depend on an expansion being connected to the CPC, so I can't test those bits until I'm back at a real CPC.

@Markus: Although I've tried out JavaCPC several times, it was always on a PC that was permanently connected to the interwebs, so I was under the impression that it needed the connection for certain things.

Bryce.

Targhan

I wrote an article about using Winape for viewing/debugging and any other editor for assembling/generating DSK and SNA (windows only). The focus is on PSPad, which is free and great. Here is the link.

Targhan/Arkos

Arkos Tracker 2.0.1 now released! - Follow the news on Twitter!
Disark - A cross-platform Z80 disassembler/source converter
FDC Tool 1.1 - Read Amsdos files without the system

Imperial Mahjong
Orion Prime

Bryce

I've been trying out WinApe for a few hours and actually I find the editor ok. Haven't found anything I didn't like so far, so I'll stick with that for now.

Bryce.

redbox

Quote from: Bryce on 21:08, 02 June 14
I've been trying out WinApe for a few hours and actually I find the editor ok. Haven't found anything I didn't like so far, so I'll stick with that for now.

Wait until you've not saved for a while, deleted something you've highlighted by accident and then find you can't undo (or CTRL-Z).

Trust me, you will cry.  A lot.

PSPad or similar has another benefit in that you can create a "project" which essentially is a tree of files.  This is great for having sub-routines separated from the main loop and you can just read them in from your "main.asm" file.


Bryce

My learning curve hasn't got that far yet :D At the moment I'm still just experimenting with simple routines, we're not talking 3D game / major demo here, it's more on the "print a few characters" level. Although I've programmed PICs / AVRs for years, I've never programmed a CPC or Z80. I learnt on a 6800 at uni, but that's not exactly yesterday, I replaced that grey matter with beer and party shortly afterwards.

Bryce.

Prodatron

I guess it has nothing to do with your Z80 skills, how to use WinApe in the perfect way for developing ;)
Using "make" files in WinApe and editing the real code in an independant editor does much more sense. Just a small example:


nolist
'SymbOS MSX mass storage device driver for
'MegaSD compatible SD[xc] card reader (OCM and MegaFlashRomSCC+SD)
write "..\..\..\msx\-SDMEGA.DRV"
READ "..\SymbOS-File-Const.asm"
READ "Drv-SDMega.asm"


This is what I load into the WinApe editor. It will be recognized on every start of WinApe, and I never need to change it again.
The real code is "Drv-SDMega.asm", and that is what I am editing in UltraEdit.
IMHO that's the best way to develop Z80 stuff today.

GRAPHICAL Z80 MULTITASKING OPERATING SYSTEM

Bryce

That's an interesting solution, I'll try that out too.

Bryce.

redbox

Quote from: Bryce on 08:27, 03 June 14
That's an interesting solution, I'll try that out too.

It's the same as using a WinAPE wrapper (like Grim shows you), just a different name for it  ;)

Bryce

Grim?

I'm now looking for "Best practices" for CPC Machine Code. The commands and methods are all familiar to me, but I still have questions such as:

What registers are normally used for simple loops (for both <256 cycles and >256 cycles).

On a PIC I assign RAM to use as variables/Flags like this: Var1 equ &FF. What part of the CPCs RAM should I use for things like this?
I'm also looking for information on passing values from MC to a BASIC variable if anyone can point me to that.

Bryce.

redbox

Quote from: Bryce on 10:42, 03 June 14
Grim?

The guide I linked to in my earlier post: documentations:software:winape:start [Grimware]

Quote from: Bryce on 10:42, 03 June 14
What registers are normally used for simple loops (for both <256 cycles and >256 cycles).

8-bit loop (<256):


   ld b,16
loop:
   ... do something ...
   djnz loop


16-bit loop (>256 and <65535):


    ld de,1634
loop:
   ... do something ...
   dec de
   ld a,d
   or e
   jp nz,loop


Quote from: Bryce on 10:42, 03 June 14
On a PIC I assign RAM to use as variables/Flags like this: Var1 equ &FF. What part of the CPCs RAM should I use for things like this?

If it is static, you can declare it the same as you do with the PIC.

If it changes, you can store it anywhere in RAM along side your code (but leave it outside of routines, for example after the RET otherwise the Z80 will try and execute it) and use a pointer.  For example:


8-bit:

   ld a,(my_variable)
   inc a
   ld (my_variable),a
   ret

my_variable:
   defb 32

16-bit
   ld hl,(my_variable)
   inc hl
   ld (my_variable),hl
   ret

my_variable:
   defw &3024


You can also use the pointers to access arrays, for example:


   ld hl,my_array
loop:
   ld a,(hl)
   ... a now holds 1st element in array
   inc hl
   jr loop

my_array
   defb 32,55,99,22,59 ...


Quote from: Bryce on 10:42, 03 June 14
I'm also looking for information on passing values from MC to a BASIC variable if anyone can point me to that.

Do you want to pass the values from RSXs in your ROM or just back to BASIC...?

Bryce

The software is running from ROM, so DEFB or DEFW doesn't work within the code.

I want my RSX to create a string of characters which can then be found in BASIC. For example:

10 A$=81
20 |Sqroot, A$ (Where A$ then contains the result)
30 Print A$ (Would result in 9 being printed)

Bryce.

Btw: I found one rather annoying thing on WinApe. When I have my ROM installed and I change the contents (ie: made changes and re-compile), a reset will not give me the new ROM, I have to exit and restart WinApe before it uses the new file.

redbox

Quote from: Bryce on 13:34, 03 June 14
The software is running from ROM, so DEFB or DEFW doesn't work within the code.

Reserve the amount of bytes you want to 'steal' from the CPC's RAM during your ROMs initalisation.

For example:


   push de
   push hl
   ld hl,InitMessage
   call PrintString
   pop hl
   pop de
   and a
   ld bc,4   ; take 4 bytes of CPC RAM
   sbc hl,bc
   scf
   ret


You can then access this RAM by using the IX/IY registers which point to it's location.  Examples here: Technical information about Locomotive BASIC - CPCWiki

Bryce

Yes, I've done that, but how do I get that data to a string?

Bryce.

redbox

Quote from: Bryce on 14:12, 03 June 14
Yes, I've done that, but how do I get that data to a string?

It's there in the Wiki article I linked:

"With the help of the variable container "@" it is also possible to get a result from an invoked mc-code back to basic. In this case the param contains the address of the integer,   floating point or string. You can modify these to give the result. BASIC allocates the strings, so when you modify a string, do not write more characters than the original string."

So instead of using a$, you use the container and it becomes @a$.

Bryce

Yes, I read that but didn't fully understand how that works. I think I need to try it out.

Bryce.

Powered by SMFPacks Menu Editor Mod