Planet Shelezyak - programming the XTR modem.

City #20


  ──══░░▒▒▓▓ ПЛАНЕТА ШЕЛЕЗЯКА ▓▓▒▒░░══──
            


  X-TRADE GROUP

             ╔════════════════╗
             ║                ║
   XTR-MODEM               ║                ║
             ╚════════════════╝

                продолжение

              ПРОГРАММИРОВАНИЕ

    Для  любопытных пользователей сообщаем
the required minimum of information. Communication with
modem occurs through a single port
with address #B7 (183).

IN A,(#B7), if the line is not occupied by the modem
 Bit7 BitO
 0 0 line is not connected to the modem
  0 1 off-hook parallel.  apparatus
  1 0 call (glitches possible)
  1 1 line free

IN A,(#B7), if the line is occupied by the modem

 Bit7 is always 0
 BitO receives data goes through it

 OUT (#B7),A


 BitO when the line is busy - transmitted
       data, when receiving d.b. =1
       not relevant when the line is free
 Bit1 1 - take line
       0-release line

 Bit The bits determine the time until which
 BitS hardware will stretch the time interval
 Bit7 menu between two adjacent commands
 Bit dami IN A,(#B7) or OUT (#B7),A

 Bit7-BitH
 #00 time .000002*16 sec
 #10 time .000002*15 sec
 ...
 #E0 time .000002*1 sec
 #F0 asynchronous mode, NO WAIT

    For case #F0 nothing
stretched, everything is done as for
#FE port in VICOMM emulation mode.What are bits 7-4 for?

          example:

LD A,#?0 *
 OUT (#B7),A *
        IN A,(#B7) !
        POP AF
        IN A,(#B7) !
without hardware support for commands,
marked with !, execution period
composet:


 ticks seconds

  PENTAGON 11+10=21 .000006
  TURBO PENTAGON 11+10=21* .000004 !
  SCORPION 12+10=22 .0000063
  TURBO SCORPION 12+10=22* .000004 !
  KAY 12+10=22 .0000063
  TURBO KAY 12+12=24 .0000034

  * plus WAIT
  ! approximately

 For the case of XTR, the period for all machines
is equalized, increasing (!) to
value set in bits 7-4 (except
#F0 values).
    The same is true for OUT (#B7), A and for
any IN/OUT combinations with port #B7.
Note_1:


naturally, the program must be written
for a worse car, so that the execution time
there were fewer commands on this machine thanset time until which everything
stretches (otherwise it will be compression!).

Note_2:

there should not be a period without stretching
less than .00000229 sec, (8 cycles heTURBO
PENTAGONa, 16 strokes TURBO PENTAGONa),
otherwise stretching will not occur.


        Example of a pause of .002 seconds:

W002 XOR A
 OUT (#B7),A ; period 32 µS
        LD B,62
W002_1 IN A,(#B7) ; 62*.000032=.001984
 DJNZ W002_1
 ...

 On any machine it will be .002 seconds,
independent of TURBO/heTURBO.

         Programming examples:

 release the OUT line (#B7),#F0
 occupy the OUT line (#B7),#F3

Dialing (WAIT ... in seconds):

ADRNUM DB "1234567"

DIAL OUT (#B7),#00 ; line reset
        WAIT 0.5
        OUT (#B7),#02 ; take the line
        LD HL,ADRNUM
        LD C,7
DIAL7 WAIT 0.5
        LD A,(HL)
 SUB #30
 JR NZ,DIAL7_0
        LD A,10 ; Forzero-ten
DIAL7_0 LD B,A
        INC HL
        PUSH HL
        PUSH BC
        CALL DIALN; dialing numbers
        POP B.C.
        POP HL
        DEC C
        JR NZ,DIAL7
        WAIT 0.5
        OUT (#B7),#03
        RET

DIALN OUT (#B7),#00
        WAIT .06
        OUT (#B7),#02
        WAIT .04
        DJNZ DIALN1
        RET
 Data transmission (VICOMM principle):

 OUT (#B7),#F2
WAIT
        OUT (#B7),#F3
        WAIT
        repeat according to the algorithm

 Call waiting:

WTCALL LD DE,#8180
 XOR A
        OUT (#B7),A
WTCLO LD BC,#FFOO
WTCL1 WAIT .002
        IN A,(#B7)
        AND D
        CP E
        JR NZ,WTCL2
        INC C
WTCL2 DJNZ WTCL1
        LD A,C
 CP 30 ; anti-glitch
 JR C,WTCLO ; no call
WTCLЗ LD B,0 ; waiting for the end
WTCLЧ WAIT .002; call
        IN A,(#B7)
        AND D
        CP E
        JR Z,WTCLЗ
        DJNZ WTCL
; you can take a line
        RET

 !  It is not recommended to occupy a line in
the moment of the call (after all, 120 volts!!!),
need to wait for a breakbetween calls
(the above is true for any
telephone line terminal).


Share your thoughts about the article