Home   • Persönlich •

< Persönlich

< Persönlich: Projects


> Intro

> Hardware

> Manual

• Interfacing

> Terminal


 

— Projects: UZE, Interfacing —

Assembling Source File UZE.Z80

Source code is written in WordStar 3.4 in the non-document mode (version 1.xx) and PB 3.20 IDE (PowerBASIC Revision 3.20, Integrated Development Environment for Version 2.xx). There are very few extended ascii codes used (e.g. "µ", code 230) and they will be represented in the assembler listing (UZE.PRN) with bit 7 reset, i.e. as pure ascii (e.g. 230-128=102 "f"). Do not be alarmed by this fact. For Version 2.xx, the "µ" character was replaced by "M".

Source code is written for the "CROMEMCO Z80 Macro Assembler version 03.04". This assembler runs under CP/M 2.2 or later, using only i8080 codes. To start this assembler, use the following command line:

ZMAC UZE.sol HEX [XREF SYMB DATE=mmddyy TIME=hhmmss]

The parameter within the brackets are optional. The source file extension must be Z80 and must not be entered. Instead, the three characters for the file extensions are used as "sol". "s" is the drive, where the source file (UZE.Z80) is located, "o" where the output file (UZE.HEX) and "l" where the list file (UZE.PRN) are to be written. See the ZASM (ZMAC) handbook for more information.

If the assembler is to be used in an PC-/MS-DOS environment, rename ZMAC.COM to ZMAC.CPM and generate a DOS-COM-shell with GENCOM.COM by Sydex (GENCOM ZMAC PROCESSOR=8080 DISPLAY=KAYPRO KEYBOARD=KAYPRO). Be sure the new insystem CP/M emulator 22NICE by Sydex is also on the same drive and directory along with ZMAC.COM and ZMAC.CPM or is available through a DOS PATH=statement. If PC-/MS-DOS platform uses a NEC V20 or V30 processor (µPD70108 or µPD70116), the processor statement for GENCOM can be set to "V20" to double speed of emulation. Do not confuse GENCOM by Sydex with GENCOM by Digital Research Inc.

The hexfile (UZE.HEX) can be downloaded to an EPROM-programming device, e.g. WaveTek digelec EP804 via a serial port. To prepare a PC-/MS-DOS platform, execute the statement:

MODE COMx:9600,o,7,1

The EP804 is already initialized to match these parameters. The EP804 is declared as a data communications equipment (DCE) as the COM-ports of any PC-/MS-DOS computer are. A custom cable with the following connections can be used (pin numbers correspond to DB25):

2<—>3TXD
3<—>2RXD
4<—>5RTS
5<—>4CTS
6<—>20DSR
7<—>7GND
20<—>6DTR

Preparing a Downloadable Object File

Write the program routine source code with any ascii editor, such as WordStar version 3.3 or 3.4 in the non-document mode. Assemble the programm using the "CROMEMCO Z80 Macro Assembler version 03.04". Note that the file type must be Z80 (filename.Z80).

Invoke the assembler mentioned above with the following command line:

ZMAC filename.sol HEX[ SYMB XREF DATE=mmddyy TIME=hhmms]

The produced file (filename.HEX) is in the hex-intel format and must be converted to binary using a load tool. Unfortunately, load tools need a starting address of 100h, but the ORG-assembler instruction will point to RAM at 32,768 or higher. The hex-intel file will reflect this and the load tool will not work properly. The hexfile must be converted to emulate the load address of 100h. This can be done with HEXHEX version 2.0 by Horo.

HEXHEX filename

The HEX file extension is assumed. HEXHEX looks for filename.HEX and writes an adjusted hex-intel file named filename.HIA (hex intel address adjusted). The original hex file filename.HEX must be deleted and filename.HIA renamed to filename.HEX. Now, the load tool can work on this hexfile. HEXCOM version 3.00 by Digital Research Inc will nicely do the job.

HEXCOM filename.HEX

The binary file produced has the name filename.COM. (When emulating CP/M under the DOS environment using 22NICE, the name will be filename.CPM). Since it is not a command file for CP/M (or DOS for that matter), it should be renamed to filename.OBJ or filename.BIN to reflect what it actually is. The code contained in this file can then be downloaded to the UZE system.

