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

📄 5-24.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
   demand	db	'Please enter your demand',0dh,0ah,'$'
   wrong	db	'Wrong	demand!!!',0dh,0ah,'Enter the demand between 1 and 5',0dh,0ah,'$'
   out1	db	'This	is the answer',0dh,0ah,'$'
   a	       db	?
   singlist	dw	proc1
   		dw	proc2
   		dw	proc3
   		dw	proc4
   		dw	proc5
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**
  	mov	bx,	offset	singlist
enter1:
	mov	dx,	offset	demand
	mov	ah,	09h
	int	21h
	mov	ah,	01h
	int	21h
	push	ax
	cmp	al,	31h
	jl	enter2
	cmp	al,	35h
	jg	enter2
	jmp	do
enter2:
	mov	dx,	offset	wrong
	mov	ah,	09h
	int	21h
	jmp	enter1
do:
	pop	ax
	and	al,	0fh
	mov	cl,	al
	mov	a,	al
rotate:
	dec	cl
	jnz	rotate1
	jmp	exit
rotate1:
	add	bx,	2
	jmp	rotate
exit:
	jmp	word	ptr[bx]
proc1:
	mov	dx,	offset	out1
	mov	ah,	09h
	int	21h
	mov	dl,	31h
	mov	ah,	02h
	int	21h
	mov ax, 4c00h  ;The end of the program, return to the system
  	int 21h
proc2:
	mov	dx,	offset	out1
	mov	ah,	09h
	int	21h
	mov	dl,	32h
	mov	ah,	02h
	int	21h
	mov ax, 4c00h  ;The end of the program, return to the system
  	int 21h
proc3:
	mov	dx,	offset	out1
	mov	ah,	09h
	int	21h
	mov	dl,	33h
	mov	ah,	02h
	int	21h
	mov ax, 4c00h  ;The end of the program, return to the system
  	int 21h
proc4:
	mov	dx,	offset	out1
	mov	ah,	09h
	int	21h
	mov	dl,	34h
	mov	ah,	02h
	int	21h
	mov ax, 4c00h  ;The end of the program, return to the system
  	int 21h
proc5:
	mov	dx,	offset	out1
	mov	ah,	09h
	int	21h
	mov	dl,	35h
	mov	ah,	02h
	int	21h
	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 + -