


























































































setbaud 1,9600,8,n,1
setp    0x7f02,0x01
mode_reco
setc    0,0
setc    1,0
setc    2,0
setc    3,0
setc    4,0
setc    5,0
setc    6,0
setc    6,10
call    init_b0

loop_start:
buffrd  s2,0            
compd   "E/n",s2,0
jnz     loop_start

movd    "                                        /n",0xd100,0
movd    "                                        /n",0xd140,0
movd    "0",0xd480,0



setl    8,2
movd    " Alcatel UA-SET (4034) SCHALTUHR V2.0 ***/n",s2,100
out     s2,100,c4
movd    " by HOERHAGER JOSEF AOHE                                 06//98/n",s2,100
out     s2,100,c4
movd    " Modul 0 Ready for working !/l/n",s2,100
out     s2,100,c4
;
err_main:
setl    15,2
movd    " Wait for init UA-Subset!/n",s2,100
out     s2,100,c4
sett    250

err_main_wait:
movd    "@",0xd460,0
wait    tf_sign,cntl_sign
case    tf_sign,test1_cntl
movd    "/l  ERROR no UA-Subset found!!!/l/n",s2,100
out     s2,100,c4
jmp     err_main

test1_cntl:
case    cntl_sign,err_main
movd    "          CH0st1-CNTL-Sign/n",s2,100
movs    0xd460,0,s2,100,2
out     s2,100,c4
movd    "@D/n",s2,100
out     s2,100,c4
compd   "H",0xd460,0
jz      main_1
jmp     err_main_wait
main_1:
movd    " Init UA-Subset OKAY!/n",s2,100
out     s2,100,c4
movd    "@D/n",s2,100
out     s2,100,c4
setl    15,0
sett    250
movd    "0",0xd480,0

main:
sett    50
setl    8,1
afs_tl2:
;
l12_on:
;
led_8:
wait    im_sign,rx_sign,tf_sign,cntl_sign,ans_sign
setl    8,2





case    im_sign,test_rx
in      s2,0
compd   "chst",s2,0
jz      ch_st_im
compd   "tr",s2,0
jz      trenn_taste
compd   "sk",s2,0
jz      send_skey
compd   "info",s2,0
jz      info_taste
compd   "offh",s2,0
jz      send_offhook
compd   "onh",s2,0
jz      send_onhook
compd   "d ",s2,0
jz      dial_cmd
;
compd   "stop",s2,0
jz      start_wait
buffwr  s2,0
sendsig ans_sign,c0
ansd    "OKAY/n"
setl    8,1
jmp     main

start_wait:
ansd    "Okay stoped/n"
start_1_wait:
wait    im_sign
case    im_sign,start_1_wait
in      s2,0
compd   "start",s2,0
jnz     start_wait
ansd    "Okay running/n"
jmp     main
;
dial_cmd:
vta_wrs s2,0,20
setl    8,1
ansd    "OKAY/n"
jmp     main
send_offhook:
vta_key 255
setl    8,1
ansd    "OKAY/n"
jmp     main
send_onhook:
vta_key 254
setl    8,1
ansd    "OKAY/n"
jmp     main
send_skey:
vta_skey        s2,3
setl    8,1
ansd    "OKAY/n"
jmp     main
;
trenn_taste:
vta_key 41
setl    8,1
ansd    "OKAY/n"
jmp     main
;
info_taste:
vta_key 42
setl    8,1
ansd    "OKAY/n"
jmp     main
;
ch_st_im:


ansd    "OK!/n"
jmp     main





test_rx:
case    rx_sign,test_tf
clear   rx_sign
setl    8,1
compd   "1",0xd490,4
jnz     test_rx_skip1
out     0xd100,0,c4
movd    "0",0xd490,4

test_rx_skip1:
compd   "1",0xd490,5
jnz     test_rx_skip2
out     0xd140,0,c4
movd    "0",0xd490,5
compd   "Record",0xd140,9
jnz     test_rx_skip2


test_rx_skip2:
compd   "6",0xd480,0
jnz     test_end
movd    " Ringing !!!/n",s2,100
out     s2,100,c4
test_end:
sett    4
wait    tf_sign
jmp     main
;




test_tf:
case    tf_sign,test_cntl


jmp     test_1_answ
jmp     main




test_cntl:
case    cntl_sign,test_tx
movd    "          CH0-CNTL-Sign/n",s2,100
movs    0xd460,0,s2,100,2
out     s2,100,c4
compd   "H",0xd460,0
jnz     err_main
movd    "@",0xd460,0

decc    6
jz      test_subset
jmp     main

test_subset:
setc    6,10
compd   "0",0xd480,0
jnz     main




call    tx_wait
vta_key 41

jmp     main





test_tx:








test_answ:
case    ans_sign,test_undef

test_1_answ:
compd   "0",0xd480,0
jnz     error_ua_busy
loop_answ:
buffrd  s2,0            
compd   "E/n",s2,0
jz      main
out     s2,0,c4
sendsig ans_sign,c0
jmp     change_st

error_ua_busy:
movd    "UA-Subset is busy/n",s2,100
out     s2,100,c4
jmp     main

test_undef:
movd    "CH0-Undefined event/n",s2,100
out     s2,100,c4
jmp     main






change_st:
compd   "dial ",s2,0
jz      dial_string
compd   "skey ",s2,0
jz      dosend_skey
compd   "tr",s2,0
jz      key_tr
compd   "VM_ON",s2,0
jz      vm_sw_on
compd   "vm_on",s2,0
jz      vm_sw_on
compd   "VM_OFF",s2,0
jz      vm_sw_off
compd   "vm_off",s2,0
jz      vm_sw_off
compd   "VM_TAG",s2,0
jz      vm_sw_tag
compd   "vm_tag",s2,0
jz      vm_sw_tag
compd   "VM_NACHT",s2,0
jz      vm_sw_nacht
compd   "vm_nacht",s2,0
jz      vm_sw_nacht
compd   "VM_MODE1",s2,0
jz      vm_sw_m1
compd   "vm_mode1",s2,0
jz      vm_sw_m1
compd   "VM_MODE2",s2,0
jz      vm_sw_m2
compd   "vm_mode2",s2,0
jz      vm_sw_m2
compd   "VM_ENTITY",s2,0
jz      vm_sw_entity
compd   "vm_entity",s2,0
jz      vm_sw_entity
compd   "UANOPROG",s2,0
jz      test_answ
compd   "Prog",s2,0
jz      test_answ
compd   "Ende-",s2,0
jz      test_answ
change_lst:
movd    " ERROR Key not defined!!/n",s2,100
out     s2,100,c4
jmp     main


vm_sw_on:
ticon   17,6,2
jnz     vm_sw_1_on
movd    "Vermittlung ist aktiv/n",s2,100
out     s2,100,c4
jmp     loop_answ
vm_sw_1_on:
call    tx_wait
vta_key 17
movd    "  Ja",s2,240
call    sk_wait
call    press_sk
jnz     error_vm
jmp     loop_answ
vm_sw_off:
ticon   17,6,0
jnz     vm_sw_1_off
movd    "Vermittlung ist inaktiv/n",s2,100
out     s2,100,c4
jmp     loop_answ
vm_sw_1_off:
call    tx_wait
vta_key 17
movd    "  Ja",s2,240
call    sk_wait
call    press_sk
jnz     error_vm
jmp     loop_answ

