A(0x08) getc
Jump to navigation
Jump to search
00004024: 27bdffd8 addiu r29,r29,-0x0028 00004028: afbf0014 sw r31,0x0014(r29) 0000402c: 27a50024 addiu r5,r29,0x0024 00004030: 0c000aca jal 0x00002b28 A(0x02) read (fd = p1, dst = sp + 0x24, length = 1) 00004034: 24060001 addiu r6,r0,0x0001 00004038: 1c400004 bgtz r2,0x0000404c branch if could read byte 0000403c: 83a20024 lb r2,0x0024(r29) the byte that was read 00004040: 10000006 beq r0,r0,0x0000405c 00004044: 2402ffff addiu r2,r0,-0x0001 if failed, return -1 00004048: 83a20024 lb r2,0x0024(r29) 0000404c: 00000000 nop 00004050: 304200ff andi r2,r2,0x00ff else, 00004054: 00021600 sll r2,r2,0x18 00004058: 00021603 sra r2,r2,0x18 for some reason, expand the sign. this means a read of ff could look like an error, even if it isn't. this is very good design. 0000405c: 8fbf0014 lw r31,0x0014(r29) 00004060: 27bd0028 addiu r29,r29,0x0028 00004064: 03e00008 jr r31 00004068: 00000000 nop