//
//*********************************************************
// Modul 3 using
//
// s11,100 transfer parameter from ch 0
// s12     workstr
// s9      printing notruf string
// s10     printing notruf string
// s8      parameter save
//
//*********************************************************
//  COMMON AFS DEFINES
//
#define csra    0Xfc81
#define csrb    0Xfc89
#define csrc    0Xfc91
#define csrd    0xfc99
#define baud_300        0X44
#define baud_1200       0X66
#define baud_2400       0X88
#define baud_4800       0X99
#define baud_9600       0Xbb
//
#define dbs_search_str  s15,0
//
#define dbs_para        s15,100
#define dbs_pointer     s15,102
//
#define dbs_flag        s15,149
//
#define fdt_str         s15,150
#define dt_str          s15,180
#define lfdt_str        21
#define dt_str_year     s15,180
#define dt_str_month    s15,182
#define dt_str_day      s15,184
#define dt_str_weekday  s15,186
#define dt_str_hour     s15,188
#define dt_str_minute   s15,190
//
#define calc_erg_flag   s15,204
#define calc_p1         s15,210
#define calc_p2         s15,220
#define calc_erg        s15,230
#define calc_erg6       s15,232
#define calc_erg4       s15,234
#define calc_erg_3dg    s15,235
#define calc_rest       s15,240
//
#define dbs_str         s14
#define dbs_str_0       s14,0
//
#define number_of_dtmf  11
//
//---------------------------------------------------------
// Include file for VPS-Port decoding
//---------------------------------------------------------
//
// codes beginning with A
//
#define call_to_aa                      0
#define recall_to_aa                    4
#define multi_tree_call                 8
#define multi_tree_recall               9
#define fixed_forwarding                1
#define forwarding_on_busy              5
#define delayed_forwarding              6
#define consult_own_subset              2
#define consult_any_subset              7
#define record_online                   3
//
// call progress codes beginning with B
//
#define dial_tone                       35
#define forwarding_info                 34
#define ringback_tone                   36
#define busy_tone                       37
#define unobtainable_tone               38
#define onhook_tone                     39
//
#define tone_offhook                    49
#define date_time_dtmf                  40
#define day_switch                      41
#define night_switch                    42
//
#define timeout                         255
#define notexist                        254
#define not_supported                   253
//
// codes beginning with AA
//
#define aa_call_to_aa                   10
#define aa_recall_of_aa                 14
#define aa_multi_tree_call              18
#define aa_multi_tree_recall            19
#define aa_fixed_forwarding             11
#define aa_forwarding_on_busy           15
#define aa_delayed_forwarding           16
#define aa_record_online                13
//
//
#define dtmf_str                        s11
#define pos_0                           0
#define pos_1                           1
#define pos_2                           2
//
#define result                          5   // result counter 5
#define extension_length                4
#define extension_count                 6
#define pointer_dtmf                    7
#define cpointer_dtmf                   c7
#define tree_length                     4
//
//*********************************************************
//*********************************************************
//
#define a2824_input_cr       s13,2       //l= 3
//
#define a2824_str               s1
#define current_min          a2824_str,230     //l= 8
#define a2824_time           a2824_str,240     //format hh:mm
#define a2824_hour           a2824_str,240
#define a2824_min            a2824_str,243
//
#define a2824_display_l1     0xd400,0
#define a2824_display_l2     0xd400,42   //l= max 41
//
#define ch2824               c0
//
#define a2824_a1_cr          s11,100     //l= max 3
#define a2824_a1_cr_sub      s11,105     //l= max 3
#define a2824_a1_num         s11,110     //l= max 20
#define a2824_a1_posnum      110
#define a2824_a1_code        s11,130     //l= max 10
#define a2824_a1_poscode     130
#define a2824_a1_mess        s11,140     //l= max 20
#define a2824_a1_posmess     140
//
#define test_2824_state      s11,240     //l = 10
#define lgnotr_state         s11,250     //l = 4
//*********************************************************
// Buffer 0 definitionen
//***********************************************
#define buffer_m0               0
#define badr_0_high             0x10
#define lbuff_0_high            0x50
#define modnum_0                0x00
//************************************************
//*********************************************************
//*********************************************************
// Buffer 1 definitionen
//***********************************************
#define buffer_m1               1
#define badr_1_high             0x10
#define lbuff_1_high            0x50
#define modnum_1                0x01
//************************************************
//*********************************************************
//*********************************************************
// Buffer 2 definitionen
//***********************************************
#define buffer_m2               2
#define badr_2_high             0x10
#define lbuff_2_high            0x20
#define modnum_2                0x02
//************************************************
//*********************************************************
//*********************************************************
// Buffer 3 definitionen
//***********************************************
//#define buffer_m3               3
//#define badr_3_high             0x10
//#define lbuff_3_high            0x50
//#define modnum_3                0x03
//************************************************
//*********************************************************
//*********************************************************
// Landesgericht Notruf mit DHS3
// using: s12 for work
//        s11 for Parameter transfer and constant
//
#define wstr                            s12
#define print1                          s9
#define print2                          s10
#define p_store                         s8
//*********************************************************
#define lgdbs           1
//
#define _extension      0
#define _notrufext      4
#define _twgext         8
#define _flag           12
#define _name           13              // l= 16
//
//*********************************************************
// START
//
        setbaud 1,9600,8,n,1
reset_0:
        mode_reco
//        call    init_watchman
        movd    "        /n",calc_p1
        movs    calc_p1,calc_p2,10
        movs    calc_p1,calc_erg,10
        movs    calc_p1,calc_rest,10
        setl    11,2            //modul busy
        setl    12,2
        setl    13,2
        setl    14,2
        setl    15,2
        call    init_dbs2
        movd    "return from <dbs_2_init> okay!/n",wstr,100
        out     wstr,100,c4
        compd   "CONFIG",p_store,200        //config mess (internal usage)
        jz      setup_1
//
// first init default
//
        call    init_b0         // history-buffer
        call    init_b1         // transfer to modul1
        call    init_b2         // transfer to modul2
        movd    "return from buffer-init okay!/n",wstr,100
        out     wstr,100,c4
//
// setup default parameter
//
        movd    "CONFIG   ",p_store,200    //set config
        movd    "4761     ",p_store,210    //Notruf TLN
        movd    "3        ",p_store,220    //Number of LF
        movd    "20       ",p_store,230    //Timeout for auto clear
        movd    "1234     ",p_store,240    //DTMF Clear-code
//
//**********************************************************
// configuration of DHS 3 - parameter default
//
        movd    "911114   ",p_store,190         // dir pick
//**********************************************************
//
        clear   s14,0
        setc    9,0                     //lfd-nr counter
        setc    5,0
setup_1:
//
//**********************************************************
// setup s11,70 number of lf
// using cnt 7,8
//
        movd    "                     ",print1,70
        movc    p_store,220,7           //cnt 7 anzahl
        setc    8,70                    //destination
        setc    6,20                    //maximale anzahl
lf_set:
        movd    "/l",print1,c8
        incc    8
        decc    7
        jz      cr_set
        decc    6
        jnz     lf_set
cr_set:
        movd    "/n",print1,c8
//
//**********************************************************
// setup headerstring for printer
//
        movd    "*****        NOTRUF        *****         LFD NR.:        *****/n",print1,100
        setc    1,80            //timeout for init 80 sec
        setc    0,5             //timeout counter
//
//**********************************************************
//
        movd    "NOTRUF          /l/n",wstr,0
        movd    "3<3",wstr,8
        movd    "Modul 3 LGNOTR V1.1 by J. Hoerhager AOH start/n",wstr,0
        out     wstr,0,c4
        setl    11,2
        setl    6,0
        clear   rx_sign
//
//**********************************************************
// send reset message
//
        call    notruf_reset
