Jump to content
IGNORED

Colecovision recharged BASIC compiler: CVBasic v0.4.0 (now with compression and MSX support!)


Recommended Posts

41 minutes ago, slydc said:

A new update of CVbasic ? You're the man Oscar! ;) And the animation of Jess, really great! ;)

 

Well i have done a small slideshow of 5 pictures and this is the second version as the first one there was a different color screen in between the pictures but now that's corrected.

It's not much but it's a start, hope some of you will like it. :)

 

 

slideshow02.rom 16.31 kB · 1 download

Cool! 8)

 

Link to comment
Share on other sites

12 hours ago, nanochess said:

Use this code for cleaning parts of the screen:

FOR #c = $1800 + 128 TO $1800 + 191
	VPOKE #c,32
NEXT #c

 

I used separated constants so you can see the starting and ending positions on the screen. And yep, it will save you a lot of bytes!

 

Thank you, that what I was looking for!

 

4 hours ago, Jess Ragan said:

TMScolor is a real time saver, I'll tell you h'what.

 

So! I just made a thing. It's not a game, but there's animation, so that's a step in the right direction. The ROM should run in anything that can play ColecoVision games. (Also, phew. Even with TMScolor, this took some time.)

antiqueovision.rom 3.16 kB · 4 downloads

 

54 minutes ago, slydc said:

A new update of CVbasic ? You're the man Oscar! ;) And the animation of Jess, really great! ;)

 

Well i have done a small slideshow of 5 pictures and this is the second version as the first one there was a different color screen in between the pictures but now that's corrected.

It's not much but it's a start, hope some of you will like it. :)

 

 

slideshow02.rom 16.31 kB · 3 downloads

Can you share the sources? Always nice to see other example that the one from nanochess.

Link to comment
Share on other sites

I want to do something like this:

	level = 1
	#pointer = #level_pointers(level)
	RESTORE #pointer
	READ BYTE size
	PRINT AT 0, size
STOP: GOTO STOP

level_pointers:
	DATA VARPTR #level1, VARPTR #level2
level1:
	DATA BYTE 4,0,1,2,3
level2:
	DATA BYTE 3,0,1,2

When compiling this, I get a warning variable #POINTER being assigned but never used. Looking at the generated assembly code, RESTORE treats the variable the same as a label.

 

Of course I can work around this by just using a lot of IF-statements, but to create more complex data structures it would be really useful to be able to use the contents of a variable to RESTORE from.

Link to comment
Share on other sites

I'm doing my first (very basic) tests with CVbasic for Sega SG-1000, it works fine with emulator but i found an issue when using the rom code on a real hardware: the "wait" command (i think translated with HALT cpu code) hangs the console and freeze.

I don't know if is it a bug or i missed something....   

  • Confused 1
Link to comment
Share on other sites

2 hours ago, aotta said:

I'm doing my first (very basic) tests with CVbasic for Sega SG-1000, it works fine with emulator but i found an issue when using the rom code on a real hardware: the "wait" command (i think translated with HALT cpu code) hangs the console and freeze.

I don't know if is it a bug or i missed something....   

I think I've a bug, I missed a IM 1 instruction at the START: label in cvbasic_prologue.asm.

 

Please test this: (just replace the file)

 

cvbasic_prologue.asm

Link to comment
Share on other sites

(shrugs) Sure, here you go. Do note that I'm going to be stingier with my code when it starts resembling a game, though.

 

So, as a hypothetical. Can I define graphics in a title screen (preferably written as an external program), then re-define them for the content of a game later? A title screen could be more elaborate if I could dedicate all of the ColecoVision's VRAM to it.

antiqueovision.bas bellafonte.bas

  • Like 1
Link to comment
Share on other sites

13 hours ago, Révo said:

Thank you, that what I was looking for!

 

 

Can you share the sources? Always nice to see other example that the one from nanochess.

No problem! Completely forgot to include the BAS file.

slideshow02.bas

  • Like 1
Link to comment
Share on other sites

3 minutes ago, Jess Ragan said:

(shrugs) Sure, here you go. Do note that I'm going to be stingier with my code when it starts resembling a game, though.

 

So, as a hypothetical. Can I define graphics in a title screen (preferably written as an external program), then re-define them for the content of a game later? A title screen could be more elaborate if I could dedicate all of the ColecoVision's VRAM to it.

antiqueovision.bas 8.6 kB · 0 downloads bellafonte.bas 12.78 kB · 0 downloads

