Tuesday, July 28, 2009

Assembler: I'm trying to use the Periodic Interrupt on the Real Time clock, what is wrong with my code?

Here is my code, written for the NASM assembler, with comments: (it probably won't look good on Yahoo! Answers, copy it into notepad/edit/other fixedwidth editor for the comments to align etc.)





[BITS 16]


org 0x0100





jmp start ; Jump to the start.





interrupt: ; interrupt to be called by the RTC





push ax ; push ax and


push dx ; dx onto stack


mov al,0x0c ; 0x0c into al to read the


out 0x70,al ; Status Register C in the RTC


in al,0x71 ; to reset it for the next interrupt


mov ah,0x02 ; DOS function 0x02 - write character


mov dl,0x41 ; "A"


int 0x21 ; DOS interrupt


pop dx ; pop dx and ax


pop ax ; back to their original values


iret ; return





start: ; Start of the main code





mov al,0x0b ; Select Status Register B


out 0x70,al


in al,0x71 ; Get the value


and al,10111111b ; Disable the Periodic Interrupt


out 0x71,al





mov al,0x0a ; Select Status Register A

Assembler: I'm trying to use the Periodic Interrupt on the Real Time clock, what is wrong with my code?
What happens when you run it? No output at all?

silk flowers

No comments:

Post a Comment