reset_01:
        movd    "F",dbs_flag
        movd    "   ",a2824_a1_cr               //
setup_0:
        clear   cntl_sign
//
main_start:
        movd    "0   ",lgnotr_state
        call    print_state
//
main:
        setl    11,1
        setl    12,0
        setl    13,0
        setl    14,0
        setl    15,0
        movd    "F",dbs_flag
        sett    200                     //timer 10sec
        wait    tf_sign,cntl_sign,im_sign
        case    tf_sign,test_cntl
//
// State 0 timeout
//
        compd   "2824conn",test_2824_state
        jz      main
        call    pr_2824err
        movd    "2824conn",test_2824_state
        jmp     main
//
test_cntl:
        case    cntl_sign,test_im_sign
        movd    "WATCHMAN 3 Message                                /n",wstr,0
        movs    a2824_a1_cr,wstr,20,60
        out     wstr,0,c4
        compd   "RING",a2824_a1_mess
        jz      m3_ring
//*************************************
        movd    "   ",a2824_a1_cr       // clear callref
        jmp     main_start
//
//*********************************************************
print_state:
        movd    "Modul 3 LGNOTR STATE       /n",wstr,0
        movs    lgnotr_state,wstr,23,3
        out     wstr,0,c4
        ret
//*********************************************************
// LGNOTR state 1
// message ring
//**********************************************************
// incomming call
//
m3_ring:
        setl    11,2
        movd    "1  ",lgnotr_state
        call    print_state
//************************************************
// save calling number
        movs    a2824_a1_num,p_store,0,20
//
//*******************************************************************
// test if extension # is a valied emergency number
//
        movd    "                                      /n",s14,0
        movd    "2 0 ",dbs_para                 // select DBS 2 element 0
        movs    p_store,0,dbs_search_str,20     // serach for calling number
        compd   "    ",dbs_search_str
        jz      no_number
        acall   pfirst_dbs
        movd    "2 0 ",dbs_para                 // select DBS 2 element 0
        acall   find_dbs
        jnz     no_number
//
//*******************************************************************
// extension nuber found read parameter from DBS 2
//
        acall   read_dbs
//
        out     s14,0,c4                // print the content of the dbs
        call    notruf_akti             // ext = p_store,0
//
//*******************************************************************
// test if extension is category key or earpice
//
        compd   "T",s14,_flag
        jz      emergency_call
        compd   "P",s14,_flag
        jz      emergency_call
//
//*******************************************************************
// for other flags
// Test time < 7 or time > 17
// make only a printout for extensions defined as earpices
//
        acall   read_dt                         //#V2.2
        movd    "0     ",calc_p1
        movs    dt_str_hour,calc_p1,2           //#V2.2
        movd    "7 ",calc_p2
        acall   comp
        compd   "LT",calc_erg_flag
        jz      no_emergency
        movd    "16 ",calc_p2
        acall   comp
        compd   "GT",calc_erg_flag
        jnz     emergency_call
no_emergency:
        call    notruf_outside
        jmp     no_number
//
//*******************************************************************
// now call the emergency extension and wait for offhook.
//
emergency_call:
        movd    " Routine emergency_call enter/n",s12,0
        out     s12,0,c4
//*************************************
// go offhook
//
        movd    "                                                     /n",dtmf_str,0
        clearmfv
        offhook
        call    wait_dial_tone
//*************************************
// what code
//
test_1:
        compc   result,dial_tone
        jnz     dial_error_1
//*************************************
// dial pickup
//
        movd    "dialing dirpick/n",wstr,0
        out     wstr,0,c4
        mfvout  p_store,190     // dial dirpick
        sett    20
        wait    tf_sign
        setc    4,3             // 3 Versuche
state_1:
//*************************************
// R�ckfrage
//   do Flash
//
        clearmfv
        movd    "                                                     /n",dtmf_str,0
        movd    "make flash after dirpick/n",wstr,0
        out     wstr,0,c4
        flash_100               // R�ckfrage
//********************************
// wait for dialing code
//
        call    wait_dial_tone
//********************************
// test if dialing code
//
test_2:
        compc   result,dial_tone
        jnz     dial_error
//********************************
// code dialing tone received
//
        movs    s14,_notrufext,p_store,210,4
        call    notruf_verbinden
        movd    "dialing to emergency extension/n",wstr,0
        out     wstr,0,c4
        mfvout  p_store,210             // dial to notruf number
        clearmfv
        movd    "                                                     /n",dtmf_str,0
        setc    3,5                     // number of retrys
//*************************************
// wait for any code from VPS after dialing
//
state_2:
        call    vps_code
        compc   result,timeout
        jnz     test_3
        decc    3
        jnz     state_2
//*************************************
// if no DTMF-code received
// after 15 sec waiting - error-handling
//
        flash_100
        sett    20
        wait    tf_sign
        decc    4
        jnz     state_1
        movd    " Error on transfer to emergency extension no dialing code! VPS-Port?/n",wstr,0
        out     wstr,0,c4
//*************************************
// try to connect to TWG
//
connect_twg:
        flash_100
        sett    20
        wait    tf_sign
        jmp     state_twg_connect
//*************************************
// received a VPS-code test it
//
test_3:
        compc   result,ringback_tone
        jz      free_extension
        compc   result,busy_tone
        jz      busy_extension
        compc   result,tone_offhook
        jz      notruf_offhook
        compc   result,unobtainable_tone
        jz      busy_extension
//*************************************
// other code
//
        movd    " Undefined code:                        /n",wstr,0
        movs    dtmf_str,0,wstr,17,10
        out     wstr,0,c4
//*************************************
// try again to connect
//
try_again:
        flash_100
        movd    " Trying again !!!/n",wstr,0
        out     wstr,0,c4
        sett    20
        wait    tf_sign
        decc    4
        jnz     state_1
//*************************************
// connect to TWG
//
state_twg_connect:
        clearmfv
        movd    "                                                     /n",dtmf_str,0
        movd    " Transfer call to TWG-extension/n",wstr,0
        out     wstr,0,c4
        call    notruf_weiter
        flash_100
        call    wait_dial_tone
        compc   result,dial_tone
        jnz     dial_error
        movd    " Routine connect_twg/n",wstr,0
        out     wstr,0,c4
        movd    "         ",wstr,100
        movs    s14,_twgext,wstr,100,4           // connect to TWG from DBS 1
        mfvout  wstr,100
        clearmfv
        movd    "                                                     /n",dtmf_str,0
//
state_twg_1:
        call    wait_dial_tone
        compc   result,ringback_tone
        jz      state_twg_2
//
        movd    "Error_TWG code:                        /n",wstr,0
        movs    dtmf_str,0,wstr,17,10
        out     wstr,0,c4
        flash_100
        sett    20
        onhook
        jmp     main_start
//
state_twg_2:
        onhook
        jmp     main_start
//*************************************
// extension is free
//
free_extension:
        movd    " Extension is free wait for offhook/n",wstr,0
        out     wstr,0,c4
        setc    3,5             // wait 15 sec (5 calls of cps_code)
                                 //for offhook
free_l1_ext:
        call    vps_code
        compc   result,timeout
        jnz     test_1_free
        decc    3
        jnz     free_l1_ext
        jmp     try_again
//
test_1_free:
        compc   result,tone_offhook
        jnz     test_2_free
        jmp     notruf_offhook
//
test_2_free:
        compc   result,ringback_tone
        jz      cancel_notruf
        movd    " received on waiting for offhook/n",wstr,0
        out     wstr,0,c4
        jmp     free_l1_ext
//*************************************
//
cancel_notruf:
        onhook
        call    notruf_cancel
        movd    " Emergency call cancel/n",wstr,0
        out     wstr,0,c4
        jmp     main_start
