Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
system_routines:screen_handler [2016/06/02 13:31] ex_writer [VBLANK] |
system_routines:screen_handler [2016/06/10 23:05] (current) ex_writer [Screen Handler System Routines] |
||
---|---|---|---|
Line 3: | Line 3: | ||
The screen handler is a group of routines for generating [[:glossary#f|frame buffer]] images. Included are entries for filling sections of the screen with constant data, the animation of figures, and the display of alphanumerics. | The screen handler is a group of routines for generating [[:glossary#f|frame buffer]] images. Included are entries for filling sections of the screen with constant data, the animation of figures, and the display of alphanumerics. | ||
- | Many of these routines utilize the Magic functions provided by the Astrocade's [[hardware:custom chips]]. Since the status of these chips cannot be context-switched, many of these routines are not [[:glossary#r|re-entrant]]. The user is responsible for preventing conflicts. This can be done by disabling [[:interrupts]] or implementing a [[:glossary#s|semaphore]]. | + | Many of these routines utilize the [[hardware:magic system|Magic functions]] provided by the Astrocade's [[hardware:custom chips]]. Since the status of these chips cannot be context-switched, many of these routines are not [[:glossary#r|re-entrant]]. The user is responsible for preventing conflicts. This can be done by disabling [[hardware:interrupts]] or implementing a [[:glossary#s|semaphore]]. |
- | + | ||
- | [NM:14] | + | |
===== Screen Handler System Routines ===== | ===== Screen Handler System Routines ===== | ||
Line 17: | Line 15: | ||
| [[#fill|FILL]] | Fill a contiguous memory range with a constant | | | [[#fill|FILL]] | Fill a contiguous memory range with a constant | | ||
| [[#rectan|RECTAN]] | Paint a rectangle of specified size, color, and coordinates | | | [[#rectan|RECTAN]] | Paint a rectangle of specified size, color, and coordinates | | ||
+ | | [[#relabs|RELABS]] | Relative to absolute conversion | | ||
| [[#relab1|RELAB1]] | Non-Magic RELABS | | | [[#relab1|RELAB1]] | Non-Magic RELABS | | ||
- | | [[#relabs|RELABS]] | Relative to absolute conversion | | ||
| [[#restore|RESTOR]] | Restores area previously saved (using SAVE) | | | [[#restore|RESTOR]] | Restores area previously saved (using SAVE) | | ||
| [[#save|SAVE]] | Preserves specified screen area that is 'underneath' a moving pattern | | | [[#save|SAVE]] | Preserves specified screen area that is 'underneath' a moving pattern | | ||
Line 78: | Line 76: | ||
| Arguments: | B = Extended options\\ C = Standard alphanumeric options byte\\ D = Y-coordinate\\ E = X-coordinate\\ HL = Address of BCD number\\ IX = Optional character font descriptor (not loaded) | | | Arguments: | B = Extended options\\ C = Standard alphanumeric options byte\\ D = Y-coordinate\\ E = X-coordinate\\ HL = Address of BCD number\\ IX = Optional character font descriptor (not loaded) | | ||
| Output: | DE = Updated to next character frame | | | Output: | DE = Updated to next character frame | | ||
- | + | | Description: | This routine converts each nibble into ASCII and displays it. Uses the standard BCD codes 0 through 9. The normally illegal BCD values are displayed as ASCII $2A–$2F (see below). Use [[human interface#incscr|INCSCR]] to increment the memory location pointed to in HL. | | |
- | | Description: | This routine converts each nibble into ASCII and displays it. Uses the standard BCD codes 0 through 9. The normally illegal BCD values are displayed as $2A–$2F respectively. Use [[human interface#incscr|INCSCR]] to increment the memory location pointed to in HL. | | + | |
In addition to the standard BCD set, the codes $A–$F are defined as follows: | In addition to the standard BCD set, the codes $A–$F are defined as follows: | ||
Line 157: | Line 154: | ||
DB 10101010B | DB 10101010B | ||
</code> | | </code> | | ||
- | ==== RELAB1 ==== | ||
- | CONVERT RELATIVE ADDRESS TO ABSOLUTE NORMAL ADDRESS | ||
- | |||
- | | Calling Sequence: | <code z80>SYSTEM RELAB1</code> or <code z80>SYSSUK RELAB1 | ||
- | DB (Magic register value)</code>| | ||
- | | Arguments: | A = Magic register value to combine with shift amount\\ D = Y-coordinate\\ E = X-coordinate | | ||
- | | Output: | A = Combined Magic register value\\ DE = Absolute normal address (non-Magic) | | ||
- | | Description: | This routine is identical to [[#relabs|RELABS]] except that a non-Magic address is returned, and the hardware [[hardware:magic system|Magic register]] is not set. The flopped bit is interrogated, and the flopped coordinate system is used, if optioned. | | ||
==== RELABS ==== | ==== RELABS ==== | ||
Line 177: | Line 166: | ||
{{:relabs_coords.png}} | {{:relabs_coords.png}} | ||
+ | |||
+ | Lance Squire: "RELABS converts X/Y to MAGIC RAM addresses plus sets the shift bits for | ||
+ | the MAGIC register." | ||
+ | |||
+ | ==== RELAB1 ==== | ||
+ | |||
+ | CONVERT RELATIVE ADDRESS TO ABSOLUTE NORMAL ADDRESS | ||
+ | |||
+ | | Calling Sequence: | <code z80>SYSTEM RELAB1</code> or <code z80>SYSSUK RELAB1 | ||
+ | DB (Magic register value)</code>| | ||
+ | | Arguments: | A = Magic register value to combine with shift amount\\ D = Y-coordinate\\ E = X-coordinate | | ||
+ | | Output: | A = Combined Magic register value\\ DE = Absolute normal address (non-Magic) | | ||
+ | | Description: | This routine is identical to [[#relabs|RELABS]] except that a non-Magic address is returned, and the hardware [[hardware:magic system|Magic register]] is not set. The flopped bit is interrogated, and the flopped coordinate system is used, if optioned. | | ||
+ | |||
+ | Lance Squire: "RELABS1 converts X/Y to SCREEN RAM addresses. Any pixel shifting is up | ||
+ | to the user." | ||
==== RESTOR ==== | ==== RESTOR ==== | ||
Line 220: | Line 225: | ||
| Output: | None | | | Output: | None | | ||
| Description: | Outputs data to designated [[hardware:i o ports|output ports]]. | | | Description: | Outputs data to designated [[hardware:i o ports|output ports]]. | | ||
- | | Notes: | INMOD is the Bally Arcade's interrupt mode. \\ \\ The HORCB ([[hardware:color mapping#horizontal color boundary|horizontal color boundary]]) determines the imaginary line separating left/right color register values. The HORCB is positioned between any two adjacent screen RAM bytes (i.e., four pixels). So HORCB is equal to the Arcade's horizontal resolution (HORIZX) divided by 4. \\ \\ The VERBL (vertical blanking line) determines how many lines of screen RAM will display. The Arcade's maximum resolution is 102. Blanking before line 102 limits the graphics onscreen, but increases the available [[:glossary#s|scratchpad]] RAM. VERBL expects a value that is two times the designated blanking line (i.e., BLINE*2). So if you want the screen to blank on line 90, you must output 90*2 = 180 to VERBL. The screen area below VERBL will be set to the designated [[hardware:color mapping#frame color|frame color]]. | | + | | Notes: | INMOD is the Bally Arcade's interrupt mode. \\ \\ The HORCB ([[hardware:color#horizontal color boundary]]) determines the imaginary line separating left/right color register values. The HORCB is positioned between any two adjacent screen RAM bytes (i.e., four pixels). So HORCB is equal to the Arcade's horizontal resolution (HORIZX) divided by 4. \\ \\ The VERBL (vertical blanking line) determines how many lines of screen RAM will display. The Arcade's maximum resolution is 102. Blanking before line 102 limits the graphics onscreen, but increases the available [[:glossary#s|scratchpad]] RAM. VERBL expects a value that is two times the designated blanking line (i.e., BLINE*2). So if you want the screen to blank on line 90, you must output 90*2 = 180 to VERBL. The screen area below VERBL will be set to the designated [[hardware:color#frame color]]. | |
==== STRDIS ==== | ==== STRDIS ==== | ||
Line 233: | Line 238: | ||
| Output: | DE = Updated to next character frame | | | Output: | DE = Updated to next character frame | | ||
| Description: | The string pointed at by HL is displayed as optioned. The string is terminated by a zero byte. | | | Description: | The string pointed at by HL is displayed as optioned. The string is terminated by a zero byte. | | ||
- | | Notes: | IX is not loaded by SUCK; it must be loaded prior to SYSSUK call. STRDIS is not [[glossary#r|reentrant]].\\ \\ There is an HVGLIB macro for STRDIS that displays a string with one line:<code z80>TEXTD (string address), (x-coord), (y-coord), (options)</code> | | + | | Notes: | IX must be loaded prior to a SYSSUK call. STRDIS is not [[:glossary#r|reentrant]].\\ \\ There is an HVGLIB macro for STRDIS that displays a string with one line, but it must be used inside [[software:upi conventions#the interpreter]]:<code z80>TEXTD (string address), (x-coord), (y-coord), (options)</code> | |
==== VBLANK ==== | ==== VBLANK ==== | ||
Line 298: | Line 303: | ||
DB (Magic Register) | DB (Magic Register) | ||
DW (pattern address)</code>| | DW (pattern address)</code>| | ||
- | | Arguments: | HL = pattern address\\ A = [[Magic Register]]\\ B = Y pattern size\\ C = X pattern size\\ D = Y-coordinate\\ E = X-coordinate | | + | | Arguments: | HL = pattern address\\ A = [[hardware:magic system#magic register|Magic Register]]\\ B = Y pattern size\\ C = X pattern size\\ D = Y-coordinate\\ E = X-coordinate | |
| Output: | DE = Absolute (i.e., screen RAM) address used\\ A = Magic Register used | | | Output: | DE = Absolute (i.e., screen RAM) address used\\ A = Magic Register used | | ||
| Notes: | User must worry about ON/OFF color if expansion is used. | | | Notes: | User must worry about ON/OFF color if expansion is used. | | ||
Line 311: | Line 316: | ||
DB (Magic Register) | DB (Magic Register) | ||
DW (Pattern block address)</code>| | DW (Pattern block address)</code>| | ||
- | | Arguments: | HL = pattern block address\\ A = [[Magic Register]]\\ B = Y pattern size\\ C = X pattern size\\ DE = Absolute screen address of upper left-hand corner of pattern write | | + | | Arguments: | HL = pattern block address\\ A = [[hardware:magic system#magic register|Magic Register]]\\ B = Y pattern size\\ C = X pattern size\\ DE = Absolute screen address of upper left-hand corner of pattern write | |
| Notes: | This routine writes patterns to non-Magic memory. The value in A is not output to the Magic register; it is only interrogated to decide whether to FLOP or EXPAND. | | | Notes: | This routine writes patterns to non-Magic memory. The value in A is not output to the Magic register; it is only interrogated to decide whether to FLOP or EXPAND. | | ||
- | |||
==== WRITP ==== | ==== WRITP ==== | ||
Line 323: | Line 327: | ||
DB (Magic Register) | DB (Magic Register) | ||
DW (pattern block address)</code>| | DW (pattern block address)</code>| | ||
- | | Arguments: | HL = pattern block address\\ A = [[Magic Register]]\\ D = Y-coordinate\\ E = X-coordinate | | + | | Arguments: | HL = pattern block address\\ A = [[hardware:magic system#magic register|Magic Register]]\\ D = Y-coordinate\\ E = X-coordinate | |
| Output: | DE = Screen address used\\ A = Magic Register used | | | Output: | DE = Screen address used\\ A = Magic Register used | | ||
| Description: | The pattern size is taken from the pattern block. | | | Description: | The pattern size is taken from the pattern block. | | ||
| Notes: | User must worry about ON/OFF color if expansion is used. | | | Notes: | User must worry about ON/OFF color if expansion is used. | | ||
- | See the [[bunker|Space Invaders Bunker]] example for a demonstration of WRITP. | + | See the [[:bunker|Space Invaders Bunker]] example for a demonstration of WRITP. |
==== WRITR ==== | ==== WRITR ==== | ||
Line 339: | Line 342: | ||
DB (Magic Register) | DB (Magic Register) | ||
DW (Pattern block address)</code>| | DW (Pattern block address)</code>| | ||
- | | Arguments: | HL = pattern block address\\ A = [[Magic Register]]\\ D = Y-coordinate\\ E = X-coordinate | | + | | Arguments: | HL = pattern block address\\ A = [[hardware:magic system#magic register|Magic Register]]\\ D = Y-coordinate\\ E = X-coordinate | |
| Output: | DE = Screen address used\\ A = Magic Register used | | | Output: | DE = Screen address used\\ A = Magic Register used | | ||
| Description: | The relative (i.e., displacement) coordinates stored with the pattern block are added to the coordinates passed in DE. Pattern size is taken from the pattern block. | | | Description: | The relative (i.e., displacement) coordinates stored with the pattern block are added to the coordinates passed in DE. Pattern size is taken from the pattern block. | | ||
| Notes: | If Expander is used, user must set ON/OFF color before calling WRITR. | | | Notes: | If Expander is used, user must set ON/OFF color before calling WRITR. | | ||
+ | ---- | ||
+ | |||
+ | [NM:14] |