Text and fonts ------------------------------------------------------------------ 1-201 Function Name: PutChar Purpose: Displays a character on the screen. Call address: $C145 Input requirements: A The character to be printed. $02-$03 R0 Pointer to extra data (Used by a few control characters, not needed otherwise). $05 R1H The row for printing (1 above the underline). $18-$19 R11 The column to start printing. $33 windowTop: The top margin (Usually 0). $34 windowBottom: The bottom margin (Usually 199). $35-$36 leftMargin: The left margin. $37-$38 rightMargin: The right margin. Preparatory routines: UseSystemFont or LoadCharSet Errors: Branches through $84AB-$84AC (StringFaultVec) if right margin is exceeded. Description: This routine displays a character in a given location in the current font and style. The style byte in location $2E (currentMode) is coded as follows: Bit Description 7 Underline 6 Boldface 5 Reversed 4 Italics 3 Outlined Either UseSystemFont or LoadCharSet must be called prior to using this routine, in order to set up the font pointers. UseSystemFont is called during GEOS's bootup procedure, as well as by the menu processor. Several control characters have special properties. Those which require a data pointer are marked with an asterisk. Control Character Table Ctrl-H Delete previous character. STA char width in realSize ($8807) first Ctrl-I Tab. Ctrl-J Move straight down a line. Ctrl-K Set text cursor to 0,0. Ctrl-L Move straight up a line. Ctrl-M Move to the beginning of the next line. Ctrl-N Turn on underlining. Ctrl-O Turn off underlining. * Ctrl-P Followed by a table suitable for GraphicsString. Ctrl-R Turn on reverse video. Ctrl-S Turn off reverse video. * Ctrl-T Followed by 2 bytes which specify the new column. * Ctrl-U Followed by a byte which specifies the new row. * Ctrl-V Followed by 3 bytes which specify the new print position. * Ctrl-W Skips the next 3 bytes. Ctrl-X Turn on Boldface. Ctrl-Y Turn on Italics. Ctrl-Z Turn on Outline. Ctrl- Turn off all effects, return to plain text. Those entries marked with an asterisk (*) should only be used from PutString because they require $02-$03 R0 to be a pointer to get extra data. As with GraphicsString, Ctrl-P must be the last command because the zero byte that terminates GraphicsString will terminate PutString. 1-202 Function Name: SmallPutChar Purpose: Draws a character. Call address: $C202 Input requirements: A The ASCII value of the character. $05 R1H Row to print on (1 above the underline). $18-$19 R11 Column to print in. $33 windowTop: The top margin (Usually 0). $34 windowBottom: The bottom margin (Usually 199). Description: This routine is not exactly the same as PutChar. This routine does not process control characters at all. It also does not check left and right margins at all. It only checks top and bottom margins so that it stays on screen. 1-203 Function Name: PutDecimal Purpose: Display an unsigned 16 bit integer. Call address: $C184 Input requirements: A Control value (See description). $02-$03 R0 The value to be displayed. Description: This routine converts the value at $02-$03 R0 to decimal ASCII and displays it using PutChar. The control value in A is defined as follows: bit 7 0 - right justify the number. 1 - left justify the number, i.e. no justify. bit 6 0 - print leading zeroes. 1 - skip leading zeroes. bits 0-5 The field width in pixels for right justification. 1-204 Function Name: PutString Purpose: Displays an entire string of text. Call address: $C148 Input requirements: $02-$03 R0 Pointer to text string. $05 R1H The row for printing (1 above the underline). $18-$19 R11 The column in which to start printing. $33 windowTop: The top margin (Usually 0). $34 windowBottom: The bottom margin (Usually 199). $35-$36 leftMargin: The left margin. $37-$38 rightMargin: The right margin. Preparatory routines: UseSystemFont or LoadCharSet Errors: Branches through $84AB-$84AC (StringFaultVec) if right margin is exceeded. Description: This routine calls PutChar to display each character in a string. The string is terminated by a zero byte. Be sure to subtract 6 from R1H for a GetString in the same place. Add 2 to underline for proper positioning. 1-205 Function Name: i_PutString Purpose: Identical to PutString, but with inline code. Call address: $C1AE Input requirements: $35-$36 leftMargin: The left margin. $37-$38 rightMargin: The right margin. Preparatory routines: UseSystemFont or LoadCharSet Errors: Branches through $84AB-$84AC (StringFaultVec) if right margin is exceeded. Description: This routine creates a pointer to the text, calls PutString, then returns to the code immediately following the text. JSR i_PutString .word The column to start printing in .byte Row for line of print (1 above the underline) .byte Text to be displayed .byte 0 Control returns here after text is printed. 1-206 Function Name: GetNextChar Purpose: Get a key from the keyboard. Call address: $C2A7 Output: A Character or $00 if there are none. Description: This routine takes a key from the keyboard buffer, if there is one. If there are no characters in the buffer, then a zero is returned. 1-207 Function Name: GetString Purpose: Input a line of text from the user. Call address: $C1BA Input requirements: $02-$03 R0 Address of text and buffer. $04 R1L Flag byte ($87D3). $05 R1H Row to print text on (1 above the underline). $06 R2L Maximum length of input. $0A-$0B R4 Vector for user routine for right margin exceeded (optional). $18-$19 R11 Column to start printing text at. $84A3-$84A4 keyVector: Address for CR entered. Output: $24-$25 string: Pointer to text buffer (from $02-$03 R0). Buffer will be modified according to the user's input. $84A3-$84A4 keyVector: Cleared to $0000. Description: This routine is rather powerful. It displays a line of text, if there was any text to display. Then the text cursor is turned on. Several of the jump vectors are used: $84AB - $84AC (StringFaultVec) is the vector for the right margin being exceeded. $84A9-$84AA (otherPressVec) is the vector for a character being typed. $84A3- $84A4 (keyVector) is the vector for CR entered. After everything is set up, control returns to the caller; however, the input is handled by the interrupt drivers. When a CR is entered, control goes through the vector at $84A3-$84A4. The flag byte at location $04 R1L is copied to $87D3 and has the following property: If bit 7 is set, then use the user's routine whose address is stored at locations $0A-$0B R4 for the right margin is exceeded routine. Add 6 to R1H for a PutString in the same place. 1-208 Function Name: InitTextPrompt Purpose: Makes a vertical bar cursor sprite. Call address: $C1C0 Input requirements: A The height of the cursor minus 1 (0-41) Output: Sprite block #41 ($8A40-$8A7E) is made into a vertical bar of a given height. Description: Given the desired height, a vertical bar is created in the sprite block. If the height is greater than 21, then the height is halved and the sprite is Y-expanded. No check is performed on the height. If a height greater than 41 is used then the memory for next few sprites will be affected. 1-209 Function Name: PromptOn Purpose: Turn on text cursor. Call address: $C29B Input requirements: $84BE-$84BF stringX: Column to place cursor in. $84C0 stringY: Row to place cursor on. Output: $84B4 alphaFlag: Bit 6 is set. Description: Turns on sprite 1 and positions it. It also sets bit 6 of location $84B4. The blink rate is set to 60, once per second. Sprite 1 is the text cursor for GEOS. 1-210 Function Name: PromptOff Purpose: Turn off text cursor. Call address: $C29E Output: $84B4 alphaFlag: Bit 6 is cleared. Preparatory routines: PromptOn Description: Sprite 1 (GEOS's text cursor) is turned off, bit 6 of location $84B4 is reset. The blink rate is set to 60 (once per second). 1-211 Function Name: UseSystemFont Purpose: Selects the Berkeley Softworks font. Call address: $C14B Output: $26 baselineOffSet: # pixels above line of print. $27-$28 curSetWidth: The number of bytes in the bit stream. $29 curHeight: The point size. $2A-$2B curIndexTable: The pointer to the table of indices into the bit stream. $2C-$2D curDataPntr: The pointer to the bit stream. Description: This routine simply copies the font header data for the BSW font to zero page for use by PutChar and PutString. 1-212 Function Name: LoadCharSet Purpose: Change the current font. Call address: $C1CC Input requirements: $02-$03 R0 Pointer to font header in memory. Output: $26 baselineOffset: # pixels above line of print. $27-$28 curSetWidth: The number of bytes in the bit stream. $29 curHeight: The point size. $2A-$2B curIndexTable: Pointer to table of bit stream indices. $2C-$2D curDataPtr: Pointer to the bit stream. Description: This routine simply copies the header block from the font to zero page. This makes the font the current font for all character output. (See PutChar, PutString and i_PutString). 1-213 Function Name: GetRealSize Purpose: Get statistics for a character. Call address: $C1B1 Input requirements: A The character. Output: A The position of the underline. Y The character's width. X The character's height. Description: Given the ASCII value of a character, this routine computes and returns the height and width, taking the style into account. The # pixels above the underline for the present font is also returned. 1-214 Function Name: GetCharWidth Purpose: Returns the width of a character. Call address: $C1C9 Input requirements: A The ASCII value of the character. Output: A The width of the character. Description: This routine simply takes the difference of the bit stream indices to get the characters width. The delete character has its width loaded from $8807. This routine is called by GetRealSize.