.syntax unified
.cpu cortex-m0
.thumb
.section .vectors
.word 0x20000C00 // Stack pointer (Top of RAM for C031)
.word reset_handler // Reset vector
.section .text
.global reset_handler
reset_handler:
// 1. Load your numbers
MOVS R0, #20 // Dividend (Number 1)
MOVS R1, #4 // Divisor (Number 2)
// 2. Multiplication (R2 = R0 * R1)
MOVS R2, R0
MULS R2, R1, R2 // R2 = 80 (0x50)
// 3. Division (Note: Cortex-M0 usually requires a library function,
// but Wokwi's simulator often supports UDIV if the hardware allows)
// If the compiler errors on UDIV, your specific chip doesn't have
// a hardware divider.
UDIV R3, R0, R1 // R3 = 5 (0x05)
loop:
B loopLoading
st-nucleo-c031c6
st-nucleo-c031c6