which basic cross-compilers could be used for nes development?

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems. See the NESdev wiki for more information.

Moderator: Moderators

Post Reply
nitrofurano
Posts: 11
Joined: Sun Mar 21, 2010 3:07 pm

which basic cross-compilers could be used for nes development?

Post by nitrofurano »

as i have been using Boriel's ZX-Basic Compiler, that is designed as basic cross-compiler for ZX-Spectrum only, to whatever z80 hardware (game consoles, home computers, arcade machines) - i wonder how possible wouldn't it be doing the same to NES using a 6502 basic cross-compiler

i have found these ones:
- https://github.com/ekbann/integer-basic
- https://github.com/neilsf/xc-basic3
- https://github.com/spotlessmind1975/ugbasic

and might be more 6502 basic cross-compilers around

so, perhaps would be simple to patch these cross-compilers somehow for targeting nes? or perhaps a basic cross-compiler for nes can be made based on these ones? what do you all think?
User avatar
Individualised
Posts: 310
Joined: Mon Sep 05, 2022 6:46 am

Re: which basic cross-compilers could be used for nes development?

Post by Individualised »

Possibly relevant, As a start, the C64 KERNAL and BASIC has been ported to NES: viewtopic.php?t=23693
Oziphantom
Posts: 1565
Joined: Tue Feb 07, 2017 2:03 am

Re: which basic cross-compilers could be used for nes development?

Post by Oziphantom »

should be easy to port, however BASIC compilers still tend to do things dynamically, in order to keep the same flow, which means use a fair amount of RAM. The main issue will be finding and replacing it use of BASIC or KERNAL ROM calls and patching the address. Also make it understand banking if you want to go over 32K. Maybe making it for FDS would work better.
Pokun
Posts: 2681
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: which basic cross-compilers could be used for nes development?

Post by Pokun »

Family BASIC only uses 4 kB cartridge RAM and most (all?) of it is for the user. V3 uses 8 kB.
Oziphantom
Posts: 1565
Joined: Tue Feb 07, 2017 2:03 am

Re: which basic cross-compilers could be used for nes development?

Post by Oziphantom »

sure, the Basic V2 will work in a 5K VIC 20 or a 4K P.E.T as well, just you can't really do much with them in that amount of RAM. But you have to store BASIC code in that size as well, so having all the code stored in ROM will help. On the flip side these compilers are designed for a machine that has 64K of free ram for it to use how it sees fit.
There is a VIC-20 compiler here https://csdb.dk/release/?id=39361 but it doesn't actually convert to ASM it coverts to a new more compact P-code format.
Post Reply