.include "macros.inc"
.section .text, "ax"
.global TRKInitializeNub
TRKInitializeNub:
mflr r0
stw r0, 4(r1)
stwu r1, -0x10(r1)
stw r31, 0xc(r1)
stw r30, 8(r1)
bl TRKInitializeEndian
or. r30, r3, r3
bne lbl_80087EE8
bl usr_put_initialize
lbl_80087EE8:
cmpwi r30, 0
bne lbl_80087EF8
bl TRKInitializeEventQueue
mr r30, r3
lbl_80087EF8:
cmpwi r30, 0
bne lbl_80087F08
bl TRKInitializeMessageBuffers
mr r30, r3
lbl_80087F08:
cmpwi r30, 0
bne lbl_80087F18
bl TRKInitializeDispatcher
mr r30, r3
lbl_80087F18:
cmpwi r30, 0
bne lbl_80087F5C
lis r3, gTRKInputPendingPtr@ha
addi r31, r3, gTRKInputPendingPtr@l
lis r3, 0x0000E100@ha
addi r6, r31, 0
addi r3, r3, 0x0000E100@l
li r4, 1
li r5, 0
bl TRKInitializeIntDrivenUART
mr r0, r3
lwz r3, 0(r31)
mr r31, r0
bl TRKTargetSetInputPendingPtr
cmpwi r31, 0
beq lbl_80087F5C
mr r30, r31
lbl_80087F5C:
cmpwi r30, 0
bne lbl_80087F6C
bl TRKInitializeSerialHandler
mr r30, r3
lbl_80087F6C:
cmpwi r30, 0
bne lbl_80087F7C
bl TRKInitializeTarget
mr r30, r3
lbl_80087F7C:
mr r3, r30
lwz r31, 0xc(r1)
lwz r30, 8(r1)
addi r1, r1, 0x10
lwz r0, 4(r1)
mtlr r0
blr
.global TRKTerminateNub
TRKTerminateNub:
mflr r0
stw r0, 4(r1)
stwu r1, -8(r1)
bl TRKTerminateSerialHandler
li r3, 0
addi r1, r1, 8
lwz r0, 4(r1)
mtlr r0
blr
.global TRKNubWelcome
TRKNubWelcome:
mflr r0
lis r3, "@40"@ha
stw r0, 4(r1)
addi r3, r3, "@40"@l
stwu r1, -8(r1)
bl TRK_board_display
addi r1, r1, 8
lwz r0, 4(r1)
mtlr r0
blr
.global TRKInitializeEndian
TRKInitializeEndian:
lis r3, gTRKBigEndian@ha
stwu r1, -0x10(r1)
addi r5, r3, gTRKBigEndian@l
li r6, 1
stw r6, 0(r5)
li r0, 0x12
li r3, 0x34
stb r0, 8(r1)
li r4, 0x56
li r0, 0x78
stb r3, 9(r1)
li r3, 0
stb r4, 0xa(r1)
stb r0, 0xb(r1)
lwz r4, 8(r1)
addis r0, r4, 0xedcc
cmplwi r0, 0x5678
bne lbl_80088034
stw r6, 0(r5)
b lbl_80088050
lbl_80088034:
addis r0, r4, 0x87aa
cmplwi r0, 0x3412
bne lbl_8008804C
li r0, 0
stw r0, 0(r5)
b lbl_80088050
lbl_8008804C:
li r3, 1
lbl_80088050:
addi r1, r1, 0x10
blr
.section .rodata, "a"
.balign 8
"@40":
.asciz "MetroTRK for Dolphin v0.8"
.balign 8
.section .bss, "wa"
.global gTRKBigEndian
gTRKBigEndian:
.skip 0x8