Changes

Jump to: navigation, search

Caruh

4,164 bytes added, 16:16, 1 November 2023
/* Task conventions: Requirements for Tasks */
The Task now knows that it has been saved successfully. The Task now needs to reset the 'Secured Bit' and jump to address &4000.
Tasks saved by the Caruh system are loaded (like any other) to address &4000 and also started there.
 
= OS functions for Tasks =
The Tasker Caruh provides several additional OS functions for Tasks.
Furthermore, certain parameters can be queried from RAM variables.
Please refer to the chapter on Task variables above.
 
 
=== Caruh's GUI and OS functions ===
Both screen mode and screen format can be set by the user in Caruh.
This is done using options.
These settings can be read from the following RAM variables:
 
* Memory address &000E contains the screen mode (0-3) which was set by the user. Each task can read the desired screen mode from this byte if the Task is switched to the Foreground.
 
* Memory address &000F contains the screen format (0 for 80x25, 1 for 68x30 and 3 for 64x32 format) that was set by the user. Each Task can read the desired screen format from this byte if the Task is switched to the Foreground.
 
* MENU SYSTEM
The 'M_DISP2' menu system known from CBM can be called up with the 'RST 1' command. For parameter transfer see source code. #######
 
* DRAW WINDOW
The 'DR_WIN' window drawer known from CBM can be called with 'CALL &000B'. To call DR_WIN:
 
HL = Pointer to start of Parameter- and Text-Block
 
 
Such a data block looks like this:
 
DB LOCATE_YY ;Upmost line
 
DB LOCATE_XX ;Leftmost row
 
 
DB LINES ;Number of lines in Window-Frame
 
DB ROWS ;Number of rows / columns
 
 
DB "Sample text",&00 ;Text of first line, terminated by byte &00
 
 
Now the text of the following lines may follow here...
 
Every line must be terminated by an &00 byte
 
A text line can use control codes for screen MODE 2
 
As for example the locate control code (80x25 format):
 
DB &1F,YY,XX,"Text sample",&00
 
 
 
ATTENTION: DR_WIN at &000B will switch the Interrupts OFF. The calling Task must switch them on again by itself.
 
 
* REQUEST SQUARE ON COMMON SCREEN SOMEWHERE
Calling the 'SAOMS' function at address &0003 allows the user to reserve a piece of the general multi-screen (regular view).
This OS function must be called by a Task.
 
 
To call this function:
 
Task number in TTNS3 = &BE03 (A Task can read its number from address TNUME = &7FFD)
 
YL = Total number of rows of area to be reserved (width, MODE 2 chars)
 
YH = Total number of lines of the area to be reserved (height)
 
 
Return from function: First you need to take a look at the Z-Flag, then see for data in XL and XH.
 
Z-Flag set '1' -> User Break using ESC key! Do not use values in IX!
 
Z-Flag cleared -> All fine! -> See registers XL and XH: XL = Upmost line / Y position of frame (0-24). XH = Leftmost raw / X position of Frame (0-79)
 
 
* REQUEST DEFINED SQUARE ON COMMON SCREEN ON DEFINED POSITION
 
If the 'RFMSA' function is called using the 'CALL &0013' command at address &0013, a Task can use it to reserve a part of the shared screen. The parameters are required as follows:
 
XL = Upmost line / Y position of frame (0-24)
 
XH = Leftmost raw / X position of Frame (0-79)
 
YL = Total Rows of Frame (1-80)
 
YH = Total Lines of Frame (1-25)
 
Address (TTNS3 = &BE03) = Number of requesting the Task
 
 
Return from function: When returning, the zero flag provides information about the success:
 
Z-Flag cleared -> Areas overlapping! Area can NOT be used!
 
Z flag set '1' -> Requested area CAN be used!
 
 
* SET PRIORITY OF A TASK
If the function 'SEPRI' is called using the Z80 command 'RST 2' at address &0010, a Task can change its priority (new priority in A).
Each task is started with the highest priority '1' after loading.
Often, however, a Task does not have to be called up that often (e.g. display time or temperature, send data to the printer, etc.). In such a case, the priority can be reduced.
The new priority is transferred in the accumulator; values from 1 to 255 are permissible. Smaller values have higher priority.
 
 
* If a task currently has nothing to do, it can actively switch to the next Task. This is done using the commands:
 
DI ;Disable interrupts (command before each 'RST 7' necessary!)
 
RST 7 ;Call up the Task Manager or the next Task
 
 
* Testing the content of address &7FFB on &7x allows integrity tests. Since the E-RAM status (high byte) is read here, the upper nibble must be '7'. If it's not equal to '7', the task E-RAM has been corrupted!
1,988
edits