Please help me with code that doesn't understand the principle at all.
#4
To begin with, loading GXDraw functions causes the game to freeze at startup.
I am sure I am not understanding anything.

#============================================================#
# Source #
#------------------------------------------------------------#
# Draw Debug Bar Call Address Ports: #
# RMCE - 0x80009640 #
# RMCP - 0x80009680 #
# RMCJ - 0x800095DC #
# RMCK - 0x80009788 #
#============================================================#

.macro push_stack size, registers
stwu r1, \size(r1)
stmw \registers, 8(r1)
.endm

.macro DirectPrint_absolute_bl register, address
ori \register, r31, \address@l
mtctr \register
bctrl
.endm

.macro pop_stack registers, size
lmw \registers, 8(r1)
addi r1, r1, \size
.endm


.set GXDraw, 0x8016E9D0
.set GXSetCullMode, 0x8016F2D8
.set GXSetLineWidth, 0x8016F234
.set GXBegin,0x8016F010


# Function Prologue...
push_stack -128, r2




lis r31, 0x8002


DirectPrint_absolute_bl r12, GXDraw

li r3, 0 # X coordinate of text start

DirectPrint_absolute_bl r12, GXSetCullMode


lfs f0, -0x7B68(r2)
fmuls f0, f0, f30
fctiwz f0, f0
stfd f0, 0x8(r1)
lwz r3, 0xC(r1)
rlwinm r3, r3, 0, 24, 31
li r4, 2
DirectPrint_absolute_bl r12, GXSetLineWidth

li r3, 0xB0 #line strip
li r4, 1
li r5, 5 #5 vertices
DirectPrint_absolute_bl r12, GXBegin
lis r3, 0xCC01 #gfx mem-loc
lis r4, 0x00FF
ori r4, r4, 0x00FF
li r0, 0
lfs f0, 0x50(r1) #Left X
lfs f1, 0x54(r1) #top y
lfs f2, 0x58(r1) #right x
lfs f3, 0x5C(r1) #bottom y

#vertex 0 = left x, top y
stfs f0, -0x8000(r3) #x
stfs f1, -0x8000(r3) #y
stw r0, -0x8000(r3) #z
stw r4, -0x8000(r3) #colour
#vertex 1 = left x, bottom y
stfs f0, -0x8000(r3) #x
stfs f3, -0x8000(r3) #y
stw r0, -0x8000(r3) #z
stw r4, -0x8000(r3) #colour
#vertex 2 = right x, bottom y
stfs f2, -0x8000(r3) #x
stfs f3, -0x8000(r3) #y
stw r0, -0x8000(r3) #z
stw r4, -0x8000(r3) #colour
#vertex 3 = right x, top y
stfs f2, -0x8000(r3) #x
stfs f1, -0x8000(r3) #y
stw r0, -0x8000(r3) #z
stw r4, -0x8000(r3) #colour
#vertex 4 = left x, top y #repeated since draws end to end of positions specified
stfs f0, -0x8000(r3) #x
stfs f1, -0x8000(r3) #y
stw r0, -0x8000(r3) #z
stw r4, -0x8000(r3) #colour
addi r3, r1, 0x60
# Function Epilogue...
pop_stack r2, 128

# Original Instruction
lwz r12, 0(r3)
Reply


Messages In This Thread
RE: Please help me with code that doesn't understand the principle at all. - by Ryuk - 07-17-2022, 03:15 AM

Forum Jump:


Users browsing this thread: 4 Guest(s)