Page 1 of 1

ASM macros

Posted: May 15th, 2019, 7:21 am
by Dedok179
Hello. Is it possible to use macros in asm on PS1? In order not to write the whole function every time, but for example call func_write (adr, value). If it is possible how to implement it better?

Re: ASM macros

Posted: May 15th, 2019, 9:06 pm
by Dedok179
The compiler eats this construction normally:
ACTIV macro
LUI a0,0x8000
ORI a0, a0,0xD000
ORI t0, zero, 0x0001
LB t9,0x0000 (a0)
NOP
BNE t0, t9, go_back_home
NOP
endm

But you should change it to enter your values:
ACTIV macro adr
LUI a0,0x8000
ORI a0, a0, adr
ORI t0, zero, 0x0001
LB t9,0x0000 (a0)
NOP
BNE t0, t9, go_back_home
NOP
endm

and call it as ACTIV 0xD000, then the compiler swears that it’s impossible to say so, although if you simply call ACTIV, then everything compiles. Xs, rummaged all the psy-q docks, did not find anything about this.
compile with asmpsx, file with a macro I cut to the end of the main through incbin

Re: ASM macros

Posted: May 16th, 2019, 11:23 pm
by Dedok179
Just leave it here.