FyOS Test (Aug 27, 2007)

(home)
  1. From: "Jeff" Aug 28, 2007
  2. From: "Jeff" Sep 5, 2007
  3. From: "david_zmk" Nov 5, 2007
  4. From: "david_zmk" Nov 6, 2007
  5. From: "Jeff" Nov 12, 2007


Subject: FyOS Test

From: "Jeff" <fyberoptic1979@...>

Aug 27, 2007

This is far from an actual OS just yet, but I made considerable
strides no=
w that I have full I/O in C, and made a pretty decent
command-line interfa=
ce to do some various tasks. I haven't touched
up the source to everythin=
g just enough yet to release that, but I
thought I'd let folks test the bi=
nary to see if there's anything I
might need to do before I release anythi=
ng else. Plus I just think
it's kind of neat to play with!

So let me jus=
t get to the link, first of all:
(URL)
001.bin

You need a loader app already, which is outside of the scope of th=
is
particular post. I might write up some documentation on that aspect
a=
nd include a loader app when I release the full source. But for the
time =
being, this assumes you're using something or other that gets a
binary fil=
e into ram at 0x8000, and executes it. It also expects to
have interrupts=
enabled when it starts.

Now I know there's a few different firmware versi=
ons floating around
out there, but one of the neater aspects is that I wro=
te support into
CRT0 initialization to detect the firmware version and dyn=
amically
fill in the shadow vars (I only use p2 and p3 shadow for now). T=
his
means it SHOULD support v2.53, v2.54, and v3.03 just fine, despite
ea=
ch being different. But I've only tested it on v3.03, because
that's the =
only MS I have.

When it loads up, you get some info where it shows the fir=
mware
version, tells you if it's satisfied with that version (and what
fa=
llback it used if not), then shows some other stuff. One is where
I was t=
esting to verify globals were being initialized, which
probably isn't need=
ed anymore. The shadow byte addresses should help
you verify if it's usin=
g the proper ones. And cgafont_addr is just
for reference, and probably i=
sn't really needed anymore either.

Then you get a > (unfortunately no blin=
king cursor yet), where you
type in commands. To get a list, use "help". =
Case insensitive.

You have:

CLS - Clears the screen.
EXIT - Launches ori=
ginal page4000 loader (in case you want to reload
it or other code, which =
I do often for testing).
HELP - Gets help on individual commands.
HEXTOINT =
- Displays hex strings as integers. Was used to test a
function I wrote t=
o do this, but I left the command in anyway.
PEEK - Displays memory locatio=
ns in hex.
POKE - Writes a byte to a memory location.
RESET - Resets FyOS t=
o initial screen.
REBOOT - Resets the Mailstation to 0x0000.
POWERDOWN - Tu=
rns off the Mailstation via firmware function 0x0A6B.

The screen will scro=
ll downwards when you reach the bottom, just like
any other text screen. =
Text wraps around the right edge. Backspace
goes past the left edge to th=
e previous line (unless at line 0). The
text I/O is really pretty nifty i=
f I do say so myself.

Not all of the code is optimized yet, some of which =
still being
written in C functions. Some of the assembly could be written=
in a
better manner, as well. But hey, it works. I'd rather focus on
fu=
nctionality than speed at the moment.

I should point out that I am NOT usi=
ng a custom interrupt here. I'm
not using custom keyboard functions or an=
y of that. This is working
purely off the Mailstation firmware, which is =
why it was important to
use the proper shadow vars. To get a blinking cur=
sor though, I may
have to hook the interrupt sometime.

I can't think of a=
nything else in particular to mention about it, so
I hope it works on othe=
r Mailstations!


1: Subject: Re: FyOS Test

(top)

From: "Jeff" <fyberoptic1979@...>

Aug 28, 2007

Welp, I finished a whole bunch of documenation, commented my source
files,=
and included the tools I use (short of SDCC itself), all in
one zip file.=
If you have a PC and a Mailstation, then you should be
able to use this =
I hope!

(URL)

Check out the=
readme.txt first.

It's actually v0.02 of FyOS included this time, instea=
d of simply the
source to v0.01. I made a bunch of changes to the code, a=
nd since
the FyOS command interpreter basically makes for a big example of=
how
to use this stuff, I figured it only made sense to go ahead and
incl=
ude the newest. I included a binary version too if you want to
get right =
to playing with it.

