Jump to content
IGNORED

Colecovision BASIC compiler: CVBasic v0.1.0


nanochess

Recommended Posts

7 hours ago, ZippyOasys said:

Will there be plans for importing .VGMs in the future?

I'll consider it. Thanks for bringing it to my attention.

 

The VGM file format is a music format where instead of notes, it logs the commands sent to the audio chip.

 

This means it isn't editable, and that you can only use VGM files created for the sound chip you have. For example, a VGM file for AY-3-8910 audio doesn't work for the Colecovision SN76489.

Link to comment
Share on other sites

@nanochess 

Hope you don't mind a few silly questions from one of your Intellivision disciples ;-)

 

- How many variables can be used in this environment? What is the maximum DIM array size?

- How is memory segmented, and which segments can be used?

- Sprites: can we do vertical or horizontal zooms, flipping or mirroring?

- Are there different graphic modes available?

- Do you see the possibility of implementing scrolling support in future releases?

- Could you elaborate on what are the 3 display areas mentioned in connection with the DEFINE command?

From the manual: "Internally, CVBasic will replicate the date along the 3 display areas so the defined characters will appear on the whole screen when required."

- In what circumstances should I consider accessing the VRAM directly?

- When is your CVBasic book coming ;-)

 

Thanks!

Link to comment
Share on other sites

1 hour ago, cmadruga said:

@nanochess 

Hope you don't mind a few silly questions from one of your Intellivision disciples ;-)

 

- How many variables can be used in this environment? What is the maximum DIM array size?

- How is memory segmented, and which segments can be used?

- Sprites: can we do vertical or horizontal zooms, flipping or mirroring?

- Are there different graphic modes available?

- Do you see the possibility of implementing scrolling support in future releases?

- Could you elaborate on what are the 3 display areas mentioned in connection with the DEFINE command?

From the manual: "Internally, CVBasic will replicate the date along the 3 display areas so the defined characters will appear on the whole screen when required."

- In what circumstances should I consider accessing the VRAM directly?

- When is your CVBasic book coming ;-)

 

Thanks!

1. I don't have yet made the memory usage calculator. 8-bit variables use 1 byte, 16-bit variables use 2 bytes, and arrays use the width multiplied by the length. The maximum memory usage is around 960 bytes.

2. There is no segmentation of the memory yet, you can write a game up to 32K in size without worrying about segments. In the future, I expect to put bank-switching support, and there will be two 16 KB pages (one fixed, and another switchable)

3. There is no flipping or mirroring for the sprites. There is a zoom but it is for all the sprites, currently, there is no way to use it.

4. No graphic mode switching yet. Currently, you can consider the screen as a 32x24 grid with 256 characters where every character can be defined.

5. A difficult matter, but I expect to allow some support for tile scrolling.

6. The video mode set up by CVBasic is the highest-resolution video mode. In this mode the 32x24 screen grid addresses three areas, depending on the row (0-7, 8-15, 16-23), so DEFINE CHAR and DEFINE COLOR replicates the character definition in the three VRAM areas; otherwise, your character would be visible, for example, only on the top rows.

7. Only to VPOKE/VPEEK the 32x24 screen grid with the character numbers you want to see displayed. Forgot it: You can use PRINT AT instead of VPOKE.

8. Hahaha, good point!

 

 

  • Like 3
  • Thanks 1
Link to comment
Share on other sites

4 minutes ago, drfloyd said:

i try to run CVBASIC.EXE but it does not work.... (Windows 10)

 

Nothing happened

You need to open a cmd window and run the command as shown in the instructions included in the zip.  You also have to download the assembler per the instructions.  If you follow the instructions it should work.

 

Usage:
  
  cvbasic in.bas output.asm

The following modules are automatically included as prologue and epilogue of your generated code and these set important variables and helper code:

  cvbasic_prologue.asm
  cvbasic_epilogue.asm

Afterwards you should assemble your program using tniASM v0.45 available from http://www.tni.nl/products/tniasm.html

  tniasm output.asm

And finally you can test the generated game.rom file using CoolCV, blueMSX, openMSX, or a Flash cartridge for real hardware.
 

  • Thanks 1
Link to comment
Share on other sites

31 minutes ago, drfloyd said:

i try to run CVBASIC.EXE but it does not work.... (Windows 10)

 

Nothing happened

CVBasic is just a compiler that will compile a Basic language file (*.bas) that was created with an Editor such as Notepad into an Assembly listing (*.asm) which can then be assembled into ColecoVision cartridge format using tniASM that can then be used in emulators or a real CV / ADAM.

 

  • Thanks 1
Link to comment
Share on other sites

@nanochess  :  Just an idea , but i guess you have already think about it  , it would be great when your basic is done for coleco , that your compiler be able to generate binary for SG1000 and why not also MSX , Spectravideo SV318 , MTX ...

  • Like 1
