掌機 - GP2X Wiz - Assembly - Button



按鍵B連接到GPIOC-5


GPIO架構


暫存器



main.s

    .global _start

    .equiv GPIOC_OUT,    0xc000a080
    .equiv GPIOC_OUTENB, 0xc000a084
    .equiv GPIOC_PAD,    0xc000a098

    .arm
    .text
_start:
    b reset
    b .
    b .
    b .
    b .
    b .
    b .
    b .
   
reset:
    ldr r0, =GPIOC_OUTENB
    ldr r1, =(1 << 16)
    str r1, [r0]

0:
    ldr r0, =GPIOC_PAD
    ldr r1, [r0]
    lsl r1, #11
    ldr r0, =GPIOC_OUT
    str r1, [r0]
    b 0b
    .end

完成