I have never used the hchar C function, but it calls the ROM routine for diplaying characters in HIRES (CHAR). If that is the case, then your idea should work.
This BASIC code does it:
Code: Select all
6 CURSET 120,100,3
10 CHAR #7F,0,1
20 WAIT 20
30 CHAR #7F,0,0
35 WAIT 20
40 GOTO 10
However I think there is not a C wrapper for the wait function, so I guess that is what you are trying to do with your while loops and clock. Maybe the error is there. The vars accessed by clock decrement each 1/100th of a second, I think, so 150 would be something like 1.5 secs, which is enough.
Mmmm... not sure what could be happening here. Maybe the code is being optimized as to remove the while loops (as they do nothing)? Maybe there is an error in the implementation of clock?. Maybe an error in the compiler? (I sometimes had to make a variable global to avoid strange errors).
I'd try to change the loops to something like for(i=0;i<10000;i++); and see what happens. If that fails, try to put a getchar(); and see if it blinks when you press return...
Still there is a much much simpler solution to your problem. Use the flashing attribute. Plot a flash attribute, plot the square, plot a remove flash attribute. The flash attribute must be plotted at each of the 8 rows the char uses, of course...
And, beware, hchar is extremely slow. There are much faster ways of plotting chars on hires screen (like simply copying the data in the charset area into the HIRES screen).