News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Commandline Problem

Started by vasant, April 02, 2006, 12:04:55 PM

Previous topic - Next topic

vasant

mov si,82h
Mov ah,2
mov dl,[si]
int 21h

mov ah,4ch
int 21h

End

Why? if run

ex a  ;first time
Output: a
but
ex      ;second time
Output a
It not blank?

MichaelW

Is your program an EXE or a COM? If an EXE, are you using a .STARTUP directive or loading DS with something like:

mov  ax,@data
mov  ds,ax

If yes, then you need to use an ES override to access anything in the PSP:

mov dl,es:[si]


eschew obfuscation

vasant

How to use PSP in .Com File?
.Com must Define ORG 100h?

Thank you.

MichaelW

For a COM file the loader sets CS = DS = SS = ES = segment address of PSP, so your code would work correctly without a segment override:

mov si,82h
Mov ah,2
mov dl,[si]  ; <== OK
int 21h


Without an override, the segment register for MOV, and most other instructions that access data, is DS.


eschew obfuscation