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

📄 text4.asm

📁 汇编课程设计
💻 ASM
📖 第 1 页 / 共 4 页
字号:
		    win       8,17,8,28,07h  ;菜单的阴影
		    win       2,28,8,28,07h  ;菜单的阴影
		    poscur    2,16
		    show  play_0
		    poscur    3,16
		    poscur    4,16
		    poscur    5,16
		    poscur    6,16
        	    poscur    7,16
		    show  play_5
		 tomusic1:
		    win       4,17,4,26,79h
		    poscur    4,16
		    win       6,17,6,26,79h
		    poscur    6,16
		    win       3,17,3,26,67h
		    poscur    3,16
		    GEtchar
		    CMP       AH,50h               ;若按下键下方向键
		    JZ        tomusic2
		    CMP       AH,48h
		    JZ        togun1
		    CMP       AH,1ch 			;若按了Enter键
		    JZ 	  pmusic11
		    JMP       pexit
		togun1:       JMP togun
		tomusic11:     JMP tomusic1
		pmusic11:     JMP	       pmusic1
		tomusic2:
		    win       3,17,3,26,79h
		    poscur    3,16
		    win       5,17,5,26,79h
		    poscur    5,16
		    win       4,17,4,26,67h
		    poscur    4,16
		    GEtchar
		    CMP  AH,50h
		    JZ   toscale
		    CMP       AH,48h
		    JZ        tomusic11
		    CMP AH,1ch
		    JZ    pmusic21
		    JMP       pexit
		tomusic21:    JMP       tomusic2
		pmusic21:     JMP		pmusic2
		toscale:
		    win       4,17,4,26,79h
		    poscur    4,16
		    win       6,17,6,26,79h
		    poscur    6,16
		    win       5,17,5,26,67h
		    poscur    5,16
		    GEtchar
		    CMP  AH,50h
		    JZ   togun
		    CMP       AH,48h
		    JZ        tomusic21
		    CMP AH,1ch
		    JZ    pscale1
		    JMP       pexit

		pscale1:      JMP       pscale
		tomusic12:    JMP       tomusic1
		toscale1:     JMP       toscale
		togun:
		    win       5,17,5,26,79h
		    poscur    5,16
		    win       3,17,3,26,79h
		    poscur    3,16
                    win       6,17,6,26,67h
		    poscur    6,16
                    GEtchar
		    CMP  AH,50h
		    JZ   tomusic12
		    CMP       AH,48h
		    JZ        toscale1
		    CMP AH,1ch
		    JZ    pgun
		    JMP       pexit

;****处理不同的分支所调用的不同的函数.****/

pmusic1:
;              CALL      music1play
              JMP       pexit
pmusic2:
              CALL	music2play
              JMP       pexit
pscale:
              CALL	scaleplay
              JMP       pexit
pgun:
              CALL	gunplay
              JMP       pexit
pexit:        CALL      menuHide
              CALL      BackDisplay
              poscur row,column
              recover
              RET
showMenuP	ENDP
showMenuE     PROC
              saveE
              CALL 	savedisplay
              CMP       copyFlag,0
              JZ        NOTactiveC
              MOV       copyActive,79h
              JMP       activeOKC
	  notactiveC:
	              MOV       CopyActive,78h
	  activeOKC:
              CMP       PasteFlag,0
              JZ        NOTactiveP
              MOV       PasteActive,79h
              JMP       activeOKP
	  notactiveP:
	              MOV       PasteActive,78h
	  activeOKP:
    		    win       0,31,0,40,07h
    		    poscur    0,0
		    show      str_menu
		    win       2,31,6,42,78h  ;菜单不选中的颜色(白底黑字)
		    win       7,32,7,43,07h  ;菜单的阴影
		    win       2,43,7,43,07h  ;菜单的阴影
		    poscur    2,31
		    show  Edit_0
		    poscur    3,31
		    show  Edit_1
		    poscur    4,31
		    show  Edit_2
		    poscur    5,31
		    show  Edit_3
		    poscur    6,31
		    show  Edit_4
		 toCopy:
		    win       4,32,4,41,copyActive
		    poscur    4,31
                show      Edit_2
		    win       5,32,5,41,pasteActive
		    poscur    5,31
		    show      Edit_3
		    win       3,32,3,41,67h
		    poscur    3,31
		    show      Edit_1
                showM	  mess21
		    GEtchar
		    CMP       AH,50h               ;若按下键下方向键
		    JZ        toCut
		    CMP       AH,48h
		    JZ        toPaste1
		    CMP       AH,1ch 			;若按了Enter键
		    JZ 	  pCopy1
		    JMP       Editexit
            toPaste1:     JMP       toPaste

		pCopy1:      JMP	       pCopy
		toCut:
		    win       3,32,3,41,copyActive
		    poscur    3,31
		    show      Edit_1
		    win       5,32,5,41,pasteActive
		    poscur    5,31
		    show      Edit_3
		    win       4,32,4,41,67h
		    poscur    4,31
		    show      Edit_2
                showM	  mess22
		    GEtchar
		    CMP		AH,50h
		    JZ   		toPaste
		    CMP      	 AH,48h
		    JZ        	toCopy1
		    CMP 		AH,1ch
		    JZ    		PCut1
		    JMP       	EditExit
            toCopy1:     JMP       toCopy
		PCut1:     JMP		PCut
		toPaste:
		    win       4,32,4,41,copyActive
		    poscur    4,31
		    show      Edit_2
		    win       3,32,3,41,copyActive
		    poscur    3,31
		    show      Edit_1
		    win       5,32,5,41,67h
		    poscur    5,31
		    show      Edit_3
                showM	  mess23
		    GEtchar
		    CMP  AH,50h
		    JZ   toCopy2
		    CMP       AH,48h
		    JZ        toCut1
		    CMP AH,1ch
		    JZ    pPaste1
		    JMP       EditExit
		toCut1:    JMP       toCut
		pPaste1:   JMP       pPaste
		toCopy2:   JMP       toCopy


;****处理不同的分支所调用的不同的函数.****/

pCopy:
              CALL      CopyEdit
              JMP       EditExit
PCut:
              CALL	CutEdit
              JMP       EditExit
pPaste:
              CALL	PasteEdit
              JMP       EditExit
EditExit:
              CALL      menuHide
              CALL      BackDisplay
              poscur 	row,column
              recover
              RET
showMenuE     ENDP
 ;*************************************
CopyEdit      PROC
              saveE
              CMP       copyFlag,0
              JZ        exitCopyEdit
     ;         CALL      CLsPaste
              MOV       pasteFlag,1
              MOV       CL,pasteNum
              MOV       CH,0
              poscur	rowbak,columnbak
              MOV       DH,rowbak
              MOV       DL,columnbak
              MOV       SI,0
copyLoop:
              readchar
              MOV       pasteBuffer[SI],AL
              INC       SI
              INC       DL
              poscur	DH,DL
              LOOP      copyLoop
              MOV       pasteBuffer[SI],24h
exitCopyEdit:
              recover
              RET
CopyEdit      ENDP
cutEdit      PROC
              saveE
              CMP       copyFlag,0
              JZ        exitCutedit
              MOV       pasteFlag,1
              MOV       CL,pasteNum
              MOV       CH,0
              poscur	rowbak,columnbak
              MOV       DH,rowbak
              MOV       DL,columnbak
              MOV       SI,0
cutLoop:
              readchar
              MOV       pasteBuffer[SI],AL
              INC       SI
              INC       DL
              poscur	DH,DL
              LOOP      cutLOOP
              MOV       pasteBuffer[SI],24h
exitCutEdit:
              posgets
              poscur	rowbak,columnbak
              MOV       DH,rowbak
              MOV       DL,columnbak
              CALL      BackDisplay
 LOOPclearCut:								;此循环是为了恢复反显文本
              MOV       AL,20h
              MOV       BX,0017h
              MOV       CX,1
              MOV       AH,09h
              INT       10h
              DEC       SI
              INC       DL
              poscur	DH,DL
              CMP       SI,0
              JNZ       LOOPclearCut
              CALL      savedisplay
              poscur    row,column
              recover
              RET
cutEdit      ENDP
pasteEdit      PROC
              saveE
              CALL      backdisplay
              poscur	row,column
              CMP       pasteFlag,0
              JZ        exitPasteEdit
              posgets
              MOV       CL,pasteNum
              MOV       CH,0
              MOV       SI,0
  LOOPPaste:
              CMP       column,79
              JNZ       continuePaste
              MOV       column,1
              INC       row
              poscur	row,column
    continuePaste:
              INC       column
              MOV		DL,pastebuffer[SI]
        	  INC 	SI
       	  MOV 	AH,2
       	  INT 	21h
     	        LOOP 	LOOPPaste
              CALL	saveDisplay
              mov	modifyFlag,0
 exitPasteEdit:
              recover
              RET