//*************************************
// extension is busy
//
busy_extension:
        call    notruf_busy
        movd    " Extension is busy wait timeout and try again/n",wstr,0
        out     wstr,0,c4
        decc    4                       // last retry?
        jz      busy_state_1
        sett    100                     // wait 10 sec
        wait    tf_sign
busy_state_1:
        incc    4
        jmp     try_again
//
//*************************************
// Offhook notruf_extension
//
notruf_offhook:
        onhook                  // on offhook transfer call
        sett    10
        wait    tf_sign
        call    notruf_beant
        movd    " Extension offhook/n",wstr,0
        out     wstr,0,c4
        jmp     main_start
//
//*************************************
// dialing error
//
dial_error:
        flash_100
dial_error_1:
        sett    20
        wait    tf_sign
        movd    " ERROR ERROR on dialing, no dial tone/n",wstr,0
        out     wstr,0,c4
        onhook
        call    notruf_cancel
        jmp     main_start
//
//*************************************
// Subroutinen for dialing handling
//
//********************************
// wait for dialing code
//
wait_dial_tone:
        call    vps_code                // get vps_code
        compc   result,timeout
        jnz     e_wait_dial_tone
        call    vps_code                // get vps_code
        compc   result,timeout
        jnz     e_wait_dial_tone
        call    vps_code                // get code a second time
        compc   result,timeout
        jnz     e_wait_dial_tone
        movd    " Error no dial tone code found !!! VPS-Port? /n",wstr,0
        out     wstr,0,c4
e_wait_dial_tone:
        ret
//
//*********************************************************
// error keine rufnummer
//
no_number:
        movd    "keine Rufnummer oder Rufnummer nicht in DBS!!! /n",wstr,0
        out     wstr,0,c4
        movd    "AT*A/n",wstr,0
        out     wstr,0,ch2824
        sett    20
        wait    tf_sign
        movd    "AT*H/n",wstr,0
        out     wstr,0,ch2824
        jmp     main_start
//***********************************************************************
//*********************************************************
vps_code:
        setc    result,timeout
        movd    "                              /n",dtmf_str,pos_0
        sett    30                      // wait for 3 sec on dtmf
        getmfv  dtmf_str,pos_0
        jz      vps_exit
        compd   "A",dtmf_str,pos_0
        jz      state_a
        compd   "B",dtmf_str,pos_0
        jz      state_b
        compd   "C",dtmf_str,pos_0
        jz      state_c
        movd    "/n",dtmf_str,pos_1     // terminate dtmf
        setc    result,not_supported
        jmp     vps_exit
//
state_a:
        sett    15
        getmfv  dtmf_str,pos_1          // read next digit
        jz      vps_exit
        movd    "/n",dtmf_str,pos_2     // terminate dtmf
        compd   "A",dtmf_str,pos_1      // AA calling line id
        jz      state_aa
        compd   "0",dtmf_str,pos_1      // call ta aa
        jz      state_a0
        compd   "1",dtmf_str,pos_1      // fixed forwarding
        jz      state_a1
        compd   "2",dtmf_str,pos_1      // cunsult from own subset
        jz      state_a2
        compd   "3",dtmf_str,pos_1      // record online
        jz      state_a3
        compd   "4",dtmf_str,pos_1      // rrcall of aa
        jz      state_a4
        compd   "5",dtmf_str,pos_1      // forwarding on busy
        jz      state_a5
        compd   "6",dtmf_str,pos_1      // delayed forwarding
        jz      state_a6
        compd   "7",dtmf_str,pos_1      // consult_from any subset
        jz      state_a7
        compd   "8",dtmf_str,pos_1      // multi tree call to aa
        jz      state_a8
        compd   "9",dtmf_str,pos_1      // multi tree recall of aa
        jz      state_a9
        setc    result,notexist
        ret
//
state_a0:
        setc    result,call_to_aa
        jmp     vps_exit
//
state_a1:
        setc    result,fixed_forwarding
        jmp     vps_get_ext
//
state_a2:
        setc    result,consult_own_subset
        jmp     vps_get_ext
//
state_a3:
        setc    result,record_online
        jmp     vps_get_ext
//
state_a4:
        setc    result,recall_to_aa
        jmp     vps_get_ext
//
state_a5:
        setc    result,forwarding_on_busy
        jmp     vps_get_ext
//
state_a6:
        setc    result,delayed_forwarding
        jmp     vps_get_ext
//
state_a7:
        setc    result,consult_any_subset
        jmp     vps_exit
//
state_a8:
        setc    result,multi_tree_call
        jmp     vps_get_tree
//
state_a9:
        setc    result,multi_tree_recall
        jmp     vps_get_tree_ext
//
//*********************************************************
//
state_aa:
        setc    result,not_supported
        jmp     vps_exit
//
//*********************************************************
//
state_b:
        sett    15
        getmfv  dtmf_str,pos_1          // read next digit
        jz      vps_exit
        compd   "4",dtmf_str,pos_1      //
        jz      state_b4
        compd   "5",dtmf_str,pos_1      //
        jz      state_b5
        compd   "6",dtmf_str,pos_1      //
        jz      state_b6
        compd   "7",dtmf_str,pos_1      //
        jz      state_b7
        compd   "8",dtmf_str,pos_1      //
        jz      state_b8
        compd   "9",dtmf_str,pos_1      //
        jz      state_b9
        setc    result,notexist
        ret
//
state_b4:
        setc    result,forwarding_info
        movd    " Forwarding info /n",wstr,0
        jmp     vps_1exit
//
state_b5:
        setc    result,dial_tone
        movd    " Dialing tone/n",wstr,0
        jmp     vps_1exit
//
state_b6:
        setc    result,ringback_tone
        movd    " Ringback tone/n",wstr,0
        jmp     vps_1exit
//
state_b7:
        setc    result,busy_tone
        movd    " Busy tone/n",wstr,0
        jmp     vps_1exit
//
state_b8:
        setc    result,unobtainable_tone
        movd    " Unobtainable tone/n",wstr,0
        jmp     vps_1exit
//
state_b9:
        setc    result,onhook_tone
        movd    " Extension onhook/n",wstr,0
        jmp     vps_1exit
//
//*******************************************************************
state_c:
        sett    15
        getmfv  dtmf_str,pos_1          // read next digit
        jnz     state_clock
        // if timeout code offhook
        setc    result,tone_offhook     // return result
        movd    "/n",dtmf_str,pos_2
        movd    " Extension offhook/n",wstr,0
        jmp     vps_1exit
//
state_clock:
        movd    "/n",dtmf_str,pos_2
        compd   "0",dtmf_str,pos_1      // test for date_time
        jz      state_date_time
        compd   "1",dtmf_str,pos_1      // test for date_time
        jz      state_day_switch
        compd   "2",dtmf_str,pos_1      // test for date_time
        jz      state_night_switch
        setc    result,notexist
        ret
//
state_date_time:
        setc    result,date_time_dtmf
        jmp     vps_exit
//
state_day_switch:
        setc    result,day_switch
        jmp     vps_exit
//
state_night_switch:
        setc    result,night_switch
        jmp     vps_exit
//
vps_1exit:
        out     dtmf_str,0,c4
        out     wstr,0,c4
//
vps_exit:
        ret
//
//*********************************************************
// get extension number
// #define extension_length             4
//
vps_get_ext:
        setc    extension_count,extension_length
        setc    pointer_dtmf,pos_2
vps_get_loop:
        sett    15
        getmfv  dtmf_str,cpointer_dtmf
        jz      vps_get_exit
        incc    pointer_dtmf
        movd    "/n",dtmf_str,cpointer_dtmf
        decc    extension_count
        jnz     vps_get_loop
        ret
//
vps_get_exit:
        setc    0,2
        decc    0
        ret
