I start on build 8086. I am studying an old book from the early 90s that I found in a savings store. I thought it would be fun to program like in 1992.
In any case, I ended up with the book, and now I have written several programs on the command line of my old Win95 laptop.
I am having problems with the fact that it does not work as intended after switching to using the 'les' instruction. However, it worked when I manually configured the ES and DI registers with the corresponding address.
;************************************ ; STACK SEGMENT ;************************************ TheStack SEGMENT STACK ;STACK specifies the stack segment db 64 dup (THESTACK) ;reserves 512 bytes for the stack TheStack ENDS ;************************************ ; END STACK SEGMENT ;************************************ ;************************************ ; DATA SEGMENT ;************************************ Data SEGMENT BufAddr DD 0b8000000h Data ENDS ;************************************ ; END DATA SEGMENT ;************************************ ;************************************ ; CODE SEGMENT ;************************************ Code SEGMENT assume CS:Code,DS:Data MAIN PROC Start: ;execution begins ;setup input for stosw les di, DWORD PTR BufAddr mov cx,0f4fh ;cx contains the number of times stosw will loop cld ;draw smileys mov ax,0f01h ;0f is the text attribute for white on black, 01 is the hex code for a smiley rep stosw ;write it all to the buffer ;EXIT mov AH,4CH ;Setup the terminate dos process service mov AL,0 ;ERRORLEVEL takes 0 int 21H ;return to dos MAIN ENDP Code ENDS ;************************************ ; END CODE SEGMENT ;************************************ END Start ;Start is the Main procedure
Ok, so this program should draw a bunch of ascii smiley characters in the command line window, but it doesnโt work.
It works when I replace the LES line with the following lines of code.
mov bx,0b800h mov es,bx xor di,di
Is the LES command used when used with the BufAddr variable in the same way as the previous three lines of code?
When I debug a compiled exe (I use MASM 6.11 as a compiler), I notice that the ES and DI registers are not loading with the correct values.
source share