Jump to content

Photo

7800basic beta, the release thread


798 replies to this topic

#751 RevEng OFFLINE  

RevEng

    River Patroller

  • Topic Starter
  • 4,976 posts
  • Bitnik
  • Location:bottom of the stack

Posted Thu Dec 14, 2017 3:57 PM

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.

#752 SmittyB OFFLINE  

SmittyB

    Moonsweeper

  • 278 posts

Posted Mon Jan 1, 2018 2:03 PM

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.

Attached Thumbnails

  • doublebuffer clear screen.png

Edited by SmittyB, Mon Jan 1, 2018 2:09 PM.


#753 TidusRenegade OFFLINE  

TidusRenegade

    Space Invader

  • 35 posts

Posted Sun May 27, 2018 8:08 AM

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


#754 SmittyB OFFLINE  

SmittyB

    Moonsweeper

  • 278 posts

Posted Sun May 27, 2018 8:17 AM

Make sure your antivirus isn't quarantining it. I use Avast and if I don't set it to ignore that file it'll just remove it when I try to compile.

#755 TidusRenegade OFFLINE  

TidusRenegade

    Space Invader

  • 35 posts

Posted Mon May 28, 2018 3:01 PM

Thanks for the response - I use AVG, I disabled it but I still got the same result as above.

 

Is it correct that there isn't a 7800filter.exe file in the 7800basic directory? The only 7800filter.* files are 7800filter.Darwin.x86 and 7800filter.Linux.x86

Have I downloaded the wrong version??



#756 SmittyB OFFLINE  

SmittyB

    Moonsweeper

  • 278 posts

Posted Mon May 28, 2018 3:17 PM

There should be a 7800filter.exe file. You'll need to re-add it and add it as an exception to AVG, then it should work.



#757 TidusRenegade OFFLINE  

TidusRenegade

    Space Invader

  • 35 posts

Posted Mon May 28, 2018 3:21 PM

ah ok thanks, not sure why it disappeared. I'll redownload it



#758 SmittyB OFFLINE  

SmittyB

    Moonsweeper

  • 278 posts

Posted Mon May 28, 2018 3:32 PM

It's very likely AVG removed it without telling you, falsely thinking it was a virus of some kind.



#759 TidusRenegade OFFLINE  

TidusRenegade

    Space Invader

  • 35 posts

Posted Mon May 28, 2018 3:37 PM

Yep, found it in the quarantine, restored it and it now works fine!
Thanks your help

#760 Dauber ONLINE  

Dauber

    Quadrunner

  • 5,651 posts
  • What's for tea, luv?
  • Location:Right by where The Lone Ranger went to high school

Posted Tue May 29, 2018 5:13 AM

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



#761 RevEng OFFLINE  

RevEng

    River Patroller

  • Topic Starter
  • 4,976 posts
  • Bitnik
  • Location:bottom of the stack

Posted Tue May 29, 2018 7:04 AM

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


#762 Mord OFFLINE  

Mord

    River Patroller

  • 2,660 posts
  • Location:Canada

Posted Tue May 29, 2018 10:27 AM

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.



#763 Mord OFFLINE  

Mord

    River Patroller

  • 2,660 posts
  • Location:Canada

Posted Tue May 29, 2018 10:39 AM

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



#764 RevEng OFFLINE  

RevEng

    River Patroller

  • Topic Starter
  • 4,976 posts
  • Bitnik
  • Location:bottom of the stack

Posted Tue May 29, 2018 1:17 PM

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.



#765 TidusRenegade OFFLINE  

TidusRenegade

    Space Invader

  • 35 posts

Posted Wed May 30, 2018 1:05 PM

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?

Attached Files


Edited by TidusRenegade, Wed May 30, 2018 1:06 PM.


#766 SmittyB OFFLINE  

SmittyB

    Moonsweeper

  • 278 posts

Posted Wed May 30, 2018 1:27 PM

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, Wed May 30, 2018 3:26 PM.


#767 frankodragon OFFLINE  

frankodragon

    River Patroller

  • 4,932 posts
  • Tacos are real and delicious.
  • Location:Planet Vastia

Posted Wed May 30, 2018 7:56 PM

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.



#768 SmittyB OFFLINE  

SmittyB

    Moonsweeper

  • 278 posts

Posted Sat Jun 2, 2018 8:20 AM

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, Sat Jun 2, 2018 8:21 AM.


#769 Dauber ONLINE  

Dauber

    Quadrunner

  • 5,651 posts
  • What's for tea, luv?
  • Location:Right by where The Lone Ranger went to high school

Posted Sat Jun 2, 2018 8:52 AM

 

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.



#770 RevEng OFFLINE  

RevEng

    River Patroller

  • Topic Starter
  • 4,976 posts
  • Bitnik
  • Location:bottom of the stack

Posted Sat Jun 2, 2018 9:48 AM

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.

#771 SmittyB OFFLINE  

SmittyB

    Moonsweeper

  • 278 posts

Posted Sat Jun 2, 2018 9:58 AM

Ah.... That makes more sense. I wasn't thinking that the string would be stored in the second bank so going back to the first would cause it to read whatever was at the corresponding location.

#772 TidusRenegade OFFLINE  

TidusRenegade

    Space Invader

  • 35 posts

Posted Sat Jun 2, 2018 12:18 PM

Yep that makes complete sense thanks RevEng and thanks SmittyB for at least making me feel less dumb asking the question!!

Ok time to experiment a bit with 7800 then



#773 SmittyB OFFLINE  

SmittyB

    Moonsweeper

  • 278 posts

Posted Sat Jun 2, 2018 12:35 PM

I look forward to seeing what you do with it.

#774 ultima OFFLINE  

ultima

    Chopper Commander

  • 197 posts
  • Location:Los Angeles,CA USA

Posted Sat Jun 23, 2018 2:15 PM

 I went to the 8-bit.org link to download this and keep getting a network error.



#775 RevEng OFFLINE  

RevEng

    River Patroller

  • Topic Starter
  • 4,976 posts
  • Bitnik
  • Location:bottom of the stack

Posted Sat Jun 23, 2018 3:15 PM

Just tested, and it's working for me. Maybe your anti-virus software is getting in the way?




0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users