Draw Text To Screen [SwareJonge]
#8
Due to my curiosity, I stepped by stepped your code to see how you were able to get this Draw Code to work w/o flickers on the console. I ended up with a better understanding of what you did, but was still left with some questions. I ended up removing some items and was still able to draw perfectly fine.

Source (PAL only):
Code:
#Address (PAL) = 80009680

#Push Stack
stwu sp, -0x80 (sp)
stmw r3, 0x8 (sp)

#Set r31 for Direct Print Calling
lis r31, 0x8002

#Get current XFB (alternates between two FB's)
lwz r3, -0x6060 (r13)

#Get width and height for XFB
lis r5, 0x802A #Memory constant
lwz r5, 0x73FC (r5) #Load XFB Width Height Pointer
lhz r4, 0x4 (r5)
lhz r5, 0x8 (r5)

#Change XFB for Direct Print (r3 = FB, r4 = Width, r5 = Height)
ori r12, r31, 0x1E30
mtctr r12
bctrl

#Setup Args for Direct Print
li r3, 0
li r4, 0xDC
li r5, 1

bl our_text
.string "Hey"
our_text:
mflr r6

#Print to Screen
ori r12, r31, 0x1E90
mtctr r12
bctrl

#Store Cache
ori r12, r31, 0x1E70
mtctr r12
bctrl

#Pop Stack
lmw r3, 0x8 (sp)
addi sp, sp, 0x80

#Default Instruction
lwz r12, 0 (r3)

Some questions I have:
I notice you use a memory constant then load a pointer to get the width and height for the buffer, is this the only way to do it? Seems 'hacky'. Is there not a VI based function call to get those halfword values?

What was the purpose for calling the DirectPrintIsActive function? I removed it and didn't notice any changes.

What's the reasoning for checking if r0 equals 0 after the calling DirectPrintChangeXFB? Function calls only put return parameters in r3 or r3 & r4. And with multiple testing, I never once had a single time where r0 was 0 after calling DirectPrintChangeXFB.

Thank you in advance for any feedback.
Reply


Messages In This Thread
Draw Text To Screen [SwareJonge] - by SwareJonge - 01-02-2021, 03:29 PM
RE: Draw Text To Screen [SwareJonge] - by Vega - 01-02-2021, 03:39 PM
RE: Draw Text To Screen [SwareJonge] - by Vega - 01-02-2021, 03:59 PM
RE: Draw Text To Screen [SwareJonge] - by Vega - 01-03-2021, 01:54 AM
RE: Draw Text To Screen [SwareJonge] - by Vega - 01-16-2021, 02:46 AM
RE: Draw Text To Screen [SwareJonge] - by Vega - 01-16-2021, 10:58 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)