out of segment space?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

out of segment space?

virote328
Hello, I got an error on the VM emulator.  

it tells me "Out of segment space in Square.draw.7"

But I haven't the faintest idea of what that means....

To familiarize myself with Jack, I make a simple game where a square spawns at the top of the screen
and when it gets to the bottom , the square is destroyed.

I made my own Square class.  it is similar to the one provided, but with some changes.
Can anyone help me figure out what this means so i can fix it?  I can provide any details you need.

This is the function that it is messing up on...
        method void draw(){
                do Screen.setColor(true);
                if (color){ //makes a filled in square
                        do Screen.drawRectangle(x, y, x+size, y+size);
                }
                else { //makes an outline of a square
                        do Screen.drawLine(x, y, x+size, y);
                        do Screen.drawLine(x+size, y, x+size, y+size);
                        do Screen.drawLine(x+size, y+size, x, y+size);
                        do Screen.drawLine(x, y+size, x, y);
                }
                return;
        }


This is the vm code produced by the provided jackCompiler

function Square.draw 0
push argument 0
pop pointer 0
push constant 0
not
call Screen.setColor 1
pop temp 0
push this 3  //<----------------------this is the line that the vm emulator screams the error
if-goto IF_TRUE0
goto IF_FALSE0
label IF_TRUE0
push this 0
push this 1
push this 0
push this 2
add
push this 1
push this 2
add
call Screen.drawRectangle 4
pop temp 0
goto IF_END0
label IF_FALSE0
push this 0
push this 1
push this 0
push this 2
add
push this 1
call Screen.drawLine 4
pop temp 0
push this 0
push this 2
add
push this 1
push this 0
push this 2
add
push this 1
push this 2
add
call Screen.drawLine 4
pop temp 0
push this 0
push this 2
add
push this 1
push this 2
add
push this 0
push this 1
push this 2
add
call Screen.drawLine 4
pop temp 0
push this 0
push this 1
push this 2
add
push this 0
push this 1
call Screen.drawLine 4
pop temp 0
label IF_END0
push constant 0
return
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: out of segment space?

virote328
Never mind.  The reason for the error was because I was trying to draw a non-existent square.

I have a part of my code where I dispose the square object and I didn't realize that I was attempting to draw before recreating the square.


Learning a new language is always full of noob mistakes
Loading...