版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、纯为个人思路,无特殊,惊人语句.初学完的;程序功能:最原始简单版俄罗斯方块;硬件连接:接双色点阵;晶振型号:12M;单片机:STC89C52;编写时间:;编程人:HANGBIT;点阵行输入HWBITHZBITLIEBIT;点阵列输入LWBITLZBITWEIBITDUANBITXIANEQUP1BiaoXBITBiao_zBIT;按键是否按下标志Biao_yBITBiao_xBITDou_zBIT;按键相应标志位Ying_zBITDou_yBITYing_yBITDou_xBITYing_xBITBiao_ZYBIT; 开始、暂停标志; 左、右、旋转按键Biao_ztBITKEY_zBITKE
2、Y_yBITKEY_xBITORG0000HAJMPStartORG0003HAJMPInt0_serORG000BHAJMPT0_serORG0030H*Start:MOVR0,#08HMOVR1,#51HMOVR3,#03HMOVR4,#08H/MOV46H,#99MOV40H,#03HMOV30H,#0FEHMOV33H,#0FEHMOV37H,#80HMOVTMOD,#01HMOVTH0,#(65536-10000)/256MOVTL0,#(65536-10000)MOD256SETBEASETB EX0SETBET0SETBIT0SETBTR0;Main:CALLZhanting;暂
3、停响应CALLXianshi;点阵显示CALLCMkey_z;左移按键CALLCMkey_y;右移按键CALLCMkey_x;旋转按键CALLPanduan_z;判断是否可以左移CALLPanduan_y;判断是否可以右移CALLPanduan_x;判断是否可以旋转CALLPanduan_xia;判断是否可以下移CALLPanduan_xh;判断消行CALLSaomiao_xh;扫描消行CALLJifen;计算分值CALLJifenXianshi;分值显示ORLPCON,#01HAJMPMain;Zhanting:JBBiao_zt,Out_zt;判断是否暂停Zhanti:MOVA,37H;显
4、示STARTRLCAMOV37H,AMOVLIE,CCLRLWSETBLWDJNZR0,ZhantiMOVR0,#08HCLRLZSETBLZMOVA,37HRLCARRAMOV37H,AZhan:SETBHANGCLRHWSETBHWDJNZR0,ZhanMOVR0,#08HMOVA,38HINC38HMOVDPTR,#TABZMOVCA,A+DPTRMOV39H,AZhant:MOVA,39HRLCMOVMOVCLRSETBDJNZMOVCLRSETBCALLCALLQing:SETBCLRSETBDJNZMOVQing1:SETBCLRSETBDJNZMOVCLRSETBDJNZ39H,
5、AHANG,CHWHWR0,ZhantR0,#08HHZHZDelayDelayHANGHWHWR0,QingR0,#08HHANGHWHWR0,Qing1R0,#08HHZHZR4,ZhantiMOVR5,#08HCLRCYMOVA,38HSUBBA,#08HMOV38H,A/MOV38H,#00HMOVA,44HMOV34H,#00HCJNEA,#10,ZhantingINC38HMOV44H,#00HMOVA,38HCJNEA,#31,ZhantingMOV38H,#00HAJMPZhantingOut_zt:RET;Xianshi:;移动积木显示SETBHANGCLRHWSETBHWD
6、JNZR0,XianshiMOVR0,#08HLoop:MOVA,30HRLCAMOVHANG,CCLRHWSETBHWDJNZR0,LoopMOVR0,#08HCLRHZSETBHZMOVA,30HRLCARLAMOV30H,ACALLXingzMOVA,31HINC31HMOVCA,A+DPTRMOV32H,ACALLHengyiLoop1:MOVA,32HRLCAMOV32H,AMOVLIE,CCLRLWSETBLWDJNZR0,Loop1MOV R7,#08HCLRLZSETBLZCALLDelayCALLQingpingBeijing:;背景显示SETBHANGCLRHWSETBHW
7、DJNZR0,BeijingMOVR0,#08HLoop3:MOVA,33HRLCAMOV33H,AMOVHANG,CCLRHWSETBHWDJNZR0,Loop3MOVR0,#08HCLRHZSETBHZMOVA,33HRLCARLAMOV 33H,AMOVA,R1MOV50H,ALoop2:MOVA,50HRLCAMOV50H,AMOVLIE,CCLRLWSETBLWDJNZR0,Loop2MOVR0,#08HINCR1CLRLZSETBLZCALLDelayCALLQingpingCJNER1,#59H,Xianshi0MOVR1,#51HMOV31H,#00HRETXianshi0:A
8、JMPXianshi确认显示形状*Xingz:MOVA,40HCJNEA,#0,S1MOV DPTR,#TAB0RET51: CJNECALLRET52: CJNECALLRET53: CJNECALLRET54: CJNECALLRET55: CJNECALLRET56: CALLRETXuanz1:MOVCJNEMOVRETXu1:CJNEMOVA,#1,S2Xuanz1A,#2,S3Xuanz2A,#3,S4Xuanz3A,#4,S5Xuan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Dou_z,Loopz2SETBDou_zLoopz2:INC42HJBYing_z,OutzSETBYing_zSETBBiao_zRETLoopz0:CLRDou_zCLRYing_zOutz:RET右移按键;CMkey_y:JBKEY_y,Loopy0JBDou_y,Loopy2SETBDou_yRETLoopy2:INC42HJBYing_y,OutySETBYing_yS
13、ETBBiao_yRETLoopy0:CLRDou_yCLRYing_yOuty:RET旋转按键*;CMkey_x:JBKEY_x,Loopx0JBDou_x,Loopx2SETBDou_xRETLoopx2:INC42HJBYing_x,OutxSETBYing_xSETBBiao_xRETLoopx0:CLRDou_xCLRYing_xOutx:RET左移防冲突;Panduan_z:JBCBiao_z,ZuoyiRETZuoyi:SETBBiao_ZYCALLHangyiMOVA,36HJB,YesZuoCALLHangerMOVA,36HJB,YesZuoCALLHangsanMOVA,
14、36HJB,YesZuo;已到边上,不用移动MOV45H,R3DECR3MOVA,35HCJNEA,#0,Zuo_0;防移动冲突背景AJMPYesZuoZuo_0:CJNEA,#1,Zuo_1AJMPYesZuoZuo_1:CJNEA,#2,Zuo_2CALLXuan_1AJMPYesZuoZuo_2:CJNEA,#3,Zuo_3CALLXuan_2AJMPYesZuoZuo_3:CJNEA,#4,Zuo_4CALLXuan_3Zuo4:AJMPYesZuoCJNEA,#5,Zuo_5CALLXuan_4AJMPYesZuoZuo_5:CALLXuan_5YesZuo:RET右移防冲突;Pan
15、duan_y:JBCBiao_y,YouyiRETYouyi:SETBBiao_ZYCALLHangyiMOVA,36HJB,YesyouCALLHangerMOVA,36HJB,YesyouCALLHangsiMOVA,36HJB,Yesyou;已到边上MOV45H,R3INCR3MOVA,35H防右移冲突背景CJNEA,#0,You_0AJMPYesyouYou0:CJNEA,#1,You_1AJMPYesyouYou_1:CJNEA,#2,You_2CALLXuan_1AJMPYesyouYou_2:CJNEA,#3,You_3CALLXuan_2AJMPYesyouYou_3:CJNE
16、A,#4,You_4CALLXuan_3AJMPYesyouYou_4:CJNEA,#5,You_5CALLXuan_4AJMPYesyouYou_5:CALLXuan_5Yesyou:旋转防冲突RET;Panduan_x:JBCBiao_x,XuanzhuanMOVA,40HCJNEA,#0,BieRETBie:MOVA,35HCJNEA,#0,PanyiRETPanyi:MOV43H,41HINC41HMOVA,40HCJNEA,#1,NoyiMOVA,35HCJNEA,#1,XuanyiMOV41H,43HRETXuanyi:MOVA,41H;一字型防出边界CJNEA,#1,Yi_1AJ
17、MPYi_hYi_1:CJNEA,#3,Yi_sAJMPYi_hYi_s:;一字型防冲突背景CALLHangyiXuanzhuan:;方形不用旋转MOV A,36HANLA,#83HCJNEA,#0,NoxuanYi_h:MOVA,35HCJNEA,#2,Yi_h2CALLXuan_1CALLYesxuanRETYi_h2:MOVA,35HCJNEA,#3,Yi_h3CALLXuan_2CALLYesxuanRETYi_h3:MOVA,35HCJNEA,#4,Yi_h4CALLXuan_3CALLYesxuanRETYi_h4:MOVA,35HCJNEA,#5,Yi_h5CALLXuan_4C
18、ALLHangsiMOVA,36HCJNEA,#0,NoxuanCALLYesxuanRETYi_h5:CALLXuan_5CALLHangsiMOVA,36HANLA,55HCJNEA,#0,NoxuanCALLYesxuanRETNoyi:;另外五种变形防出边界冲突背景CALLYouchuMOVA,35HCJNEA,#1,Xuanzh1CALLYesxuanRETXuanzh1:;防冲突背景CJNEA,#2,Xuanzh2CALLXuan_1CALLYesxuanRETXuanzh2:CJNEA,#3,Xuanzh3CALLXuan_2CALLYesxuanRETXuanzh3:CJNEA
19、,#4,Xuanzh4CALLXuan_3CALLYesxuanRETXuanzh4:CJNEA,#5,Xuanzh5CALLXuan_4CALLYesxuanRETXuanzh5:CALLXuan_5Yesxuan:MOVA,41HCJNEA,#4,OutqMOV41H,#00HOutq:RETNoxuan:MOV41H,43H防右出边界子程序RETYouchu:CALLHangyiMOVA,36HJB,NoxuanMOVA,36HJB,NoxuanCALLHangsanMOVA,36HJB,NoxuanRETXuan_1:CALLHangyiMOVA,36HANLA,54HCJNEA,#0
20、,No_zyxRETXuan_2:CALLHangyiMOVA,36HANLA,55HCJNEA,#0,No_zyxCALLHangerMOVA,36HANLA,54HCJNEA,#0,No_zyxRETXuan_3:CALLHangyiMOVA,36HANLA,56HCALLHanger防冲突子程序CJNE A,#0,No_zyxCALLHangerMOVA,36HANLA,55HCJNEA,#0,No_zyxCALLHangerMOVA,36HANLA,54HCJNEA,#0,No_zyxRETXuan_4:CALLHangyiMOVA,36HANLA,57HCJNEA,#0,No_zyx
21、CALLHangerMOVA,36HANLA,56HCJNEA,#0,No_zyxCALLHangerMOVA,36HANLA,55HCJNEA,#0,No_zyxRETXuan_5:CALLHangyiMOV A,36HANL A,58HCJNEA,#0,No_zyxCALLHangerMOVA,36HANLA,57HCJNEA,#0,No_zyxCALLHangerMOVA,36HANLA,56HCJNEA,#0,No_zyxRETNo_zyx:JBCBiao_ZY,No_zNo_x:AJMPNoxuan;旋转冲突背景No_z:MOVR3,45H;左、右冲突背景RET一秒下移子程序*Pan
22、duan_xia:MOVA,34HCJNEA,#100,Out_xMOV34H,#00HMOVA,30HRLAMOV30H,AINC35HOutx:RET判断是否可下移;Panduan_xh:MOVA,35HCJNEA,#00H,X1RETX1:CJNEA,#01H,X2CALLXH1RETX2:CJNEA,#02H,X3CALLXH2RETX3:CJNEA,#03H,X4CALLXH3RETX4:CJNEA,#04H,X5CALLXH4RETX5:CJNEA,#05,X6CALLXH5RETX6:CALLXH6RET;XH1:MOVA,36HANLA,54HCJNEA,#0,WanRETXH
23、2:CALLHangyiMOVA,36HANLA,55HCJNEA,#0,WanCALLHangerMOVA,36HANLA,54HCJNEA,#0,WanRETWan:;游戏结束AJMP$XH3:;防下移冲突背景子程序CALLHangyiMOVA,36HANLA,56HCJNEA,#0,Noxia3CALLHangerMOVA,36HANLA,55HCJNEA,#0,Noxia3CALLHangsanMOV A,36HANL A,54HCJNEA,#0,WanRETNoxia3:CALLHangsanMOVA,36HCJNEA,#0,WanCALLHangyiMOVA,36HORLA,55H
24、MOV55H,ACALLHangerMOVA,36HORLA,54HMOV54H,ACALLSMHang;扫描行RETXH4:CALLHangyiMOVA,36HANLA,57HCJNEA,#0,Noxia4CALLHangerMOVA,36HANLA,56HCJNEA,#0,Noxia4CALL HangsanMOVA,36HANLA,55HCJNEA,#0,Noxia4RETNoxia4:CALLHangsiMOVA,36HCJNEA,#0,WanCALLHangyiMOVA,36HORLA,56HMOV56H,ACALLHangerMOVA,36HORLA,55HMOV55H,ACALL
25、HangsanMOVA,36HORLA,54HMOV54H,ACALLSMHang;扫描行RETXH5:CALLHangyiMOVA,36HANLA,58HCALLHangerMOVA,36HANLA,57HCJNEA,#0,Noxia5CALLHangsanMOVA,36HANLA,56HCJNEA,#0,Noxia5RETNoxia5:CALLHangyiMOVA,36HORLA,57HMOV57H,ACALLHangerMOVA,36HORLA,56HMOV56H,ACALLHangsanMOVA,36HORLA,55HMOV55H,ACALLHangsiMOVA,36HORLA,54H
26、MOV54H,ACALL SMHang ; 扫描行RETXH6:CALLHangyiMOVA,36HORLA,58HMOV58H,ACALLHangerMOVA,36HORLA,57HMOV57H,ACALLHangsanMOVA,36HORLA,56HMOV56H,ACALLHangsiMOVA,36HORLA,55HMOV55H,ACALLSMHang;扫描行RETSMHang:;积木停止,出新积木SETBBiaoXMOV30H,#0FEHMOV31H,#00HMOV34H,#00HMOV35H,#00HRET*Hangyi:CALLMOVMOVCMOVCALLMOVRETHanger:C
27、ALLMOVMOVCMOVCALLMOVRETHangsan:CALLMOVMOVCMOVCALLMOVXingzA,#01HA,A+DPTR32H,AHengyi36H,32HXingzA,#00HA,A+DPTR32H,AHengyi36H,32HXingzA,#07HA,A+DPTR32H,AHengyi36H,32HRETHangsi:CALLXingzMOVA,#06HMOVCA,A+DPTRMOV32H,ACALLHengyiMOV36H,32HRET扫描是否消行*Saomiao_xh:JBCBiaoX,SaomiaoRETSaomiao:MOV41H,#00H;消行MOVR3,#
28、03HMOVA,42HMOVB,#07HDIVABMOV40H,BMOVA,54HCJNEA,#0FFH,Sao1MOV54H,#00HINCR5Sao1:MOVA,55HCJNEA,#0FFH,Sao2MOV55H,54HINCR5Sao2:MOVA,56HCJNEA,#0FFH,Sao3MOV56H,55HMOV55H,54HMOV54H,#00HINCR5Sao3:MOVA,57HCJNEA,#0FFH,Sao4MOV57H,56HMOV56H,55HMOV55H,54HMOV54H,#00HINCR5Sao4:MOVA,58HCJNEA,#0FFH,Sao5MOV58H,57HMOV5
29、7H,56HMOV56H,55HMOV55H,54HMOV54H,#00HINCR5Sao5:RET*得分显示Jifen:CJNER5,#0,Jia1RETJia1:MOVA,R5MOVR5,#00HCJNEA,#1,Jia2INC46HRETJia2:CJNEA,#2,Jia3MOVA,#3ADDA,46HMOV46H,ARETJia3:CJNEA,#3,Jia4MOVA,#7ADDA,46HMOV46H,ARETJia4:MOVA,#10ADDA,46HMOV46H,AJifenXianshi:MOVXIAN,#0BFHSETBWEICLRWEIMOVA,46HMOVB,#10DIVABM
30、OVDPTR,#TABMOVCA,A+DPTRMOVXIAN,ASETBDUANCLRDUANCALLDelayMOVXIAN,#7FHSETBWEICLRWEIMOVA,BMOVCA,A+DPTRMOVXIAN,ASETBDUANCLRDUANCALLDelayMOVXIAN,#0FFHSETBWEICLRWEIRET*暂停标志位Int0_ser:CPLBiao_ztRETI;T0_ser:MOVMOVINCINCINCRETI;*;Qingping:CLRLIECLRLWSETBLWDJNZR0,QingpingMOVR0,#08HCLRLZSETBLZRET;Delay:MOVR6,#10D1:MOVR7,#10DJNZR7,$TH0,#(65536-10000)/256TL0,#(65536-10000)MOD25634H42H44H清屏子程序延时子程序定时计数,并出随机数DJNZR6,D1RET*随机积木7类型; 田字型; 一字型;L 型;T 字型TA
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 异地欠款合同模板
- 承包林地养殖合同范例
- 挂靠物业公司合同范例
- 房车订制售卖合同范例
- 会计审核合同范例
- 影视合作分工合同范例
- 借款公司合同范例
- 户外舞台搭建合同范例
- 工业用地转让合同范例
- 手工鏊子转让合同模板
- 高中数学必修一《双曲线及其标准方程》课件
- DB13-T 5800-2023 复温竹罐治疗外科术后患者低体温技术规范
- 政府、办公楼物业管理服务投标方案(技术方案)
- 幼儿园中班社会《节约用纸》课件
- 时代乐章第三课自然之美 课件 2024-2025学年人教版(2024)初中美术上册
- 2024小学语文五上2:大单元作业设计
- 【地理】城镇与乡村 课件-2024-2025学年人教版七年级地理上册
- 宜居宜业和美乡村项目可行性研究报告-全国乡村文化振兴在行动
- 住宅区和住宅建筑通信配套工程技术标准 DG-TJ08-606-2022
- 厨房燃料合同协议书
- 2024年新苏教版一年级上册数学全册课件(新版教材)
评论
0/150
提交评论