Sei sulla pagina 1di 3

Hacettepe University

Computer Science and Engineering Department

Name and Surname: Barış Toker

Identity Number: 20421986

Course: BİL341

Experiment: Experiment 4

Subject: Operating Systems – PC Interrupt Handling

Data Due: 27.11.2007

Advisors: Prof. Dr. Ali Saatçic, R. A. Ersin ER

Type Definitions
typedef void interrupt(*isr_pointer) ();

Execution Flow Between Subprograms

Description Template

<-subprogram name with parameters>


1 - <what it does>,
2 - <what it returns>,
3 - <where it is called>.
4 - <what it calls>.

int main(int argc, char* argv);


1 – This is the executable function, it makes the initializations and finalizations, handles the game's
flow.
4 – It calls the functions update_idt, restore_idt.

void move_orc(Orc orc);


1 – This function is used to move orcs on the screen.
3 – It is called in timer_isr.
4 – It calls the function print_on_screen;

void move_player(Player player);


1 – This function is used to move the players on the screen.
3 – It is called in keyboard_isr();
4 – It calls the function print_on_screen;

void print_on_screen(int x_coordinate, int y_coordinate, char ch);


- contains assembly code
1 – This function is used to print a charater on the screen at the given coordinate.
3 – It is called in move_orc, move_player, timer_isr;

void update_idt();
- contains assembly code
1 – This function is used to update the keyboard and timer interrupt service routines.
3 – It is called in main.
4 – It calls the functions get_isr, set_isr.

void restore_idt();
- contains assembly code
1 – This function is used to restore the actual keyboard and timer interrupt service routines.
3 – It is called in main.
4 – It calls the functions get_isr, set_isr.

isr_pointer get_isr(int idt_index);


- contains assembly code
1 – This function is used to get a pointer to the interrupt service routine at the given IDT index.
2 – It returns a pointer to the relevatn interrupt service routine.
3 – It is called in update_idt, restore_idt.

void set_isr(int idt_index, isr_Pointer isr);


1 – This function is used to set the interrupt service routine at the given IDT index with function
pointed with isr.
3 – It is called in update_idt, restore_idt.

void interrupt keyboard_isr();


- contains assembly code
1 – This function is used to handle keyboard interrupts.
3 – It is called when a key is pressed on the keyboard.
4 – It calls the function move_player;

void interrupt timer_isr();


- contains assembly code
1 – This function is used to handle the timer interrupt. It moves the orcs at a certain frequency and
prints the time elapsed at the screen.
4 – It calls the functions move_orc, print_on_screen.

Potrebbero piacerti anche