Studying for Mass Storage…

Now that TB 2.5g and G-DOS 0.50b are finalized and out there in the wild, it’s time to turn our focus to Mass Storage.  That’s right, we need to be able to add, remove, modify, and use files contained in some type of file system.  The type of file system may be up for debate.  But regardless of what we decide to do with this computer, we need a way to access binary files, BASIC programs, etc.

So the two main types of file systems of interest to us would be FAT or a CP/M file structure.  Considering that this computer only has 32k of RAM, that dissolves any idea of using CP/M without major modifications.  That’s another project for another day.  FAT on the other hand has several advantages.  Firstly, it is readily readable by a modern PC.  Which means that we should be able to write and transfer files between this computer and a PC with ease.  Secondly, it is highly documented.

Knowing this I set out to learn everything that I could about the hardware side of the SD format.  First thing I discovered is that there are two protocols for communicating with an SD card.  The first is SPI, a pretty straight forward protocol similar to what one would use with Serial Shift Registers. The second is SDIO, which is completely undocumented.  Knowing this I knew that I would be using SPI.  So I would need the following pins: Clock, MISO, MOSI, and Chip Select.  That is in addition to the 3.3v supply voltage.  Speaking of 3.3v, i would also need to level shift from 5v to 3.3v and vice versa.  Luckily I recently ordered 74LS07 Open Collector Buffers, so this is no problem.

But how would I drive these pins?  Well, that is when I began thinking about the onboard 8255 PIO.  Obviously it has plenty of pins…but I wanted to use that for general purpose I/0…  And besides, I do not want to dedicate one whole port to just one input pin!  But wait!  If I were to add a z80 PIO I could use it in Mode 3, or I/O mode!  That means I can specify in software whether a pin is input or output!  Fantastic, I have the hardware figured out.  Now onto the SD SPI Protocol.

And that is where I am at now.  Reading in the plethora of information available on the web, which doesn’t really give me much information about the hardware side (like do I write one byte, then read a byte? Or how do I specify where I want to read data from?).  That is until I found the resources below.  And while I am still trying to crawl through the information, I am taking many notes along the way.

If you’re interested in this type of stuff, I suggest giving it at least a once over.  You’ll probably learn something that is of no real use to you outside of this hobby.

https://www.compuphase.com/mbr_fat.htm

Simple FAT and SD Tutorial Part 1

Simple FAT and SD Tutorial Part 2

Simple FAT and SD Tutorial Part 3

Simple FAT and SD Tutorial Part 4

G-80S Update: G-DOS v0.50b Released

It’s here!  TinyBASIC v2.5g hit the Web late last night.  Today, it’s the G80-S Monitor v0.50b.  The link to the download is below.  Several changes were made to simplify use of this software.  As well as the TinyBASIC being updated to v2.5g.

If you find any bugs, please let me know.  Enjoy!

G80S_v0_50b

TinyBASIC 2.5g Released

Behold!  I present to you TinyBASIC 2.5g!

Thats right, it has been anticipated for some time.  I now feel comfortable releasing it into the wild.  So without further delay, the files are available below.  There are two version, one is a version designed to run on the G80-S Micro Computer.  The other is a version with will require you to write a few routines to work with your particular computer.  In the event that your memory is different than 32k ROM and 32k RAM, you’ll also need to play with the memory locations to get it to work properly.

If you have any questions about how to get it running, shoot me an email, I’ll be happy to see what I can do to help.

tinybasic_2_5g

G80S_tinybasic_2_5g

G80-S v0.45t Stable Available for Download

While I iron out some of the details for the release of v0.50b and the v2.5g of TinyBASIC, I figured I better post an updated download for the currect version.  This is a stable pre-release.  And as such, not a lot is going to change between v0.45t and v0.50b.  I’m mostly just working on cleaning up code at this point.  If you’d like to check out the change log, it is attached below.  If you’d like to download the software, I’ve included it too.

I would have like to have already released the v0.50b by now.  But as we all know, sometimes life just gets in the way.  If you have any questions shoot me an email.  The Contact Us page  is your friend.

Also, there is still some availability of the PCB with the PLD option. I’m looking for a dependable supplier for these older parts. Once I do, they will become a more permanent option.

CHANGELOG – v0.45t

G80S_v0_45t

TinyBASIC 2.5g On The Horizon.