vm_sw_tag:
ticon   17,6,2
jz      vm_sw_1_tag
movd    "Vermittlung ist nicht aktiv/n",s2,100
out     s2,100,c4
jmp     loop_answ
vm_sw_1_tag:
call    tx_wait
vta_key 16
movd    "Int.St",s2,240
call    sk_wait
call    press_sk
jnz     error_vm
movd    " Tag",s2,240
call    sk_wait
vta_key 30
call    rx_wait
call    tx_wait
vta_key 41
call    rx_wait
jmp     loop_answ
vm_sw_nacht:
ticon   17,6,2
jz      vm_sw_1_nacht
movd    "Vermittlung ist nicht aktiv/n",s2,100
out     s2,100,c4
jmp     loop_answ
vm_sw_1_nacht:
call    tx_wait
vta_key 16
movd    "Int.St",s2,240
call    sk_wait
call    press_sk
jnz     error_vm
movd    "Nacht",s2,240
call    sk_wait
vta_key 29
call    rx_wait
call    tx_wait
vta_key 41
call    rx_wait
jmp     loop_answ
vm_sw_m1:
ticon   17,6,2
jz      vm_sw_1_m1
movd    "Vermittlung ist nicht aktiv/n",s2,100
out     s2,100,c4
jmp     loop_answ
vm_sw_1_m1:
call    tx_wait
vta_key 16
movd    "Int.St",s2,240
call    sk_wait
call    press_sk
jnz     error_vm
movd    "Umlei1",s2,240
call    sk_wait
vta_key 31
call    rx_wait
call    tx_wait
vta_key 41
call    rx_wait
jmp     loop_answ
vm_sw_m2:
ticon   17,6,2
jz      vm_sw_1_m2
movd    "Vermittlung ist nicht aktiv/n",s2,100
out     s2,100,c4
jmp     loop_answ
vm_sw_1_m2:
call    tx_wait
vta_key 16
movd    "Int.St",s2,240
call    sk_wait
call    press_sk
jnz     error_vm
movd    "Umlei2",s2,240
call    sk_wait
vta_key 32
call    rx_wait
call    tx_wait
vta_key 41
call    rx_wait
jmp     loop_answ
vm_sw_entity:
ticon   17,6,2
jz      vm_sw_1_entity
movd    "Vermittlung ist nicht aktiv/n",s2,100
out     s2,100,c4
jmp     loop_answ
vm_sw_1_entity:
call    tx_wait
vta_key 16
movd    "Int.St",s2,240
call    sk_wait
call    press_sk
jnz     error_vm
movd    "Entity",s2,240
call    sk_wait
vta_key 33
call    rx_wait
;        call    tx_wait
;        vta_key 41
;        call    rx_wait
jmp     loop_answ
error_vm:
movd    " Softkey not found !/n",s2,100
out     s2,100,c4
jmp     loop_answ


key_tr:
call    tx_wait
vta_key 41
call    tx_wait
vta_key 41
call    rx_wait
jmp     loop_answ

dosend_skey:
call    tx_wait
vta_skey        s2,5
call    rx_wait
jmp     loop_answ

dial_string:
call    tx_wait
vta_wrs s2,5,20
call    rx_wait
jmp     loop_answ





sk_wait:
movd    "0",0xd490,5
comps   s2,240,0xd140,1,4
jz      sk_wait_end
comps   s2,240,0xd140,9,4
jz      sk_wait_end
comps   s2,240,0xd140,17,4
jz      sk_wait_end
comps   s2,240,0xd140,25,4
jz      sk_wait_end
comps   s2,240,0xd140,33,4
jz      sk_wait_end
sk_wait_update:
call    rx_wait
jnz     sk_wait_error
compd   "1",0xd490,5
jnz     sk_wait_update

movd    "0",0xd490,5
compd   "                    ",0xd140,0
jz      sk_wait_update
comps   s2,240,0xd140,1,4
jz      sk_wait_end
comps   s2,240,0xd140,9,4
jz      sk_wait_end
comps   s2,240,0xd140,17,4
jz      sk_wait_end
comps   s2,240,0xd140,25,4
jz      sk_wait_end
comps   s2,240,0xd140,33,4
jz      sk_wait_end
sk_wait_error:
movd    "Softkey  *    * not found on sk_wait/n",s2,150
movs    s2,240,s2,160,4
out     s2,150,c4
jmp     nz_ret
sk_wait_end:
ret