The program BIN2HEXA version 1.02 converts a binary (or object) file into a string of hex-ascii characters into a file with the file extension HAF (hex ascii file). The string in this file can be downloaded to the UZE in mode 2 or 3, using a telecommunications software with the ascii option as described below.


Using the UZE System with a Host Terminal

Connecting and controlling the UZE system with a terminal programm on the host platform is fairly straightforward. The serial communication port of the host must be set to 9600 Baud, no parity, eight databits and one stopbit. The CTS (cleared to send) and RTS (request to send) hardware handshaking should be selected and enabled. If a BBS (bulletin board service) access software is used, select VT52 or VT100 terminal emulation and exit from dial-up mode to the terminal mode. Press "H" to get the system prompt ":". In order to be able to see what one types, the local echo option may be switched on.

The BBS-terminal program can also be used to download files to the UZE system, provided there is a means to send ascii-files without any protocol (e.g. XModem, ZModem, et.al). Be sure all filters and translaters (e.g. "strip LF") are disabled and blank line expansion is off as well. Issue the download command with all parameters in the terminal mode. Exit terminal mode while UZE waits for data. Press "PageUp" on the BBS-terminal program to start an "upload" (here it means upload from the console, i.e. download to UZE). Enter the filename of the file to be sent and wait. Prior to sending the file, the filesize must be known in order to setup the download command as appropriate. An ascii file usually has the end of file character (EOF 1Ah, 26) as the last character. This one is not sent! Check the filesize by dumping it on the host system and substract from the filesize the number of EOF-characters, otherwise, that number of bytes must be entered from the host keyboard in order to conclude the download with the indicated number of bytes.

D40000,454.

Exit terminal mode, press [PageUp], select "ascii" and enter "TEST.BAS".

For uploading UZE memory to a file, prepare the upload command, but do not start it yet. That is, enter start address and number of bytes but do not provide the delimitter after the number of bytes. Exit terminal mode and press "PageDown" to start a BBS-download. Select ascii as protocol and provide the filename. When all is done, return to the terminal mode and start the upload to the terminal by entering the missing delimitter. Be sure the last character uploaded is the end of file character (EOF 1Ah, 26). This character will terminate the download for the host BBS program. The EOF marker will not be written to the file, however.

Example:
A small BASIC programm was written. The filesize was 455 bytes EOF inclusive. This file was downloaded to 40,000. The command below started the upload of file B:\TEST.BAS

D40000,454.

  Looked at file:	U40000,454.
  Dumped memory: 	M4,40000,464,0,0.E672.
  Wrote the assembly code below and assembled it: ZASM SHUFF HEX
  Translated hexfile HEXHEX SHUFF
  Deleted SHUFF.HEX and renamed SHUFF.HIA to SHUFF.HEX
  Started HEXCOM SHUFF
  Downloaded the following assembly programm:

        (80E8)  0001  org  33000
  80E8  2A06FF  0002  ld   hl,(65286)
  80EB  E5      0003  push hl
  80EC  21409C  0004  ld   hl,40000
  80EF  1150C3  0005  ld   de,50000
  80F2  01F401  0006  ld   bc,500
  80F5  EDB0    0007  ldir
  80F7  C9      0008  ret
                0009  
  80F8  (0000)  0010  end

  D33000,16.  Started sendfile B:\SHUFF.CPM
  Executed program  E33000.
  Looked at file:  U50000,454.  It was here.

Using the UZE System with a High Level Programming Language

