80x86 assembly language program structure and simple i o
Download
1 / 11

80x86 assembly language program structure and simple I/O - PowerPoint PPT Presentation


  • 103 Views
  • Uploaded on

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

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' 80x86 assembly language program structure and simple I/O' - jordan-hamilton


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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
80x86 assembly language program structure and simple i o

80x86 assembly languageprogram structure and simple I/O

Assistant : 蘇建仲(Su Jain-Zhong)

LAB : ISMP LAB

Tel : 62530-58

E-Mail : [email protected]


Int 21h dos
INT 21H(DOS 插斷)

  • 輸出字元

    • AH=02H ; DL=要輸出的字元

    • PUTCHAR MACRO CHAR MOV DL,CHAR MOV AH,02H INT 21H ENDM


Int 21h dos cont
INT 21H(DOS 插斷)(Cont.)

  • 輸出字串

    • AH=09H ; DS:DX=欲顯示字串起始位置

    • 以“$”結束

    • PRINT MACRO BUFF LEA DX,BUFF MOV AH,09H INT 21H ENDM


Int 21h dos cont1
INT 21H(DOS 插斷)(Cont.)

  • 輸入字元

    • AH=08H

    • READCHAR MACRO MOV AH,08H INT 21H ENDM

    • AL 輸入的字元


Int 21h dos cont2
INT 21H(DOS 插斷)(Cont.)

  • 輸入字串

    • AH=0AH ; DS:DX 緩衝區起始位置

    • INPUT MACRO BUFF LEA DX,BUFF MOV AH,0AH INT 21H ENDM

      最大輸入字元 實際輸入字元

DS:DX

輸入字串


An example
An Example

  • Reference progam2-1


Macro
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


Marco lib
MARCO Lib

  • Reference program2-2


Subroutine
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


Subroutine link in diff files
Subroutine link in diff. files

  • PUBLIC subroutine name

  • EXTRN subroutine name:FAR


How to use assembler
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


ad