D
D
DVoropaev2019-01-31 14:54:59
DOS
DVoropaev, 2019-01-31 14:54:59

Why doesn't the int 1ah interrupt fire?

The task is to write a resident program for DOS (TASM)
in the program to set up an int 1ah interrupt so that it works a minute after starting, I did this:

;1 вариант
mov ah,02h
int 1Ah
inc cl
mov ah,06h
int 1Ah;

We get the current time, add one to the minutes and set the alarm (cases where 59 minutes can be ignored).
However, the interrupt does not work. But if the response time is specified directly in the code, then everything works.
;2 вариант 
mov ch,00h
mov cl,01h
mov dh,0;
mov ah,06h
int 1Ah;

Full code
.model tiny
.code
org 100h 
.386
start:jmp load
;tt

ASCIInullcolumn db 30h
outchar db ?
cursor db ?
mov cursor, 0
mode db ?
doubledot db 3Ah
old dd 0
;proces
setMode proc near

  mov ah, 0Fh
  int 10h
  mov mode,al
  mov ah,00h
  mov al,3
  int 10h

  ret
setMode endp

setCursor proc 
pusha
  ;set cursor
  mov ah, 02h
  mov bh,0
  mov dh,0
  mov dl,cursor;êîëóìí
  int 10h
popa
ret
setCursor endp

showChar proc 
  pusha

    mov ah,0Ah
    mov al, outchar
    mov bh,0
    mov cx,1
    int 10h

  popa
  ret
  showChar endp

showTime proc 
pusha

mov cursor,0
  
  call setMode

  call setCursor

  mov ah,02h
  int 1ah
  ;dh - ñåêóíäû
  ;ch - ÷àñû
  ;cl - ìèíóòû
  push dx
  push cx
  

  mov bl, 10h;äåëèòåëü
  mov al, ch;äåëèìîå
  mov ah,0
  div bl
  ;push ax 
  ;mov al,ah
  add al, ASCIInullcolumn
  add ah, ASCIInullcolumn

  mov outchar,al
  call showChar
  add cursor,1
  call setCursor
  mov outchar,ah
  call showChar

  
  mov outchar, 3Ah
  inc cursor
  call setCursor
  call showChar

  inc cursor
  call setCursor

  
  pop ax

  mov ah, 0h 
  mov bl,10h
  div bl
  add al, ASCIInullcolumn
  add ah, ASCIInullcolumn
  mov outchar,al
  call showChar
  add cursor,1
  call setCursor
  mov outchar,ah
  call showChar

  mov outchar, 3Ah
  inc cursor
  call setCursor
  call showChar
  inc cursor
  call setCursor

  mov al,dh

  mov ah, 0h 
  mov bl,10h
  div bl
  add al, ASCIInullcolumn
  add ah, ASCIInullcolumn
  mov outchar,al
  call showChar
  add cursor,1
  call setCursor
  mov outchar,ah
  call showChar

  popa
  ret
showTime endp



handler:
handler proc near
pushf                            	
    call    cs:old                   
    push    ds                       
    push    es
    push    ax
    push    bx
    push    cx
    push    dx
    push    di
    push    cs
    pop     ds


    call showTime

    pop     di   
    pop     dx
    pop     cx
    pop     bx
    pop     ax
    pop     es
    pop     ds


iret   

handler endp
end_handler:




;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;load;;;;;;;;;;;;;;;;;;;;

load:mov ax, 354Ah;35 - number of function, 4A - number of interrupt
int 21h

;1 вариант
mov ah,02h
int 1Ah
inc cl,01h
mov ah,06h
int 1Ah;

;2 вариант 
;mov ch,00h
;mov cl,01h
;mov dh,0;
;mov ah,06h
;int 1Ah;


mov word ptr old, bx
mov word ptr old+2,es
mov ax,254Ah
mov dx,offset handler
int 21h
mov ax,3100h
mov dx,(end_handler-start+10Fh)/16
int 21h



ret
end start

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jcmvbkbc, 2019-01-31
@DVoropaev

;1 вариант
mov ah,02h
int 1Ah
inc cl
mov ah,06h
int 1Ah;

We get the current time, add one to the minutes and set the alarm (cases where 59 minutes can be ignored)

Time from int 1Ah is returned to BCD. To increase the minutes counter by 1 inc clis not enough, you need mov al, cl ; inc al ; daa ; mov cl, al.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question