ASM macros

General Programming help in C, C++ or ASM, Compiling / Debugging, and R3000A Central Processing Unit (CPU) information
Post Reply
User avatar
Dedok179
Serious PSXDEV User
Serious PSXDEV User
Posts: 86
Joined: Jun 11, 2015
I am a: Programmer, Beginning reverser
PlayStation Model: SCPH-5502
Discord: Dedok179#2632
Location: Tula,RU

ASM macros

Post by Dedok179 » May 15th, 2019, 7:21 am

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?

User avatar
Dedok179
Serious PSXDEV User
Serious PSXDEV User
Posts: 86
Joined: Jun 11, 2015
I am a: Programmer, Beginning reverser
PlayStation Model: SCPH-5502
Discord: Dedok179#2632
Location: Tula,RU

Post by Dedok179 » May 15th, 2019, 9:06 pm

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

User avatar
Dedok179
Serious PSXDEV User
Serious PSXDEV User
Posts: 86
Joined: Jun 11, 2015
I am a: Programmer, Beginning reverser
PlayStation Model: SCPH-5502
Discord: Dedok179#2632
Location: Tula,RU

Post by Dedok179 » May 16th, 2019, 11:23 pm

Just leave it here.
You do not have the required permissions to view the files attached to this post.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests