Skip to content

Instantly share code, notes, and snippets.

@thautwarm
Created October 30, 2019 13:39
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 thautwarm/9ac33c7b534cbd0272298a7c7b81884a to your computer and use it in GitHub Desktop.
Save thautwarm/9ac33c7b534cbd0272298a7c7b81884a to your computer and use it in GitHub Desktop.
mips-print
.word 0x10000002 ; MERL cookie
.word 0x0000010c ; File Length (in bytes) is 268
.word 0x000000ec ; Code Length (in bytes) is 236
print:
sw $1, -4($30)
sw $2, -8($30)
sw $3, -12($30)
sw $4, -16($30)
sw $5, -20($30)
sw $6, -24($30)
sw $7, -28($30)
sw $8, -32($30)
sw $9, -36($30)
sw $10, -40($30)
lis $3
.word 0xffffffd8
add $30, $30, $3
lis $3
.word 0xffff000c
lis $4
.word 0x0000000a
lis $5
.word 0x00000004
add $6, $1, $0
slt $7, $1, $0
beq $7, $0, 4
lis $8
.word 0x0000002d
sw $8, 0($3)
sub $6, $0, $6
add $9, $30, $0
divu $6, $4
mfhi $10
sw $10, -4($9)
mflo $6
sub $9, $9, $5
slt $10, $0, $6
bne $10, $0, -7
lis $7
.word 0x00000030
lw $8, 0($9)
add $8, $8, $7
sw $8, 0($3)
add $9, $9, $5
bne $9, $30, -5
sw $4, 0($3)
lis $3
.word 0x00000028
add $30, $30, $3
lw $1, -4($30)
lw $2, -8($30)
lw $3, -12($30)
lw $4, -16($30)
lw $5, -20($30)
lw $6, -24($30)
lw $7, -28($30)
lw $8, -32($30)
lw $9, -36($30)
lw $10, -40($30)
jr $31
.word 0x05 ; ESD - print
.word 0x0000000c
.word 5
.word 112 ; p
.word 114 ; r
.word 105 ; i
.word 110 ; n
.word 116 ; t
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment