Jump to content
IGNORED

7800basic beta, the release thread


RevEng

Recommended Posts

Fine vertical scrolling is in the works. I'll be implenting it in the traditional way, as Mord did. I just need to overhaul the interrupt routines to support this, without breaking anything the process.

 

Allowing character maps that can plot at any Y means that maria needs to do twice as much character dma. This would mean your 160a mode screen would only be able to display 1 or 2 sprites in a zone. Other, more dma intensive modes wouldn't work at all. Doesn't seem worth the effort.

  • Like 1
Link to comment
Share on other sites

  • 3 weeks later...

I've just fixed a graphical issue in my game when going from the title screen to the main game. I use double buffering and as part of my 'topscreenroutine' I check against a flag that says which background / mode to use and I was finding that when changing this flag I'd get a flash of a corrupted screen which some of the characters drawn with white even if my palettes are all reset to black. The confusing thing to me was that I was getting the correct 'in-game' background but the corrupt graphics were from the titlescreen even though I changed modes after clearing the screen and plotting the in-game screen.

I found out that I needed to clear the screen, flip the buffer, then clear the screen again to empty both buffers and prevent the dodgy frame from showing.

Is this intentional or should clearscreen clear both buffers?

 

Edit: I'm guessing it's intentional, or at least only a problem because of the way I'm doing things. I've doubled up my initial drawing so that it clears and plots to each buffer in one go so there's not a single frame missing when switching between modes.

post-27819-0-74709800-1514836657_thumb.png

Edited by SmittyB
Link to comment
Share on other sites

  • 4 months later...

Hi All,

 

Can anyone help?

 

Hopefully I'm just being dense with this but I'm trying to get 7800basic working so I can have a play with 7800 development but I'm struggling to get the example code to compile

 

I've copied the 7800basic directory to by harddisk, I've run the install_win.bat file (which showed success) and I copied the helloworld bas and gfx files to the root directory to test compilation

 

After running 7800bas helloworld.bas I get the following:

 

7800basic 0.6 Jul 12 2017 22:46:35
*** (): INFO, GFX Block #0 starts @ $E000
atascii
*** (): INFO, GFX block #0 has 1064 bytes left (133 x 8 bytes)
7800basic compilation complete.
User-defined 7800.asm found in current directory
'7800filter' is not recognized as an internal or external command,
operable program or batch file.
After that I get a helloworld.bas.asm file but no other files are produced
I'm sure that I'm doing something stupid I'm just not sure what!!
I tried searching the forums but found nothing about this particular issue
Can anyone help?
For reference I'm using v0.6 of 7800basic
Link to comment
Share on other sites

I've hit a bit of a stumbling block, and I'm trying to come up with a good way to resolve it.

 

The project I'm working on requires that I generate 28 random numbers that are not only unique but also have to fall with a range of 0-223. (Actually, now that I think of it, I might need to reduce it to 0 to 208, but still...the logic would be the same.)

 

I've tried several different things. First off, I've found a pretty sane way to seed the random number generator so that it's not the same exact numbers every time.

 

1) I was able to use nested for/next loops to make sure that the numbers are unique.

 

2) I was able to use nested for/next loops to make sure that the numbers are less than the high end of the range.

 

Problem is...I can't figure out how to do (1) and (2).

 

Any 7800basic programmers fallen into the same situation?? How did you solve it??

Link to comment
Share on other sites

For your #2 desire, I'm not sure how you'd accomplish that with loops alone. The usual method is to take a user-influenced value (ie. time on title screen, before user started the game). The easiest way to do that is just stick something like "temp1=rand" into your title loop. You can also stick a "frame counter" value into rand directly, if you make sure it's not equal to 0 first.

 

On #1... if your desired range is a power of 2 (2,4,8,16,...) then that's usually accomplished by masking or dividing the returned random value. Since that's not the case here, the way to get random numbers in your range is to throw away ones that don't meet the criteria.

 

get208rand
 temp1=rand
 if temp1>209 then get208rand
 temp1=temp1-1: rem change 1-209 to 0-208

