Assembler with possibility to create pseudo mnemonics

Página 1/2
| 2

Por Accumulator

Champion (339)

Imagen del Accumulator

12-01-2023, 15:56

I have been away from the scene for some time and returned programming again.
To speed up coding I am looking for an assembler with possibility to create pseudo mnemonics.

I do not know if they exist, I am not aware of this feature in assemblers. I am sure they must exist.

What I mean by creating pseudo mnemonics is for example:
ADD HL,&H2000
which will result after compiling in (for example, you can edit yourself, how to compile)
PUSH DE
LD DE,&h2000
ADD HL,DE
POP DE

Similar for ADC Hl,&Hxxxx

or
OUT (&H99),128,14+128
in
ld a,128
out (&h99),A
ld a,14+128
out (&h99),a

Similar with using registers instead of numbers.
Ruining register values is your own responsibility.

Does it exist? (incl. saving with pseudo mnemonics and substituted mnemonics)

Login sesión o register para postear comentarios

Por santiontanon

Paragon (1809)

Imagen del santiontanon

12-01-2023, 16:22

As I have argued in the past, these type of "fake instructions" are usually a bad idea, as they are either inefficient or could have unexpected side effects (e.g., in your example, there is either an unexpected push/pop or an unexpected modification of the DE register if you remove the push/pop). But if you still want to use these, there are two possibilities:
1) you can always define these with MACROs, most assemblers allow this, and you could just define an "ADD16" macro, for example, that does exactly what you suggest above.
2) there are assemblers that already have very long lists of these "fake instructions" defined by default like sjasmplus or sjasm (the one you state above is defined in both).

If you want to use these, my suggestion is to use macros, so that you can have some sort of indicator in the names of these new instructions (I would advise AGAINST calling them the same names as the original z80 nemonics), so that it's obvious they are composite instructions, to prevent debugging nightmares Smile

Por Accumulator

Champion (339)

Imagen del Accumulator

12-01-2023, 16:44

I fully agree those instructions could be inefficient, however for some routines you do not need the speed.
Also the use of regular expressions to create fake mnemonic could be helpful in speeding up coding.
If you can save in real mnemonics and optimize afterwards, could solve some efficiency.
Does the assembler also have an compiled info summary of T States for the routine?
What about undocumented, now documented mnemonics?

I have to check MACRO, never used them in the past, only calling sub-routines and return if speed is not needed, or copy blocks of coding and putting them where needed when speed is essential.

Thanks for the advice and info!

Por ro

Scribe (4964)

Imagen del ro

12-01-2023, 19:14

For the sake of clean-code, I wouldn't use any of that. It might be tempting, but can be a real pain later. But hell, I'm a hardcore coder who doesn't even use cross-development shit. So, what do I know.

Por wolf_

Ambassador_ (10109)

Imagen del wolf_

12-01-2023, 19:18

Well, who knows.... Nosferatu, Flicky, Fubsy and Radical Raymond might 've been finished already with xdev-tools. Wink

Por santiontanon

Paragon (1809)

Imagen del santiontanon

12-01-2023, 20:42

Here is the list of these "fake instructions" that sjasmplus supports: https://z00m128.github.io/sjasmplus/documentation.html#s_fak...

(and btw, I now see I was wrong, and the instruction you defined above is not in the list, haha, my bad!)

I don't think there is a table of T-states used by each of these though!

If you choose to use macros, let us know if you have troubles defining them. Happy to help out on creating a couple of these as examples :)

Por Accumulator

Champion (339)

Imagen del Accumulator

13-01-2023, 00:45

Logic I was not using MACROS!, WBASS2 is not supporting MACROS.
MACROS would help a lot, and exactly what I am looking for.
I have truid to build SJASMPLUS inc LuaBridge, but all fails,
Any suggestions or already builld for intel64, and can point be to that location? (linux)

With MACROS I am also able to create a LABEL with half mnemonic, in order to ok for example)
READDP: OR (non value after) (OR + value of SCR) will result in Carry 0
WRITEVD: SCF accessing this carry=1
ex af,af
SOMEROUTINE
ex af,af
jr c ,vdpout

But have to change to anotehr assembler, because I am still stuck, but love WBASS2

Por santiontanon

Paragon (1809)

Imagen del santiontanon

13-01-2023, 01:57

Oh, interesting, the maintainer of sjasmplus (ped7g) often reads these forums, maybe ped7g can help on that. I was able to compile it fine, but on Mac, never compiled it on Linux myself.

But another alternative is Glass (https://www.grauw.nl/projects/glass/). Glass is Java, and you can just get the .jar file, so, no need to compile it.

Some example macros inspired in your example above using the Glass syntax:

ADD_HL_CONST: MACRO ?const
    push de
    ld de, ?const
    add hl, de
    pop de
    ENDM

ADD_REG_CONST: MACRO ?reg1, ?reg2, ?const
    push ?reg2
    ld ?reg2, ?const
    add ?reg1, ?reg2
    pop ?reg2
    ENDM

And then you can call them like this:

    ADD_HL_CONST 100
    ADD_REG_CONST hl, de, 100

Por Daemos

Prophet (2069)

Imagen del Daemos

13-01-2023, 08:27

I did recently build sjasmplus on linux. It should build. What distro did you try?

Por Daemos

Prophet (2069)

Imagen del Daemos

13-01-2023, 13:13

You can thank me later Wink statically compiled so that it runs on any linux64 system.

Sjasmplus linux 64

Por Manel46

Paladin (674)

Imagen del Manel46

13-01-2023, 13:22

I use sjasm. Also the macros, which make the job much easier.

Página 1/2
| 2