EtchedPixels / pcc-tms9995

ANSI pcc retarget to the TMS9995 microprocessor
6 stars 1 forks source link

[feature request][tms9900][ti99] Support #5

Open Fabrizio-Caruso opened 2 years ago

Fabrizio-Caruso commented 2 years ago

Maybe it is better to track the TMS9900 and TI99 features here instead of https://github.com/EtchedPixels/CC6303/issues/19

I can confirm that you can run binaries with Classic99 (http://www.harmlesslion.com/cgi-bin/onesoft.cgi?1) once you have first converted them from ELF to EA5 and then split them (which is also necessary for small files because it seems to add a necessary header) as I do here: https://github.com/Fabrizio-Caruso/CROSS-LIB/blob/master/src/games/chase/makefiles.chase/Makefile.gcc_tms9900_targets#L162

Is your compiler producing ELF binaries? If that is the case, maybe we could use the same tools and with some luck the same crt. It seems that the most common solution is to have the binary run at $A000 (start of 32K RAM memory expansion).

An even better and clearer example is the one by Tursi (https://atariage.com/forums/applications/core/interface/file/attachment.php?id=872708) which is from the AtariAge forum, which, by the way is the best place to find TI99 experts (https://atariage.com/forums/topic/164295-gcc-for-the-ti/).

The loading/running procedure with Classic99 is:

EtchedPixels commented 2 years ago

So if I understood the model right EA5 is a crude memory dump in a series of files with headers loaded in sequence of filename and the side car memory is at 0xA000 with another space low down ending at 0x4000.

I've added the bits to the compiler tool that ought to make this work.

The toolchain produces a few different outputs but the main one is a straight memory image, which is what I then turn into what is hopefully valid EA5.

Fabrizio-Caruso commented 2 years ago

I think you got it right but the naming (not your use of the names) is ambiguous. There is the ELF which is converted to something also called EA5 (which stands for editor/Assembler option 5), which is not the runnable EA5, yet. I produce the runnable EA5 binaries with ea5split. They seem to have headers and are split in 8k blocks (I think the 8k blocks are a requirement for ROM images).

I will do some tests once I understand what I need to use your compiler. It seems I need the main TMS9995 repo + the support repo + CC6303 for the linker and Assembler. I will give a shot once I have some time. I see no input/output, yet. I will write on the VDP ports to produce something visible on the screen. It should not be to hard. Alternatively I could use some rom routines.

EtchedPixels commented 2 years ago

Seems to work for my simple test case. I've added a few bits for mdos as well although they need further work as it turns out the mdos load format is almost as brain dead as the ti one.

Fabrizio-Caruso commented 2 years ago

Great! I couldn't find your example in your repositories. Did you manage to code a hello world example? Would you make it available? Is MDOS a format used by the TI99/4a or by some other TMS9900/9995 computer such as the Geneve 9640? Once I have implemented some sort of putchar and getchar, I will test your compiler with my 5 games and several examples. I will start with a version that uses plain ASCII mode. They can provide a good test and benchmark as they are big mini-games (with binaries of up to 20kb on most 8-bit targets).
I think putchar can be done in plain C by writing into the VDP ports. For getchar I either need to call a ROM routine or access the CRU to poll the keyboard/joystick. Both of which require some knowledge of TMS9900 Assembly, which I currently lack. Calling the ROM routine should be easier. I will have to figure out how it can be done (in terms of syntax and conventions).

EtchedPixels commented 2 years ago

I built a raw assembler VDP test EA5 and booted it on a geneve emulation as the LOAD/SYS. (The Geneve bootstrap is an EA5 file off a TI format disk)

MDOS is geneve