Link to comment
Share on other sites

2 minutes ago, youki said:

@nanochess  :  Just an idea , but i guess you have already think about it  , it would be great when your basic is done for coleco , that your compiler be able to generate binary for SG1000 and why not also MSX , Spectravideo SV318 , MTX ...

 

You're probably looking for ugBASIC https://ugbasic.iwashere.eu/

 

Personally, I'd love a dedicated BASIC compiler for the Coleco.  Who better than nanochess to expose cool hardware features?

  • Like 3
Link to comment
Share on other sites

Yeah, both Ug and Boriel should already generate at least MSX binaries, not sure about SG-1000 and the others. This one seems tailored towards the ColecoVision, though I admit that the CV hardware wise is far more alike other systems than its competitors (Atari, Intellivision, Vectrex) at the time.

  • Like 1
Link to comment
Share on other sites

On 3/2/2024 at 2:08 PM, cmadruga said:

@nanochess 

Hope you don't mind a few silly questions from one of your Intellivision disciples ;-)

 

- How many variables can be used in this environment? What is the maximum DIM array size?

- How is memory segmented, and which segments can be used?

- Sprites: can we do vertical or horizontal zooms, flipping or mirroring?

- Are there different graphic modes available?

- Do you see the possibility of implementing scrolling support in future releases?

- Could you elaborate on what are the 3 display areas mentioned in connection with the DEFINE command?

From the manual: "Internally, CVBasic will replicate the date along the 3 display areas so the defined characters will appear on the whole screen when required."

- In what circumstances should I consider accessing the VRAM directly?

- When is your CVBasic book coming ;-)

 

Thanks!

Hope you don't mind me answering some tech question nanochess.

1. There's 1024 bytes of RAM, I think maybe 700 bytes of variable for users. 


2. There's 0x8000-0xFFFF for cart, 0x7xxx for RAM.  It can't use VRAM memory, however you can upload and retrieve data from it, but slower doing that.


3. The video hardware don't do hardware flips, yet Atari, Intellivision, nes, etc could. There's BIOS command, but I have no idea how it invoke that. Zoom affect all sprites, 2 type of zoom. There's also 8x8 16x16 mode, only 4 on a line, even in 8x8 mode! You have 64 sprite pattern in 16x16 mode, 256 sprites pattern in 8x8 mode.  There's a max of 32 sprites single color on screen.  And only feature is the early clock mode to move the sprite 32 pixel to the left. Useful to pan your sprite off the screen smoothly to the left instead of disappearing and warping to the right side.


4. There's several graphic mode, one for low color which has 32 1 fg/bg color per 8 8x8 pattern. The other the undocument graphic mode that has 2 color per 1 row, until 2048.  The one rarely use is the multicolor mode, only 64x48 dots on screen. There's mode you can use one tileset, one colorset. Or bitmap mode which uses 3 tileset, 3 colorset, which takes up 12KB of VRAM.  Usually I work in 3 tileset, one colorset for my project. There's a mirroring bug on real hardware if you use sprite number 9-32 if you use undocumented screenmode 2 with 1 tileset 1 colorset mode.  There's text mode, which uses 40 column by 24 row. There's no sprite or color table in this mode since the display is maxed out at 320, which sprite can't be use, and color comes from the video register.


5. Scrolling is tough since it takes about 2-3 screen time to fill up the screen with tiles. I used double buffer name table to hide the tile update for Vanguard and Sparrow goes Flapping.


6.The screen is split up into 3 segment.


7. You can access the VRAM at anytime, however, you have to do the update before nmi occur, which when the screen finish drawing.  I recommend doing small graphic update right after WAIT to update the sprite attribute(to avoid screen tearing), score, DMA sprites, and etc.


8. I looked through his window to check, but he threw an axe at me.  How rude. 😛

Edited by Kiwi
  • Thanks 1
Link to comment
Share on other sites

4 minutes ago, Gemintronic said:

Just donated yesterday.  Thank you @nanochess! :)

 

Has anyone got the tniasm compiler link to work?

Thank you very much!

 

The compiler has also reached 100 downloads! It is a lot for a compiler that barely has one week published.

 

I think the version 0.2.0 is ready to get out of the oven and now includes my own assembler. I hope to publish it soon.

  • Like 1
Link to comment
Share on other sites

1 hour ago, nanochess said:

Thank you very much!

 

The compiler has also reached 100 downloads! It is a lot for a compiler that barely has one week published.

 

I think the version 0.2.0 is ready to get out of the oven and now includes my own assembler. I hope to publish it soon.

I just released the version 0.2.0.

 

It is available here (moving to Colecovision Programming forum):

 

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

  • 1 month later...
  • 4 weeks later...

Just got my copy of your book. I can't be more excited!

 

