ASM print all already printed values

I have an ASM script that displays a date (day, month, year) and time (hours, minutes, seconds).

Sends the current time and date to a DOS field. The thing is, it is static. I want to make it dynamic, that is, I need to write a new value at the exact location where the current value is on the screen. How do you do it in ASM?

I have no clue and google was not my friend for this.

0


source to share


3 answers


Use ASM code to position the cursor before printing the line. For example:



        MOV     DX,1629H                ; (LINE 16H, COL 29H)
        MOV     AH,2                    ; Move cursor to DH,DL
        INT     10H
        ; now print your string

      

+2


source


If your DOS-box is COMMAND.COM or CMD.EXE before Windows 2000 (new CMD.EXE doesn't support ANSI) then it will support ANSI escape sequences. You can use various cursor commands to position the cursor at the beginning of your clock before displaying the new time.



0


source


This is not a language specific problem, but more platform specific. You said you are working in a DOS box, so you can use one of the following:

  • If you are using a DOS printing routine (for example INT 21h with AH = 9), you can print a carriage return (ASCII 13) without the next newline character (ASCII 10) to return the cursor to the beginning of the current line. Likewise, if it is actually a Windows console application and you are using WriteConsole, you should achieve the same effect.
  • If you are indeed using DOS, you can use BIOS to update the current cursor position with INT 10h, AH = 2.
  • As Sparr mentioned, you can send ANSI escape sequences (if ansi.sys is loaded) to control the cursor as well as other things like color. These escape sequences will be printed (e.g. ala INT 21h, AH = 9) just like your text.

If you are going to do a lot of assembly programming in DOS, I would keep the bookmark one of the several abort .

0


source







All Articles