时间:2021-05-19
本文中的汇编语言是基于x86芯片,下面给出代码:
;TITLE GAME4TH PAGE 60,132STSEG SEGMENT DB 64 DUP (0)STSEG ENDS;-----------------------------------DTSEG SEGMENTDATAH DB 10H,10H,10H,10H,10H,10H,10H,10H,10HDATAL DB 20H,21H,22H,23H,24H,25H,26H,27H,28HDTSEG ENDSCR EQU 0DHLF EQU 0AH;------------------------------------CDSEG SEGMENT MAIN PROC FAR ASSUME CS:CDSEG,DS:DTSEG,SS:STSEG MOV AX,DTSEG MOV DS,AX MOV AX,0600H MOV BH,00011110B MOV CX,0 MOV DH,18H MOV DL,04FH INT 10H FISH: MOV AX,0600H MOV BH,00011110B MOV CX,0 MOV DH,18H MOV DL,04FH INT 10H MOV AH,02 MOV BH,00 MOV SI,OFFSET DATAH MOV DI,OFFSET DATAL MOV DH,[SI] MOV DL,[DI] INT 10H MOV AX,0201H MOV DL,'+' INT 21H MOV AH,02 MOV BH,00 MOV DH,[SI]+1 MOV DL,[DI]+1 INT 10H MOV AX,0201H MOV DL,'#' INT 21H MOV AH,02 MOV BH,00 MOV DH,[SI]+2 MOV DL,[DI]+2 INT 10H MOV AX,0201H MOV DL,'#' INT 21H MOV AH,02 MOV BH,00 MOV DH,[SI]+3 MOV DL,[DI]+3 INT 10H MOV AX,0201H MOV DL,'#' INT 21H MOV AH,02 MOV BH,00 MOV DH,[SI]+4 MOV DL,[DI]+4 INT 10H MOV AX,0201H MOV DL,'#' INT 21H MOV AH,02 MOV BH,00 MOV DH,[SI]+5 MOV DL,[DI]+5 INT 10H MOV AX,0201H MOV DL,'#' INT 21H MOV AH,02 MOV BH,00 MOV DH,[SI]+6 MOV DL,[DI]+6 INT 10H MOV AX,0201H MOV DL,'#' INT 21H MOV AH,02 MOV BH,00 MOV DH,[SI]+7 MOV DL,[DI]+7 INT 10H MOV AX,0201H MOV DL,'#' INT 21H MOV AH,02 MOV BH,00 MOV DH,[SI]+8 MOV DL,[DI]+8 INT 10H MOV AX,0201H MOV DL,'>' INT 21H LOOP1:MOV AH,0 ;循环输入 MOV AL,0 INT 16H CMP AH,72 JE UP CMP AH,80 JE DOWN CMP AH,77 JE RIGHT CMP AH,75 JE LEFT UP: MOV SI,OFFSET DATAH MOV DI,OFFSET DATAL MOV DH,[SI]+8 MOV DL,[DI]+8 MOV CH,DH MOV CL,DL DEC DH MOV [SI]+8,DH MOV [DI]+8,DL JMP BACK DOWN: MOV SI,OFFSET DATAH MOV DI,OFFSET DATAL MOV DH,[SI]+8 MOV DL,[DI]+8 MOV CH,DH MOV CL,DL INC DH MOV [SI]+8,DH MOV [DI]+8,DL JMP BACK LEFT: MOV SI,OFFSET DATAH MOV DI,OFFSET DATAL MOV DH,[SI]+8 MOV DL,[DI]+8 MOV CH,DH MOV CL,DL DEC DL MOV [SI]+8,DH MOV [DI]+8,DL JMP BACK RIGHT:MOV SI,OFFSET DATAH MOV DI,OFFSET DATAL MOV DH,[SI]+8 MOV DL,[DI]+8 MOV CH,DH MOV CL,DL INC DL MOV [SI]+8,DH MOV [DI]+8,DL JMP BACK BACK: MOV DH,[SI]+7 MOV DL,[DI]+7 MOV [SI]+7,CH MOV [DI]+7,CL MOV CH,DH MOV CL,DL MOV DH,[SI]+6 MOV DL,[DI]+6 MOV [SI]+6,CH MOV [DI]+6,CL MOV CH,DH MOV CL,DL MOV DH,[SI]+5 MOV DL,[DI]+5 MOV [SI]+5,CH MOV [DI]+5,CL MOV CH,DH MOV CL,DL MOV DH,[SI]+4 MOV DL,[DI]+4 MOV [SI]+4,CH MOV [DI]+4,CL MOV CH,DH MOV CL,DL MOV DH,[SI]+3 MOV DL,[DI]+3 MOV [SI]+3,CH MOV [DI]+3,CL MOV CH,DH MOV CL,DL MOV DH,[SI]+2 MOV DL,[DI]+2 MOV [SI]+2,CH MOV [DI]+2,CL MOV CH,DH MOV CL,DL MOV DH,[SI]+1 MOV DL,[DI]+1 MOV [SI]+1,CH MOV [DI]+1,CL MOV CH,DH MOV CL,DL MOV DH,[SI] MOV DL,[DI] MOV [SI],CH MOV [DI],CL MOV CH,DH MOV CL,DL JMP FISH MAIN ENDP CDSEG ENDS END MAIN以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。
声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。
本文实例为大家分享了C语言实现贪吃蛇小游戏的具体代码,供大家参考,具体内容如下此次贪吃蛇小游戏的目的是使得我在Linux底下使用vi进行编写的心得:1.自己对l
javascript实现简单的贪吃蛇游戏,功能很简单,代码也很实用,就不多废话了,小伙伴们参考注释吧。贪吃蛇varmap;//地图varsnake;//蛇var
我大概在一个多月前把自己上学期写的c代码的贪吃蛇游戏push到csdn上,并且说c风格的贪吃蛇写起来有些麻烦(贪吃蛇游戏的c语言实现),准备用面向对象的c++再
游戏操作说明通过方向键控制贪吃蛇上下左右移动。贪吃蛇吃到食物之后会变长一个长度。游戏具体实现游戏难点是怎么模拟贪吃蛇的移动。如果只是一个方块的话显然很简单。但是
本文实例为大家分享了C语言实现贪吃蛇的具体代码,供大家参考,具体内容如下用C语言链表写的贪吃蛇(程序设计时做的,做的不好大佬勿喷)借助游戏内容分析贪吃蛇所需的功