TinyBASIC 2.5g is very near release.  The source now includes routines for IN/OUT, PEEK/POKE, CLS, and DELAY.  And the code for executing Machine Code is being worked out.  So all things considered, it is just about ready to dump into the wild.

Along with the release of v2.5g, I will also be releasing the G80-S Monitor v0.50, which will include in ROM TinyBASIC 2.5g.  This greatly expands the ability of the computer by allowing the user to test new hardware on the fly without the need to write code in assembly, and modify the contents of memory from within BASIC.  I’m personally looking forward to the release.

As a note, the G80-S v1.0 boards are up for sale in the store, and on eBay here, and the Prototyping boards will be shortly.  And once I have a chance to do some tinkering with the hardware side of things I’ll be working on code for a FAT file system.

But until then, happy coding!

Contemplating Graphics

I’ve been thinking about graphics the last week or two. One of the items on my list of things to do is to build a video board for the G80-S. However, graphics pose a new problem…

Video Processors of the time period that this computer would exist were very primitive in respect to their capabilities. Wanting to have a machine similar in capabilities to an MSX, this requires me to use a chip compatible with the TMS9918A. The problem with this chip is that it doesn’t have the greatest of text modes. 40×25 characters just doesn’t work for the Monitor program, or any future aspirations of CP/M or DOS, which typically require 80×24 or 80×25 text modes.

There is a solution to this. Grant Searle’s adaptation of Daryl Rictor’s AVR video processor to 80-column text Mode is perfect for CP/M or DOS. But the problem is that: 1) It’s not compatible with the TMs9918A graphics, 2) the graphics mode leaves quite a bit to be desired.

That leaves me contemplating what should be done. I’ve got some ideas, but I figured in the mean time I would play around with a few different projects, at least until my new boards come…

One of the things that I’ve been wanting to play with was a 128*64 pixel graphics display. I bought one off of eBay a while back, and I’ve never toyed with it. 128*64 pixels isn’t a lot to work with. But I figured I should at least be able to get the G80-S to utilize it for it’s display…at least for TinyBASIC. I’d like to have 32-columns at the minimum. At 8-rows that should give a decent display. But cramming 32 characters in a 128 pixel wide display is a chore.

But with luck I came up with what I though would be a decent character set. I’ve attached the images below for your critique. The characters are 4×8 (width x height). That should allow for a 32×8 display and still permit normal graphics. Now I just have to write some code to test it.




TinyBASIC: Variables, Memory, and Expansion

In my last blog post I shared that I have managed to integrate TinyBASIC into my monitor for the G80-S in a ‘mostly stable’ way. Now that has progressed from mostly stable to very stable. But further, the IN instruction has been revised to use variables. Which is quite handy, as it allows the programmer to not only write to I/O, but to also read from it, and make branches in his/her program as a result of those reads.

This is a big step, as it is the basis for other routines that can expand on the original TinyBASIC source code. Routines such as PEEK or POKE may need to use variables, and the ability to use variables to OUT to I/O is also important from a programmers viewpoint. And these routines just simply were not included in the original source, and I desire to have them available in my software. So as such, I’m further modifying TinyBASIC as I see fit.  And yes, when it is done I will release it into the wild.

Variables in TinyBASIC are straight forward once you understand them. To read from or write to a variable one simple needs to understand that they are nothing more than a predefined area of memory, and that they have a given structure.

This area of memory is defined as VARBGN in the TinyBASIC source. And in my personal example of code resides in 55 bytes of data starting from 0xFF00. Now, each variable is broken into two (2) bytes. However, they are not organized as you would assume, with the MSB being first, and the LSB being second (i.e. the way one would read the memory if layed out in from of him). No, TinyBASIC addresses variables just like the z80 addresses memory. I.e. if we refer to location FF88 in memory it will be listed as 88FF. Likewise, if we refer to a variable (for the sake of examples let say it is listed as 01h) in memory, it will be addressed like this:  01h 00h.  Strange, but ok.

Further, the first address of the variables is not ‘A’. I believe that it is ‘@‘ which I also believe is a pointer. But I have not confirmed this. One step at a time…

Now, this means that if we want to use variables it is as simple as figuring out which variable we want to use, and reading from or writing to that area of memory. Simple right!

As a result I have rewritten the IN instruction so that it now operates as a tool for loading a given variable for use by the program. It can be used in the following ways:

IN hh V
IN hh,V
IN hh=V
IN hhV

