IchigoJam BASIC command "USR" pass an address of function to divide as the register R3 after IchigoJam 1.2b31. (IchigoJam-FAN to download the latest version 1.2b45)
asm: R1=3 → 00100 001 [num]
asm: GOTO R3 → 010001110 [R3] 000
BASIC: PRINT 100 / 3 → 33
If you want to use the number as remainder (R1), call it!
[0]=`00100 001<<8 + 3 [1]=`1011010 100000000 [2]=`010001111 0011 000 [3]=`0100011000 001 000 [4]=`1011110 100000000 ?USR(#800,100) 1
asm: R1=3 → 00100 001 [num]
asm: PUSH {LR} → 1011010 100000000
asm: GOSUB R3 → 010001111 [R3] 000
asm: R0=R1 → 0100011000 [R1] [R0]
asm: POP {PC} → 1011110 100000000
BASIC: PRINT 100 % 3 → 1
Enjoy programming with the simple machine language!
links
- Cortex-M0 Armマシン語表(抜粋)
- はじめてのマシン語 - IchigoJamではじめるArmマシン語その1
- IchigoJam-FAN on Facebook