home *** CD-ROM | disk | FTP | other *** search
- .model large
- dosseg
- ;
- ; This is a sample for a minimal program that makes the
- ; CTask kernel resident.
- ;
- public __acrtused
- public __psp
- public _alloc_resource
- public _tsk_alloc
- public _tsk_free
- ;
- include tsk.mac
- ;
- extrn _install_tasker: far
- extrn _preempt_on: far
- extrn _set_priority: far
- extrn _schedule: far
- ;
- __acrtused equ 9876h
- ;
- NULL segment para public 'BEGDATA'
- NULL ends
- ;
- stacklen = 256
- ;
- .stack stacklen
- ;
- .data?
- ;
- _alloc_resource resource <>
- ;
- __psp dw ?
- ;
- .data
- ;
- main_name db "CTRES",0
- ;
- .code
- ;
- ; Dummy allocation routines. The memory allocation is never called
- ; by CTask if you don't explicitly request it.
- ;
- _tsk_free:
- _tsk_alloc:
- xor ax,ax
- mov dx,ax
- ret
- ;
- ; The main program.
- ; NOTE: This sample program does *not* clear uninitialized memory
- ; to zero. CTask has explicit initialization code for all
- ; of it's variables.
- ;
- main:
- mov ax,@data
- mov ds,ax
- mov __psp,es
- cld
- mov ax,es:[2ch] ; Environment pointer in PSP
- mov es,ax
- mov ah,49h ; Release environment
- int 21h
- ;
- ; install_tasker (0, 0, IFL_DISK | IFL_PRINTER | IFL_INT15);
- ;
- mov ax,offset main_name
- push ds
- push ax
- mov ax,IFL_DISK OR IFL_PRINTER OR IFL_INT15
- push ax
- xor ax,ax
- push ax
- push ax
- call _install_tasker
- add sp,4
- ;
- ; set_priority (NULL, PRI_STD);
- ;
- mov ax,PRI_STD
- push ax
- xor ax,ax
- push ax
- push ax
- call _set_priority
- add sp,6
- ;
- call _preempt_on
- call _schedule
- ;
- mov dx,offset stack ; stack end
- add dx,15 ; round up
- mov cl,4
- shr dx,cl ; convert to paragraphs
- add dx,@data ; add data start segment
- sub dx,__psp ; minus program segment
- mov ax,3100h ; TSR
- int 21h
- ;
- end main
-
-