Howdy, Stranger!

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

Categories

TSR screen restore?

I am designing an assembly program that will display the time on screen. The program will also change the int 9 handler to my new routine which will intercept Alt-M to activate a menu and at the same time the INT 1ch handler. I'm having a problem with regards to restoring the screen after the Menu. Of course before calling the Menu routine I first saved the screen's current informations by setting the ds:[si] to 0b800h and es:[di] to my buffer and I used the movsw op code to do the job. I do the opposite of this routine to restore the screen. Unfortunately, I had unpredictable results and mostly it resulted to a computer crash. By the way my menu and screen restoring routines were integrated into my keyboard handler. I used COM for this program. Anybody who can help me? Tnx. Programmers RULE!!!!

Comments

  • roland_changroland_chang Member Posts: 27
    : I am designing an assembly program that will display the time on screen. The program will also change the int 9 handler to my new routine which will intercept Alt-M to activate a menu and at the same time the INT 1ch handler. I'm having a problem with regards to restoring the screen after the Menu. Of course before calling the Menu routine I first saved the screen's current informations by setting the ds:[si] to 0b800h and es:[di] to my buffer and I used the movsw op code to do the job. I do the opposite of this routine to restore the screen. Unfortunately, I had unpredictable results and mostly it resulted to a computer crash. By the way my menu and screen restoring routines were integrated into my keyboard handler. I used COM for this program. Anybody who can help me? Tnx. Programmers RULE!!!!
    :

    In DOS TSR, there are some pitfalls need to be handled carefully:
    1. Segment registers need to be re-initialize to your default segment.
    2. CLD/STD must be used before REP/MOVSB ..., because you do not know if the direction flag is modified by other program.
    3. Avoid interrupt routine is re-entered. Example:type one key will generate at least 2 interrupts, one when key pressed, and another key release, and may be more interrupts.
    4. Create your own stack for TSR if you need large stack size to avoid corrupt stack. The application or MS-DOS may reserve very small amount of stack.

    Anybody likes to add some points?

  • PrzemekG_PrzemekG_ Member Posts: 595
    Also there may be a problem if the user press Alt-M when he will already be in your program.
  • programmerEXprogrammerEX Member Posts: 16
    Thanx very very much for the reply. I think my fault was the exclusion of CLD/STD. I appreciated it a lot. I hope that this sharing of ideas will never end.
  • maraimarai Member Posts: 5
    [b][red]This message was edited by the marai at 2002-5-25 14:51:19[/red][/b][hr]
    I HAD SIMILAR PROBLEM...
    I WANT TO WRITE PROGRAM THAT ASK USER TO ENTER THE TIME HE WANTS IN mm:ss AND WHEN HE PRESSES CARIAGE RETURN THE PROGRAM STARTS DOWN COUNTING AS STOP WATCH AND WHEN THE USER PRESSES ANY KEY, THE PROGRAM TERMINATE...
    I USED INT 1CH THAT GET CALLED 18.2 PER SECOND WHEN INT 8 IS CALLED BUT THE PROGRAM PRINT EXTRA DIGITS FOR ME EVEN THOUGH I CONVERT THE TIME AND DISPLAY CORRECTLY...
    I THINK THE PROBLEM IS WHEN THE NEW TIME PRINTED, IT'S PRINTED NOT IN EXACTLY THE SAME COORDINATE AS THE PREVIOUS ONE ...?


  • roland_changroland_chang Member Posts: 27
    : [b][red]This message was edited by the marai at 2002-5-25 14:51:19[/red][/b][hr]
    : I HAD SIMILAR PROBLEM...
    : I WANT TO WRITE PROGRAM THAT ASK USER TO ENTER THE TIME HE WANTS IN mm:ss AND WHEN HE PRESSES CARIAGE RETURN THE PROGRAM STARTS DOWN COUNTING AS STOP WATCH AND WHEN THE USER PRESSES ANY KEY, THE PROGRAM TERMINATE...
    : I USED INT 1CH THAT GET CALLED 18.2 PER SECOND WHEN INT 8 IS CALLED BUT THE PROGRAM PRINT EXTRA DIGITS FOR ME EVEN THOUGH I CONVERT THE TIME AND DISPLAY CORRECTLY...
    : I THINK THE PROBLEM IS WHEN THE NEW TIME PRINTED, IT'S PRINTED NOT IN EXACTLY THE SAME COORDINATE AS THE PREVIOUS ONE ...?
    :
    :
    :

    If you like to print information on screen at fix position, you need to set cursor position before every print function called ( By INT10 BIOS ? ).
    If your program is a TSR and call print function in INT1C handler, maybe you need to print information by driect access display buffer. Because calling INT10 from INT1C may cause re-entry of INT10. That is, some app. call INT10, in INT10, timer interrupt occurred and call INT1C, then call INT10. Or you must guarantee your TSR will NOT entered in INT10. ( By hook a int10 hanlder to process this condition ).

  • Justin BibJustin Bib USAMember Posts: 0

    ___ { http://forcoder.org } free video tutorials and ebooks about [ R Delphi Scratch MATLAB Go Python PL/SQL Visual Basic Java Visual Basic .NET Swift Ruby C++ C Perl PHP C# Objective-C JavaScript Assembly Bash Erlang Ada Crystal Julia Hack Awk D Scala SAS Apex COBOL VBScript Rust F# LabVIEW FoxPro Dart Lisp Kotlin Lua Alice Transact-SQL Scheme Fortran Logo Clojure Prolog ML ABAP ] _____________

Sign In or Register to comment.