Built in function tried to access memory outside heap or screen

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Built in function tried to access memory outside heap or screen

kingofbuffs
Hey guys,

I am getting this error in the Square game. (Also, in pretty much every other program I have written myself, although it could be because of incorrect code.)

Any way to deal with this? What is this error indicating exactly? I have not changed anything in the files, and compiled the files as is.

Furthermore, compiling the vm files to asm files and running it on cpu emulator, I get this:



Although, this could be because of my possibly faulty vm translator.

Is there any known bugs in the given jack compiler or am I doing something wrong?

Reply | Threaded
Open this post in threaded view
|

Re: Built in function tried to access memory outside heap or screen

WBahn
Administrator
Look at your screen shot. You are trying to execute the instruction M=D when the value in the A register is 24577.

What memory address is your program trying to access when you execute this instruction with that value in the A register?

What is located at that memory address in the Hack RAM memory space?
Reply | Threaded
Open this post in threaded view
|

Re: Built in function tried to access memory outside heap or screen

kingofbuffs
I was able to solve the first problem, which was the one that was throwing off the error in the title. I was making a trivial mistake (as I always do...). Instead of loading the whole directory, I was only loading the Main.vm. After this, square game functions properly in the vm emulator.

However, translating it into lower level and loading it into the cpu emulator still does not function properly and creates that strange pattern, and eventually the error.

I wish there was more robust testing for the chapter 7 and 8, because the experience has been very frusturating, even after passing all the tests given by the course and contributors, vm translator still seems buggy. Hopefully, it will be fixed in the second edition.

I will now start focusing on my project 9, and maybe go back to the problem later.