This might be simple or tedious, depending how the data communications protocol is suported by the language. Tests with Turbo BASIC (PowerBASIC 1.0) showed a problem in reception. The read command returns only after a cr/lf-sequence was received. This small programm could be made to work, however.

  crlf$ = chr$(13)+chr$(10)              'just to make life easy
  open "com1:9600,n,8,1,cs,ds,cd" as #1  'RTS and CTS active
  com(1) on                              'event trap on com-port
  cls                                    'clear screen
  do                                     'infinite loop start
    print "Ready>";                      'a prompt
    line input A$                        'user input of commands
    if left$(A$,1) = "$" then exit loop  '$-char terminates loop
    A% = instr(A$,"%%")                  '%%-is place holder for cr/lf
    if A% > 0 then mid$(A$,A%,2) = crlf$ 'relace %% by cr/lf
    print# 1,A$                          'output command string
    on com(1) gosub GetIt                'if a character received
    print                                'insert a cr/lf on screen
  loop                                   'infinite loop end
  print "Stop"                           'say end at console
  stop                                   'stop programm
  system                                 'return to system
  '
  '
  GetIt:                                 'event trap subroutine
  print "!";                             'mark that a char was received
  line input#1, B$                       'get received string
  print B$                               'display received string
  return                                 'resume in loop

Testrun: READY>D40000,10,HoroSoft%%U40000,12.  (input data)

  !HoroSoft                                    (received data)
  READY>$                                      (exit loop)
  STOP                                         (stop mark)

Known Problems or Bugs

None at this time. Free space to note any is provided between these brackets: [ ].


A Terminalprogram for the Universal Z80 Engine

A terminal program for the UZE-system with the name UZETERM was developed for the PC-/MS-DOS environment. Up- und download from/to UZE from mass storage devices such as diskettes and harddisk is a featured working option. Its only bug at the time of writing is an unclosed file if any was unsuccessfully opened. This will rectified with version > 1.02.


Extended A(uxy-Commands (Version 2.xx)

Version — Syntax: aVer.
Version returns the current Version of the Extended UZE firmware by uploading a text. The "Versi0"-label can be used to upload ascii text of any length, provided the text ends with a byte 255 (chr$(255)). The Versi0 label is defined in the list.

List — Syntax: aList{,v|n}.
List lists all defined Extended A-command like VLIST in fig-FORTH. List can also list the named UZE-variable names. List without a parameter or with any parameter except "V" lists the A-command names. To list the variable names, the "V" parameter must be used.

Example: aList,v. lists the variable names; aList,n. lists the A-command names.

SetVar — Syntax: aSetVar,varname,subvar,value.
VarSet can be used to set a named system variable to a value. This may not always have the desired effect! Not all variable names are defined as in the assembler listing. "aList,v." lists the names. Unlisted variables can be accessed through a subvariable offset. The number handling for the value entered will meet the UZE convention and limitation as described in the General Considerations, Commands above.

  • varname: is the system variable name as defined and listed by aList,v.
  • subvar: is the nth variable after varname
  • value: is an unsigned 16-bit integer
Defined variable names (varname)
MCFAdrMemory Check Fail address
IModeOInterrupt Mode-One (1) vector
NMIVecNon-maskable Interrupt vector
ILoopVInfinite Loop Variable
TASKCommand TASK address
EXECCommand EXECute address
DNLDCommand DowNLoaD address
UPLDCommand UPLoaD address
HELOCommand HELlO address
MONICommand MONItor address
AUXYCommand AUXilliarY address
PARAMParameter-1 address
IModeZInterrupt Mode-Zero (0) Vector

For the T, E, U, D, H and A commands and for Param(eter:

  • subvar = 0: C?addr and param1 (address)
  • subvar = 1: C?byte and param2 (byte count)
  • subvar = 2: C?pntr and param3 (pointer)
  • subvar = 3: C?cntr and param4 (counter)

Any system variable can be accessed through the subvar-offset. SetVar is an easier form of the D(ownload command.

Example:   aSetVar,MCFadr,74,10. will set IQRSP to 10 and the system will crash! The unnamed variables should not be "poked"!

RetVar — Syntax: aRetVar,varname,subvar.
RetVar is the complementary function of SetVar extended A-command. It returns the value of the variable in ascii-decimal. If SetVar can be compared with POKE, for RetVar, PEEK would be appropriate. For the meaning of "varname" and "subname" see SetVar above.

Any system variable can be accessed through the subvar-offset. RetVar is an easier form of the U(pload command.

Example:   aRetVar,MCFadr,74,10. will return IQRSP.


Source Code

The listing generated by the Cromemco macro assembler, the symbol table and the cross reference list is provided in the Adobe Portable Document Format (PDF): uze201.pdf (38 pages).

 
  © 2004 - 2018 by Horo Wernli.