//
//*********************************************************
// get tree number
// #define tree_length             4
//
vps_get_tree:
        setc    extension_count,tree_length
        setc    pointer_dtmf,pos_2
        jmp     vps_get_loop
//
//*********************************************************
// get tree number plus extension number
// #define tree_length             4
//
vps_get_tree_ext:
        setc    extension_count,tree_length
        setc    pointer_dtmf,pos_2
        call    vps_get_loop
        jnz     vps_get_exit
        setc    extension_count,extension_length
        jmp     vps_get_loop
//
//*********************************************************
//
//***********************************************************************

//************************************************
//
test_im_sign:
        case    im_sign,sign_err
        in      wstr,10
        compd   "init/n",wstr,10         //teste m3 configurations cmd"s
        jnz     cfg_cmd1
        ansd    "OKAY!/n"
cfg_cmd01:
        movd    "     ",p_store,200
        jmp     reset_0
//
cfg_cmd1:
cfg_cmd2:
        compd   "set",wstr,10
        jnz     cfg_cmd3
        call    cmd_set
        anss    wstr,10
        jmp     main_start
        //
cfg_cmd3:
        compd   "disp hist ",wstr,10
        jnz     cfg_cmd4
        call    disp_history
        jmp     main_start
        //
cfg_cmd4:
        compd   "disp config",wstr,10
        jnz     cfg_cmde
        call    disp_config
        jmp     main_start
        //
cfg_cmde:
        out     wstr,0,c4
        movd    "ERR_CMD/n",wstr,11
        out     s12,0,c4
        anss    s12,10
        jmp     main_start
        //
//************************************************
//
//   sign-error
//
sign_err:
        movd    " SIGNAL_ERROR/n",wstr,11
        out     wstr,0,c4
        jmp     main_start
//
//************************************************
// subroutinen
//
notruf_akti:
        call    set_nstr_1
        movd    "**** Alarmentgegennahme                                       /n",print2,0
        call    set_nstdef_str
        call    send_start
        call    print_out
        call    write_hist
        ret
//
notruf_verbinden:
        call    set_nstr_1
        movd    "**** Verbinde zu:                                             /n",print2,0
        movs    s14,_notrufext,print2,20,4
        call    set_nstdef_str
        call    send_start
        call    print_out
        call    write_hist
        ret
//
notruf_beant:
        call    set_nstr_1
        movd    "**** Verbunden mit:                                           /n",print2,0
        movs    s14,_notrufext,print2,20,4
        call    set_nstdef_str
        call    send_stop
        call    print_out
        call    write_hist
        ret
//
notruf_weiter:
        call    set_nstr_1
        movd    "**** weitergeleitet zu Alarmk.:                               /n",print2,0
        movs    s14,_twgext,print2,32,4
        call    set_nstdef_str
        call    send_stop
        call    print_out
        call    write_hist
        ret
//
notruf_busy:
        call    set_nstr_1
        movd    "**** Nebenstelle besetzt:                                     /n",print2,0
        movs    s14,_notrufext,print2,26,4
        call    set_nstdef_str
        call    send_start
        call    print_out
        call    write_hist
        ret
//
notruf_cancel:
        call    set_nstr_1
        movd    "**** Notrufnebenstelle hat aufgelegt                          /n",print2,0
        call    set_nstdef_str
        call    send_stop
        call    print_out
        call    write_hist
        ret
//
notruf_outside:
        call    set_nstr_1
        movd    "**** abgehoben auáerhalb 7 - 17 Uhr                           /n",print2,0
        call    set_nstdef_str
        call    send_stop
        call    print_out
        call    write_hist
        ret
//
//******************************************************
//
set_nstr_1:
        compd   "P",s14,_flag
        jnz     testing_H
        movd    "**** Polizei-Notruf             von:                                      /n",print2,100
        ret
//
testing_h:
        compd   "H",s14,_flag
        jnz     testing_t
        movd    "**** Alarm Apparat              von:                                      /n",print2,100
        ret
//
testing_t:
        movd    "**** Alarm Raum�berwachung      von:                                      /n",print2,100
        ret
//
//*********************************************************
//
set_nstdef_str:
        movd    "**************************************** LFD NR.:        *****/n",print1,100
        movs    p_store,0,print2,137,4        // extension #
        movs    s14,_name,print2,142,16       // extension name
        acall   fread_dt
        movs    s15,150,print2,41,23
        ret
//
//*********************************************************
//
notruf_reset:
        movd    "**** NOTRUF  message                                                      /n",print2,100
        movd    "**** SYSTEM RESET  *****                                      /n",print2,0
        movd    "**************************************** LFD NR.:        *****/n",print1,100
        acall   fread_dt
        movs    s15,150,print2,41,23
        call    send_stop
        call    print_out
        call    write_hist
        ret
//
//*********************************************************
//
pr_2824err:
        movd    "**** NOTRUF  message                                                      /n",print2,100
        movd    "**** Error keine Verbindung mit 2824 **                                   /n",print2,0
        movd    "**************************************** LFD NR.:        *****/n",print1,100
        acall   fread_dt
        movs    s15,150,print2,41,23
        call    send_stop
        call    print_out
        call    write_hist
        ret
//
print_out:
        movc    5,print1,150               //setup lfd nr
        incc    5
        out     print2,100,c4              //header to sn-mon
        out     print2,100,c5              //header to printer
        out     print2,0,c4                //message
        out     print2,0,c5
        out     print1,100,c4
        out     print1,100,c5
        out     print2,70,c5               //lf to printer
        writeb  print2,100,1
        writeb  print2,100,2
        writeb  print2,0,1
        writeb  print2,0,2
        writeb  print1,100,1
        writeb  print1,100,2
        writeb  print2,70,1
        writeb  print2,70,2
        sendsig ans_sign,c1
        sendsig ans_sign,c2
        ret
//
//**********************************************************
//
send_start:
        movd    "START/n",print2,200
        writeb  print2,200,1
        writeb  print2,200,2
        out     print2,200,c4
        ret
//
//**********************************************************
//
send_stop:
        movd    "STOP/n",print2,200
        writeb  print2,200,1
        writeb  print2,200,2
        out     print2,200,c4
        ret
//
//**********************************************************
//
write_hist:
        writeb  print2,100,0
        jz      wr_hist1
        readb   wstr,11,0
        jmp     write_hist
wr_hist1:
        writeb  print2,0,0
        jz      wr_hist2
        readb   wstr,11,0
        jmp     wr_hist1
wr_hist2:
        writeb  print1,100,0
        jz      wr_hist3
        readb   wstr,11,0
        jmp     wr_hist2
wr_hist3:
        ret
//
//**********************************************************
//
time_min:
        acall   read_dt
        movd    "       ",s15,210       //p1 loeschen
        movs    s15,188,s15,210,2       //Stunden in min umrechnen
        movd    "60 ",s15,220
        acall   mul
        movs    s15,190,s15,210,2       //minuten
        movs    s15,230,s15,220,8
        acall   add                     //min + stunde x 60
//
//       save result in string AKTUT s14,230
//
        movs    s15,233,s14,230,6
        ret
//
//**********************************************************
// calculate time out
//
//calc_timeout:
        movs    s14,230,s15,210,6        //calculate timeout mov aktime
        movs    p_store,230,s15,220,4
	acall	add
        movs    s15,233,s14,240,6
        movs    s15,233,s15,210,6       //calc max minute
        movd    "1440 ",s15,220
        acall   comp
        compd   "LT",s15,204
        jz      calc_end_to
        movs    s14,240,s15,210,6
        movd    "1440 ",s15,220
        acall   subb
        movs    s15,233,s14,240,6
//
calc_end_to:
        ret
//**********************************************************
//
disp_config:
        ansd    " CONFIGURATION !/n"
        movd    "                                /n",wstr,100
        movd    " NOTRUF Nst# =                  /n",wstr,100
        movs    p_store,210,wstr,124,6
        out     wstr,100,c4
