[Z-MACHINE] Question about `erase_window`

Section 8.7.2 of the standard (1.1) says:

There are two “windows”, called “upper” and “lower”: at any given time one of these two is selected.

for versions 4 and later, except 6. However, on a txd output of A Mind Forever Voyaging, I see ERASE_WINDOW #ffff at address 0x19a28.

How should this be interpreted?

Thanks for any pointers.

Section 15 explains the opcode’s operation in detail:


Erases window with given number (to background colour); or if -1 it unsplits the screen and clears the lot; or if -2 it clears the screen without unsplitting it. In cases -1 and -2, the cursor may move (see S 8 for precise details).

I see - I didn’t notice it was a signed number, my mistake!

Yep, pretty much everything in the Z-machine is signed—even in cases where it doesn’t make much sense. I suppose it simplifies the implementation!

Not quite, from my ZVM implementation I think I count 18 opcodes that must have signed operands out of 103 total opcodes. But there are probably a lot more that could used signed operands without it mattering if that’s how it was implemented.

1 Like