Version 0.02 has a lot of optimizations (particularly =
in screen
scrolling and clearing), as well as some additional commands, li=
ke to
poke and peek values into ports now (since before you could only do =

memory locations). There's also an interactive scancode viewer.

I includ=
ed the binary to v0.01 too if anyone wants to compare the
two. This might=
give you an idea of how writing code in C will
perform as opposed to asse=
mbly. Screen scrolling and clearing is
particularly noticable between the=
two.

Unfortunately, it's starting to get pretty fat already! I'm going t=
o
have to figure out an alternative storage method. I have some things
i=
n mind though.

But yeah, FyOS aside, you should be able to just write you=
r own apps
fairly easily now I hope. There's hardly any difference in wri=
ting
for the Mailstation as to just a normal console window in DOS or
Lin=
ux, to be honest. printf/getchar/gets are the most used functions
for con=
sole interaction that I know of, and they work fine with no
setup necessar=
y by the user. Only thing you truly have to worry
about is your code and =
data sizes, since the MS can only hold so much.

As always, let me know if =
you have any problems or questions.


2: Subject: Re: FyOS Test

(top)

From: "Jeff" <fyberoptic1979@...>

Sep 5, 2007

Not posted here lately, but I've been working nonetheless! I made a
ton o=
f internal changes, so I went from v0.02 to just making this
v0.1. The so=
urce is still messy though so I'm only going to release
a binary as a prev=
iew. It not only needs more comments, but still
needs some work to make i=
t easier to access from outside code. In
other words, by the time I relea=
se the source next time, it'll likely
have an actual programming interface=
similar to CP/M's BDOS
functionality.

(URL)
on/fyos_01_ldr.bin

The big internal changes are:

- Interrupt has been f=
ully replaced. This means the firmware's
keyboard routines were ripped ou=
t to be loaded from elsewhere, and to
also use variables in different loca=
tions. This was necessary
because...

- I added in key repeat.

- And a=
n actual blinking cursor.

- Replacing the interrupt meant I was no long=
er tied to using the
firmware's p2shadow and p3shadow. In other words, th=
is should run on
any version of the firmware, since I'm no longer using an=
y firmware
routines. And I created my own shadow vars.

- The entire thi=
ng now runs from the upper 16K of ram. The command
interpreter starts at =
0xc000, and the "BDOS" starts at 0xe400. The
command interpreter is prett=
y fat right now, since it's all written
in C. It was all I could do to ma=
ke it fit in that space, and I had
to remove a couple of the help commands=
to do that! The "BDOS" is
all assembly.

Since the code starts at 0xc00=
0 (though initially executed at
0xe400), I tacked it onto the end of a tin=
y loader. So you can still
load the binary at the normal 0x8000, and once=
it runs, it'll take
care of moving the code into the right place and exec=
uting it.

I have to say, the addition of a blinking cursor makes it look m=
uch
more alive now than it has nearly the entire time I've worked on all
=
this. It was certainly worth the effort involved. For all intents
and pu=
rposes, it's now about as close to a true text console as one
can get.

I =
don't know how many people actually have tried any of the other
versions, =
but I hope you like this one! And if you don't know how to
load it, there=
's instructions and software in the v0.02 zip to let
you do so.

Also, in=
a funny twist, it seems that there's a perfect sequence of
bytes somewher=
e in my code/data which makes the Mailstation think it
was shut down prope=
rly when you hit the reset button on the back.


3: Subject: Re: FyOS Test

(top)

From: "david_zmk" <David_zmk@...>

Nov 5, 2007

Hi, a number of times i read that you have storage problems with the
mailst=
ation, maybe my suggestion is not applicable or already
considered but, why=
not use the 8 megabits flash memory that the
mailstation uses to save e-ma=
ils and CFG files, to store the FS and/or
the program data? it's not a HUGE=
amount of memory but, 1MB is 1MB.

Zim_256
com, "Jeff" <fyberoptic1979@...> wrote:
e been working nonetheless! I made a
from v0.02 to just making this
so I'm only going to release
ore comments, but still
outside code. In
me, it'll likely
BDOS
r.bin
y replaced. This means the firmware's
to be loaded from elsewhere, and to
ations. This was necessary

