Lady Bug

developing/porting a new game or gaming framework? post in here!
User avatar
lovebug
Posts: 415
Joined: Sun Jan 31, 2021 5:07 pm
Location: Magrathea
Contact:

Re: Lady Bug

Post by lovebug »

i was in the process of removing the temporary sprite erase code that just fills the sprite space with black and writing the proper code to redraw the background tiles behind the sprites and I just realised another thing about that image of the original arcade game I posted way back
Image

with the tiles offset like this each sprite only requires 4 or 6 tiles to be drawn, replacing the background and erasing the sprite

but I centered the tiles and now it will require 6 or 9 tiles to be drawn :(

currently im just storing zero's to erase the sprite which is 70 bytes plus code overhead
9 tiles @ 24 bytes would be 216 bytes plus more overhead, it might be too slow ?

I had considered storing the 70 bytes of screen data behind the sprite in a buffer to be redrawn back when a sprite needs to be erased but that introduces other issues when sprites are overlapped and parts of a sprite will get stored as background image making a real mess when its restored

the other thing i thought of is just redrawing the background on 1 side of the sprite thats behind as it moves forward, it seems complex but would be very fast as only 1 column of 2 pixels or 1 to 2 rows of pixels would need to be drawn to erase the edge of the sprite when it moves and only drawing a full background restore if the sprite is removed like when it hits a skull

hmmm

I need to think about this a bit
Image
User avatar
lovebug
Posts: 415
Joined: Sun Jan 31, 2021 5:07 pm
Location: Magrathea
Contact:

Re: Lady Bug

Post by lovebug »

I changed my mind and took a break from the graphics and added the sound code instead, its working fine and ready for any sound effects and music i throw at it
ladybug.ssd
(14.75 KiB) Downloaded 22 times
Image
User avatar
lovebug
Posts: 415
Joined: Sun Jan 31, 2021 5:07 pm
Location: Magrathea
Contact:

Re: Lady Bug

Post by lovebug »

I've noticed that the sound has less bass than the original arcade but also the noise generator sounds different which is strange because the beeb has the same 76489 chip as the arcade game

---- edit ---- oh well

im not sure if it sounds different on a real beeb compared to beebem ?
Image
User avatar
lurkio
Posts: 3665
Joined: Wed Apr 10, 2013 12:30 am
Location: Doomawangara
Contact:

Re: Lady Bug

Post by lurkio »

lovebug wrote:
Tue Apr 20, 2021 10:13 pm
I've noticed that the sound has less bass than the original arcade but also the noise generator sounds different which is strange because the beeb has the same 76489 chip as the arcade game ... ---- edit ---- oh well ... im not sure if it sounds different on a real beeb compared to beebem ?
Yes, it sounds very different, and wrong, on a real Model B: very tinny, and each note seems to be cut very short. Not right at all. Ran on a Model B with Turbo MMC (having disabled all other filesystem ROMs and other unnecessary ROMs). The recording isn't great because it was made with just my old iPhone sat near the Beeb speaker grille:

New Recording 14.m4a.zip
(57.86 KiB) Downloaded 14 times

:?:
User avatar
lovebug
Posts: 415
Joined: Sun Jan 31, 2021 5:07 pm
Location: Magrathea
Contact:

Re: Lady Bug

Post by lovebug »

thanks lurkio for the effort, sadly I couldnt quite make out anything on the recording even after amplification
Image
User avatar
lurkio
Posts: 3665
Joined: Wed Apr 10, 2013 12:30 am
Location: Doomawangara
Contact:

Re: Lady Bug

Post by lurkio »

lovebug wrote:
Wed Apr 21, 2021 3:25 pm
thanks lurkio for the effort, sadly I couldnt quite make out anything on the recording even after amplification
The faint beeping noises *are* the sounds that the real Beeb is producing!

EDIT: Here's a quick video of it on a real Beeb: https://youtu.be/mgQRVa8758o

Another curiosity is that when I boot the .SSD in b-em, there's no sound at all!

:!:
User avatar
lovebug
Posts: 415
Joined: Sun Jan 31, 2021 5:07 pm
Location: Magrathea
Contact:

Re: Lady Bug

Post by lovebug »

thanks again

yeah that sounds totally messed up and nothing like the video I posted using beebem
this is possibly a timing issue with the writing to the sound chip but im using exactly the same code to write as Superior Software's EXILE so it should work

I wish I had a real bbc computer to diagnose this, im gonna re-read the texas 76489 datasheet and see if something is obviously wrong
Image
User avatar
lurkio
Posts: 3665
Joined: Wed Apr 10, 2013 12:30 am
Location: Doomawangara
Contact:

Re: Lady Bug

Post by lurkio »

lovebug wrote:
Wed Apr 21, 2021 6:05 pm
I wish I had a real bbc computer to diagnose this, im gonna re-read the texas 76489 datasheet and see if something is obviously wrong
JSBeeb accurately reproduces the bug (the corrupted sound)!:

https://bbc.godbolt.org/?disc=https://d ... k&autoboot

Maybe you can use JSBeeb's debugger to work out what's going wrong? Don't ask me how to use it though! I think there are notes about the debugger in the JSBeeb Github repo, or maybe see the Issues section of the repo.

:?:
User avatar
BigEd
Posts: 4234
Joined: Sun Jan 24, 2010 10:24 am
Location: West Country
Contact:

Re: Lady Bug

Post by BigEd »

I think you may need to give the sound chip time to respond to each write.
User avatar
lovebug
Posts: 415
Joined: Sun Jan 31, 2021 5:07 pm
Location: Magrathea
Contact:

Re: Lady Bug

Post by lovebug »

it should be the correct timing for the chip but i'll recheck the code, I used to code from exiles write routine posted early in this thread so it should work as I didnt change it. gonna study the texas datasheet tonight see if ive made a mistake

interesting that the jsbeeb reproduces the fault, very handy as I can test any changes there

thanks guys
Image
User avatar
tricky
Posts: 5677
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: Lady Bug

Post by tricky »

The beebs SN runs faster than any other I have found, which can make things a bit high pitched, but not like your sample.
Both b-em and beebem have had quite a few sounds bugs and I believe that they both still have some.
Minimal timing that I have found is:

Code: Select all

.snd_write_A ; A is written to sound slow data bus : Z=0 A=8 X=X Y=Y
{
;	SEI
	sta SysViaRegA            ; sample says SysViaRegH but OS uses no handshake ; handshake regA
	lda #0+0 : sta SysViaRegB ; enable sound for 8us
	PHP : PLP : NOP : NOP     ; 3+4+2+2 + 2(lda #) = 16 clocks = 8us
	lda #0+8 : sta SysViaRegB ; disable sound
;	CLI
	RTS
}
The Data sheet may not help as it expects the data to be held until one of the pins changes, but that isn't connected on the beeb.
User avatar
lovebug
Posts: 415
Joined: Sun Jan 31, 2021 5:07 pm
Location: Magrathea
Contact:

Re: Lady Bug

Post by lovebug »

thanks tricky, I tried your code which is very nice btw but got the same result

so I started to look deeper and it turns out that the keyboard scanning code had a bug causing bad data to be written to the sound chip
fixed the bug and its working fine in beebem and jsbeeb now so hopefully works correctly on a real bbc also
 
ladybug.ssd
(14.75 KiB) Downloaded 20 times

thanks again to everyone for helping me out with this, cheers :D

well I hope this one works :D
Image
User avatar
lovebug
Posts: 415
Joined: Sun Jan 31, 2021 5:07 pm
Location: Magrathea
Contact:

Re: Lady Bug

Post by lovebug »

the one thing I noticed in the arcade is that ladybugs munching sound has more of a crunch to it than on beebem

the arcade game just sends low frequency random noise followed by high frequency random noise values to the chip but when i tried it on beebem it sounded flat

to compensate I changed the sound table for the munch to alternate between low frequency noise and low frequency pulse modes every frame for 4 frames followed by high frequency noise for 2 frames

it sounds more crunchier on beebem but may sound completely wrong on real hardware ? as according to the sn76489 data sheet the noise/pulse shift register is cleared when the feedback mode is changed to/from pulse/noise and im not sure if beebem is doing that

Code: Select all

.sfxDataMunch

	equb 2					; software channel 2
	equb &e2, &f0, &41			; hardware channel 3 pulse/noise
	equb &e6, &41
	equb &e2, &41
	equb &e6, &41
	equb &e4, &42
	equb &ff, &40
	
Image
User avatar
tricky
Posts: 5677
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: Lady Bug

Post by tricky »

Beebem doesn't do white noise or periodic noise correctly!
On an SN76489, whenever you set the frequency (noise type) it resets the counter and starts of with a few cycles of 0s, but that may be 1s depending on the chip. Either way, they shouldn't be audible. If you set them every frame, you may notice a 50Hz buzz included with your desired sound!
User avatar
lovebug
Posts: 415
Joined: Sun Jan 31, 2021 5:07 pm
Location: Magrathea
Contact:

Re: Lady Bug

Post by lovebug »

thanks for the explaination, i knew it was something like that

the buzz might make the sound more crunchier or terrible ? on beebem and jsbeeb sounds good but maybe on real hardware sounds bad

thanks again for your sound code which helped me confirm that it wasnt a timing issue
Image
User avatar
0xC0DE
Posts: 1053
Joined: Tue Mar 19, 2019 7:52 pm
Location: The Netherlands
Contact:

Re: Lady Bug

Post by 0xC0DE »

tricky wrote:
Wed Apr 21, 2021 9:31 pm
The beebs SN runs faster than any other I have found, which can make things a bit high pitched, but not like your sample.
Both b-em and beebem have had quite a few sounds bugs and I believe that they both still have some.
Minimal timing that I have found is:

Code: Select all

.snd_write_A ; A is written to sound slow data bus : Z=0 A=8 X=X Y=Y
{
;	SEI
	sta SysViaRegA            ; sample says SysViaRegH but OS uses no handshake ; handshake regA
	lda #0+0 : sta SysViaRegB ; enable sound for 8us
	PHP : PLP : NOP : NOP     ; 3+4+2+2 + 2(lda #) = 16 clocks = 8us
	lda #0+8 : sta SysViaRegB ; disable sound
;	CLI
	RTS
}
The Data sheet may not help as it expects the data to be held until one of the pins changes, but that isn't connected on the beeb.

I use a variant, for what it's worth:

Code: Select all

.snd_write_A ; A is written to sound slow data bus : Z=0 A=8 X=X Y=Y
{
;	SEI
	sta SysViaRegA            ; sample says SysViaRegH but OS uses no handshake ; handshake regA
	lda #0+0 : sta SysViaRegB ; enable sound for 8us
	jsr exit
	lda #0+8 : sta SysViaRegB ; disable sound
;	CLI
.exit
	RTS
}
0xC0DE
"I program my home computer / Beam myself into the future"
:arrow: Follow me on Twitter
:arrow: Visit my YouTube channel featuring my games and demos for Acorn Electron and BBC Micro
User avatar
lovebug
Posts: 415
Joined: Sun Jan 31, 2021 5:07 pm
Location: Magrathea
Contact:

Re: Lady Bug

Post by lovebug »

I've nothing to add right now, have'nt done any coding

taking a break but will get back to it soon
Image
User avatar
Snuggsy187
Posts: 247
Joined: Wed Apr 03, 2019 9:53 pm
Contact:

Re: Lady Bug

Post by Snuggsy187 »

You've been ploughing through this constantly it seems ! :D =D>

A well deserved break - why not :D
DROP PARCHMENT > POKE LOCK > PULL PARCHMENT > CURSE > BARGE DOOR > GO DOOR
Twitter: @snuggsy187
User avatar
lovebug
Posts: 415
Joined: Sun Jan 31, 2021 5:07 pm
Location: Magrathea
Contact:

Re: Lady Bug

Post by lovebug »

I was experimenting with the sound adding some effects / music, had to increase the number of software defined sound channels from 3 to 5 to prevent sounds cutting other sounds off and reserved channel 0 for 3 channel music
also juggled the psg channel data a bit so effects have minimum conflict with each other

the enemy spawn warning sound is triggered when the timer reaches the top left corner and an enemy should be spawned when the timer reaches top middle (complete revolution) but I still havent written the enemy spawn code yet so all the enemys are being spawned at the very start instead of one at a time. i just need to write the enemy spawn code and attach it to this trigger. i'll fix that soon

havent done anything else

ladybug.ssd
(15 KiB) Downloaded 13 times
Image
User avatar
lovebug
Posts: 415
Joined: Sun Jan 31, 2021 5:07 pm
Location: Magrathea
Contact:

Re: Lady Bug

Post by lovebug »

sorry ive not been well for a while and havent programmed anything
i have only added the remaining sound effects and music tables

theres a couple of major routines I must write and will give an update as soon as im up to it

thanks
Image
User avatar
Snuggsy187
Posts: 247
Joined: Wed Apr 03, 2019 9:53 pm
Contact:

Re: Lady Bug

Post by Snuggsy187 »

Sorry you haven't been well, hope things are looking up. Good to see you back on the scene !

Best wishes :D
DROP PARCHMENT > POKE LOCK > PULL PARCHMENT > CURSE > BARGE DOOR > GO DOOR
Twitter: @snuggsy187
User avatar
tricky
Posts: 5677
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: Lady Bug

Post by tricky »

Absolutely
User avatar
fwibbler
Posts: 520
Joined: Thu Jan 13, 2005 10:37 pm
Location: Essex
Contact:

Re: Lady Bug

Post by fwibbler »

Absolutely!
Get better first,


then get back to work :twisted:
User avatar
lovebug
Posts: 415
Joined: Sun Jan 31, 2021 5:07 pm
Location: Magrathea
Contact:

Re: Lady Bug

Post by lovebug »

I had a little go at programming something

some object detection
checking for end of level (not counting the letters yet)
updating level, vegetable/vegetable score
enemys released from box via timer and returned to box when a skull is touched
although right now the enemy release warning still triggers even if all enemys are already active and needs to be fixed
also all enemys are displayed in the box when not active also the vegetable is also drawed all the time, all these need to be fixed

this was a bit of a quick hack , all still a bit messy
 
 



audio and video goes out of sync after a few mins (the usual when beebem captures)
Last edited by lovebug on Tue Jul 06, 2021 12:37 am, edited 2 times in total.
Image
User avatar
lovebug
Posts: 415
Joined: Sun Jan 31, 2021 5:07 pm
Location: Magrathea
Contact:

Re: Lady Bug

Post by lovebug »

sorry i forgot the disk !
Attachments
ladybug.ssd
(17.75 KiB) Downloaded 9 times
Image
User avatar
Snuggsy187
Posts: 247
Joined: Wed Apr 03, 2019 9:53 pm
Contact:

Re: Lady Bug

Post by Snuggsy187 »

Cool, nice and smooth, looks like it's all coming together :D =D> =D>
DROP PARCHMENT > POKE LOCK > PULL PARCHMENT > CURSE > BARGE DOOR > GO DOOR
Twitter: @snuggsy187
User avatar
lovebug
Posts: 415
Joined: Sun Jan 31, 2021 5:07 pm
Location: Magrathea
Contact:

Re: Lady Bug

Post by lovebug »

thanks

sorry its been some time since i did anything but i had to take a break because of health issues, im still not 100% but will try to put in a little time here and there and get this finished

still plenty of game code to write
enemy sprites to be designed
sprite background restore instead of just painting black
intro screen with game options
level announcement
letter collection
extra and special bonus functions
and more....
Image
User avatar
tricky
Posts: 5677
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: Lady Bug

Post by tricky »

It is looking and sounding great.
Well done.
User avatar
lovebug
Posts: 415
Joined: Sun Jan 31, 2021 5:07 pm
Location: Magrathea
Contact:

Re: Lady Bug

Post by lovebug »

still have some sound issues to fix, i know why its happening its a tone channel priority thing but i just havent got around to it

just written the code to handle the 15 flag bits for bonus at the top for S P E C I A L E X T R A 2 3 5 and a new drawPlayfieldUpper function to parse the bits and draw the characters as originally it was just static white text
if a bit is clear then that character is displayed as white, if its set then the character is displayed in the correct color for that section (red, yellow or cyan)

as a quick hacky test ive made collecting the hearts write 2 random bytes to the flag bits so collection a heart will change the colors, works

added a lot of initialization code for start of game and levels although you wont really notice anything as its all behind the scenes
the only thing visible will be that the x2 x3 x5 are cleared back to white at the start of a new level

written and tested code so that ladybug can be invulnerable to skulls ,working fine
eventually collecting the special bonus will give you a bonus score and invulnerability to skulls for 5 rounds

plenty more to do and only 1220 bytes left :!:
Attachments
ladybug.ssd
(18 KiB) Downloaded 6 times
Image
User avatar
lovebug
Posts: 415
Joined: Sun Jan 31, 2021 5:07 pm
Location: Magrathea
Contact:

Re: Lady Bug

Post by lovebug »

ah I was also counting the initialization/relocation code
i actually have 1386 bytes free even after just writing some more code ! woohoo

Code: Select all

---------------------------------------------------- 
available ram  &0 - &47EF . 18416 bytes 
screen ram     &47F0 - &7fff . 14352 bytes 
---------------------------------------------------- 
used           &0 - &4310 . 17169 bytes 
unused         139 bytes 
free           1386 bytes 
---------------------------------------------------- 

---------------------------------------------------- 
detailed memory usage 
---------------------------------------------------- 
variables      &0 - &8D . 142 bytes 
free           &8E - &FF . 114 bytes 
---------------------------------------------------- 
used           &100 - &1EC . 237 bytes 
used (stack)   &1ED - &1FF . 19 bytes 
---------------------------------------------------- 
used           &200 - &27B . 124 bytes 
free           &27C - &286 . 11 bytes 
---------------------------------------------------- 
used           &287 - &CF1 . 2667 bytes 
free           &CF2 - &CFF . 14 bytes 
---------------------------------------------------- 
used           &D00 - &4310 . 13841 bytes 
free           &4311 - &47EF . 1247 bytes 
---------------------------------------------------- 

---------------------------------------------------- 
not included in calculation (throw away code) 
---------------------------------------------------- 
init & reloc   &4400 - &44B1 . 178 bytes 
---------------------------------------------------- 
Image
Post Reply

Return to “new projects in development: games”