Project Z - Inferno computer

Discussion in 'The Projects Forum' started by Robin Mitchell, Jan 21, 2011.

  1. Robin Mitchell

    Thread Starter Well-Known Member

    Oct 25, 2009
    Hi everyone,

    In the past 6 months i have REALLY learnt alot about CPU's, memory etc...
    So i am starting a new project called:

    It is a z80 based computer with 64K ram, a very tiny OS (hopefully less than 1K), video out and possibly (but unlikely) one channel sound.

    I have already made simple z80 systems only consisting of CPU and memory. I am using two PIC18F45K20, one for video and the other for keyboard + IO control (allthough i need someone to advise me a smaller, better chip to use as keyboard control, the PIC18F45K20 is big :p ).

    This will all be mounted in one 80's style case with PS2 keyboard etc...
    I want it to have tape memory as well (for external storage) but need help on that one...unless i use the PIC18F45K20 extra port as a decoder..yeah that could work...Anyway

    The OS is dead simple, it has only these commands:
    N - Start a new program
    S - Save program
    L - Load new program

    When in new program mode, it firsts asks for an address, then the data to be stored in that address and then displays the line.

    What do you think, any questions, adivce???
    Could really use some for the OS and tape interface...

    forgot to mention, it will have a composite video as well so it can connect to most tv's :p
    Also, how do you connect to a floppy device :S ???
    Last edited: Jan 21, 2011
  2. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    Try an SD card instead of a floppy or tape interface.

    Floppy is unreliable, tape requires essentially another processor inside for modulation on recording/reading (QAM, maybe a modem could be hacked?)
  3. Wendy


    Mar 24, 2008
    God, don't use a tape device. You want a tape device I have a nice old TRS80 I would be willing to give you, with a complete set of maintenance and programming books.

    I would spend hours writing code, only to loose it because audio tape is unreliable. By comparison diskettes are much better, and hard drives (and later) are better that that.

    The Commodore PET, TRS80, Apple, and many more managed to do audio tape with not too much extra circuitry. PET's were 6502 (as were Apple), and used a simple FSK scheme that was the best by far. Of course, they also used PROM to program the CPU to read the data. TRS80's were Z80, as were Sinclairs.

    I've been doing this computer stuff for a very long time. Does it show?

    The best simple design I've ever seen was the Timex Sinclair (not the color model). With 5 chips, including the Z80 and 7805, it was a complete Z80 computer. They saved a few too many pennies on the power supply jack though, so I gave it up in frustration. Nothing like writing an 8K BASIC program and loosing it because the power jack wiggled. The Z80 generated the video signal, and read the cassette tape petty well with these constraints.

    I would seriously consider dipping deep into prior art on this. There are some seriously cool designs out there.
  4. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    I made one of those kits 30 some years ago. I fondly remember the "Fast mode" that simply stopped updating the display so it could do calculations faster.

    That and the pain of losing 8 hours of typing on that stupid tiny membrane keyboard. That was my first extra computer project, building a "real" keyboard for one.
  5. Robin Mitchell

    Thread Starter Well-Known Member

    Oct 25, 2009
    i have a spectrum :p (well two acctually)
    bbc micro, commodore 64, amstrad 464 and electron XD
    Love them all

    I want to do this computer as little chips as possible with inbuild membrain keyboard (jokes, molded keyboard ;) )
  6. Wendy


    Mar 24, 2008
    Figure an 8 bit computer can use 64K max. The C128 got around this limitation, as did the XT, by switching banks of 64K RAM, which was a major pain in the assets for programmers. It also meant some precious RAM had to be lost, as (if memory serves) it needed to be common to all the banks to communicate values for programs that used more than 64K.

    What my rambling is leading up to is it should be possible to use an SD card as both HD and RAM, with the right drivers. I mean seriously, 512K SD card is almost impossible to find anymore, and you need RAM. A Z80 is so slow by current standards (2Mhz?) that an SD card might be able to keep up.

    I was typing this the same time Mitch was making his post, so I'll add another thought. You need a PROM for the OS, the SD card might be able to fill this need too. It can be programmed at any modern computer, and them become an integral part of your project. Just a thought.

    If you can use a conventional keyboard. You'll sprain something otherwise. When I saw the Sinclair version I loved it, because keyboard were "part" of the computer and this one was immune to drinks. I like the replaceable keyboard much better, it is easier to type on at speed, and it is cheap.
    Last edited: Jan 21, 2011
  7. Robin Mitchell

    Thread Starter Well-Known Member

    Oct 25, 2009
    why is the maximum memory accessible by 8 bit 64K ? I though it was 512K...
    8 bit CPU's have 16 bit addressing....2^16 = 65536
    65536 * 8 = 524288 = 524K memory
  8. kubeek

    AAC Fanatic!

    Sep 20, 2005
  9. Wendy


    Mar 24, 2008
    Nope. This is a weakness you have been fighting from square one. Memory is measured in bytes, not bits.

    A 8 bit computer has a data buss of 8 bits (1 byte). While it is not true anymore this used to mean it had an address buss of 16 bits (two bytes). 2^16 = 65536 bytes Note the difference between bytes and bits.

    There are very good reasons why the address buss was double the data buss (and the data buss is separate from the address buss).

    Take a typical 8 bit CPU assembly language command that is 3 bytes long,

    LD A LO,HI

    LOAD A is the first byte (the opcode), LO and HI are two bytes that make a 16 bit address. The LO HI convention simplifies circuitry in the CPU, much like reverse polish did for calculators. A is loaded with the byte stored at the address.

    On your earlier CPU experiments you were trying to use a 12 bit address for a 4 bit word (a 4 bit CPU). How would you create an assembly command as shown above in 3 bytes? It would need 4 bytes, which eats up a small memory bank fast. It also screws up the LO HI convention something fierce.

    A 4 bit CPU such as the 4004 can have a max of 256 bytes. Each byte is 4 bits long. Everything is scaled down, but the commands still follow the 3 byte command format convention.

    The Pentium and beyond the conventions started shifting a bit, so I'm not checked out on theory as I am 8 bit computers. However, I think I can extrapolate some details. They still use 3 byte commands, using the LO / HI convention. Each byte is 16 bits however, and the address is 32 bits long (still two bytes). The means the max address for the early 16 bit machines is around 4.3Gig. The power of squaring adds up fast. I *think* in terms of data usage on hard drives and what not 8 bits is still considered a byte.

    What assembly languages do you know? This would help you in learning and completing your goals. I have two under my belt, 6502 and Z80. Z80 is a spin off of the 8080 processor, as is the 8086. They are cousins of the same family.
    Last edited: Jan 22, 2011
  10. Robin Mitchell

    Thread Starter Well-Known Member

    Oct 25, 2009
    z80 :p language
  11. Wendy


    Mar 24, 2008
    You want a language that is a dream to learn look at the 6502. By the time Z80's came along they had evolved dramatically from the original 4004 op code set. Evolution means there are commands that were just created and stuffed into the op code set without any organization.

    The 6502 on the other hand, was written from scratch around 8 bit concepts. All the commands relate to each other and are grouped logically, which makes learning them much simpler. You can can extrapolate 6502 commands looking at others. Back in the heyday of the C64 many young programmers were writing code directly to video memory (using characters from the keyboard), no assemblers required, because of this organization. You typed in a stream of characters, did a sys call and if you got it right it worked.

    The Z80 is a more powerful processor, it has some really powerful op code commands, but you're going to need a manual just to look up the op code set until you start memorizing it. The stand alone commands, and commands that are not grouped together, are killers. However, you'll come across some commands you didn't know existed (such as looping for example) that will allow you to simplify chunks by 15 bytes or more. Memory in 8 bit CPUs is at a premium (unlike today), so it mattered.
  12. jgessling

    Well-Known Member

    Jul 31, 2009
    You might be interested in the Heathkit et-3400 as a computer/breadboard combo. I got mine for $20 at a flea market and it's great fun, with a small monitor in ROM and simple enough to actually understand what's happening. There's a whole world of old computer buffs around, check it out. And yes, I've got a couple of Sinclairs too.
  13. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    Splendid Idea!

    4 on eBay, one is $99 buy it now, others are $20-$50

    May get you halfway to where you are trying to be, for a very decent value.
  14. Robin Mitchell

    Thread Starter Well-Known Member

    Oct 25, 2009
    Update, thinking about my OS system, KIWI: Here are notes on it and so on and so forth:

    Code ( (Unknown Language)):
    2. Inferno Operating system (kiwi)
    4. On boot up check IO port for graphics card
    5. and retrive the version
    7. Display OS info
    9. Menu:
    11. -----------
    12. New
    13. Load
    14. Run
    15. View memory
    16. -----------
    18. New program:
    19. Enter address:
    20. Enter value:
    21. >If Esc key entered, go back to menu
    22. >Once data is entered, follow the sub routine Display and HEX display
    25. Load:
    26. Set data out to PIC
    29. Run:
    30. Set program counter to address location, if pause/break hit then reset CPU but not memory
    32. View memory:
    33. Print out memory contents between two numbers
    36. Sub routines:
    37. -----------------------------
    38. Display ASCII character
    39. - Set A to the character code
    40. - Set B to the X pixle
    41. - Set C to the Y pixle
    43. On routine >>
    44. > Out A, address = 0001
    45. > Out B, address = 0010
    46. > Out C, address = 0011
    47. -----------------------------
    49. -----------------------------
    50. Display HEX character
    51. - Set A to the number
    52. - Set B to the X pixle
    53. - Set C to the Y pixle
    55. On routine >>
    56. > Out A, address = 0100
    57. > Out B, address = 0101
    58. > Out C, address = 0110
    59. -----------------------------
    62. Rom info for text:
    64. Add (HEX)    Binary
    65. =====================
    67. New
    68. 03E8            01001110
    69. 03E9            01100101
    70. 03EA            01110111
    72. Load
    73. 03EB            01001100
    74. 03EC        01101111
    75. 03ED        01100001
    76. 03EF        01100100
    78. Run
    79. 03F0        01010010
    80. 03F1        01110101
    81. 03F2        01101110
    83. View Memory
    84. 03F3        01010110
    85. 03F4        01101001
    86. 03F5        01100101
    87. 03F6        01110111
    88. 03F7        00100000
    89. 03F8        01001101
    90. 03F9        01100101
    91. 03FA        01101101
    92. 03FB        01101111
    93. 03FC        01110010
    94. 03FD        01111001