Assembly 如何传输系统时间';s整数月到字符串月通过汇编8086?

Assembly 如何传输系统时间';s整数月到字符串月通过汇编8086?,assembly,x86-16,Assembly,X86 16,所以我的代码是用汇编8086编写的,它要求系统的当前时间, (小时、分钟、秒、日、月和年)但我不想预览当前的5月份(即数字“5”),而是想将月份输出为字符串,从中 当前日期:2014年11月5日至当前日期:2014年5月11日?我应该使用循环吗 name "datefile" org 100h TAB EQU 9 ; ASCII CODE mov ah, 2ah ; get date int 21h xlat mov week, al

所以我的代码是用汇编8086编写的,它要求系统的当前时间, (小时、分钟、秒、日、月和年)但我不想预览当前的5月份(即数字“5”),而是想将月份输出为字符串,从中 当前日期:2014年11月5日至当前日期:2014年5月11日?我应该使用循环吗

name "datefile"

org 100h  

TAB EQU 9   ; ASCII CODE

mov ah, 2ah                  ; get date 
int 21h 
xlat

mov week, al                 ; 0=sunday  
add cx, 0f830h               ; for years 
mov ax, cx 
call deci 

mov year, ax 
mov al, dh                   ; month 
call deci

mov mont, ax 
mov al, dl                   ; day 
call deci 
mov day, ax 


mov ah, 2ch                  ; get time 
int 21h 
mov al, ch                   ; hour 
call deci

mov hour, ax 
mov al, cl                   ; minute 
call deci

mov minu, ax 
mov al, dh                   ; second 
call deci

mov seco, ax 


mov ah, TAB 
mov dx, offset txt 
int 21h 


mov ax, 4200h 
xor cx, cx                   ; begin byte 0 
xor dx, dx                   ;  
int 21h 
jb error 




mov ah, 3eh                 ; close file.
int 21h 



; wait for any key press:
mov ah, 0
int 16h

error:                       ; leave program (unconditionally). 
mov ax, 4c00h
int 21h


deci:                        ; calculate in decimal 
push cx
xor ah, ah 
mov cl, 10 
div cl 
add ax, 3030h
pop cx
ret 



; here's data to display the date and time 

txt  db 0Dh, 0Ah, 0Ah, TAB, TAB          ; jump line and go two tabs right 
dat  db "date: "
week db 0, TAB                           ; put the day 1=monday   9 jump a colon (tab)
     db "20"
year db 0, 0, '-'        
mont db 0, 0, '-'
     ;db 0Ax, 

day  db 0, 0, TAB  


hour db 0, 0, ':'       
minu db 0, 0, ':' 
seco db 0, 0, ' '
     db 0Dh, 0Ah, 24h         ; line feed   return   and  stop symbol 24h=$ (ASCII). 

January:
    mov ax, OFFSET mont
    mov dh, ax                ; put month to 16 bit reg
    db "1 - January" 

您必须在.data部分中创建12个字符串,然后使用这些值进行cmp。比如说

cmp al,1 
je label 

label:
    mov ah,09h
    mov dx,offset january 
    int 21h .
我想这很容易。
这取决于您如何创建逻辑并实现它

使用常量数组而不是循环

Jan db "January$"
Feb db "January$"
...
Dec db "December$"

Months dw offset Jan
    dw offset Feb
    ...
    dw offset Dec
然后使用月数选择正确的月份

;Assuming SI contains zero-based month number
mov dx,  [Months+2*si] ;DX has now the offset of the month name

只是一个问题,我如何比较10以上的值?