PDA

View Full Version : MITS Altair BASIC for Propeller anyone ?



heater
01-14-2009, 05:30 PM
Surprising myself in a big way I have just managed to get the 8080 emulation for the Propeller to run MITS Altair Basic.

You can now enter, edit and run programs written in one of Microsoft's first basics on your Prop Demo board! See attached screen shot.

This is mostly the same as the CP/M for the Prop package (2.1) but:

1. Altair extended basic v4 is loaded into memory instead of CP/M.
2. Added emulation of the 8080 RST instructions as the BASICS use them even if CP/M does not.
3. Added emulation of the Altair's front panel switch register which is used by BASICS to determine serial port configuration.

This build still includes disk emulation on an sd card but will run with no sd card present.

To run this:

1. Unzip the thing somewhere
2. Make altair_sim.spin the top level file
3. Compile all CTRL-F10
4. Run PropTerminal to talk to it (Included in the zip)
5. Hit return when prompted for "MEMORY SIZE ?"
6. Hit "Y" and return when prompted for "WANT SIN-COS-TAN-ATAN
7. Enter your favourite BASIC program and RUN.

Also included is the earlier 8K and 4K basics which you can try by editing a line in altair_mem.spin, look for "OPTIONS" in the comments there.

I promised myself years ago not to get involved in MS products again but, well, this is another test of the 8080 emulation and at least it fits within the HUB RAM.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.

Baggers
01-14-2009, 05:49 PM
Congrats heater :) looks great, will have a play later

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
http://www.propgfx.co.uk/forum/·home of the PropGFX Lite

·

RossH
01-14-2009, 06:06 PM
Very cool. Thanks.

Baggers
01-14-2009, 06:54 PM
btw heater, i'm impressed to managed to fit a M$ product into HUB-RAM, I bet thats the only M$ product that fits lol :)

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
http://www.propgfx.co.uk/forum/·home of the PropGFX Lite

·

heater
01-14-2009, 07:02 PM
baggers said...
i'm impressed to managed to fit a M$ product into HUB-RAM


Thing is microsoft started out quite well squeezing BASIC into only 4K RAM. Quite a feat in itself. But then things snowballed exponentially, 8K BASIC then extended BASIC at 16K. Pretty much using everything Moores Law had to offer as soon as possible. Till we come to Vista which seemed to be launched ahead of the transistor count.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.

Cluso99
01-14-2009, 07:03 PM
Well done heater. Brings back some memories http://forums.parallax.com/images/smilies/smile.gif Unfortunately, no time to try at present.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Prop Tools under Development or Completed (Index)
http://forums.parallax.com/showthread.php?p=753439

My cruising website http://www.bluemagic.biz

BradC
01-14-2009, 07:21 PM
heater said...
Thing is microsoft started out quite well squeezing BASIC into only 4K RAM. Quite a feat in itself.


Easy to do when you "appropriate" someone else's code from a printout in a dumpster.

Your achievement however, is something incredibly impressive. Well done indeed! Can't wait to drag out some of my old CPM disks and have a play.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cardinal Fang! Fetch the comfy chair.

Baggers
01-14-2009, 07:53 PM
Yeah, it's systems did expand to stupid proportions, I wonder if there is a FULL complete version of the source for Vista, the install size is massive, so I wonder how big the source is. lol wouldn't fancy getting that printout from a dumpster and typing it in lol.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
http://www.propgfx.co.uk/forum/·home of the PropGFX Lite

·

heater
01-14-2009, 08:12 PM
@BradC: Do you have any links to this "dumpster" story?

Because from what I understand MITS basic was orignaly written by:

Paul Allen - The BASIC interpreter stuff.
Monde Davidoff - The floating point stuff.
Bill Gates - Some dinky I/O routines for the Altair.

The last of which has given everybody grief over the years trying to run it on other hardware or simulators including myself and PropAltair. Still can't get the 4K version to run. Thanks Bill.

Perhaps we will never know exactly, the source has been "lost". Which is odd considering how much money made out of it.

P.S. Reminds me of the time in 1976 my friend and I walked into the computer lab at the University of Manchester Institute of Science and Technology (UMIST) one weekend. We were from another Uni. There was nobody around. My friend started fishing around in the trash cans and eventually pulled out a listing with a login sequence including password on it. We were soon into their main frame:)

Also saw my first ever EPROM, on a bench in that lab that day.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.

Post Edited (heater) : 1/14/2009 12:56:46 PM GMT

Humanoido
01-14-2009, 08:18 PM
I suppose you could also fit in Tom Pittman's Tiny BASIC?

humanoido

heater
01-14-2009, 08:30 PM
According to Tom Pittman "I never did an x80 version of my TinyBasic".

