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

📄 5-2.asm

📁 实现给出要求字母的前后字母的程序
💻 ASM
字号:
;----------------------------------------------------------------------
;Program:
;Created by:
;Finished Date & Time:
;----------------------------------------------------------------------

SSEG SEGMENT PARA STACK 'stack'
     dw 100h dup(0) ;Resize the stack by changing the number '100'
SSEG ENDS

DSEG SEGMENT
   ;TO DO: Add your program's data here
	start	db	'Please enter the character',0dh,0ah,'$'
	wrong	db	'Wrong character!!!Please enter right character between 61h and 7ah',0dh,0ah,'$'
	out1	db	'This is the answer',0dh,0ah,'$'
	end1	db	0dh,0ah,'Do you want to end the programe?---------y--------n?',0dh,0ah,'$'
DSEG ENDS

CSEG SEGMENT
  assume  cs:CSEG, ds:DSEG, es:DSEG, ss:SSEG
  
  INIT PROC ;Initialize procedure
  	mov ax, dseg
	mov ds, ax
	mov es, ax
	;TO DO: Add your initialize code here (as your requirement)

	ret    ;return to the MAIN procedure
  INIT ENDP

  MAIN PROC   ;Here is your program entry point
  	call INIT ;call the INIT procedure to initialize the program
  	;**TO DO: Add your main code here**
start1:
  	mov	dx,	offset	start
  	mov	ah,	09h
  	int	21h
  	mov	ah,	01h;-------------------input
  	int	21h
  	push	ax
  	cmp	al,	61h
  	jl	wrong1
  	cmp	al,	7ah
  	jg	wrong1
  	jmp	do
wrong1:
	mov	dx,	offset	wrong
	mov	ah,	09h
	int	21h
	jmp	start1
do:
	pop	ax
	sub	al,	20h
	dec	al
	push	ax
	mov	dx,	offset	out1
	mov	ah,	09h
	int	21h
	pop	ax
	mov	dl,	al
	mov	ah,	02h
	int	21h
	inc	al
	mov	dl,	al
	mov	ah,	02h
	int	21h
	inc	al
	mov	dl,	al
	mov	ah,	02h
	int	21h
	mov	dx,	offset	end1
	mov	ah,	09h
	int	21h
	mov	ah,	01h
	int	21h
	cmp	al,	79h
	jz	exit
	cmp	al,	59h
	jz	exit
	jmp	start1
exit:
	mov ax, 4c00h  ;The end of the program, return to the system
  	int 21h
  MAIN ENDP
  ;TO DO: Add other procedures(PROC) here (as your requirement)

CSEG ENDS
;TO DO: Add other segments here (as your requirement)

END MAIN
;----------------------------*The End*--------------------------------
;Warning:This ASMEditor can not support Chinese now.
;Please do NOT use any Chinese-word! Or you will LOST you file!!
;This Model was created by Honeybee. You can modify it as you wish.
;If you write a Model, save it with this name "InitSamp.EAM" in this
;application's floder.

⌨️ 快捷键说明

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