Need some help with Memory Mapped Video for DOS

I'm just a beginner in asm.I'm using Tha art of assemble(16 bit x86) to learn asm.I have some problems about an application on chapter 5.
This is what it asks me to do:
***********************************************************************
The PCs video display is a memory mapped I/O device. That is, the display adapter maps each character on the text display to a word in memory. The display is an 80x25 array of words declared as follows:
display:array[0..24,0..79] of word; Display[0,0] corresponds to the upper left hand corner of the screen, display[0,79] is the
upper right hand corner, display[24,0] is the lower left hand corner, and display[24,79] is the lower right hand corner of the display.
The L.O. byte of each word holds the ASCII code of the character to appear on the screen.
The H.O. byte of each word contains the attribute byte (see The PC Video Display on
page 1247 for more details on the attribute byte). The base address of this array is B000:0 for monochrome displays and B800:0 for color displays.
***********************************************************************
AX register allways contains this: mov ax, 500h+"."
This is how i tried to put ax in the memory mapped io:
mov bx, 0b800h
mov es, bx
mov dx,ax
mov ax,80
mul i
add ax,j
add ax,ax
mov bx,ax
mov es:[bx],dx

the problem is that the screen is allways black
why ?

Comments

  • : AX register allways contains this: mov ax, 500h+"."
    : This is how i tried to put ax in the memory mapped io:
    : mov bx, 0b800h
    : mov es, bx
    : mov dx,ax
    : mov ax,80
    : mul i
    : add ax,j
    : add ax,ax
    : mov bx,ax
    : mov es:[bx],dx
    :
    : the problem is that the screen is allways black
    : why ?

    The MUL instruction changes DX to 0, so that's what ends up being displayed to the screen later on.

    DX returns the upper 16bits of the multiplication, which in your case was 0.

    Try saving the value of AX in something else, like SI or DI, then make your last line there "mov es:[bx], si"

    -jeff!
  • : : AX register allways contains this: mov ax, 500h+"."
    : : This is how i tried to put ax in the memory mapped io:
    : : mov bx, 0b800h
    : : mov es, bx
    : : mov dx,ax
    : : mov ax,80
    : : mul i
    : : add ax,j
    : : add ax,ax
    : : mov bx,ax
    : : mov es:[bx],dx
    : :
    : : the problem is that the screen is allways black
    : : why ?
    :
    : The MUL instruction changes DX to 0, so that's what ends up being displayed to the screen later on.
    :
    : DX returns the upper 16bits of the multiplication, which in your case was 0.
    :
    : Try saving the value of AX in something else, like SI or DI, then make your last line there "mov es:[bx], si"
    :
    : -jeff!
    :

    10x
    I didn't know how that mul changes dx too

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories