| | |
OS dev: Procedure that ends a task.
Please support our Assembly advertiser: Programming Forums - DaniWeb Sister Site
![]() |
Hello.
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:
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:
asm Syntax (Toggle Plain Text)
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
Last edited by Alex_; Sep 29th, 2009 at 6:52 am.
Fundamental law of life:
do{ ThingsToDo+=me.CompleteTask(ThingsToDo); }while(ThingsToDo); Die(me);
Law of the Spirit:
do{ Rebuke(me); }while(!me.Repented); LiveEternal(me);
PM me to know more why i wrote this or what it means.
do{ ThingsToDo+=me.CompleteTask(ThingsToDo); }while(ThingsToDo); Die(me);
Law of the Spirit:
do{ Rebuke(me); }while(!me.Repented); LiveEternal(me);
PM me to know more why i wrote this or what it means.
It might be that the 16-bit code you have been given
pertains to when a task requests to terminate on a
single tasking operating system.
Or if it refers to multi-tasking, then it is not just an
intermediary but free's a task from a list of tasks
to execute and free's its memory, and transfers
control back to the task-scheduler.
INT 08 is called by the system clock on IBM-PCs.
I think it might be for multi-tasking.
It is possible in 16-bit assembly to multi-task applications.
pertains to when a task requests to terminate on a
single tasking operating system.
Or if it refers to multi-tasking, then it is not just an
intermediary but free's a task from a list of tasks
to execute and free's its memory, and transfers
control back to the task-scheduler.
INT 08 is called by the system clock on IBM-PCs.
I think it might be for multi-tasking.
It is possible in 16-bit assembly to multi-task applications.
Last edited by NotNull; Sep 29th, 2009 at 11:26 am.
----------------------------------------------------------
To control a mind violates a man, and all it has been used for is
hurting and afflicting. Nowonder I progam in assembly...
--->Now available http://dotcoding.netai.net/
To control a mind violates a man, and all it has been used for is
hurting and afflicting. Nowonder I progam in assembly...
--->Now available http://dotcoding.netai.net/
Assembly Syntax (Toggle Plain Text)
push cs ; if CS==DS then [firsttask] same as [cs:firsttask] pop ds lea di,[cs:firsttask] ; Offset of some array of data structures. See below mov al,[cs:numtask] ; Current task ID xor ah,ah push dx mov dx,515 ; hmmm. ID is index into 515 byte data items??? mul dx pop dx add di,ax ; It must be... Because FIRSTTASK+(ID*515) mov [Byte Ptr cs:di],255 ;clears first byte of data struct to 255 mov dx,[cs:di+3] ; retrieves the address of some of its memory. ; in DOS a data struct is made for each ; block of memory, for ex. call FreeMemory call _ei jmp int08new ; if int08 is on the same segment, if not jmp far
Same thing happens when you index into an array of
words:
Assembly Syntax (Toggle Plain Text)
lea di, [myarr] mov bx, index shl bx, 1 mov word [myarr+bx], 1234h
Last edited by NotNull; Sep 29th, 2009 at 11:44 am.
----------------------------------------------------------
To control a mind violates a man, and all it has been used for is
hurting and afflicting. Nowonder I progam in assembly...
--->Now available http://dotcoding.netai.net/
To control a mind violates a man, and all it has been used for is
hurting and afflicting. Nowonder I progam in assembly...
--->Now available http://dotcoding.netai.net/
Since its getting rid of FLAGS, CS, and IP on the stack [SP=SP+6],
I would assume this doesn't pertain to multi-tasking but
a procedure of similar function to the INT 20h DOS interrupt.
This would mean the TASK calls the procedure in order to terminate.
It looks like its just keeping information about each task in a
large contiguous array of data structures, and keeping track of
the task that was currently yeilding system resources, instead
of using a PSP (like DOS), so it doesn't need the caller's CS value.
I would assume this doesn't pertain to multi-tasking but
a procedure of similar function to the INT 20h DOS interrupt.
This would mean the TASK calls the procedure in order to terminate.
It looks like its just keeping information about each task in a
large contiguous array of data structures, and keeping track of
the task that was currently yeilding system resources, instead
of using a PSP (like DOS), so it doesn't need the caller's CS value.
Last edited by NotNull; Sep 29th, 2009 at 11:42 am.
----------------------------------------------------------
To control a mind violates a man, and all it has been used for is
hurting and afflicting. Nowonder I progam in assembly...
--->Now available http://dotcoding.netai.net/
To control a mind violates a man, and all it has been used for is
hurting and afflicting. Nowonder I progam in assembly...
--->Now available http://dotcoding.netai.net/
Thanks very much notnull. But i still don't understad how to make from all that a procedure that ends a task.
Fundamental law of life:
do{ ThingsToDo+=me.CompleteTask(ThingsToDo); }while(ThingsToDo); Die(me);
Law of the Spirit:
do{ Rebuke(me); }while(!me.Repented); LiveEternal(me);
PM me to know more why i wrote this or what it means.
do{ ThingsToDo+=me.CompleteTask(ThingsToDo); }while(ThingsToDo); Die(me);
Law of the Spirit:
do{ Rebuke(me); }while(!me.Repented); LiveEternal(me);
PM me to know more why i wrote this or what it means.
Let's see.
Does it have to be based on the code you showed?
Does it have to be a working program?
Does it have to manage multiple tasks?
If all else fails try making a program that loads a binary image
as an overlay, and set up an interrupt handler
for termination that points into your loading program.
INT 21/48-4A Memory Management
INT 21/4B03 Load Overlay
INT 21/25 SetIVT
You'll have to allocate the block of memory for the
overlay yourself.
Use a indirect far jump into the overlay, starting at whatever
offset is the entry point:
Make sure to include a call to your termination interrupt within
the overlay.
Does it have to be based on the code you showed?
Does it have to be a working program?
Does it have to manage multiple tasks?
If all else fails try making a program that loads a binary image
as an overlay, and set up an interrupt handler
for termination that points into your loading program.
INT 21/48-4A Memory Management
INT 21/4B03 Load Overlay
INT 21/25 SetIVT
You'll have to allocate the block of memory for the
overlay yourself.
Use a indirect far jump into the overlay, starting at whatever
offset is the entry point:
Assembly Syntax (Toggle Plain Text)
push es xor ax, ax push ax retf ;or push es xor ax, ax push ax mov bp, sp jmp far [bp]
the overlay.
----------------------------------------------------------
To control a mind violates a man, and all it has been used for is
hurting and afflicting. Nowonder I progam in assembly...
--->Now available http://dotcoding.netai.net/
To control a mind violates a man, and all it has been used for is
hurting and afflicting. Nowonder I progam in assembly...
--->Now available http://dotcoding.netai.net/
0
#7 Oct 29th, 2009
Uhm. I'm confused.
I actually understood my assignment wrong. So i don't have to do that anymore... I'm sorry for bothering. But i appreciate your help! Thanx
I actually understood my assignment wrong. So i don't have to do that anymore... I'm sorry for bothering. But i appreciate your help! Thanx
Fundamental law of life:
do{ ThingsToDo+=me.CompleteTask(ThingsToDo); }while(ThingsToDo); Die(me);
Law of the Spirit:
do{ Rebuke(me); }while(!me.Repented); LiveEternal(me);
PM me to know more why i wrote this or what it means.
do{ ThingsToDo+=me.CompleteTask(ThingsToDo); }while(ThingsToDo); Die(me);
Law of the Spirit:
do{ Rebuke(me); }while(!me.Repented); LiveEternal(me);
PM me to know more why i wrote this or what it means.
![]() |
Similar Threads
- Stock Levels (JSP)
- Dev-C++ - [Build Error] [main.o] Error 1 (C++)
- Program has too many procedures, what should I do? (Visual Basic 4 / 5 / 6)
- Reading a list from txt file to array... (Pascal and Delphi)
- restrict field to alpha only (MS SQL)
- Object reference not set to an instance of an object. in a setup Project in ASP.NET (ASP.NET)
- Windows 2003 Group Policy (Windows NT / 2000 / XP)
- Urgent HELP ME --- i am new to ORACLE (Oracle)
- my computer won't work after overclocking (Troubleshooting Dead Machines)
Other Threads in the Assembly Forum
- Previous Thread: passing command line parameters mips
- Next Thread: Flags used to test conditional jumps...
| Thread Tools | Search this Thread |






