function Game.new 3
push constant 6
call Memory.alloc 1
pop pointer 0
push constant 0
pop this 2
push constant 8
pop this 0
push constant 3
pop this 1
push constant 250
push constant 220
push constant 50
push constant 10
call Rect.new 4
pop this 3
push constant 250
push constant 200
push constant 6
push constant 1
push constant 1
call Ball.new 5
pop this 4
push this 0
push this 1
call Math.multiply 2
call Array.new 1
pop this 5
label WHILE_EXP0
push local 0
push this 0
lt
not
if-goto WHILE_END0
label WHILE_EXP1
push local 1
push this 1
lt
not
if-goto WHILE_END1
push local 0
push constant 3
call Math.multiply 2
push local 1
add
push this 5
add
push local 0
push constant 60
call Math.multiply 2
push constant 20
add
push local 1
push constant 30
call Math.multiply 2
push constant 20
add
push constant 50
push constant 15
call Rect.new 4
pop temp 0
pop pointer 1
push temp 0
pop that 0
push local 0
push constant 3
call Math.multiply 2
push local 1
add
push this 5
add
pop pointer 1
push that 0
pop local 2
push local 2
call Rect.draw 1
pop temp 0
push local 1
push constant 1
add
pop local 1
goto WHILE_EXP1
label WHILE_END1
push constant 0
pop local 1
push local 0
push constant 1
add
pop local 0
goto WHILE_EXP0
label WHILE_END0
push pointer 0
return
function Game.loop 1
push argument 0
pop pointer 0
label WHILE_EXP0
push constant 0
not
not
if-goto WHILE_END0
push constant 16
call Sys.wait 1
pop temp 0
push this 2
push constant 0
eq
if-goto IF_TRUE0
goto IF_FALSE0
label IF_TRUE0
push pointer 0
call Game.movePaddle 1
pop temp 0
push this 4
call Ball.update 1
pop temp 0
push pointer 0
call Game.chackBallPaddleCol 1
pop temp 0
push pointer 0
call Game.checkBallBricksCol 1
pop temp 0
push pointer 0
call Game.checkGameOver 1
pop temp 0
goto IF_END0
label IF_FALSE0
call Keyboard.keyPressed 0
pop local 0
push local 0
push constant 82
eq
if-goto IF_TRUE1
goto IF_FALSE1
label IF_TRUE1
push pointer 0
call Game.resetGame 1
pop temp 0
label IF_FALSE1
label IF_END0
goto WHILE_EXP0
label WHILE_END0
push constant 0
return
function Game.resetGame 3
push argument 0
pop pointer 0
call Screen.clearScreen 0
pop temp 0
push this 3
push constant 250
push constant 220
call Rect.setPos 3
pop temp 0
push this 4
push constant 250
push constant 200
call Ball.setPos 3
pop temp 0
push this 4
push constant 1
push constant 1
call Ball.setSpeed 3
pop temp 0
push this 0
push this 1
call Math.multiply 2
pop local 1
label WHILE_EXP0
push local 0
push local 1
lt
not
if-goto WHILE_END0
push local 0
push this 5
add
pop pointer 1
push that 0
pop local 2
push local 2
push constant 0
call Rect.setHidden 2
pop temp 0
push local 2
call Rect.draw 1
pop temp 0
push local 0
push constant 1
add
pop local 0
goto WHILE_EXP0
label WHILE_END0
push constant 0
pop this 2
push constant 0
return
function Game.checkGameOver 1
push argument 0
pop pointer 0
push this 4
call Ball.getBottom 1
pop local 0
push local 0
push constant 240
gt
if-goto IF_TRUE0
goto IF_FALSE0
label IF_TRUE0
push constant 1
pop this 2
push constant 0
push constant 0
call Output.moveCursor 2
pop temp 0
call Output.println 0
pop temp 0
push constant 9
call String.new 1
push constant 103
call String.appendChar 2
push constant 97
call String.appendChar 2
push constant 109
call String.appendChar 2
push constant 101
call String.appendChar 2
push constant 32
call String.appendChar 2
push constant 111
call String.appendChar 2
push constant 118
call String.appendChar 2
push constant 101
call String.appendChar 2
push constant 114
call String.appendChar 2
call Output.printString 1
pop temp 0
call Output.println 0
pop temp 0
push constant 18
call String.new 1
push constant 112
call String.appendChar 2
push constant 114
call String.appendChar 2
push constant 101
call String.appendChar 2
push constant 115
call String.appendChar 2
push constant 115
call String.appendChar 2
push constant 32
call String.appendChar 2
push constant 114
call String.appendChar 2
push constant 32
call String.appendChar 2
push constant 116
call String.appendChar 2
push constant 111
call String.appendChar 2
push constant 32
call String.appendChar 2
push constant 114
call String.appendChar 2
push constant 101
call String.appendChar 2
push constant 115
call String.appendChar 2
push constant 116
call String.appendChar 2
push constant 97
call String.appendChar 2
push constant 114
call String.appendChar 2
push constant 116
call String.appendChar 2
call Output.printString 1
pop temp 0
label IF_FALSE0
push constant 0
return
function Game.movePaddle 3
push argument 0
pop pointer 0
call Keyboard.keyPressed 0
pop local 0
push this 3
call Rect.getLeft 1
pop local 1
push this 3
call Rect.getRight 1
pop local 2
push local 0
push constant 130
eq
push local 1
push constant 0
gt
and
if-goto IF_TRUE0
goto IF_FALSE0
label IF_TRUE0
push this 3
push constant 2
call Rect.moveLeft 2
pop temp 0
label IF_FALSE0
push local 0
push constant 132
eq
push local 2
push constant 510
lt
and
if-goto IF_TRUE1
goto IF_FALSE1
label IF_TRUE1
push this 3
push constant 2
call Rect.moveRight 2
pop temp 0
label IF_FALSE1
push this 3
call Rect.draw 1
pop temp 0
push constant 0
return
function Game.chackBallPaddleCol 11
push argument 0
pop pointer 0
push this 3
call Rect.getLeft 1
pop local 0
push this 3
call Rect.getRight 1
pop local 1
push this 3
call Rect.getTop 1
pop local 2
push this 3
call Rect.getBottom 1
pop local 3
push local 1
push local 0
add
push constant 2
call Math.divide 2
pop local 4
push this 4
call Ball.getLeft 1
pop local 5
push this 4
call Ball.getRight 1
pop local 6
push this 4
call Ball.getTop 1
pop local 7
push this 4
call Ball.getBottom 1
pop local 8
push local 6
push local 5
add
push constant 2
call Math.divide 2
pop local 9
push this 4
call Ball.getVspeed 1
pop local 10
push local 5
push local 0
gt
push local 6
push local 1
lt
and
if-goto IF_TRUE0
goto IF_FALSE0
label IF_TRUE0
push local 8
push local 2
gt
push local 10
push constant 0
gt
and
if-goto IF_TRUE1
goto IF_FALSE1
label IF_TRUE1
push local 9
push local 4
gt
if-goto IF_TRUE2
goto IF_FALSE2
label IF_TRUE2
push this 4
push constant 1
push constant 1
neg
call Ball.setSpeed 3
pop temp 0
goto IF_END2
label IF_FALSE2
push this 4
push constant 1
neg
push constant 1
neg
call Ball.setSpeed 3
pop temp 0
label IF_END2
label IF_FALSE1
label IF_FALSE0
push constant 0
return
function Game.checkBallBricksCol 21
push argument 0
pop pointer 0
push this 4
call Ball.getLeft 1
pop local 5
push this 4
call Ball.getRight 1
pop local 6
push this 4
call Ball.getTop 1
pop local 7
push this 4
call Ball.getBottom 1
pop local 8
push this 4
call Ball.getVspeed 1
pop local 9
push this 0
push this 1
call Math.multiply 2
pop local 19
label WHILE_EXP0
push local 18
push local 19
lt
not
if-goto WHILE_END0
push local 18
push this 5
add
pop pointer 1
push that 0
pop local 20
push local 20
call Rect.getLeft 1
pop local 0
push local 20
call Rect.getRight 1
pop local 1
push local 20
call Rect.getTop 1
pop local 2
push local 20
call Rect.getBottom 1
pop local 3
push local 20
call Rect.getHidden 1
pop local 4
push local 4
push constant 1
lt
if-goto IF_TRUE0
goto IF_FALSE0
label IF_TRUE0
push local 20
call Rect.draw 1
pop temp 0
push local 5
push local 0
gt
push local 6
push local 1
lt
and
if-goto IF_TRUE1
goto IF_FALSE1
label IF_TRUE1
push local 8
push local 2
gt
push local 7
push local 3
lt
and
if-goto IF_TRUE2
goto IF_FALSE2
label IF_TRUE2
push local 20
push constant 1
call Rect.setHidden 2
pop temp 0
push local 20
call Rect.draw 1
pop temp 0
push local 6
push local 0
sub
pop local 10
push local 1
push local 5
sub
pop local 11
push local 8
push local 2
sub
pop local 12
push local 3
push local 7
sub
pop local 13
push local 10
call Util.abs 1
push local 11
call Util.abs 1
lt
if-goto IF_TRUE3
goto IF_FALSE3
label IF_TRUE3
push constant 1
pop local 14
push local 10
pop local 16
goto IF_END3
label IF_FALSE3
push local 11
pop local 16
label IF_END3
push local 12
call Util.abs 1
push local 13
call Util.abs 1
lt
if-goto IF_TRUE4
goto IF_FALSE4
label IF_TRUE4
push constant 1
pop local 15
push local 12
pop local 17
goto IF_END4
label IF_FALSE4
push local 13
pop local 17
label IF_END4
push local 16
call Util.abs 1
push local 17
call Util.abs 1
lt
if-goto IF_TRUE5
goto IF_FALSE5
label IF_TRUE5
push this 4
call Ball.invertHspeed 1
pop temp 0
goto IF_END5
label IF_FALSE5
push this 4
call Ball.invertVspeed 1
pop temp 0
label IF_END5
label IF_FALSE2
label IF_FALSE1
label IF_FALSE0
push local 18
push constant 1
add
pop local 18
goto WHILE_EXP0
label WHILE_END0
push constant 0
return
