i have problems with configuring the rtc (bochs 2.6.11). I thought i may be doing something that causes problems when working with the rtc, so to eliminate every possible conflict, i just have a bare minimum bootable code, that sets the interrupt and should enable the rtc periodic interrupt (according to https://wiki.osdev.org/RTC and https://www.compuphase.com/int70.txt).
The entire code is listed below.
Code: Select all
bits 16
org 0x7c00
jmp start
;--------------------------------------------------------------------------------------
;--------------------------------------------------------------------------------------
; Loader
;--------------------------------------------------------------------------------------
start:
cli
mov ax, 0x0000
mov ds, ax
mov es, ax
mov ax, 0x1000
mov ss, ax
xor sp, sp
; Set up ivt for 0x70 -> RTC
push ds
mov dx, 0x0000
mov ds, dx
; each ivt entry is 32 bit long [offset][segment]
mov cl, 4
mov ah, 0
mov al, 0x70
mul cl
mov si, ax
mov [ds:si], word interrupt_called
mov [ds:si + 2], cs
pop ds
; Test rtc
xchg bx, bx
cli
; Turn on irq 8
mov al, 0x8b
out 0x70, al ; select register b and disable NMI
in al, 0x71 ; read current content of register b
mov ah, al
mov al, 0x8b
out 0x70, al ; reset register b
or ah, 0x40
mov al, ah
out 0x71, al ; Enable periodic interrupt
; read register c to allow for new interrupts
mov al, 0x0c
out 0x70, al
in al, 0x71
; Also set to register d according to https://www.compuphase.com/int70.txt
mov al, 0x0d
out 0x70, al
in al, 0x71
sti
.wait_for_int:
nop
jmp .wait_for_int
;--------------------------------------------------------------------------------------
interrupt_called:
xchg bx, bx
iret
;--------------------------------------------------------------------------------------
; Boot-Magic
;--------------------------------------------------------------------------------------
times 510-($-$$) nop
db 0x55
db 0xaa
;--------------------------------------------------------------------------------------