-
Notifications
You must be signed in to change notification settings - Fork 15
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
Stepping towards a multi-target compiler #82
Comments
I can help with C16 (CPlus/4 = C16 with 64K) and VIC20. Their architecture is not so different than the C64. With the CPlus/4, BASIC+KERNAL are located at $8000-$FCFF, they take half of the memory. they can be banked out to access ram under but they are only banked out simultaneously. |
Thanks! To tell the truth, there is no upper memory limit check currently. As long as DASM compiles the intermediate code (I think up until $FFFF), no error will occur. So this is again another task - to set up some limit check depending the platform and configuration (using PRAGMA as you suggest). Are BASIC/KERNAL floating point routines in Plus/4, C16 and VIC20 the same? XC=BASIC does not have its own floating point library, it just uses the FP routines in BASIC/KERNAL (temporarily banking it in for the calculations). The rest seems okay, I think I'll start with separating the nucleus and the libs and when it's done I'll ask you to do the other platforms. |
FP routines in CPlus/4 and VIC20 should be at different addresses but work like the C64. |
Hi @Majikeyric I have created a new branch Let me provide you some basic information. The
(I wasn't sure if I should make 1 or 2 dirs for c16 and plus/4, we can discuss this later.) There's a new PRAGMA directive that looks like this:
This tells the compiler which platform to compile to. Defaults to "c64". I have only did a couple of tests (you'll find it in It is worth noting that whenever you change a file in the Please contact me in email (feketecsaba [at] gmail) if you need to discuss the details. Thank you so much and welcome aboard! I'm very excited about this new feature as it opens the door to other retro worlds! PS. Some addresses are still hard-coded, e. g $0400 and $0801. We'll have to discuss these... |
Thanks for the info ! I'm excited too helping porting XCBASIC to other platforms I love (with the C64!). |
The VIC20 implementation is complete there are a lot of similarities with the C64. BUT there are 3 different memory configurations for VIC20. So I don't how you can deal with it. 3K expansion: 8K expansion and more: some remarks: The STDLIB_MEMSETUP SUBROUTINE is not required as there is no bank switching on VIC20 so I just let a RTS if you call it anyway. STDLIB_RND SUBROUTINE The current device number is probably hardcoded ? ($BA) $02fe-$02ff location to store USR function return address should be ok on VIC20/C16+4 Does XCBASIC check when C64 code is located at $a000-$bfff ? and how does it manage the BASIC banking-in in this case ? There will a bit more complex case with C+4, as ROMs (BASIC+KERNAL) are located at $8000-$ffff and can only be turned on/off at once, not separately. EDIT IRQ call : bintr You should place bintr address to $fffe. KERNAL/BASIC calls: SEI |
On Windows you have a DUB command line launcher in your start menu. Run it and cd to the project root. Then issue the command and it should run fine. It creates the xcbasic64.exe which you should copy to the bin directory. What errors do you get? |
I think I'll add a PRAGMA for this. Now I see that it's very important to make BASIC start and screen addresses variable... I'll move on to your other questions a bit later, my weekend is busy, sorry. |
I added you as a collaborator now, maybe this will solve it. |
It is not checked at all :-( To be honest I think this is a minor issue now as BASIC is only banked in for floating point routines. If the program doesn't use floats then BASICIN/BASICOUT will only be called on the program start/end. Three options I can see now for fixing this:
+1 idea: drop floats and use fixed point. |
Can you please fix and also add a reference in a comment. I think I forgot to add credits/reference. Thanks |
I have pushed some code change that gives us these new PRAGMAs:
CHARAT and TEXTAT now takes into account the above settings. I have difficulties with testing on VIC-20, TEXTAT is yet buggy in some situations. I haven't yet tested on Plus/4 at all. P.S. @Majikeyric would you like to join the XC=BASIC Slack channel where we can discuss the details? I can send you an invitation. Or do you have any other preferred communication method? |
the VIC20 screen by default at startup has 23 rows and 22 columns (but it can be changed by writing to registers). I haven't completely implemented C16/Plus/4 yet
yes sure! and yes I like Slack! :) |
Thanks. Here's the invite link: It's open for everyone who wants to join. |
The compiler is currently targeted to C64 only. Many users have already suggested that it should be possible to compile XC=BASIC programs to other platforms e.g Plus/4, C16, VIC-20, BBC Micro, the upcoming X16, and others.
This task requires involvement of developers who are familiar with the new target systems.
Here is a brief explanation of the current library system for reference. The compiler includes the following libraries in the intermediate assembly source:
lib/nucleus.asm
- Not really a library, but a bunch of pseudo-op definitions. The compiler translates the program to these pseudo-ops. This file is always included.lib/stdlib.asm
- The standard library containing routines required for I/O, random numbers and memory setup. This file is always included.lib/strings.asm
- Library containing the string handling routines. Included only if strings are used in the program.lib/mem.asm
- Library containing the memory manipulation routines. Included only if commands likeMEMSET
,MEMSHIFT
, etc. are used in the program.lib/opt.asm
- This is again rather a set of macros required by the optimizer.For the future I envision a library structure something similar to the following:
Meaning that all platform-agnostic libraries go to the library root and and all platform-specific libraries go to their own dir.
The following steps are required (in a nutshell):
PRAGMA
directive that instructs the compiler which platform to target to.Please add your thoughts and/or let me know if you can help in coding. Thanks.
The text was updated successfully, but these errors were encountered: