掌機 - GP2X Wiz - Assembly - ECID



Address

SymbolDescription
ID0xc001f800 ~ 0xc001f80f
CHIPNAME0xc001f810 ~ 0xc001f83f
GUID0xc001f844 ~ 0xc001f854
ECID0xc001f854 ~ 0xc001f858

main.s

    .global _start

    .equiv GPIOC_OUT,      0xc000a080
    .equiv GPIOC_OUTENB,   0xc000a084
    .equiv GPIOC_PAD,      0xc000a098
    .equiv GPIOA_ALTFN0,   0xc000a020
    .equiv UART_LCON0,     0xc0016000
    .equiv UART_UCON0,     0xc0016002
    .equiv UART_FCON0,     0xc0016004
    .equiv UART_MCON0,     0xc0016006
    .equiv UART_TRSTATUS0, 0xc0016008
    .equiv UART_THB0,      0xc0016010
    .equiv UART_BRD0,      0xc0016014
    .equiv UART_CLKENB0,   0xc0016040
    .equiv UART_CLKGEN0,   0xc0016044
     
    .arm
    .text
_start:
    b reset
    b .
    b .
    b .
    b .
    b .
    b .
    b .
 
reset:
    ldr r0, =GPIOC_OUTENB
    ldr r1, =(1 << 16)
    str r1, [r0]

    ldr r0, =GPIOA_ALTFN0
    ldr r1, =(1 << 16)
    str r1, [r0]

    ldr r0, =UART_CLKENB0
    ldr r1, [r0]
    bic r1, #4
    str r1, [r0]

    ldr r0, =UART_LCON0
    ldr r1, =0x83
    strh r1, [r0]

    ldr r0, =UART_UCON0
    ldr r1, =5
    strh r1, [r0]

    ldr r0, =UART_FCON0
    ldr r1, =6
    strh r1, [r0]

    ldr r0, =UART_MCON0
    ldr r1, =0xc0
    str r1, [r0]

    ldr r0, =UART_BRD0
    ldr r1, =1
    strh r1, [r0]

    ldr r0, =UART_CLKGEN0
    ldr r1, =0x272
    strh r1, [r0]

    ldr r0, =UART_FCON0
    ldr r1, =1
    strh r1, [r0]

    ldr r0, =UART_CLKENB0
    ldr r1, [r0]
    orr r1, #4
    str r1, [r0]

    ldr r0, =GPIOC_OUT
    ldr r1, =(1 << 16)
    str r1, [r0]

    ldr r0, =GPIOC_PAD
0:
    ldr r1, [r0]
    tst r1, #(1 << 5)
    bne 0b

    ldr r0, =GPIOC_OUT
    ldr r1, =~(1 << 16)
    str r1, [r0]

    ldr r4, =0xc001f810
    ldr r5, =0xc001f83f
0:
    ldr r6, [r4]

    mov r0, r6
    bl uart_byte

    mov r0, r6
    lsr r0, #8
    bl uart_byte

    mov r0, r6
    lsr r0, #16
    bl uart_byte

    mov r0, r6
    lsr r0, #24
    bl uart_byte

    add r4, #4
    cmp r4, r5
    ble 0b

    b .

uart_byte:
    ldr r2, =UART_THB0
    ldr r3, =UART_TRSTATUS0
0:
    ldr r1, [r3]
    tst r1, #(1 << 1)
    beq 0b
    strb r0, [r2]
    mov pc, lr
    .end

完成