xtr-modem {2/2}

ZXNet echo conference «code.zx»

From 500:812/28.08 To Ivan Savin 23 February 1998

----- PROGRAMMING ----- For curious users we inform 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 Bit0 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 Bit0 receives data through it OUT (#B7),A Bit0 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 Bit4 bits define the time until which Bit5 hardware will stretch the time interval Bit7 menu between two adjacent commands Bit6 dami IN A,(#B7) or OUT (#B7),A Bit7-Bit4 #00 time .000002*16 sec #10 time .000002*15 sec ... #E0 time .000002*1 sec #F0 asynchronous mode, NO WAIT For case #F0 nothing is stretched, everything is performed as for port #FE in mode ME emulation VICOMM. 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, note !, the completion period will be: ticks seconds PENTAGON 11+10=21 .000006TURBO 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 XTR case, the period for all machines equalizes, increasing (!) to a value value set in bits 7-4 (except for the #F0). The same is true for OUT (#B7), A and for any IN/OUT combinations with port #B7. Note_1: naturally, the program should to be written under the worst car, so that the execution time of commands on this machine would be less than the set time until why everything is stretched (otherwise it will be compression!). note_2: the period without stretching is not must be less than .00000229 sec, (8 clock cycles non-TURBO PENTAGON, 16 cycles TURBO PENTA- GONa), 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, not depending on TURBO/non-TURBO. Programming examples: release the OUT line (#B7),#F0 occupy the OUT line (#B7),#F3 Dialing a number (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,7DIAL7 WAIT 0.5 LD A,(HL) SUB #30 JR NZ,DIAL7_0 LD A,10 ; for zero-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 Waiting for a call: WTCALL LD DE,#8180 XOR A OUT (#B7),A WTCL0 LD BC,#FF00 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,WTCL0 ; no call WTCL3 LD B,0 ; waiting for the end WTCL4 WAIT .002 ; call IN A,(#B7) AND D CP E JR Z,WTCL3 DJNZ WTCL4 ; you can take a line RET ! It is not recommended to occupy the line in mid- ment of the bell (after all, 120 volts!!!), you need to wait for a pause between calls (say this is true for any terminal telephone line devices). __________________________ That's it. -+- iS-DOS 4.5