;--------------------------------------------------------------------
; Filename:
; Version: V
; 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 0f7h
imr1 equ 00h
cnt0 equ 280h
cnt1 equ 281h
cntcmd equ 283h
p85a equ 290h
p85b equ 291h
p85c equ 292h
p85cmd equ 293h
stacked segment stack
sta dw 100 dup(?)
top equ length sta
stacked ends
data segment
mes1 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,'$'
mes5 db 'overflow!',0ah,0dh,'$'
tab db 3fh,06h,5bh,4fh,66h,6dh,7dh,07h
db 7fh,67h,77h,7ch,39h,2eh,79h,71h,73h
tab1 db 88h,48h,28h,18h,84h,44h,24h,14h
db 82h,42h,22h,12h,81h,41h,21h,11h
int_seg dw ?
int_off dw ?
fmimr db 0
fmimr1 db 0
mdisp db 4 dup(?)
operand1 dw 0000h
operand2 dw 0000h
operator db 00h
result dw 0000h
numsys dw 10h
tfor db 60d
temp dw ?
tmp dw ?
time0 dw ?
time1 dw ?
flag0 db 00h
flag1 db 00h
flag2 db 01h
flag3 db 00h
flag4 db 00h
time dw 0000h
data ends
code segment
assume cs:code,ds:data,ss:stacked
start: mov ax, data
mov ds, ax
mov ax, stacked
mov ss, ax
mov sp, top
mov dx, cntcmd ;initialize8253,set interrupt 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 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
比赛计算器 来自淘豆网m.daumloan.com转载请标明出处.