-1

Excuse me but isn't this program going to display "1" on the screen?
Thank you very much!

.8086
DATA SEGMENT
CHAR DB 31H
DATA ENDS

STACK SEGMENT STACK
STACK ENDS

CODE SEGMENT
ASSUME CS:CODE,DS:DATA,SS:STACK
MOV AX,DATA
MOV DS,AX
MOV AX,STACK
MOV SS,AX
;---------------------------------
START:
MOV DL,CHAR
MOV AH,2
INT 21H
MOV AH,4CH
INT 21H
CODE ENDS
END START
2
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by NotNull
0
mov dl, 0x31
mov ah, 0x2
int 0x21

^----Should display a '1'

Maybe it is about where you defined your stack, and your
memory variable got overwritten when external interrupts
needed the stack...

On top of this, I do not see a value defining the size of the stack
in bytes???

MS-DOS sets the SS register to the paragraph aligned segment address
of the start of any segment declaced with STACK, and SP to the offset
of the byte immediately after the STACK.
Hence if you have defined a stack you shouldn't have to initialize SS : SP

Edited by NotNull: n/a

0

Thank you very much! And I just found out that I've also got the "start" label in the wrong place.

0

Oh, I missed that.
The start label was after the

MOV AX, DATA 
MOV DS, AX

and was never executed, hence DS still pointed to the
PSP and not the segment containing the memory variable
'char'.
On entry ES and DS will contain the segment address
of the PSP, so you can save a pointer to the PSP to
access it later.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.