home *** CD-ROM | disk | FTP | other *** search
/ The Unsorted BBS Collection / thegreatunsorted.tar / thegreatunsorted / texts / boxes / jbox_39.a49 < prev    next >
Text File  |  1993-05-14  |  22KB  |  963 lines

  1. ; The Jolly-Box v3.9 (1 Mbit Samplerom, 4 Kb Program ROM).
  2. ; New modifications by Zaphod Beeblebrox of Control Team, Origial
  3. ; Code by Jolly Roger/Int. Tollfree Access
  4. ; Multi-Frequenz-Demon-Dialer for Global Access!!!
  5. ; last update 08.May.1993 17:00.26
  6. ; code for INTEL 8049 with 10 Mhz (because timing)
  7.  
  8. ;How to Operate:
  9. ;===============
  10. ;
  11. ;Press *0 for samplebank 0 select (DTMF, All 16 Digits).
  12. ;Press *1 for samplebank 1 select (CCITT #5 -R1- *DEFAULT*).
  13. ;Press *2 for samplebank 2 select (CCITT #5 -R2-).
  14. ;Press *3 for samplebank 3 select (Break/Simulation Tones).
  15. ;Press *4 for CCITT #4 (2040 Hz/2400 Hz a.k.a 2VF). (Not yet Implemented!)
  16. ;Press *# for special tone simulation mode.
  17. ;Press **0 to enter a new routing code. The default is KP2+46.
  18. ;Press **1 to enter RAM memory number #1.
  19. ;Press **2 to enter RAM memory number #2.
  20. ;# ends the input and adds ST code if not in DTMF mode.
  21. ;
  22. ;When entering a number on the input line, the first digit must be
  23. ;between 0-3: A "0" means that the prefix in ram should be dialed before
  24. ;the actual number you enter. "1" means that KP1 should be the first tone
  25. ;dialed when the macro is played back. "2" is the same, but KP2 instead of
  26. ;KP1. A ST code is always added at the end of a CCITT number stored in RAM
  27. ;or ROM when it's played back. "3" means that this tone should be ignored
  28. ;and the rest of the dialing should be done in DTMF mode.
  29. ;
  30. ;Press 0 to dial the entered number #1. (without trunk)
  31. ;Press 1 to dial the entered number #2. (without trunk)
  32. ;Press 20-27 for dial in the first phonebook
  33. ;Press 30-37 for dial in the second phonebook
  34. ;Press 4 for 1850 Hz DHLS tone
  35. ;Press 5 for a Redbox "Dime" Tone
  36. ;Press 6 for a Redbox "Quarter" Tone
  37. ;Press 7 to send US Local Trunk-Tone (2600 Hz, 1.5 seconds).is KP2-460.
  38. ;Press 8 to send CCITT International Trunk #1
  39. ;Press 9 to send CCITT International Trunk #2
  40. ;Press # to get into whitebox mode, press again to return to bluebox mode.
  41.  
  42. ;Example:
  43. ;"b46018262804c"
  44. ;Press:* 2 4 6 0 1 8 2 6 2 8 0 4 #
  45. ;or   :* 0 1 8 2 6 2 8 0 4 #  (b460 will be added for 0)
  46. ;"a08185585636c"
  47. ;Press:* 1 0 8 1 8 5 5 8 5 6 3 6 #
  48.  
  49. ;When ist beeps three times:
  50. ;Quarz is ok.
  51. ;Porcessor is ok.
  52. ;All chips on the Sound card are ok.
  53.  
  54. ;Press 1,2,3 or 4  when turning on and you get a test of all tones
  55. ;in the sample bank you selected.
  56.  
  57. ;  Register:
  58. ;  =========
  59. ;  r0 = adress reg #1. (Input-Line & Dialing Loops).
  60. ;  r1 = adress reg #2. (Prefix-Dialing Loop).
  61. ;  r2 = counter for wait routine
  62. ;  r3 = sound to play
  63. ;  r4 = sound pause
  64. ;  r5 = sample bank for autodialing
  65. ;  r6 = sound length
  66. ;  r7 = temporary register
  67. ; r31 = security code entered status
  68. ; r32-65 = memory for entered number #1 (ends with 32)
  69. ; r66-99 = memory for entered number #2 (ends with 32)
  70. ; r100-127 = memory for entered dialing prefix (ends with 32)
  71.  
  72. ;codes in the sample rom:
  73. ;the 128Kb rom is divided in 32 2048 large blocks
  74.  
  75. ;00 - "0" DTMF touch tones   10 - "0"    CCITT #5 R1
  76. ;01 - "1" DTMF touch tones   11 - "1"    CCITT #5 R1
  77. ;02 - "2" DTMF touch tones   12 - "2"    CCITT #5 R1
  78. ;03 - "3" DTMF touch tones   13 - "3"    CCITT #5 R1
  79. ;04 - "4" DTMF touch tones   14 - "4"    CCITT #5 R1
  80. ;05 - "5" DTMF touch tones   15 - "5"    CCITT #5 R1
  81. ;06 - "6" DTMF touch tones   16 - "6"    CCITT #5 R1
  82. ;07 - "7" DTMF touch tones   17 - "7"    CCITT #5 R1
  83. ;08 - "8" DTMF touch tones   18 - "8"    CCITT #5 R1
  84. ;09 - "9" DTMF touch tones   19 - "9"    CCITT #5 R1
  85. ;0a - "*" DTMF touch tones   1a - "kp1"  CCITT #5 R1
  86. ;0b - "#" DTMF touch tones   1b - "kp2"  CCITT #5 R1
  87. ;0c - "a" DTMF touch tones   1c - "st"   CCITT #5 R1
  88. ;0d - "b" DTMF touch tones   1d - "C.11" CCITT #5 R1
  89. ;0e - "c" DTMF touch tones   1e - "C.12" CCITT #5 R1
  90. ;0f - "d" DTMF touch tones   1f - "DHLS" CCITT #5 R1/R2
  91.  
  92. ;20 - "0"    CCITT #5 R2     30 - 2400/2600 Hz
  93. ;21 - "1"    CCITT #5 R2     31 - 2400/2400 Hz
  94. ;22 - "2"    CCITT #5 R2     32 - 2040/2040 Hz
  95. ;23 - "3"    CCITT #5 R2     33 - 2040/2400 Hz
  96. ;24 - "4"    CCITT #5 R2     34 - 2280/2280 Hz
  97. ;25 - "5"    CCITT #5 R2     35 - 2600/2600 Hz
  98. ;26 - "6"    CCITT #5 R2     36 - Spare 1
  99. ;27 - "7"    CCITT #5 R2     37 - Spare 2
  100. ;28 - "8"    CCITT #5 R2     38 - Spare 3
  101. ;29 - "9"    CCITT #5 R2     39 - 480/620 Hz (US Ringing Tone)
  102. ;2a - "kp1"  CCITT #5 R2     3a - 350/440 Hz (US Dialtone)
  103. ;2b - "kp2"  CCITT #5 R2     3b - 440/480 Hz (US Busy)
  104. ;2c - "st"   CCITT #5 R2     3c - 440/440 Hz (Sw. Dialt & Busy).
  105. ;2d - "C.11" CCITT #5 R2     3d - 460/460 Hz (German Tone).
  106. ;2e - "C.12" CCITT #5 R2     3e - 1700/2200 Hz (US/DK Redbox)                 
  107. ;2f - "DHLS" CCITT #5 R2     3f - Silence (Empty!!!).
  108.  
  109. ;port1:    bit  0   = Samplebank Select Low Bit
  110. ;    bit  1   = Samplebank Select High Bit
  111. ;    bits 2-7 = Rows for keyboard
  112. ;port2: bits 0-3 = Program Address Memory High Address Bits
  113. ;    bits 4-7 = select a sample of the sample rom (CCITT or DTMF)
  114.  
  115. ;BEGIN OF PAGE $000
  116.  
  117. ;Resetroutine:
  118.     nop            ;    lo
  119.     nop            ;    hi-pointer to reset ($000)
  120.     nop            ;    lo
  121.     nop            ;    hi-pointer to nmi ($000)
  122.     nop
  123.     nop
  124.     nop
  125.     nop
  126.     nop
  127.  
  128.     call    init
  129.  
  130. ;give ok status (beep ,delay 300ms, beep, delay 100ms,long beep)
  131. ;end of reset routine
  132.  
  133. wboxb:    mov    r4,=75        ; 150 ms delay
  134.     call    beep        ; beep to show reset
  135.     mov    r4,=25        ; set 50 ms delay
  136.     call    beep        ; beep again
  137.     call    beep        ; a third beep!
  138.  
  139. ;select tone 0, sample-bank 1.
  140.  
  141.     mov    r3,=%00000000
  142.     mov    r5,=%00000001
  143.  
  144. ;MainMenu
  145. ;========
  146. ;**0 = enter routing code
  147. ;**1 = enter number #1
  148. ;**2 = enter number #2
  149. ;*0 = select sample bank 0 (DTMF Whitebox, all 16 tones).
  150. ;*1 = select sample bank 1 (CCITT #5 R1 Tones).
  151. ;*2 = select sample bank 2 (CCITT #5 R2 Tones).
  152. ;*3 = select sample bank 3 (Various Tones/Breaks).
  153. ;*4 = select CCITT #4 mode
  154. ;*# = special tone simulation mode
  155. ;0 = dial entered number #1
  156. ;1 = dial entered number #2
  157. ;20-17, 30-37 phonebook(s)
  158. ;4 = DHLS tone
  159. ;5 = Redbox - Dime Tone
  160. ;6 = Redbox - Quarter Tone
  161. ;7 = Local Trunk, 1.0s 2600 Hz
  162. ;8 = CCITT Clear Forward
  163. ;9 = CCITT Xfer Forward
  164. ;# = whitebox, press again to go back to bluebox.
  165.  
  166. start:    mov    r4,=0
  167.     call    beep        ; beep again
  168.     mov    A,r5
  169.     jz    main
  170.     anl    A,=%00000100
  171.     jz    main
  172.     jmp    c4_main
  173.  
  174. main:    call    key        ; get a code from key Accu
  175.     jz    dial1        ; if it is 0 goto dial
  176.     anl    A,=%10111111    ; %x0xxxxxx
  177.     jz    command        ; if it is 64 command menu 2
  178.     anl    A,=%01111111    ; %00xxxxxx
  179.     jz    whitebox    ; if it is 128 goto wb
  180.     dec    a        ; so it has to be 1-9
  181.     jz    dial2        ; if it is 1
  182.     dec    a        ; so it has to be 2-9
  183.     jz    dialn1        ; if it is 2
  184.     dec    a        ; so it has to be 3-9
  185.     jz    dialn2        ; if it is 3
  186.     dec    a        ; so it has to be 4-9
  187.     jz    dhls        ; if it is 4
  188.     dec    a        ; so it has to be 5-9
  189.     jz    dime        ; if it is 5
  190.     dec    a        ; so it has to be 6-9
  191.     jz    quart        ; if it is 6
  192.     dec    a        ; so it has to be 7-9
  193.     jz    ltrunk        ; if it is 7
  194.     dec    a        ; so it has to be 8,9
  195.     jz    trunk1        ; if it is 8
  196.     jmp    trunk2        ; so it had to be 9
  197.  
  198. ;Input line
  199. ;Press 0-9 to enter a number.
  200. ;Use * to enter special tones (1-6 = A-E, H).
  201. ;Use # to finish and add ST code.
  202.  
  203. enter_r:mov    r0,=100        ; set start for routing code
  204.     mov    @r0,=32        ; give end code
  205.     jmp    enterl        ; goto enterl
  206.  
  207. enter_1:mov    r0,=32        ; set start for number #1 - 32
  208.     mov    @r0,=32        ; give end code
  209.     jmp    enterl
  210.  
  211. enter_2:mov    r0,=66        ; set start for number #1 - 32
  212.     mov    @r0,=32        ; give end code
  213.     jmp    enterl
  214.  
  215.  
  216. dialn1:    mov    A,r5
  217.     mov    r7,A
  218.     call    key        ; get a key 0-7
  219.     anl    A,=7        ; %00000111
  220.     jmp    dialn        ; goto dial
  221.  
  222. dialn2:    mov    A,r5
  223.     mov    r7,A
  224.     call    key        ; get a key 8-15 (0-7)
  225.     orl    A,=8        ; %00001000
  226.  
  227. ;dial a number from p3 rom out of
  228.  
  229. dialn:    mov    r6,=27        ; 54 ms tone
  230.     mov    r4,=20        ; 40 ms pause
  231.     swap    A        ; a=a*16
  232.     mov    r0,a        ; put number to r0
  233.     mov    a,r0        ; get number from r0
  234.     movp3    a,@A        ; hole ersten wert
  235.     inc    r0        ; increment position in rom
  236.     jz    route1        ; when 0 then dial prefix
  237.     dec    a
  238.     mov    r3,=10        ; Sample pointer --> KP1
  239.     jz    touchn        ; If 1 - Dial KP1+Number
  240.     dec    a
  241.     mov    r3,=11        ; Sample pointer --> KP2
  242.     jz    touchn        ; If 2 - Dial KP2+Number
  243.     dec    a
  244.     jnz    main        ; If 3 - Dial in DTMF, else go main.
  245.     mov    r4,=40        ; 80 ms pause between DTMF's
  246.     mov    r6,=40        ; 80 ms duration for DTMF's.
  247.     mov    A,=0
  248.     mov    r5,A        ; Select DTMF Sample-Bank
  249.     jmp    rbackn
  250.  
  251. touchn:    call    sound        ; Play the sample
  252. rbackn:    mov    a,r0        ; get position in rom
  253.     movp3    a,@A        ; Fetch next tone
  254.     inc    r0        ; increment position in rom
  255.     mov    r3,a        ; put next sample in r3
  256.     jz    touchn        ; 0 is also a tone we should output!
  257.     anl    A,=%11011111    ; If it's $20 - End of signalling!
  258.     jz    etouch        ; We have to check if we should play ST code now...
  259.     jmp    touchn
  260.  
  261. ;dial a number from ram (r32 or r66).
  262.  
  263. dial1:    mov    r0,=32        ; Dial RAM Macro #1
  264.     jmp    dial
  265.  
  266. dial2:    mov    r0,=66        ; Dial RAM Macro #2
  267.  
  268. dial:    mov    r6,=27
  269.     mov    r4,=20
  270.     mov    A,r5
  271.     mov    r7,A
  272.     mov    a,@r0        ; hole ersten wert
  273.     inc    r0        ; increment position in ram
  274.     jz    route2        ; If 0 - Dial Routing
  275.     mov    r3,=10        ; Sample pointer --> KP1
  276.     dec    a
  277.     jz    touch        ; If 1 - Dial KP1+Number
  278.     dec    a
  279.     mov    r3,=11        ; Sample Pointer --> KP2
  280.     jz    touch        ; If 2 - Dial KP2+Number
  281.     dec    a
  282.     jnz    main        ; If 3 - Dial in DTMF, else go main.
  283.     mov    r4,=40        ; 80 ms pause between DTMF's
  284.     mov    r6,=40        ; 80 ms duration of DTMF's
  285.     mov    A,=0
  286.     mov    r5,A
  287.     jmp    rback
  288.  
  289. touch:    call    sound        ; play the sample
  290. rback:    mov    a,@r0        ; fetch the next tone
  291.     inc    r0
  292.     mov    r3,a
  293.     jz    touch        ; 0 is also a tone we should play!!
  294.     anl    A,=%11011111    ; check for $20 - End of signalling
  295.     jnz    touch        ; if no end code, goto output
  296. etouch:    mov    A,r5
  297.     jz    endsig        ; Don't add ST code for DTMF mode.
  298.     mov    r3,=12        ; Sample pointer --> ST code
  299.     call    sound        ; play the sample
  300. endsig: mov    A,r7
  301.     mov    r5,A
  302.     jmp    main        ; end to main
  303.  
  304. silence:mov    A,=%11111111
  305.     outl    p1,A
  306.     mov    A,=$f0
  307.     outl    p2,A
  308.     ret
  309.  
  310. route1: call    dialr        ; and wait
  311.     jmp    rbackn        ; end to main
  312.  
  313. route2:    call    dialr        ; and wait
  314.     jmp    rback        ; end to main
  315.  
  316. trunk1:    jmp    trunk1n
  317. trunk2: jmp     trunk2n
  318. ltrunk:    jmp    ltrunkn
  319. dime:    jmp    dime1
  320. quart:    jmp    quart1
  321. dhls:    jmp    dhls2
  322. whitebox:jmp    white
  323. command:jmp    command2
  324.  
  325.     PAGE    1
  326.  
  327. ;Enter number to ram or select sample bank for bluebox mode.
  328. ;Press 0-3 for the different sample-banks, and # to enter
  329. ;the special tone simulation mode.
  330.  
  331. command2:call    key
  332.     jz    bank0        ; If it's 0 - Samplebank 0 select.
  333.     anl    A,=%10111111    ; If * was pressed check for inputline.
  334.     jz    enterm
  335.     anl    a,=%01111111    ; If # was pressed goto simulation mode.
  336.     jz    simtj
  337.     dec    a
  338.     jz    bank1        ; If it's 1 - Samplebank 1 select.
  339.     dec    a
  340.     jz    bank2        ; If it's 2 - Samplebank 2 select.
  341.     dec    a
  342.     jz    bank3        ; If it's 3 - Samplebank 3 select.
  343.     dec    a
  344.     jz    ccitt4        ; If it's 4 - CCITT #4 Mode Enable.
  345.     jmp    command2
  346.  
  347. bank0:    mov    A,=0
  348.     jmp    banks
  349.  
  350. bank1:    mov    A,=1
  351.     jmp    banks
  352.  
  353. bank2:    mov    A,=2
  354.     jmp    banks
  355.  
  356. bank3:    mov    A,=3
  357.     jmp    banks
  358.  
  359. ccitt4:    mov    A,=4
  360.  
  361. banks:    mov    r5,A
  362.     mov    r4,=0
  363.     call    beep
  364.     jmp    start
  365.  
  366. enterm:    call    key
  367.     anl    A,=%00000011
  368.     jz    enterr
  369.     dec    a
  370.     jz    enter1
  371.     jmp    enter2
  372.  
  373. enterl:    mov    r4,=0
  374.     call    beep        ; give message, that * was pushed
  375.     call    beep
  376. notspec:call    key        ; get a key
  377.     jz    write        ; test 0
  378.     anl    A,=%10111111    ; %x0xxxxxx
  379.     jz    special        ; * = Enter special tone (1-6 = A-E, H)
  380.     anl    A,=%01111111    ; %00xxxxxx
  381.     jz    startj        ; test #
  382. write:    mov    @r0,a        ; if 0-9, write number
  383.     inc    r0        ; go to next
  384.     mov    @r0,=32        ; set end
  385.     jmp    enterl        ; goto enterl
  386.  
  387. special:call    key
  388.     anl    A,=%00000111
  389.     jz    notspec
  390.     add    A,=9
  391.     jmp    write
  392.  
  393. ;Whitebox routine
  394. ;press keys as log as the tone has to play
  395. ;    1=$10    2=$20    3=$30
  396. ;    4=$40    5=$50    6=$60
  397. ;    7=$70    8=$80    9=$90
  398. ;    *=$a0    0=$00    #=$b0
  399. ;    A=$c0    B=$d0    C=$e0
  400. ;        D=$f0
  401.  
  402. white:    mov    r4,=10
  403.     mov    r6,=20
  404.     call    beep
  405.     call    beep
  406.     mov    a,=%00000011
  407.     outl    p1,A        ; set all rows to output
  408. whitell:call    release
  409.     mov    A,=$f0
  410.     outl    p2,A
  411. whitel:    mov    A,=%11111011    ; set bit 2 low
  412.     outl    p1,A
  413.     mov    a,=$10
  414.     jnt0    wkey        ; jump if key is pressed ...
  415.     mov    a,=$70        ; .....
  416.     jnt1    wkey
  417.     mov    a,=%11110111
  418.     outl    p1,A
  419.     mov    a,=$20
  420.     jnt0    wkey
  421.     mov    a,=$80
  422.     jnt1    wkey
  423.     mov    a,=%11101111
  424.     outl    p1,A
  425.     mov    a,=$30
  426.     jnt0    wkey
  427.     mov    a,=$90
  428.     jnt1    wkey
  429.     mov    a,=%11011111
  430.     outl    p1,A
  431.     mov    a,=$40
  432.     jnt0    wkey
  433.     jnt1    ffake
  434.     mov    a,=%10111111
  435.     outl    p1,A
  436.     mov    a,=$50
  437.     jnt0    wkey
  438.     mov    a,=$00
  439.     jnt1    wkey
  440.     mov    a,=%01111111
  441.     outl    p1,A
  442.     mov    a,=$60
  443.     jnt0    wkey
  444.     jt1    whitel        ; start over if no key is pressed
  445.     sel    rb1
  446.     mov    A,r7
  447.     jz    fake2
  448.     jmp    wboxb        ; return to main menu.
  449. ffake:    sel    rb1
  450.     mov    A,r7
  451.     jz    fake1
  452.     sel    rb0
  453.     jmp    wkey2j
  454. fake1:    sel    rb0
  455.     mov    A,=$b0
  456.     jmp    wkey
  457. fake2:    sel    rb0
  458.     mov    A,=$a0    
  459. wkey:    outl    p2,A        ; set tone
  460.     mov    a,=%00000000    ; whitebox tones on
  461.     outl    p1,A
  462.     jmp    whitell
  463.  
  464. ;wait routine for waiting 2*A ms (a=65: 130ms) (set a to 0, to get 512ms delay)
  465. wait:    mov    r2,=166        ; set loop of 5+166*8 cycles
  466. wait1:    nop            ; delay 1 cycle
  467.     nop            ; delay 1 cycle
  468.     nop            ; delay 1 cycle
  469.     nop            ; delay 1 cycle
  470.     nop            ; delay 1 cycle
  471.     nop            ; delay 1 cycle
  472.     djnz    r2,wait1    ; delay 2 cycles
  473.     dec    a        ; after 1 #s, if a>0
  474.     jnz    wait        ; goto wait again
  475.     ret            ; end of wait
  476.  
  477. dime1:    mov    A,=2
  478.     mov    r4,=33
  479.     mov    r6,=33
  480.     jmp    red
  481.  
  482. quart1:    mov    A,=5
  483.     mov    r4,=17
  484.     mov    r6,=17
  485.     jmp    red
  486.  
  487. wkey2j:    jmp    wkey2
  488. enter1:    jmp    enter_1
  489. enter2:    jmp    enter_2
  490. enterr:    jmp    enter_r
  491. simtj:    jmp    simt
  492. startj:    jmp    start
  493.  
  494.     PAGE    2
  495.  
  496. ;Enter key
  497. ;gives The Code of pressed Key in Accu and waits for key press.
  498. ;bevore it waits for releasing the key.
  499. ;    1=$01    2=$02    3=$03
  500. ;    4=$04    5=$05    6=$06
  501. ;    7=$07    8=$08    9=$09
  502. ;    *=$40    0=$00    #=$80
  503.  
  504. key:    call    releaseb
  505. keyl:    mov    a,=%11111011    ; set bit 2 low
  506.     outl    p1,A
  507.     mov    a,=1
  508.     jnt0    kkey        ; jump if key is pressed ...
  509.     mov    a,=7        ; .....
  510.     jnt1    kkey
  511.     mov    a,=%11110111
  512.     outl    p1,A
  513.     mov    a,=2
  514.     jnt0    kkey
  515.     mov    a,=8
  516.     jnt1    kkey
  517.     mov    a,=%11101111
  518.     outl    p1,A
  519.     mov    a,=3
  520.     jnt0    kkey
  521.     mov    a,=9
  522.     jnt1    kkey
  523.     mov    a,=%11011111
  524.     outl    p1,A
  525.     mov    a,=4
  526.     jnt0    kkey
  527.     mov    a,=$40
  528.     jnt1    kkey
  529.     mov    a,=%10111111
  530.     outl    p1,A
  531.     mov    a,=5
  532.     jnt0    kkey
  533.     mov    a,=0
  534.     jnt1    kkey
  535.     mov    a,=%01111111
  536.     outl    p1,A
  537.     mov    a,=6
  538.     jnt0    kkey
  539.     mov    a,=$80
  540.     jnt1    kkey
  541.     jmp    keyl        ; start over if no key is pressed
  542. kkey:    ret            ; ret acc.
  543.  
  544. ;test release key
  545.  
  546. releaseb:mov    a,=%00000011
  547.     outl    p1,A        ; set all rows to output
  548. release:jnt0    release        ; wait until there is no key pressed
  549.     jnt1    release        ; (both lines)
  550.     mov    a,=37        ; delay 75ms
  551.     call    wait
  552.     jnt0    release        ; wait if there is no key pressed
  553.     jnt1    release        ; (both lines)
  554.     ret
  555.  
  556. ;make a beep sound with 30ms delay
  557.  
  558. beep:    mov    r3,=$01        ; select sound 01, Bank 3 (good beep sound)
  559.     mov    r6,=15        ; 30 ms beep
  560.      mov    A,r5
  561.     mov    r7,A
  562.     mov    r5,=%00000011    ; set sound dma
  563.     call    sound        ; and wait
  564.     mov    A,r7
  565.     mov    r5,A
  566.     ret
  567.  
  568. ;Sound routine
  569. ;r3 represents the sound which is in the sample rom.
  570. ;r4 is the pause after the sound, r5 the sample bank & r6 the length
  571.  
  572. sound:    mov    A,r3        ; get sample to a
  573.     swap    A        ; a=a*16
  574.     outl    p2,A        ; send sample
  575.     mov    A,r5        ; tone bank select
  576.     outl    p1,A
  577.     mov    A,r6        ; use R6/2 ms to delay
  578.     call    wait        ; wait
  579.     call    silence        ; stop sound
  580.     mov    A,r4        ; pause
  581.     jz    nowait
  582.     call    wait
  583. nowait:    ret            ; end of sound
  584.  
  585. ;dial prefix from ram (r100)
  586.  
  587. dialr:    mov    r4,=20
  588.     mov    r6,=27
  589.     mov    r1,=100        ; start
  590.     mov    a,@r1        ; hole ersten wert
  591.     inc    r1        ; increment position in ram
  592.     dec    a
  593.     mov    r3,=10
  594.     jz    touchr
  595.     dec    a
  596.     mov    r3,=11
  597.     jz    touchr
  598.     dec    a
  599.     jnz    dialr2
  600.     mov    r4,=40        ; 80 ms pause between DTMF's
  601.     mov    r6,=40        ; 80 ms duration for DTMF's.
  602.     mov    r5,=0        ; Select DTMF Samplebank.
  603.     jmp    touchr2
  604. touchr: call    sound        ; send the touchtone
  605. touchr2:mov    a,@r1        ; hole nΣchsten wert
  606.     inc    r1
  607.     mov    r3,a
  608.     jz    touchr        ; gebe null aus
  609.     anl    A,=%11011111    ; kein code eingegeben
  610.     jnz    touchr        ; if no end code, goto output
  611. dialr2:    ret
  612.  
  613. wkey2:    call    releaseb
  614. wkey2l:    mov    A,=%11111011
  615.     outl    p1,A
  616.     mov    A,=$a0
  617.     jnt0    wkeyj
  618.     mov    A,=%11110111
  619.     outl    p1,A
  620.     mov    A,=$b0
  621.     jnt0    wkeyj
  622.     mov    A,=%11101111
  623.     outl    p1,A
  624.     mov    A,=$c0
  625.     jnt0    wkeyj
  626.     mov    A,=%11011111
  627.     outl    p1,A
  628.     mov    A,=$d0
  629.     jnt0    wkeyj
  630.     mov    A,=%10111111
  631.     outl    p1,A
  632.     mov    A,=$e0
  633.     jnt0    wkeyj
  634.     mov    A,=%01111111
  635.     outl    p1,A
  636.     mov    A,=$f0
  637.     jt0    wkey2l
  638.  
  639. wkeyj:    jmp    wkey
  640. whitej:    jmp    whitel
  641.  
  642.  
  643.     page    3
  644.  
  645. ; Page 3 contains the 16 stored phonenumber ($300-$3ff).
  646.  
  647.     page    4
  648.  
  649.  
  650. ; Special tone simulation mode.
  651. ; =============================
  652. ;
  653. ; 1 = Swedish Dialtone.
  654. ; 2 = Swedish Busy Tone.
  655. ; 3 = Swedish Ringtone.
  656. ; 4 = US Dialtone
  657. ; 5 = US Busy Tone.
  658. ; 6 = US Ringtone.
  659. ; 7 = Swedish All Trunks Busy
  660. ; 8 = US All Trunks Busy
  661. ; 9 = Greenbox Ringback. (700 & 1700 Hz, 1 sec).
  662. ; 0 = Greenbox Coin Return (1100 & 1700 Hz, 1 sec).
  663. ; * = 2600 Hz wink (90 ms).
  664. ; # = Jump back to main menu.
  665.  
  666. simt:    mov    a,=%00000011
  667.     outl    p1,A
  668. siml1:    call    release
  669.     mov    A,=$f0
  670.     outl    p2,A
  671. siml2:    mov    A,=%11111011    ; 1 - Swedish Dialtone
  672.     outl    p1,A
  673.     mov    a,=$c0
  674.     jnt0    skey
  675.     jnt1    sbusy        ; 7 - Swedish Slow-Busy
  676.     mov    A,=%11110111    ; 2 - Swedish Busy
  677.     outl    p1,A
  678.     mov    A,=$c0
  679.     jnt0    fbusy
  680.     mov    A,=$b0
  681.     jnt1    fbusy        ; 8 - US Fast-Busy
  682.     mov    a,=%11101111    ; 3 - Swedish Ringtone
  683.     outl    p1,A
  684.     mov    a,=$c0
  685.     jnt0    ringl
  686.     jnt1    rngbck        ; 9 - Greenbox Ringback
  687.     mov    a,=%11011111    ; 4 - US Dialtone
  688.     outl    p1,A
  689.     mov    a,=$a0
  690.     jnt0    skey
  691.     jnt1    wink26        ; * - 2600 Wink (90 ms).
  692.     mov    a,=%10111111    ; 5 - US Busy
  693.     outl    p1,A
  694.     mov    a,=$b0
  695.     jnt0    busy
  696.     jnt1    cretn        ; 0 - Greenbox Coin Return
  697.     mov    a,=%01111111    ; 6 - US Ringtone
  698.     outl    p1,A
  699.     mov    a,=$90
  700.     jnt0    ringl
  701.     jt1    siml2        ; start over if no key is pressed
  702.     jmp    wboxb        ; return to main menu.
  703. skey:    outl    p2,A        ; set tone
  704.     mov    a,=%00000011    ; simulation tones on
  705.     outl    p1,A
  706.     jmp    siml1
  707.  
  708. busy:    mov    r3,=250
  709.     jmp    busyl
  710. fbusy:    mov    r3,=125
  711. busyl:    outl    p2,A
  712.     mov    r7,A
  713.     mov    A,r3
  714.     call    wait
  715.     mov    A,=$f0
  716.     outl    p2,A
  717.     mov    A,r3
  718.     call    wait
  719.     mov    A,r7
  720.     jnt0    busyl
  721.     jnt1    busyl
  722.     jmp    simt
  723.  
  724. sbusy:    outl    p2,A
  725.     mov    r7,A
  726.     mov    A,=250
  727.     call    wait
  728.     mov    A,=$f0
  729.     outl    p2,A
  730.     mov    A,=250
  731.     call    wait
  732.     mov    A,=250
  733.     call    wait
  734.     mov    A,=250
  735.     call    wait
  736.     mov    A,=250
  737.     call    wait
  738.     mov    A,r7
  739.     jnt0    sbusy
  740.     jnt1    sbusy
  741.     jmp    simt
  742.  
  743. ringl:    outl    p2,A
  744.     mov    r7,A
  745.     mov    A,=250
  746.     call    wait
  747.     mov    A,=250
  748.     call    wait
  749.     mov    A,=$f0
  750.     outl    p2,A
  751.     mov    A,=250
  752.     call    wait
  753.     mov    A,=250
  754.     call    wait
  755.     mov    A,=250
  756.     call    wait
  757.     mov    A,=250
  758.     call    wait
  759.     mov    A,r7
  760.     jnt0    ringl
  761.     jnt1    ringl
  762.     jmp    simt
  763.  
  764. wink26:    mov    A,=$50
  765.     outl    p2,A
  766.     mov    A,=45
  767.     call    wait
  768.     mov    A,=$f0
  769.     outl    p2,A
  770.     jmp    simt
  771.  
  772. cretn:    mov    A,=$c0
  773.     outl    p2,A
  774.     mov    A,=%00000001
  775.     outl    p1,A
  776.     mov    A,=250
  777.     call    wait
  778.     mov    A,=250
  779.     call    wait
  780.     mov    A,=$f0
  781.     outl    p2,A
  782.     jmp    simt
  783.  
  784. rngbck:    mov    A,=$a0
  785.     outl    p2,A
  786.     mov    A,=%00000001
  787.     outl    p1,A
  788.     mov    A,=250
  789.     call    wait
  790.     mov    A,=250
  791.     call    wait
  792.     mov    A,=$f0
  793.     outl    p2,A
  794.     jmp    simt
  795.  
  796.     page    5
  797.  
  798. c4_main:call    beep
  799.     call    beep
  800.     call    beep
  801.     call    beep
  802.     mov    r5,=1
  803.     jmp    start
  804.  
  805.     page    6
  806.  
  807. init:    sel    rb0        ; use old register
  808.     orl    p1,=%11111111    ; %11111111 all bits for output
  809.     orl    p2,=%11111111    ; %11111111 all bits for output
  810.  
  811.     mov    a,=%11111000
  812.     outl    p1,a        ; select 1 key and whitebox-mode
  813.     jnt0    selftest    ; if 1 is pressed while turning on goto selftest
  814.     mov    a,=%11110101
  815.     outl    p1,a        ; select 2 key and bluebox-mode CCITT #5 R1
  816.     jnt0    selftest    ; if 2 is pressed while turning on goto selftest
  817.     mov    a,=%11101110
  818.     outl    p1,a        ; select 3 key and bluebox-mode CCITT #5 R2
  819.     jnt0    selftest    ; if 3 is pressed while turning on goto selftest
  820.     mov    a,=%11011111
  821.     outl    p1,a        ; select 4 key and special signalling tones & trunks.
  822.     jnt0    selftest    ; if 4 is pressed while turning on goto selftest
  823.  
  824. ;reset number
  825.     mov    r0,=32
  826.     mov    @r0,=32
  827.     mov    r0,=66
  828.     mov    @r0,=32
  829.  
  830. ;set b460 default to memory
  831.     mov    r0,=100
  832.     mov    @r0,=2        ;kp2
  833.     inc    r0        ; go to next
  834.     mov    @r0,=4        ;4
  835.     inc    r0        ; go to next
  836.     mov    @r0,=6        ;6
  837.     inc    r0        ; go to next
  838.     mov    @r0,=0        ;0
  839.     inc    r0        ; go to next
  840.     mov    @r0,=32        ;end
  841.  
  842. au_code:sel    rb1        ; Power-On Security Access code
  843.     mov    r7,=$ff
  844.     call    key
  845.     jz    c_no
  846.     anl    A,=%11111110    ; Digit #1 = 1
  847.     jnz    c_no
  848.     call    key
  849.     jz    c_no
  850.     anl    A,=%11111101    ; Digit #2 = 2
  851.     jnz    c_no
  852.     call    key
  853.     jz    c_no
  854.     anl    A,=%11111100    ; Digit #3 = 3
  855.     jnz    c_no
  856.     call    key
  857.     jz    c_no
  858.     anl    A,=%11111011    ; Digit #4 = 4
  859.     jnz    c_no
  860.     sel    rb0
  861.     ret
  862.  
  863. c_no:    mov    r7,=$00
  864.     sel    rb0
  865.     jmp    white
  866.  
  867. ;Testmode:  All tones will be played!!!
  868.  
  869. selftest:mov    r3,a
  870.     clr    a
  871. testloop:
  872.     outl    p2,a        ;set tone
  873.     mov    r1,a        ;keep it
  874.     mov    a,=250        ;0.5 sec delay
  875.     call    wait    
  876.     mov    a,r1        ;get it back
  877.     add    a,=%00010000    ;next sample
  878.     mov    r1,a        ;keep it
  879.     call    silence        ;sound off
  880.     mov    a,=30    
  881.     call    wait        ;pause 60ms
  882.     mov    a,r3
  883.     outl    p1,a
  884.     mov    a,r1
  885.     jmp    testloop    ;loop
  886.  
  887. trunk1n:mov    r3,=$00        ; select sound 00
  888.     mov    r4,=0        ; no pause
  889.     mov    A,r5
  890.     mov    r7,A
  891.     mov    r5,=%00000011    ; select sample bank 03
  892.     mov    r6,=65        ; 130 ms 2400/2600 Hz
  893.     call    sound        ; play tone
  894.     mov    A,=250        ; 500 ms pause
  895.     call    wait
  896.     mov    A,=250        ; Another 500 ms pause
  897.     call    wait
  898.     mov    A,=150        ; 300 ms pause
  899.     call    wait
  900.     mov    r3,=$01        ; select sound 01
  901.     mov    r4,=0        ; no pause
  902.     mov    r6,=150        ; 300ms 2400 Hz
  903.     call    sound        ; play tone
  904.     mov    A,r7
  905.     mov    r5,A
  906.     jmp    main
  907.  
  908. trunk2n:mov    r3,=$00        ; select sound 00
  909.     mov    r4,=0        ; no pause
  910.     mov    A,r5
  911.     mov    r7,A
  912.     mov    r5,=%00000011    ; select sample bank 03
  913.     mov    r6,=65        ; 130 ms 2400/2600 Hz
  914.     call    sound        ; play tone
  915.     mov    A,=250        ; 500 ms pause
  916.     call    wait
  917.     mov    A,=250        ; Another 500 ms pause
  918.     call    wait
  919.     mov    A,=250        ; Another 500 ms pause
  920.     call    wait
  921.     mov    A,=250        ; Another 500 ms pause
  922.     call    wait
  923.     mov    r3,=$01        ; select sound 01
  924.     mov    r4,=0        ; no pause
  925.     mov    r6,=65        ; 130ms 2400 Hz
  926.     call    sound        ; play tone
  927.     mov    A,r7
  928.     mov    r5,A
  929.     jmp    main
  930.  
  931. ltrunkn:mov    A,=$50        ; select sound 05
  932.     outl    p2,a        ; no pause
  933.     mov    A,=%11111111    ; set sample bank 03
  934.     outl    p1,A
  935.     call    releaseb
  936.     call    silence
  937.     jmp    main        ; goto main loop
  938.  
  939. dhls2:    mov    A,r5
  940.     mov    r7,A
  941.     mov    r5,=1        ; Samplebank 1
  942.     mov    r3,=$0f        ; Sample #15 DHLS Tone.
  943.     mov    r6,=250        ; Wait 0.5s
  944.     call    sound
  945.     mov    A,r7
  946.     mov    r5,A
  947.     jmp    main
  948.  
  949. red:    mov    r7,A
  950.     mov    r3,=$0e        ; select sound 14
  951.     mov    A,r5
  952.     mov    r1,A
  953.     mov    r5,=%00000011    ; select sample bank 03
  954.     call    sound        ; play tone
  955.     mov    A,r1
  956.     mov    r5,A
  957.     mov    A,r7
  958.     dec    A
  959.     jnz    red
  960.     jmp    main
  961.  
  962. ; The End!
  963.