Saturday, January 23, 2016

Elfish fun

I have a lot of old systems. By that I mean not a PC as we now know them or anything
running X86 and wide ranging. 

Every so often I pull out one of my Elves and play.   The smaller ones are a drag 
on old hands that have grown to hate toggle switches.  I have very elaborate ones 
like my Embedded ELF2K that run the sophisticated ELFOS from a CF disk.
But for playing that's a handful.  So an intermediate ELF is in the works.

An intermediate elf is a basic ELF as published in Poptronics (Popular Electronics)
in 1976 with extensions.  The ELF was a 256bytes or ram with toggle switches 
minimal machine with a two digit LED display.  A very minimal machine 13 ICs in 
all one one above the SSI (small scale integration level) and that being the 1802 
Cosmac cpu.  very basic but enough to tech programming hand a few fun software 
games.  The CPU was easy to interface to and tended to invite people to extend
into the larger realm.  Those that have played with the 1802 know this.

This design is an extended ELF. Keep the switches, IO and display and add 
address display (16bit) and latch the upper 16 bits.  With 64K of address space 
the divide is lower 32K is a 61256 ram (32K) and the upper will have UT4 monitor 
rom as I have one at 8000H (upper 32K) and ram 6116 at F800H because its 
handy to have some ram for a scratch pad..   At address E000 to EFFFh we 
can put a few 2816 EEPROMS for storing the developed OS. Terminal
 (serial) IO will use Q and EF 1.    

FYI the standard ELF (PE and QUEST) the N2 line is used for the data out
to the two hex displays (n=4 or higher) and switches in. This is important 
as it reserves some IO.  The alternate is to fully decode the IO.  its only one chip.

To address a large parallel flash (1MB) I need 20 bits for address and data 
in and data out.  The use of IO lines N0 and N1 will address the IO. This is built 
as both lines will decode as 2 ports where N0=1 and N1=0  is input or output 
of data and N (in or 69 and out 61) and port N0=0 and N1=1 is a address out
(62 instruction) and to get the needed address byte I output 3 bytes 
and the hard wave stores then in sequential order.  The hardware are 6 
4 bit binary upcounters (74C161).  That provides up to 24 bits or address 
(enough for a 16MB flash ram).  The counters count up after every read or 
write to data port (61 or 69) so that every read or write done points to the 
the byte to be read or written. The devices for the address are wired 
as a 3 byte shift register where three writes to the port 2 are sequenced into the
counter and two latches.  Typical output would be 3 bytes of 12H, 34H, 00. 
The result is the high latch has 12H, the mid latch has 34H and the two 4bit 
counters have 00.  Very simple.  Simpler than CF or SD though maybe later.

Right now I'm playing with an idea for a simple OS that uses a large (1M to 4MB)
parallel flash memory as storage but far less elaborate that Mikes ELFOS.  The 
idea is a simple "bag and tag" with Load, Store, Jump. Create, Delete, List, and 
terminal IO.  the idea is minimum space for system code and using IO to address
the flash memory.

FYI: "bag and tag" for those not familiar with old and crude OSs like NorthStar 
DOS is something like this.

A storage BLOCK is a convenient binary chunk like 256 bytes.
A storage device has BLOCKs logically numbered 0 though NNNN.
For this its assumed any physical device large enough to store 
the desired files.  For example a 1MB flash ram would store 4096
256byte BLOCKs of data and we would logically address them as 
0 to 4095.

Each file directory entry uses 16 bytes (binary round number).

So with this there are 16 possible entries for a BLOCK.  IF we want to 
store more than 16 files (space permitting) then we can assign several 
blocks as a directory.

filename, storage_starting_block, size_of_file, IN_RAM_address, Spare, Type_of_File,

File name is 8 bytes         Example FILENAME
storage_starting_block     two bytes that are the starting BLOCK in storage
Size_of_File                      number of BLOCKs needed to hold the entire file.
IN_RAM_address             An optional address of where the OS should put the file in ram.
SPARE                            might contain read only flag or other uses.
Type_of_File                     Type of file, binary executable, BASIC, other?

Example  FRED  1234 0005 0000 0 0

An file called FRED, stored at logical block 1234,  5 blocks long (1280bytes),
loads at location 0000, and is a binary executable.  Not super readable for humans
but enough.

Takes very little code to find the file in  the storage,  copy to ram and execute it.
though back in the day the device rather than a flash ram something like a floppy 
would take a bit of code to make the BLOCK address into track and sector and 
of course hardware to do it.  Its enough to store a file, recover it, execute it
and if desired delete it.  With the right tools (programs) stored program generation
is easy.  Programs that might fit the use would include BASIC language, Assembler,
editor, file transfer via serial line from a larger host system.  Enough to be useful.

One of the things this system will do is not store the operating system on 
the media.  No reason to and we will have enough EEPROM space 
for storing it.  It simplifies the mass storage media as we don't need to reserve
space for the "system".

Why do this?  Every day I use a Linux box with a level of sophistication that 
boggles the mind and Gigabytes of software.  Its fun to build a system both 
hardware and software that one can wrap a mind entirely around with full 
understanding.  That and it keeps one rooted.


Allison

No comments:

Post a Comment