t I was no longer tied to using the
n other words, this should run on
no longer using any firmware
s.
d
command interpreter is pretty fat right now, since it's all written
C. It was all I could do to make it fit in that space, and I had
ove a couple of the help commands to do that! The "BDOS" is
y.
0xe400), I tacked it onto the end of a tiny loader. So you can still
oad the binary at the normal 0x8000, and once it runs, it'll take
f moving the code into the right place and executing it.
, the addition of a blinking cursor makes it look much
an it has nearly the entire time I've worked on all
nly worth the effort involved. For all intents
bout as close to a true text console as one
ow many people actually have tried any of the other
you like this one! And if you don't know how to
uctions and software in the v0.02 zip to let
a funny twist, it seems that there's a perfect sequence of
ere in my code/data which makes the Mailstation think it
roperly when you hit the reset button on the back.


4: Subject: Re: FyOS Test

(top)

From: "david_zmk" <David_zmk@...>

Nov 6, 2007

Or you can try using a IDE device for storage, like a CF card (A bit
diffic=
ult because of the connector) or a notebook HDD.

Take a look at:
(URL)
w.z80.de/gide/

Documentation in:
(URL)

Zim_256
=
.1. The source is still messy though so I'm only going to release
inary as a preview. It not only needs more comments, but still
some work to make it easier to access from outside code. In
ds, by the time I release the source next time, it'll likely
ctual programming interface similar to CP/M's BDOS

big internal changes are:
This means the firmware's
ed from elsewhere, and to
This was necessary
=
meant I was no longer tied to using the
dow. In other words, this should run on
since I'm no longer using any firmware
shadow vars.
am. The command
t 0xe400. The
all written
, and I had
BDOS" is
though initially executed at
ny loader. So you can still
once it runs, it'll take
and executing it.
r makes it look much
I've worked on all
For all intents
console as one
y have tried any of the other
And if you don't know how to
re in the v0.02 zip to let
wist, it seems that there's a perfect sequence of
y code/data which makes the Mailstation think it
y when you hit the reset button on the back.


5: Subject: Re: FyOS Test

(top)

From: "Jeff" <fyberoptic1979@...>

Nov 12, 2007

Hi, a number of times i read that you have storage problems with the
station, maybe my suggestion is not applicable or already
why not use the 8 megabits flash memory that the
e e-mails and CFG files, to store the FS and/
or
ot a HUGE amount of memory but, 1MB is 1MB.

There were a couple of prob=
lems with using the flash memory. At
least in my mind. The codeflash was=
the larger one, and I didn't
really want to mess with it for the time bei=
ng. Especially since
it's broken up into 64KB sectors, meaning you have t=
o erase the whole
chunk to change anything in it. The dataflash is only 5=
12KB, but has
256 byte sectors, which is much better for storing data. Ho=
wever,
they chose to use one with far less write cycles than even the
cod=
eflash. So after some extended use, you'd eventually start
wearing it dow=
n to the point that it wouldn't work anymore.

So that leads me to the pr=
oblem of making some sort of file system
out of it that limits how much it=
writes to particular sectors. For
my little Fonera router thing that I r=
eflashed a while back, it uses
JFFS to deal with the flash memory, to writ=
e to it in kind of a
circular loop, to extend the flash's life as long as =
possible. But
the problem is that that method is more memory-intensive an=
d slow,
and I think that's the last thing the Mailstation needs to contend=

with. The Fonera has much more horsepower to deal with it.

I considered=
compact flash once (which is nearly identical to IDE),
but that would req=
uire an actual hardware mod, and I've always wanted
to keep this stuff as =
casual hobbyist friendly as possible. Plus I
didn't particularly want to =
risk the Mailstation itself for modding.
That's why I thought of trying t=
o use SD over the parallel port of
the thing. That'd be slow, but it woul=
d work. It's just a matter of
making some little adapter. Such a thing w=
ould also have to adapt
the 5v to 3.3v. And I'm lazy and never did it!

I=
n the end though, it will probably come down to some sort of
internal flas=
h storage. I'll try to do some reading on what other
people have done wit=
h other devices and see if I can get some idears,
to avoid wearing the fla=
sh down as much as possible. It's just one
of those things where I'm stil=
l at the stage where it's daunting to
think about.