Author Topic: Best Emulator with assembly code editor.  (Read 6333 times)

0 Members and 1 Guest are viewing this topic.

Offline Bryce

  • The Hardware Guy.
  • Supporter
  • 6128 Plus
  • *
  • Posts: 11.721
  • Country: wf
  • It's not broken, it just hasn't been fixed yet.
    • index.php?action=treasury
  • Liked: 4219
  • Likes Given: 444
Best Emulator with assembly code editor.
« on: 14:10, 31 May 14 »
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.

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.035
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
  • Liked: 1016
  • Likes Given: 926
Re: Best Emulator with assembly code editor.
« Reply #1 on: 14:22, 31 May 14 »
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

Offline Bryce

  • The Hardware Guy.
  • Supporter
  • 6128 Plus
  • *
  • Posts: 11.721
  • Country: wf
  • It's not broken, it just hasn't been fixed yet.
    • index.php?action=treasury
  • Liked: 4219
  • Likes Given: 444
Re: Best Emulator with assembly code editor.
« Reply #2 on: 14:34, 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.

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.035
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
  • Liked: 1016
  • Likes Given: 926
Re: Best Emulator with assembly code editor.
« Reply #3 on: 15:59, 31 May 14 »
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

Offline redbox

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.751
  • Country: gb
    • redbox
  • Liked: 326
  • Likes Given: 267
Re: Best Emulator with assembly code editor.
« Reply #4 on: 16:12, 31 May 14 »
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
Grim's website.

Offline Gryzor

  • Administrator
  • 6128 Plus
  • *****
  • Posts: 15.930
  • Country: gr
  • CPC-Wiki maintainer
    • CPCWiki
  • Liked: 3408
  • Likes Given: 6115
Re: Best Emulator with assembly code editor.
« Reply #5 on: 19:30, 31 May 14 »
I think Bryce is confusing JavaCPC (the stand-alone emulator/suite) with WebCPC (which is the applet that runs on sites)...

Offline ralferoo

  • Supporter
  • 6128 Plus
  • *
  • Posts: 969
  • Country: gb
  • Liked: 583
  • Likes Given: 222
Re: Best Emulator with assembly code editor.
« Reply #6 on: 22: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!

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.

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.035
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
  • Liked: 1016
  • Likes Given: 926
Re: Best Emulator with assembly code editor.
« Reply #7 on: 00:25, 01 June 14 »
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

Offline AMSDOS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 3.891
  • Country: au
    • index.php?action=treasury
    • Programs for Turbo Pascal 3
  • Liked: 1104
  • Likes Given: 1864
Re: Best Emulator with assembly code editor.
« Reply #8 on: 00:54, 01 June 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

Offline Prodatron

  • 6128 Plus
  • ******
  • Posts: 832
  • Country: de
  • Back on the Z80
    • index.php?action=treasury
    • SymbOS SYmbiosis Multitasking Based Operating System
  • Liked: 1059
  • Likes Given: 556
Re: Best Emulator with assembly code editor.
« Reply #9 on: 14:30, 01 June 14 »
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
« Last Edit: 14:33, 01 June 14 by Prodatron »

GRAPHICAL Z80 MULTITASKING OPERATING SYSTEM

Offline Bryce

  • The Hardware Guy.
  • Supporter
  • 6128 Plus
  • *
  • Posts: 11.721
  • Country: wf
  • It's not broken, it just hasn't been fixed yet.
    • index.php?action=treasury
  • Liked: 4219
  • Likes Given: 444
Re: Best Emulator with assembly code editor.
« Reply #10 on: 21:37, 01 June 14 »
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.

Offline Targhan

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.140
  • Country: fr
  • Liked: 1078
  • Likes Given: 155
Re: Best Emulator with assembly code editor.
« Reply #11 on: 21:21, 02 June 14 »
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 - alpha 9 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

Offline Bryce

  • The Hardware Guy.
  • Supporter
  • 6128 Plus
  • *
  • Posts: 11.721
  • Country: wf
  • It's not broken, it just hasn't been fixed yet.
    • index.php?action=treasury
  • Liked: 4219
  • Likes Given: 444
Re: Best Emulator with assembly code editor.
« Reply #12 on: 23: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.

Bryce.

