1 / 11

80x86 assembly language program structure and simple I/O

80x86 assembly language program structure and simple I/O. Assistant : 蘇建仲 (Su Jain-Zhong) LAB : ISMP LAB Tel : 62530-58 E-Mail : sujz@csie.ncku.edu.tw. INT 21H(DOS 插斷 ). 輸出字元 AH=02H ; DL= 要輸出的字元

Télécharger la présentation

80x86 assembly language program structure and simple I/O

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 80x86 assembly languageprogram structure and simple I/O Assistant : 蘇建仲(Su Jain-Zhong) LAB : ISMP LAB Tel : 62530-58 E-Mail : sujz@csie.ncku.edu.tw

  2. INT 21H(DOS 插斷) • 輸出字元 • AH=02H ; DL=要輸出的字元 • PUTCHAR MACRO CHAR MOV DL,CHAR MOV AH,02H INT 21H ENDM

  3. INT 21H(DOS 插斷)(Cont.) • 輸出字串 • AH=09H ; DS:DX=欲顯示字串起始位置 • 以“$”結束 • PRINT MACRO BUFF LEA DX,BUFF MOV AH,09H INT 21H ENDM

  4. INT 21H(DOS 插斷)(Cont.) • 輸入字元 • AH=08H • READCHAR MACRO MOV AH,08H INT 21H ENDM • AL 輸入的字元

  5. INT 21H(DOS 插斷)(Cont.) • 輸入字串 • AH=0AH ; DS:DX 緩衝區起始位置 • INPUT MACRO BUFF LEA DX,BUFF MOV AH,0AH INT 21H ENDM 最大輸入字元 實際輸入字元 DS:DX 輸入字串

  6. An Example • Reference progam2-1

  7. MACRO TEST MACRO STR,X………. L1: ……….. LOOP L1………. ENDM • Problem • TEST ASC1,X ……………TEST ASC2,Y L1: …………. LOOP L1…………. L1: ………… LOOP L1…………. • Solve error TEST MACRO STR,X LOCAL L1………. L1: ……….. LOOP L1………. ENDM

  8. MARCO Lib • Reference program2-2

  9. Subroutine • Parameter passing • By register • By data segment • Reference example program2-3,4 • Calling External Program • Calling program: EXTRN var: type • Called program: PUBLIC var • Type:BYTE,WORD,DWORD

  10. Subroutine link in diff. files • PUBLIC subroutine name • EXTRN subroutine name:FAR

  11. How to use assembler • Assembly Tool • masm asm_file.asm • link obj_file.obj [+ obj_file2.obj] ….. • ml asm_file.asm + asm_file2.asm • Debug tool • debug exe_file.exe • codeview exe_file.exe

More Related