Kernel Routines: (v0.07)
========================

Note: This is obsolete. Starting with v0.08 (?) this file will
      be generated automatically from the source code.
      (the used tool is "devel_utils/relate.c")


addtask
   <- X/Y=address of code to execute
   <- A=periority (1-7)
   -> c=1 : try again (out of slots / out of memory)
   
   changed: AXY, tmpzp: 0 1 2 3 4 5
   
   add a task (=process) to the systems scheduling table
   
printk
   <- A=char
   -> 
   
   changed: , tmpzp: 0 1
   
   print character to console (for system messages and debugging)
   
delay_50us
   <- 
   -> A=0, X=0
   
   changed: AX
   
   pause for at least (!) 50us
   
catcherr
   <- A=error number
   -> c=1
   
   changed: XY
   
   Used to return with error. Yet simply sets carry flag and returns.
   
suicerrout
   <- A=error number
   -> (doesn't return)
   
   changed: (doesn't return)
   
   print standard error message (including the type of error) and then
   commit suicied with nonzero exitcode
   
suicide
   <- A=exitcode
   -> (doesn't return)
      
   changed: (doesn't return)
   
   commint suicide with specified exitcode.
   
print_error
   <- A=error number
   -> 
   
   changed: X, tmpzp: 0 1
   
   print standard system error message (including the type of error) to console
   
hexout
   <- A=number
   -> 
   
   changed: AX, tmpzp: 0 1
   
   print hexadecimal number to console
   
hook_irq
   <- X/Y=address of handler
   -> c=error, A=number of semaphore semaphore that is used
   
   changed: AXY, tmpzp: 0 1 4 5
   
   add a IRQ-handler to the system IRQ-handler chain (up to 3 IRQ-handler)
   to deinstall the handler call unlock with the semaphore hook_irq returned.
   
hook_alert
   <- X/Y=address of handler
   -> c=error
   
   changed: AXY, tmpzp: 0 1 4 5
   
   install an alert handler (altert is generated by real time clock of CIA1)
   
hook_nmi
   <- X/Y=pointer to strukture:  jmp  nmi_handler
                                 jmp  nmi_disable
                                 jmp  nmi_enable
   -> c=error (try again)
   
   changed: AXY, tmpzp 0 1 4 5
   
   install nmi-handler (and maybe anable NMI)
   some time critical operations may want to disable NMI, this is done by a
   call to disable_nmi (disable_nmi then calls the nmi_disbale routine included
   in the strukture that has been passed to hook_nmi)
   
disable_nmi
   <- 
   -> 
   
   changed: AXY, tmpzp (unknown, maybe all)
   
   disable NMI. (when entering time critical code sections)
   
enable_nmi
   <-
   ->
   
   changed: AXY, tmpzp (unknown, maybe all)
   
   enable NMI, (when leaving time critical code sections)
   
mpalloc
   <- A=number of pages to allocate
      X=page usage code / flags
      Y=mode (bit7 = no I/O area)
   -> c=0: X=start page
      c=1: out of memory (try again)
      
   changed: AXY, tmpzp: 0 1 2 3 4 5
   
   allocate n concurrent pages of internal RAM
   
spalloc
   <- X=page usage code / flags
      Y=mode (bit7 = no I/O area)
   -> c=0: X=start page
      c=1: out of memory (try again)
      
   changed: AXY, tmpzp: 0 1

   allocate a single page of internal RAM
      
pfree
   <- X=start page
   ->
   
   changed: AXY
   
   de-allocate internal RAM allocated with mpalloc or spalloc
   
lock
   <- X=number of semaphore
      c=0: non blocking
      
   -> c=error (if non blocking)
   
   changed: AXY, tmpzp: 4 5
   
   lock resource
   
unlock
   <- X=number of semaphore
   -> c=error
   
   changed: AXY, tmpzp: 4 5
   
   unlock resource   
      
panic
   <-
   -> (doesn't return)
   
   changed: (doesn't return)
   
   prints "kernel panic" and stops (endless loop)
   
p_remove
   <- X=IPID
   -> 
   
   changed: AY
   
   remove task from CPU-queue
   
p_insert
   <- X=IPID
   ->
   
   changed: AY
   
   add task to CPU-queue
   
sendsignal
   <- A/Y=PID of destination process
      X=number of signal (0..7 or 9)
   -> c=0: A=$00: signal sent
      c=0: A=$ff: signal not sent (try again)
      
   changed: AXY, tmpzp: 0 1 4
   
   send signal to a process (maybe the current process)
   
_raw_sendsignal
   <- tmpzp+4=number of signal (must be valid!)
      X=IPID
   ->
   
   changed: AXY, tmpzp: 0 1

signal
   <- X=number of signal
      A/Y=address of handler (Y=0 de-installs handler)
   -> c=error
   
   changed: Y
   
   install a signal handler
   
sleep
   <- X/Y=sleep time in jiffies (1/64s)
   ->
   
   changed: AXY, tmpzp: 0 1 2 3 4 5
   
   suspend current process for AT LEAST n jiffies
   
block, suspend
   <- A=wait code 0 (waitc_...)
      X=wait code 1 (additional parameter)
   ->
   
   changed: AXY, tmpzp: (all)
   
set_zpsize
   <- A=new zeropage size
   -> c=error
   
   changed: Y
   
   change number of available zeropage bytes (beginning with userzp)
   (only the registered pages will be reserved accross taskswitches)
   
mun_block
  <- A=wait code 0
     X=wait code 1
  -> 
  
  changed: AXY, tmpzp: 0 1 2 3 4
  
  un-block (un-suspend) all processes with a given wait-state
  
wait
   <- X/Y=pointer to 7 usable bytes (for PID and TIME)
      c=0: non blocking
      c=1: blocking
   -> c=0: A=exitcode (and struct valid)
      c=1: try again
   
   changed: AXY, tmpzp: (all)
   
   wait for a child to terminate and get exitcode + CPU time spent
   
getipid
   <- A/Y=PID
   -> X=IPID
      c=error
      
   changed: AXY, tmpzp: 0 1 2 3
   
   get internal process number (IPID) from PID
   
force_taskswitch
   <- 
   ->
   
   changed: ,tmpzp: (all)
   
   force a taskswitch
   
locktsw
   <- 
   ->
   
   changed: 
   
   lock taskswitches without disabling IRQ
   
unlocktsw
   <-
   ->
   
   changed: A, tmpzp: (all)
   
   unlock taskswitches  (if locked by locktsw)
   
   
