亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? caculator.asm

?? 利用匯編語言實現的一個打字練習程序
?? ASM
字號:
;*************************************************
;funtion:caculator
;1.receive the arithmatic expression
;2.conver the nuber into integal number and push
;  into stack as the order input
;3.if without "()":call caculator to get the result
;      else :be priority to deal with the data con-
;            tained in the "()"and push result into
;            stack until no "()" among the express-
;            ion,then call Caculator to gain result.
;**************************************************
;illustrate:si indicate the current character inputed
stack segment para stack
      db 256 dup (?)
top   label word
stack ends
data segment
ESCAPE   =  1BH
stoax    dw ?
stobx    dw ?
stocx    dw ?
stodx    dw ?
prompt   db "Please input the expression:",0dh,0ah,'$'
commons  db "Press any key to continue or ESCAPE to exit!",0dh,0ah,'$'
err_1    db "Please make sure the first operand is number",0dh,0ah,'$'
err_2    db "Data is out of the range(0~32768)",0dh,0ah,'$'
err_3    db "The data operand is needed",0dh,0ah,'$'
err_4    db "Maybe the operade is missed",0dh,0ah,'$'
err_5    db "invalid caculate expression(maybe you drop the operate)",0dh,0ah,'$'
err_6    db "empty!",0dh,0ah,'$'
err_7    db "Match error!('(' and ')' don't match)",0dh,0ah,'$'
buffer   db 128              ;the buffer receiving input
         db ?
equal    db 120 dup (0)
tempdata dw 0                ;store the current data
tempoper dw 0                ;store the current operade
mutex    db 0                ;strict with the input expression
data ends
code segment
     assume ds:data,cs:code,ss:stack
;==================main funtion=====================
main  proc far
start:
      mov  ax,stack
      mov  ss,ax
      mov  sp,offset top     ;set stack area
      mov  ax,data
      mov  ds,ax             ;set the data area
      mov  dx,offset prompt
      mov  ah,9
      int  21h               ;print the input prompt
      mov  dl,' '
      mov  ah,2
      int  21h               ;inset the first bankspace
      mov  dx,offset buffer
      mov  ah,0ah
      int  21h               ;receive the input expression
      call crlf
      mov  si,-1             ;initial the read pointer
      mov  cl,buffer+1       ;get the expression length
      xor  ch,ch
      sub  cx,si
      dec  cx                ;the lenght can caculate
      cmp  cx,0
      jnz  next
      jmp  exit              ;no input
next: mov  dx,-1
      push dx                ;set a mark as sign to be out of stack
dis1: inc  si
      cmp  equal[si],' '
      jz   dis1              ;dispose the backspace
      cmp  equal[si],'0'
      jb   crash
      cmp  equal[si],'9'
      jbe  next_con
crash:mov  dx,offset err_1
      mov  ah,9
      int  21h
      jmp  exit              ;ensure the first operand is a number
next_con:
      mov  dl,buffer+1
      xor  dh,dh
      mov  si,dx             ;si->the last character(0dh)
                             ;set string pointer(si)
cycle:dec  si                ;dipose the extra character
      mov  al,equal[si]
      cmp  equal[si],' '
      jz   cycle             ;remove the ' '
      cmp  si,-1
      jz   final             ;when the expression contain ' ' at the head
      cmp  equal[si],0dh    
      jz   cycle             ;remove the CR key
      cmp  equal[si],')'
      jz   push_sign         ;')' possess the highest priority
      cmp  equal[si],'0'     ;at the end of the expression
      jb   err_miss          ;miss a operade
      cmp  equal[si],'9'
      ja   err_miss          ;si point to the first number
      call convert           ;start deal with the data
      push dx                ;store a operand
      cmp  equal[si],'('     
      jz   call_ca
deduce: 
      cmp  equal[si],' '
      jz   cycle             ;remove the ' '
      cmp  equal[si],'+'     ;push the differnt operade
      jz   push_op           ;into the stack
      cmp  equal[si],'-'
      jz   push_op
      cmp  equal[si],'*'
      jz   push_op
      cmp  equal[si],'/'
      jz   push_op
      cmp  si,0
      jle  final
      jmp  err_miss          ;miss an operade
;
err_miss:
      mov  dx,offset err_4
      mov  ah,9
      int  21h
      jmp  exit
;
push_sign:                   ;push the exit paremeter of
      inc  mutex
      mov  dx,-1             ;the stack
      push dx
      jmp  cycle
;
final:
      cmp   mutex,0
      jnz   err_match
      call  caculate
      push dx
      mov  dl,'='
      mov  ah,2
      int  21h               ;print '='
      pop  dx
      cmp  dx,32768
      jb   print
      neg  dx
      push dx
      mov  dl,'-'
      mov  ah,2
      int  21h
      pop  dx
