Search code examples
cassemblypromptdump

how can I pause my C program when a page of the console has been printed?


I'm working on a basic SIC assembler and one of the features that I'm trying to implement is that during a dump function, if the program generates more than a page of text on the console, it would prompt the user to press a key before continuing.

My dump function reads out the hex values of a range of addresses in memory.


Solution

  • First you need to define what a "page" is. Then you will know how many lines are available. Then when printing you stop to get input every X lines (where X is the number of lines per page) before continuing printing the next X lines.

    Because reading input will block until the user presses the Enter key (normally) then it will seem like your program pauses.