Announcement

Collapse

Forum Rules and Etiquette

Our mission ...

This forum is part of our mission to promote the preservation of vintage computers through education and outreach. (In real life we also run events and have a museum.) We encourage you to join us, participate, share your knowledge, and enjoy.

This forum has been around in this format for over 15 years. These rules and guidelines help us maintain a healthy and active community, and we moderate the forum to keep things on track. Please familiarize yourself with these rules and guidelines.


Rule 1: Remain civil and respectful

There are several hundred people who actively participate here. People come from all different backgrounds and will have different ways of seeing things. You will not agree with everything you read here. Back-and-forth discussions are fine but do not cross the line into rude or disrespectful behavior.

Conduct yourself as you would at any other place where people come together in person to discuss their hobby. If you wouldn't say something to somebody in person, then you probably should not be writing it here.

This should be obvious but, just in case: profanity, threats, slurs against any group (sexual, racial, gender, etc.) will not be tolerated.


Rule 2: Stay close to the original topic being discussed
  • If you are starting a new thread choose a reasonable sub-forum to start your thread. (If you choose incorrectly don't worry, we can fix that.)
  • If you are responding to a thread, stay on topic - the original poster was trying to achieve something. You can always start a new thread instead of potentially "hijacking" an existing thread.



Rule 3: Contribute something meaningful

To put things in engineering terms, we value a high signal to noise ratio. Coming here should not be a waste of time.
  • This is not a chat room. If you are taking less than 30 seconds to make a post then you are probably doing something wrong. A post should be on topic, clear, and contribute something meaningful to the discussion. If people read your posts and feel that their time as been wasted, they will stop reading your posts. Worse yet, they will stop visiting and we'll lose their experience and contributions.
  • Do not bump threads.
  • Do not "necro-post" unless you are following up to a specific person on a specific thread. And even then, that person may have moved on. Just start a new thread for your related topic.
  • Use the Private Message system for posts that are targeted at a specific person.


Rule 4: "PM Sent!" messages (or, how to use the Private Message system)

This forum has a private message feature that we want people to use for messages that are not of general interest to other members.

In short, if you are going to reply to a thread and that reply is targeted to a specific individual and not of interest to anybody else (either now or in the future) then send a private message instead.

Here are some obvious examples of when you should not reply to a thread and use the PM system instead:
  • "PM Sent!": Do not tell the rest of us that you sent a PM ... the forum software will tell the other person that they have a PM waiting.
  • "How much is shipping to ....": This is a very specific and directed question that is not of interest to anybody else.


Why do we have this policy? Sending a "PM Sent!" type message basically wastes everybody else's time by making them having to scroll past a post in a thread that looks to be updated, when the update is not meaningful. And the person you are sending the PM to will be notified by the forum software that they have a message waiting for them. Look up at the top near the right edge where it says 'Notifications' ... if you have a PM waiting, it will tell you there.

Rule 5: Copyright and other legal issues

We are here to discuss vintage computing, so discussing software, books, and other intellectual property that is on-topic is fine. We don't want people using these forums to discuss or enable copyright violations or other things that are against the law; whether you agree with the law or not is irrelevant. Do not use our resources for something that is legally or morally questionable.

Our discussions here generally fall under "fair use." Telling people how to pirate a software title is an example of something that is not allowable here.


Reporting problematic posts

If you see spam, a wildly off-topic post, or something abusive or illegal please report the thread by clicking on the "Report Post" icon. (It looks like an exclamation point in a triangle and it is available under every post.) This send a notification to all of the moderators, so somebody will see it and deal with it.

If you are unsure you may consider sending a private message to a moderator instead.


New user moderation

New users are directly moderated so that we can weed spammers out early. This means that for your first 10 posts you will have some delay before they are seen. We understand this can be disruptive to the flow of conversation and we try to keep up with our new user moderation duties to avoid undue inconvenience. Please do not make duplicate posts, extra posts to bump your post count, or ask the moderators to expedite this process; 10 moderated posts will go by quickly.

New users also have a smaller personal message inbox limit and are rate limited when sending PMs to other users.


Other suggestions
  • Use Google, books, or other definitive sources. There is a lot of information out there.
  • Don't make people guess at what you are trying to say; we are not mind readers. Be clear and concise.
  • Spelling and grammar are not rated, but they do make a post easier to read.
See more
See less

Powertran Cortex

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    C on a 9995

    I'm spending way more time on this than I should, but over the weekend I've grown quite optimistic over the Ritchie compiler port. It is now in a state where it will compile small test routines satisfactorily. I'm currently working with it as a cross-compiler, but it should fit on a Cortex:
    - If I'm not mistaken there is 56K of available RAM (8K mapped to I/O?)
    - The compiler has three passes, measuring 18K, 22K and 8K for the PDP11 binaries
    - It would seem that the passes need 10-20K in data space, so 30-40K is needed for it to run
    Using Cortex Basic/CDOS as host (taking up 24K), one should be able to compile smaller programs. Using MDEX (with a 12K kernel), it should have enough room to compile itself.

    Considered at a very high level, the code generation pass (the second pass, ~4.000 lines of C) works by matching code snippets to the parse tree. There are about 350 such code snippets and I have reviewed/adapted about 50 so far. I'd like to share my progress, and perhaps get some input/help from others. Certainly the folks working on gcc ports (Dave Pitts and "tursi") might be interested.

    I'm not sure this thread is the right forum to expand on the compiler port. Use a new thread in the TI area of this forum? Use another forum for this? Or is this thread the best place?

    Paul

    Comment


      Originally posted by Jim Hearne View Post
      Page 34 of your 99xxx databook says /READY is sampled on I/O operations and can be used to extend them.
      Jim
      Ah, yes, you're absolutely right! Checking again, the 9995 works in the same way. Only the 9900 where READY only applies to memory cycles (unless it's just the way that the spec is worded?).

      Comment


        Originally posted by pnr View Post
        I'd love to do a single eurocard version of a 9995 based system and a 99105 system on two piggybacked eurocards. However, my Eagle skills are next to non-existent. Other than the E-bus interface, most of the routing could be the same. I'm too busy now, but in a few months time I'd be interested in working on PCB's for this, as a novice assistant.

        Paul
        I don't know if Stuart still has any of the MPE TMS9995 eurocard boards left.

        PCB's I am good at (IMO), though the program I use here at work ( Boardmaker ) is rather old and won't export anything other than Gerbers.

        Would a 99105 system need 2 Eurocards ?, if you use modern RAM and EPROM (or even EEPROM) like Stuart has it shouldn't take up too much space.

        Jim

        Comment


          Originally posted by pnr View Post
          Also, figure 16 suggests that the 99xxx has automatic wait state insertion ("WAITGEN"), but I could not find how to activate it. Perhaps the same as for the 9995.
          Depending on where you look, pin 6 on the 99xxx is described as either WAITGEN or Vss. Talking with someone else a while ago, we concluded that the wait generation circuit in the 99xxx is possibly buggy so they relabelled the pin as Vss so the wait gen circuit is disabled.

          Comment


            C for Cortex Basic/CDOS

            Thanks to a great kick-start from Paul, I have pursued the C99 route. I got the DOS version from whtech running using my C++ Builder XE2 and modified the CSUP Runtime Library for use with Cortex Basic.

            Like Paul said, c99 produces .asm source file(s) that are assembled and linked to a single relocatable object file using asm990 and lnk990. I have written a utility that converts the object file to an auto-run machine code program in the form of a .cas file, which can be loaded into the emulator or real Cortex. The load address is user selectable . Works very well. Basically, with the C source in your favourite editor, simply press Save, run a build.bat script in a DOS window and do a LOAD"" on the Cortex and it's running C code! I've been wanting to do this for years.

            I still have some tidying up to do and I've not added a CDOS file I/O library yet. Also, I probably need to develop a .cas to CDOS file utility if you want to actually save the file on CDOS, although this can easily be done manually just using MONITOR.

            As far as getting the compiler itself to run on CDOS (and MDEX), I've not anything with this yet. Anyone got a copy of the C99 source without the DOS/UNIX mods? I'd prefer to use this rather than try to take all the mods out (I think there might be more than the ones indicated by #ifdef _DOS etc).

            Dave.

            Comment


              Excellent work chaps!

              A few questions:

              (1) What hardware do the ports of C support? Serial? Keyboard? VDP?
              (2) What's the format of the object file from asm990 and lnk990? Attach a sample?
              (3) What changes would be needed to run the object code on a different 99xx system, like my breadboard systems? The CRU address of the serial port?

              Stuart.

              Comment


                Originally posted by Stuart View Post
                Excellent work chaps!

                A few questions:

                (1) What hardware do the ports of C support? Serial? Keyboard? VDP?
                (2) What's the format of the object file from asm990 and lnk990? Attach a sample?
                (3) What changes would be needed to run the object code on a different 99xx system, like my breadboard systems? The CRU address of the serial port?

                Stuart.
                Hi Stuart,

                Best example of asm990/lnk990 is http://www.powertrancortex.com/downl...m%20Source.zip

                Each asm file is assembled to an obj file. Each obj file is then linked to a single relocatable obj. I then wrote something to convert that to an absolute binary ROM file.

                As for c99, it just adds an extra step of producing an asm from a c module. I then modified the 'mkrom' utility to produce the .cas file.

                As far as hardware goes, my changes to the Runtime Library for Console I/O use the built-in MID instructions (e.g. READ R1 to read a key, WRIT R1 to display it etc.). That's about it. It's very 'open' in that if you want a function to support something, either write it in C or assembler or just add it to the RTL. This is what I like about it really. It's purely a cut down C compiler (with no libraries!) that's so light-weight, it is completely self-contained. The only thing the RTL needs to do is initialise the stack and handle the exit back to Cortex Basic, the rest you add as required. The manual describes putchar, puts, getchar & gets but you can make them do whatever you want or eliminate them if you don't need them. Paul, on the other hand, is after a full compiler as he's trying to build Unix!

                I'll post it all when I'm done tinkering.

                Dave.

                Comment


                  Originally posted by Stuart View Post
                  (3) What changes would be needed to run the object code on a different 99xx system, like my breadboard systems? The CRU address of the serial port?
                  Stuart.
                  For instructions how to use small C with the breadboard see my post of Jan 4th, 12:30.

                  The Ritchie compiler outputs assembler in unix syntax (using e.g. ".globl" instead of REF/DEF); I ported a unix v6 assembler to the 9900 and modern C a few years back and that's what I'm using now. All work in progress.

                  Just like small C its output expects nothing from the environment: if you need interfacing with the hardware, you write a small assembly subroutine to do that for you. Essentially, 'getc' and 'putc' is all you need to get going.

                  Paul

                  Comment


                    Originally posted by Jim Hearne View Post
                    Would a 99105 system need 2 Eurocards?, if you use modern RAM and EPROM (or even EEPROM) like Stuart has it shouldn't take up too much space.
                    Jim
                    Probably I was demonstrating my ignorance. My thoughts were that if you put 2 RAM, 2 ROM, a LS612 mapper, 4 bus drivers, a CPU, a microcontroller, a flash card, the UART and USB breakout board, and some 5..10 TTL glue chips on a board pretty much all space is gone and where will the tracks go then? Two cards stacked together would still fit in a flat alu box and make a nice "pocket-minicomputer". Just Stuart's minimal design should certainly fit on a single card.

                    Paul

                    Comment


                      Fake Chips

                      We know that the TMS9909 FDCs on eBay from a certain Chinese supplier are fakes. A couple of months ago I was given some surplus 99xx chips by a UK eBay supplier who sells 'kits of parts' of various processor families, and these parts are apparently sourced from China. This included a TMS9900 and a TMS9995. Both looked distinctly dodgy, with the date codes not making sense and the printing not looking quite right. Surprisingly, both work absolutely fine. Also included were two clock generator chips for the 9900, which should be TIM9904ANL's. They're obviously new (or re-labelled), but are actually printed "TMS9904ANL" (TMS, not TIM), which is not a valid designation. Even more surprisingly, these work as well ...

                      Comment


                        Ritchie C compiler port

                        Just a quick progress report. The port (as a cross compiler for now) is progressing nicely. Back then software packages did not come with test suites, so I use the Xinu source for that. The Xinu source consists of many short files (often only 30..70 lines), with one or two functions each. This makes it feasible to inspect the compiler assembler output and match it against its C source.

                        I'm working from the 2.11BSD version of the compiler, which was maintained till the early 90's: by and large it is a C89 compliant compiler.

                        Just to give an idea of where it is at, please find an example compilation attached. Note however that so far I have mostly looked at working with 'int', stuff related to e.g. long or float does not work at all yet.

                        Paul
                        Attached Files

                        Comment


                          Summary for posterity of some recent e-mails

                          Dave supplied a C99 demo project for the Cortex, using asm990, lnk990, and bin990 to create a Cortex cassette image.

                          ====

                          Hi Stuart,

                          For what it's worth, I tried the demo with 'UNIT 2' and 'UNIT -1' for
                          RS232 only and it did display text on the terminal (but without cursor-control). I did this as I thought your set up is like this?

                          Also, if you remove the -x option from the bin990 utility, then it will generate pure binary machine code instead of a cassette image. Perhaps this would be useful with your other 99xx hardware? You would have to modify the putchar/getchar assembler routines in CortexRTL.asm, but I'm sure you're that's no problem for you.

                          Dave.

                          ====

                          C99 is essentially Small C ported to the 9900: http://en.wikipedia.org/wiki/Small-C, there's links to resources from there.
                          I still have the original articles from Dr. Dobbs somewhere, if need be I can scan those (but they are about the 8080 version).

                          In related news, I'm still making progress with the Ritchie compiler. I've now succeeded in compiling several files from Xinu (in fact all the material from chapter 4 of the 1984 version of the Xinu book: the process queue). The output code seems about equally dense as pdp11 code (fewer addressing modes make the code longer, but more registers make it shorter, it seems to balance out).

                          Paul

                          ====

                          Stuart queried if there was a switch to make the .obj file from lnk990 absolute rather than relative. Dave replied:

                          The asm990 and lnk990 are from Dave Pitts and modified by me for DOS. The demo.obj is created by linking the relocatable asm modules to a single relocatable object. I asked Dave Pitts how to get an absolute file from that instead (ie the same question you have) and he said in a TI990 the operating system loads it at run time and assigns the load address at that time. Since it's a multi tasking OS, the programs have to be relocatable.

                          So he gave me a copy of what the OS does and my bin990 is based on that. I tell it the load address via the command line and it builds the executable as if it was about to be run by the TI990 OS.

                          ====

                          Paul said:

                          "a TI990 the operating system loads it at run time and assigns the load address at that time"

                          That is what EVMBUG on the breadboard does as well: you pass an absolute load address to the LMC command and it relocates the .obj as part of the loading.

                          Comment


                            Originally posted by pnr View Post
                            Just a quick progress report. The port (as a cross compiler for now) is progressing nicely. Back then software packages did not come with test suites, so I use the Xinu source for that. The Xinu source consists of many short files (often only 30..70 lines), with one or two functions each. This makes it feasible to inspect the compiler assembler output and match it against its C source.

                            I'm working from the 2.11BSD version of the compiler, which was maintained till the early 90's: by and large it is a C89 compliant compiler.

                            Just to give an idea of where it is at, please find an example compilation attached. Note however that so far I have mostly looked at working with 'int', stuff related to e.g. long or float does not work at all yet.

                            Paul
                            Looks good, Paul!

                            The compiler certainly seems to produce some decent code, especially in terms of using the addressing modes.

                            Great work so far!

                            Dave.

                            Comment


                              Ti-c

                              Just received a reply from Alan Beard. He attached the source to TI-C to his message. Had a quick look and it seems to compile under gcc with only a little fiddling. It generates much better code than Clint Pulley's C99 and seems to do most of C89 sans longs and floats. Like C99 it is a single executable that outputs assembly. The output seems compatible with asm990.

                              I would like to have this stuff up on the whtech site. Does anybody here know how to get in touch with the whtech maintainers?

                              Paul

                              Comment


                                I can make sure it gets up onto WHT. I believe Stuart can as well. This is very good news, as Al's been out of contact with the TI community for a long while. I bought his Fortran99/Fortran9640 program many years ago. It was a nice implementation of Fortran.
                                Enter My Mind At Your Own Risk!

                                Comment

                                Working...
                                X