flat assembler
Message board for the users of flat assembler.
  
       
      Index
      > OS Construction > Help with ints | 
  
| Author | 
  | 
              
| 
                  
                   xleelz 07 Jun 2011, 17:31 
                  Well, I'm not sure if it helps but the source code to Coty's HeliumOS can be found at http://board.flatassembler.net/topic.php?t=12410
 
                  He uses kernel interrupts to print the characters 'A' and 'B' to the screen. _________________ The person you don't know is the person that could help you the most... or rape you, whichever they prefer.  | 
              |||
                  
  | 
              
| 
                  
                   me239 08 Jun 2011, 23:24 
                  Interrupts are terribly easy. Here is a sample code to simulate int 21h, function 02h. Remember, keep your interrupt vectors in a safe place in memory! Otherwise unwanted instructions could be executed and hang the machine.
 
                  
                Code: call set_interrupt *YOUR CODE ivt: pushf ; save flags cmp ah, 02h ; DOS interrupt function 02h (print character) jnz int_ret ; not our function, then leave push ax ; save AX mov al, dl ; move the character from dl to al mov ah, 0eh ; Teletype BIOS function int 10h ; print character pop ax ; restore AX int_ret: popf ; restore flags iret ; interrupt return (basically retf) set_interrupt: push es ; save ES push 0 pop es ; lets zero out es cli ; disable interrupts mov word[es:21h*4], ivt ; formula for this is "Interrupt*4 = offset" mov word[es:21h*4+2], cs ; we must put our segment after the offset sti ; enable interrupts pop es ; restore ES ret ; return to our code  | 
              |||
                  
  | 
              
| 
                  
                   BOTOKILLER 09 Jun 2011, 10:30 
                  me239 wrote: Interrupts are terribly easy. Here is a sample code to simulate int 21h, function 02h. Remember, keep your interrupt vectors in a safe place in memory! Otherwise unwanted instructions could be executed and hang the machine. I'm developing Pmode OS and Pmode IDT  | 
              |||
                  
  | 
              
| 
                  
                   me239 09 Jun 2011, 19:11 
                  BOTOKILLER wrote: 
 Code: ivt: pushf cmp ah, 02h jz int_ret push ax es push 0b800h pop es mov ah, 07h stosw pop es ax int_ret: popf iret I believe that 16 and 8 bit registers should still work in Pmode.  | 
              |||
                  
  | 
              
< Last Thread | Next Thread >  | 
    
Forum Rules: 
  | 
    
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.