⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main1.asm

📁 用汇编语言实现四则运算,其中数值的范围是用32位长字节表示的范围
💻 ASM
字号:
; Assembly language program -- 32 4 Operators
; Author:  zhudingfen
; Date:    revised 8/07
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
; 使用 nmake 或下列命令进行编译和链接:
; ml /c /coff Main1.asm
; ml /c /coff Procedure1.asm
; link /debug /subsystem:console /entry:start /out:Main1.exe Main1.obj Procedure1.obj io.obj kernel32.lib
; Main1.exe
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.386
.MODEL FLAT
ExitProcess PROTO NEAR32 stdcall, dwExitCode:DWORD
EXTRN ReadExpress:NEAR32,Adder:NEAR32 ,Subtraction:NEAR32,Muliplic:NEAR32, Divis:NEAR32
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
; Include 文件定义
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
INCLUDE io.h            ; header file for input/output
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
; Equ 等值定义
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
cr      EQU     0dh     ; carriage return character
Lf      EQU     0ah     ; line feed
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
; 数据段
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.STACK  4096            ; reserve 4096-byte stack

.DATA                   ; reserve storage for data

prompt1 BYTE    " Please input Expression :  ", 0
string  BYTE    40 DUP (?)
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
; 代码段
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
			.CODE                   ; start of main program code
_start:
         output  prompt1         ; prompt for String
         input   string, 40      ; read ASCII characters
         lea  esi ,string
	 call  ReadExpress       ; call ReadExpress Function to String  separate into number1 and number2
         cmp dh,'+'
         jne Dashes              
         call  Adder             ; Adder Operators
         jmp  Exit
Dashes: 
	 cmp dh,'-'
         jne Mutiplication
	 call Subtraction        ;Subtraction Operators
         jmp Exit
Mutiplication: 
	cmp dh,'*'
	jne Division
	call  Muliplic          ;Multiplication  Operation
	jmp Exit
Division:     
        call Divis              ; division Operation
Exit:   INVOKE  ExitProcess, 0  ; exit with return code 0
	PUBLIC _start                   ; make entry point public
END                             ; end of source code

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -