fillautomatic problem

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

fillautomatic problem

karam
hello
my code below work with interactive fill file normaly but when i use
the fill automatically file it throw error and i have checked my code multiply time
and i cant undestand why it dosnt work


in my code im looping in infinit loop
and pushing 1 in screen memory block  block
until its fild
and when done it return to the loop and check if key is presed or not
and keep the screen black or clear it acordingly


fill automatically file:

set RAM[24576] 0,    // the keyboard is untouched
repeat 1000000 {
  ticktock;
}
output;              // test that the screen is white

set RAM[24576] 1,    // a keyboard key is pressed
repeat 1000000 {
  ticktock;
}
output;              // test that the screen is black

set RAM[24576] 0,    // they keyboard in untouched
repeat 1000000 {
  ticktock;
}
output;              // test that the screen is white


my code:

(loop)
@8191
D=A
@i
M=D
@KBD
D=M
@Black
D;JNE
@white
D;JEQ
@loop
0;JMP


(Black)
@i
D=M
@SCREEN
A=A+D
M=-1
@i
M=M-1
D=M
@Black
D;JNE
@loop
D;JEQ


(white)
@i
D=M
@SCREEN
A=A+D
M=0
@i
M=M-1
D=M
@white
D;JNE
@loop
0;JMP








Reply | Threaded
Open this post in threaded view
|

Re: fillautomatic problem

WBahn
Administrator
Saying that "it throw error" doesn't give us much to go on.

WHAT error is it throwing?

WHAT is it doing that it shouldn't, or not doing that it should?

WHAT error message or indication is given.

Reply | Threaded
Open this post in threaded view
|

Re: fillautomatic problem

karam
in the compiler ther is a message that indelicate failure in compiling line 3
Reply | Threaded
Open this post in threaded view
|

Re: fillautomatic problem

WBahn
Administrator
My crystal ball isn't back from the shop yet. I can't remotely peer into your output file and see what about it failed to compare on line 3.

My guess, however, is that if YOU look at it and spend some time with it, you will likely find that there is one value that is not comparing. Focus on why that value is not getting set properly.
Reply | Threaded
Open this post in threaded view
|

Re: fillautomatic problem

karam
i have solved the problem i didnt handle the first cell in screen  memory block
so in the fillautomatic ther was one bite wrong and it Brock the program but in
the fil interactive it didnt care
Reply | Threaded
Open this post in threaded view
|

Re: fillautomatic problem

WBahn
Administrator
Yep.

In your loop you were changing a RAM location, decrementing the index, and then checking if you were at the last index (which you had NOT yet changed) and exiting the loop if you were.

But the main takeaway is that you don't just look at the summary of "you got it wrong", you need to delve into the information provided of exactly what was wrong so that you can better focus on where the problem is happening.