The above type routine doesn't loop too badly so long as the values you're looking for aren't very rare. For smaller random ranges, you should divide or mask the random value first, to get it closer to your desired range.

 

get28rand
 temp1=rand&31 : rem random between 0 and 31. we can do this because 32=power of two
 if temp1>28 then get28rand
Link to comment
Share on other sites

Fine vertical scrolling is in the works. I'll be implenting it in the traditional way, as Mord did. I just need to overhaul the interrupt routines to support this, without breaking anything the process.

 

Allowing character maps that can plot at any Y means that maria needs to do twice as much character dma. This would mean your 160a mode screen would only be able to display 1 or 2 sprites in a zone. Other, more dma intensive modes wouldn't work at all. Doesn't seem worth the effort.

 

Oh, just thought of something. When the vertical scrolling goes live, or even before :ponder:, would it be possible to adjust plotmapfile so it can display a portion of a larger map the same way plotmap does? Been thinking of trying to write an assembly program to do that myself but I'm having a hard time figuring out how the mapfile is stored in the rom.

Link to comment
Share on other sites

I've hit a bit of a stumbling block, and I'm trying to come up with a good way to resolve it.

 

The project I'm working on requires that I generate 28 random numbers that are not only unique but also have to fall with a range of 0-223. (Actually, now that I think of it, I might need to reduce it to 0 to 208, but still...the logic would be the same.)

 

I've tried several different things. First off, I've found a pretty sane way to seed the random number generator so that it's not the same exact numbers every time.

 

1) I was able to use nested for/next loops to make sure that the numbers are unique.

 

2) I was able to use nested for/next loops to make sure that the numbers are less than the high end of the range.

 

Problem is...I can't figure out how to do (1) and (2).

 

Any 7800basic programmers fallen into the same situation?? How did you solve it??

 

I'd have to actually try to use for loops I think. I use to have horrible luck with getting them to work in the earlier days (likely due to my own stupidity!) and at some point I ended up just writing my own conditional loops that pretended to be a for loop.

 

Anyway, I doubt I'd use a for loop in what you're talking about.

 

Instead I'd probably:

 

-1. Define an array for holding the 28 values you want, so they're next to each other.

0. Define and set an index to 0.

1. generate a number randomly.

2. Do a test comparison. If it's over 208, do some calculations to adjust it and test again. (Even subtracting the amount over 208 would at least make sure it's under 208)

3. Compare that value to all the values you've already placed in your array to make sure it's unique. If not, go back to 1.

4. If it's a unique value from 0-208, place it in the first unused slot of the array. (perhaps fill the array with 255's to indicate unused slots.)

5. Test the loop to see if all values are filled. If so the loop is done.

 

If you're concerned about spending too much time in one frame setting up these values, you can add an extra loop terminating check to make sure it won't go over a certain number runs through the loop without terminating. However if you do that you'll need to make sure the program knows it'll need to go back into this loop on the next frame to continue. (perhaps have it's own little gameloop that doesn't technically end but will handle the clearscreen/drawscreen stuff?)

 

It's important to note however that my coding style makes others screen in terror. :)

Link to comment
Share on other sites

Oh, just thought of something. When the vertical scrolling goes live, or even before :ponder:, would it be possible to adjust plotmapfile so it can display a portion of a larger map the same way plotmap does? Been thinking of trying to write an assembly program to do that myself but I'm having a hard time figuring out how the mapfile is stored in the rom.

The map character contents are just stored linearly, but I think you mean the DL structure, which is complicated.

 

plotmapfile has a DL structure that depends on your image. 7800basic tries to minimize the number of DL entries, so you'll have a variable number of them depending on what color indexes your map data references.

 

00000000000000000000 <= creates 1 DL object, referencing palette 0
00000000111100000000 <= creates 3 DL objects, referencing palettes 0,1, and 0
00000111000022200000 <= creates 5 DL objects, referencing palettes 0,1,0,2,0

Because all sorts of DL entries would need to be changed/removed/added if the window changes horizontally, I don't think plotmapfile is ever going to be compatible with coarse horizontal positioning and tiles using different palettes.

 

But you asked for vertical, which should be doable. When I get a chance I'll look into it.

  • Like 1
