Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!



athlonxlathlonxl Member Posts: 1
having trouble with a program.
The program should monitor the keyboard, waiting for a keystroke. While no keystroke is entered,it should do something else, such as display the current time, or display a counter. Something visual is good, so that we can see something is happening while we wait for a key.

When the user enters a keystroke it should be clearly displayed somewhere on the screen.

To implement the polled waiting loop use int 16H function 1(see bios handout). This function checks to see if a key has been entered and returns 0 in the ZF (zero flag) if a key was entered, 1 if not. It does NOT wait for a key to be entered and it does NOT remove the key from the buffer. Use int 16H function 0 to get the key once one has been entered.

After calling int 16H, function 1, you can access the ZF in the same way you access the intel registers. For example, if you've defined a union REGS r then access the ZF through r.x.flags. The ZF is bit number 6 in the flags register. You'll need to do some bitwise operations here.

You can use printfs or int 10H functions for your output , your choice. Continue waiting for, and displaying keystrokes until a 'q' is entered, then exit the program.

im thinking of doing a clock that displays real time but cant make so it keeps changing so that the time is constant without me interfering.

here is what i have



  • AsmGuru62AsmGuru62 Member Posts: 6,519
    [color=Blue]I did not write the full code - simply do not remember the DOS days. Just look at the logic and find out how to do it in VC++ of old days, because VC++ today is no longer for DOS - only for Windows.[/color]
    : [code]
    : #include
    : #include
    : #include
Sign In or Register to comment.