; -----------------------------------------------
; PShell - a runtime environment for    
; sharp pocket computers                 
; file     : pc1262.h                   
; author   : puehringer edgar           
; date     : 07.05.2004                 
; version  : 1.0.0                      
; assembler: as61860                    
;                                       
; Contains machine dependant constanst
; -----------------------------------------------

; Flags for conditional assembly - this
; models will be supported (maybe)

__PC_1262__  = 1
__PC_1280__  = 0
__PC_1350__  = 0
__PC_1360__  = 0
__PC_1402__  = 0
__PC_1403__  = 0

; Bankswitch flag
; 1 if this is a model with bankswitched
; ROM, 0 otherwise

__PC_IS_BANKSWITCHED__  = 0

; Keyboard matrix flag
; 1 if this is a model which addresses
; a part of the keyboard with the gate
; array, 0 otherwise (addressed by port B)

__PC_KBD_GATE_ARRAY__ = 0

; Small characters availablility flag
; 1 if available, 0 otherwise

__PC_HAS_LOWERCASE_CHARS__ = 1

; Mode button availablility flag (otherwise includes into power switch)
; 1 if available, 0 otherwise

__PC_HAS_MODE_BTN__ = 0

; Resonator frequency
; On of these defines must be 1 to indicate the resonator frequency of
; the calculator
  
__PC_RESONATOR_576K__ = 0
__PC_RESONATOR_768K__ = 1
__PC_RESONATOR_800K__ = 0

; Keycodes
; Note: the BRK key is not included into
; this constants, because it is read with
; the TEST instruction

KEY_A	       =    45
KEY_B	       =     7
KEY_C	       =    28
KEY_D	       =    29
KEY_E	       =    30
KEY_F	       =     1
KEY_G	       =     8
KEY_H	       =    14
KEY_I	       =    24
KEY_J	       =    19
KEY_K	       =    23
KEY_L	       =    26
KEY_M	       =    18
KEY_N	       =    13
KEY_O	       =    17
KEY_P	       =    11
KEY_Q	       =    46
KEY_R	       =     2
KEY_S	       =    37
KEY_T	       =     9
KEY_U	       =    20
KEY_V	       =     0
KEY_W	       =    38
KEY_X	       =    36
KEY_Y	       =    15
KEY_Z	       =    44

KEY_1	       =     5
KEY_2	       =    49
KEY_3          =    41
KEY_4          =     4
KEY_5          =    48
KEY_6          =    40
KEY_7          =     6
KEY_8	       =    50
KEY_9	       =    42
KEY_0          =    27

KEY_SPACE      =    22
KEY_RETURN     =    25 ; the ENTER key
KEY_ESC        =    34 ; the C-CE or CLS key

KEY_CTRL       =    47 ; the DEF key
KEY_SHIFT_L    =    39

KEY_DOWN       =    31
KEY_UP         =     3
KEY_LEFT       =    10
KEY_RIGHT      =    16

KEY_PERIOD     =    51 ; the . key

KEY_PLUS       =    43
KEY_MINUS      =    35
KEY_ASTERISK   =    33 ; the * key
KEY_SLASH      =    32 ; the 'divide' key on PC-14XX
KEY_EQUAL      =    12

; Keys not available on PC-1262

KEY_UNDEF       = 0xfe

KEY_CAPS_LOCK   = KEY_UNDEF  ; the SML key
KEY_SHIFT_R     = KEY_UNDEF

KEY_DEL         = KEY_UNDEF
KEY_INS         = KEY_UNDEF

KEY_COLON       = KEY_UNDEF
KEY_SEMICOLON   = KEY_UNDEF
KEY_COMMA       = KEY_UNDEF  ; the , key
KEY_PARENLEFT   = KEY_UNDEF  ; the ( key 
KEY_PARENRIGHT  = KEY_UNDEF  ; the ) key

KEY_M_MINUS     = KEY_UNDEF  ; the M- key
KEY_M_CLEAR     = KEY_UNDEF  ; the CM key      

KEY_OFF         = KEY_UNDEF

KEY_PERCENT_R   = KEY_UNDEF

KEY_EXCLAM      = KEY_UNDEF
KEY_QUOTEDBL    = KEY_UNDEF  ; the \" key
KEY_NUMBERSIGN  = KEY_UNDEF  ; the # key
KEY_DOLLAR      = KEY_UNDEF
KEY_PERCENT_L   = KEY_UNDEF

KEY_MODE        = KEY_UNDEF  ; the BASIC key on PC-1403(H)
KEY_CAL         = KEY_UNDEF

KEY_PLUS_MIN    = KEY_UNDEF  ; the +/- key

