
Сообщение от
Dart Alver
Ped7g , а можете реализовать поддержку особых макросов с неопределённым количеством параметров, чтоб от ни одного до много-много ?
...
varargs for macro are mentioned few times in various issues, like: https://github.com/z00m128/sjasmplus/issues/150
You are welcome to check current proposal/notes and add any new suggestion/syntax detail so it's not lost when finally somebody will want to work on it.
(I'm currently working very little at hobby stuff, too busy with newborn, work and running/fitness, ZX dev time shrink to few hours per month right now)
- - - Updated - - -

Сообщение от
CityAceE
...
Вот так работает, но в итоге имеем лишних 7 байт на константы. Причём в конец кода их перекинуть нельзя, так как они должны находится перед первым вызовом макроса.
There's no good native support for what you are trying to do.
You can maybe hack it by doing DEFINE with numeric values, ie. DEFINE A 1 : DEFINE REG_A 1 : IF reg1 == REG_A ... but it will probably bite you badly in other ways because the defines like "A" are too short and generic. Other possible hack is to use lua script to check for value of macro argument reg1, that's less intrusive, but cumbersome.
Mind you, sjasmplus has the i8080 support the other-way, ie. you can write i8080 code in Zilog syntax and the assembler will warn you when you use Z80-specific instruction by accident. sjasmplus has also support for "M" register as `(hl)` alias.
You can add to source code:
Код:
; use --i8080 switch to 8080 instructions only
OPT --syntax=M ; enable "M" register as (hl) alias
LD A,B ; MOV A,B
LD A,M ; MOV A,M
LDIR ; error "Unrecognized instruction: LDIR"
and assemble it with --i8080 switch to get results like this:
Код:
$ sjasmplus --i8080 --msg=lstlab -
; use --i8080 switch to 8080 instructions only
OPT --syntax=M ; enable "M" register as (hl) alias
LD A,B ; MOV A,B
LD A,M ; MOV A,M
LDIR ; error "Unrecognized instruction: LDIR"
# file opened: <stdin>
1 0000 ; switch to 8080 instructions only
2 0000 OPT --syntax=M
3 0000 78 LD A,B ; MOV A,B
4 0001 7E LD A,M ; MOV A,M
<stdin>(5): error: Unrecognized instruction: LDIR
5 0002 LDIR ; error "Unrecognized instruction: LDIR"
6 0002
# file closed: <stdin>
But to do it the other way, ie. to support original i8080 syntax, you should probably look for other assembler, sjasmplus is not a good choice for that.