haroldo-ok / batari-basic-js

Compiles Batari Basic source files from a JS environment.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Welcome to batari-basic πŸ‘‹

Version Documentation Maintenance License: GPL--3.0 Twitter: Haroldo0k

Compiles Batari Basic source files from a JS environment.

🏠 Homepage

Install

npm install batari-basic

Usage

const bBasic = require('batari-basic');
const fs = require('fs');

const HELLO_WORLD = `
 rem Hello World

 playfield:
................................
......X.X.XXX.X...X...XXX.......
......X.X.X...X...X...X.X.......
......XXX.XX..X...X...X.X.......
......X.X.X...X...X...X.X.......
......X.X.XXX.XXX.XXX.XXX.......
................................
.....X...X.XXX.XX..X...XX.......
.....X...X.X.X.X.X.X...X.X......
.....X.X.X.X.X.XX..X...X.X......
.....XX.XX.XXX.X.X.XXX.XX.......
end

 COLUPF = 22
 COLUBK = 2

mainloop
 drawscreen
 score = score + 1
 goto mainloop
`;

const binaries = bBasic(HELLO_WORLD);
fs.writeFileSync('example.bin', Buffer.from(binaries.output));

The bBasic(code) function receives, as a parameter, a string containing the source code to compile, and returns an object three keys:

  • output is the compiled Atari 2600 ROM, as a Uint8Array containing its bytes.
  • listings is an string containing the generated ASM listings;
  • symbolmap is an string mapping addresses to symbols, often used by debugging emulators.

Run tests

npm run test

Author

πŸ‘€ Haroldo O. Pinheiro

🀝 Contributing

Contributions, issues and feature requests are welcome!
Feel free to check issues page. You can also take a look at the contributing guide.

Show your support

Give a ⭐️ if this project helped you!

πŸ“ License

Copyright Β© 2021 Haroldo O. Pinheiro.
This project is GPL--3.0 licensed.


This README was generated with ❀️ by readme-md-generator

About

Compiles Batari Basic source files from a JS environment.

License:GNU General Public License v3.0


Languages

Language:JavaScript 100.0%