; ; Include file for RTOS. ; ; This file should be INCLUDEd in all RTOS applications. ; It contains the macros that ease access to the RTOS itself. ; external os_define, os_run, os_exit, os_cancel external os_wait, os_init, os_priority ; ; This routine must be called before any other RTOS ; call is made. ; ; rt_init (no arguments) ; rt_init macro call os_init endm ; ; rt_define - Make a task known to the operating system ; ; rt_define must be called before any other commands are issued ; for the task. ; ; rt_define start, stack, bbr, priority, number ; start = start address ; stack = top of stack for this task ; bbr = task's bank ; priority= task's initial priority ; number = task number (1 to NUMTSK-1) ; rt_define macro start,stack,bbr,priority,number ld hl,start ; set start address ld de,stack ; set top of stack ld bc,priority*256+bbr ; set priority and bank ld a,number ; task number call os_define endm ; ; rt_run - Put a task in the READY state. ; ; rt_run number,rsi ; number = task number ; rsi = reschedule interval ; rt_run macro number,rsi ld de,rsi ; set reschedule interval ld a,number ; set task number call os_run endm ; ; rt_exit - Exit the current task ; ; rt_exit (no arguments) ; rt_exit macro jp os_exit endm ; ; rt_priority - Set the current task's priority ; ; rt_priority priority ; priority= task's new priority (1 to 63) ; rt_priority macro priority ld b,priority call os_priority endm ; ; rt_cancel - Cancel a task ; ; rt_cancel number ; number = task number (0 to NUMTSK-1) ; rt_cancel macro number ld a,number ; set task number call os_cancel endm ; ; rt_wait - Put the current task into a WAITING state ; ; rt_wait count ; count = number of tics to wait (1 to 32767) ; rt_wait macro count ld de,count ; set count call os_wait endm