Yes, you can do it.

 

When you need to reset the graphics context you only need to do MODE 0

 

Link to comment
Share on other sites

image.png.db7d378095becd4c0d652a33e81a0733.png

Okay, now we're humming along! (Keeping the source code private for this one.) I had a lot of fun building this title screen, but there's a lot of graphic data here, and I felt like I was starting to fly too close to the sun. When I used the latter VRAM addresses (220 and up), weird things happened, and all the color data was ignored for straight black and white images. Should that concern me? I thought I had the full range of those 256 characters.

 

I'm getting unreasonably excited about this, though. Even before the text has been added, this title screen kicks the asses of about 80% of ColecoVision title screens. Somehow "NINTENDO PRESENTS DONKEY KONG" in Space Invaders letters doesn't cut it for me. I was spoiled on the more elaborate title screens of NES games, and that's the feeling I hope to evoke here.

 

Also, I need to learn how to properly use the INCLUDE command. It'd be nice to address another program for data, rather than having it all dumped in the main code. It's more modular that way. I can come back and re-use that code for later games, should they happen.

byron_title.rom

  • Like 3
Link to comment
Share on other sites

I just noticed that cvbasic_prologue.asm could be optimized to save 140 bytes (and a few more in SG1000), and also accelerated LDIRVM (so mode setup and graphic loading will look faster now, Pletter stays the same).

 

Finally, in cvbasic_epilogue.asm the LFSR wasn't being advanced in each video frame like in IntyBASIC, so I made it to get programmers more randomness.

 

Updated as v0.4.4, I was lazy so I didn't recompile the binaries, CVBasic still says v0.4.3

 

  • Like 2
Link to comment
Share on other sites

I know i'd learn how to use the VRAM tables, but it's first time i'm programming a Sega console (thanks to CVBasic) and i'm lost in trying to highligth (change color reversing it) a text line in mode 0...

Is it possible to have a "PRINT AT nn COLOR" like in Intybasic, or something similar? I'm getting crazy VPOKing around $2000 with no success 😅

 

And, just as note, CONT commands don't work on SEGA SC-3000 (may be because he use keyboard key to duplicate joystick command, so use some different coding?) 

Edited by aotta
typo
Link to comment
Share on other sites

8 hours ago, aotta said:

I know i'd learn how to use the VRAM tables, but it's first time i'm programming a Sega console (thanks to CVBasic) and i'm lost in trying to highligth (change color reversing it) a text line in mode 0...

Is it possible to have a "PRINT AT nn COLOR" like in Intybasic, or something similar? I'm getting crazy VPOKing around $2000 with no success 😅

 

And, just as note, CONT commands don't work on SEGA SC-3000 (may be because he use keyboard key to duplicate joystick command, so use some different coding?) 

To reverse the whole alphabet (uppercase A-Z) you would use something like:

FOR #c = $2000 + $41 * 8 TO $2007 + $5A * 8
    VPOKE #c, $0f
NEXT #c

 

This is for rows 0-7, for rows 8-15 change $2000 and $2007 to $2800 and $2807, and for rows 16/23 change $2000 and $2007 to $3000 and $3007 respectively.

 

Notice the $41 is the ASCII code for letter A, and $5a is the ASCII code for letter Z.

 

For SC-3000 this Sega computer has a port to select the joysticks because it has a keyboard, I'll try to put a initialization code at the start once I remember how to select the joystick.

 

Link to comment
Share on other sites

Thank you @nanochess, now it's clear to me that vpoking at $2xxx addresses change the whole character color, not the color of character at screen "+X" position! So, i suppose that for having a single word hilighted within a text, i had to define a second char set and use it when needed, right? maybe i'll have to NOT the charset in different position as you ORred the char for bolding font in your example.

 

About SC-3000 joystick, you're right again: i made a rough patch adding this code before using "count1":

  c=cont1
  while c=0
	wait 
	asm di
	asm ld a,$92
	asm out ($df),a 
	asm ld a,7
	asm out ($de),a
	asm in a,($dc)
	asm ld ($a000),a
	asm in a,($dd)
	asm ld ($a001),a 
	asm ld a,$92
	asm out ($df),a 
	c=cont1  
	print at 32*23+20,c 
 WEND

Strangely, it works with keys "1,Q,A,Z,"Jap" and "," (the Row 0 in keyboard matrix) even i set 7 (the joystick row) in $de command as suggested in SC-3000 manual. But for sure i missed something, i'll continue testing.

Thank you again for your work and your support!

