Skip to content

Instantly share code, notes, and snippets.

@simias
Last active August 29, 2015 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simias/438196d7a67bb0d55177 to your computer and use it in GitHub Desktop.
Save simias/438196d7a67bb0d55177 to your computer and use it in GitHub Desktop.
.set noreorder
.set noat
.set mips1
.text
.global main
main:
j foo
nop
foo:
lui $a0, %hi(msg)
ori $a0, $a0, %lo(msg)
j bios_printf
nop
j $ra
nop
bios_printf:
j 0xa0
li $t1, 0x3f
.data
msg:
.string "hello world\n"
/*
$ /opt/psx-tools/bin/mipsel-unknown-elf-objdump -tda test.o
test.o: file format elf32-littlemips
test.o
SYMBOL TABLE:
00000000 l d .text 00000000 .text
00000000 l d .data 00000000 .data
00000000 l d .bss 00000000 .bss
00000000 l d .reginfo 00000000 .reginfo
00000000 l d .MIPS.abiflags 00000000 .MIPS.abiflags
00000000 l d .pdr 00000000 .pdr
00000000 l d .gnu.attributes 00000000 .gnu.attributes
00000000 g O .text 00000000 main
00000008 l .text 00000000 foo
00000000 l .data 00000000 msg
00000020 l .text 00000000 bios_printf
Disassembly of section .text:
00000000 <main>:
0: 02 00 00 08 00 00 00 00 ........
00000008 <foo>:
8: 3c040000 lui a0,0x0
c: 34840000 ori a0,a0,0x0
10: 08000008 j 20 <bios_printf>
14: 00000000 nop
18: 03e00008 jr ra
1c: 00000000 nop
00000020 <bios_printf>:
20: 08000028 j a0 <bios_printf+0x80>
24: 2409003f li t1,63
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment