《電子技術(shù)應(yīng)用》
您所在的位置:首頁(yè) > 嵌入式技術(shù) > 解決方案 > 匯編源代碼之GET TIME OF DAY(獲取時(shí)間)

匯編源代碼之GET TIME OF DAY(獲取時(shí)間)

2017-07-23
關(guān)鍵詞: 匯編語(yǔ)言

INTRODUCTION

The first example is of a program that uses the system time of day. This example uses a conditional assembly to decide between two ways to get the time of day. One way is to use the DOS time of day function; the other way, illustrated by the second code example, uses the BIOS time of day function. The second example can be used to replace the standard DOS call to get the time of day. This second example will return the time of day much faster than the standard DOS call.

FIRST EXAMPLE

This example runs until a set time of day occurs and then terminates. This code gets the time of day information from the DOS command line input data. If there is bad input data, then an error message is displayed, informing the user what the correct input data format is. While the program is waiting for the terminate time, it will scan the keyboard for an escape key to terminate the program on user demand.

; Wait for Time
;This program can be executed inside of a .BAT file to
; stall execution of the .BAT file until a set time of day
;?????????????????????????????????????????????????????????? ???
;conditional assembly flag, 0 to use DOS, 1 to use BIOS example
.MODEL tiny
use_bios_flag EQU 1
;----------- stack area ---------------
.STACK 500
;--------------------------------------
.CODE
;************* @@@@@@@@@@@@@@ ***************
start  proc  near
    mov   bx,80H    ;index command line data
    mov   al,[bx]    ;get size of string variable
    mov   ax,cs
    mov   ds,ax     ;reset data segment
    mov   psp_seg,es  ;save PSP address
    mov   es,ax     ;reset extra segment
    cmp   al,4     ;is there data in string
    jb   exit_bad   ;branch if no data
    inc   bx
    inc   bx      ;point to start of data
   ;get number out of buffer area
    call  get_number
    jc   exit_bad   ;branch if number bad
    mov   wait_hour,al ;save number in hour
    cmp   al,23     ;?? number too large ??
    ja   exit_bad   ;branch is too large
   ;check the number terminating character
    cmp   ah,":"
    jne   exit_bad   ;branch if not :
   ;point to start of next number
    inc   bx
   ;get next number out of buffer area
    call  get_number
    jc   exit_bad   ;branch if number bad
    cmp   al,59     ;?? number too large ??
    ja   exit_bad   ;branch if too large
    mov   wait_minute,al   ;save number to minute
  ;display executing wait message
    mov   ah,9    ;set DOS function number
    lea   dx,wait_message
    int   21H     ;DOS call to display message
;________________________________
;********** !!!!!!!! **********
wait_loop:
   ;scan keyboard for keys
    mov   ah,1
    int   16H
    jz   wait_no_key   ;branch if no key
    mov   ah,0      ;if here then keyboard data
    int   16H       ;get key code from buffer
    cmp   ax,3B00H    ;check key code
    je   exit      ;branch if exit key
    cmp   al,1BH     ;check for ESC key
    je   exit      ;branch if ESC key
wait_no_key:
  ;find out what time it is
;conditional assembly ????????????????????
   ;use this code if linking to code in this section
IF use_bios_flag
    call  get_time_of_day
   ;else use this code if calling DOS for time
ELSE
    mov   ah,2CH
    int   21H       ;get current time of day
ENDIF
    cmp   ch,wait_hour
    jne   wait_loop    ;loop if not time
    cmp   cl,wait_minute
    jne   wait_loop    ;loop if not time
;^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
exit:
    mov   ah,4CH
    int   21h       ;terminate program
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
exit_bad:
    mov   ah,9
    lea   dx,exit_bad_message
    int   21H       ;DOS call to display message
    jmp   exit
; ***** ^^^^^^^^ ***** ^^^^^^^^ ****
get_number:
;on entry BX indexes ASCII number data in PSP segment area
;on exit if carry clear,
 ; register AL has binary number, from 0 to 99
 ; BX indexes past the number,
 ; AH has exiting character code indexed by BX
   push ds
   mov ds,psp_seg
   mov al,[bx]
   inc bx
   call number_check
   jc  get_number_bad
   mov ah,al
   mov al,[bx]
   call number_check
   jc  get_number_1
get_number_2a:
   cmp ah,0
   je  get_number_2
   add al,10
   dec ah
   jmp get_number_2a