//
        movd    " NUMBER of LF =                 /n",wstr,100
        movs    p_store,220,wstr,124,6
        out     wstr,100,c4
//
        movd    " CLEAR TIMEOUT =                /n",wstr,100
        movs    p_store,230,wstr,124,6
        out     wstr,100,c4
//
        movd    " CLEAR CODE =                   /n",wstr,100
        movs    p_store,240,wstr,124,6
        out     wstr,100,c4
//
        movd    " AKTUELLE ZEIT =                /n",wstr,100
        movs    s14,230,wstr,124,6
        out     wstr,100,c4
//
        movd    " NEXT =                            /n",wstr,100
        movs    s14,181,wstr,124,10
        out     wstr,100,c4
//
        movd    " DIR-PICK   =                   /n",wstr,100
        movs    p_store,190,wstr,124,6
        out     wstr,100,c4
//
//
        ret
//
//************************************************
//
// command set
//
cmd_set:
        compd   "num=",wstr,14
        jnz     cmd_set1
        movs    wstr,18,p_store,210,8
        jmp     okay_set
//
cmd_set1:
        compd   "lf=",wstr,14
        jnz     cmd_set2
        movs    wstr,17,p_store,220,8
        jmp     okay_set
//
cmd_set2:
        compd   "to=",wstr,14
        jnz     cmd_set3
        movs    wstr,17,p_store,230,8
        jmp     okay_set
//
cmd_set3:
        compd   "clcode=",wstr,14
        jnz     cmd_set4
        movs    wstr,21,p_store,240,8
        jmp     okay_set
//
cmd_set4:
        compd   "dirpick=",wstr,14
        jnz     cmd_set5
        movs    wstr,22,p_store,190,8
        jmp     okay_set
//
cmd_set5:
        movd    "ERR_CMD/n",wstr,10
        ret
okay_set:
        movd    "OKAY!/n",wstr,10
        ret
//
//************************************************
//RETURN Z
//    using counter 15 for generall working
z_ret:
	setc	15,255
	incc	15
	ret
//
nz_ret:
	setc	15,0
	incc	15
	ret
//
//**********************************************************
//
send_sit:
          sett  10
          wait  tf_sign
          setp  mfv,f1
          sett  4
          wait  tf_sign
          setp  mfv,f4
          sett  4
          wait  tf_sign
          setp  mfv,f7
          sett  4
          wait  tf_sign
          setp  mfv,off
          ret
//
//**********************************************************
//
send_quit:
          sett  5
          wait  tf_sign
          setp  mfv,f4
          sett  5
          wait  tf_sign
          setp  mfv,off
          sett  5
          wait  tf_sign
          setp  mfv,f4
          sett  5
          wait  tf_sign
          setp  mfv,off
          ret
//
//*********************************************************
//
send_akntone:
           setp mfv,f7
           sett 4
	   wait  tf_sign
	   setp mfv,off
           sett 4
	   wait  tf_sign
	   setp mfv,f7
           sett 4
	   wait  tf_sign
           ret
//
//*********************************************************
//
//
disp_history:
        movc    wstr,20,6
        compc   6,0
        jnz     dh_loop
        setc    6,10
//
dh_loop:
        readb   wstr,10,0
        jz      dh_emty
        out     wstr,10,c4
        decc    6
        jnz     dh_loop
        ansd    "MORE data/n"
        ret
//
dh_emty:
        ansd    "HISTORY BUFFER EMTY!/n"
        ret
//
//************************************************
// Buffer 0 init
//
// Aufruf:       call    Init_b0
//
init_b0:
        setp    0XD300,badr_0_high      //beginn adresse high
        setp    0XD301,0x00             //beginn adresse low
//
        setp    0Xd302,lbuff_0_high     //bufferlaenge high
        setp    0XD303,0x00             //bufferlaenge low
//
        setp    0Xd304,lbuff_0_high     //anzahl bytes free high
        setp    0XD305,0x00             //anzahl bytes free low
//
        setp    0Xd306,badr_0_high      //input zeiger high
        setp    0XD307,0x00             //input zeiger low
//
        setp    0Xd308,lbuff_0_high     //input laenge bis bufferende high
        setp    0XD309,0x00             //input laenge bis bufferende low
//
        setp    0Xd30A,badr_0_high      //output zeiger high
        setp    0XD30B,0x00             //output zeiger low
//
        setp    0Xd30C,lbuff_0_high     //output laenge bis bufferende high
        setp    0XD30D,0x00             //output laenge bis bufferende low
//
        setp    0XD30E,modnum_0         //modulnummer falls in modulmem
//
        ret
//
//************************************************
// Buffer 1 init
//
// Aufruf:       call    Init_b1
//
init_b1:
        setp    0Xd310,badr_1_high      //beginn adresse high
        setp    0Xd311,0x00             //beginn adresse low
//
        setp    0Xd312,lbuff_1_high     //bufferlaenge high
        setp    0Xd313,0x00             //bufferlaenge low
//
        setp    0Xd314,lbuff_1_high     //anzahl bytes free high
        setp    0Xd315,0x00             //anzahl bytes free low
//
        setp    0Xd316,badr_1_high      //input zeiger high
        setp    0Xd317,0x00             //input zeiger low
//
        setp    0Xd318,lbuff_1_high     //input laenge bis bufferende high
        setp    0Xd319,0x00             //input laenge bis bufferende low
//
        setp    0Xd31A,badr_1_high      //output zeiger high
        setp    0Xd31B,0x00             //output zeiger low
//
        setp    0Xd31C,lbuff_1_high     //output laenge bis bufferende high
        setp    0Xd31D,0x00             //output laenge bis bufferende low
//
        setp    0Xd31E,modnum_1         //modulnummer falls in modulmem
//
        ret
//
//************************************************
// Buffer 2 init
//
// Aufruf:       call    Init_b2
//
init_b2:
        setp    0Xd320,badr_2_high      //beginn adresse high
        setp    0Xd321,0x00             //beginn adresse low
//
        setp    0Xd322,lbuff_2_high     //bufferlaenge high
        setp    0Xd323,0x00             //bufferlaenge low
//
        setp    0Xd324,lbuff_2_high     //anzahl bytes free high
        setp    0Xd325,0x00             //anzahl bytes free low
//
        setp    0Xd326,badr_2_high      //input zeiger high
        setp    0Xd327,0x00             //input zeiger low
//
        setp    0Xd328,lbuff_2_high     //input laenge bis bufferende high
        setp    0Xd329,0x00             //input laenge bis bufferende low
//
        setp    0Xd32A,badr_2_high      //output zeiger high
        setp    0Xd32B,0x00             //output zeiger low
//
        setp    0Xd32C,lbuff_2_high     //output laenge bis bufferende high
        setp    0Xd32D,0x00             //output laenge bis bufferende low
//
        setp    0Xd32E,modnum_2         //modulnummer falls in modulmem
//
        ret