Link to comment
Share on other sites

9 hours ago, aotta said:

Thank you @nanochess, now it's clear to me that vpoking at $2xxx addresses change the whole character color, not the color of character at screen "+X" position! So, i suppose that for having a single word hilighted within a text, i had to define a second char set and use it when needed, right? maybe i'll have to NOT the charset in different position as you ORred the char for bolding font in your example.

 

About SC-3000 joystick, you're right again: i made a rough patch adding this code before using "count1":

  c=cont1
  while c=0
	wait 
	asm di
	asm ld a,$92
	asm out ($df),a 
	asm ld a,7
	asm out ($de),a
	asm in a,($dc)
	asm ld ($a000),a
	asm in a,($dd)
	asm ld ($a001),a 
	asm ld a,$92
	asm out ($df),a 
	c=cont1  
	print at 32*23+20,c 
 WEND

Strangely, it works with keys "1,Q,A,Z,"Jap" and "," (the Row 0 in keyboard matrix) even i set 7 (the joystick row) in $de command as suggested in SC-3000 manual. But for sure i missed something, i'll continue testing.

Thank you again for your work and your support!

I just read the available hardware information on Sega SC-3000.

 

You were almost right.

 

Remove your ASM code, and at the start of your program use this:

 

	ASM LD A,$92
	ASM OUT ($DF),A
	ASM LD A,$07
	ASM OUT ($DE),A

 

This is because in the 8255 each time you set the mode (port $DF) all latches are reset, so you always end with row 0. After setting mode, I only set the line register (port $DE), and everything should work just right.

 

Please test and if it works, I'll add this code snippet to future cvbasic_prologue.asm files for SG-1000 mode.

 

 

Link to comment
Share on other sites

19 minutes ago, nanochess said:

.....

Please test and if it works, I'll add this code snippet to future cvbasic_prologue.asm files for SG-1000 mode.

 

Ca va sans dire.... it works!! Thank you as always!

  • Thanks 1
Link to comment
Share on other sites

1 hour ago, aotta said:

Ca va sans dire.... it works!! Thank you as always!

Thank you also! I'll include this patch in future versions of CVBasic so it is compatible with Sega SC-3000.

 

  • Like 1
Link to comment
Share on other sites

In the cv basic code, is there any way to code something that resembles a timer, like counting frame iterations?   Also, in another thread if I'm not mistaken, someone made mention of collision detection which is native to the bios.   Is there a better way than using the players x,y coordinates vs sprite x,y coordinates?    Last one, if one were to program something like a donkey kong clone, what would you think would be the best way to give points when the player jumps over the sprite??

 

Aside from the questions, I've been having a whole lot of fun experimenting with CVBasic and am working steadily towards a making a game :)   Thanks for this!

Link to comment
Share on other sites

6 hours ago, OriginalJohn said:

In the cv basic code, is there any way to code something that resembles a timer, like counting frame iterations?   Also, in another thread if I'm not mistaken, someone made mention of collision detection which is native to the bios.   Is there a better way than using the players x,y coordinates vs sprite x,y coordinates?    Last one, if one were to program something like a donkey kong clone, what would you think would be the best way to give points when the player jumps over the sprite??

 

Aside from the questions, I've been having a whole lot of fun experimenting with CVBasic and am working steadily towards a making a game :)   Thanks for this!

 

The FRAME variable is a 16-bit variable that is updated each time a video frame happens.

 

There is no VDP collision support because it is barely useful as it only detects sprite vs sprite collision but cannot distinguish sprites. The better way is doing a comparison of player coordinates against enemy coordinates.

 

A Donkey Kong clone? Maybe you have seen this (soon to be published) but basically it would be enough to determine the current platform of both the player and the sprite, and if the player is jumping, and the sprite is in the same X-coordinate, it has jumped successfully over it and it can score.

 

Link to comment
Share on other sites

12 hours ago, nanochess said:

 

The FRAME variable is a 16-bit variable that is updated each time a video frame happens.

 

There is no VDP collision support because it is barely useful as it only detects sprite vs sprite collision but cannot distinguish sprites. The better way is doing a comparison of player coordinates against enemy coordinates.

 

A Donkey Kong clone? Maybe you have seen this (soon to be published) but basically it would be enough to determine the current platform of both the player and the sprite, and if the player is jumping, and the sprite is in the same X-coordinate, it has jumped successfully over it and it can score.

 

Thanks for the info - it is very helpful! 

  • Like 1
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...