; FILENAME      J31H2.ASM
; DESCRIPTION   SYSTEM CALL & INTERNAL RAM (MONITOR)
;               LABEL HEADING
;               FOR INCLUDE FROM ANY USER-PROGRAM
; HARDWARE      JAZZ31 VERSION 2.0
; ASSEMBLER     SXA51
; START-DATE    16/05/95
; COMPANY       SILA RESEARCH CO.,LTD.

; ********** VARIABLE SET **********

                             ;***** PORT *****
CONA     EQU    0F800H       ;OUT SEGMENT,PRINTER
CONB     EQU    0F801H       ;OUT 0-3=DIGIT 4=LED 5=/STB 6=WATCH-DOG 7=SPEAKER
CONC     EQU    0F802H       ;IN  0-3=KEY-IN 4=JP8000H 5=BUSY 7=LOW-BATT
CONP     EQU    0F803H       ;CONTROL PORT

DATABI   EQU    P1.4         ;DS1202 RTC
CLKBIT   EQU    P1.5
RSTBIT   EQU    P1.6
TOOLBT   EQU    P1.7

                             ;***** PARAMETER *****
AUTOR1   EQU    40H          ;AUTO REPEAT FIRST DELAY
AUTOR2   EQU    10H          ;AUTO REPEAT SECOND DELAY (DEFAULT)
AUTORH   EQU    AUTOR2+8     ;AUTO REPEAT SLOW (8 LEVEL ADJUST)
AUTORL   EQU    AUTOR2-8     ;AUTO REPEAT FAST
REFDEL   EQU    12H          ;REFRESH DELAY
PROMPT   EQU    40H          ;PROMPT CHARECTOR
FLASHC   EQU    06H          ;FLASH SPEED DELAY
BRAT12   EQU    0E8H         ;1200 BAUD RATE VAR.
BRAT24   EQU    0F4H         ;2400
BRAT48   EQU    0FAH         ;4800
BRAT96   EQU    0FDH         ;9600
SMOD     EQU    B.7          ;FOR BAUD FUNCTION

; ********** INTERNAL RAM **********

         ORG    0000H
                             ;**** USER AREA ****
         DS     8            ;USER AREA (REGISTER BANK-0 VIRTUAL)
         DS     24           ;USER AREA (INTERNAL RAM & USER STACK)
         DS     12           ;USER AREA (BIT ADDRESSABLE)
         DS     4            ;**** SYSTEM FLAG AREA ****
         DS     2

                             ;**** BUFFER AREA ****
ASMBUF:                      ;(FOR REMOTE 8 BYTE)
DISBUF:  DS     8            ;DISPLAY BUFFER (SEGMENT CODE)
HEXBUF:  DS     3            ;HEX BUFFER
SCANKM:  DS     1            ;SCAN  - KEY MEMORY
SCANAM:  DS     1            ;SCAN  - AUTO REPEAT MEMORY
SCANAR:  DS     1            ;SCAN  - AUTO REPEAT COUNT DOWN
SCANRC:  DS     1            ;SCAN  - REFRESH COUNT DOWN
SCANFC:  DS     1            ;SCAN  - FLASH COUNT DOWN

                             ;**** GENERAL AREA ****
INPBKH:  DS     1            ;INPUT - DATA HIGH BACKUP
INPBKL:  DS     1            ;INPUT - DATA LOW BACKUP
INPBKC:  DS     1            ;INPUT - CHAR BACKUP
IZDATA:                      ;(FOR REMOTE 2 BYTE)
MEMADD:  DS     2            ;ADDR  - DMEM,PMEM,INTR,SFR,DEBUG
IXDATA:  DS     2            ;IX DATA MEMORY
IYDATA:  DS     2            ;IZ DATA MEMORY (FOR REMOTE)

                             ;**** MEMORY AREA ****
DMMADD:  DS     2            ;DATA & PROGRAM ADDRESS
INRADD:  DS     1            ;INTERNAL RAM ADDRESS
RUNADD:  DS     2            ;RUN ADDRESS (PC)
STTADD:  DS     2            ;START ADDRESS
ENDADD:  DS     2            ;END ADDRESS
DESADD:  DS     2            ;DESTINATION ADDRESS
HEXDAT:  DS     1            ;HEX DATA
POWMEM:  DS     1            ;POWER UP CODE

                             ;**** VIRTUAL AREA ****
VTSP:    DS     1            ;FOR SFR
VTDPL:   DS     1
VTDPH:   DS     1
VTTCON:  DS     1
VTTMOD:  DS     1
VTTL0:   DS     1
VTTL1:   DS     1
VTTH0:   DS     1
VTTH1:   DS     1
VTP1:    DS     1
VTSCON:  DS     1
VTIE:    DS     1
VTIP:    DS     1
VTPSW:   DS     1
VTACC:   DS     1
VTB:     DS     1
STACK:   DS     24
INTEND:

                             ;**** SYSTEM FLAG (EQU) ****
SCANPF   EQU    60H          ;SCAN  - PRESS FLAG
SCANRF   EQU    61H          ;SCAN  - REFRESH ON FLAG
SCANR1   EQU    62H          ;SCAN  - REFRESH INTR FLAG
SCANR2   EQU    63H          ;SCAN  - REFRESH DMEM FLAG
SCANF5   EQU    64H          ;SCAN  - D5 DOT FLASH FLAG
SCANF7   EQU    65H          ;SCAN  - D7 DOT FLASH FLAG
SCANFF   EQU    66H          ;SCAN  - D6 PROMPT FLASH FLAG
SCANFD   EQU    67H          ;SCAN  - FLASH DATA 0=DARK 1=BRIGTH

