+ Reply to Thread
Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 38
Like Tree1Likes

Thread: On The Theory of Interrupts

  1. #21
    Wire Sofaking Fizyk's Avatar
    Join Date
    Jun 2008
    Location
    Łomianki, Poland
    Posts
    740
    Blog Entries
    1

    Default Re: On The Theory of Interrupts

    This code uses the old way of using interrupts, which, according to BP, should work, but there is a new, better way.
    Essentially, with the old way, you did "stp", and set up the IDT, which looked like [offset,32,offset,32,...]. Now you use "stef" and the IDT is [offset,segment,0,32,offset,segment,0,32,...].

    My programs: BIOS - Alcyone - Calculator - Notepad - Movie Player
    My tutorials: applyTorque - Quaternions - PID controllers
    Some other things I made: FT Chip - RK4 Solar System

  2. #22
    Wire Sofaking -=Fox=-'s Avatar
    Join Date
    Feb 2007
    Location
    Somewhere in my Mind...
    Posts
    1,846
    Blog Entries
    7

    Default Re: On The Theory of Interrupts

    Quote Originally Posted by Fizyk View Post
    This code uses the old way of using interrupts, which, according to BP, should work, but there is a new, better way.
    Essentially, with the old way, you did "stp", and set up the IDT, which looked like [offset,32,offset,32,...]. Now you use "stef" and the IDT is [offset,segment,0,32,offset,segment,0,32,...].
    Woah.... so how do you do that in code? Do you have to put the CPU in protected mode? If I can have a code example I could get a better grasp of it :lol:
    http://tiny.cc/OMFGWTFBBQ

    Best People On Wiremod!

    Black Phoenix, Azrael, Jat Goodwin, Magos Mechanicus, ITSBTH, Fizyk, g33v3s,tuusita, InfectiousFight, ief015

    Pointless things that are pointless, are pointlessly pointless, therefore pointlessness is pointless.
    So pointlessly pointing out the pointlessness of this pointless signature is utterly pointless.
    My IQ is 123

  3. #23
    Wire Sofaking Fizyk's Avatar
    Join Date
    Jun 2008
    Location
    Łomianki, Poland
    Posts
    740
    Blog Entries
    1

    Default Re: On The Theory of Interrupts

    I took the code from Hitman's post and modified it to work with the new interrupts:

    Code:
    stef
    jmp Init
    Interrupt_Table:
      alloc  1024      //now it's 4 bytes for each interrupt
    Init:
      sti
      lidtr  Interrupt_Table
      mov  ebx,Interrupt_Table
      add  ebx,128   //the same - 4 bytes, so 32*4
      mov  #ebx,Int_Start
      inc  ebx
      mov #ebx,0  //now we have to put the segment too - usually it will be 0, unless you mess with segments in a more advanced way
      inc ebx
      mov #ebx,0  //not really needed, as alloc initializes memory with 0's, but I put it here to show the idea
      inc ebx
      mov  #ebx,32  //the last byte, 32 indicates that the interrupt is present
      jmp  Idler
    Int_Start:
      cli
      out  0,1337
      nmiret
    
    Idler:
      add eax,0.001
      out 0,eax
    jmp Idler
    Actually, as I look at it now, I don't see what is its point. After initializing interrupts, it jumps to the part that increases value of port 0 by 0.001 each execution. Only when you input 32 to the NMI input of the CPU, it would output 1337 for a while, but it will be quickly overwritten by the increasing eax in the "Idler" part.

    My programs: BIOS - Alcyone - Calculator - Notepad - Movie Player
    My tutorials: applyTorque - Quaternions - PID controllers
    Some other things I made: FT Chip - RK4 Solar System

  4. #24
    Wire Sofaking -=Fox=-'s Avatar
    Join Date
    Feb 2007
    Location
    Somewhere in my Mind...
    Posts
    1,846
    Blog Entries
    7

    Default Re: On The Theory of Interrupts

    That's exactly what the problem was with the origional code. It would increment the number, and when you pressed the button it would interrupt but only once, then wouldn't interrupt again.

    I'll give it a shot and see what I get!
    http://tiny.cc/OMFGWTFBBQ

    Best People On Wiremod!

    Black Phoenix, Azrael, Jat Goodwin, Magos Mechanicus, ITSBTH, Fizyk, g33v3s,tuusita, InfectiousFight, ief015

    Pointless things that are pointless, are pointlessly pointless, therefore pointlessness is pointless.
    So pointlessly pointing out the pointlessness of this pointless signature is utterly pointless.
    My IQ is 123

  5. #25
    Wire Sofaking Fizyk's Avatar
    Join Date
    Jun 2008
    Location
    Łomianki, Poland
    Posts
    740
    Blog Entries
    1

    Default Re: On The Theory of Interrupts

    It won't interrupt again, because the first thing the interrupt routine does is... disable the interrupts (cli). So after interrupting once, the interrupts are disabled and you won't be able to trigger the NMI any more.

    My programs: BIOS - Alcyone - Calculator - Notepad - Movie Player
    My tutorials: applyTorque - Quaternions - PID controllers
    Some other things I made: FT Chip - RK4 Solar System

  6. #26
    GMech Developer InfectiousFight's Avatar
    Join Date
    Jun 2007
    Location
    Houston, TX
    Posts
    537

    Default Re: On The Theory of Interrupts

    So...lemme summarize this and see if I have it right...the interrupt table is now 1,024 bytes in size, and each interrupt has 4 spaces associated with it. The first space specifies the address of the code that is to be executed when the interrupt is called. Second is...a segment offset? If I'm correct? And what are the official purposes of the third and fourth ones? I saw that the last one always had a 32 in there but I remember seeing SOMEwhere on this site that you could also specify an 8 or a 16 for different purposes. What is the REASON that there is a 32 there?

  7. #27
    That furred thing Black Phoenix's Avatar
    Join Date
    Feb 2007
    Location
    Kyiv, Ukraine
    Posts
    3,565

    Default Re: On The Theory of Interrupts

    Byte 0: IP that will be set when interrupt occurs (entrypoint, where to jump)
    Byte 1: CS that will be set when interrupt occurs (offset of executed code, code segment)
    Byte 2: Reserved, must be zero
    Byte 3: Flags

    Flags are following (bit numbers):
    Code:
    3  [8 ] = CMPR shows if interrupt occured (CMPR will be set to 1 if this interrupt exists, and to -1 if this interrupt does not exist)
    4  [16] = Interrupt does not set CS (code segment wont be set)
    5  [32] = Interrupt enabled
    6  [64] = NMI interrupt (is this NMI interrupt?)
    I'm a wire-crazy person with a tail.

    Take a daily journey into my brain

    D2K5

  8. #28
    GMech Developer InfectiousFight's Avatar
    Join Date
    Jun 2007
    Location
    Houston, TX
    Posts
    537

    Default Re: On The Theory of Interrupts

    What if you wanted to use more than one? What if you wanted an NMI interrupt where the Code Segment wouldn't apply?

  9. #29
    That furred thing Black Phoenix's Avatar
    Join Date
    Feb 2007
    Location
    Kyiv, Ukraine
    Posts
    3,565

    Default Re: On The Theory of Interrupts

    Quote Originally Posted by InfectiousFight View Post
    What if you wanted to use more than one? What if you wanted an NMI interrupt where the Code Segment wouldn't apply?
    They are flags. If you want NMI interrupt that doesn't set CS you just use "80" (64 + 16, bits 4 and 6)
    I'm a wire-crazy person with a tail.

    Take a daily journey into my brain

    D2K5

  10. #30
    GMech Developer InfectiousFight's Avatar
    Join Date
    Jun 2007
    Location
    Houston, TX
    Posts
    537

    Default Re: On The Theory of Interrupts

    Ahhhhhhhhhhhhh, I get it now...thanks!

+ Reply to Thread
Page 3 of 4 FirstFirst 1234 LastLast

Similar Threads

  1. Interrupts (like unicorns)
    By InfectiousFight in forum Installation and Malfunctions Support
    Replies: 3
    Last Post: 12-03-2008, 09:47 AM
  2. All about Interrupts - because you wanted it...
    By dnifan in forum CPU, GPU, and Hi-speed Discussion & Help
    Replies: 4
    Last Post: 10-06-2008, 12:36 PM
  3. Conspiracy Theory: OMG REAL GMAN!?!?!?
    By turck3 in forum Wiremod General Chat
    Replies: 7
    Last Post: 05-13-2008, 06:12 PM
  4. theory
    By Admung in forum Installation and Malfunctions Support
    Replies: 1
    Last Post: 02-19-2008, 08:49 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
proceed-collector
proceed-collector
proceed-collector
proceed-collector
linguistic-parrots
linguistic-parrots
linguistic-parrots
linguistic-parrots