Fill.asm doubt

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

Fill.asm doubt

learning67
This post was updated on .
Hi,

Thank you for doing such an incredible job with the course.
Unfortunately I haven't been able to debug this error, '*At line 32757;
can't continue past line*' and '*At line 30: Destination is M but A=24577
is an illegal address'*
I am unable to understand how it reaches 24577.

The code I have is:

[source code deleted by admin]

@KBD //Checking the keyboard value
D=M
@AHEAD
D;JEQ //if the keyboard is equal to zero jump ahead
@-1   //else assign -1 to value
D=A

[source code deleted by admin]

Any help that you can provide would be great!
Reply | Threaded
Open this post in threaded view
|

Re: Fill.asm doubt

cadet1620
Administrator
learning67 wrote
Hi,

Thank you for doing such an incredible job with the course.
Unfortunately I haven't been able to debug this error, '*At line 32757;
can't continue past line*' and '*At line 30: Destination is M but A=24577
is an illegal address'*
I am unable to understand how it reaches 24577.

The code I have is:
...
@KBD //Checking the keyboard value
D=M
@AHEAD
D;JEQ //if the keyboard is equal to zero jump ahead
@-1   //else assign -1 to value
"@-1" is not a legal A-command. The number must be between 0 and 32767. Use the C-command "A=-1".

There is a bug in the CPU Emulator (and the supplied Assembler) that causes it to write a bad machine instruction for "@-1". This results in a wild jump and your program executes off the end of ROM resulting in the 32767 message.

When I fix that, your code runs without crashing, but does not do anything when a key is pressed.

There is a logic problem with your POINTER : SCREENEND comparison. Fix one instruction there and your program works.

[Please edit your post to remove the source code once your problem is resolved.]

--Mark