ASSUME CS:CODSEG, DS:DATSEG


⮬ ࣠ 稪 祥, 㦠 㫥 ᬥ饭.

饭 㫥 祩 ( 㬮砭), ॡ㥬.

饥 祭 稪 祥 ணࠬ⮬ ४⨢ ORG (砫), 騩 ଠ

ORG <ࠦ>

믮 ४⨢ ORG 祭 ࠦ, १ 㦠 稪 祥. ᫥ ࠦ ந 64 .

४⨢ । EQU.

४⨢ EQU ணࠬ । ᨬ᪨ ᯮ㥬 ࠦ ଠ:

EQU <ࠦ>

<ࠦ> ।:

-⠭;

-;

-ॣ;

- .



"" 室 , ஥ ணࠬ ᯮ ।⠢ ࠦ. ।塞 ४⨢ EQU ࠧ蠥 ८।. ..  ⮫쪮 ४⨢ EQU. ਬ:

CR EQU 0DH ; ᫥ ⠭

ADR EQU AR [SI]+3 ;᭮ ࠦ

COUN EQU CX ; ॣ

砭!

४⨢ PURGE ( 㤠, ᢮) 㤠 ⠡ : ᫥ ⮣ । .

४⨢ 楤 PROC END.



४⨢ PROC (procedure) ⬥砥 室 楤, ४⨢ ENDP - 砭 楤. ଠ ४⨢

PROC <⨯> ;NEAR, 㬮砭, FAR -

.

⥫ 楤

.

.



ENDP

 ⪮, 㪠뢠饩 室 楤. 楤  NEAR FAR ( 㬮砭 ਭ ⨯ NEAR). ᥬ ᯮ ⨯ 楤 । ⮣, CALL ஢ 맮 楤. 楤 ⨯ NEAR ᥬ ᥣ⭮ 맮. 饭 楤 ⥪ , ⥬ ⠭ ⮫쪮 ᮤন 稪 , .. 楤 ⨯ FAR ᥬ ᥣ⭮ 맮, ᮤন ᬥ饭 窨 室. 饭 ⮩ 楤 ⥪ , ⥬ ⠭ ᮤন ॣ஢ CS IP.

楤 몥 ᥬ ࠭祭 ⢨, ..  ணࠬ ६ ⪠ 楤 (.. ४⨢ PROC/ENDP ).

, ᫥⥫쭮, 室 ࠧ । ४⨢ PROC, 砥  訡 ⥫ 楤. ।饭 砩 믮 楤 맮 ४ ࠧ 楤 । ⥬, 뢠.

室묨 ࠬࠬ ᫥ 祭 . ਢ ᯮᮡ । ࠬ஢ 楤ࠬ. ᯮᮡ 祭 ࠬ஢ ࠧ ॣ । 饭 楤. 㣮 ᯮᮡ । ࠬ஢ 楤ࠬ ࣠ १ ⥪ ॣ , ண ᥣ  ॣ SS.

몥 ᥬ I8086 ४ ਤন ᫥饣 ᮣ襭 頥 楤ன 祭 室 ࠬ.

-祭 ६ ⨯ WORD 頥 ;

-祭 ६ ⨯ BYTE 頥 AL;

-⪨ 㪠⥫ (ᬥ饭) 頥 ॣ BX;

- 㪠⥫ (:ᬥ饭) 頥 ॣ ES:BX.



४⨢ LABEL

४⨢ LABEL 믮 ᪮쪮 㭪権, ਬ, ᯥ稢 ᪮쪮 祪 室 楤 ᮧ 祥 ᨬ ᮤন । ᯮ짮 . ᮤন ଠ ⨯ ।塞 , ⨯ 筮 㪠뢠 ⨬ 㯮ॡ . ଠ ४⨢:

LABEL <⨯>

