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

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

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

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

__PC_IS_BANKSWITCHED__  = 1

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

__PC_HAS_LOWERCASE_CHARS__ = 1

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

KEY_A	       =   45
KEY_B	       =   76
KEY_C	       =   60
KEY_D	       =   61
KEY_E	       =   62
KEY_F	       =   69
KEY_G	       =   77
KEY_H	       =    1
KEY_I	       =   15
KEY_J	       =    8
KEY_K	       =   14
KEY_L	       =   19
KEY_M	       =    7
KEY_N	       =    0
KEY_O	       =   20
KEY_P	       =   24
KEY_Q	       =   46
KEY_R	       =   70
KEY_S	       =   53
KEY_T	       =   78
KEY_U	       =    9
KEY_V	       =   68
KEY_W	       =   54
KEY_X	       =   52
KEY_Y	       =    2
KEY_Z	       =   44

KEY_1	       =   51
KEY_2	       =   50
KEY_3          =   49
KEY_4          =   43
KEY_5          =   42
KEY_6          =   41
KEY_7          =   35
KEY_8	       =   34
KEY_9	       =   33
KEY_0          =   59

KEY_SPACE      =   13
KEY_RETURN     =   18  ; the ENTER key
KEY_ESC        =    6  ; the C-CE or CLS key

KEY_CAPS_LOCK  =   36  ; the SML key
KEY_CTRL       =   37  ; the DEF key
KEY_SHIFT_R    =   38

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

KEY_COMMA      =   23  ; the , key
KEY_PERIOD     =   57  ; the . key

KEY_PLUS       =   56
KEY_MINUS      =   48
KEY_ASTERISK   =   40  ; the * key
KEY_SLASH      =   32  ; the 'divide' key on PC-1403(H)
KEY_PARENLEFT  =   17  ; the ( key 
KEY_PARENRIGHT =   12  ; the ) key
KEY_EQUAL      =   55

; Special keys

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

KEY_PLUS_MIN    =   58  ; the +/- key

KEY_HYP         =   67
KEY_SIN         =   66
KEY_COS         =   65
KEY_TAN         =   64
KEY_FSE         =    4
KEY_HEX         =   75
KEY_DEG         =   74
KEY_LN          =   73
KEY_LOG         =   72
KEY_RCP         =   11  ; the 1/X key
KEY_UP_DOWN     =    5  ; the up/down arrow key
KEY_EXP         =   83
KEY_ASCIICIRCUM =   82  ; the ^ or y^X key
KEY_SQR         =   81  ; the square root key
KEY_SQU         =   80  ; the x^2 key

KEY_M_PLUS      =   47  ; the M+ key
KEY_M_SET       =   31  ; the X>M key
KEY_M_RECALL    =   39  ; the RM key

; Keys not available on PC-1403(H)

KEY_UNDEF       = 0xfe

KEY_SHIFT_L     = KEY_UNDEF

KEY_DEL         = KEY_UNDEF
KEY_INS         = KEY_UNDEF

KEY_COLON       = KEY_UNDEF
KEY_SEMICOLON   = KEY_UNDEF

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

; The offset between port A and port K matrix

KEYPORT_OFFS = 28

; BASIC system pointers

BASIC_START   = 0x8030
BASIC_CUR_X   = 0xff69  ; x cursor position

; Memory location

BASVAR_STR_ESC = 0xF5;   245            ; Excape character to indicate a
                                        ; string variable
MEM_BASVAR_Z  = 0xFB10;  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 = 0xFE60;                 ; The input buffer 80 byte
MEM_BAS_WAIT  = 0xFF47;  65351          ; Duration of WAIT interval

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

MEM_LCD_PART1   = 0x3000
MEM_LCD_PART2   = 0x3040
MEM_BANKSWITCH  = 0x3C00
MEM_KEYPORT	= 0x3E00    ; address of key port

MEM_CHARTAB     = 0x4060
MEM_CHARTAB_OFF	= 0xF0      ; Offset between character Tables

MEM_BS_IND_CHARTAB  = 0x09  ; the index of the rom bank containing the character table

__INVERS_CHARTAB__  = 0

; LCD properties

LCD_ROWS       =  1
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_PWRDOWN = 0x04E3  ; Power Down
