@DVoropaev
Ставлю + к карме на хабре за ответы на вопросы

Почему не срабатывает прерывание int 1ah?

Задача состоит в написании резидентной программы для DOS (TASM)
в программе настроить прерывание int 1ah, чтобы оно сработало спустя минуту после запуска, я сделал вот так:
;1 вариант
mov ah,02h
int 1Ah
inc cl
mov ah,06h
int 1Ah;

Мы получаем текущее время, прибавляем к минутам единицу и настраиваем будильник (случаи, когда 59 минут можно не рассматривать)

Однако прерывание не срабатывает. Но если время срабатывания указывать непосредственно в коде, то все работает
;2 вариант 
mov ch,00h
mov cl,01h
mov dh,0;
mov ah,06h
int 1Ah;


Полный код
.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

  • Вопрос задан
  • 321 просмотр
Решения вопроса 1
jcmvbkbc
@jcmvbkbc
"I'm here to consult you" © Dogbert
;1 вариант
mov ah,02h
int 1Ah
inc cl
mov ah,06h
int 1Ah;


Мы получаем текущее время, прибавляем к минутам единицу и настраиваем будильник (случаи, когда 59 минут можно не рассматривать)

Время из int 1Ah возвращается в BCD. Чтобы увеличить счётчик минут на 1 inc cl недостаточно, нужно mov al, cl ; inc al ; daa ; mov cl, al.
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы