Montage - Virtual Net 96 (English)Hardware Montages
★ Ce texte vous est présenté dans sa version originale ★ 
 ★ This text is presented to you in its original version ★ 
 ★ Este texto se presenta en su versión original ★ 
 ★ Dieser Text wird in seiner Originalfassung präsentiert ★ 

  Virtual Net 96 (VN96) Doc v1.0, 1996 by Hage & Steve of Wizcat
    Version: 1.0, 12.03.1997
 1.) Introduction
 2.) General things
  2.1) Devices
  2.2) Installation & Handling
  2.3) Do it yourself devices
 3.) How to write own programs
  3.1) Basics
  3.2) The routine pack VN96ROUT.ASM
  3.3) Asynchronous and synchronous
  3.4) The first program
  3.5) Synchronous programming
 4.) Contact

 1.) Introduction

 The Virtual Net 96 is a combination of hard- and software developed by us to connect two or more CPCs in a kind of network.
 The Hardware consists of very simple devices connected to each CPC. These devices are linked to each other with normal cables.
 The software consists of utilities or games accessing a routine pack developed by us. This routine pack makes it possible to transfer data with a speed of 60000 Baud.
 This documentation introduces into the VN96 and teaches you how to write own VN96 programs.
 You can skip section 3 if you don't want to create own programs, programmers should read the whole document.

 2.) General things

  2.1) Devices

  Devices and cable can be ordered from us (or buildt by yourself, see below):

    * Single cable
      1 cable                    ;   ;1.50 DM

    * Single device
      1 device                     ;  4.50 DM

    * 'Add-On'
      1 device and 1 cable           ;6.00 DM

    * 'Beginner Set'
      2 devices and 1 cable         ;10.00 DM

  2.2) Installation & Handling

  The devices are put into the printer port, the switch upwards.
  Two pins at a time (one on the top of the other) belong together and must
  be connected with the end of a cable. The marked wire (knot) belongs to the
  upper pin. The other end of the cable has to be connected to another device.
  The other two pins are used to connect a further device and so on.
  If the switch is in position left the device is deactivated, in position
  right it is activated.

  IMPORTANT: Is the CPC switched off or if there's no VN96 program active then
  the device HAS TO BE DEACTIVATED (switch in position right)! If a program
  has been started you can switch on the device and the program will handle
  the rest.

  2.3) Do it yourself devices

  For users familiar with a soldering iron, here's the wiring diagram of the

  ---------------------o--------------------------------------- Data
  ---------------------|-----------------o--------------------- GND
                     ;  |               ;  |
                        ;  /             ; |
               ;  Switch  /---|           ;|
                    ;   ;/               ; |
                     ;  |               ;  |
        Resistor       |               ;  |
          10k          o-------+         ;|
                  ;  | /        |         ;|
        +-----+     |/         ;|         ;|
  +-----|     |-----<          |         ;|
  |     +-----+     |         ;|         ;|
  |               ;  | --------|---------o
  |                           ; |         ;|
  |             ; Transistor    |         ;|
  |               ; BC 547C     |         ;|
  |                           ; |         ;|
  ______                     ;  ____
  Strobe                     ;  Busy      GND
  (Pin 1)                     ; (Pin 11)  (Pin 19 or another GND pin)

  The pins are related to the printer port.

  Our devices and cables are assembled with an unique design. To maintain compatibility it is recommended to use the following specifications:

    * The connection of a device with a cable is provided with 1.3mm pins.
      There sould be four pins, two data and two GND pins.

    * The data pins should be placed above, the GND pins below (to avoid a reversed connection)

    * The cables end in 1.3mm sockets and on both ends of the cable the same of the two wires is marked with a knot.

    * Switch: position right: off, position left: on

  If you can't imagine how this looks like you can lend devices and wires from us for free.

 3.) How to write own programs

  3.1) Basics

  The data wire has two states, one and zero. This state can be requested with the 6th bit of the I/O address #F500 (Busy), for example:

IF INF(&F500) > 64 THEN PRINT "One!" ELSE PRINT "Zero!"

  Or with Z80:

    LD B,#F5
    IN A,(C)
    CP 64
    JR NC,one
    JR zero

  This state always is equal on all connected CPCs, meaning the state is either one or zero on ALL CPCs.

  A CPC can influence this state with the 7th bit of the I/O address #EF00:

    OUT &EF00,128   ' Put data wire to one
    OUT &EF00,0     ' Put data wire to zero

  Here an example with Z80 too:

   LD BC,#EF80     ' Put data wire to one
    OUT (C),C
    LD B,#EF00      ' Put data wire to zero
    OUT (C),A

  But what happens if a CPC puts the wire to one and another puts it to zero?
  Against expections the devices doesn't disintegrate or explode or something like that.

  The usual state of the data wire is one. If one or more CPCs put a zero to the wire the whole wire switches to zero. That means zero has priority above
  one, the 'ones'of other CPCs are ignored. To say it in a different way: The wires only switches to one if ALL CPCs put a one to the wire. This is the only way to realize a bidirectional connection. Apart from that it is very useful for synchonisations (see below).
  IMPORTANT: The first command in every VN96 program (in the BASIC loader, for  example) must put the data wire to one. After a reset the printer port puts the data wire to zero and that would block a transmission. That's why the device has to be switched off when there's no VN96 program running. But the user switches on the device after he has started a VN96 program, therefore each VN96 program has to put the data wire to one as soon as possible.
  A transmission runs off like this: All CPCs willing to receive put the data wire to one and now the CPC that wants to send can influence the wire according to the bits he wants to transmit. But this routines must not be written again, because there is...

  3.2) The routine pack VN96ROUT.ASM

  The routines of the routine pack VN96ROUT.ASM (which should be on the same disk as this doc, the newest version is available from us for free) are as follows:

    vnsnd    Transmit a byte
    vnrec    Receive a byte
    vnsndb   Transmit a data block
    vnrecb   Receive a data block
    vnzero   Wait for zero
    vnone    Wait for one
    vnzeri   Wait for zero without timeout
    vnonei   Wait for one without timeout
    vnwait   Wait a determined time
    vnwais   Wait for a request routine

IMPORTANT: All routines do not change the interrupt state. But if a routine is executed the interrupts MUST be disabled (DI).

Here the routines in detail:

    Routine:       'vnsnd', transmit a byte
    Jump in:       A=Byte to transmit
    Jump out:      A, BC destroyed
    Comments:      Byte is immediately transmitted without checking the wire.

    Routine:       'vnrec', receive a byte
    Jump in:       -
    Jump out:      CY=0 --> Ok, A=received byte
                  ; CY=1 --> Timeout error
                  ; A, BC, DE destroyed
    Comments:      If there's no byte received within ca. 1s the routine returns with CY=1.

    Routine:       'vnsndb', transmit a data block
    Jump in:       HL=Pointer to the data block
                  ; DE=Length of the data block in bytes
    Jump out:      A, BC, DE, HL destroyed
    Comments:      Data block is immediately transmitted without checking the wire.

    Routine:       'vnrecb', receive a data block
    Jump in:       HL=Pointer to a buffer
    Jump out:      CY=0 --> Ok, (HL)=data block
                              ;  DE=length ot the data block in bytes
                  ; CY=1 --> Timeout error
                  ; A, BC, DE, HL destroyed
    Comments:      If there's no data block received within ca. 1s the routine returns with CY=1.

    Routine:       'vnzero', wait for zero state
    Jump in:       -
    Jump out:      CY=0 --> Data wire is zero
                  ; CY=1 --> Timeout error
                  ; A, B, DE destroyed
    Comments:      If the data wire doesn't switch to zero state within ca. 1s the routine returns with CY=1.

    Routine:       'vnone', wait for one state
    Jump in:       -
    Jump out:      CY=0 --> Data wire is one
                  ; CY=1 --> Timeout error
                  ; A, B, DE destroyed
    Comments:      If the data wire doesn't switch to one state within ca. 1s the routine returns with CY=1.

    Routine:       'vnzeri', wait for zero state without timeout
    Jump in:       -
    Jump out:      Data wire is zero
                  ; A, B, DE destroyed
    Comments:      This routine returns only if the data wire is in zero state.

    Routine:       'vnonei', wait for one state without timeout
    Jump in:       -
    Jump out:      Data wire is one
                  ; A, B, DE destroyed
    Comments:      This routine returns only if the data wire is in one state.

    Routine:       'vnwait', wait a determined time
    Jump in:       HL=Wait time in 7.63us steps
    Jump out:      A, HL destroyed
    Comments:      Waits HL*7.63 micro seconds.
                  ; Rule of thumb: 9 HL cycles are one raster line.

    Routine:       'vnwais', wait for a request routine
    Jump in:       -
    Jump out:      -
    Comments:      Waits the time the routines vnzero, vnone, vnzeri and vnonei need to notice a change of the data state.

  3.3) Asynchronous and synchronous

  Gererally, two techniques are distinguished between: asynchronous and synchronous.
  Asynchrounous means simply: nothing happens - nothing is transmitted. A chat program is an example for this. The data wire is normally in one state. If one of the chatters presses a key, the keycode is transmitted to the other CPCs and after this the wire swichtes to one again.
  But why is the standard state one instead of zero? As sayed above: Well, if one or more of the CPCs put the wire to zero, none of the others could change this state any more.
  Synchronous means: The connected CPCs have a determined order and data is contiuously exchanged. Example: The Tron-like game 'Last Action Point' by Steve of Wizcat. During the game bytes are continously exchanged between the
  CPCs in a determined order. These bytes contain the joystick information of each player. After a sychronization phase player one sends his byte, then player two sends his byte, then player three and so on. After this all CPCs have to calculate the exchanged data, display graphics, etc. Then the game leads into a new sychronisation phase.
  But now we have a problem: The single CPCs do not all need the same time to process their data. That's why the transmissions have to be synchonisized.
  To this matter there is a simple but important solution named synchronization phase:
  After the transmission of all bytes all CPCs put the data wire to zero and start their calculations. If a CPC has finished this he puts the wire to one again. But the wire won't switch to one unless ALL CPCs put the wire to one. Therefore the CPC must wait until the wire swiches to one. All CPCs will return synchronous from this request, when the last CPC puts the wire to one. Then the new transmission can begin.

  3.4) The first programm

  As an example for asychronous programming a chat program was mentioned above. Now such a chat program will be developed step by step.
  First of all the wire must be put to one to avoid blocking transmissions:

             ;  ORG #A000
    chatstart: LD BC,#EF80       ; put data wire to one
             ;  OUT (C),C

  Now follows the main loop which checks if another CPC would like to transmit any byte:

    mainloop:  LD B,#F5          ; check data wire
             ;  IN A,(C)
             ;  CP 64             ;; is it zero?
             ;  JR C,recabyte     ; yes, --> receive byte

  Is the wire in zero state the program jumps to the routine which receives  the byte. If noone sends a byte, the keyboard is checked:

             ;  CALL #BB09        ; key pressed?
             ;  JR C,sndabyte     ; yes, --> transmit byte
             ;  JR mainloop

  If there a key is pressed the program jumps to the transmit routine. If not the loop starts again.
  Here's the routine to receive a byte using the routine pack VN96ROUT.ASM:

    recabyte:  DI               ; ; disable interrupts
             ;  CALL vnone        ; wait for one state
             ;  JR C,mainloop     ; timeout error, --> back to the main loop
             ;  CALL vnrec        ; receive the byte
             ;  JR C,mainloop     ; timeout error, --> back to the main loop
             ;  CALL #BB5A        ; print the char
             ;  JR mainloop       ; back to the main loop

  The routine waits for the end of the start bit and then receives and prints the byte.
  Now follows the routine which transmittes a byte when a key is pressed:

    sndabyte:  DI               ; ; disable interrupts
             ;  LD I,A           ; ; save the byte
             ;  LD BC,#EF00       ; send the start bit
             ;  OUT (C),C
             ;  LD HL,1500        ; wait for the others to notice it
             ;  CALL vnwait
             ;  LD BC,#EF80       ; quit the start bit
             ;  OUT (C),C
             ;  CALL vnwais       ; wait for the others to notice it
             ;  LD A,I           ; ; transmit the byte
             ;  CALL vnsnd
             ;  LD A,I           ; ; print the char
             ;  CALL #BB5A
             ;  JR mainloop       ; back to the main loop

  Here the start bit and then the byte is transmitted. The first wait loop is required because the other CPCs need a litte time to leave the main loop (maybe in the middle of a #BB09 call). The second wait loop 'vnwais'gives the CPCs time to return from their 'vnone' call.

  3.5) Synchronous programming

  As example for synchronous programming Steve of Wizcats 'Last Action Point' is used here.
  To use synchron programming the CPCs must have a determined order. This is reached with a asynchronous 'chat' between the players at the beginning of the game, the chat phase.
  Every CPC calculates a random number. At the start on all CPCs the program is loaded and the data wire is in one state. Now one player presses the start key. This CPC transmittes a start bit (see 3.4) which starts the chat   phase. Now every CPC counts down his random number. If a CPC counts out he transmittes a start bit followed by his player informations (name, points etc.). The CPCs must therefore check the data state while counting down their random numbers.
  So the single CPCs one after the other transmit their data. While doing this increasing player numbers are assigned determining the order of the CPCs.
  To quit these phase the random numbers must be restricted in its size. If the time according to the largest possible random number is ran out the chat phase can be quitted. No other CPC will send any data.
  The chat phase is now followed by a sychnonisation phase leading into synchonous mode (see 3.3).

 4.) Contact

 For free software, questions, critics, suggestions, to order devices or just for fun write to:

   * Hage of Wizcat
     Abt-Rudolfstr. 46
     73479 Pfahlheim
     E-Mail: wsteng@rzws.fh-aalen.de

   * Steve of Wizcat
     Ihnbergstr. 9/1
     73479 Pfahlheim
     E-Mail: Christian.Stengel@T-Online.de

   * http://www.home.pages.de/~vn96

★ YEAR: 1996
★ AUTEURS: Hage & Steve of Wizcat

CPCrulez[Content Management System] v8.7-desktop
Page créée en 092 millisecondes et consultée 1809 fois

L'Amstrad CPC est une machine 8 bits à base d'un Z80 à 4MHz. Le premier de la gamme fut le CPC 464 en 1984, équipé d'un lecteur de cassettes intégré il se plaçait en concurrent  du Commodore C64 beaucoup plus compliqué à utiliser et plus cher. Ce fut un réel succès et sorti cette même années le CPC 664 équipé d'un lecteur de disquettes trois pouces intégré. Sa vie fut de courte durée puisqu'en 1985 il fut remplacé par le CPC 6128 qui était plus compact, plus soigné et surtout qui avait 128Ko de RAM au lieu de 64Ko.