Difference between revisions of "A(0x3c) putchar"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
m
 
(One intermediate revision by the same user not shown)
Line 40: Line 40:
 
  000040ec: 810873d1 lb r8,0x73d1(r8)
 
  000040ec: 810873d1 lb r8,0x73d1(r8)
 
  000040f0: 00000000 nop
 
  000040f0: 00000000 nop
  000040f4: 31090097 andi r9,r8,0x0097          ascii text has flags? checks for flags 0x80, 0x10, 0x4, 0x2, 0x1. (assuming it works, finds digits, uppercase, lowercase, and DEL)
+
  000040f4: 31090097 andi r9,r8,0x0097          check flags 0x10 (grammar), 0x4 (number), 0x2 (lowercase), 0x1 (uppercase) and 0x80.
  000040f8: 11200007 beq r9,r0,0x00004118        branch if not any of those (assumedly.)
+
  000040f8: 11200007 beq r9,r0,0x00004118        branch if not any of those. (assumedly. this doesn't actually work though)
 
  000040fc: 24040001 addiu r4,r0,0x0001
 
  000040fc: 24040001 addiu r4,r0,0x0001
 
  00004100: 3c0a0001 lui r10,0x0001
 
  00004100: 3c0a0001 lui r10,0x0001
Line 50: Line 50:
 
  00004114: 24040001 addiu r4,r0,0x0001          1
 
  00004114: 24040001 addiu r4,r0,0x0001          1
 
  00004118: 27a50018 addiu r5,r29,0x0018        temp.
 
  00004118: 27a50018 addiu r5,r29,0x0018        temp.
  0000411c: 0c000b25 jal 0x00002c94              [[A(0x03) write]] (1, src = sp + 0x18, length = 1) <- unlike [[https://psx-spx.consoledev.net/kernelbios/#a3ch-or-b3dh-putcharchar-write-character-to-tty| other]] documentation, this actually points to open file 1, not open file 0.
+
  0000411c: 0c000b25 jal 0x00002c94              [[A(0x03) write]] (1, src = sp + 0x18, length = 1)  
 
  00004120: 24060001 addiu r6,r0,0x0001          length = 1
 
  00004120: 24060001 addiu r6,r0,0x0001          length = 1
 
  00004124: 8fbf0014 lw r31,0x0014(r29)
 
  00004124: 8fbf0014 lw r31,0x0014(r29)

Latest revision as of 08:46, 24 September 2024

0000406c: 27bdffe8 addiu r29,r29,-0x0018
00004070: afa40018 sw r4,0x0018(r29)
00004074: 83ae0018 lb r14,0x0018(r29)
00004078: 24010009 addiu r1,r0,0x0009
0000407c: 11c10009 beq r14,r1,0x000040a4       branch if character to write == Horz Tab.
00004080: afbf0014 sw r31,0x0014(r29)

Line feed:

00004084: 2401000a addiu r1,r0,0x000a
00004088: 15c10016 bne r14,r1,0x000040e4       branch if character to write != Line Feed (BUGGED? should point to 0x40e0; r25 contains garbage data otherwise.)
0000408c: 93b90018 lbu r25,0x0018(r29)         
00004090: 0c00101b jal 0x0000406c              A(0x3c) putchar <-- self reference?
00004094: 2404000d addiu r4,r0,0x000d          putchar('carriage return')
00004098: 3c010001 lui r1,0x0001
0000409c: 1000001d beq r0,r0,0x00004114        branch always
000040a0: ac208910 sw r0,-0x76f0(r1)           set current write pos. to 0

Horizontal tab:

000040a4: 0c00101b jal 0x0000406c              A(0x3c) putchar <-- self reference?
000040a8: 24040020 addiu r4,r0,0x0020          putchar('space')
000040ac: 3c0f0001 lui r15,0x0001
000040b0: 8def8910 lw r15,-0x76f0(r15)         current write pos.
000040b4: 00000000 nop
000040b8: 00000000 nop
000040bc: 05e10004 bgez r15,0x000040d0         branch if > 0
000040c0: 31f80007 andi r24,r15,0x0007         is not at tab boundary?
000040c4: 13000002 beq r24,r0,0x000040d0       branch if at tab boundary 
000040c8: 00000000 nop
000040cc: 2718fff8 addiu r24,r24,-0x0008       if not at tab boundary, -0x8
000040d0: 1700fff4 bne r24,r0,0x000040a4       loop until at tabulation boundary
000040d4: 00000000 nop
000040d8: 10000013 beq r0,r0,0x00004128        end
000040dc: 8fbf0014 lw r31,0x0014(r29)
000040e0: 93b90018 lbu r25,0x0018(r29)         unreachable

other chars.:

000040e4: 3c080000 lui r8,0x0000
000040e8: 01194021 addu r8,r8,r25              ? r25 contains garbage data here. branch is not set properly?
000040ec: 810873d1 lb r8,0x73d1(r8)
000040f0: 00000000 nop
000040f4: 31090097 andi r9,r8,0x0097           check flags 0x10 (grammar), 0x4 (number), 0x2 (lowercase), 0x1 (uppercase) and 0x80.
000040f8: 11200007 beq r9,r0,0x00004118        branch if not any of those. (assumedly. this doesn't actually work though)
000040fc: 24040001 addiu r4,r0,0x0001
00004100: 3c0a0001 lui r10,0x0001
00004104: 8d4a8910 lw r10,-0x76f0(r10)         current write pos.
00004108: 3c010001 lui r1,0x0001
0000410c: 254b0001 addiu r11,r10,0x0001        + 1
00004110: ac2b8910 sw r11,-0x76f0(r1)          write pos + 1
00004114: 24040001 addiu r4,r0,0x0001          1
00004118: 27a50018 addiu r5,r29,0x0018         temp.
0000411c: 0c000b25 jal 0x00002c94              A(0x03) write (1, src = sp + 0x18, length = 1) 
00004120: 24060001 addiu r6,r0,0x0001          length = 1
00004124: 8fbf0014 lw r31,0x0014(r29)
00004128: 27bd0018 addiu r29,r29,0x0018
0000412c: 03e00008 jr r31
00004130: 00000000 nop