《比赛计算器》Word文档

上传人:W**** 文档编号:154405310 上传时间:2020-12-06 格式:DOC 页数:12 大小:45.50KB
返回 下载 相关 举报
《比赛计算器》Word文档_第1页
第1页 / 共12页
《比赛计算器》Word文档_第2页
第2页 / 共12页
《比赛计算器》Word文档_第3页
第3页 / 共12页
《比赛计算器》Word文档_第4页
第4页 / 共12页
《比赛计算器》Word文档_第5页
第5页 / 共12页
点击查看更多>>
资源描述

《《比赛计算器》Word文档》由会员分享,可在线阅读,更多相关《《比赛计算器》Word文档(12页珍藏版)》请在金锄头文库上搜索。

1、;-; Filename: calc.asm; Version: V 1.0; Writer: Liu Cong,Cui Yang; Organization: Tianjin University; Object: This is a demo for the header of assembly language source file.; Compilation Options: None; History: 09/20/2011 Init version;-imr0 equ 0f7himr1 equ 00hcnt0 equ 280hcnt1 equ 281hcntcmd equ 283

2、hp85a equ 290hp85b equ 291hp85c equ 292h p85cmd equ 293hstacked segment stacksta dw 100 dup(?)top equ length stastacked endsdata segmentmes1 db please input the question.,0ah,0dh,$mes2 db can not hold the number!,0ah,0dh,$mes3 db incorrect input!,0ah,0dh,$mes4 db two-operand support only!,0ah,0dh,$m

3、es5 db overflow!,0ah,0dh,$tab db 3fh,06h,5bh,4fh,66h,6dh,7dh,07h db 7fh,67h,77h,7ch,39h,2eh,79h,71h,73htab1 db 88h,48h,28h,18h,84h,44h,24h,14h db 82h,42h,22h,12h,81h,41h,21h,11hint_seg dw ? int_off dw ?fmimr db 0fmimr1 db 0mdisp db 4 dup(?) operand1 dw 0000hoperand2 dw 0000hoperator db 00hresult dw

4、0000hnumsys dw 10htfor db 60dtemp dw ?tmp dw ?time0 dw ?time1 dw ?flag0 db 00hflag1 db 00hflag2 db 01hflag3 db 00hflag4 db 00htime dw 0000hdata endscode segment assume cs:code,ds:data,ss:stackedstart: mov ax, data mov ds, ax mov ax, stacked mov ss, ax mov sp, top mov dx, cntcmd ;initialize8253,set i

5、nterrupt frequency to 1s once mov al, 37h out dx, al mov dx, cnt0 mov al, 00h out dx, al mov al, 10h out dx, al mov dx, cntcmd mov al, 77h out dx, al mov dx, cnt1 mov al, 00h out dx, al mov al, 10h out dx, al mov dx, p85cmd mov al, 88h out dx, al mov ax, 350bh int 21h mov ax, es mov int_seg, ax mov

6、int_off, bx push ds mov ax, seg int_pr mov ds, ax mov dx, offset int_pr mov ax, 250bh int 21h pop ds in al, 21h mov fmimr, al and al, 0f7h out 21h, al in al, 0a1h mov fmimr1, al and al, 00h out 0a1h, al begin:or flag0, 08h xor ax, ax call disp xor dx, dx mov al, operator cmp al, 0ah je oadd cmp al,

7、0bh je osub cmp al, 0ch je omul cmp al, 0dh je odivoadd: mov ax, operand1 add ax, operand2 mov result, ax jmp over0osub: mov ax, operand1 sub ax, operand2 mov result, ax jmp over0omul: mov ax, operand1 mul operand2 mov result, ax jmp over0odiv: mov ax, operand1 div operand2 mov result, axover0: mov

8、ah, 0 int 16h mov time, 0000h mov flag3, 01h sti lop: hlt mov ah, 0bh int 21h add al, 1 jnz lop mov flag3, 00h cli mov ax, time div tfor xchg ah, al and flag0, 0f7h mov si, 200h mov cx, 2 mov numsys, 10doutput:mov ax, result call disp mov dx, 9999hdelay2:dec dx cmp dx, 0 jnz delay2 mov flag4, 1 mov

9、ax, time call disp mov flag4, 0 mov dx, 9999hdelay1:dec dx cmp dx, 0 jnz delay1 loop output mov operand1, 0 mov operand2, 0 mov operator, 0 mov flag0, 0 mov flag1, 0 mov flag2, 1 mov flag3, 0 mov flag4, 0 jmp begin hlt mov dx, int_seg mov ax, int_off mov ds, ax mov ax, 250bh int 21h mov al, fmimr ou

10、t 21h, al mov al, fmimr1 out 0a1h, al disp proc push ax push bx push cx push dx push di push si pushf newn: mov bx, offset mdisp xor cx, cxsep: xor dx, dx div numsys mov di, cx mov bxdi, dl inc cx cmp ax,0 jnz sep lc: inc di xor dl, dl mov bxdi, dl cmp di, 3 jne lc mov al, flag4 cmp al, 0 jz xlt mov

11、 cx, 4 xlt: mov temp, cxrefh: mov cx, temp mov di, cx dec di mov ah, 01h shl ah, clop: shr ah, 1 mov al, ah mov dx, p85c out dx, al mov al, bxdi mov tmp, bx mov bx, offset tab xlat cmp di, 2 jne no cmp flag4, 0 jz no add al, 80h no: mov bx, tmp dec di mov dx, p85b out dx, al mov al, flag0 and al, 08h cmp al, 0 jnz iping mov cx, 9

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 办公文档 > 解决方案

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号