press_sk:
movd    "0",0xd490,5
comps   s2,240,0xd140,1,4
jz      press_1
comps   s2,240,0xd140,9,4
jz      press_2
comps   s2,240,0xd140,17,4
jz      press_3
comps   s2,240,0xd140,25,4
jz      press_4
comps   s2,240,0xd140,33,4
jz      press_5
compd   ">",0xd140,39   
jnz     dir_left
vta_key 35
pr_lo_1:
call    rx_wait
jnz     error_pr_sk
compd   "1",0xd490,5
jnz     pr_lo_1
jmp     press_sk

dir_left:
movd    "0",0xd490,5
comps   s2,240,0xd140,1,4
jz      press_1
comps   s2,240,0xd140,9,4
jz      press_2
comps   s2,240,0xd140,17,4
jz      press_3
comps   s2,240,0xd140,25,4
jz      press_4
comps   s2,240,0xd140,33,4
jz      press_5
compd   "<",0xd140,0   
jnz     sk_not_found
vta_key 34
pr_lo_2:
call    rx_wait
jnz     error_pr_sk
compd   "1",0xd490,5
jnz     pr_lo_2
jmp     dir_left

sk_not_found:
movd    "Softkey  *    * not found on press_sk/n",s2,150
movs    s2,240,s2,160,4
out     s2,150,c4
jmp     nz_ret

press_1:
vta_key 29
common_pr_sk:
call    rx_wait
jnz     error_pr_sk
compd   "1",0xd490,5
jnz     common_pr_sk
ret
press_2:
vta_key 30
jmp     common_pr_sk
press_3:
vta_key 31
jmp     common_pr_sk
press_4:
vta_key 32
jmp     common_pr_sk
press_5:
vta_key 33
jmp     common_pr_sk

error_pr_sk:
vta_key 41
jmp     nz_ret

to_wait:
sett    1
wait    tf_sign
ret

movd    "000",0xd490,4

rx_wait:
clear   rx_sign
sett    40
rx_wait_l:
wait    rx_sign,tf_sign
case    rx_sign,rx_w_tf
out     0xd100,0,c4
out     0xd140,0,c4
jmp     z_ret

rx_w_tf:
case    tf_sign,rx_wait_l
movd    "  Timeout 4 sec on waiting rx_sign!!!/n",s2,100
out     s2,100,c4
jmp     nz_ret1



tx_wait:
sett    50
wait    tx_sign,tf_sign
case    tx_sign,test_tx_tf
jmp     z_ret
test_tx_tf:
case    tf_sign,tx_wait
movd    " Error on TX_WAIT. No TX_signal after 5 sec./n",s2,100
out     s2,100,c4
jmp     nz_ret








to_left:
movd    "                    ",s14,220
setc	12,20	
setc	10,200	
setc	11,220	
lto_left:
compd   " ",s14,c10
jnz	mto_left
incc	10
decc	12
jnz	lto_left
movd	"                   ",s14,200
ret

mto_left:
movs	s14,c10,s14,c11,1
incc	10
incc	11
decc	12
jnz     mto_left
movd    "                   ",s14,200
ret







z_ret:
setc    2,1
decc    2
ret







nz_ret:
nz_ret2:
setc    2,1
incc    2
ret







nz_ret1:
setc    2,2
decc    2
ret








init_b0:
setp    0XD300,0x50      
setp    0XD301,0x00             

setp    0Xd302,0x20     
setp    0XD303,0x00             

setp    0Xd304,0x20     
setp    0XD305,0x00             

setp    0Xd306,0x50      
setp    0XD307,0x00             

setp    0Xd308,0x20     
setp    0XD309,0x00             

setp    0Xd30A,0x50      
setp    0XD30B,0x00             

setp    0Xd30C,0x20     
setp    0XD30D,0x00             

setp    0XD30E,0x00         

ret

zzz:

end

