Author Topic: Maxam REPT equivalent  (Read 5159 times)

0 Members and 1 Guest are viewing this topic.

Offline AugustoRuiz

  • CPC664
  • ***
  • Posts: 121
  • Country: es
  • Liked: 157
  • Likes Given: 49
Maxam REPT equivalent
« on: 19:52, 04 June 13 »
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?

Offline AugustoRuiz

  • CPC664
  • ***
  • Posts: 121
  • Country: es
  • Liked: 157
  • Likes Given: 49
Re: Maxam REPT equivalent
« Reply #1 on: 10: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!

Offline arnoldemu

  • Supporter
  • 6128 Plus
  • *
  • Posts: 5.336
  • Country: gb
    • Unofficial Amstrad WWW Resource
  • Liked: 2275
  • Likes Given: 3478
Re: Maxam REPT equivalent
« Reply #2 on: 10:56, 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

Offline AugustoRuiz

  • CPC664
  • ***
  • Posts: 121
  • Country: es
  • Liked: 157
  • Likes Given: 49
Re: Maxam REPT equivalent
« Reply #3 on: 11:14, 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)...

Offline arnoldemu

  • Supporter
  • 6128 Plus
  • *
  • Posts: 5.336
  • Country: gb
    • Unofficial Amstrad WWW Resource
  • Liked: 2275
  • Likes Given: 3478
Re: Maxam REPT equivalent
« Reply #4 on: 11:21, 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

Offline AugustoRuiz

  • CPC664
  • ***
  • Posts: 121
  • Country: es
  • Liked: 157
  • Likes Given: 49
Re: Maxam REPT equivalent
« Reply #5 on: 11:37, 05 June 13 »
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:



Code: [Select]

MACRO INCLUDE fileName
  READ fileName
ENDM

Online ralferoo

  • Supporter
  • 6128 Plus
  • *
  • Posts: 970
  • Country: gb
  • Liked: 583
  • Likes Given: 222
Re: Maxam REPT equivalent
« Reply #6 on: 11:58, 05 June 13 »
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.

Offline TFM

  • Visit the mysteries of the CPC at www.futureos.de
  • Supporter
  • 6128 Plus
  • *
  • Posts: 9.899
  • Country: aq
  • Space Chicken for FutureOS is free!
    • index.php?action=treasury
    • FutureOS - The revolution on CPC!
  • Liked: 1982
  • Likes Given: 4650
Re: Maxam REPT equivalent
« Reply #7 on: 19:08, 06 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

Offline AugustoRuiz

  • CPC664
  • ***
  • Posts: 121
  • Country: es
  • Liked: 157
  • Likes Given: 49
Re: Maxam REPT equivalent
« Reply #8 on: 10:59, 07 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.

Offline TFM

  • Visit the mysteries of the CPC at www.futureos.de
  • Supporter
  • 6128 Plus
  • *
  • Posts: 9.899
  • Country: aq
  • Space Chicken for FutureOS is free!
    • index.php?action=treasury
    • FutureOS - The revolution on CPC!
  • Liked: 1982
  • Likes Given: 4650
Re: Maxam REPT equivalent
« Reply #9 on: 22:07, 07 June 13 »
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

Offline Executioner

  • Supporter
  • 6128 Plus
  • *
  • Posts: 783
  • Country: au
  • WinAPE Developer
    • WinAPE
  • Liked: 392
  • Likes Given: 60
Re: Maxam REPT equivalent
« Reply #10 on: 04:24, 18 October 13 »
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


Offline ssr86

  • CPC664
  • ***
  • Posts: 120
  • Country: pl
  • Liked: 48
  • Likes Given: 21
Re: Maxam REPT equivalent
« Reply #11 on: 22:47, 19 October 13 »
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...

Offline redbox

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.751
  • Country: gb
    • redbox
  • Liked: 326
  • Likes Given: 267
Re: Maxam REPT equivalent
« Reply #12 on: 23:44, 19 October 13 »
ld a,label loads the low byte...

LD HL,label
LD A,L

Offline ssr86

  • CPC664
  • ***
  • Posts: 120
  • Country: pl
  • Liked: 48
  • Likes Given: 21
