flat assembler
Message board for the users of flat assembler.

Index > OS Construction > RTC 1024Hz interrupt

Author
Thread Post new topic Reply to topic
edfed



Joined: 20 Feb 2006
Posts: 4242
Location: 2018
edfed
i try to have a working irq8 (int70h), but i cannot.

maybe i am missing something like PIC mask, because i made exactlly what is intended in order to make it works, and it don't work... Sad
Code:
initialisation:
...
        mov al,0bh
        out 70h,al
        ror ax,8
        in al,71h
        ror ax,8
        out 70h,al
        ror ax,8
        or al,40h
        out 71h,al
        sti
...
    

Code:
interruption:
        cli
        push eax ecx
        inc [.cnt]

        or al,0ch
        out 70h,al
        in al,71h ;read even if don't care

        mov al,20h
        out 20h,al
        pop ecx eax
        sti
        iret
align 4
.cnt    dd 0
    


maybe this interrupt no more exist since the 80286... but every sources i've read tells the same procedure to do that.

then, there is a lack.

i just tested with all irq unmasking in initialisation code, and still don't work...
Code:
...
        mov al,1
        out 21h,al
        mov al,0h
        out 21h,al
...
    


it is driving me crazy, because this interrupt is the best feature you can find for precision timing, it can adjust the divisor rate of the PIT in order to have a really precise timer, and a lot of things that involve time (4th D) computing.
Post 06 Mar 2011, 15:30
View user's profile Send private message Visit poster's website Reply with quote
poupougne



Joined: 04 May 2007
Posts: 15
Location: Lyon, France
poupougne
Hi edfed,
IRQ8 is present on the 2nd controler : you must send EOI to 0x20 AND 0xA0 port.
STI is not required in handler : IRET will do it
For unmasking, send 0 to both 0x21 and 0xA1 port
Post 07 Mar 2011, 08:16
View user's profile Send private message Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2140
Location: Estonia
Madis731
I recommend this http://wiki.osdev.org/PIC as reference. I converted it to asm and it worked. No reinventing the wheel.
Post 07 Mar 2011, 13:32
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4242
Location: 2018
edfed
i think i will need to start from scratch as the code i've made is under fool, it can be better to just test in standalone.

i've tested the advice of poupougne, and give nothing.

madis, i will try from your link and let you know if it work
Post 07 Mar 2011, 14:25
View user's profile Send private message Visit poster's website Reply with quote
SeproMan



Joined: 11 Oct 2009
Posts: 60
Location: Belgium
SeproMan
inc [.cnt] is missing a cs: segment override.

Code:
interruption: 
        cli 
        push eax ecx 
        inc [.cnt] 

        or al,0ch 
        out 70h,al 
        in al,71h ;read even if don't care 

        mov al,20h 
        out 20h,al 
        pop ecx eax 
        sti 
        iret 
align 4 
.cnt    dd 0 
    

_________________
Real Address Mode.
Post 29 Aug 2011, 22:35
View user's profile Send private message Reply with quote
asmdev



Joined: 21 Dec 2006
Posts: 18
asmdev
Code:
or al,0ch 
out 70h,al  
in al,71h 
    

I always imagined that one should go for "mov al, 0ch"

Code:
mov al,0bh
out 70h,al
ror ax,8
in al,71h
; preserve AL here in some register

ror ax,8
out 70h,al 
or al,40h    ; <<<<<<<<< restore AL from the register (0x0b is not gonna cut)
out 71h,al 
    

you are not clearing bits [6-4], so value in these bits is unknown and may easily be not "100b". Do preserve bit 7,3,2,1,0.

Also, personally I do ACK right before "sti"
Code:
...
...
or al,40h
out 71h,al
; your ACK, same as in interrupt handler
sti 

    


Do read this file http://www.sat.dundee.ac.uk/~psc/pctim003.txt . Its alot but worth reading. Section about CMOS starts at chapter 7.

Stop using obfuscated code like "ror ax, 8" when asking for help

Also keep in mind that while inside the interrupt either "alert" or/and "update" bits can be set even if you did not request for those interrupts. For example, it can happen when "periodic" event happens at the same time as "update" event. Alsways check if "periodic" flag is set.
Post 30 Aug 2011, 01:02
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.