Files
QkoSad 7894b48931 .
2025-07-16 13:00:37 +03:00

148 lines
1.9 KiB
Plaintext
Executable File

function Memory.init 0
push constant 0
pop static 0
push static 0
push constant 2048
push constant 14334
pop temp 1
add
pop pointer 1
push temp 1
pop that 0
push static 0
push constant 2049
push constant 1
neg
pop temp 1
add
pop pointer 1
push temp 1
pop that 0
push constant 0
return
function Memory.peek 0
push static 0
push argument 0
add
pop pointer 1
push that 0
return
function Memory.poke 0
push static 0
push argument 0
push argument 1
pop temp 1
add
pop pointer 1
push temp 1
pop that 0
push constant 0
return
function Memory.alloc 2
push constant 2048
pop local 0
push argument 0
push constant 0
lt
not
if-goto L0
push constant 5
call Sys.error 1
pop temp 0
goto L1
label L0
label L1
push argument 0
push constant 0
eq
not
if-goto L2
push constant 1
pop argument 0
goto L3
label L2
label L3
label L4
push local 0
push constant 0
add
pop pointer 1
push that 0
push argument 0
push constant 2
add
lt
not
if-goto L5
push local 0
push constant 1
add
pop pointer 1
push that 0
pop local 0
goto L4
label L5
push local 0
push constant 0
push local 0
push constant 0
add
pop pointer 1
push that 0
push argument 0
sub
push constant 2
sub
pop temp 1
add
pop pointer 1
push temp 1
pop that 0
push local 0
push local 0
push constant 0
add
pop pointer 1
push that 0
add
push constant 2
add
pop local 0
push local 0
push constant 0
push argument 0
pop temp 1
add
pop pointer 1
push temp 1
pop that 0
push local 0
push constant 2
add
return
function Memory.deAlloc 1
push constant 2048
pop local 0
push argument 0
push constant 1
push local 0
push constant 1
add
pop pointer 1
push that 0
pop temp 1
add
pop pointer 1
push temp 1
pop that 0
push local 0
push constant 1
push argument 0
pop temp 1
add
pop pointer 1
push temp 1
pop that 0
push constant 0
return