汇编打字程序.docx
- 文档编号:23583514
- 上传时间:2023-05-18
- 格式:DOCX
- 页数:20
- 大小:16.89KB
汇编打字程序.docx
《汇编打字程序.docx》由会员分享,可在线阅读,更多相关《汇编打字程序.docx(20页珍藏版)》请在冰豆网上搜索。
汇编打字程序
Init_gamemacroop1,op2,op3,op4,op5,op6
movcx,00h
movdh,op1
movdl,op2
op6:
movah,02h
movbh,00h
int10h
pushcx
movah,0ah
moval,op3
movbh,00h
movcx,01h
int10h
popcx
inccx
incop4
cmpcx,op5
jneop6
endm
clear_screenmacroop1,op2,op3,op4
movah,06h
moval,00h
movbh,07h
movch,op1
movcl,op2
movdh,op3
movdl,op4
int10h
movah,02h
movbh,00h
movdh,00h
movdl,00h
int10h
endm
menumacroop1,op2,op3
movah,02h
movbh,00h
movdh,op1
movdl,op2
int10h
movah,09h
leadx,op3
int21h
endm
datasegment
linjiangdb"Madebylinjiang$"
nodb"NO.:
021411$"
megdb"Letushaveagame!
!
Comeon!
!
$"
meg1db"**SelectMenu**$"
meg2db"Pleaseselectthegamespeed,ESCtoquit.$"
meg3db"1.VeryslowTooeasy,speedup!
$"
meg4db"2.SlowEverybodycandeal.$"
meg5db"3.NomalIthinkyoucandeal!
$"
meg6db"4.FastAchallenge.Payattention!
$"
meg7db"5.VeryFastToohard,Haveatry?
$"
meg8db"6.FastestAreyoucrazy?
?
$"
meg9db"*Selectthenumberamong1-6andpressENTERtostart!
*$"
meg10db"GameSpeedSelect:
$"
hotkeydb"Whenyouareplayinggames:
$"
hotkey1db"ESCtoreturntomenu$"
hotkey2db"SPACEtopausethegame$"
hotkey3db"Pressanykeytoplaygames......$"
hotkey4db"Areyouready?
?
$"
failmegdb"Theletterisarrivethebottom,Youarelost!
:
($"
failmeg0db"PressENTERtogoon......$"
failmeg1db"Gameisover!
$"
failmeg2db"PressENTERtoreturnmenuandpressESCtoexit!
$"
failmeg3db"Bye-Bye!
Thankforyourplaying!
!
$"
failmeg4db"Pressanykeytoquit......$"
speeddw00d,4800d,2400d,1800d,1200d,600d,400d
lettersdb"jwmilzoeucgpravskntxhdyqfb"
db"iytpkwnxlsvxrmofzhgaebudjq"
db"nwimzoexrphysfqtvdcgljukda"
letters_bakdb"jwmilzoeucgpravskntxhdyqfb"
db"iytpkwnxlsvxrmofzhgaebudjq"
db"nwimzoexrphysfqtvdcgljukda"
letter_counterdb0
life_flagdb78dup(0)
position_flagdb78dup(0)
present_positiondb1
dataends
stacksegmentparastack'stack'
db64dup(0)
stackends
codesegment
mainprocfar
assumecs:
code,ds:
data,ss:
stack
start:
movax,data
movds,ax
movletter_counter,00h
movpresent_position,1
leasi,position_flag
movah,00h
movcx,00h
init_postion_flag:
mov[si],ah
incsi
inccx
cmpcx,78d
jneinit_postion_flag
leadi,letters
leasi,letters_bak
movcx,00h
init_letters:
movah,[si]
mov[di],ah
incsi
incdi
inccx
cmpcx,78d
jneinit_letters
movah,00h
leasi,life_flag
movcx,00h
init_life_flag:
mov[si],ah
incsi
inccx
cmpcx,78d
jneinit_life_flag
movcx,00h
movah,01h
orch,00010000b
int10h
clear_screen00d,00d,24d,79d
Init_game00d,00d,0ah,dl,80d,nextsign1
Init_game24d,00d,0ah,dl,80d,nextsign2
Init_game00d,00d,0ah,dh,25d,nextsign3
Init_game00d,79d,0ah,dh,25d,nextsign4
menu01d,15d,meg;菜单信息的宏展开
menu01h,61d,linjiang
menu03d,20d,meg1
menu03d,68d,no
menu05d,15d,meg2
menu07d,15d,meg3
menu09d,15d,meg4
menu11d,15d,meg5
menu13d,15d,meg6
menu15d,15d,meg7
menu17d,15d,meg8
menu19d,15d,meg9
menu22d,15d,meg10
input:
movah,02h
movbh,00h
movdh,22d
movdl,33d
int10h
movah,0ah
moval,""
movbh,00h
movcx,01h
int10h
movah,01h
int21h
retry:
cmpal,"1"
jespeed1
cmpal,"2"
jespeed2
cmpal,"3"
jespeed3
cmpal,"4"
jespeed4
cmpal,"5"
jespeed5
cmpal,"6"
jespeed6
cmpal,1bh
jeto_over0
jmpinput
to_over0:
jmpover
speed1:
movah,01h
int21h
cmpal,0dh
jneotherkey
movax,speed+2
movspeed,ax
jmpbegin
speed2:
movah,01h
int21h
cmpal,0dh
jneotherkey
movax,speed+4
movspeed,ax
jmpbegin
speed3:
movah,01h
int21h
cmpal,0dh
jneotherkey
movax,speed+6
movspeed,ax
jmpbegin
speed4:
movah,01h
int21h
cmpal,0dh
jneotherkey
movax,speed+8
movspeed,ax
jmpbegin
speed5:
movah,01h
int21h
cmpal,0dh
jneotherkey
movax,speed+10
movspeed,ax
jmpbegin
speed6:
movah,01h
int21h
cmpal,0dh
jneotherkey
movax,speed+12
movspeed,ax
jmpbegin
otherkey:
;处理重复输入的代码段
pushax
movah,02h
movbh,00h
movdh,22d
movdl,34d
int10h
movah,0ah
moval,""
movbh,00h
movcx,01h
int10h
movah,02h
movbh,00h
movdh,22d
movdl,33d
int10h
popax
movdx,ax
movah,02h
int21h
jmpretry
begin:
clear_screen01d,01d,23d,78d
menu08d,20d,hotkey
menu10d,20d,hotkey1
menu12d,20d,hotkey2
menu14d,20d,hotkey4
menu16d,20d,hotkey3
movah,07h
int21h
clear_screen01d,01d,23d,78d
Init_game23d,01d,06h,dl,78d,nextsign5
movah,02h;光标初始化
movbh,00h
movdh,01h
movdl,01h
int10h
movcx,00h
leasi,letters
nextletter:
;初始化屏幕上方的字母
movah,02h
movdl,[si]
int21h
incsi
inccx
cmpcx,78d
jenextcycle
jmpnextletter
from_front:
;相关循环的算法
subpresent_position,78d
jmpgobackto_si
find_zero:
cmpletter_counter,78d
jerecycle
cmppresent_position,78d
jefrom_one
movah,00h
nextsi:
addpresent_position,01h
incsi
cmp[si],ah
jegobackto_di
cmppresent_position,78d
jefrom_one
jmpnextsi
from_one:
movpresent_position,01h
jmpgobackto_si
recycle:
movletter_counter,00h
movpresent_position,01d
leasi,position_flag
movcx,00h
movah,00h
clearsi:
mov[si],ah
inccx
cmpcx,78d
jenextcycle
incsi
jmpclearsi
nextcycle:
leadi,letters
leasi,position_flag
addpresent_position,31d
cmppresent_position,78
jafrom_front
gobackto_si:
addsi,wordptrpresent_position
decsi
movah,[si]
cmpah,01h
jefind_zero
gobackto_di:
movah,01h
mov[si],ah
adddi,wordptrpresent_position
decdi
movdl,present_position
movah,02h;字母下落的代码段部分
movbh,00h
movdh,01h
int10h
movcx,00h
nextrow:
pushcx;新的一行
movcx,00h
out_cycle:
;延迟
pushcx
movcx,00h
in_cycle:
addcx,01h
cmpcx,50000d
jnein_cycle
pushdx
movah,06h
movdl,0ffh
int21h
popdx
jzpass;如果键盘缓冲区部分为空,则跳转
cmpal,1bh;如果键入ESC,则返回主菜单
jeto_start1
cmpal,"";如果键入SPACE,则游戏暂停
jepause
cmpal,[di];输入字母正确!
跳转!
jedisappear
pass:
popcx
inccx
cmpcx,speed
jeprint
jmpout_cycle
pause:
pushdx;暂停处理
movah,06h
movdl,0ffh
int21h
popdx
cmpal,""
jnepause
jmppass
to_start1:
;返回主菜单
jmpstart
print:
movah,0ah
moval,""
movbh,00h
movcx,01h
int10h
incdh
movah,02h
movbh,00h
int10h
movah,0ah
moval,[di]
movbh,00h
movcx,01h
int10h
popcx
inccx
cmpcx,21d
jeprint_next_letter
jmpnextrow;下一行
disappear:
;击中字母后的相关处理
popcx
popcx
movah,0ah
moval,""
movbh,00h
movcx,01h
int10h
jmphit
print_next_letter:
;处理原位置的空缺
leasi,life_flag
addsi,wordptrpresent_position
decsi
movah,[si]
cmpah,1
jefail
movah,0ah
moval,""
movbh,00h
movcx,01h
int10h
incdh
movah,02h
movbh,00h
int10h
movah,0ah
moval,""
movbh,00h
movcx,01h
int10h
movah,1
mov[si],ah
hit:
movah,02h
movbh,00h
movdh,01h
movdl,present_position
int10h
moval,[di];出现下一个新字母的数法
addal,7
cmpal,7ah
jaconvey_letter
movah,0ah
movbh,00h
movcx,01h
int10h
mov[di],al
addletter_counter,01h
jmpnextcycle
convey_letter:
subal,7ah
addal,61h
movah,0ah
movbh,00h
movcx,01h
int10h
mov[di],al
addletter_counter,01h
jmpnextcycle
fail:
movah,0ah;游戏失败后的相关处理
moval,""
movcx,01h
int10h
incdh
movah,02h
movbh,00h
int10h
movah,0ah
moval,[di]
movbh,00h
movcx,01h
int10h
movah,02h
movbh,00h
movdh,12d
movdl,17d
int10h
pushdx
movah,09h
leadx,failmeg
int21h
popdx
adddh,2
movah,02h
movbh,00h
int10h
movah,09h
leadx,failmeg0
int21h
re:
movah,07h
int21h
cmpal,0dh
jnere
clear_screen01,01,23,78
movah,02h
movbh,00h
movdh,11d
movdl,20d
int10h
pushdx
movah,09h
leadx,failmeg1
int21h
popdx
incdh
incdh
movah,02h
movbh,00h
int10h
movah,09h
leadx,failmeg2
int21h
notkey:
movah,07h
int21h
cmpal,0dh
jeto_start
cmpal,1bh
jeover
jmpnotkey
to_start:
clear_screen00,00,24,79
jmpstart
over:
clear_screen01,01,23,78
movah,02h
movbh,00h
movdh,11d
movdl,15h
int10h
movah,09h
leadx,failmeg3
int21h
movah,02h
movbh,00h
movdh,13d
movdl,15h
int10h
movah,09h
leadx,failmeg4
int21h
movah,07h
int21h
movah,07h
int21h
clear_screen00,00,24,79
movax,4c00h
int21h
mainendp
codeends
endstart
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 汇编 打字 程序