Program Segment Prefix: Difference between revisions

Content deleted Content added
Monkbot (talk | contribs)
m top: Task 16: replaced (1×) / removed (0×) deprecated |dead-url= and |deadurl= with |url-status=;
No edit summary
Line 119:
mov bl, [80h]
cmp bl, 7Eh
ja exit ; preventing overflow
mov byte [bx + 81h], '$'
 
Line 128:
 
exit:
mov ax, 4C00h ; subfunction 4C (see below)
int 21h
</source>
Line 135:
 
<source lang="nasm">
; save...
 
push ds
xor ax, ax
push ax
 
; move to the default data group (@data)
mov ax,@data
mov ds,ax, @data
mov dxds,mess1 ax
 
; print message in mess1 (21h subfunction 9)
mov dx,mess1
mov ahdx,9h mess1
mov axah,@data 9
int 21h
 
retf
 
</source>
 
If the executable was a .COM file, this procedure was unnecessary and the program could be terminated merely with a direct INT 20h instruction or else calling INT 21h Function 0,. howeverHowever, the programmer still had to ensure that the CS register contained the segment address of the PSP at program termination. Thus,
 
<source lang="nasm">
 
jmp start
 
Line 166:
 
int 20h
 
</source>