But here www.ittybittycomputers.com/IttyBitty/TinyBasic/ (http://www.ittybittycomputers.com/IttyBitty/TinyBasic/) he suggests some one else did. His link for it does not work. Do you have a copy or a link to it and/or info?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.

BradC
01-14-2009, 08:38 PM
heater said...
@BradC: Do you have any links to this "dumpster" story?



Numerous. Not that I can remotely claim they pretend to be unbiased, but the story has been around a *long, long* time.

www.freedomunderground.org/view.php?v=3&t=3&aid=14022 (http://www.freedomunderground.org/view.php?v=3&t=3&aid=14022)
macosx.com/forums/317703-post12.html (http://macosx.com/forums/317703-post12.html)
www.dhanapalan.com/blog/2008/06/22/bill-gates-and-the-importance-of-source-code/ (http://www.dhanapalan.com/blog/2008/06/22/bill-gates-and-the-importance-of-source-code/)
www.dynamicobjects.com/d2r/archives/002646.html (http://www.dynamicobjects.com/d2r/archives/002646.html)
www.daniweb.com/forums/post23101-3.html (http://www.daniweb.com/forums/post23101-3.html)
www.vanwensveen.nl/rants/microsoft/IhateMS_1.html (http://www.vanwensveen.nl/rants/microsoft/IhateMS_1.html)

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Cardinal Fang! Fetch the comfy chair.

heater
01-14-2009, 09:32 PM
Ah those stories. Well as much as I loath to stand up for Bill this dumpster diving part does seem to be a bit over the top.

1. For sure learning to code is greatly aided by reading the code of those who have come before. From a dumpster or not.
2. Fishing a BASIC interpreter for a PDP10 out of a dumpster and using it as inspiration as to how to write one for an 8080 is not exactly a trivial exercise and far from "appropriating".
3. The thing about unauthorized use of the university computer, well we all tried to do that at uni. How else could you progress at the time?

It's interesting to compare the software industry development with that of the steam engine. James Watt is generally credited with being the great inventor there and the firm Boulton and Watt made piles of money out of it. Everyone at the time knew how to make a steam engine, they were all busy trying copying each other whilst at the same time locking ideas up with patents and royalties. Stifling progress as they did so.

Meanwhile the "true" inventor of the steam engine was a young unknown boy name of Humphrey Potter who devised away to make the engine push up and down repeatedly, continuously by itself rather than rely on an operator (a young boy) opening and closing valves ten times a minute. He of course got no credit or reward, rather he was fired and replaced by his own invention!

I also consider young Potters invention to be the first use of "feedback" rather than the oft quoted steam regulator of Watt.

Read about my hero Humphrey Potter here: http://inventors.about.com/od/nstartinventors/a/Newcomen_2.htm

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.

Oldbitcollector (Jeff)
01-14-2009, 11:03 PM
@heater,

Nicely done! I had a feeling you would get this working. :)

OBC

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
New to the Propeller?

Check out: Protoboard Introduction (http://jeffledger.googlepages.com/Protoboard_Introduction.pdf) , Propeller Cookbook 1.4 (http://ucontroller.com/Propeller%20Protoboard%20Designs%20for%20the%20Beg inner.pdf) & Software Index (http://forums.parallax.com/showthread.php?p=770318)
Updates to the Cookbook are now posted to: Propeller.warrantyvoid.us (http://propeller.warrantyvoid.us)
Got an SD card connected? - PropDOS (http://www.orrtech.net/propdos/)

potatohead
01-15-2009, 12:16 AM
Excellent!

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Propeller Wiki: Share the coolness! (http://propeller.wikispaces.com/)
Chat in real time with other Propellerheads on IRC #propeller @ freenode.net (http://propeller.wikispaces.com/Join+us+on+IRC%21/)
Safety Tip: Life is as good as YOU think it is!

heater
01-16-2009, 10:27 PM
Pleased to announce that Microsoft's original 4K BASIC is now working under PropAltair.
May God forgive me.

It will also run 8K and Extended BASICS, just edit two lines in altair_mem.spin, look for "OPTIONS".

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.

Oldbitcollector (Jeff)
01-16-2009, 10:34 PM
...this is the beginning of the end.. Micro-Soft products running on a Propller..

Next thing you know we'll be dealing with SPAM, popup ads..
Peter Venkman: "Human sacrifice, dogs and cats living together... mass hysteria! "

Nice Job! Looking forward to playing with this...

OBC

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
New to the Propeller?

Check out: Protoboard Introduction (http://jeffledger.googlepages.com/Protoboard_Introduction.pdf) , Propeller Cookbook 1.4 (http://ucontroller.com/Propeller%20Protoboard%20Designs%20for%20the%20Beg inner.pdf) & Software Index (http://forums.parallax.com/showthread.php?p=770318)
Updates to the Cookbook are now posted to: Propeller.warrantyvoid.us (http://propeller.warrantyvoid.us)
Got an SD card connected? - PropDOS (http://www.orrtech.net/propdos/)

Post Edited (Oldbitcollector) : 1/16/2009 3:01:16 PM GMT

heater
01-16-2009, 10:52 PM
Don't forget to send ~$200 to:

William Henry Gates III
1180 Alvarado SE,
#114,
Albuquerque,
New Mexico,
87108

As requested by same in 1976 www.blinkenlights.com/classiccmp/gateswhine.html (http://www.blinkenlights.com/classiccmp/gateswhine.html)

Which, by the way, is demanding money not due to him. These basics contain the string "COPYRIGHT 1976 BY MITS INC."

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.

shanghai_fool
01-16-2009, 11:05 PM
This is true. I purchased mine from MITS (punched paper tape, I didn't trust cassettes). I don't know if MITS paid Gates or not.

Cluso99
01-16-2009, 11:29 PM
You forgot viruses !!!!

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Prop Tools under Development or Completed (Index)
http://forums.parallax.com/showthread.php?p=753439

My cruising website http://www.bluemagic.biz

Post Edited (Cluso99) : 1/17/2009 3:43:43 PM GMT

heater
01-16-2009, 11:35 PM
Well the 8k and extended basics contain the strings "WRITTEN FOR ROYALTIES BY MICRO-SOFT" so I guess your money got to Bill eventually. Which really makes it clear that Bill was asking for money from hobbyists (well anyone) for something which was not his.

By the way how much exactly was your basic ?

I miss those paper tapes. Wish I had a punch and reader now.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.

Humanoido
01-16-2009, 11:39 PM
Tiny Basic was implemented on the Intel 8080/8085 and the original archived
discussion page, reconstructed (with help from Volume 17 of the CP/M User's
Group archives), is found here:

MINOL-Tiny BASIC with Strings in 1.75K Bytes
web.archive.org/web/19980702115208/http://www.signiform.com/erik/pubs/minol.htm (http://web.archive.org/web/19980702115208/http://www.signiform.com/erik/pubs/minol.htm)

Note the letter by Erik T. Mueller

Erik T. Mueller
said...
Dear Mr. Warren: May 1, 1976
I have a Tiny BASIC program running on my Altair
that I think you might be interested in. I call it MINOL.
It fits in 1.75K memory. Unlike the other Tiny BASIC's,
MINOL has a string-handling capability, but only
single-byte, integer arithmetic and left-to-right
expression evaluation.
Additions to TB include CALL machine-language sub-
routines, multiple statements on a line (like TBX), and
optional "LET" in variable assignments. Memory locations of
the form (H,L) can be used interchangably with variables, per-
mitting DIM-like operations.
Sincerely,
Erik T. Mueller
This information was updated 27 times. While the original posting from "Dr.
Dobb's Journal of Computer Calisthenics and Orthodontia" no longer links the
Tiny Basic listing or file, just scroll down farther on the page and provided is a
listing of the 8080/8085 Tiny Basic code manually typed which can be copied
and pasted from the html page!

You can consult the more recent versions as archived links here (as I chose
the oldest link from Jul 02, 1998).

web.archive.org/web/*/http://www.signiform.com/erik/pubs/minol.htm (http://web.archive.org/web/*/http://www.signiform.com/erik/pubs/minol.htm)

The newest link is here, from Sep 28, 2007.
web.archive.org/web/20070928040139/http://www.signiform.com/erik/pubs/minol.htm (http://web.archive.org/web/20070928040139/http://www.signiform.com/erik/pubs/minol.htm)

Thanks to the Internet Archive WayBack Machine.
www.archive.org/web/web.php (http://www.archive.org/web/web.php)

At originally only 1.75K, a working version on the Prop would be absolutely remarkable.

humanoido

Post Edited (humanoido) : 1/16/2009 3:52:58 PM GMT

Mike Green
01-16-2009, 11:45 PM
I haven't looked at it much, but there is a "tiny" Basic on the Hydra CD written mostly in Prop assembler. It occupies a couple of cogs, so we're talking about 1K to 1.5K instructions.

heater
01-17-2009, 12:28 AM
As it happens there is a MINOL on the altairz80 simulator site. I never knew that it was a tiny basic ! I'll see I can get it to run on PropAltair.

I was just reading a about a guys original 1975 Altair who states that he was getting 350K instructions per second. So propAltair is doing a fairly accurate emulation of the speed of an 8080 :)

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.

heater
01-17-2009, 04:51 PM
By popular request (humanoido) here is PropAltair running the tiny basic version called MINOL.

This makes the HUB RAM look huge !

This is the end of the line for stand alone BASICs from me, time to get back to the "real work" of improving CP/M on the Prop.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.

Post Edited (heater) : 1/17/2009 9:09:53 AM GMT

Dr_Acula
01-17-2009, 09:51 PM
Absolutely fascinating you can fit these programs on the altair simulator.

Hopefully that CP/M board will get to you heater in the next week and you can see if it is possible to squeeze it into a propeller.

I'm working on making complex code easier to write. Coloured text and cut and paste and quick compiles have certainly sped up the edit/test/edit/test cycle. Back in the CP/M day the text editors were much more cumbersome by comparison. And my dad was telling me that back in his day (1960s) you had paper tape and you would "load" a program, which in practice meant a girl would go and get a roll of tape and feed it into a machine which would spit it across to the other side of the room and another girl would grab the tape and roll it all up and file it away. Serves me right for complaining about compiles that take more than 10 seconds!

Languages. A can of worms I know. I've got frustrated with the smaller languages and I'm working with s-basic at present because it is much more structured than other forms of basic, and so you can add new keywords as functions and hence enlarge the language as needed. It looks more like spin than mbasic for instance. But with modern programming like richtextboxes in .net, you can add things like syntax colouring and dop in functions from a menu. The attached screenshot is a vb.net program, with a VT100 terminal in the top window talking to a N8VEM CP/M board, and in the lower windows is the s-basic program. Compile is a single step process which sends the program to the N8VEM via xmodem and then runs the sbasic compiler. You can write little programs and store them in the on-board ramdisk - eg a program to change the baud rate, and another to change the serial port. Just for fun, the N8VEM board is on the other side of the house and is communicating via wireless modules.

I can see a convergence of ideas here. Either CP/M being emulated fully on the Prop. Or an Prop operating system evolving to the stage of being able to write and compile programs on its own board.

heater
01-18-2009, 01:00 AM
Dr A

It's been fascinating to get them running on the Prop, in fact it's diverted me for too long from the real business CP/M. The real honour goes to people like Erik T. Mueller for creating things like Minol in 2K bytes back in 1976. And here we are today complaining that the COGs don't have enough registers and the HUB ram is too small. Young people today, I don't know.....

Paper tapes and punch cards is where I started out back in uni. Was just a tad before micros started to arrive on the scene.

Wireless communication, colour syntax highlighting, wow, you must have the most sophisticated CP/M development environment ever created ! Here I'm still doing most of my debugging via the 8 LEDs on a Prop demo board, just like the old days.

When I get the external RAM sorted full scale CP/M will be running on the Prop. As for a self hosting prop operating system I think others here are working on it.

By the way if I took the time to figure out how to use Digital Researches ASM and the WM editor I think I can already do program development for CP/M. They both seem to run in 24K.

Just now I'm stuck by a CPU instruction set test program by MICROCOSM ASSOCIATES that fails on PropAltair. And Guess what ? It trips up on that pesky DAA opcode.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.

heater
01-18-2009, 05:23 AM
Attached is propaltair running an 8080 instruction set test program.

Problem is propaltairs DAA instruction fails (Test currently disabled), this is driving me nuts. As far as I can tell the DAA implementation is as per my 8080 assembly language programming manual. The tests I made for it worked and it gives the correct results when used by the survey.com program, the only program I know that uses it for real.

Searching around the net it seems many have had trouble with this in their simulator attempts. The z80 does not set flags exactly as 8080. The 8080 is considered buggy in this respect. But I could not find exactly what the issue is.

Anyone have any info on this ?

Otherwise emulation seems to be solid.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.

Ale
01-18-2009, 05:56 AM
heater,

I think you may know this people: http://www.altairkit.com

There is a forum where issues are discussed, http://www.stockly.com/forums/index.php, maybe they can run some test cases for you. I mean, they have real 8080s. (I only have a Z180 around, and DAA works as per the manual, well better because the Z80 manual I got a couple years ago had some mistakes in the DAA instruction description).

I wanted to convert that tiny basic to propeller assembler. Someone did it but I mean I wanted http://forums.parallax.com/images/smilies/smile.gif. I have some problem with the 8080 opcodes, I know only the Z80 nomenclature.

I hope it helps. Btw, great achivement !

heater
01-18-2009, 06:25 AM
Thanks Ale, I will check out those links.

I've just found an Manual from Radio Shack that covers both 8080 and 8085 programming. It does mention differences in flag handling between the two. Which, as I said, is different from z80. The issue seems to be that the half carry flag may or may not be set by logical operations depending on cpu and phase of the moon. Neither of my manuals actually have all the details of this.

Looking at the code for DAA in the GNU 8085 simulator I can't see how that conforms to any manual description !

Baa ! I might just leave it as it is for now and get on with something else.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.

Dr_Acula
01-18-2009, 07:51 AM
Once you get that board it will help, but I wonder if it might be worth testing it on a real Z80 and just looking at the flags. It is easy enough to do with ZDT or DDT. All that would be needed is the state of all the registers (including the flag regsiter) just before DAA is run. Have you got a code example?

Cluso99
01-18-2009, 12:42 PM
Heater: Since you know by tracing what is in all the registers and flags, maybe you could write a small piece of code that sets the 8080 to this point, and follow it with a few instructions that display the results. Then you could ask on one of the forums using real 8080's if someone would be kind enough to run your piece of code and report back.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Prop Tools under Development or Completed (Index)
http://forums.parallax.com/showthread.php?p=753439

My cruising website http://www.bluemagic.biz

heater
01-18-2009, 04:16 PM
Nice suggestions guys but not so simple. PropAltair has single step capability, already used a lot but currently commented out due to lack of COG space. To use it I have to remove some opcodes from emulation. Doable but tedious.

Here is what I found so far:

1. The DAA instruction is dependent on the setting of the Auxiliary Carry flag (half carry) by previous instructions. Namely arithmetic ops, logical ops and inc/dec ops. So its not just DAA to fix but all other interesting instructions.

2. The original Intel 8080 Assembly Language manual documents these flag settings sparsely and wrongly.

3. The later Intel 8080 and 8085 manual does a slightly better job, it does mention difference between 8080 and 8085 setting of AUX. It does document how AUX is set for more instructions. BUT not all ! It contradicts the earlier manual.

4. Pretty much all 8080/8085 simulators I have found on the net have had bugs with DAA !

5. The z80 treats these flags differently again.

I do not have a real CPU to test against. I have only be making checks against the SIMH Altairz80 simulator in 8080 mode.

Seems I have to decide between 8080 and 8085 and be sure to get at least that one right.

Testing DAA against a real CPU is a HUGE task. One has to check many many combinations of DAA with adds/subtracts, and/ors/xors, increment/decrement.......with all kind of operand values.....

I'm shooting for 8085 compatibility for now because: I do actually have an 8085 chip which will be set working one day. I can "borrow" the flag setting logic from the GNU 8085 simulator:)

Dr_A, or anyone, attached is the 8080 cpu test source from MICROCOSM ASSOCIATES I'm using. I have made minor changes to get it to assemble with M80. Just rename to .MAC. If you are willing to try it you will hace to change the character output routine to work on your system.

I put a jump around the DAA test JMP NODAA do you can see where the problem is.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.

Dr_Acula
01-18-2009, 09:40 PM
Ok, this is DDT running on a Z80. Not an 8080 so maybe it will be different.

ddt
DDT VERS 2.2
-a0100
0100 nop
0101 ora a
0102 nop
0103 daa
0104 nop
0105
-t
C0Z0M0E0I0 A=00 B=0000 D=0000 H=0000 S=0100 P=0100 NOP *0101
-t
C0Z0M0E0I0 A=00 B=0000 D=0000 H=0000 S=0100 P=0101 ORA A*0102
-t
C0Z1M0E1I0 A=00 B=0000 D=0000 H=0000 S=0100 P=0102 NOP *0103
-t
C0Z1M0E1I0 A=00 B=0000 D=0000 H=0000 S=0100 P=0103 DAA *0104
-t
C0Z1M0E1I0 A=00 B=0000 D=0000 H=0000 S=0100 P=0104 NOP *0105
-

Where
Register Meaning Value
C Carry flag (0/1)
Z Zero flag (0/1)
M Minus flag (0/1)
E Even parity flag (0/1)
I lnterdigit carry (0/1)
A Accumulator (0-FF)
B BC register pair (0-FFFF)
D DE register pair (0-FFFF)
H HL register pair (0-FFFF)
S Stack pointer (0-FFFF)
P Program counter (0-FFFF)

Got some more code?

BTW that test8080 program compiles but doesn't display the signon message. I suspect it is going to need some work eg .mac files don't need an 0rg 0100 as it is assumed but ones that use asm in cp/m did need an org 0100. Have you got the original source by any chance?

Post Edited (Dr_Acula (James Moxham)) : 1/18/2009 1:51:26 PM GMT

Humanoido
01-19-2009, 12:22 AM
Heater said...
By popular request (humanoido) here is PropAltair running the tiny basic version called MINOL.
This makes the HUB RAM look huge !

This is totally fantastic!!!!!! Amazing job!!!!!!


humanoido

heater
01-19-2009, 01:11 AM
@humanoido: Thanks. I'm amazed I got this far myself. It was an interesting puzzle, though I do wonder what you, or anyone, would do with a tiny basic like that.

@Dr_A: Thanks again for pointing me at DDT I hadn't taken the time to find out how to use it before. Turns out DDT runs just fine on PropAlatair so it makes quick checks much easier.

As for more code, not yet, but I was thinking to create a little program that exercises all the instructions that affect the AUX flag and reports what happens. This should be able to run on any 8080 like cpu or simulator so that we can see what is what.

I got the original test program from here: www.classiccmp.org/dunfield/r/test.asm (http://www.classiccmp.org/dunfield/r/test.asm). That guy has a lot of good CP/M material.

I had to make some changes to get it to assemble under M80:

1. It uses STR 'bla bla bla' which I changed to DB 'bla bla bla'
2. It uses MVI L,(TEMP0&0FFH) to get the low byte of a memory address, I changed to MVI L,(TEMP0 AND 0FFH)
3. It uses MVI H,(TEMP0/0FFH) to get the high byte of memory address, I changed to MVI H,(TEMP0 / 256)
4. There is a missing ":" in the declaration of TEMP2
5. I added ASEG at the beginning.

I had to change the character output routine it uses as it goes straight to the 8051 hardware instead of using BDOS. Suggest you change it to us BDOS.

By the way did anyone notice: The fact that DDT runs on PropAltair makes the propeller a self hosting development environment for the Propeller !!!!

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.

heater
01-19-2009, 01:43 AM
Ahhhgg, this is awfull, there are six places in the emulator to add one long each to fix the 8080 AUX flag setting and only ONE free long in my COG !!!

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.

Dr_Acula
01-19-2009, 07:00 AM
Nooooo! You can't run out of space in the prop now?! Not when it is so close.

Anyway, getting DDT working is going to help a lot. You can type in short programs using a (assemble) and trace them one step at a time and watch registers change. Saves compiling each time. I presume you have links to the instruction manual http://www.unix4fun.org/z80pack/cpm2/ch4.htm

One thing you will be able to do with a real board (it should be in customs by now) is to compare the simulator with running ddt on a real board.

Cluso99
01-19-2009, 12:32 PM
Heater: do you have 2 spare cogs? If so you could use my zero footprint debugger. (1 cog for debugger and 1 for fdxserial)

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Prop Tools under Development or Completed (Index)
http://forums.parallax.com/showthread.php?p=753439

My cruising website http://www.bluemagic.biz

heater
01-19-2009, 02:45 PM
Actually after another sleepless night pondering how to save COG space I came up with a cunning and devious plan.

With out going into too much detail. Currently I have a lump of PASM that is an ALU. The intention was to save COG space by having it common to all arithmetic and logic ops. This ALU has configurable instructions to determine it's operand sources and result destination. It also has a flag input to cause it to set 8080 flags differently for arithmetic or logical ops. These "parameters" have to be set by the opcode handlers prior to jumping to the ALU. The parameters being determined by decoding instruction fields.

Turns out all this opcode field decoding and ALU parameter setting makes for a lot of PASM instructions. And makes the whole code especially the ALU hard to understand.

Now, it occurred to me that I already have a fast LMM implementation to handle some lesser used ops that previously did not fit in COG. What if I moved all the arithmetic and logic ops out to LMM code? Sounds slower than PASM right?

Perhaps not, by getting rid of a shared ALU and jumping to some LMM that only handles one op, say ORA B, straight from the dispatch table the opcode handler becomes much short and in line, the overhead of it being LMM is about the same as the overhead of setting up the old ALU params. Perhaps it's even faster.

@Dr_D: I found a DDT manual and all is working well, currently I compare execution with the Altairz80 simulator in 8080 mode.

@Cluso99: Will the debugger handle reverse execution order LMM ? Without driving me nuts !

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.

Cluso99
01-19-2009, 03:47 PM
@heater: Two things...

Yes, my debugger is just a pasm instruction debugger, so it doesn't really know anything about anything except executing a single pasm instruction. But I don't think this is what you actually are asking, and it is not a true LMM machine although this is how it actually works.

However, I have a better idea for you that may work. In my ClusoInterpreter I made decoding much faster and shorter by having a vector table in hub ram. You are welcome to use this method. See the published (not working, but the decoding does) ClusoInterpreter or PM me with an email address and I'll email it to you and anything else you may require. I also did a fast compact overlay loader which is faster than LMM.

BTW I am really impressed at what you have achieved - but I dare not look at it or I =WILL= get distracted http://forums.parallax.com/images/smilies/smile.gif

PS. I can get you 4 more instructions at $1F0-1F3 and 1 or 2 variables at $1F5 and $1f7 (from memory) if that helps :-)

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Prop Tools under Development or Completed (Index)
http://forums.parallax.com/showthread.php?p=753439

My cruising website http://www.bluemagic.biz

Post Edited (Cluso99) : 1/19/2009 7:54:21 AM GMT

heater
01-19-2009, 05:02 PM
Thanks Cluso, Your debugger sounds interesting, I'll give it a check out if I get really stuck.

Just now I do have a vector (dispatch) table in HUB RAM. My "dispatcher" uses it to select PASM routines for op code handler OR it it can execute LMM blocks. Basically the table is a list of words with PASM addresses in COG or LMM addresses in RAM. The dispatcher checks if the looked up address is >= 512 and starts LMM if so instead of jumping to PASM.

Problem is if you do a straight decode using the dispatch table into PASM routine that's 256 routines. So if they were only one LONG + a jump back to dispatch loop the COG would be full.

To get around this I started pointing (in the table) many similar opcodes to the same handler routine which would decode some fields of the op code and do the op. So for example 64 MOV instructions can be handled by one handler of 10 LONGS.

Trouble is when you do that with arith/logic ops the decoding gets long and tortuous.

Other big, slow less used ops (Like DAA is almost never used.) I put into LMM.

Overlays, hmm, interesting idea.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.

Ale
01-19-2009, 05:19 PM
heater: I'm using LMM in one of my projects and I'm surprised how well it does. I was using some routine to handle jumping... but add and sub directly from the PC works quite well, the range is +/63. Some macro here would surely help. A table is a good way of squeezing speed out of some decoding like yours. For a slow (but very compact) example you have the spin interpreter, a marvelous piece of code. May be a table in ROM would have helped ?

Edit: After some trial, I discovered that the range is actually +/- 63 instructions :-(, not 512 as I thought, well...

Post Edited (Ale) : 1/19/2009 1:32:06 PM GMT

Cluso99
01-19-2009, 06:25 PM
Heater: My vector table is in hub and it is quick. I can house 3 vectors and 5 bits per vector in 1 long. Allows for multiple routines to be called per vector.

Here is the vector code section I use in the ClusoInterpreter


loop
mov x,#0 'reset x
rdbyte op,pcurr 'get opcode
add pcurr,#1
mov a,op 'preset a (for mathop)
test op,#%01 wz 'get flags
test op,#%10 wc '(note varop requires c=1)
mov vector,op 'get the offset (bytecode op)
vector1 shl vector,#2 'convert to longs (*4)
add vector,vector_base 'add the hub base address
rdlong vector,vector 'get the vector_table entry
jmpret popx_ret,vector 'indirect call to 1st vector (return address in pop_ret=vector_ret)
vector2 shr vector,#9
jmpret popx_ret,vector 'indirect call to 2nd vector (return address in pop_ret=vector_ret)
vector3 shr vector,#9
jmpret popx_ret,vector 'indirect call to 3rd vector (return address in pop_ret=vector_ret)
jmp $ 'never gets here!!! (can save this instr) '<===
'  
vector_base long 0-0 'base of vector_table
vector long 0-0 'vector(s)


And here are bits of the vector table in hub


long j5_23 <<9+ popyx ' 17 00010111 STRCOMP(stringa,stringb) 2 1
long i_WRBYTE <<18+ j6_012 <<9+ popayx ' 18 6 00011000 BYTEFILL(start,value,count) 3
long i_WRWORD <<18+ j6_012 <<9+ popayx ' 19 00011001 WORDFILL(start,value,count) 3
long i_WRLONG <<18+ j6_012 <<9+ popayx ' 1A 00011010 LONGFILL(start,value,count) 3


long i_bin +i_ROR <<18 +math_E0 <<9 +math_bin '$041 E0 00000 ROR 1st -> 2nd b -> ->= rotate_right
long i_bin +i_ROL <<18 +math_E0 <<9 +math_bin '$049 E1 00001 ROL 1st <- 2nd b <- <-= rotate_left
long i_bin +i_SHR <<18 +math_E0 <<9 +math_bin '$051 E2 00010 SHR 1st >> 2nd b >> >>= shift_right


Hope this may help http://forums.parallax.com/images/smilies/cool.gif




▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Prop Tools under Development or Completed (Index)
http://forums.parallax.com/showthread.php?p=753439

My cruising website http://www.bluemagic.biz

heater
01-19-2009, 07:01 PM
Hurray !!! The pesky DAA instruction is now working!! Daa, Daa, Daa....

See attached screen shot running a CPU test under CP/M. All tests OK.

Had to fix ALL the other logic ops (ANDa, ORs and XORS) to do this, which meant moving them to LMM.
Suprisingly that does not cost much in speed after "in lining" the code.

I will not attach this code yet as I want to clean it up some more.

Thanks for all your suggestions, I will look into them when I have a mo.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.

Cluso99
01-19-2009, 07:59 PM
Excellent work heater http://forums.parallax.com/images/smilies/smile.gif http://forums.parallax.com/images/smilies/smile.gif

Now you have it working, how many cogs are you using and what are they used for?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Prop Tools under Development or Completed (Index)
http://forums.parallax.com/showthread.php?p=753439

My cruising website http://www.bluemagic.biz

heater
01-19-2009, 09:52 PM
As it stands now PropAltairs COG usage is:

1. Simulator "main" does some init then starts CPU, is actually free for use after that sitting in "repeat".
2. The 8080 emulation.
3. I/O subsystem, Emulates anything on the other end of CPU IN/OUT instructions.
currently: console in, console out, 8 floppy disks on SD card and driving the Prop Demo Boards LEDS.
4. PC_Keyboard for listening to PropTerminal.
5. PC_Text for talking to Prop terminal.
6. sdspiqasm - The low level SD card driver.
7. Free.
8. Free.

Running a 24K byte CP/M system (God how I wish I had that in 1979!) my HUB RAM is
full 61 longs left. The emulator COG is full 7 LONGS free!

There are many ways to go from here:
The simulator main COG could be combined with the I/O cog.
PC_Keyboard can be replaced by a real keyboard driver.
PC_Text can be replaced by a TV or VGA driver, if we use external RAM for CP/M.
PC_XX could be replace with full duplex serial for use with ProComm, which is what I want to next.

Now that the 8080 logical operation seems to be pinned down accurately I'd like to go for a
multi COG emulator, for speed, but I'm going to leave that for now and start trying to get DrAcula's N8VEM CP/M
board to use a Propeller for it's I/O devices and disks.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.

Baggers
01-19-2009, 09:56 PM
Great work heater, very impressive :D

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
http://www.propgfx.co.uk/forum/·home of the PropGFX Lite

·

Cluso99
01-20-2009, 12:35 AM
So heater is the plan to use 2 props, one for the PropAltair and one for the Video Terminal (VGA/TV & PS2 Keyboard) and communicate serially [ProComm] ?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Prop Tools under Development or Completed (Index)
http://forums.parallax.com/showthread.php?p=753439

My cruising website http://www.bluemagic.biz

heater
01-20-2009, 12:58 AM
Well there are a couple of plans:)

1. Add external RAM to a Prop and run the emulator and TV and keyboard and SD. A full system on a chip. If there are enough pins etc.

2. I really like the idea of using a serial line to PropComm. Preferably with external RAM for the emulator but it rans without anyway.

3. Given that a Prop with external RAM then has a "bus interface" it could also include an IO/M line to select I/O devices
in which case it might be cool to use the second Prop on the "IO" bus where it emulates serial port chips etc in a simple way
perhaps a modified version of PropComm with VT100 emulation. Perhaps also including the SD
card driver as PropComm has that anyway.

4. One day we may have a Prop/CPLD/RAM board from Leon which would make all this very neat.

In the mean time there is a plan to add a Propeller to the N8VEM CP/M computer project (Dr_Acula and co), which uses a real Z80 chip, to
implement peripheral devices. Replacing all/most of them thus making for a really simple real CP/M machine.

I will be concentrating on N8VEM next as Dr_Acula has been kind enough to send me a board. But I'm pondering if the N8VEM
can be combined (about same as) option 3 above.

Decisions, decisions....

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.

Oldbitcollector (Jeff)
01-20-2009, 01:11 AM
Outside of a couple VT100 emulation issues. (I'm adding VT52 as well)
PropCOMM is about as smooth as it can be for use with a CP/M board, Propeller or otherwise.
At present the system is Xmodem transfer into the CP/M side, then launch.
This works, but honestly could be better implemented with some type of direct access to
the to the SD card from CP/M side. (A little outside of my abilities at present)

Personally, I'm just waiting for one of our resident wizards to create an onboard compiler
so we can create code and compile without the use of a PC. :) As I see it, we're pretty close.

OBC

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
New to the Propeller?

Check out: Protoboard Introduction (http://jeffledger.googlepages.com/Protoboard_Introduction.pdf) , Propeller Cookbook 1.4 (http://ucontroller.com/Propeller%20Protoboard%20Designs%20for%20the%20Beg inner.pdf) & Software Index (http://forums.parallax.com/showthread.php?p=770318)
Updates to the Cookbook are now posted to: Propeller.warrantyvoid.us (http://propeller.warrantyvoid.us)
Got an SD card connected? - PropDOS (http://www.orrtech.net/propdos/)

Cluso99
01-20-2009, 01:45 AM
I like the idea of 2 props, one doing the emulation and one doing the terminal and I/Os if required. The emulation prop needs the SD card for the disk and CP/M. It is fairly easy to stack 2 prop proto boards. Only need 4 wires: +V & GND, Tx & Rx to join them. http://forums.parallax.com/images/smilies/smile.gif
This way, the emulation prop could do the PropAltair, ZX81, Apple or C64, etc. Just change the SD card http://forums.parallax.com/images/smilies/smile.gif

Once you use a CPLD, may as well go the whole hog and do the complete cpu and terminal in a single fpga such as a spartan 3 (it's been done for a number of retros). But that takes the fun away from usng the Prop :-(

OBC: Does PropComm have just a version with VGA + PS2 Keyboard + VT100 + Serial (i.e. A standalone video terminal running on a Prop)? (I think you may have gone past this point)

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Prop Tools under Development or Completed (Index)
http://forums.parallax.com/showthread.php?p=753439

My cruising website http://www.bluemagic.biz

Post Edited (Cluso99) : 1/19/2009 5:54:30 PM GMT

Oldbitcollector (Jeff)
01-20-2009, 01:58 AM
Yes, there are two VGA version which contain a bulk of VT100 support.
One has the PropDOS additions, while the other does not.

http://forums.parallax.com/showthread.php?p=772078

I haven't added the extended VT100 stuff to the TV version yet.
Doug is working on an 80 column, color TV driver, so I'm waiting to see what he comes up with.
Honestly, I'd rather he spent his time on the 6502 emu stuff. :)

@heater, sorry, looks like I've gone and hijacked your thread..

Point additional PropCOMM questions to my thread. :)

OBC

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
New to the Propeller?

Check out: Protoboard Introduction (http://jeffledger.googlepages.com/Protoboard_Introduction.pdf) , Propeller Cookbook 1.4 (http://ucontroller.com/Propeller%20Protoboard%20Designs%20for%20the%20Beg inner.pdf) & Software Index (http://forums.parallax.com/showthread.php?p=770318)
Updates to the Cookbook are now posted to: Propeller.warrantyvoid.us (http://propeller.warrantyvoid.us)
Got an SD card connected? - PropDOS (http://www.orrtech.net/propdos/)

heater
01-20-2009, 07:43 AM
OBC, never mind the thread hijacking. There seems to be some symbiosis going on here. For sure it's in my plans to have a two Prop stand alone CP/M system with PropComm.

As I'm done with trying out old BASICs future PropAltair developments will go back onto the CPM/Propeller thread.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.

Cluso99
01-20-2009, 02:43 PM
@OBC for Doug: Here is an FPGA 6502 implementation that may help in the Prop 6502 emulator. (OT, sorry Heater)

Postedit: Sorry, here is the link· http://www.fpgaarcade.com/library.htm

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Prop Tools under Development or Completed (Index)
http://forums.parallax.com/showthread.php?p=753439

My cruising website http://www.bluemagic.biz

Post Edited (Cluso99) : 1/20/2009 9:20:11 AM GMT

heater
01-20-2009, 04:22 PM
FPGA 6502 where?.

Guess I could have just used the 8085 core from opencores,org. FPGAs are something else I'd love to have the time to get in to. Someone here is creating a propeller in verilog so perhaps one day there will be an 8080 emulated on a propeller implemented in an FPGA:)

I don't think using a weeny small cheap CPLD as glue between a Prop some RAM and some peripherals compares to implementing an 8080 on FPGA. Not sure but surely an FPGA big enough to implement an 8080 would be much more expensive and you'd still need the RAM.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.

Baggers
01-20-2009, 04:27 PM
heater you beat me to the where lol :)
btw for fpga you'll need the ram + flash so it'll be even more expensive! lol

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
http://www.propgfx.co.uk/forum/·home of the PropGFX Lite

·

Cluso99
01-20-2009, 05:18 PM
Sorry, forgot link :-( http://www.fpgaarcade.com/library.htm

My Spartan 3A·(Avnet)·board has external ram end flash. However, the Spartan 3A has 56Kb of distributed ram and 360Kbits of block ram within the XC3S400A fpga. Some of this may get used in the cpu design. I am using the 512x36 blocks as 512x32 (dual port) for the cog ram.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Prop Tools under Development or Completed (Index)
http://forums.parallax.com/showthread.php?p=753439

My cruising website http://www.bluemagic.biz

Post Edited (Cluso99) : 1/20/2009 9:30:06 AM GMT

toml_1295
04-11-2012, 12:04 AM
I see the note in altair_mem.spin that 4K BASIC doesn't work yet. Do you have an idea what the problem with it is?

Heater.
04-11-2012, 10:33 AM
toml_1295

Welcome to the forum.

Gosh that is going back in time. I seem to remember that at some point we had 4K BASIC working. Of course just now I can't find it in the forum anywhere.
I've just been through the old PropAltair thread without spotting it. If I have time I'll scour my old PC and try to find it for you later today.

Or perhaps someone has a book mark to it.

I also seem to remember that the MITS BASICS stopped working in the later ZiCog Z80 emulators as they relied on 8080 flag operation or some such.

Toby Seckshund
04-11-2012, 05:00 PM
That'll teach you for saying something about the past not being over, yet :-)

toml_1295
04-11-2012, 06:48 PM
toml_1295

Welcome to the forum.

Gosh that is going back in time. I seem to remember that at some point we had 4K BASIC working. Of course just now I can't find it in the forum anywhere.
I've just been through the old PropAltair thread without spotting it. If I have time I'll scour my old PC and try to find it for you later today.

Or perhaps someone has a book mark to it.

I also seem to remember that the MITS BASICS stopped working in the later ZiCog Z80 emulators as they relied on 8080 flag operation or some such.

Oops! My bad for not reading the ENTIRE thread before posting. I found the post with propaltair_2_3_4KBASIC. Sorry about that!

Tom L

Toby Seckshund
04-11-2012, 08:15 PM
Heater's getting the 8080 stuff, and then the Z80, working was such a gift. A 24KB version of CP/M running on a Prop got me back into the quest for a resurected Nascom (my first computer).