⢥ ⨯ 䨣 祢 ᫮: BYTE, WORD, DWORD, NEAR, FAR. ⨯ 㪠뢠 , ।⠢ ᮡ ६. ६ ⨬ , 묨, 㯮ॡ । ࠢ. ⨯ NEAR FAR . ⪮, ࠭ । ࠢ, ⨬ , 묨. ਬ:

BUF LABEL WORD

DW 1234H

ࠣ ணࠬ 祭 ४⨢:

BUF DW 1234H

४⨢

NED LABEL NEAR

। NED .

४⨢ LABEL 㤮 । 祭 㪠⥫ ⥪ (.. 設 ⥪), ਬ,

STACK_SEG SEGMENT WRD STACK

DW 64 DUP(?) ; 뤥 ࠧ ⥪

VSTK LABEL WORD ;設 ⥪

STACK_SEG ENDS

४⨢ DW १ࢨ 64 ᫮ 樠樨. ४⨢ LABEL ᢠ VSTK ᫮, 室饬 ᫥ 64 ᫮ 砫 ᥣ STACK_SEG. 饭 VSTK 砫 ᥣ STACK_SEG ।⠢ ᮡ 祭 , ஥ 㤥 ᮤঠ 㪠⥫ ⥪ SP ⥪ ⮩.



४⨢ 裡 㫥 ᥣ⮢.

४⨢ 裡 㫥.

୮ ணࠬ஢ ᫮ ணࠬ ࠧ ᪮쪮 ࠢ⥫쭮 ⮭ (㫥). 쭠 ணࠬ ⮨ ᪮쪨 室 㫥, ᪠ ᥬ஢, ᨬ 㣠, ᮤঠ ᪮쪮 楤. 쭮 ணࠬ஢ ஡ ꥤ (裡, 뢠, ।஢ 痢, ) ⤥ 㫥 ணࠬ. ⮣ 室 ᮮ⢥騥 ४⨢ ᥬ ᯥ樠쭠 ணࠬ, 뢠 ।஬ 痢 騪.

ꥤ 㫥 砥 ⮬, 饭 (뫪) ⠬ (६, ⪠ .) 㣨 , 㣨 㫨 ⠪ ⠬ (. . ).



饭 㫨 ꥤ ணࠬ.

ᥬ஢ 室 ஦ ꥪ (ꥪ 䠩), ᮤঠ騩 㦥 ଠ 饭. 痢 ᯮ ଠ ꥤ ⤥ ꥪ 䠩 ꥪ 䠩, ஬ ⥭ 饭. ᬮ७ ४⨢ 痢 㫥 ᥣ⮢ 筥 ४⨢ PUBLIC EXTRN

४⨢ PUBLIC EXTRN .

४⨢ PUBLIC  , । 㫥, , .. 㯭 饭 㣨 㫥. ४⨢ EXTRN, ᮮ頥, ᯮ㥬 㫥 । 㣮 , ..  譨. ४⨢ PUBLIC EXTRN ଠ:

PUBLIC , []

EXTRN . :⨯,< :⨯>

४⨢ ६, ⪨ ⠭, ,। ४⨢ = . ६ BYTE, WORD, DWORD.

⪨ NEAR, FAR, ⠭ -ABS (᮫⭮ 祭)



, ।塞 㫥, 㪠 ४⨢ PUBLIC ⮫쪮 ࠧ. ४⨢ PUBLIC EXTRN 㯯஢ 砫 .

, 䨣騩 ४⨢ EXTRN, ᮢ ⨯ , । 㣮 㫥.

ਬ:

PUBLUC NED, MUR, SVAL

EXTRN DAD:BYTE, IVN:FAR, KRN:ABS

᫨ ᥬ 砥 饭 譥 , १ࢨ 室 ( ⮬ ⨯ ), ꥪ⭮ 䠩 ⬥⪠ ⮬. ꥤ ᪮쪨 ꥪ 䠩 । 痢 ᬠਢ ⠪ ⬥⪨ , ᯮ 㯭 ଠ , ⠢ 室 祭.

४⨢ END.

稢 ⮩ ४⨢, 㪠 ࠭, ⥪ 祭.

४⨢ END ଠ

END [<᪮ >]

室 㫥 ⮫쪮 ४⨢ END ᫥ ப . ᪮ ᮬ  ⪠ ⮩ , ன 믮 ணࠬ. ꥤ ᪮쪨 㫥 ⮫쪮 㫥 () 㪠 ᪮ .

४⨢ ꥤ ᪨ ⮢.

ꥤ 㫥 ணࠬ ꥤ ᪨ ᥣ⮢, ⮨ . ᫨ , । ࠢ 㣮 室 ᮤন ᥣ⭮ ॣ CS, 饭 - ᥣ⭮ ॣ DS. ᫮ ࣠樨 ⥪ ꥤ 㫥.

⮬, ᫨ ꥤ ࠧ ᥣ⮢ ꥤ 㫥 ࠧ஬ 64 , ᥣ 㫥 ꥤ ⠪, ⮡ ᮤঠ騬 뫮 ⮬ ᮤন ॣ CS.



筮 ᫥ ꥤ ᥣ ᥣ ⥪.

室 ଠ ᯮᮡ ꥤ ᪨ ᥣ⮢ ꥤ塞 㫥 ᮤন ४⨢ SEGMENT ᯨ᪠ ਡ⮢. ଠ ४⨢ SEGMENT :

SEGMENT [<⨯ ࠢ>] [<⨯ ꥤ>] [<' '>]

⮬ ꥤ塞 ᥣ . 㪠 ࠭ ४⨢  易⥫, ᫨ , ᫥ 㪠 浪.

ᬮਬ ஡ ਡ ⨯ ꥤ .

ꥤ.

ਡ 뢠, ࠧ ᪨ ᥣ ꥤ 㣨 ᪨ ᥣ⮬ 騬 ⠪ . ᫨ ᥣ ਡ ।, ᥣ ⠥ ꥤ塞, ᥣ⠬, 騬 ⠪ . ꥤ 砥 室 㦭 㪠뢠 ࢮ । ᥣ. ᫥ ४⨢ SEGMENT ᥣ⮢ ਡ ᪠. ᯮ짮 ᫥騥 ⨯ ꥤ : PUBLIC, STACK, AT, COMMON, MEMORY.

ਡ PUBLIC ᥣ ꥤ ⥬ ⥭樨, .. ࠧ 㣨. ⮬ ᬥ饭 ᥣ ४ ⮬ 㬬୮ ࠧ 㦥 ꥤ ᥣ⮢, ᮢ ꥤ塞 ᥣ ⮬ ᮤন ᥣ⭮ ॣ.



ꥤ STACK ਬ ᪨ ᥣ⮢, ⠢ ⥪. ਡ⮬ STACK ꥤ ⠪, ⮡ ࠧ 祭 ࠢ 㬬 ࠧ஢ ꥤ塞 ᥣ⮢. 饭 ꥤ塞 ᥣ⮢ ਡ⮬ STACK ४ ⠪, ⮡ ᫥ ( 訬 ᮬ) ᥣ ᮢ ᫥ ⮬ ꥤ , .. ᥣ ⥪ 稭 ⮣ .



ꥤ AT 樥

AT <ࠦ>

ணࠬ 砫 ᪮ ᥣ .. 䨪஢ ᥣ 㦭 . 祭 ࠦ ࠣ , .. 祭 㦠 ᮮ⢥騩 ᥣ ॣ. ਬ:



START: MOV AX, DATSEG

MOV DS, AX

-

-

-

CODSEG ENDS

ASSUME . , CS, , MOV. . MOV , . DATSEG ( ), , MOV , - ( ).

, - . . :

ASSUME CS:CODE, DS:CODE

DS :

MOV AX, CS

MOV DS, AX

CS . ASSUME , , .

ORG.

 

(), , ( ) .

( ), .

SEGMENT .