I'm using Tasm 1.4. I'm trying to change the color of the background and text without clearing the previous text, but it always ends up on clearing the previous text although the colors are changed.
For example:
mov ah,09h
lea dx,text1
int 21h ;displays text1
mov ah,01h
int 21h ;I input a character
mov ah,06h
mov bh,42h
mov cx,0000h
mov dx,184fh
int 10h ;I use this to change the text and background color
mov ah,02h
mov bh,00h
mov dh,0ch
mov dl,20h
int 10h ;along with this
mov ah,09h
lea dx,text2
int 21h ;displays text2
mov ah,02h
mov dl,al
int 21h ;displays the inputted character
Now what happens there is...
- it displays text1
- it asks for an input
- I enter an input
- it will display text2 followed by the inputted character, with the background color changed to red and the text color changed to green. But, text1 was cleared from the screen.
I should also say that text1 and text2 can definitely fit in the same screen.
So how do I get the same output but with text1 not being cleared from the screen?
text2
followed by the character that was typed to be displayed in the new color scheme. – Anastigmatictext2
string manually character by character and display each character at the proper location. The brute force method would be to get the position of the cursor before starting to print any text. Use int 10h/ah-9 to write each character and manually advance the cursor to the next column. There is another way to do this if ANSI.SYS console driver is used. – AnastigmaticPROC
in the TASM manual. – Anastigmaticint 21h
is generally a DOS interrupt (so they are running on some form of DOS) so there is an OS present. There are tags 16-bit and DOS that could help clarify questions like this. There is a tag bare-metal for environments without an OS (so you are limited to the BIOS calls) – Anastigmaticint 21h
requires DOS, not just BIOS? Thanks, now I'll know what to look for. – Hornbackint 21h
then it is definitely not bare-metal (no OS), DOS or a DOS emulation layer must be present. In 32 bit Windows environments that still support 16bit code you are able to useint 21h
and many BIOS calls that don't pose a security threat (BIOS calls that read the hard disk will not return data). BIOS calls under a Windows NT(or higher) command prompt are emulated. Most BIOS calls are not available in protected-mode. BIOS calls don't rely on an OS. – Anastigmaticint 05h
,int 10h
,int 13h
,int 14h
,int 15h
,int 16h
,int 17h
,int 1Ah
,int 1Bh
,int 1Ch
,int 1Dh
,int 1Eh
,int 1Fh
,int 41h
,int 46h
,int 4Ah
. There are a few very uncommon ones for specific hardware but you likely won't see them. – Anastigmatic