mirror of
https://github.com/usatiuk/nand2tetris.git
synced 2025-10-29 00:27:49 +01:00
53 lines
738 B
Plaintext
53 lines
738 B
Plaintext
function Cell.new 0
|
|
push constant 6
|
|
call Memory.alloc 1
|
|
pop pointer 0
|
|
push argument 0
|
|
pop this 0
|
|
push argument 1
|
|
pop this 1
|
|
push argument 2
|
|
pop this 2
|
|
push argument 3
|
|
pop this 3
|
|
push constant 8
|
|
pop this 4
|
|
push constant 11
|
|
pop this 5
|
|
push pointer 0
|
|
return
|
|
function Cell.draw 0
|
|
push argument 0
|
|
pop pointer 0
|
|
push this 1
|
|
push constant 1
|
|
add
|
|
push this 0
|
|
push constant 1
|
|
add
|
|
push this 2
|
|
call Math.multiply 2
|
|
call Output.moveCursor 2
|
|
pop temp 0
|
|
push this 3
|
|
call Output.printInt 1
|
|
pop temp 0
|
|
push this 4
|
|
push this 0
|
|
call Math.multiply 2
|
|
push this 1
|
|
push this 5
|
|
call Math.multiply 2
|
|
push this 4
|
|
push this 0
|
|
push this 2
|
|
add
|
|
call Math.multiply 2
|
|
push this 1
|
|
push this 5
|
|
call Math.multiply 2
|
|
call Screen.drawLine 4
|
|
pop temp 0
|
|
push constant 0
|
|
return
|