this code accesses the graphics buffer - not the text mode buffer
but - the idea is the same
.MODEL Small
.STACK 4096
.DOSSEG
.386
OPTION CaseMap:None
;####################################################################################
.DATA
s$Msg db 'Press Alt-Enter to Exit Full Screen',13,10,24h
;************************************************************************************
.DATA?
;####################################################################################
.CODE
;************************************************************************************
_main PROC FAR
mov dx,@data
mov ds,dx
mov ax,13h
int 10h
mov ax,0A000h
mov es,ax
xor di,di
mov cx,64000
loop00: mov es:[di],cl
inc di
dec cx
jnz loop00
mov ah,0
int 16h
mov ax,3
int 10h
mov dx,offset s$Msg
mov ah,9
int 21h
mov ax,4C00h
int 21h
_main ENDP
;####################################################################################
END _main
notice that, at the beginning of the program, DS is set to @data (the data segment where the message string is located)
ES is set to the video buffer segment
i could set DS to the video buffer segment, rather than ES
but, then, i would have to set it back to the local data segment before displaying the text message
INT 21h, function AH=9, requires that DS:DX points to the string