Text output behavior

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

Text output behavior

dd-b
The behavior isn't exactly "wrong" .  But it caused considerable confusion for quite a while.

The Output.print* functions wrap around to the top of the screen rather than scrolling, and they don't clear the line when they're starting to output to it.  

This combination made some debugging logging in a random number generator look like it was printing out values for var ints that were in excess of 65536 (it was actually printing shorter stuff into a longer line and what was left at the end was a few additional digits, which then  looked like they were part of the line).

The solution was to make sure there were spaces at the end of the logging output -- not even necessarily enough to clear the line, just enough to make clear the boundary between what was output this time and any previous leftover garbage.  

Scrolling is, I think, impractical as things are currently implemented.  Clearing the line, though, that isn't obviously crazy.  Or just emphasizing in the documentation that it behaves this way, and suggest making sure you can tell where your latest output ends and thus detect what is leftover garbage at the end of the line?  I dunno, nobody ever finds and reads the documentation.  
Reply | Threaded
Open this post in threaded view
|

Re: Text output behavior

ivant
dd-b wrote
Scrolling is, I think, impractical as things are currently implemented.
Scrolling is not only an option, it's even suggested as a possible implementation in the book. The default implementation is without scrolling, which makes the other one even more satisfying, when you implement it yourself.
jrd
Reply | Threaded
Open this post in threaded view
|

Re: Text output behavior/Scrolling Solution?

jrd
So, I am actually still confused on the general implementation of screen scrolling.

Can someone clarify a bit more the process to enable screen scrolling?  It's essential to the working of my Chapter 9 game project.  Thx.

- JRD
Reply | Threaded
Open this post in threaded view
|

Re: Text output behavior/Scrolling Solution?

cadet1620
Administrator
jrd wrote
So, I am actually still confused on the general implementation of screen scrolling.

Can someone clarify a bit more the process to enable screen scrolling?  It's essential to the working of my Chapter 9 game project.  Thx.
Scrolling is not implemented in the supplied Output.vm file nor in the VMEmulator program.

In chapter 12, you will write your own version of Output.jack.  That is where you can write code that supports scrolling.

--Mark