-
-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support other target machines (Atari, Vic20, C-128, BBC Micro...) #6
Comments
Some progress has been made here recently, by adding a switch to select the compiler output target. |
The commanderX16 target is now the second functional target and it kinda ironed out the kinks that should make it fairly easy to add another target. (as long as we know the machine's memory map and such) |
Are you considering at least basic support for 8-bit Atari? |
I would love to!! What needs to be done is mainly implement the ICompilationTarget and IMachineDefinition objects for it that tell the compiler about memory layout and stuff. |
Safe memory location for code is from $2000 to $BFFF then BASIC is off - this is default scenario. ZP free memory for non BASIC programs is from $80-$FF. Key registers you can find here: https://github.com/KarolS/millfork/tree/master/include a8_*.mfk Most simple binary (XEX) for Atari is build this way:
https://www.atarimax.com/jindroush.atari.org/afmtexe.html There are other headers for multi segments programs but above is good for start :]
as XEX file looks this way:
Header: first 6 bytes and last 6. This way you can load one big segment into memory from $2000 to $200E and run program from $2000. |
Oh, well I forgot about:
:D
|
What type of 8 bit atari are we talking about anyway? |
Atari 800 XL 64KB RAM. On Ubuntu I use https://atari800.github.io/ - in special cases I use Altirra under WINE. Run atarti800 from command-line then F8 give you access to the monitor. |
how to print some text to the screen on 800xl? |
You can take screen memory pointer from Also look at: https://github.com/KarolS/millfork/blob/master/include/a8_kernel.mfk https://github.com/tebe6502/Mad-Pascal/blob/master/base/atari/putchar.asm
|
I'm not an expert, I always turn off system and write my own procedures to PRINT on screen ;) |
well at least 64tass supports generating xex files so we don't have to adapt the tool chain. |
I don't like the idea of writing my own PRINT routines, I much rather use a rom routine to put text and numbers on the screen. Is there a list of atari rom routines like this somewhere? |
@zbyti to streamline things in a way to get going, I really need at least parts of a questionnaire filled out for me. Here is the (new) porting guide I wrote: Here is a guide to help fill out the blanks required to add a new target to the compiler: https://prog8.readthedocs.io/en/latest/portingguide.html As I know next to nothing about the Atari 8bits, I really need someone (you?) to step in and fill in those questions to get things on the road. Not all are required to be answered to get at least a bare bones thing running, but some really are, and I don't have the time to investigate this platform myself now. |
Okay, I'll try to answer these questions soon, I'll consulting with someone more experienced on this platform than me if necessary. A8 support is not urgent, you know by your self how many people programing on 8-bit in anything other than ASM or BASIC ;) |
C128 target was added in 7.6 (but very incomplete still). |
Atari XL support: @FreddyOffenga explains everything here: https://www.youtube.com/watch?v=ezQuRA1FPJ0 ;) Freddy contributed to Millfork A8 support, maybe he can help in this case.
|
@zbyti thanks for refering to my presentation :) You can also find the textual info here: JAC! did a much longer tutorial about the Atari 8-bit which might be useful if you want to know the basics of the platform. Part 3 and 4 are about the memory map. Keep up the good work! |
@FreddyOffenga @zbyti I'd really like to add atari XL support to prog8 but I don't have the time to comb through the materials myself right now. |
CPU
Memory MapZero pagePrograms not written in BASIC do not require BASIC to run. On Atari, programs run under DOS (many different variants).
RAM, ROM, I/O
From here I count on @FreddyOffenga ;) |
master branch now has an |
Cool thank you! Will take a look and see where or how I can help, probably this weekend. |
Does Prog8 support custom targets? |
what do you mean with that? |
I mean - can i target a 65c02 with a custom memory map and io? for examples /r/beneater |
Ah I see. Well, no it doesn't - the target machine's configurations are hardcoded right now. It's not much work to add a new configuration though if you know what's needed. |
oh i see. im not really all that familiar with what would be needed and also the languages used. im basically looking for something akin to cc65 customization but with a better C standard. |
Well prog8 is not C, so if you're looking for "a better C standard" you're looking in the wrong place. |
alternatives to C89 is preferred |
Hello, our team is currently evaluating the available technologies for our project. We would like add NES support to prog8, but for that, we would like to know what is the overall process for adding a new target to the language. What files do we have to modify, what is the relevant internal structures of the prog8 compiler, etc. Btw we will need bank switching, do you think it would be feasible to add to prog8? How do people currently deal with this limitation when they have to bank switch in prog8? |
@RealDoigt that is not an easy thing to answer. Let me first start by saying that prog8 generated code cannot be stored in a ROM, because it uses 'inline' variables and self-modifying code. I am too unfamiliar with the NES to draw any real conclusion here, but I think this could be a deal breaker out of the door? Then regarding adding a potential new target to the compiler: many of the questions in the "porting guide" linked in the original message, https://prog8.readthedocs.io/en/latest/portingguide.html , have to be answered. This knowledge is then encoded into the compiler and support libraries. Most notably, in the various target-specific classes inside the CodeCore module, look here https://github.com/irmen/prog8/tree/master/codeCore/src/prog8/code/target And also most importantly in the syslib library module, look here for the Commander X16 version https://github.com/irmen/prog8/blob/master/compiler/res/prog8lib/cx16/syslib.p8 It's been a while since I added a new target, but the rest of the compiler should be (near) fully agnostic of the target platform. As long as it has a 6502 type cpu Regarding bank switching: there are no special features in the language or compiler to deal with this. By that I mean that everything related to bank switching is done manually and the compiler has no understanding of it at all. |
Yes, that is unfortunate but you are right, not being able to store programs in a rom is a major deal breaker right out of the door. |
Maybe you can put RAM on the nes cartridge? |
There's a |
The 'neo' branch has just been merged into the master branch, so it's available now by default (though very bare bones still) |
I would be happy if a very simple target system config file would be supported instead of hard-coded targets. Currently, I'm working on my own 6502-based system and the memory map and variable locations are changing quite often. I would like to test Prog8 for my development but choosing a non matching target seems to be the wrong way for me. From my understanding there isn't more needed than defining memory regions (in zeropage and elsewhere) that should be ignored by Prog8, a start address for the program and the CPU type. I whould be happy if you could add such a feature. If it's more sophisticated you could distinguish between ROM, Used RAM, Unused RAM, Used ZP, Unused ZP, IO Region etc. |
It's quite a bit of work to make it all configurable, I am afraid. However, defining the classes and code required to implement new targets is getting a bit long in the tooth for me too, so maybe I will give this another look to have at least some things configurable. |
I've started an experiment to have a .properties file that can be specified as a compilation target, in which you can then define the variables. Something like this: # configuration file for a flexible Prog8 compilation target
cpu = 65C02
program = CBMPRG
encoding = iso
loadaddress = $0801
memtop = $d000
startup_reserved = 32
bsshighram_start = 0
bsshighram_end = 0
bssgoldenram_start = 0
bssgoldenram_end = 0
# io_regions can be zero or more memory address ranges (inclusive) separated by comma
io_regions = $d000-$dfff
# zeropage scratch variables. reg must always be b1+1 !
zp_scratch_b1 = $e0
zp_scratch_reg = $e1
zp_scratch_w1 = $e2
zp_scratch_w2 = $e4
# the start of the 32 bytes used by the R0-R15 virtual registers. Can be in Zeropage or elsewhere.
virtualregisters = $10
# TODO some more things still need to follow... |
Btw, I'll probably announce and discuss the configurability feature on the discord channel more directly, rather than spamming here. |
We're not all on your discord and I shouldn't have to join yet another discord group |
Then you have to wait and see what it will or will not end up as |
as long as the information is not hidden on discord for ever, I'm fine with that |
Sure, as always, it will be documented in the manual |
The very bare-bones atari and neo6502 targets have been moved out of the compiler to externally configurable targets. See https://prog8.readthedocs.io/en/latest/targetsystem.html#customizable-target |
@RealDoigt btw, idk if you've already seen it (It's technically mentioned in |
Thank you for bringing this to my attention, I'll take a look at it tonight and I'll see where I can help. I think I could probably help with sound once the hp stuff is done. |
I'd like prog8 to better support other 6502 machines as well. But I know very little of the others, and any help here would be very much appreciated
Here is a guide to help fill out the blanks required to add a new target to the compiler: https://prog8.readthedocs.io/en/latest/portingguide.html
Here is some information about the customizable compiler target feature https://prog8.readthedocs.io/en/latest/targetsystem.html#customizable-target
The text was updated successfully, but these errors were encountered: