返回列表 回复 发帖

汇编菜单模式

  1. wind struc
  2. wpos dw 0
  3. wcolor db ?
  4. wbox dw ?
  5. itempos dw 02
  6. itemcol0 db ?
  7. itemcol1 db ?
  8. itemsum db ?
  9. itemnum db 0
  10. item0 dw ?
  11. wind ends
  12. code segment stack 'stack'
  13. assume cs:code,ds:code,ss:code
  14. begin:
  15. posh db 20
  16. posl db 40
  17. color db 71h
  18. posll db 40d
  19. poscx dw ?
  20. posdx dw ?
  21. number db 00
  22. backaddr dw ?
  23. oldint1c dd ?
  24. msgbox1:
  25. db '谀哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪目',0dh,0ah
  26. db '?New file: ?,0dh,0ah
  27. db '滥哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪馁',0dh,0ah,0
  28. msgbox0:
  29. db '谀腁ssembler and Fortran哪哪哪哪腫 ZDOS ]哪哪哪腣er 2.0哪哪哪哪哪腫 : : ]目',0dh,0ah
  30. db '仆屯屯屯屯屯屯屯屯屯屯屯屯屯File name and path屯屯屯屯屯屯屯屯屯屯屯送屯屯屯偷',0dh,0ah
  31. db '? Edit ? move ?,0dh,0ah
  32. db '? Masm ?arrows ?,0dh,0ah
  33. db '? For1 ? to ?,0dh,0ah
  34. db '? Pas2 (FORTRAN) ?choose ?,0dh,0ah
  35. db '? Link 掏屯屯屯偷',0dh,0ah
  36. db '? Debug ? press ?,0dh,0ah
  37. db '? Execute ? enter ?,0dh,0ah
  38. db '? Name project file ? to ?,0dh,0ah
  39. db '? DosShell ?execute?,0dh,0ah
  40. db '? Quit... ? item ?,0dh,0ah
  41. db '滥哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪心哪哪哪馁',0dh,0ah,0h
  42. msg0 db ' Edit ',0dh,0ah,0,63 dup(0dh)
  43. msg1 db ' Masm ',0dh,0ah,0,63 dup(0dh)
  44. msg2 db ' For1 ',0dh,0ah,0,63 dup(0dh)
  45. msg3 db ' Pas2 (FORTRAN) ',0dh,0ah,0
  46. msg4 db ' Link ',0dh,0ah,0,63 dup(0dh)
  47. msg5 db ' Debug ',0dh,0ah,0,63 dup(0dh)
  48. msg6 db ' Execute ',0dh,0ah,0,63 dup(0dh)
  49. msg7 db ' Name project file ',0dh,0ah,0
  50. msg8 db ' DosShell ',0dh,0ah,0
  51. msg9 db ' Quit... ',0dh,0ah,0
  52. msg10:
  53. time0 db ?,?
  54. db ':'
  55. time1 db ?,?
  56. db ':'
  57. time2 db ?,?,0
  58. msg11 db 0dh,0ah,' ( ZhaoJiBin 97,CL,ZC,9# ) '
  59. db 0dh,0ah,' This is NO shareware,You needn''t outlay anything.'
  60. db 0dh,0ah,' Very thanks,if you have problems,please write a postcard to me. '
  61. db 0dh,0ah,' My name : ZhaoJiBin'
  62. db 0dh,0ah,' My mailbox : ShiChuan Institute Of Technology 9708#'
  63. db 0dh,0ah,' My phone call : (028)7721727',0dh,0ah,0h,'$'
  64. msg12 db 0dh,0ah,07h,' Press Exit to retrun ZDOS 4/3/2000$'
  65. wind0 wind <00,70h,offset msgbox0,0202h,70h,17h,10,0,msg0>
  66. dw msg1,msg2,msg3,msg4,msg5,msg6,msg7,msg8,msg9
  67. edit db 80h,'EDIT.COM ',56 dup(0dh)
  68. masm db 80h,'MASM.EXE ',56 dup(0dh)
  69. for1 db 80h,'FOR1.EXE ',56 dup(0dh)
  70. pas2 db 80h,'PAS2.EXE ',56 dup(0dh)
  71. link db 80h,'LINK.EXE ',56 dup(0dh)
  72. debug db 80h,'DEBUG ',56 dup(0dh)
  73. self db 80h,' ',56 dup(0dh)
  74. dos db 80h,'COMMAND.COM ',0dh
  75. program dw execedit,execmasm, execfor1,execpas2
  76. dw execlink,execdebug,execself,execname
  77. dw execdos, execquit
  78. buffer db 50d,0,51d dup(?)
  79. pathbuffer db 80 dup(?)
  80. start: mov bx,(offset quit-offset begin+110h)/10h
  81. mov ah,4ah
  82. int 21h
  83. mov si,80h
  84. cmp byte ptr[si],0
  85. jz start0
  86. cmp byte ptr[si],50d
  87. ja start0
  88. push cs
  89. pop es
  90. call fillin
  91. start0: mov ah,0fh
  92. int 10h
  93. cmp al,03h
  94. jz start1
  95. mov ax,03h
  96. int 10h
  97. start1: call savecon
  98. push cs
  99. pop ds
  100. push cs
  101. pop es
  102. mov cl,ds:wind0.itemsum
  103. mov ch,ds:wind0.itemnum
  104. lea di,buffer+2
  105. rk2: cmp ch,0ffh
  106. jnz rk3
  107. mov ch,cl
  108. dec ch
  109. rk3: cmp ch,cl
  110. jb rk4
  111. mov ch,0
  112. rk4: lea si,ds:wind0.itemnum
  113. mov ds:[si],ch
  114. lea si,wind0
  115. call makewind
  116. call disppath
  117. call settimer
  118. lea si,buffer
  119. mov byte ptr[si+1],0
  120. call input
  121. call killtimer
  122. cmp ah,50h
  123. jnz rk0
  124. inc ch
  125. rk0: cmp ah,48h
  126. jnz rk1
  127. dec ch
  128. rk1: cmp ah,1ch
  129. jnz rk2
  130. call oopscon
  131. inc si
  132. cmp byte ptr[si],0
  133. jnz execcommand
  134. mov bl,ch
  135. xor bh,bh
  136. shl bx,1
  137. call ds:[bx+program]
  138. jmp start0
  139. execcommand: mov ax,0e0dh
  140. int 10h
  141. mov al,0ah
  142. int 10h
  143. int 10h
  144. int 2eh
  145. jmp start0
  146. execedit: lea si,edit
  147. int 2eh
  148. jmp start0
  149. execmasm: lea si,masm
  150. int 2eh
  151. jmp start0
  152. execfor1: lea si,for1
  153. int 2eh
  154. jmp start0
  155. execpas2: lea si,pas2
  156. int 2eh
  157. jmp start0
  158. execlink: lea si,link
  159. int 2eh
  160. jmp start0
  161. execdebug: lea si,debug
  162. int 2eh
  163. jmp start0
  164. execself: lea si,self
  165. int 2eh
  166. jmp start0
  167. execdos: lea dx,msg12
  168. mov ah,09h
  169. int 21h
  170. lea si,dos
  171. int 2eh
  172. jmp start0
  173. execquit: mov ax,03
  174. int 10h
  175. lea dx,msg11
  176. mov ah,09h
  177. int 21h
  178. mov dx,00h
  179. mov ds:posh,dh
  180. mov ds:posl,dl
  181. mov ds:posll,dl
  182. mov ds:color,03h
  183. lea si,msg11
  184. call dispstr
  185. mov ax,4c00h
  186. int 21h
  187. execname: call savecon
  188. lea si,msgbox1
  189. mov dx,0807h
  190. mov ds:posh,dh
  191. mov ds:posl,dl
  192. mov ds:posll,dl
  193. mov ds:color,71h
  194. call dispstr
  195. xor bx,bx
  196. mov ah,03h
  197. int 10h
  198. mov ds:poscx,cx
  199. mov ds:posdx,dx
  200. mov dx,0913h
  201. mov ah,02h
  202. int 10h
  203. lea si,buffer
  204. lea di,buffer+2
  205. call input
  206. cmp ah,1ch
  207. jnz execname
  208. cmp byte ptr[si+1],0
  209. jz execname
  210. xor bx,bx
  211. mov cx,ds:poscx
  212. mov dx,ds:posdx
  213. mov ah,02h
  214. int 10h
  215. lea si,buffer
  216. call fillin
  217. call oopscon
  218. ret
  219. fillin: inc si
  220. inc si
  221. mov bx,si
  222. int 3
  223. lea di,edit+10d
  224. name0: call fillname
  225. cmp al,0dh
  226. jz name1
  227. mov al,'.'
  228. cld
  229. stosb
  230. jmp name0
  231. name1: call fillend
  232. mov si,bx
  233. lea di,msg0+10d
  234. name2: call fillname
  235. cmp al,0dh
  236. jz name3
  237. mov al,'.'
  238. cld
  239. stosb
  240. jmp name2
  241. name3: call fillend
  242. mov si,bx
  243. lea di,masm+10d
  244. call fillname
  245. mov al,'.'
  246. cld
  247. stosb
  248. mov ax,'SA'
  249. stosw
  250. mov al,'M'
  251. stosb
  252. call fillend
  253. mov si,bx
  254. lea di,msg1+10d
  255. call fillname
  256. mov al,'.'
  257. cld
  258. stosb
  259. mov ax,'SA'
  260. stosw
  261. mov al,'M'
  262. stosb
  263. call fillend
  264. mov si,bx
  265. lea di,for1+10d
  266. call fillname
  267. mov al,'.'
  268. cld
  269. stosb
  270. mov ax,'OF'
  271. stosw
  272. mov al,'R'
  273. stosb
  274. call fillend
  275. mov si,bx
  276. lea di,msg2+10d
  277. call fillname
  278. mov al,'.'
  279. cld
  280. stosb
  281. mov ax,'OF'
  282. stosw
  283. mov al,'R'
  284. stosb
  285. call fillend
  286. mov si,bx
  287. lea di,link+10d
  288. call fillname
  289. mov al,'.'
  290. cld
  291. stosb
  292. mov ax,'BO'
  293. stosw
  294. mov al,'J'
  295. stosb
  296. call fillend
  297. mov si,bx
  298. lea di,msg4+10d
  299. call fillname
  300. mov al,'.'
  301. cld
  302. stosb
  303. mov ax,'BO'
  304. stosw
  305. mov al,'J'
  306. stosb
  307. call fillend
  308. mov si,bx
  309. lea di,debug+10d
  310. call fillname
  311. mov al,'.'
  312. cld
  313. stosb
  314. mov ax,'XE'
  315. stosw
  316. mov al,'E'
  317. stosb
  318. call fillend
  319. mov si,bx
  320. lea di,msg5+10d
  321. call fillname
  322. mov al,'.'
  323. cld
  324. stosb
  325. mov ax,'XE'
  326. stosw
  327. mov al,'E'
  328. stosb
  329. call fillend
  330. mov si,bx
  331. lea di,self+10d
  332. call fillname
  333. mov al,'.'
  334. cld
  335. stosb
  336. mov ax,'XE'
  337. stosw
  338. mov al,'E'
  339. stosb
  340. call fillend
  341. mov si,bx
  342. lea di,msg6+10d
  343. call fillname
  344. mov al,'.'
  345. cld
  346. stosb
  347. mov ax,'XE'
  348. stosw
  349. mov al,'E'
  350. stosb
  351. call fillend
  352. ret
  353. fillend: cld
  354. mov ax,0dh*256+20h
  355. stosw
  356. mov ax,0ah
  357. stosw
  358. ret
  359. fillname: cld
  360. lodsb
  361. cmp al,0dh
  362. jz fill0
  363. cmp al,'.'
  364. jz fill0
  365. cmp al,'a'
  366. jb fill1
  367. cmp al,'z'
  368. ja fill1
  369. sub al,'a'-'A'
  370. fill1: cld
  371. stosb
  372. jmp fillname
  373. fill0: push di
  374. push ax
  375. mov al,20h
  376. fill4: cmp es:byte ptr[di],0dh
  377. jz fill3
  378. cld
  379. stosb
  380. jmp fill4
  381. fill3: pop ax
  382. pop di
  383. ret
  384. input: push bx
  385. push cx
  386. push dx
  387. input1: xor ax,ax
  388. int 16h
  389. cmp ah,50h
  390. jz input0
  391. cmp ah,48h
  392. jz input0
  393. cmp al,0
  394. jz input1
  395. cmp al,08h
  396. jz input2
  397. cld
  398. stosb
  399. cmp ah,1ch
  400. jz input0
  401. mov cl,ds:byte ptr[si]
  402. cmp cl,ds:byte ptr[si+1]
  403. jz input3
  404. mov ah,0eh
  405. int 10h
  406. inc ds:byte ptr[si+1]
  407. jmp input1
  408. input0: pop dx
  409. pop cx
  410. pop bx
  411. ret
  412. input2: cmp ds:byte ptr [si+1],0
  413. jz input1
  414. dec ds:byte ptr [si+1]
  415. dec di
  416. mov ah,0eh
  417. int 10h
  418. mov al,20h
  419. int 10h
  420. mov al,08h
  421. int 10h
  422. jmp input1
  423. input3: dec di
  424. mov ax,0e07h
  425. int 10h
  426. jmp input1
  427. disppath: call saveregs
  428. xor bx,bx
  429. mov ah,03h
  430. int 10h
  431. mov ah,02h
  432. mov dx,1800h
  433. int 10h
  434. mov ah,02h
  435. mov dl,0dh
  436. int 21h
  437. mov ah,19h
  438. int 21h
  439. mov dl,al
  440. add dl,'A'
  441. mov ah,02h
  442. int 21h
  443. mov dl,':'
  444. int 21h
  445. mov dl,'\'
  446. int 21h
  447. lea si,pathbuffer
  448. mov dl,0
  449. mov ah,47h
  450. int 21h
  451. dpath0: cld
  452. lodsb
  453. or al,al
  454. jz dpath1
  455. mov dl,al
  456. mov ah,02h
  457. int 21h
  458. jmp dpath0
  459. dpath1: mov dl,'>'
  460. mov ah,02h
  461. int 21h
  462. call oopsregs
  463. ret
  464. makewind: call saveregs
  465. mov dx,ds:wind0.wpos
  466. mov ds:posh,dh
  467. mov ds:posl,dl
  468. mov ds:posll,dl
  469. mov dl,ds:wind0.wcolor
  470. mov ds:color,dl
  471. push si
  472. mov si,ds:wind0.wbox
  473. call dispstr
  474. pop si
  475. mov dx,ds:wind0.itempos
  476. mov ds:posh,dh
  477. mov ds:posl,dl
  478. mov ds:posll,dl
  479. mov cl,ds:wind0.itemsum
  480. mov ch,cl
  481. sub ch,ds:wind0.itemnum
  482. mov dl,ds:wind0.itemcol0
  483. mov dh,ds:wind0.itemcol1
  484. lea si,ds:wind0.item0
  485. make1: push si
  486. mov ds:color,dl
  487. cmp ch,cl
  488. jnz make0
  489. mov ds:color,dh
  490. make0: mov si,[si]
  491. call dispstr
  492. pop si
  493. inc si
  494. inc si
  495. dec cl
  496. jnz make1
  497. call oopsregs
  498. ret
  499. ;************************************************
  500. dispstr: call saveregs
  501. mov ax,0b800h
  502. mov es,ax
  503. dispstr0: cld
  504. lodsb
  505. or al,al
  506. jz dispstr3
  507. cmp al,0dh
  508. jnz dispstr1
  509. mov al,cs:posll
  510. mov cs:posl,al
  511. jmp dispstr0
  512. dispstr1: cmp al,0ah
  513. jnz dispstr2
  514. inc cs:posh
  515. jmp dispstr0
  516. dispstr2: call calcul
  517. mov ah,cs:color
  518. cld
  519. stosw
  520. inc cs:posl
  521. jmp dispstr0
  522. dispstr3: call oopsregs
  523. ret
  524. calcul: push ax
  525. mov al,cs:posh
  526. mov ah,80d
  527. mul ah
  528. add al,cs:posl
  529. adc ah,0
  530. shl ax,1
  531. mov di,ax
  532. pop ax
  533. ret
  534. settimer: call saveregs
  535. int 3
  536. mov ax,351ch
  537. int 21h
  538. mov ds:word ptr oldint1c,bx
  539. mov ds:word ptr oldint1c+2,es
  540. lea dx,newint1c
  541. mov ax,251ch
  542. int 21h
  543. call oopsregs
  544. ret
  545. killtimer: call saveregs
  546. int 3
  547. lds dx,oldint1c
  548. mov ax,251ch
  549. int 21h
  550. call oopsregs
  551. ret
  552. newint1c: call saveregs
  553. mov ax,0200h
  554. int 1ah
  555. mov al,ch
  556. lea si,time0
  557. call bcd
  558. mov al,cl
  559. lea si,time1
  560. call bcd
  561. mov al,dh
  562. lea si,time2
  563. call bcd
  564. mov ax,0b800h
  565. mov es,ax
  566. mov di,67*2d
  567. lea si,msg10
  568. disptime: mov al,cs:[si]
  569. inc si
  570. or al,al
  571. jz disptime0
  572. mov ah,071h
  573. cld
  574. stosW
  575. jmp disptime
  576. disptime0: call oopsregs
  577. jmp cs:oldint1c
  578. bcd: mov ah,al
  579. shr ah,1
  580. shr ah,1
  581. shr ah,1
  582. shr ah,1
  583. and al,0fh
  584. add ax,'00'
  585. xchg ah,al
  586. mov cs:[si],ax
  587. ret
  588. saveregs: pop cs:backaddr
  589. db 60h
  590. push ds
  591. push es
  592. push cs:backaddr
  593. ret
  594. oopsregs: pop cs:backaddr
  595. pop es
  596. pop ds
  597. db 61h
  598. push cs:backaddr
  599. ret
  600. savecon: call saveregs
  601. mov ax,0b800h
  602. mov es,ax
  603. mov ds,ax
  604. xor si,si
  605. mov di,80*25*2
  606. mov cx,80*20*2
  607. cld
  608. rep movsb
  609. call oopsregs
  610. ret
  611. oopscon: call saveregs
  612. mov ax,0b800h
  613. mov es,ax
  614. mov ds,ax
  615. xor si,si
  616. mov di,80*25*2
  617. mov cx,80*20*2
  618. xchg si,di
  619. cld
  620. rep movsb
  621. call oopsregs
  622. ret
  623. org $+136h
  624. quit:
  625. code ends
  626. end start
复制代码

                     我是一个呼吸着现在的空气而生活在过去的人
               这样的注定孤独,孤独的身处闹市却犹如置身于荒漠
                                     我已习惯了孤独,爱上孤独
                                 他让我看清了自我,还原了自我
                             让我再静静的沉思中得到快乐和满足
                                   再孤独的世界里我一遍又一遍
                                   不厌其烦的改写着自己的过去
                                             延伸到现在与未来
                                       然而那只是泡沫般的美梦
                                 产生的时刻又伴随着破灭的到来
                         在灰飞烟灭的瞬间我看到的是过程的美丽
                                      而不是结果的悲哀。。。
返回列表