flat assembler
Message board for the users of flat assembler.

Index > OS Construction > ..

Author
Thread Post new topic Reply to topic
pool



Joined: 08 Jan 2007
Posts: 97
Location: Philippines
pool
..


Last edited by pool on 17 Mar 2013, 11:42; edited 1 time in total
Post 11 Jan 2008, 05:22
View user's profile Send private message Visit poster's website Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
masking as masking bits or what?
Post 11 Jan 2008, 06:25
View user's profile Send private message Reply with quote
shoorick



Joined: 25 Feb 2005
Posts: 1605
Location: Ukraine
shoorick
interrupts?
Post 11 Jan 2008, 09:55
View user's profile Send private message Visit poster's website Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4225
Location: 2018
edfed
the mask? with jim carrey?
Post 11 Jan 2008, 11:32
View user's profile Send private message Visit poster's website Reply with quote
pool



Joined: 08 Jan 2007
Posts: 97
Location: Philippines
pool
..


Last edited by pool on 17 Mar 2013, 11:42; edited 1 time in total
Post 17 Jan 2008, 10:53
View user's profile Send private message Visit poster's website Reply with quote
dosin



Joined: 24 Aug 2007
Posts: 337
dosin
http://neworder.box.sk/news/6876

This site may help..

Code:
remap_pic:          
        mov al, 0x11           ;; INIT command
        out 0x20, al           ;; Send the INIT command to PIC1
        call io_delay          ;; Delays after IO reads
        out 0xA0, al           ;; Send the INIT command to PIC2
        call io_delay
        mov al, 0x20           ;; The start of the PIC1 interrupts
        out 0x21, al           ;; Send the port to PIC1 DATA
        call io_delay
        mov al, 0x28           ;; The start of the PIC2 interrupts
        out 0xA1, al           ;; Send the port to PIC2 DATA
        call io_delay
        mov al, 0x04           ;; Set the code for MASTER
        out 0x21, al           ;; Set PIC1 as master
        call io_delay
        mov al, 0x02           ;; Set the code for SLAVE
        out 0xA1, al
        call io_delay
        mov al, 0x01           ;; 8086 mode code
        out 0x21, al
        call io_delay
        out 0xA1, al
        call io_delay
        mov al, 0xFB           ;; This masks off all IRQs except the cascaded
        out 0x21, al
        call io_delay
        mov al, 0xFF           ;; Masks off all IRQs on PIC2
        out 0xA1, al
        call io_delay
        ret
io_delay:
        jmp $+2
        ret
    


This is from that site - follow the link and it will give you a better description of what is going on in the above code..
Post 17 Jan 2008, 18:30
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4225
Location: 2018
edfed
Code:
...
          mov esi,picmap1
          call picmap
...
picmap1:
db 20h,28h
db 0fbh,0ffh
...
picmap:
;esi = params
;params:
.pic1base=0
.pic2base=1
.pic1msk=2
.pic2msk=3
        mov al, 0x11           ;; INIT command 
        out 0x20, al           ;; Send the INIT command to PIC1 
        call .delay          ;; Delays after IO reads 
        out 0xA0, al               ;; Send the INIT command to PIC2 
        call .delay 
        mov al,[esi+pic1base] 
        out 0x21, al               ;; Send the port to PIC1 DATA 
        call .delay 
        mov al,[esi+.pic2base] 
        out 0xA1, al           ;; Send the port to PIC2 DATA 
        call .delay 
        mov al, 0x04           ;; Set the code for MASTER 
        out 0x21, al           ;; Set PIC1 as master 
        call .delay 
        mov al, 0x02           ;; Set the code for SLAVE 
        out 0xA1, al 
        call .delay 
        mov al, 0x01           ;; 8086 mode code 
        out 0x21, al 
        call .delay 
        out 0xA1, al 
        call .delay 
        mov al,[esi+.pic1msk]
        out 0x21, al 
        call .delay 
        mov al,[esi+.pic2msk]  
        out 0xA1, al 
        call .delay 
        ret 
.delay: 
        jmp $+2 
        ret
    


like it, this code become modular. and easy to configure.
Post 18 Jan 2008, 00:56
View user's profile Send private message Visit poster's website Reply with quote
zhak



Joined: 12 Apr 2005
Posts: 490
Location: Belarus
zhak
it's written that a software delay must be implemented when accessing i/o ports in the artictle at http://neworder.box.sk/news/6876. but i've read that this delay is not needed on modern PCs. so should there be any delays or not? my question corresponds to any i/o ports (keyboard, rtc, ide... etc) not only PIC ports.
Post 18 Jan 2008, 20:54
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4225
Location: 2018
edfed
delayed version need to be used, because of compativility for older PCs.
but, in some years, it will be endless.
the delay can be ignored cause of instructions beetwen two IO instructions.
Post 18 Jan 2008, 21:27
View user's profile Send private message Visit poster's website 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-2019, Tomasz Grysztar.

Powered by rwasa.