实验一、

写一个完整的8086汇编语言程序,从键盘输入姓名,屏幕上输出“hello,姓名”,如若从键盘输入的是“Sam”,则从屏幕上显示“hello,Sam”。

  •  
;Program:;Author:Nonoas;Date:20191009
.386.MODEL FLAT
ExitProcess PROTO NEAR32 stdcall, dwExitCode:DWORD
INCLUDE io.h ; header file for input/output
cr EQU 0dh ; carriage return characterLf EQU 0ah ; line feed
.STACK 4096 ; reserve 4096-byte stack
.DATA ; reserve storage for data
prmpt byte "输入你的姓名: ", 0str1 byte "hello,"str2 byte 10 dup(?)
.CODE ; start of main program code_start:
output prmpt input str2,10
output str1
INVOKE ExitProcess, 0 ; exit with return code 0PUBLIC _start ; make entry point public
END ; end of source code

 

 

 

 

 

实验二、写一个完整的8086汇编语言程序,满足以下要求:
A.数据段申请一个存储数据的字长数据number1,该数据存储的值12。
B.数据段申请一个存储数据的字长数据number2,该数据从键盘输入。(提示从键盘键入该数据的ASCII值,转换成数值后存入number2中)
C.交换number1和number2的值,并且显示交换后的值在屏幕上(提示数值需要转化为ASCII值才能进行输出)。
假设从键盘输入的值为“20”,则显示的信息为:
The value of number1 is 20,the value of number2 is 12。

  •  
;Program:;Author:Nonoas;Date:20191009
.386.MODEL FLAT
ExitProcess PROTO NEAR32 stdcall, dwExitCode:DWORD
INCLUDE io.h ; header file for input/output
cr EQU 0dh ; carriage return characterLf EQU 0ah ; line feed
.STACK 4096 ; reserve 4096-byte stack
.DATA ; reserve storage for data
number1 DWORD 12number2 DWORD ?prompt1 byte "Please enter a ASCII of a data:",0prompt2 byte cr,lf,"The value of number1:",0prompt3 byte cr,lf,"The value of number2:",0string byte 20 dup (?)str1 byte 20 dup (?)str2 byte 20 dup (?)
.CODE ; start of main program code_start:
output prompt1 input string,20 atod string mov number2,eax xchg eax,number1 mov number2,eax
mov ebx,number1 dtoa str1,ebx
mov ecx,number2 dtoa str2,ecx
output prompt2 output str1 output prompt3 output str2

INVOKE ExitProcess, 0 ; exit with return code 0PUBLIC _start ; make entry point public
END                             ; end of source code

 

【8086汇编(实验)】 键盘输出_汇编