Welcome, Guest. Please login or register.


Author Topic: Internal memory expansion plus USB (Read 5271 times)

Offline elmer

  • EP fan
  • *
  • Posts: 196
  • Country: us
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Firefox 86.0 Firefox 86.0
    • View Profile
Re: Internal memory expansion plus USB
« Reply #15 on: 2021.March.04. 17:18:11 »
Yes, the difficulty with serial is that it's a continuous stream rather than a file system - so we'd have to implement some protocol on top of it to transfer files. I've had a little success using the built in serial port to transfer files from a laptop (slowly), but there's no way of choosing the files from the EP end, and it never knows when the file ends.

However, there's probably already an xmodem client for CP/M or something like that.

You are absolutely correct!

The problem of transferring files across a serial link was solved back in the 1980s/1990s, but we have just not had a reason to use those old solutions on the Enterprise, yet.

There are already CP/M versions of XMODEM, ZMODEM and KERMIT file-transfer programs.

There is the classic CP/M communications program ZMP, and a modern port of ZMP using the latest Z80 version of HiTech C.

There is a modern version of KERMIT called E-KERMIT which can probably be compiled for the Enterprise using SDCC.


The PC side of any file transfers can use TeraTerm or PuTTY on Windows, or minicom on Linux.


All of that software is already written, we just need to either configure it, or build it, for the Enterprise.

That does not mean that it will be trivial to get working, but it is not like we are starting with absolutely nothing.


-  Is it possible to use only the usb expander without memories? (I already have 1 GB built-in + SF3 + FDD interface)
- The amount of shipping cost should be added to the calculated price. (I think.) How much would it be?

This board connects to the Enterprise motherboard's EXP1 and EXP2 connectors, and so I don't believe that you could use it with your current 1MB expansion board, you would have to replace that board with this one.

Shipping from the USA to Hungary for my other memory boards has cost about $17 USD (approx 5,100 HUF).  If a lot of people were interested in this board, when it has been manufactured and we are sure that it works correctly, it might be cheaper to send all of the boards in one package, and then have someone in Hungary distribute them out to everyone.
« Last Edit: 2021.March.04. 17:56:46 by elmer »

Offline Judge

  • EP user
  • *
  • Posts: 469
  • Country: hu
  • OS:
  • Windows NT 10.0 Windows NT 10.0
  • Browser:
  • Chrome 88.0.4324.190 Chrome 88.0.4324.190
    • View Profile
Re: Internal memory expansion plus USB
« Reply #16 on: 2021.March.04. 17:54:20 »
If a lot of people were interested in this board, when it has been manufactured and we are sure that it works correctly, it might be cheaper to send all of the boards in one package, and then have someone in Hungary distribute them out to everyone.

Hi John,

That's what I undertake.


√údv.Judge

Offline elmer

  • EP fan
  • *
  • Posts: 196
  • Country: us
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Firefox 86.0 Firefox 86.0
    • View Profile
Re: Internal memory expansion plus USB
« Reply #17 on: 2021.March.04. 19:00:37 »

Offline gflorez

  • EP addict
  • *
  • Posts: 3159
  • Country: es
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Firefox 86.0 Firefox 86.0
    • View Profile
Re: Internal memory expansion plus USB
« Reply #18 on: 2021.March.04. 20:22:51 »
I have seen similar solutions, the best one is the ZX Spectrum Interface 1 Bis, a modern approach to the Microdrives... as partitions on a micro-SD.

It also has a micro-USB port that you can connect to a PC, where a daemon app interacts with the Interface.

The interface connected to the Spectrum has a modified Rom with a special driver to manage a directory on the PC so, from the user point of view, a very big storage unit can be managed at high speed. Along storage, there are also other valuable options, like a virtual printer and Internet connection through the PC.

If I remember well, the linked page has some sources of the files used.
« Last Edit: 2021.March.04. 20:33:54 by gflorez »

Offline elmer

  • EP fan
  • *
  • Posts: 196
  • Country: us
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Firefox 86.0 Firefox 86.0
    • View Profile
Re: Internal memory expansion plus USB
« Reply #19 on: 2021.March.05. 22:33:37 »
I have seen similar solutions, the best one is the ZX Spectrum Interface 1 Bis, a modern approach to the Microdrives... as partitions on a micro-SD.

