掌機 - Game & Watch: The Legend of Zelda - Assembly - LCD Backlight



參考資訊:
https://github.com/ghidraninja/game-and-watch-backup
https://www.st.com/resource/en/datasheet/stm32h7b0vb.pdf
https://www.st.com/resource/en/reference_manual/dm00463927-stm32h7a37b3-and-stm32h7b0-value-line-advanced-armbased-32bit-mcus-stmicroelectronics.pdf

LCD背光電路


main.s

    .equiv PORTA_BASE,  0x58020000
    .equiv GPIO_MODER,  0x0000
    .equiv GPIO_ODR,    0x0014
 
    .equiv RCC_BASE,    0x58024400
    .equiv RCC_AHB4ENR, 0x0140
 
    .thumb
    .cpu cortex-m7
    .syntax unified
 
    .global _start
 
    .text
    .org 0x0000
_start:
    .word 0x20020000
    .word reset
 
    .org 0x0100
    .thumb_func
reset:
    ldr r0, =RCC_BASE
    ldr r1, [r0, #RCC_AHB4ENR]
    orr r1, #0x1f
    str r1, [r0, #RCC_AHB4ENR]
 
    ldr r0, =PORTA_BASE
    ldr r1, =0xa9555555
    str r1, [r0, #GPIO_MODER]
    ldr r1, =0x0000
    str r1, [r0, #GPIO_ODR]
 
    ldr r3, =(1 << 6) | (1 << 5) | (1 << 4)
0:
    eor r1, r3
    str r1, [r0, #GPIO_ODR]
    ldr r2, =0x2000000
1:
    subs r2, #1
    bne 1b
    b 0b
    .end

完成