I have an assignment to make a procedure that will end a task. The manual from the university isn't quite clear about how this works. So mainly i have this problem: How does a procedure end a working task?
1) Does the bios call the procedure ? or,
2) Will my current operating system call my procedure? or,
3) I must make myself an os that boots, launches a task, and then after an amount of time calls the procedure to end the task and bail out.
I have no idea!
The manual does give some sort of code(which should be changed by me to work properly) that shows how it should look like. But once i don't understand the way it works, how can i know what to change?
The code with comments (translated by me) from the manual:
PROC newint20h ; int 20h call _di ;keeping back any interruptions so that the task may not be launched when the processor is taken away (me: what does "taken away" mean????) pop ax pop ax ;Extracting from stiva (me: I don't know the true translation of stiva. But one thing for sure: it's a FILO type memory acces) pop ax ;extracting the leftovers that are left from the execution of int 20h (we don't need the CS,IP indicators any more) (me: What int 20h? Are they talking about THIS procedure or the system's one.) push cs pop ds lea di,[cs:firsttask] ; DI = Offset of TASK mov al,[cs:numtask] ; AL = Task's ID xor ah,ah ; AX = Task's ID push dx mov dx,515 mul dx ; AX = the starting index of firsttask pop dx add di,ax ; DI = putting the top of the stiva in di ;Putting a 255 value into task's ID , marking it as non-loaded. mov [Byte Ptr cs:di],255 mov dx,[cs:di+3] call FreeMemory call _ei jmp int08new ; Freeing the memory, and beginning the execution of int 8; ENDP newint20