Hey guys,

I'm trying to figure out how to set the foreground and background of font in a 16 bit assembly program.

So far this is what I have...

TITLE First 16-bit Program (main.asm)

; Description:
; Revision date:

INCLUDE Irvine16.inc

msg BYTE "My String",0

main PROC
mov ax,@data
mov ds,ax      ;these two lines required for 16-bit programs

;mov dh,10
;mov dl,5
;call gotoxy

mov ax,0
mov al,11101100b  ;Text to red, background to yellow
call settextcolor

mov edx,offset msg
call writestring

mov    ax, 0941h
mov    bx, 001ah
mov    cx, 0001h
int    10h

mov ah,4ch  ; terminate process
mov al,0    ; return code
int 21h
main ENDP

END main

My question is how to set the background to just the string of characters. Right now it is setting my whole entire console to a yellow background. All I want is the string highlighted with yellow.

How do I do this?


Posted on 2011-11-17 15:44:17 by msmallard
Try int 10h, ah=13h


Note that you'll have to set es as well as ds at the beginning of your program.


Posted on 2011-11-19 01:04:27 by fbkotler