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

191 lines
2.4 KiB
Plaintext
Executable File

function SquareGame.new 0
push constant 2
call Memory.alloc 1
pop pointer 0
push constant 0
push constant 0
push constant 30
call Square.new 3
pop this 0
push constant 0
pop this 1
push pointer 0
return
function SquareGame.dispose 0
push argument 0
pop pointer 0
push this 0
call Square.dispose 1
pop temp 0
push pointer 0
call Memory.deAlloc 1
pop temp 0
push constant 0
return
function SquareGame.moveSquare 0
push argument 0
pop pointer 0
push this 1
push constant 1
eq
not
if-goto L0
push this 0
call Square.moveUp 1
pop temp 0
goto L1
label L0
label L1
push this 1
push constant 2
eq
not
if-goto L2
push this 0
call Square.moveDown 1
pop temp 0
goto L3
label L2
label L3
push this 1
push constant 3
eq
not
if-goto L4
push this 0
call Square.moveLeft 1
pop temp 0
goto L5
label L4
label L5
push this 1
push constant 4
eq
not
if-goto L6
push this 0
call Square.moveRight 1
pop temp 0
goto L7
label L6
label L7
push constant 5
call Sys.wait 1
pop temp 0
push constant 0
return
function SquareGame.run 2
push argument 0
pop pointer 0
push constant 0
pop local 1
label L8
push local 1
not
not
if-goto L9
label L10
push local 0
push constant 0
eq
not
if-goto L11
call Keyboard.keyPressed 0
pop local 0
push pointer 0
call SquareGame.moveSquare 1
pop temp 0
goto L10
label L11
push local 0
push constant 81
eq
not
if-goto L12
push constant 1
neg
pop local 1
goto L13
label L12
label L13
push local 0
push constant 90
eq
not
if-goto L14
push this 0
call Square.decSize 1
pop temp 0
goto L15
label L14
label L15
push local 0
push constant 88
eq
not
if-goto L16
push this 0
call Square.incSize 1
pop temp 0
goto L17
label L16
label L17
push local 0
push constant 131
eq
not
if-goto L18
push constant 1
pop this 1
goto L19
label L18
label L19
push local 0
push constant 133
eq
not
if-goto L20
push constant 2
pop this 1
goto L21
label L20
label L21
push local 0
push constant 130
eq
not
if-goto L22
push constant 3
pop this 1
goto L23
label L22
label L23
push local 0
push constant 132
eq
not
if-goto L24
push constant 4
pop this 1
goto L25
label L24
label L25
label L26
push local 0
push constant 0
eq
not
not
if-goto L27
call Keyboard.keyPressed 0
pop local 0
push pointer 0
call SquareGame.moveSquare 1
pop temp 0
goto L26
label L27
goto L8
label L9
push constant 0
return