what about forking Boriel’s ZX-Basic Compiler for 6502/NES?

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

what about forking Boriel’s ZX-Basic Compiler for 6502/NES?

Post by nitrofurano »

since years ago i were trying to extend Boriel’s ZX-Basic Compiler ( http://www.boriel.com/wiki/en/index.php/ZX_BASIC ) to most of existing Z80-based hardware ( http://www.boriel.com/wiki/en/index.php ... R_HARDWARE )

and since Boriel’s ZX-Basic Compiler is coded in Python (relatively simple to analyze, adapt, and start using without compiling), and quite simple to use, i imagined how simple it would be to adapt it to use 6502 instead of Z80, replacing all the Z80 routines to their 6502 equivalence - it uses ix register and stack quite intensively on routines, allows inline assembly and libraries, calculations with float points, 8, 16 and 32 bit variables ( http://www.boriel.com/wiki/en/index.php/ZX_BASIC:Types ) , and the code is released in a gpl-compatible software-libre licensing

how simple it would be? and how soon could we expect such fork being released to the public?
(i think it is worth seeing how it works, at least...)

thanks in advance! :)
slobu
Posts: 276
Joined: Tue Jul 12, 2011 10:58 am

Re: what about forking Boriel’s ZX-Basic Compiler for 6502/N

Post by slobu »

Not many people are fans of BASIC here. Your best bet is to get into contact with people who have tried to get high level / beginner friendly compilers going.

Here's Atalan. I'd look at the source and examples for NES:
http://atalan.kutululu.org/

Here's PyNES:
https://gutomaia.net/pyNES/

Another option is to take an approach similar to rebootBASIC for the Atari Jaguar. Something like: use BCX to convert BASIC to C then tweak the output into something cc65 will like.

http://bcx-basic.sourceforge.net/

http://shiru.untergrund.net/articles/pr ... s_in_c.htm


Yet another option is to study the source code for batari BASIC. It works by using canned graphic engines in conjunction with converting BASIC into 6502 assembly:
http://bataribasic.com/download.html
User avatar
gauauu
Posts: 779
Joined: Sat Jan 09, 2016 9:21 pm
Location: Central Illinois, USA
Contact:

Re: what about forking Boriel’s ZX-Basic Compiler for 6502/N

Post by gauauu »

slobu wrote: Yet another option is to study the source code for batari BASIC. It works by using canned graphic engines in conjunction with converting BASIC into 6502 assembly:
http://bataribasic.com/download.html
That's what I came to say. A lot of people have success with that in Atari development. With the canned display kernels, it's not fully flexible, but also avoids having to worry about timing-critical code. I could see something like that working well for nes -- you provide standard libraries for handing nametable updates, etc, and let basic handle the simple parts of game logic.
Post Reply