Cool, I didn't know that someone had done that for the Spectrum! :cool: :ds_icon_cheesygrin:

I am more familiar with other projects that do the same kind of thing, such as DriveWire for the Tandy Color Computer, and RespeQt for the Atari 800.

Something like those could also be done on the Enterprise, but you would really want to integrate it into EXDOS, and it would be a lot of work that I am afraid might never be done, especially since you would have to be careful not to break the existing versions of EXDOS that people use for floppy discs and the SD Card adapter.

It wouldn't be fair for me to get people's hopes up about that, because it is not something that I am personally interested in working on. It is far more than I need or want.

Writing a small program to transfer a file across the serial link, and then use an existing EXDOS ROM to save it to floppy/SD is *much* easier to develop, and much more likely to get completed because it is a manageable project.

Offline elmer

  • EP fan
  • *
  • Posts: 196
  • Country: us
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Firefox 86.0 Firefox 86.0
    • View Profile
Re: Internal memory expansion plus USB
« Reply #20 on: 2021.March.05. 22:35:19 »
I'm getting closer to a final design! :mrgreen:

Offline gflorez

  • EP addict
  • *
  • Posts: 3159
  • Country: es
  • OS:
  • Windows NT 6.3 Windows NT 6.3
  • Browser:
  • Firefox 85.0 Firefox 85.0
    • View Profile
Re: Internal memory expansion plus USB
« Reply #21 on: 2021.March.06. 09:14:33 »
Something like those could also be done on the Enterprise, but you would really want to integrate it into EXDOS, and it would be a lot of work that I am afraid might never be done, especially since you would have to be careful not to break the existing versions of EXDOS that people use for floppy discs and the SD Card adapter.

Don't worry about breaking EXDOS... it stands for EXpandable Disk Operative System. In fact, the SDEXT.Rom is a driver extension to integrate the SD on the system, and there is even an IDE driver, also written by Zozo.

But there are other imaginative ways to add file management to the Enterprise, for example the FILE I/O driver that IstvanV uses on the emulator to manage a PC directory, and the "tunnel" like driver used by Geco on the SF3. They work even on a Tape only Enterprise(without EXDOS), managing the default device of EXOS. I name them tunnel drivers because they are able to manage the unknown format on the PC drive or a FAT32 formatted pen-drive, transparently to the user.

A file transfer manager will be an excellent start for your USB port, but please, leave the hardware well documented just in case...
« Last Edit: 2021.March.06. 09:20:11 by gflorez »

Offline elmer

  • EP fan
  • *
  • Posts: 196
  • Country: us
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Firefox 86.0 Firefox 86.0
    • View Profile
Re: Internal memory expansion plus USB
« Reply #22 on: 2021.March.06. 18:49:18 »
A file transfer manager will be an excellent start for your USB port, but please, leave the hardware well documented just in case...

Just like my 512KB memory board, I will upload all of the design files and Gerber files here once the first batch of boards is sold, and I have covered the actual production costs for making the boards (excluding my time).


I have looked at Zozosoft's memory test code in the EXOS 2.4 ROM, and I hope that I have chosen a specific set of USB port addresses, so that the memory region will not falsely detected as either RAM or ROM by the Enterprise.

Here are the current details ...

The address range is selected which file is used to program the ATF16V8BQL GAL.


Option 1:

  Segments $78-$7B - USB
  Segments $7C-$7F - RAM
  Segments $C0-$FB - RAM

Option 2:

  Segments $B8-$BB - USB
  Segments $BC-$FB - RAM


If Option 1:

  $78:00xx - Status Port Address  (read only, write is ignored, bits 0-4 can be used to detect if the hardware exists)

    bit 7 = PWREN# (0 when active USB connection to a PC)
    bit 6 = RXF#   (0 when you can read data from the FIFO)
    bit 5 = TXE#   (0 when you can write data to the FIFO)
    bit 4 = 0
    bit 3 = 0
    bit 2 = 1
    bit 1 = 0
    bit 0 = 1

  $78:01xx - Data Port Address  (read and write)

    USB data FIFO.