get_number_2:
   inc bx
   mov ah,al
   mov al,[bx]
get_number_1:
   cmp al,":"
   je  get_number_1a
   cmp al,0DH
   jne get_number_bad
get_number_1a:
   xchg al,ah
   pop ds
   clc    ;set good number flag
   ret
get_number_bad:
   pop ds
   stc    ;set bad number flag
   ret
;#################################################
number_check:
  ;this code checks for ASCII number in AL
  ; if it finds a number, then it makes it binary
  ; and returns with carry clear, else carry set
   cmp al,"0"
   jb  number_bad
   cmp al,"9"
   ja  number_bad
   and al,0FH
   clc
   ret   stc
   ret
;*************************
start   endp
;+++ this routine combines data and code into one segment +++
; define data area
psp_seg     dw   0
wait_hour    db   0
wait_minute   db   0
wait_message  db   0DH,0AH,0DH,0AH
    db  "Wait in progress, Press [ESC] to exit",0DH,0AH
        db   "$"
exit_bad_message    db   0DH,0AH
    db  "To use TimeWait program enter timeout data "
    db  "from command line as example:",0DH,0AH,0DH,0AH
    db   "TimeWait 11:30",0DH,0AH,0DH,0AH
    db   "Note, timeout hours vary from 0 to 23, "
    db   "and minutes from 0 to 59.",0DH,0AH
    db   "$"
;______________________________________
   end start


本站內(nèi)容除特別聲明的原創(chuàng)文章之外,轉(zhuǎn)載內(nèi)容只為傳遞更多信息,并不代表本網(wǎng)站贊同其觀點(diǎn)。轉(zhuǎn)載的所有的文章、圖片、音/視頻文件等資料的版權(quán)歸版權(quán)所有權(quán)人所有。本站采用的非本站原創(chuàng)文章及圖片等內(nèi)容無(wú)法一一聯(lián)系確認(rèn)版權(quán)者。如涉及作品內(nèi)容、版權(quán)和其它問(wèn)題,請(qǐng)及時(shí)通過(guò)電子郵件或電話(huà)通知我們,以便迅速采取適當(dāng)措施,避免給雙方造成不必要的經(jīng)濟(jì)損失。聯(lián)系電話(huà):010-82306118;郵箱:aet@chinaaet.com。
亚洲一区二区欧美_亚洲丝袜一区_99re亚洲国产精品_日韩亚洲一区二区
欧美影院一区| 中国日韩欧美久久久久久久久| 在线观看视频日韩| 国产伦精品一区二区三区视频黑人| 欧美日韩成人综合在线一区二区| 老司机免费视频久久| 久久精品国产成人| 亚洲欧美日韩高清| 亚洲一区二区三区中文字幕在线| 9久re热视频在线精品| 日韩视频免费在线观看| 亚洲精品美女久久7777777| 亚洲国产合集| 亚洲国产精品www| 亚洲国产精品久久精品怡红院| 欧美在线视频观看| 欧美亚洲在线播放| 欧美一区二区私人影院日本| 亚洲欧美精品在线观看| 亚洲欧美视频在线| 午夜精品福利一区二区三区av | 亚洲国产精品日韩| 亚洲高清色综合| 亚洲国产精彩中文乱码av在线播放| 久久精品二区| 亚洲人成在线影院| 亚洲毛片av| av成人动漫| 亚洲一区二区三区中文字幕| 午夜精品福利在线| 欧美中文字幕精品| 久久永久免费| 欧美国产精品人人做人人爱| 欧美日韩亚洲一区| 国产精品毛片在线看| 国产精品一区二区在线观看不卡 | 亚洲激情视频在线播放| 亚洲精品久久久久久一区二区| 亚洲裸体俱乐部裸体舞表演av| 在线一区亚洲| 午夜视频一区二区| 久久一区二区三区国产精品 | 亚洲三级免费电影| 亚洲深夜福利| 久久大香伊蕉在人线观看热2| 亚洲国产影院| 亚洲视频1区2区| 久久精品99国产精品酒店日本| 免费成年人欧美视频| 欧美日韩视频一区二区| 国产精品人人做人人爽| 黄色在线一区| aⅴ色国产欧美| 欧美怡红院视频| 99精品欧美一区| 欧美一区免费| 欧美成人中文| 国产精品久久久久影院亚瑟| 黄色日韩网站| 亚洲一区二区免费| 亚洲国产精品电影| 亚洲一区二区三区久久| 久久久综合精品| 欧美午夜精品一区二区三区| 国产伊人精品| 日韩亚洲欧美一区| 久久国产天堂福利天堂| 中文有码久久| 久久综合九色综合欧美狠狠| 欧美日韩在线不卡| 激情国产一区二区| 日韩视频在线永久播放| 欧美影院在线| 亚洲特色特黄| 美女性感视频久久久| 国产精品国产自产拍高清av| 激情久久婷婷| 亚洲综合不卡| 一区二区三区不卡视频在线观看 | 欧美精品久久久久久久| 国产日韩欧美一区在线| 亚洲精品久久久久久一区二区| 欧美一区二区日韩| 亚洲一级一区| 欧美精品电影| 激情久久五月| 先锋影音网一区二区| 在线视频欧美日韩精品| 久久在精品线影院精品国产| 国产精品久久婷婷六月丁香| 亚洲第一中文字幕| 先锋影音一区二区三区| 亚洲香蕉成视频在线观看 | 国产欧美日韩不卡| 9久re热视频在线精品| 亚洲日韩欧美视频一区| 久久精品午夜| 国产精品久久国产精品99gif| 亚洲国产天堂久久国产91| 先锋亚洲精品| 欧美一级二区| 国产精品高潮在线| 亚洲精选在线观看| 亚洲理论在线| 免费看成人av| 一区二区在线不卡| 久久国产免费| 欧美在线日韩精品| 国产精品大片免费观看| 99re亚洲国产精品| 夜夜精品视频| 欧美片在线播放| 亚洲精品久久久久久下一站| 亚洲人成在线观看网站高清| 麻豆精品视频在线| 韩国av一区二区三区四区| 亚洲综合色激情五月| 亚洲欧美韩国| 国产精品国产三级国产aⅴ入口| 亚洲美女av黄| 在线综合+亚洲+欧美中文字幕| 欧美黄色影院| 最新中文字幕亚洲| 99亚洲伊人久久精品影院红桃| 欧美黄色一级视频| 亚洲精品一区二区三区99| 亚洲美女区一区| 欧美激情一区二区三区| 亚洲香蕉网站| 久久av红桃一区二区小说| 欧美精品久久一区二区| 亚洲国产欧美日韩另类综合| 亚洲国产精品一区二区第四页av| 久久国产主播| 国产一区二区精品久久99| 欧美在线地址| 久久这里有精品视频| 黄页网站一区| 亚洲人成在线播放| 欧美日韩国产不卡在线看| 亚洲人成绝费网站色www| 9久草视频在线视频精品| 欧美三级资源在线| 亚洲一区二区视频在线观看| 久久不见久久见免费视频1| 国产亚洲欧美aaaa| 亚洲国产日韩美| 欧美大片在线观看| 亚洲精品一区二区三区婷婷月 | 亚洲电影自拍| 欧美大片免费| 中文国产成人精品久久一| 性欧美超级视频| 国内精品久久久久久影视8 | 最近中文字幕日韩精品| 亚洲午夜精品一区二区三区他趣 | 国产午夜精品美女毛片视频| 亚洲第一在线视频| 欧美激情在线播放| 在线亚洲欧美专区二区| 欧美专区在线观看| 一区二区三区在线观看欧美| 亚洲激情在线播放| 欧美午夜精彩| 久久成人免费视频| 欧美精品性视频| 亚洲——在线| 久久综合九色综合网站| 亚洲精品一区二区三区99| 欧美在线不卡| 亚洲大胆视频| 亚洲永久视频| 一区二区三区在线高清| 亚洲图片欧美一区| 国产最新精品精品你懂的| 日韩视频在线你懂得| 国产精品女主播| 亚洲人成小说网站色在线| 欧美天堂亚洲电影院在线播放 | 久久久久国产免费免费| 亚洲激情啪啪| 久久不见久久见免费视频1| 亚洲国产一区二区三区青草影视| 亚洲欧美日韩视频二区| 精品成人国产| 亚洲欧美日韩另类| 亚洲国产精品一区| 亚洲欧美综合v| 亚洲高清中文字幕| 性欧美超级视频| 亚洲免费精品| 久热精品视频在线免费观看| 亚洲视频在线观看| 男同欧美伦乱| 午夜一区在线| 国产精品v亚洲精品v日韩精品| 亚洲激情网站免费观看| 国产日本亚洲高清| 一区二区三区日韩欧美| 国产自产在线视频一区|