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 1 Guest are viewing this topic.

ssr86

Yes, that is what I had in mind. Thanks for the answer.
It's not possible so I'll do it with nested 'ifs' instead...




Grim

Quote from: ssr86 on 18:13, 23 November 13
Is it possible to write such a macro in Winape??:

macro load_A_with reg
   ld a,reg
endm

It is:

;;Define some of the 3-bit CPU register indexes as used by the LD r,r' instruction for convenience
_b EQU %000
_c EQU %001
_d EQU %010
_e EQU %011
_h EQU %100
_l EQU %101
;_z EQU %110
_a EQU %111

;; Add the 3-bit register index argument with the LD A,r opcode to make the final instruction
;; Note: the AND %111 is only here to sanitize the input, just in case.
macro load_a_with reg
db reg AND %111 + %01111000
mend

;; Macro usage:
load_a_with _b
load_a_with _c
load_a_with _d
load_a_with _e
load_a_with _h
load_a_with _l
load_a_with _a



Quote from: Executioner on 22:49, 07 November 13There is another form of write direct which allows writing directly to sectors on a disc image.
Aye! Duly noted cap'n! :)

ssr86


Executioner

Quote from: ssr86 on 18:13, 23 November 13
Parameters can only be numbers or characters it seems.

Interesting... I think that's an oversight, perhaps I can change it for the next release.

ssr86

Another question about Winape assembler...
Is there a way to use inequalities in conditional code...?

if par1<const
...
endif

Bruce Abbott

Quote from: ssr86 on 23:11, 31 January 14
Is there a way to use inequalities in conditional code...?
Not directly, but you can use bitwise logical operators that produce a result of 'true' (not zero) or 'false' (zero), eg.:-

IF par1-const AND &8000
...
ENDIF

In this case, if par1-const is negative then bit 15 of the result will be set, so result AND &8000 will be true (not zero).



ssr86

Thank you, it helped a lot:)

But is there a way to have two inequalities checked in one 'if', or do I have to go with two 'ifs' because I can't use brackets...?

if par1<const1 AND par2<const2
...
endif




Bruce Abbott

Quote from: ssr86 on 13:49, 01 February 14
Thank you, it helped a lot:)

But is there a way to have two inequalities checked in one 'if', or do I have to go with two 'ifs' because I can't use brackets...
Expressions are evaluated in strict left to right order, so it may be possible in some cases but not easy. Best to just use nested ifs. 

Executioner

You can either use nested IFs, or use EQU for each of the conditions eg.

c1 equ par1 - const1 and #8000
c2 equ par2 - const2 and #8000
if c1 and c2
...
endif

Powered by SMFPacks Menu Editor Mod