If Option 2:

  $B8:00xx - Status Port Address  (read only, write is ignored, bits 0-4 can be used to detect if the hardware exists)

    bit 7 = PWREN# (0 when active USB connection to a PC)
    bit 6 = RXF#   (0 when you can read data from the FIFO)
    bit 5 = TXE#   (0 when you can write data to the FIFO)
    bit 4 = 0
    bit 3 = 0
    bit 2 = 1
    bit 1 = 0
    bit 0 = 1

  $B8:01xx - Data Port Address  (read and write)

    USB data FIFO.


The port addesses are mirrored for 4 segments, i.e. a 64KB address range.

Within each segment, the port addresses are mirrored every 512 bytes, i.e. only
A8 is used for decoding the address within the 64KB address range.



<Modified 2021-03-18 to swap RXF# & TXE# bit order to match latest board design.>
« Last Edit: 2021.March.18. 16:38:42 by elmer »

Offline gflorez

  • EP addict
  • *
  • Posts: 3159
  • Country: es
  • OS:
  • Windows NT 6.3 Windows NT 6.3
  • Browser:
  • Firefox 85.0 Firefox 85.0
    • View Profile
Re: Internal memory expansion plus USB
« Reply #23 on: 2021.March.06. 22:22:27 »
Great. Have you looked at LGB's Z80 ports list?

Since the time he created the list, other hardware have taken position, for example, SF3 uses 20-2F and 40-4F ranges(incompatible with the Spectrum Hardware emulator).

I see you use F8h and B8h as communication ports. Good selection, single unused ports, but you must re-assure that these are not mirrors ports of other nearer ports, from the RTC card or Dave.

Usually, a wealthy EP returns 255 from an unused port(for example "PRINT IN(XX)"  ), but I don't know how to test a port on Output.
« Last Edit: 2021.March.06. 22:54:36 by gflorez »

Offline geco

  • EP addict
  • *
  • Posts: 6266
  • Country: hu
  • OS:
  • Linux Linux
  • Browser:
  • Chrome 88.0.4324.181 Chrome 88.0.4324.181
    • View Profile
Re: Internal memory expansion plus USB
« Reply #24 on: 2021.March.07. 00:01:20 »
Great. Have you looked at LGB's Z80 ports list?
As i see there is no direct port usage, they are memory mapped ports.
What i do not understand in this moment how they works, each 78:00xx status registers have relation to 78:01xx, ex 0000 belongs to 0100? And these ranges are totally mirrored in the 4 "port" segment also? so 78:00xx has the same content as 79:00xx or 7a:02xx?
I think both option is good, i like better option 2 :-)

Offline elmer

  • EP fan
  • *
  • Posts: 196
  • Country: us
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Firefox 86.0 Firefox 86.0
    • View Profile
Re: Internal memory expansion plus USB
« Reply #25 on: 2021.March.07. 00:12:48 »
I see you use F8h and B8h as communication ports. Good selection, single unused ports, but you must re-assure that these are not mirrors ports of other nearer ports, from the RTC card or Dave.

I suspect that you have misunderstood what I wrote ... which is a very easy thing to do when we're both relying on Google Translate! ;-)

The two USB hardware port addresses are not mapped into the Z80's I/O Port address range, because the Z80's /IORQ signal is not available on either EXP1 or EXP2, and frankly even if it was, there are not enough pins on GAL16V8 to map both RAM segments and I/O ports.

The USB hardware occupies a 64KB region in the Enterprise's 4MB memory map (i.e. 4 segments) ... which is why I have to be careful that the EXOS scan for RAM/ROM segments will not harm the USB chip.

Using a whole 64KB region is somewhat wasteful, but we can afford the memory space, and it is the best solution that I could think of actually building something that is both affordable and easy-to-install.

Offline elmer

  • EP fan
  • *
  • Posts: 196
  • Country: us
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Firefox 86.0 Firefox 86.0
    • View Profile
Re: Internal memory expansion plus USB
« Reply #26 on: 2021.March.07. 00:43:20 »
As i see there is no direct port usage, they are memory mapped ports.

Precisely, yes! :)


What i do not understand in this moment how they works, each 78:00xx status registers have relation to 78:01xx, ex 0000 belongs to 0100? And these ranges are totally mirrored in the 4 "port" segment also? so 78:00xx has the same content as 79:00xx or 7a:02xx?
I think both option is good, i like better option 2 :-)