Offline redbox

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.751
  • Country: gb
    • redbox
  • Liked: 326
  • Likes Given: 267
Re: Best Emulator with assembly code editor.
« Reply #13 on: 00:23, 03 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.


Offline Bryce

  • The Hardware Guy.
  • Supporter
  • 6128 Plus
  • *
  • Posts: 11.721
  • Country: wf
  • It's not broken, it just hasn't been fixed yet.
    • index.php?action=treasury
  • Liked: 4219
  • Likes Given: 444
Re: Best Emulator with assembly code editor.
« Reply #14 on: 00:45, 03 June 14 »
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.

Offline Prodatron

  • 6128 Plus
  • ******
  • Posts: 832
  • Country: de
  • Back on the Z80
    • index.php?action=treasury
    • SymbOS SYmbiosis Multitasking Based Operating System
  • Liked: 1059
  • Likes Given: 556
Re: Best Emulator with assembly code editor.
« Reply #15 on: 00:58, 03 June 14 »
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:

Code: [Select]
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

Offline Bryce

  • The Hardware Guy.
  • Supporter
  • 6128 Plus
  • *
  • Posts: 11.721
  • Country: wf
  • It's not broken, it just hasn't been fixed yet.
    • index.php?action=treasury
  • Liked: 4219
  • Likes Given: 444
Re: Best Emulator with assembly code editor.
« Reply #16 on: 10:27, 03 June 14 »
That's an interesting solution, I'll try that out too.

Bryce.

Offline redbox

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.751
  • Country: gb
    • redbox
  • Liked: 326
  • Likes Given: 267
Re: Best Emulator with assembly code editor.
« Reply #17 on: 12:31, 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  ;)

Offline Bryce

  • The Hardware Guy.
  • Supporter
  • 6128 Plus
  • *
  • Posts: 11.721
  • Country: wf
  • It's not broken, it just hasn't been fixed yet.
    • index.php?action=treasury
  • Liked: 4219
  • Likes Given: 444
Re: Best Emulator with assembly code editor.
« Reply #18 on: 12:42, 03 June 14 »
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.

Offline redbox

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.751
  • Country: gb
    • redbox
  • Liked: 326
  • Likes Given: 267
Re: Best Emulator with assembly code editor.
« Reply #19 on: 15:25, 03 June 14 »
Grim?

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

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

8-bit loop (<256):

Code: [Select]
   ld b,16
loop:
   ... do something ...
   djnz loop

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

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

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:

Code: [Select]
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:

Code: [Select]
   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 ...

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...?

Offline Bryce

  • The Hardware Guy.
  • Supporter
  • 6128 Plus
  • *
  • Posts: 11.721
  • Country: wf
  • It's not broken, it just hasn't been fixed yet.
    • index.php?action=treasury
  • Liked: 4219
  • Likes Given: 444
Re: Best Emulator with assembly code editor.
« Reply #20 on: 15:34, 03 June 14 »
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.

Offline redbox

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.751
  • Country: gb
    • redbox
  • Liked: 326
  • Likes Given: 267
Re: Best Emulator with assembly code editor.
« Reply #21 on: 16:06, 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:

Code: [Select]
   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

Offline Bryce

  • The Hardware Guy.
  • Supporter
  • 6128 Plus
  • *
  • Posts: 11.721
  • Country: wf
  • It's not broken, it just hasn't been fixed yet.
    • index.php?action=treasury
  • Liked: 4219
  • Likes Given: 444
Re: Best Emulator with assembly code editor.
« Reply #22 on: 16:12, 03 June 14 »
Yes, I've done that, but how do I get that data to a string?

Bryce.

Offline redbox

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.751
  • Country: gb
    • redbox
  • Liked: 326
  • Likes Given: 267
Re: Best Emulator with assembly code editor.
« Reply #23 on: 16:22, 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$.

Offline Bryce

  • The Hardware Guy.
  • Supporter
  • 6128 Plus
  • *
  • Posts: 11.721
  • Country: wf
  • It's not broken, it just hasn't been fixed yet.
    • index.php?action=treasury
  • Liked: 4219
  • Likes Given: 444
Re: Best Emulator with assembly code editor.
« Reply #24 on: 16:28, 03 June 14 »
Yes, I read that but didn't fully understand how that works. I think I need to try it out.

Bryce.