I'm running into an error on the first program test. Using a Mac and terminal I was able to install all the parts easily. Then entering the "hello world" program using TextEdit (in plain text mode) and saving as hello.bas, when I run through cvbasic to create the .asm file I get this error:

 

ERROR: Extra characters at line 1 (hello.bas)
0 RAM bytes used of 814 bytes available.
Compilation finished.

 

It does make a .asm file but when I convert that to a ROM and run it I just get a 0 (zero) displayed.

 

I've double checked the code:

PRINT AT 0, ”Hello Gametrog”
WHILE 1: WEND

 

and it appears fine. And I tried a different code program thinking TextEdit may be adding something, but get the same results.

 

I'm sure I'm missing something simple and tried not to reach out so soon, but here I am.

(note: the last stuff I programed was BASIC on my ADAM 30 years ago...)

 

Thanks!

Erik

  • Thanks 1
Link to comment
Share on other sites

3 hours ago, Gametrog said:

Just got my copy of your book. I can't be more excited!

 

I'm running into an error on the first program test. Using a Mac and terminal I was able to install all the parts easily. Then entering the "hello world" program using TextEdit (in plain text mode) and saving as hello.bas, when I run through cvbasic to create the .asm file I get this error:

 

ERROR: Extra characters at line 1 (hello.bas)
0 RAM bytes used of 814 bytes available.
Compilation finished.

 

It does make a .asm file but when I convert that to a ROM and run it I just get a 0 (zero) displayed.

 

I've double checked the code:

PRINT AT 0, ”Hello Gametrog”
WHILE 1: WEND

 

and it appears fine. And I tried a different code program thinking TextEdit may be adding something, but get the same results.

 

I'm sure I'm missing something simple and tried not to reach out so soon, but here I am.

(note: the last stuff I programed was BASIC on my ADAM 30 years ago...)

 

Thanks!

Erik

Thank you! I'm glad you like the book. About the error in compilation, it is a common error with macOS.

 

By default, TextEdit converts the normal quotes to special opening and closing quotes. In TextEdit / Preferences remove the checkbox for automatic typographic quotes and retype the quotes.

 

  • Like 1
Link to comment
Share on other sites

3 hours ago, nanochess said:

Thank you! I'm glad you like the book. About the error in compilation, it is a common error with macOS.

 

By default, TextEdit converts the normal quotes to special opening and closing quotes. In TextEdit / Preferences remove the checkbox for automatic typographic quotes and retype the quotes.

 

Problem Solved! I appreciate it! You're the man!

Screen Shot 2024-05-26 at 1.30.52 AM.png

  • Thanks 1
Link to comment
Share on other sites

Greetings all!

 

Working on the "Game of Ball" tonight. Just displaying the background currently. I'm getting something odd and just can't seem to figure out what I'm doing wrong. The top and bottom borders are broken up. Middle dashed line appears to be fine. See Attached

ScreenShot2024-06-02at11_58_42PM.thumb.png.61540aaeb638bc3bc71bbdf5debca0a4.png

Please Note: Before reaching out and bothering I did the following:

  • Gone over the code several times, but could still be missing something...
  • Believe my problem is in the PRINT "\129" area
  • Read up on CVBASIC Manual and found the reference (although I don't yet understand it):
    • If you want to use a character beyond the printable ones, you can use the inverted slash as an escape character (by example "\128\129")

Also, if I should be asking questions like this somewhere else just let me know. Thanks in advance. gosh I know this is gonna be something simple I'm just missing...:(

ScreenShot2024-06-03at12_05_31AM.thumb.png.2091cc12d8da1eb345016ecdf9d74492.pngScreenShot2024-06-03at12_05_49AM.thumb.png.3b6ea3801b7b93be958183c35ab1a5b6.pngScreenShot2024-06-03at12_06_03AM.thumb.png.3a842209460d084cea9528776b551675.png

Link to comment
Share on other sites

12 hours ago, Gametrog said:

Greetings all!

 

Working on the "Game of Ball" tonight. Just displaying the background currently. I'm getting something odd and just can't seem to figure out what I'm doing wrong. The top and bottom borders are broken up. Middle dashed line appears to be fine. See Attached

 

Please Note: Before reaching out and bothering I did the following:

  • Gone over the code several times, but could still be missing something...
  • Believe my problem is in the PRINT "\129" area
  • Read up on CVBASIC Manual and found the reference (although I don't yet understand it):
    • If you want to use a character beyond the printable ones, you can use the inverted slash as an escape character (by example "\128\129")

Also, if I should be asking questions like this somewhere else just let me know. Thanks in advance. gosh I know this is gonna be something simple I'm just missing...:(

 

 

I see the bug, when you refer game_colors the statement says DEFINE CHAR instead of DEFINE COLOR.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...