pasteEdit      ENDP
;显示帮助
 showmenuh     PROC
              saveE
              posgets
              CALL      SaveDisplay
              win       10,15,16,67,07h
              win       9,14,15,66,0E4h
              poscur    10,5
              show      mess16
              poscur    11,5
              show      mess17
              poscur    12,5
              show      mess18
              poscur    13,5
              show      mess19
              win	      14,15,14,66,0EDh
              poscur    14,5
              show	mess20
		  GEtchar
              CALL	BackDisplay
              poscur	row,column
              recover
              RET

 showmenuh     ENDP
;*****播放第一首歌*********
; music1play   PROC
              saveE
      CALL      menuHide
      CALL      BackDisplay
;	LEA	SI,music
	LEA	BP,time
   freq1:
	MOV	DI,[SI]
	CMP	DI,0
	JE	endmusic1
	CALL	soundf1
	ADD	SI,2
	ADD	BP,2
	JMP	freq1
   endmusic1:
	MOV	AL,48h
	OUT	61h,AL
  EXITMuP1:
              recover
		  RET
; music1play   ENDP
 soundf1	PROC
              saveE
	MOV	AL,0b6h		;位组合格式:通道2,两字节计数,模式3,二进制码
	OUT	43h,AL
	MOV	DX,12h
	MOV	AX,348ch
	DIV	DI		;(di)=频率
	OUT	42h,AL		;频率计数值送通道二
	MOV	AL,AH
	OUT	42h,AL
	IN	AL,61h
	MOV	AH,AL
	OR	AL,3
	OUT	61h,AL		;关闭扬声器

	MOV	BL,[BP]
up:
	MOV	CX,16572
	CALL	waitf1
	DEC	BL
	JNZ	up
 exitSoundf1:
              recover
              RET
soundf1	ENDP
waitf1	PROC
	saveE
waitf2:
	IN	AL,61h
	AND	AL,10h
	CMP	AL,AH
	JE	waitf2
	MOV	AH,AL
	LOOP	waitf2
	recover
	RET
waitf1	ENDP
 music2play   PROC
              saveE
              CALL      menuHide
              CALL      BackDisplay
              recover
              RET
 music2play   ENDP
 scaleplay   PROC
              saveE
	LEA	SI,music1
	LEA	BP,time1
freq2:
	MOV	DI,[SI]
	CMP	DI,0
	JE	endmusic2
	MOV	BX,DS:[BP]
	CALL	soundy
	ADD	SI,2
	ADD	BP,2
	JMP	freq2
endmusic2:
	MOV	AL,48h
	OUT	61h,AL
	JMP	exit1
exit1:
              recover
		  RET
 scaleplay   ENDP
soundy	PROC
              saveE

wait1:
	MOV	CX,2801
delay:
	LOOP	delay
	DEC	BX
	JNZ	wait1

	MOV	AL,0b6h
	OUT	43h,AL
	MOV	DX,12h
	MOV	AX,348ch
	DIV	DI
	OUT	42h,AL
	MOV	AL,AH
	OUT	42h,AL
	IN	AL,61h
	MOV	AH,AL
	OR	AL,3
	OUT	61h,AL
	CALL	waitf1
              recover
	RET
soundy	ENDP
 gunplay   PROC
              saveE
	MOV	CX,50d
newshoot:
	PUSH	CX
	CALL	shoot
	MOV	CX,4000h
silent:
	LOOP	silent
	POP	CX
	LOOP	newshoot
	MOV	AL,48h
	OUT	61h,AL
              recover
	RET
 gunplay   ENDP
shoot	PROC
              saveE
	MOV	DX,140h
	MOV	BX,200h
	IN	AL,61h
	AND	AL,11111100b	;关断定时器通道2的门控
sound:
	XOR	AL,2d			;触发61h端口的第一位
	OUT	61h,AL
	ADD	DX,9248h
	MOV	CL,3
	ROR	DX,CL
	MOV	CX,DX
	ADD	CX,1ffh
	OR	CX,10
waits:
	LOOP	waits
	DEC	BX
	JNZ	sound

	AND	AL,11111100b
	OUT	61h,AL			;恢复61h端口
              recover
		  RET
shoot	ENDP
;*********按下新建菜单时的处理函数******
;入口参数有:musicInt:文件数量,一进入即增加1
;先隐藏菜单,并用默认名创建文件,文件名根据musicInt来自动判断并更改
;最后调用函数:editFile进入编辑状态.
 filenew      PROC
              saveE
              MOV 	modifyFlag,0
              CALL	menuHide
              win		1,28,1,56,70h		;写文件名
              MOV       SI,8
              INC       musicInt
              INC       musicname[SI]

⌨️ 快捷键说明

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