//
/************************************************************************
//************************************************
// Buffer 3 init
//
// Aufruf:       call    Init_b3
//
init_b3:
        setp    0Xd330,badr_3_high      //beginn adresse high
        setp    0Xd331,0x00             //beginn adresse low
//
        setp    0Xd332,lbuff_3_high     //bufferlaenge high
        setp    0Xd333,0x00             //bufferlaenge low
//
        setp    0Xd334,lbuff_3_high     //anzahl bytes free high
        setp    0Xd335,0x00             //anzahl bytes free low
//
        setp    0Xd336,badr_3_high      //input zeiger high
        setp    0Xd337,0x00             //input zeiger low
//
        setp    0Xd338,lbuff_3_high     //input laenge bis bufferende high
        setp    0Xd339,0x00             //input laenge bis bufferende low
//
        setp    0Xd33A,badr_3_high      //output zeiger high
        setp    0Xd33B,0x00             //output zeiger low
//
        setp    0Xd33C,lbuff_3_high     //output laenge bis bufferende high
        setp    0Xd33D,0x00             //output laenge bis bufferende low
//
        setp    0Xd33E,modnum_3         //modulnummer falls in modulmem
//
        ret
//
***********************************************************************/
init_dbs2:
movd    "2 16384 400 5 4 4 4 1 16  ",s15,100
acall	open_dbs
movd    "                                 ",s14,0
acall	init_dbs
acall	pfirst_dbs
;
; Tabelle fuer Taster und Hoerer
;      A_Nr Ausgangsnummer von Taste oder Telefon
;      |   Z_Nr Zielnummer zur Signalisierung
;      |   |   K_Nr Kontaktnummer fuer Waehlgeraet
;      |   |   |   ? T=Taste H=Hoerer P=Polizeinottaste
;      |   |   |   |
;
; Taste Polizeinotruf
;
;      A_NrZ_NrK_Nr?<NAME16digit   >
movd  "271627402723P Teilnehmer 001 ",s14,0
call  dbs_write
movd  "271727402723P Teilnehmer 002 ",s14,0
call  dbs_write
movd  "271827402723P Teilnehmer 003 ",s14,0
call  dbs_write
movd  "271927402723P Teilnehmer 004 ",s14,0
call  dbs_write
movd  "272027402723P Teilnehmer 005 ",s14,0
call  dbs_write
movd  "272127402723P Teilnehmer 006 ",s14,0
call  dbs_write
movd  "272627402723P Teilnehmer 007 ",s14,0
call  dbs_write
;
; Taste Alarm mit Mikrofon
;      A_NrZ_NrK_Nr?<NAME16digit   >
movd  "270027412723T Teilnehmer 008 ",s14,0
call  dbs_write
movd  "270127412723T Teilnehmer 009 ",s14,0
call  dbs_write
movd  "270227412723T Teilnehmer 010 ",s14,0
call  dbs_write
movd  "270327412723T Teilnehmer 011 ",s14,0
call  dbs_write
movd  "270427412723T Teilnehmer 012 ",s14,0
call  dbs_write
movd  "270527412723T Teilnehmer 013 ",s14,0
call  dbs_write
movd  "270627412723T Teilnehmer 014 ",s14,0
call  dbs_write
movd  "270727412723T Teilnehmer 015 ",s14,0
call  dbs_write
movd  "270827412723T Teilnehmer 016 ",s14,0
call  dbs_write
movd  "270927412723T Teilnehmer 017 ",s14,0
call  dbs_write
movd  "271027412723T Teilnehmer 018 ",s14,0
call  dbs_write
movd  "271127412723T Teilnehmer 019 ",s14,0
call  dbs_write
movd  "271227412723T Teilnehmer 020 ",s14,0
call  dbs_write
movd  "271327412723T Teilnehmer 021 ",s14,0
call  dbs_write
movd  "271427412723T Teilnehmer 022 ",s14,0
call  dbs_write
movd  "271527412723T Teilnehmer 023 ",s14,0
call  dbs_write
;
;
;Hoerer Imbergstrasse
;
;      A_NrZ_NrK_Nr?<NAME16digit   >
movd  "121927342724H Teilnehmer 024 ",s14,0
call  dbs_write
movd  "122127342724H Teilnehmer 025 ",s14,0
call  dbs_write
movd  "122327342724H Teilnehmer 026 ",s14,0
call  dbs_write
movd  "122427342724H Teilnehmer 027 ",s14,0
call  dbs_write
movd  "122527342724H Teilnehmer 028 ",s14,0
call  dbs_write
movd  "122627342724H Teilnehmer 029 ",s14,0
call  dbs_write
movd  "122827342724H Teilnehmer 030 ",s14,0
call  dbs_write
movd  "122927342724H Teilnehmer 031 ",s14,0
call  dbs_write
movd  "157527342724H Teilnehmer 032 ",s14,0
call  dbs_write
;Hoerer Kajetanerplatz
;
;      A_NrZ_NrK_Nr?<NAME16digit   >
movd  "120027302722H                ",s14,0
call  dbs_write
movd  "120227302722H                ",s14,0
call  dbs_write
movd  "120327302722H                ",s14,0
call  dbs_write
movd  "120427302722H                ",s14,0
call  dbs_write
movd  "120527302722H                ",s14,0
call  dbs_write
movd  "120627302722H                ",s14,0
call  dbs_write
movd  "120727302722H                ",s14,0
call  dbs_write
movd  "120827302722H                ",s14,0
call  dbs_write
movd  "120927302722H                ",s14,0
call  dbs_write
movd  "121027302722H                ",s14,0
call  dbs_write
movd  "121127302722H                ",s14,0
call  dbs_write
movd  "121227302722H                ",s14,0
call  dbs_write
movd  "121627302722H                ",s14,0
call  dbs_write
movd  "121727302722H                ",s14,0
call  dbs_write
movd  "122027302722H                ",s14,0
call  dbs_write
movd  "122727302722H                ",s14,0
call  dbs_write
movd  "123027302722H                ",s14,0
call  dbs_write
movd  "123127302722H                ",s14,0
call  dbs_write
movd  "123227302722H                ",s14,0
call  dbs_write
movd  "123327302722H                ",s14,0
call  dbs_write
movd  "123427302722H                ",s14,0
call  dbs_write
movd  "123527302722H                ",s14,0
call  dbs_write
movd  "123627302722H                ",s14,0
call  dbs_write
movd  "123727302722H                ",s14,0
call  dbs_write
movd  "123927302722H                ",s14,0
call  dbs_write
movd  "124027302722H                ",s14,0
call  dbs_write
movd  "124127302722H                ",s14,0
call  dbs_write
movd  "124327302722H                ",s14,0
call  dbs_write
movd  "124427302722H                ",s14,0
call  dbs_write
movd  "124527302722H                ",s14,0
call  dbs_write
movd  "124627302722H                ",s14,0
call  dbs_write
movd  "124727302722H                ",s14,0
call  dbs_write
movd  "124827302722H                ",s14,0
call  dbs_write
movd  "124927302722H                ",s14,0
call  dbs_write
movd  "125027302722H                ",s14,0
call  dbs_write
movd  "125127302722H                ",s14,0
call  dbs_write
movd  "125227302722H                ",s14,0
call  dbs_write
movd  "125327302722H                ",s14,0
call  dbs_write
movd  "125427302722H                ",s14,0
call  dbs_write
movd  "125527302722H                ",s14,0
call  dbs_write
movd  "125627302722H                ",s14,0
call  dbs_write
movd  "125727302722H                ",s14,0
call  dbs_write
movd  "125827302722H                ",s14,0
call  dbs_write
movd  "125927302722H                ",s14,0
call  dbs_write
movd  "126127302722H                ",s14,0
call  dbs_write
movd  "126227302722H                ",s14,0
call  dbs_write
movd  "126327302722H                ",s14,0
call  dbs_write
movd  "126427302722H                ",s14,0
call  dbs_write
movd  "126527302722H                ",s14,0
call  dbs_write
movd  "126627302722H                ",s14,0
call  dbs_write
movd  "126727302722H                ",s14,0
call  dbs_write
movd  "126827302722H                ",s14,0
call  dbs_write
movd  "127027302722H                ",s14,0
call  dbs_write
movd  "127127302722H                ",s14,0
call  dbs_write
movd  "127227302722H                ",s14,0
call  dbs_write
movd  "127327302722H                ",s14,0
call  dbs_write
movd  "127427302722H                ",s14,0
call  dbs_write
movd  "127527302722H                ",s14,0
call  dbs_write
movd  "127627302722H                ",s14,0
call  dbs_write
movd  "127727302722H                ",s14,0
call  dbs_write
movd  "127827302722H                ",s14,0
call  dbs_write
movd  "127927302722H                ",s14,0
call  dbs_write
movd  "128027302722H                ",s14,0
call  dbs_write
movd  "128127302722H                ",s14,0
call  dbs_write
movd  "128227302722H                ",s14,0
call  dbs_write
movd  "128327302722H                ",s14,0
call  dbs_write
movd  "128827302722H                ",s14,0
call  dbs_write
movd  "128927302722H                ",s14,0
call  dbs_write
movd  "129027302722H                ",s14,0
call  dbs_write
movd  "129127302722H                ",s14,0
call  dbs_write
movd  "129227302722H                ",s14,0
call  dbs_write
movd  "129527302722H                ",s14,0
call  dbs_write
movd  "129827302722H                ",s14,0
call  dbs_write
movd  "130127302722H                ",s14,0
call  dbs_write
movd  "130227302722H                ",s14,0
call  dbs_write
movd  "130327302722H                ",s14,0
call  dbs_write
movd  "130427302722H                ",s14,0
call  dbs_write
movd  "130527302722H                ",s14,0
call  dbs_write
movd  "130627302722H                ",s14,0
call  dbs_write
movd  "130727302722H                ",s14,0
call  dbs_write
movd  "130827302722H                ",s14,0
call  dbs_write
movd  "130927302722H                ",s14,0
call  dbs_write
movd  "131027302722H                ",s14,0
call  dbs_write
movd  "131127302722H                ",s14,0
call  dbs_write
movd  "131227302722H                ",s14,0
call  dbs_write
movd  "131327302722H                ",s14,0
call  dbs_write
movd  "131427302722H                ",s14,0
call  dbs_write
movd  "132927302722H                ",s14,0
call  dbs_write
movd  "136827302722H                ",s14,0
call  dbs_write
movd  "150027302722H                ",s14,0
call  dbs_write
movd  "150327302722H                ",s14,0
call  dbs_write
movd  "150427302722H                ",s14,0
call  dbs_write
movd  "150927302722H                ",s14,0
call  dbs_write
movd  "151027302722H                ",s14,0
call  dbs_write
movd  "151127302722H                ",s14,0
call  dbs_write
movd  "151227302722H                ",s14,0
call  dbs_write
movd  "151327302722H                ",s14,0
call  dbs_write
movd  "151427302722H                ",s14,0
call  dbs_write
movd  "151527302722H                ",s14,0
call  dbs_write
movd  "151627302722H                ",s14,0
call  dbs_write
movd  "151727302722H                ",s14,0
call  dbs_write
movd  "151827302722H                ",s14,0
call  dbs_write
movd  "151927302722H                ",s14,0
call  dbs_write
movd  "152127302722H                ",s14,0
call  dbs_write
movd  "152227302722H                ",s14,0
call  dbs_write
movd  "152327302722H                ",s14,0
call  dbs_write
movd  "152427302722H                ",s14,0
call  dbs_write
movd  "152627302722H                ",s14,0
call  dbs_write
movd  "152727302722H                ",s14,0
call  dbs_write
movd  "152827302722H                ",s14,0
call  dbs_write
movd  "152927302722H                ",s14,0
call  dbs_write
movd  "153027302722H                ",s14,0
call  dbs_write
movd  "153127302722H                ",s14,0
call  dbs_write
movd  "153227302722H                ",s14,0
call  dbs_write
movd  "153327302722H                ",s14,0
call  dbs_write
movd  "153427302722H                ",s14,0
call  dbs_write
movd  "153527302722H                ",s14,0
call  dbs_write
movd  "153627302722H                ",s14,0
call  dbs_write
movd  "153827302722H                ",s14,0
call  dbs_write
movd  "153927302722H                ",s14,0
call  dbs_write
movd  "154127302722H                ",s14,0
call  dbs_write
movd  "154227302722H                ",s14,0
call  dbs_write
movd  "154327302722H                ",s14,0
call  dbs_write
movd  "154427302722H                ",s14,0
call  dbs_write
movd  "154527302722H                ",s14,0
call  dbs_write
movd  "154627302722H                ",s14,0
call  dbs_write
movd  "154727302722H                ",s14,0
call  dbs_write
movd  "154827302722H                ",s14,0
call  dbs_write
movd  "154927302722H                ",s14,0
call  dbs_write
movd  "155127302722H                ",s14,0
call  dbs_write
movd  "155427302722H                ",s14,0
call  dbs_write
movd  "155527302722H                ",s14,0
call  dbs_write
movd  "155627302722H                ",s14,0
call  dbs_write
movd  "155727302722H                ",s14,0
call  dbs_write
movd  "155827302722H                ",s14,0
call  dbs_write
movd  "155927302722H                ",s14,0
call  dbs_write
movd  "156027302722H                ",s14,0
call  dbs_write
movd  "156227302722H                ",s14,0
call  dbs_write
movd  "156327302722H                ",s14,0
call  dbs_write
movd  "156427302722H                ",s14,0
call  dbs_write
movd  "156527302722H                ",s14,0
call  dbs_write
movd  "156627302722H                ",s14,0
call  dbs_write
movd  "156727302722H                ",s14,0
call  dbs_write
movd  "156827302722H                ",s14,0
call  dbs_write
movd  "157727302722H                ",s14,0
call  dbs_write
movd  "157827302722H                ",s14,0
call  dbs_write
movd  "157927302722H                ",s14,0
call  dbs_write
movd  "158027302722H                ",s14,0
call  dbs_write
movd  "158127302722H                ",s14,0
call  dbs_write
movd  "158227302722H                ",s14,0
call  dbs_write
movd  "158327302722H                ",s14,0
call  dbs_write
movd  "158427302722H                ",s14,0
call  dbs_write
movd  "158527302722H                ",s14,0
call  dbs_write
movd  "158627302722H                ",s14,0
call  dbs_write
movd  "158727302722H                ",s14,0
call  dbs_write
movd  "158827302722H                ",s14,0
call  dbs_write
movd  "158927302722H                ",s14,0
call  dbs_write
movd  "159027302722H                ",s14,0
call  dbs_write
movd  "159127302722H                ",s14,0
call  dbs_write
movd  "159227302722H                ",s14,0
call  dbs_write
movd  "159327302722H                ",s14,0
call  dbs_write
movd  "159427302722H                ",s14,0
call  dbs_write
movd  "159527302722H                ",s14,0
call  dbs_write
movd  "159927302722H                ",s14,0
call  dbs_write
movd  "160127302722H                ",s14,0
call  dbs_write
movd  "160227302722H                ",s14,0
call  dbs_write
movd  "160327302722H                ",s14,0
call  dbs_write
movd  "160427302722H                ",s14,0
call  dbs_write
movd  "160527302722H                ",s14,0
call  dbs_write
movd  "160627302722H                ",s14,0
call  dbs_write
movd  "160827302722H                ",s14,0
call  dbs_write
movd  "160927302722H                ",s14,0
call  dbs_write
movd  "161027302722H                ",s14,0
call  dbs_write
movd  "161527302722H                ",s14,0
call  dbs_write
movd  "161627302722H                ",s14,0
call  dbs_write
movd  "161727302722H                ",s14,0
call  dbs_write
movd  "161827302722H                ",s14,0
call  dbs_write
movd  "161927302722H                ",s14,0
call  dbs_write
movd  "162027302722H                ",s14,0
call  dbs_write
movd  "170027302722H                ",s14,0
call  dbs_write
movd  "230027302722H                ",s14,0
call  dbs_write
movd  "230127302722H                ",s14,0
call  dbs_write
movd  "230227302722H                ",s14,0
call  dbs_write
movd  "230327302722H                ",s14,0
call  dbs_write
movd  "230527302722H                ",s14,0
call  dbs_write
movd  "230627302722H                ",s14,0
call  dbs_write
movd  "230727302722H                ",s14,0
call  dbs_write
movd  "230827302722H                ",s14,0
call  dbs_write
movd  "230927302722H                ",s14,0
call  dbs_write
movd  "231027302722H                ",s14,0
call  dbs_write
movd  "231127302722H                ",s14,0
call  dbs_write
movd  "231227302722H                ",s14,0
call  dbs_write
movd  "231327302722H                ",s14,0
call  dbs_write
movd  "231527302722H                ",s14,0
call  dbs_write
movd  "231627302722H                ",s14,0
call  dbs_write
movd  "231727302722H                ",s14,0
call  dbs_write
movd  "231827302722H                ",s14,0
call  dbs_write
movd  "231927302722H                ",s14,0
call  dbs_write
movd  "232027302722H                ",s14,0
call  dbs_write
movd  "232127302722H                ",s14,0
call  dbs_write
movd  "232227302722H                ",s14,0
call  dbs_write
movd  "232327302722H                ",s14,0
call  dbs_write
movd  "232427302722H                ",s14,0
call  dbs_write
movd  "232627302722H                ",s14,0
call  dbs_write
movd  "232727302722H                ",s14,0
call  dbs_write
movd  "232827302722H                ",s14,0
call  dbs_write
movd  "233027302722H                ",s14,0
call  dbs_write
movd  "233127302722H                ",s14,0
call  dbs_write
movd  "233427302722H                ",s14,0
call  dbs_write
movd  "233527302722H                ",s14,0
call  dbs_write
movd  "233627302722H                ",s14,0
call  dbs_write
movd  "233727302722H                ",s14,0
call  dbs_write
movd  "233827302722H                ",s14,0
call  dbs_write
movd  "233927302722H                ",s14,0
call  dbs_write
movd  "234027302722H                ",s14,0
call  dbs_write
movd  "234127302722H                ",s14,0
call  dbs_write
movd  "234227302722H                ",s14,0
call  dbs_write
movd  "234327302722H                ",s14,0
call  dbs_write
movd  "234427302722H                ",s14,0
call  dbs_write
movd  "234527302722H                ",s14,0
call  dbs_write
movd  "234627302722H                ",s14,0
call  dbs_write
movd  "234727302722H                ",s14,0
call  dbs_write
movd  "234927302722H                ",s14,0
call  dbs_write
movd  "235007302722H                ",s14,0
call  dbs_write
movd  "235127302722H                ",s14,0
call  dbs_write
movd  "235227302722H                ",s14,0
call  dbs_write
movd  "235327302722H                ",s14,0
call  dbs_write
movd  "235427302722H                ",s14,0
call  dbs_write
movd  "235527302722H                ",s14,0
call  dbs_write
movd  "235627302722H                ",s14,0
call  dbs_write
movd  "236027302722H                ",s14,0
call  dbs_write
movd  "236127302722H                ",s14,0
call  dbs_write
movd  "236227302722H                ",s14,0
call  dbs_write
movd  "236327302722H                ",s14,0
call  dbs_write
movd  "236427302722H                ",s14,0
call  dbs_write
movd  "236527302722H                ",s14,0
call  dbs_write
movd  "236627302722H                ",s14,0
call  dbs_write
movd  "236727302722H                ",s14,0
call  dbs_write
movd  "237027302722H                ",s14,0
call  dbs_write
movd  "237127302722H                ",s14,0
call  dbs_write
movd  "237427302722H                ",s14,0
call  dbs_write
movd  "237627302722H                ",s14,0
call  dbs_write
movd  "238027302722H                ",s14,0
call  dbs_write
movd  "238427302722H                ",s14,0
call  dbs_write
movd  "239527302722H                ",s14,0
call  dbs_write
movd  "239727302722H                ",s14,0
call  dbs_write
movd  "239927302722H                ",s14,0
call  dbs_write
movd  "240127302722H                ",s14,0
call  dbs_write
movd  "240227302722H                ",s14,0
call  dbs_write
movd  "240427302722H                ",s14,0
call  dbs_write
movd  "240527302722H                ",s14,0
call  dbs_write
movd  "240627302722H                ",s14,0
call  dbs_write
movd  "240727302722H                ",s14,0
call  dbs_write
movd  "240827302722H                ",s14,0
call  dbs_write
movd  "240927302722H                ",s14,0
call  dbs_write
movd  "241027302722H                ",s14,0
call  dbs_write
movd  "241127302722H                ",s14,0
call  dbs_write
movd  "241227302722H                ",s14,0
call  dbs_write
movd  "241327302722H                ",s14,0
call  dbs_write
movd  "241427302722H                ",s14,0
call  dbs_write
movd  "241527302722H                ",s14,0
call  dbs_write
movd  "241827302722H                ",s14,0
call  dbs_write
movd  "241927302722H                ",s14,0
call  dbs_write
movd  "242027302722H                ",s14,0
call  dbs_write
movd  "242127302722H                ",s14,0
call  dbs_write
movd  "242227302722H                ",s14,0
call  dbs_write
movd  "242327302722H                ",s14,0
call  dbs_write
movd  "242427302722H                ",s14,0
call  dbs_write
movd  "242527302722H                ",s14,0
call  dbs_write
movd  "242627302722H                ",s14,0
call  dbs_write
movd  "242727302722H                ",s14,0
call  dbs_write
movd  "242827302722H                ",s14,0
call  dbs_write
movd  "242927302722H                ",s14,0
call  dbs_write
movd  "243027302722H                ",s14,0
call  dbs_write
movd  "243127302722H                ",s14,0
call  dbs_write
movd  "243227302722H                ",s14,0
call  dbs_write
movd  "243327302722H                ",s14,0
call  dbs_write
movd  "243427302722H                ",s14,0
call  dbs_write
movd  "243927302722H                ",s14,0
call  dbs_write
movd  "244027302722H                ",s14,0
call  dbs_write
movd  "244127302722H                ",s14,0
call  dbs_write
movd  "347127302722H                ",s14,0
call  dbs_write
movd  "347227302722H                ",s14,0
call  dbs_write
movd  "347327302722H                ",s14,0
call  dbs_write
movd  "347427302722H                ",s14,0
call  dbs_write
movd  "347527302722H                ",s14,0
call  dbs_write
movd  "347627302722H                ",s14,0
call  dbs_write
movd  "347727302722H                ",s14,0
call  dbs_write
movd  "347827302722H                ",s14,0
call  dbs_write
movd  "347927302722H                ",s14,0
call  dbs_write
movd  "348027302722H                ",s14,0
call  dbs_write
movd  "348127302722H                ",s14,0
call  dbs_write
movd  "348227302722H                ",s14,0
call  dbs_write
movd  "348327302722H                ",s14,0
call  dbs_write
movd  "348427302722H                ",s14,0
call  dbs_write
movd  "349127302722H                ",s14,0
call  dbs_write
movd  "349227302722H                ",s14,0
call  dbs_write
movd  "349327302722H                ",s14,0
call  dbs_write
movd  "349427302722H                ",s14,0
call  dbs_write
movd  "349527302722H                ",s14,0
call  dbs_write
movd  "349627302722H                ",s14,0
call  dbs_write
movd  "349727302722H                ",s14,0
call  dbs_write
movd  "349827302722H                ",s14,0
call  dbs_write
;
ret
;
dbs_write:
acall	write_dbs
acall	pnext_dbs
jz      dbs_wr_ok
movd    "Runtime-error DBS3 too small!!/n",s14,100
out     s14,100,c4
dbs_wr_ok:
ret
//
zzz:
//
end