The hardware only uses address bits A21-A16, which define a 64KB region (4 segments), plus A8 to chose between the STATUS and DATA registers of the USB interface.

A0-A7 and A9-A15 are ignored, because there aren't enough pins available on the GAL16V8, and because even if there were, routing the extra address lines on the board would be horrible.

So you can read the STATUS register at $78:0000, or $78:0001..$78-00FF, or $78:0200-$78:02FF, or $78:0400-$78:04FF, and repeated all the way up to $7B:3EFF.

In the same way, you can read the DATA register at $78:0100, or $78:0101..$78-01FF, or $78:0300-$78:03FF, or $78:0500-$78:05FF, and repeated all the way up to $7B:3FFF.


The two registers are put 256 bytes apart from each other so that the EXOS routines that detect memory will never try to read or write the DATA register, and so that a simple INC H or DEC H can be used to switch between the registers.

So, to read a sequence of bytes from the USB FIFO, with 'BC' being the number of bytes to read, and 'DE' being the address where you want to put them ...

Code: [Select]
LD A, 78h
OUT (0B1h),A

INC B
LD HL, 4000h
.WAIT: BIT 5,(HL)
JR NZ,.WAIT
INC H
LD A,(HL)
DEC H
LD (DE),A
INC DE
DEC C
JR NZ,.WAIT
DEC B
JR NZ,.WAIT
« Last Edit: 2021.March.07. 00:53:58 by elmer »

Offline geco

  • EP addict
  • *
  • Posts: 6266
  • Country: hu
  • OS:
  • Linux Linux
  • Browser:
  • Chrome 88.0.4324.181 Chrome 88.0.4324.181
    • View Profile
Re: Internal memory expansion plus USB
« Reply #27 on: 2021.March.07. 01:39:08 »
so the different status, and data registers are equivalent, and i can use ex status register 78:0000 and data register 78:0114 for reading/writing the data (i know it does not make sence, because in this way the operation is slower), because a0 - a7 are ignored.

Offline elmer

  • EP fan
  • *
  • Posts: 196
  • Country: us
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Firefox 86.0 Firefox 86.0
    • View Profile
Re: Internal memory expansion plus USB
« Reply #28 on: 2021.March.07. 01:58:37 »
so the different status, and data registers are equivalent, and i can use ex status register 78:0000 and data register 78:0114 for reading/writing the data (i know it does not make sence, because in this way the operation is slower), because a0 - a7 are ignored.

Yes, that is correct ... but only with this specific version of the hardware. ;-)

It is best if we all just agree to write our programs to access the USB ports at $78:4000 and $78:4100 (or $B8:4000 and $B8:4100), because then the hardware can be improved in the future without breaking anything.


For instance, in the future, if we used a GAL20V10 for memory decoding instead of a GAL16V8, then we get an extra 4 I/O pins to use for fun stuff.

That would allow for more ports, or for something like an 8KB dual-port RAM that could provide shared memory with a Z280 ... all on one small internal board.

It might never happen, but it is best if all of us programmers just behave politely, and we'll see if someone invents something cool in the future. :)  :cool:
« Last Edit: 2021.March.07. 02:04:57 by elmer »

Offline gflorez

  • EP addict
  • *
  • Posts: 3159
  • Country: es
  • OS:
  • Windows NT 6.3 Windows NT 6.3
  • Browser:
  • Firefox 85.0 Firefox 85.0
    • View Profile
Re: Internal memory expansion plus USB
« Reply #29 on: 2021.March.07. 09:17:12 »
I suspect that you have misunderstood what I wrote ... which is a very easy thing to do when we're both relying on Google Translate! ;-)

The two USB hardware port addresses are not mapped into the Z80's I/O Port address range, because the Z80's /IORQ signal is not available on either EXP1 or EXP2, and frankly even if it was, there are not enough pins on GAL16V8 to map both RAM segments and I/O ports.

I thank you for the care with which you have answered my ignorance...

I usually read too fast without reasoning and that creates imperfect conclusions.

Now, re-reading your messages, I can(slowly) understand the mechanism. Yes, you don't have /IORQ directly.