print:call decimal           ;display the result as a decimal number
      call crlf
      jmp  exit
;
call_ca:                     ;caculate the expression in '()'
      dec  mutex
      call caculate
      push dx
dis2: dec  si
      cmp  equal[si]," "
      jz   dis2
      jmp  deduce            ;deal with the '+、-、*、/'
;
push_op:                     ;push the operade
      mov  dl,equal[si]
      xor  dh,dh
      push dx
      jmp  cycle
;
err_match:
      mov  dx,offset err_7
      mov  ah,9
      int  21h               ;'('、')' don't match
      jmp  exit
;
exit: mov  dx,offset commons
      mov  ah,9
      int  21h               ;make a choice
      mov  ah,8
      int  21h               ;read the key input
      cmp  al,ESCAPE
      jz   _exit
      jmp  start
_exit:mov  ax,4c00h
      int  21h
main  endp
;========caculator the in order expression============
;in: stack
;out:cx+dx=final result (the final or middle result)
caculate proc
         pop  stodx          ;store the address to return
  mov  stoax,ax
  mov  stobx,bx
  mov  stocx,cx       ;store the register data 
next_sum:
         pop  dx             ;store data in the stack to dx 
  cmp  dx,-1
  jnz  start_sum      ;is the end of the stack?
  cmp  tempdata,0     ;dealing with the rest data before return  
  jz   exit_sum
  cmp  tempoper,'+'
  jz   deal_add
  jmp  deal_sub
  pop  dx             ;pop the extral '+' or '-'
exit_sum:mov  dx,cx          ;return the result
         mov  cx,stocx
  mov  bx,stobx
  mov  ax,stoax       ;recover the register data
  push stodx          ;recover the address to return
  ret
start_sum:
         cmp  dx,'*'
  jz   deal_mul
  cmp  dx,'/'
  jz   deal_div
  cmp  dx,'+'
  jz   deal_add
  cmp  dx,'-'
  jz   deal_sub
  mov  cx,dx          ;store the first operand to cx
         jmp  next_sum
;
;
deal_mul:                    ;multiply
         pop  ax             ;the second operand
next_mul:xor  dx,dx
  mul  cx             ;the first operand
  cmp  dx,0
  jnz  err_mul
         push ax             ;mul result store to continue
con_mul: jmp  next_sum
err_mul: mov  dx,offset err_6
         mov  ah,9
  int  21h
  mov  dx,-1
  push stodx
  ret                 ;out of range and unusual return
;
;
deal_div:                    ;divide
         pop  ax             ;the second operand
next_div:xor  dx,dx
  xchg ax,cx
  div  cx
  push ax             ;mod result
con_div: jmp  next_sum
;
;
deal_add:                    ;addition
         cmp  tempdata,0
  jz   store_add      ;need to caculate or not?
  push dx             ;push the operade(+)
  cmp  tempoper,'-'
  jz   case_sub
  add  cx,tempdata
  jmp  next_add
case_sub:xchg tempdata,cx
         sub  cx,tempdata
next_add:mov  tempdata,0
  mov  tempoper,0     ;temporarily store data and operater
  push cx
  jmp  next_sum
store_add:                   ;no need to caculate
         mov  tempdata,cx    ;(cx)the current number
  mov  tempoper,dx    ;(dx)the current operade
  jmp  next_sum       ;get the next data or operade
;
;  
deal_sub:                    ;subtract
  cmp  tempdata,0
  jz   store_sub      ;Dose need to caculate?
  push dx             ;push the operade '-'
  cmp  tempoper,'+'
  jz   case_add
  xchg tempdata,cx
  sub  cx,tempdata
  jmp  next_sub
case_add:add  cx,tempdata
next_sub:
  mov  tempdata,0
  mov  tempoper,0     ;temporary store
  push cx             ;push the middle result in cx
  jmp  next_sum
store_sub:                   ;no need to caculate
         mov  tempdata,cx    ;(cx)the current number
  mov  tempoper,dx    ;(dx)the current operade
  jmp  next_sum       ;continue to get the data of the stack
;
;
ret_sum: ;mov  cx,stocx
  ;mov  bx,stobx
  ;mov  ax,stoax       ;recover the register data
  ;push stodx
         ;ret
caculate endp
;###conver the character into the integral number####
;describe:the si register indicate the first numberal operand
;in:si
;out:dx (push the intergral number into the stack
change   proc
         mov  stoax,ax
  mov  stobx,bx
  mov  stocx,cx       ;store the register data 
         xor  dx,dx
  mov  cx,10d
next_ver:
  mov  ax,dx          ;sotre the number
  xor  dx,dx
  mul  cx
  mov  bl,byte ptr equal[si]
  sub  bl,30h
  xor  bh,bh          ;convert equal[si] to the integral data
         add  ax,bx
  cmp  dx,0
  jnz  err_ver
  mov  dx,ax          ;store the data into dx(return)
  inc  si
  mov  al,byte ptr equal[si]
  cmp  al,'0'
         jb   ret_ver
  mov  al,byte ptr equal[si]
  cmp  al,'9'
  ja   ret_ver
  jmp  next_ver
err_ver: mov  dx,offset err_2;unreachable range of the data(0~32768)  
         mov  ah,9
  int  21h
ret_ver:
  mov  cx,stocx
  mov  bx,stobx
  mov  ax,stoax       ;recover the register data
         ret
change   endp
;in:si    (pointer to the first integral number )
;out:dx=the integral data(≥0)
;    si=point to the current character that will be analysised
;function:vonvert a series of numberal characters to a decimal number
convert  proc
         push ax
         push cx
         mov  cx,1
  xor  dx,dx
         push dx             ;initial the enterance
next_chg:
         cmp  si,0
         jb   exit_chg       ;at the end of stack
         cmp  equal[si],'0'
         jb   exit_chg       ;<0
         cmp  equal[si],'9'  ;>9
         ja   exit_chg       ;the sign to exit
         mov  al,equal[si]
         sub  al,30h
         xor  ah,ah
         xor  dx,dx
         mul  cx
         pop  dx
         add  dx,ax          ;store the result
         push dx
         mov  ax,10
         mul  cx             ;weight*10
         mov  cx,ax
         dec  si
  jmp  next_chg       ;cycle to convert to intergral number
exit_chg:
  pop  dx
         pop  cx
         pop  ax
         ret
convert  endp
crlf     proc
         push dx
  push ax
  mov  dx,0dh
  mov  ah,2
  int  21h
  mov  dx,0ah
  mov  ah,2
  int  21h
  pop  ax
  pop  dx
  ret
crlf     endp
;in:dx
;out:
;print the decimal number on the screen
decimal proc
        push ax
 push bx
 push cx
 push dx
 mov  ax,dx
 mov  cx,10
 mov  dx,-1
 push dx       ;the exit paremeter of the stack
next_de:xor  dx,dx
 div  cx
 add  dx,30h
        push dx
        or   ax,ax
 jnz  next_de
dis_de: pop  dx
        or   dx,dx
 jz   dis_de
        cmp  dx,-1
 jnz  deal_de
 mov  dx,30h
 mov  ah,2
 int  21h
 ret
deal_de:mov  ah,2
        int  21h
 pop  dx
 cmp  dx,-1
 jnz  deal_de
 pop  dx
 pop  cx
 pop  bx
 pop  ax
 ret
decimal endp
code     ends
         end start

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
石原莉奈在线亚洲二区| 午夜成人免费电影| 久久午夜国产精品| 日韩欧美国产一区在线观看| 欧美老肥妇做.爰bbww| 欧美亚洲高清一区二区三区不卡| 成人app软件下载大全免费| 国产精品系列在线播放| 国产乱码精品一区二区三| 国产主播一区二区| 欧美日韩美少妇| 精品中文字幕一区二区| 中文字幕在线免费不卡| 日本精品免费观看高清观看| 色综合久久久久综合体桃花网| 成人免费视频一区| www.亚洲人| 色呦呦网站一区| 色综合天天综合网天天狠天天 | 奇米888四色在线精品| 午夜欧美电影在线观看| 香蕉影视欧美成人| 蜜桃av一区二区在线观看| 久久97超碰国产精品超碰| 精品一区二区三区av| 国产成人av电影在线| av不卡一区二区三区| 欧美自拍丝袜亚洲| 日韩一区二区电影| 久久久久久黄色| 免费成人av在线| 蜜臀久久99精品久久久久久9| 久久精品国产亚洲aⅴ| 国产成人综合在线观看| 91香蕉视频mp4| 67194成人在线观看| 久久综合九色综合欧美亚洲| 国产精品久久久久久福利一牛影视 | 一区二区三区在线视频观看| 一区二区三区欧美日| 琪琪久久久久日韩精品| 国产精品一区二区果冻传媒| 91视频观看视频| 欧美一区二区大片| 国产欧美一区二区三区网站| 亚洲精品成人在线| 男男gaygay亚洲| www.亚洲色图.com| 日韩一卡二卡三卡国产欧美| 亚洲国产成人自拍| 图片区日韩欧美亚洲| 成人免费在线播放视频| 艳妇臀荡乳欲伦亚洲一区| 悠悠色在线精品| 久久超碰97中文字幕| 色呦呦国产精品| 欧美tk丨vk视频| 亚洲丝袜美腿综合| 免费在线看成人av| 91免费小视频| 久久日韩精品一区二区五区| 亚洲欧美日韩精品久久久久| 久久国产婷婷国产香蕉| 91浏览器在线视频| 精品国产免费一区二区三区香蕉| 一区二区在线观看免费视频播放| 日韩国产精品久久| 成人app在线| 精品国产一区二区精华| 亚洲国产精品久久人人爱| 国产一区二区三区视频在线播放| 欧美综合天天夜夜久久| 国产精品麻豆视频| 国产一区久久久| 欧美日韩免费在线视频| 中文字幕一区二区视频| 久久电影国产免费久久电影| 久久噜噜亚洲综合| 亚洲成人在线观看视频| 99精品久久只有精品| 精品国产91亚洲一区二区三区婷婷 | 日韩视频免费观看高清完整版 | 高清日韩电视剧大全免费| 日韩一区二区三区电影在线观看 | 久久久精品tv| 日本中文字幕一区二区有限公司| 97se亚洲国产综合自在线| 26uuu亚洲婷婷狠狠天堂| 丝袜国产日韩另类美女| 91福利视频久久久久| ...xxx性欧美| 99re这里只有精品视频首页| 国产午夜精品美女毛片视频| 久久精品国产亚洲高清剧情介绍 | 亚洲一区二区三区四区在线| 成年人国产精品| 国产精品久久久久久久午夜片| 国产一区二区三区四区在线观看| 欧美tickling网站挠脚心| 调教+趴+乳夹+国产+精品| 欧美天堂亚洲电影院在线播放| 亚洲视频 欧洲视频| 97超碰欧美中文字幕| 亚洲欧洲av另类| 一本久久精品一区二区| 亚洲人午夜精品天堂一二香蕉| 99久久免费视频.com| 亚洲色图在线视频| 91福利在线播放| 亚洲综合无码一区二区| 欧美色图天堂网| 日韩中文字幕麻豆| 日韩一区二区三区免费看| 免费精品视频在线| 精品日韩一区二区| 国产福利一区在线| 国产欧美日韩视频在线观看| 丁香另类激情小说| 亚洲三级在线播放| 在线精品视频小说1| 天堂成人国产精品一区| 欧美一级艳片视频免费观看| 色综合中文综合网| 日韩av一区二区三区四区| 欧美一区二区三级| 国内成人精品2018免费看| 国产亚洲欧美一区在线观看| 国产91精品在线观看| 亚洲天堂av一区| 欧美三级欧美一级| 久久爱另类一区二区小说| 国产午夜精品久久久久久久| www.在线成人| 香蕉久久一区二区不卡无毒影院| 日韩午夜电影av| 成人午夜激情视频| 亚洲一区二区精品3399| 欧美一级欧美三级在线观看 | 精品sm在线观看| 99久久99久久精品免费观看| 亚洲综合视频在线| 日韩视频中午一区| 成人动漫一区二区| 婷婷一区二区三区| 国产日韩欧美不卡在线| 色婷婷狠狠综合| 麻豆精品视频在线观看视频| 亚洲国产高清不卡| 69堂成人精品免费视频| 国产成人精品免费网站| 亚洲一区中文在线| 久久免费视频一区| 欧美在线免费播放| 激情综合网最新| 艳妇臀荡乳欲伦亚洲一区| 精品久久久久av影院| 91黄色免费网站| 国内精品伊人久久久久影院对白| 一区二区三区资源| 欧美精品一区二区三区蜜桃 | 欧美日韩一级二级| 国产精品资源在线观看| 一区二区欧美在线观看| 久久久久97国产精华液好用吗| 在线免费观看日本一区| 国产成人午夜高潮毛片| 天堂资源在线中文精品| 国产精品久久久久久亚洲伦| 日韩免费一区二区三区在线播放| 色综合天天天天做夜夜夜夜做| 激情深爱一区二区| 亚洲国产视频a| 中文字幕中文字幕在线一区 | 亚洲乱码国产乱码精品精可以看| 精品国产伦一区二区三区观看方式| 91激情在线视频| 国产.精品.日韩.另类.中文.在线.播放| 亚洲va欧美va人人爽午夜| 国产欧美日韩亚州综合| 日韩一区二区免费在线电影| 色婷婷综合中文久久一本| 国产.欧美.日韩| 久久成人羞羞网站| 日韩精品电影在线| 亚洲一级二级在线| 亚洲日本中文字幕区| 国产午夜精品一区二区| 欧美xxxxxxxxx| 91麻豆精品国产91久久久 | 欧美变态tickle挠乳网站| 欧美在线一二三| 91亚洲男人天堂| 国产成人免费av在线| 狠狠色丁香久久婷婷综合_中| 日本大胆欧美人术艺术动态| 亚洲成人在线网站| 亚洲一区二三区| 亚洲精选在线视频| 樱桃视频在线观看一区| 成人免费在线视频|