, , , , . , .
. , , . , 64, 64, .
. (near) (far).
, . , .
:
, ;
, , , , .
. 3.3 HELLO , . , Main, far, WriteMsg near.
AStack SEGMENT STACK
DW 12 DUP(?)
AStack ENDS
AData. SEGMENT
Hello OB '!$'
AData ENDS
ACode SEGMENT
ASSUME CS: ACode, DS: AData, SS: AStack
WriteMsg PROC NEAR
mov AH, 9
int 21 h
ret
WriteMsg ENDP
Main PROC FAR
push DS
sub AX, AX
push AX
mov AX, AData
mov DS, AX
mov DX, OFFSET Hello
call WriteMsg
ret
Main ENDP
ACode ENDS
END Main
. 3.3. HELLO, .
(push DS DS; ub , , .. AX; push , .. 0) . ret, , ( , ) .
WriteMsg call WriteMsg ( WriteMsg ), ( ret Main), SP 2, WriteMsg (mov ,9). WriteMsg ret : , ,] , . SP 2.
|
|
Main ret , . Main DS 0, DS DOS PSP, , , , PSP, . PSP, , , DOS, . Main DS 0 4, 1 ret .
DOS BIOS. , ( DOS) ( BIOS). , . :
call ProcNeme
int Number,
Number , , int 10, int OAh, int lOlOb . .
. - , , ; - , . , CS IP, CS: IP IRET, CS, IP , , .
, , INT. , , ( ). 0000:0000, .. , 1024 . , 16- 16- , , , 4 , 256 . , 4. , 9 (, ) 0000:0024 (24h = 36 = 9 4).
HELLO, .3.3, WriteMsg int 21h. " DOS" DOS ( 9 , DS:DX).