SCANBF   EQU    68H          ;SCAN  - BY PASS DIRECT KEYS FLAG
SCANOL   EQU    69H          ;SCAN  - ONE LOOP SCAN FLAG
AUTOIF   EQU    6AH          ;MAIN  - AUTOI FLAG
FUNC2F   EQU    6BH          ;FUNC  - FUNC2 FLAG
SIMINT   EQU    6CH          ;DEBUG - INT-SIMULATE (IE1VEC)
SKIPFG   EQU    6DH          ;DEBUG - SKIP FLAG
MULFG    EQU    6EH          ;DPMUL - DPMUL FLAG
INPFIR   EQU    6FH          ;INPUT,HDGET - FIRST FLAG

SEFLAG   EQU    70H          ;DUMP,LIST  - SERIAL FLAG (1=SERIAL 0=PRINTER)
INPBFG   EQU    71H          ;INPUT - BACK-FIELD FLAG
DECFAG   EQU    72H          ;HDGET - DECIMAL FLAG
GETOKF   EQU    73H          ;GET2  - 2 DIGIT OK FLAG
SENDEN   EQU    74H          ;SEND  - LAST LINE FLAG
POWFAG   EQU    75H          ;RESET - POWER UP FLAG
STMFAG   EQU    76H          ;RECV  - STREAM FLAG
RELTMM   EQU    77H          ;RELT  - BIT MEMORY

REMFAG   EQU    78H          ;REM - REMOTE FUNCTION FLAG

; ********** EXTERNAL RAM **********

         ORG    8000H
BACKTS:  DS     8            ;BACKUP RAM TEST
DATBF:   DS     8            ;DATA BUFFER
VTREG:   DS     8            ;VIRTUAL REGISTOR

CPUMEM:  DS     1            ;8031/32 MEMORY (FOR REMOTE)
TABMEM:  DS     4            ;OPCODE MEMORY (ASMX)
INPBUF:  DS     41           ;INPUT BUFFER (40 CHR.MAX)
INPEND:
ENDEXT:

; ********** SYSTEM CALL LABEL **********

ENDVEC1  EQU    0033H             ;END-PROGRAM TO REMOTE
ENDVEC2  EQU    0036H             ;END-PROGRAM TO MONITOR

SUBDA    EQU    0039H             ;01
CLEAR    EQU    003CH             ;02
DMSEC    EQU    003FH             ;03
DTSEC    EQU    0042H             ;04
DSEC     EQU    0045H             ;05
TABLE    EQU    0048H             ;06
CHKSUM   EQU    004BH             ;07
MOVES    EQU    004EH             ;08

DPDEC    EQU    0051H             ;09
DPADD    EQU    0054H             ;10
DPSUB    EQU    0057H             ;11
DPMUL    EQU    005AH             ;12
DPDIV    EQU    005DH             ;13
DPCOM    EQU    0060H             ;14
DPAX     EQU    0063H             ;15
DPXA     EQU    0066H             ;16

IXRD     EQU    0069H             ;17
IXWR     EQU    006CH             ;18
IXINC    EQU    006FH             ;19
IXDEC    EQU    0072H             ;20
IXADD    EQU    0075H             ;21
IXSUB    EQU    0078H             ;22
IXCOM    EQU    007BH             ;23
IXAC     EQU    007EH             ;24

IXAX     EQU    0081H             ;25
IXXA     EQU    0084H             ;26
DBADD    EQU    0087H             ;27
DBSUB    EQU    008AH             ;28
DTADD    EQU    008DH             ;29
DTSUB    EQU    0090H             ;30
SCAN     EQU    0093H             ;31
SCAND    EQU    0096H             ;32

SCANK    EQU    0099H             ;33
INH      EQU    009CH             ;34
INW      EQU    009FH             ;35
SOUND    EQU    00A2H             ;36
UBEEP    EQU    00A5H             ;37
SONG     EQU    00A8H             ;38
PBYTE    EQU    00ABH             ;39
PBYTEH   EQU    00AEH             ;40

PBYTEW   EQU    00B1H             ;41
PBLOCK   EQU    00B4H             ;42
PBLANK   EQU    00B7H             ;43
PLF      EQU    00BAH             ;44
SBYTE    EQU    00BDH             ;45
SBYTEH   EQU    00C0H             ;46
SBYTEW   EQU    00C3H             ;47
SBLOCK   EQU    00C6H             ;48

SBLANK   EQU    00C9H             ;49
SLF      EQU    00CCH             ;50
RBYTE    EQU    00CFH             ;51
RBYTEH   EQU    00D2H             ;52
RBYTEW   EQU    00D5H             ;53
BAUDS    EQU    00D8H             ;54
RTCWR    EQU    00DBH             ;55
RTCRD    EQU    00DEH             ;56

WDS      EQU    00E1H             ;57
HTOS     EQU    00E4H             ;58
STOH     EQU    00E7H             ;59
HTOA     EQU    00EAH             ;60
ATOH     EQU    00EDH             ;61
HTOD     EQU    00F0H             ;62
DTOH     EQU    00F3H             ;63
UPPER    EQU    00F6H             ;64