KEY_HYP         = KEY_UNDEF
KEY_SIN         = KEY_UNDEF
KEY_COS         = KEY_UNDEF
KEY_TAN         = KEY_UNDEF
KEY_FSE         = KEY_UNDEF
KEY_HEX         = KEY_UNDEF
KEY_DEG         = KEY_UNDEF
KEY_LN          = KEY_UNDEF
KEY_LOG         = KEY_UNDEF
KEY_RCP         = KEY_UNDEF  ; the 1/X key
KEY_UP_DOWN     = KEY_UNDEF  ; the up/down arrow key
KEY_EXP         = KEY_UNDEF
KEY_ASCIICIRCUM = KEY_UNDEF  ; the ^ or y^X key
KEY_SQR         = KEY_UNDEF  ; the square root key
KEY_SQU         = KEY_UNDEF  ; the x^2 key

KEY_M_PLUS      = KEY_UNDEF  ; the M+ key
KEY_M_SET       = KEY_UNDEF  ; the X>M key
KEY_M_RECALL    = KEY_UNDEF  ; the RM key

; The offset between port A and port K matrix

KEYPORT_OFFS = 28

; BASIC system pointers

BASIC_START    = 0x4080
BASIC_CUR_X    = 0xff69                 ; x cursor position
BASIC__START_L = 0x66E1                 ; pointer to basic start low byte
BASIC__START_H = 0x66E2                 ; pointer to basic start high byte
BASIC__END_L   = 0x66E3                 ; pointer to basic start low byte
BASIC__END_H   = 0x66E4                 ; pointer to basic start high byte

; Memory location

BASVAR_STR_ESC = 0xF5;   245            ; Excape character to indicate a
                                        ; string variable
MEM_BASVAR_Z  = 0x6500;  25856          ; Basic std var Z
MEM_BASVAR_Y  = MEM_BASVAR_Z + 8;
MEM_BASVAR_X  = MEM_BASVAR_Y + 8;
MEM_BASVAR_W  = MEM_BASVAR_X + 8;
MEM_BASVAR_V  = MEM_BASVAR_W + 8;
MEM_BASVAR_U  = MEM_BASVAR_V + 8;
MEM_BASVAR_T  = MEM_BASVAR_U + 8;
MEM_BASVAR_S  = MEM_BASVAR_T + 8;
MEM_BASVAR_R  = MEM_BASVAR_S + 8;
MEM_BASVAR_Q  = MEM_BASVAR_R + 8;
MEM_BASVAR_P  = MEM_BASVAR_Q + 8;
MEM_BASVAR_O  = MEM_BASVAR_P + 8;
MEM_BASVAR_N  = MEM_BASVAR_O + 8;
MEM_BASVAR_M  = MEM_BASVAR_N + 8;
MEM_BASVAR_L  = MEM_BASVAR_M + 8;
MEM_BASVAR_K  = MEM_BASVAR_L + 8;
MEM_BASVAR_J  = MEM_BASVAR_K + 8;
MEM_BASVAR_I  = MEM_BASVAR_J + 8;
MEM_BASVAR_H  = MEM_BASVAR_I + 8;
MEM_BASVAR_G  = MEM_BASVAR_H + 8;
MEM_BASVAR_F  = MEM_BASVAR_G + 8;
MEM_BASVAR_E  = MEM_BASVAR_F + 8;
MEM_BASVAR_D  = MEM_BASVAR_E + 8;
MEM_BASVAR_C  = MEM_BASVAR_D + 8;
MEM_BASVAR_B  = MEM_BASVAR_C + 8;
MEM_BASVAR_A  = MEM_BASVAR_B + 8;

MEM_INPUT_BUF = 0x67B0;                 ; The input buffer 80 byte
MEM_BAS_WAIT  = 0x66E5;  26341          ; Duration of WAIT interval

MEM_BAS_START   = 0x4080    ; Start of the RAM available for the user

MEM_LCD_L1C1    = 0x2000
MEM_LCD_L1C2    = 0x2800
MEM_LCD_L2C1    = 0x2040
MEM_LCD_L2C2    = 0x2840

MEM_CHARTAB     = 0x7FAB    ; this address is not in ROM, but the
                            ; not printable characters are not in
                            ; the character table

;MEM_CHARTAB_OFF	= 0xF0      ; Offset between character Tables

__INVERS_CHARTAB__  = 1

; LCD properties

LCD_ROWS       =  2
LCD_COLS       = 24
LCD_COL_WIDTH  =  5  ; 6 on systems with full graphic screen like PC-1360
LCD_CHAR_WIDTH =  5

; CPU internal ROM calls

INT_ROM_KPRESS	= 0x0AA9  ; Keypressed function, non blocking (2729)
INT_ROM_GETKEY  = 0x113E  ; Getkey function, blocking, with SHIFT evaluation (4414)
INT_ROM_PWRDOWN = 0x0458  ; Power Down
INT_ROM_BEEP    = 0x07D4  ; Short beep
