News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu

Maxam REPT equivalent

Started by AugustoRuiz, 17:52, 04 June 13

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

AugustoRuiz

Hi all!


I'm looking for a way to have my code compatible between PASMO and WinAPE assembler (MAXAM compatible). I almost got it, except for the fact that I don't have REPT available (though REPEAT exists).


I'm defining macros for things I use in Pasmo that are different in Maxam (such as INCLUDE = READ). But I cannot figure out how to do so for REPT.


Can anybody help me? Is there a way of defining an alias or a macro so that I can have REPT in my code, and WinAPE interprets it as REPEAT?

AugustoRuiz

I'm looking for documentation on MAXAM macros, but cannot find any... Can anybody point me in the right direction?


Thank you!

arnoldemu

Quote from: AugustoRuiz on 08:30, 05 June 13
I'm looking for documentation on MAXAM macros, but cannot find any... Can anybody point me in the right direction?


Thank you!
http://www.cpcwiki.eu/index.php/Maxam_1.5

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

AugustoRuiz

Quote from: arnoldemu on 08:56, 05 June 13
http://www.cpcwiki.eu/index.php/Maxam_1.5


Sorry, read both PDFs there, but couldn't find any info on macros (and still cannot)...

arnoldemu

Quote from: AugustoRuiz on 09:14, 05 June 13

Sorry, read both PDFs there, but couldn't find any info on macros (and still cannot)...
I didn't read it fully  :laugh:

Try this one:

Maxam 2 - CPCWiki

I see "Repeat" mentioned here.
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

AugustoRuiz

Thank you!


In the end, I've done something horrible, but it works.


Two different entry points for assembler, one for pasmo, and another one for WinApe. In one of them I use REPEAT (WinAPE), and in another one I use REPT (Pasmo).


And in WinAPE I also have this:





MACRO INCLUDE fileName
  READ fileName
ENDM

ralferoo

I'm not sure if it's exactly your case, but I use WinCPC for testing things out in an emulator and pasmo run from a Makefile for making the proper binary and compressing it.

As a result, I tend to use WinCPC syntax and have an extra conversion step that converts from wincpc format (which I think is similar to maxam) to pasmo, by running things through sed or perl. That way, you have a single "source" file but can still use two different assemblers.

TFM

Quote from: AugustoRuiz on 08:30, 05 June 13
I'm looking for documentation on MAXAM macros, but cannot find any... Can anybody point me in the right direction?
Well, Maxam and Maxam 1.5 do not have macros. If you want to use macros then please use Maxam II (it runs under CP/M Plus and is compatible with RAM disc and hard disc HD20).
TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

AugustoRuiz

Quote from: TFM/FS on 17:08, 06 June 13
Well, Maxam and Maxam 1.5 do not have macros. If you want to use macros then please use Maxam II (it runs under CP/M Plus and is compatible with RAM disc and hard disc HD20).
Well, I'm using WinAPE, as I don't have any physical CPC available :(. I develop mainly using an external text editor (Notepad++), and have some sort of empty source code file that includes the main source code file. I have the almost empty file open in WinAPE assembler, so I can edit the code with undo/redo...


In order to build my dsk, I use Pasmo, Img2CPC, DSKGen and Exomizer.

TFM

Well, I'm not aquanted to the assemblers of emulators. I usually still use Maxam when using an emulator (even if it is time consuming ;-)). But there is also JavaCPC having an assembler. I never used neither one of them, so I got no clue which one may provide better results.
TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

Executioner

WinAPE assembler has both REPEAT and WHILE macros. REPEAT is designed to do something a fixed number of times, eg:

REPEAT 64
  LDI
REND

And WHILE will continue to produce code while a condition is true.

WHILE $ - #4020
  NOP
WEND


ssr86

A little offtopic however still about assembler in WinAPE (and I don't want to start a new topic for this)...:

How to load the high byte of an address into a register?
ld a,label loads the low byte...

redbox


ssr86

But isn't there a assembler function that recognizes which byte of a word you want to load?
I remember that turbo assembler for c64 had the signs < and > to do that (ldx #>label was the high byte). Because I know what the high byte is so I could just load the register with that but I use a label for that address and I would want to use that label when loading.

TFM

Quote from: ssr86 on 22:01, 19 October 13
But isn't there a assembler function that recognizes which byte of a word you want to load?
I remember that turbo assembler for c64 had the signs < and > to do that (ldx #>label was the high byte). Because I know what the high byte is so I could just load the register with that but I use a label for that address and I would want to use that label when loading.


Of course there is an more easy way:


LD H,label/256


will load the highbyte of the label in the register (H in this case).




Further the Bollawares did an assembler for the CPC that is very similar to the Turbo Assembler of the c64, check out their homepage:


http://www.bollaware.de

TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

Executioner

#15
TFM is correct, use

LD r,addr / 256

or

LD r,addr / #100


ssr86

One more question....

Macros with arguments - are they supported in WinApe assembler? If yes, then what is the syntax?
Thanks.

redbox

Quote from: ssr86 on 12:05, 06 November 13
Macros with arguments - are they supported in WinApe assembler? If yes, then what is the syntax?


argument    equ 1   (1 for true, 0 for false)

IF argument
   ...some code...
ENDIF

ssr86

What I had in mind was something like this:

Macro (arg1, arg2)
  ld a,arg1
  and arg2
  or (hl)
EndM




redbox

Quote from: ssr86 on 12:42, 06 November 13
What I had in mind was something like this:

From Grimware:


Macro local labels can be defined by prefixing with an @ symbol, they can be nested and may be called recursively. Macros can override reserved assembler symbols. The ! symbol is used to exclude the use of macros from a symbol. (eg. If the LDI symbol had been redefined, you can assemble a standard LDI using !LDI).

Macro

Syntax:
    macro <name> [parameter1[,parameter2[...]]]

Define a new macro.

macro <name> [parameter1[,parameter2[...]]]
    ; some code
mend

Your macro MUST BE DEFINED BEFORE being used in the source!

ssr86

Thank you - especially for the link. I didn't know about that there was a documentation for WinApe's assembler on grimware site.

Executioner

I'd also forgotten there was some documentation on Grimware. btw, There is another form of write direct which allows writing directly to sectors on a disc image.

eg.

write direct sectors 3-4:c1-c9 5:c1-c2


ssr86

Is it possible to write such a macro in Winape??:

macro load_A_with reg
   ld a,reg
endm

So it can be used like:

load_A_with b
load_A_with c
load_A_with d
load_A_with e

where b,c,d,e are standard registers.

I'd need to write a macro with such functionality...but it doesn't seem to be possible...
Parameters can only be numbers or characters it seems.
I could write a macro for each register or use a couple of "ifs" but it would be a long and hard to read macro...
Maybe there is a better solution?


redbox

Depends on what you are trying to do with this.

Are you wanting to write IF reg =<> argument THEN ELSE type routines?

TFM

If you mean a Z80 register with reg, then this won't work. A conditional assembly depends ATMK at variables or constants of the source code, not the finished program running. If reg is something else never mind.  :)

TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

Powered by SMFPacks Menu Editor Mod