Re: Maxam REPT equivalent
« Reply #13 on: 00:01, 20 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.

Offline TFM

  • Visit the mysteries of the CPC at www.futureos.de
  • Supporter
  • 6128 Plus
  • *
  • Posts: 9.899
  • Country: aq
  • Space Chicken for FutureOS is free!
    • index.php?action=treasury
    • FutureOS - The revolution on CPC!
  • Liked: 1982
  • Likes Given: 4650
Re: Maxam REPT equivalent
« Reply #14 on: 00:15, 20 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

Offline Executioner

  • Supporter
  • 6128 Plus
  • *
  • Posts: 783
  • Country: au
  • WinAPE Developer
    • WinAPE
  • Liked: 392
  • Likes Given: 60
Re: Maxam REPT equivalent
« Reply #15 on: 09:02, 23 October 13 »
TFM is correct, use

Code: [Select]
LD r,addr / 256
or

Code: [Select]
LD r,addr / #100
« Last Edit: 03:43, 24 October 13 by Executioner »

Offline ssr86

  • CPC664
  • ***
  • Posts: 120
  • Country: pl
  • Liked: 48
  • Likes Given: 21
Re: Maxam REPT equivalent
« Reply #16 on: 13:05, 06 November 13 »
One more question....

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

Offline redbox

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.751
  • Country: gb
    • redbox
  • Liked: 326
  • Likes Given: 267
Re: Maxam REPT equivalent
« Reply #17 on: 13:20, 06 November 13 »
Macros with arguments - are they supported in WinApe assembler? If yes, then what is the syntax?

Code: [Select]
argument    equ 1   (1 for true, 0 for false)

IF argument
   ...some code...
ENDIF

Offline ssr86

  • CPC664
  • ***
  • Posts: 120
  • Country: pl
  • Liked: 48
  • Likes Given: 21
Re: Maxam REPT equivalent
« Reply #18 on: 13:42, 06 November 13 »
What I had in mind was something like this:
Code: [Select]
Macro (arg1, arg2)
  ld a,arg1
  and arg2
  or (hl)
EndM



Offline redbox

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.751
  • Country: gb
    • redbox
  • Liked: 326
  • Likes Given: 267
Re: Maxam REPT equivalent
« Reply #19 on: 14:14, 06 November 13 »
What I had in mind was something like this:

From Grimware:

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

Offline ssr86

  • CPC664
  • ***
  • Posts: 120
  • Country: pl
  • Liked: 48
  • Likes Given: 21
Re: Maxam REPT equivalent
« Reply #20 on: 16:45, 06 November 13 »
Thank you - especially for the link. I didn't know about that there was a documentation for WinApe's assembler on grimware site.

Offline Executioner

  • Supporter
  • 6128 Plus
  • *
  • Posts: 783
  • Country: au
  • WinAPE Developer
    • WinAPE
  • Liked: 392
  • Likes Given: 60
Re: Maxam REPT equivalent
« Reply #21 on: 23:49, 07 November 13 »
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


Offline ssr86

  • CPC664
  • ***
  • Posts: 120
  • Country: pl
  • Liked: 48
  • Likes Given: 21
Re: Maxam REPT equivalent
« Reply #22 on: 19:13, 23 November 13 »
Is it possible to write such a macro in Winape??:
Code: [Select]
macro load_A_with reg
   ld a,reg
endm
So it can be used like:
Code: [Select]
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?


Offline redbox

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.751
  • Country: gb
    • redbox
  • Liked: 326
  • Likes Given: 267
Re: Maxam REPT equivalent
« Reply #23 on: 19:35, 23 November 13 »
Depends on what you are trying to do with this.

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

Offline TFM

  • Visit the mysteries of the CPC at www.futureos.de
  • Supporter
  • 6128 Plus
  • *
  • Posts: 9.899
  • Country: aq
  • Space Chicken for FutureOS is free!
    • index.php?action=treasury
    • FutureOS - The revolution on CPC!
  • Liked: 1982
  • Likes Given: 4650
Re: Maxam REPT equivalent
« Reply #24 on: 19:51, 23 November 13 »
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