Link to comment
Share on other sites

Ok dumb question of the day ....

I compiled the helloworld.bas example and wanted to test the boundaries of it so I added another bank (and suitable romsize options) and in the second bank added another line of text but that appears garbled when displayed. Sure this is a simple question but can anyone help please?

helloworld.bas

Edited by TidusRenegade
Link to comment
Share on other sites

Bank switching is something I still have to learn but it looks to me like the text graphics are in the first bank but you're swapping over to the second bank and not swapping back, so it will display whatever is in the corresponding location in bank 2s accessible graphics area. If you swap back to the first bank during the visible part of the frame you should see what you're expecting, or you can import the graphics into both banks.

 

Just to clarify I haven't had a chance to compile it and see what it does so I might be misunderstanding the problem.

Edited by SmittyB
  • Like 2
Link to comment
Share on other sites

I do know that "incbanner" graphics you need to place those in the local bank rather than in the last one. I'm not sure about placing "incbanner" graphics in the first bank for images called upon later in other banks. It's one of those caveats you need to remember since "incgraphics" can be placed in the last bank but called up in other banks.

Link to comment
Share on other sites

I've had a brief chance to compile the code and see what's happening. I too am unsure what's going on. I don't think it's to do with the bank selection because the text still looks like text, just isn't the right set of characters.

I did check the assembly and it looks fine to me. Maybe try setting the ATASCII character set in bank 2 too. I haven't had a chance to see if that would work.

Edited by SmittyB
Link to comment
Share on other sites

 

Instead I'd probably:

 

-1. Define an array for holding the 28 values you want, so they're next to each other.

0. Define and set an index to 0.

1. generate a number randomly.

2. Do a test comparison. If it's over 208, do some calculations to adjust it and test again. (Even subtracting the amount over 208 would at least make sure it's under 208)

3. Compare that value to all the values you've already placed in your array to make sure it's unique. If not, go back to 1.

4. If it's a unique value from 0-208, place it in the first unused slot of the array. (perhaps fill the array with 255's to indicate unused slots.)

5. Test the loop to see if all values are filled. If so the loop is done.

 

I did pretty much this -- and it seems to work really well! Here's what I did:

get28randoms
	seedcount = seedcount +1
	if seedcount > 64 then seedcount = seedcount - 50
	line[zzz] = pickRandom208(seedcount)
	qqq = zzz-1
	for x=0 to qqq	; iterate through previous numbers and check for dupes
		if zzz>0 && line[zzz]=line[x] then goto get28randoms ; dupe? Get another number.
	next
	zzz = zzz +1
	if zzz < 28 then goto get28randoms	
	clearscreen
	function pickRandom208
		rand = temp1
		yyy = rand
		if yyy > 207 then seedcount = seedcount+1:yyy = pickRandom208(seedcount)
		return yyy

And yeah, I know qqq and zzz are terrible variable names; I'm just trying to get a proof of concept off the ground right now. :)

 

I do have some seeding action going on outside of the loop, and I'm finding I'm getting different sets of numbers every time I run the WIP, thankfully!

 

Now on to the next thing: sorting the numbers. Ughhgh...not looking forward to that. Might have to resort to a bubble sort. Slow, but it's only 28 numbers.

Link to comment
Share on other sites

I compiled the helloworld.bas example and wanted to test the boundaries of it so I added another bank (and suitable romsize options) and in the second bank added another line of text but that appears garbled when displayed. Sure this is a simple question but can anyone help please?

Some groundwork...

 

1. When you switch banks, everything in the old bank disappears from view of the CPU and Maria. (except the last bank, and in some schemes the first bank)

2. Maria's character objects reference some bit of memory (ROM or RAM) as character "string" data.

3. When called with a quoted string of characters, plottext creates ROM data in the same bank from which it was called.

 

..in this case, you've banked away from the character string data, which is why you get incorrect data by the time Maria starts displaying the objects.

 

You need to observe the same requirements for your own data statements too. If you bank away from data and try to read it, you'll just read data in the same ROM position, but from the wrong bank.

  • Like 3
Link to comment
Share on other sites

  • 3 weeks later...

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...