Jump to content
IGNORED

MadLib for TI/C99: resolution and memory issues


Harry Potter

Recommended Posts

Hi!  I'm new to TI programming and want to port my rendition of MadLib to the TI 99/4A.  I need to know the resolution of the TI's monitor in text mode and want to know where I can place extra code and data, i.e. sections of the OS's RAM that are not used during the course of C99-compiled programs.

 

BTW, where can I find a TI 99/4A User's Manual?

Link to comment
Share on other sites

I think you will find the information is rather diffuse. Each language was essentially it's own little O/S and presented the machine differently to the user.

The editor assembler manual has a lot  of good information but it's all from the perspective of Assembly Language (on the resources page)

 

This web site has a lot of info that was never fully published by Ti. http://www.unige.ch/medecine/nouspikel/ti99/titechpages.htm

For example here is the 9918 Video processor page for your question on resolution

http://www.unige.ch/medecine/nouspikel/ti99/tms9918a.htm

 

Then there is the TI manuals for the processor and the 9918 for details in that area.

 

Specific questions are well supported here in the forum by people with almost 40 years of experience with the machine, in some cases, but that all-in-one manual is probably not a reality IMHO.

Link to comment
Share on other sites

24 minutes ago, Harry Potter said:

TheBF: I thank you for the links.  They were helpful.  I found some areas I can use for MadLib, but I still need to use overlays.  :(  How do I do it?

 

How are you planning on using the overlays?  Are you planning on loading them as essentially swap files from disk storage, or using a SAMS?

How many overlays are you anticipating?  Or how much memory do you anticipate needing for overlays?  And finally, how much memory do you anticipate needing for a "core" set of routines accessible to all the overlays?

 

Overlays are going to pretty much on the 4A side of things require some customization on your part.  This is where you will need to define the memory block(s) you want to overlay, define some kind of header for each block, and then have your own mapping routine to get those overlays into memory where you can retrieve the block(s) you want.

 

Your initial message indicates C99, which if I recall from posts I have seen elsewhere, you would be using a compiler on another platform with more capabilities.  That pretty much rules out programs that run from an existing TI-99/4A and pushes you to some of your own customization for overlays.

 

If you were writing in assembly, I would think you had more options with the Rag Assembler as I think it goes well with the SAMS or at least had the tools to do so.  The other option if programming on the TI-99/4A, I would suggest the use of MAME with setups for both the TI-99/4A and Geneve 9640.  The GenPROG package with the linker would allow nice overlays and customization with the Geneve.  Create the file(s), then switch over to TI-99/4A emulation with MAME for running/testing purposes.  I looked a few minutes ago, and it looks like MAME has supported the SAMS for quite some time.

 

 

 

 

 

 

  • Like 1
Link to comment
Share on other sites

I thank you for your information.  For now, I will only need one overlay at a time.  I don't know how much RAM I need to support both the main program and the overlays, but, on the cc65/CBM version of one program, I need <2k for each overlay and only one overlay at a time.  On another program, I anticipate significant use of RAM for both the main program and the overlays but only one overlay at a time.

 

BTW, I just realized that I could use extra unused OS memory to store overlays to be loaded and available at all times while the program is running.

Link to comment
Share on other sites

The questions make some assumptions about the machine which is why you are getting such vague answers.

 

The system has two blocks of RAM: 8k at >2000, and 24k at >A000 (and TI uses ">" as the indicator for hexadecimal).

 

GCC and C99 both use the 8k block for the stack, although stack usage is usually not very much, meaning you can use some of that memory yourself -- but you are responsible yourself for avoiding stack collisions, the tools won't tell you.


The AMS card, which has been mentioned a few times, gives you expanded memory which is paged into the memory slots above in 4k pages. The most common available device right now has 1MB. You will pretty much be on your own for managing and paging this memory if you choose to use it, there are no automated tools available for C code. But this is why people are asking about it - you could easily do your overlays if you loaded all the program into that memory.

 

All of the above is not true for an unexpanded, bare console. Running C code on a bare console is tricky and you need to learn a bit of the architecture to make it work. If that's your goal, then you'll need a deeper dive than you were probably expecting.

 

There are also 256 bytes at >8300, which we call the scratchpad. This is zero wait state memory, but the usage is kind of scrambled and if you're only working to port C code, I recommend you just disregard it.

 

All of the above ignores the video RAM, which there is always 16k of. You can not map video memory into the CPU address range so you can't run code directly from it, so I presume for the sake of this discussion that we can disregard it. But most of it is available if you need some RAM to back things up in. ;)

 

The OS itself is pretty much a non-starter. There are some functions in the ROM that fire on interrupts and a few (very few) functions that are worth calling from your own code, but for the most part it's just there to start software, not so much to help it run. If you stay out of scratchpad as I suggested above, you can largely ignore it.

 

The text mode display is 40x24 and single color only, with a single background color (though you can choose what each of those are from the 15 color palette). It takes 960 bytes of the video RAM, plus a full character set uses another 2k. In text mode, the rest of video RAM is unused and you can lay it out pretty much how you like.

 

  • Like 3
Link to comment
Share on other sites

17 minutes ago, Harry Potter said:

Thank you, but that still doesn't answer the original question: how do I create and use overlays from C99 code?

The direction you go, you are going to have to create them yourself.  Typically, separate files that have a common header, etc.  You will then need to write a custom loader depending upon how you want to retrieve the overlays and where you want to store them.  That is based on another post where I saw you were going to use Windows 10 with a C99 development system.

 

That is what Tursi and I were trying to say as we tried to get an idea on some top level overview of your program.  Overlays don't just "happen" by the operating system.  It is something you have to specifically code yourself depending upon what hardware framework you are targeting. 

 

I think this is one case where a zoom call, perhaps on a Saturday or Sunday when they are scheduled, may help you out a bit more than just messages to at least lay some foundation down and understand your current understanding of the TI-99/4A.  The next Zoom is this Saturday, 2pm EST time I think.

 

Please don't get frustrated, but on the surface, it sounds like your background understanding of the TI-99/4A may be limiting you to understanding our feedback that voice communication may more clearly get you pointed in the right direction.

 

 

 

 

 

 

 

 

  • Like 3
Link to comment
Share on other sites

I can use fread() to load an overlay into memory at a specific place in memory.  I just want to know how to write the code and data to load into memory at a given address.  BTW, I just perused the C99 manual, and it doesn't include some of the features I need, i.e. structs and array of structs.  :(  I need to find GCC for the TI and can build it using Open Watcom.

Link to comment
Share on other sites

I don't know if those programs allow you to embed assembly, such as the assembly directive:

 

AORG  >hexaddress

 

I think in some assemblers, it uses the #asm and the #endasm directives in the C code to designate start and end of the assembly code.  No idea whether your PC programs will do that.

 

If it does, and then IF the linking process respects the statement, then you should be able to control some of the coding.

 

  • Like 1
Link to comment
Share on other sites

This is what I found trying to convert pc programs in c .. many of the standard routines don't exist on the ti in the c implementations you have to write them yourself or import them and convert them etc and it's amazing how many of them eat the dog food of other standard routines that don't exist..

 

If you want some great recent examples of c on the ti look at Jedimatt42's GitHub especially force command and petee's work on his port of turmoil

 

Sent from my LM-V600 using Tapatalk

 

 

 

 

  • Like 2
Link to comment
Share on other sites

7 hours ago, Harry Potter said:

I can use fread() to load an overlay into memory at a specific place in memory.  I just want to know how to write the code and data to load into memory at a given address.  BTW, I just perused the C99 manual, and it doesn't include some of the features I need, i.e. structs and array of structs.  :(  I need to find GCC for the TI and can build it using Open Watcom.

The point we have been trying to make is that the tools to do this do not exist. You will have to invent the system and implement it yourself.

 

And no, C99 doesn't have those things. It's a subset (meaning not all of) "Small C", which itself is only a subset of C. That's why we were questioning that choice early on.

 

You are not the first person to come in and want to port software to the TI, but unfortunately neither the architecture nor the existing toolchains will do very much to help. Your success will very much depend on how much you are willing to do yourself. :)

 

Just to give you an example, you should expect to need to write fread(). :)

 

To build GCC, you will need an existing GCC for your host platform. I don't think GCC supports being built by other compilers, but you can try. The patches for 9900 are in this thread: 

 

 

 

  • Like 2
Link to comment
Share on other sites

On 3/16/2021 at 3:53 PM, Harry Potter said:

Thank you, but that still doesn't answer the original question: how do I create and use overlays from C99 code?

As Tursi said you will have to write fread() . That's the bad news.

The good news is the disk system has a function that can blit a file of upto 8K into Video RAM  extremely fast. (yes that's where it goes first) :(

That data can be blitted into CPU RAM very quickly with a system function called VMBR (Video multiple byte read) and I think that is in GCC TI library...  and now we have left my area of expertise completely.

 

All that to say overlays are very possible. I am noodling on how to built them for my own system but as you can see it's a lot of DIY.

 

If it was easy everybody would be doin' it. :) 

  • Like 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...