ASM macros

General Programming help in C, C++ or ASM, Compiling / Debugging, and R3000A Central Processing Unit (CPU) information
Post Reply
Dedok179
Active PSXDEV User
Active PSXDEV User
Posts: 55
Joined: June 11th, 2015, 7:23 pm
I am a: Programmer, Developer.
PlayStation Model: SCPH-5502
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?

Dedok179
Active PSXDEV User
Active PSXDEV User
Posts: 55
Joined: June 11th, 2015, 7:23 pm
I am a: Programmer, Developer.
PlayStation Model: SCPH-5502
Location: Tula,RU

Re: ASM macros

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

Dedok179
Active PSXDEV User
Active PSXDEV User
Posts: 55
Joined: June 11th, 2015, 7:23 pm
I am a: Programmer, Developer.
PlayStation Model: SCPH-5502
Location: Tula,RU

Re: ASM macros

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 1 guest