@lukas lukas / 223d892f9cb17017cae6afdbc1957adc
Created at Sat Feb 04 16:57:37 UTC 2023
Minimaschine p=asq+bsq
gistfile1.txt
Raw
main:
outerLoop:
LOADI 0
STORE a

outerLoopStart:
LOAD a
CMP p
JMPNN outerLoopEnd

outerLoopInner:

squareA:
LOAD a
MUL a
STORE aSQ

innerLoop:
LOADI 0
STORE b

innerLoopStart:
LOAD b
CMP p
JMPNN innerLoopEnd

innerLoopInner:

squareB:
LOAD b
MUL b
STORE bSQ

LOAD aSQ
ADD bSQ
STORE c
CMP p
JMPNZ innerLoopLast

LOADI 1
STORE resultStatus
HOLD

innerLoopLast:
LOAD b
ADDI 1
STORE b
JMP innerLoopStart

innerLoopEnd:

outerLoopLast:
LOAD a
ADDI 1
STORE a
JMP outerLoopStart

outerLoopEnd:
LOADI  0
STORE resultStatus
HOLD


a: WORD 0
b: WORD 0
resultStatus: WORD 255
aSQ: WORD 0
bSQ: WORD 0
c: WORD 0
p: WORD 10