Where ‘hh’ is the port to write to in Hexadecimal, and V is the Variable ranging from ‘A’ to ‘Z’.

I’m still working on patching the OUT instruction to use variables. Sometimes the best way to solve a problem is to step back and let your eyes rest. And that is where I am at currently. I needed to step back until my eyes are fresh. But as of right now it can output a byte to a port.

The rest of the functions are still a work in progress. I have added a CLS function that can be used either direct or within code. I have also added a QUIT function which serves to exit TinyBASIC. So it is coming along.

Overall, my work on expanding TinyBASIC to be more usable, while maintaining a small foorprint, is progressing at a pleasing rate. And while this project centered around my G80-S computer, need is the mother of invention.  And as a result I will release the source once I decide that it is complete enough for release.

But for now, I leave you curious…

Integration of TinyBASIC

It’s been a productive weekend!   I’ve been able to integrate TinyBASIC into the monitor program.  Btw, if case you were wondering why the monitor states that it is G-DOS, it is motivation (and my intent) to integrate a FAT file system into the computer.  Likely using a SD card.  I’m currently working on the design.

But wait!  Integrating TinyBASIC into my monitor program is not all that I’ve done!  I’ve also been working on expanding TinyBASIC with the following items: IN, OUT, PEEK, POKE, and CALL.  That’s right, TinyBASIC will actually have some use other than just printing to the screen.  This will be a great tool for testing hardware designs.

As it is right now, I’ve added the IN and OUT routines.  OUT performs exactly how you’d expect:  ‘OUT NN NN’ where NN is a two digit hexadecimal number.  IN on the other hand I’m still working on.  The routine itself works, but I’m unsure how to finish it off.  What I mean by that is that I need a way to be able to assign a variable, and I haven’t looked deep enough into the code to be able to determine how to do so at this time.  For now, it simply writes the value to a specific address in memory: 0x8015. Which required me toying with memory locations built into the original TinyBASIC source.

Once I can figure out how to assign a variable to the command, it will become much more useful.  And that same scheme can be applied to the PEEK command as well.  POKE on the other hand should be as straight forward as OUT.  And this gives TinyBASIC a new level of functionality, and no more limitations on variables, as you’d be able to access memory directly.

And the best thing about this is that I believe that after expanding TinyBASIC I can keep the entire ROM (including filesystem routines) under 8K. Currently with the Monitor and BASIC the ROM is just under 5K (5013 bytes). I do not see why I wouldn’t be able to keep the I/O routines for an SD card and the Filesystem routines under 3k.  And I should only need a few hundred more bytes for the additional commands.  Of course one must also take into consideration the ability to save files from BASIC and load them again.  Who knows, but 8k is my goal.  We’ll see how well we can accomplish this.

TinyBASIC for the z80 – TinyBASIC 2.0g

In celebration of 41 years of Li-Chen Wang’s TinyBASIC (the original Open Source Operating System), and the fact my G80-S Computer needed a version of BASIC, I am proud to announce the z80 port of TinyBASIC.

Version 2.0g was derived from the original TinyBASIC 2.0 source.  The method of it’s conversion was thorough.  First the original source was compiled in 8080 mnemonics.  It was then disassembled, and compared to the original source.  It was then modified for the z80 Instruction Set.  And finally, streamlined in order to make it a little more portable.  The link to the download is below.

TinyBasic_2.0g

However, if you’d like the assembly file for the G80-S computer, here is the link to that source code.  Enjoy!

G80S_tinyBASIC_2_0g

G80-S Runs Microsoft Basic 4.7b (sort of…)

As a followup to my post on interrupts, I decided to have a go at modifying Grant Searle’s I/O routines for his 7-chip z80 Computer. After quite a bit of work, I had the routines in his handler changed to conform with his code (at least I think), and function as intended (at least as far as I was able to test).

The next task was to try it with his modified version of the Nascom Rom.  And, after splicing the code, I compiled and tested…..and tested…..and tested…..

Well, the short of it is that it kind of works.  The video above says it all.  The serial routines seem to work fine up until BASIC starts up.  And at that point, my serial routines work fine, but there is some disconnect with Grant’s code that either doesn’t like my own code, or is simply amiss.

The video really does say it all.  If anyone has any ideas, or has ported Grants work over to using either the DART or SIO, I’d love to see your code.  Help a brother out… But seriously, watch the video.  It’s hilarious….