mirror of
https://github.com/usatiuk/nand2tetris.git
synced 2025-10-29 00:27:49 +01:00
24 lines
336 B
Plaintext
24 lines
336 B
Plaintext
function Array.new 0
|
|
push argument 0
|
|
push constant 0
|
|
gt
|
|
not
|
|
if-goto IF_TRUE0
|
|
goto IF_FALSE0
|
|
label IF_TRUE0
|
|
push constant 2
|
|
call Sys.error 1
|
|
pop temp 0
|
|
label IF_FALSE0
|
|
push argument 0
|
|
call Memory.alloc 1
|
|
return
|
|
function Array.dispose 0
|
|
push argument 0
|
|
pop pointer 0
|
|
push pointer 0
|
|
call Memory.deAlloc 1
|
|
pop temp 0
|
|
push constant 0
|
|
return
|