Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
system_routines:human_interface [2016/06/05 16:23]
ex_writer [Human Interface]
system_routines:human_interface [2016/06/11 12:45] (current)
ex_writer [MSKTD]
Line 1: Line 1:
 ====== Human Interface ====== ====== Human Interface ======
  
-The Human Interface system routines handle input from the [[hardware:​player input#​keypad]] and control handles, scoring, system pausing and blackout, and menu display.+The Human Interface system routines handle input from the [[hardware:​player input#​keypad]] and [[hardware:​player input#control handles]], scoring, system pausing and blackout, and menu display.
  
 ===== Human Interface System Routines ===== ===== Human Interface System Routines =====
Line 43: Line 43:
 Mode 01 and 10 expect the returned-to point to be interpretive;​ mode 00 expect it to be machine instructions. Mode 01 and 10 expect the returned-to point to be interpretive;​ mode 00 expect it to be machine instructions.
  
-//Return code// (byte 0, bit 0–5) ​[from SENTRY?]+//Return code// (byte 0, bit 0–5) from [[#SENTRY]] routine (e.g., ST0, SJ1, SCT7, etc.)
  
 //Handler address// (bytes 1 and 2) contains the address of the handling routine. //Handler address// (bytes 1 and 2) contains the address of the handling routine.
Line 49: Line 49:
 End of list is indicated by a terminator byte that is greater than or equal to $C0. End of list is indicated by a terminator byte that is greater than or equal to $C0.
  
-See [[human interface#​keyboard input example|Keyboard Input Example]] below for example [[#sentry|SENTRY]] and DOIT usage.+---- 
 + 
 +=== Example: Football DOIT Table === 
 + 
 +<code z80> 
 +;​********** 
 +;* 
 +;*   ​Player Input Transition Table 
 +;* 
 +
 +DOTABLE: ​ RC    SCT7,​DOCT7,​0 ​  ; CT7 
 +          RC    ST0,​DOTRIG0,​0 ​ ; TRIGGER 0 
 +          RC    ST1,​DOTRIG1,​0 ​ ; TRIGGER 1 
 +          RC    SP0,​DOKNOB0,​0 ​ ; Pot. 0 
 +          RC    SP1,​DOKNOB1,​0 ​ ; Pot. 1 
 +          RC    SJ0,​DOJOY0,​0 ​  ; Joystick 0 
 +          RC    SJ2,​DOJOY2,​0 ​  ; Joystick 2 
 +          RC    SJ3,​DOJOY3,​0 ​  ; Joystick 3 
 +          RC    SJ1,​DOJOY1,​ENDx ​ ; Joystick 1 
 +</​code>​ 
 + 
 +Also see the [[human interface#​keyboard input example|Keyboard Input Example]] below for example [[#SENTRY]] and DOIT usage.
 ==== DOITB ==== ==== DOITB ====
  
Line 87: Line 108:
 {{getpar_small.png}} {{getpar_small.png}}
  
-A sample 2-digit GETPAR prompt from //[[gunfight|Gunfight]]//​.+A sample 2-digit GETPAR prompt from //[[:Gunfight]]//​.
  
 ==== INCSCR ==== ==== INCSCR ====
Line 142: Line 163:
 | Output: | DE = String address of selection mode | | Output: | DE = String address of selection mode |
 | Description:​ | The title is displayed at the top of the screen. Each entry in the menu list is then displayed with a preceding number supplied by MENU. [[human interface#​getnum|GETNUM]] is called to get the selection number. The menu list is searched for the selected node and it is jumped to. | | Description:​ | The title is displayed at the top of the screen. Each entry in the menu list is then displayed with a preceding number supplied by MENU. [[human interface#​getnum|GETNUM]] is called to get the selection number. The menu list is searched for the selected node and it is jumped to. |
-| Notes: | A maximum of eight entries may appear.\\ \\ On entry, MENU expects interrupts to be enabled and colors and boundaries to be initialized. MENU uses 96 lines of screen, creams the alternate set, and requires three levels of context. MENU calls [[human interface#​sentry|SENTRY]] and thus '​eats'​ all irrelevant transitions. | +| Notes: | A maximum of eight entries may appear.\\ \\ On entry, MENU expects ​[[hardware:interrupts]] to be enabled and colors and boundaries to be initialized. MENU uses 96 lines of screen, creams the alternate set, and requires three levels of context. MENU calls [[human interface#​sentry|SENTRY]] and thus '​eats'​ all irrelevant transitions. | 
  
-Menu List Layout:+=== MENU List Layout ​===
  
 {{:​menu_list.png}} {{:​menu_list.png}}
 ==== MSKTD ==== ==== MSKTD ====
  
-JOYSTICK MASK TO DELTAS+CONVERT ​JOYSTICK MASK TO DELTAS
  
 | Calling Sequence: | <code z80>​SYSTEM ​   MSKTD</​code>​ or <code z80>​LD ​       B,(joystick mask) | Calling Sequence: | <code z80>​SYSTEM ​   MSKTD</​code>​ or <code z80>​LD ​       B,(joystick mask)
Line 159: Line 180:
 | Arguments: | B = Joystick mask (not loaded)\\ C = Flop flag\\ DE = X positive delta\\ HL = Y positive delta | | Arguments: | B = Joystick mask (not loaded)\\ C = Flop flag\\ DE = X positive delta\\ HL = Y positive delta |
 | Output: | DE = X-Delta\\ HL = Y-Delta | | Output: | DE = X-Delta\\ HL = Y-Delta |
-| Description:​ | This routine uses the joystick mask and flop flag to conditionally modify the passed deltas. If negative direction is indicated, the delta is 2's complemented;​ if no direction is indicated, 0 is returned.\\ \\ MSKTD uses the value returned by a joystick and returns positive, negative, or zero values depending on the delta values provided. Delta values entered are what we would like to use if the joystick is held right (left if flopped) or down. Negative values will be returned if the joystick is left (right if flopped) or up.\\ \\ If we give it an x-delta of 1.0 for single pixel motion, we will get -1.0 for left, 0.0 for middle, and 1.0 for right. Dropping these values directly into the x-delta bytes of the vector block, then calling [[screen handler#vect|VECT]] and [[screen handler#vwritr|VWRITR]], will move the pattern appropriately for direct motion control. Passing a delta of 0.25 and adding the resulting values to the vector block deltas would simulate, for example, the inertial motion of a spaceship. ​ | +| Description:​ | This routine uses the joystick mask and flop flag to conditionally modify the passed deltas. If negative direction is indicated, the delta is 2's complemented;​ if no direction is indicated, 0 is returned.\\ \\ MSKTD uses the value returned by a joystick and returns positive, negative, or zero values depending on the delta values provided. Delta values entered are what we would like to use if the joystick is held right (left if flopped) or down. Negative values will be returned if the joystick is left (right if flopped) or up.\\ \\ If we give it an x-delta of 1.0 for single pixel motion, we will get -1.0 for left, 0.0 for middle, and 1.0 for right. Dropping these values directly into the x-delta bytes of the vector block, then calling [[screen handler#​VECT]] and [[screen handler#​VWRITR]],​ will move the pattern appropriately for direct motion control. Passing a delta of 0.25 and adding the resulting values to the vector block deltas would simulate, for example, the inertial motion of a spaceship. ​ | 
-| Notes: | B is not loaded by SYSSUK.\\ \\ The joystick mask (B) is the byte value returned by the joystick port, either as a result of reading the appropriate [[hardware:​i o ports|port]] for a joystick (e.g., $10 for joystick 0) or calling [[#sentry|SENTRY]] and picking up the joystick changes through DOIT (which stores the mask in B). |+| Notes: | B is not loaded by SYSSUK.\\ \\ The joystick mask (B) is the byte value returned by the joystick port, either as a result of reading the appropriate [[hardware:​i o ports|port]] for a joystick (e.g., $10 for joystick 0) or calling [[#SENTRY]] and picking up the joystick changes through ​[[#DOIT]] (which stores the mask in B). |
  
 ==== PAWS ==== ==== PAWS ====
Line 169: Line 190:
 DB        (number of interrupts)</​code>​| DB        (number of interrupts)</​code>​|
 | Arguments: | B = number of interrupts to wait | | Arguments: | B = number of interrupts to wait |
-| Description:​ | This routine pauses for a specified number of interrupts. If used with [[interrupt scheduler#​actint|ACTINT]],​ a value of 60 = 1 second. This routine does an EI upon entry and assumes interrupts will occur. ​ |+| Description:​ | This routine pauses for a specified number of interrupts. If used with [[interrupt scheduler#​actint|ACTINT]],​ a value of 60 = 1 second. This routine does an EI (enable interrupt) ​upon entry and assumes interrupts will occur. ​ |
  
 ==== PIZBRK ==== ==== PIZBRK ====
Line 196: Line 217:
 | Arguments: | DE = Keypad mask table | | Arguments: | DE = Keypad mask table |
 | Output: | A = Return code\\ B = Extended code (see output chart below) | | Output: | A = Return code\\ B = Extended code (see output chart below) |
-| Description:​ | SENTRY checks for changes in the potentiometers (pots), control handles, triggers, keypad, [[:​glossary#​s|semaphores]] (i.e., flags), and counters/​timers. It also takes care of blackout, the automatic blacking-out of the screen after 255 seconds without a change. If SENTRY isn't called, then the game will not black out.\\ \\ SENTRY checks if TIMOUT equals zero on entry, and if zero, it goes to PIZBRK. If a key has gone down or a control handle changed, then TIMOUT is set to $FF.\\ \\ HL should point at a keypad mask. The keypad consists of 6 rows by 4 columns.\\ \\ Example mask of 0–9 only:\\ <code z80>+| Description:​ | SENTRY checks for changes in the potentiometers (pots), control handles, triggers, keypad, [[:​glossary#​s|semaphores]] (i.e., flags), and counters/​timers. It also takes care of blackout, the automatic blacking-out of the screen after 255 seconds without a change. If SENTRY isn't called, then the game will not black out.\\ \\ SENTRY checks if TIMOUT equals zero on entry, and if zero, it goes to [[#PIZBRK]]. If a key has gone down or a control handle changed, then TIMOUT is set to $FF.\\ \\ HL should point at a keypad mask. The keypad consists of 6 rows by 4 columns.\\ \\ Example mask of 0–9 only:\\ <code z80>
 DB      011100B DB      011100B
 DB      111100B DB      111100B
Line 202: Line 223:
 DB      000000B</​code>​ | DB      000000B</​code>​ |
  
-The keypad mask is arranged as follows:+=== Keypad Mask Layout ===
  
 {{:​keypad_mask.png}} {{:​keypad_mask.png}}
  
-Sentry output chart:+=== SENTRY Output Chart ===
  
 ^ Priority ^ A = ^ Meaning ^ B = ^ ^ Priority ^ A = ^ Meaning ^ B = ^