Acorn Island

developing/porting a new game or gaming framework? post in here!
User avatar
ChrisB
Posts: 548
Joined: Wed Oct 05, 2011 10:37 pm
Location: Surrey
Contact:

Re: Acorn Island

Post by ChrisB »

Latest update:
  • Added "Retro Power" branding after discussion as Abug with Arcadian.
  • Added more descriptive directions from lake cottage. Has anyone been able to find the blue towers?
  • Filled remaining space with spawners and POIs. Some of the more remote areas have dangerous spawners in them now. Now 1 byte free1


This is intended as the last release before a RC1 release and does not yet contain the full quest line. Last chance for comments/issues.
AcornIsland.ssd
(42 KiB) Downloaded 28 times
1Not strictly true - I've not used &00ff and there are probably 3 extra bytes on the stack that I'm not using ;)
Castle Defender, Untitled Dungeon Game, Night Ninja, Wordle, Waffle, Acorn Island, Beebchase, Ghostbusters
User avatar
ChrisB
Posts: 548
Joined: Wed Oct 05, 2011 10:37 pm
Location: Surrey
Contact:

Re: Acorn Island

Post by ChrisB »

I have decided to declare this done and released it in the retro software forum.

I identified another quest line related bug which has been corrected. I also added some more text and found some more space by optimising some code to add a few more POIs (there are now 342). I also added a Readme with acknowledgments and a hints file....

Release here: viewtopic.php?p=382437
Castle Defender, Untitled Dungeon Game, Night Ninja, Wordle, Waffle, Acorn Island, Beebchase, Ghostbusters
chrissawer
Posts: 182
Joined: Mon Aug 10, 2020 9:04 am
Location: West Yorkshire, UK
Contact:

Re: Acorn Island

Post by chrissawer »

Hi Chris, this looks really impressive!

The first 8 bit machine I tried it on was my Master, and when I tried the SSD from the release topic unfortunately the scrolling doesn't work properly. It's a bit hard to describe but instead of the character staying in the middle and the world scrolling around them, the character moves around the screen when you move up/down/left/right. The world is redrawn but not in the correct place on the screen. The spells/health bar does appear to be in the correct place.

If it's relevant I believe my Master has a VLSI CRTC. If you would like me to help debug the issue, please let me know what I can do to help.

Switched over to a BBC B and the game is working nicely. I haven't made much progress yet but am enjoying exploring!
User avatar
ChrisB
Posts: 548
Joined: Wed Oct 05, 2011 10:37 pm
Location: Surrey
Contact:

Re: Acorn Island

Post by ChrisB »

Hmm. very odd. Does the master run the program linked here:
https://bbcmic.ro/#%7B%22v%22%3A1%2C%22 ... ALSE%22%7D

This SSD is an image of that program.
rupturedebug.ssd
(5 KiB) Downloaded 19 times
Castle Defender, Untitled Dungeon Game, Night Ninja, Wordle, Waffle, Acorn Island, Beebchase, Ghostbusters
chrissawer
Posts: 182
Joined: Mon Aug 10, 2020 9:04 am
Location: West Yorkshire, UK
Contact:

Re: Acorn Island

Post by chrissawer »

ChrisB wrote: Thu Jan 26, 2023 12:14 am Hmm. very odd. Does the master run the program linked here:
Hi, no on my master the display is really quite different from how that program displays in Owlet.

The red band is stationary and near the top of the screen but not at the top.

The "hardware scrolled" text with blue background is stationary slightly further down, with the occasional flicker. However from time to time this text is also displayed a second time scrolling across the top of the screen.

I wonder if anyone else with a master is able to run the same test, and whether this is dependent on the type of CRTC fitted, or indeed if there is something wrong with my master. I'm not aware of any other issues though!
User avatar
tricky
Posts: 7696
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: Acorn Island

Post by tricky »

For mills it is polite to reset ity on exit which is only a single write iirc.

Iirc detecting it requires some fiddling, but should be wait for known hpos, write to nula address to change clock, wait a bit more, force a light pen interrupt to capture the current character address, see if it matches the new or old pixel clock.

Fortunately I think scarybeasts has already done the hard work.

If you change the number of scan lines in a character row on the last scan lines, I seem to remember the VLSI reads the wrong addressess and adds an extra character row for fun! This used to happen on Frogger and maybe still does!
User avatar
Rich Talbot-Watkins
Posts: 2054
Joined: Thu Jan 13, 2005 5:20 pm
Location: Palma, Mallorca
Contact:

Re: Acorn Island

Post by Rich Talbot-Watkins »

I think I wrote that test program! I was fairly careful to do what I thought was necessary for VLSI compatibility, particularly writing R4 in the first line of a new CRTC frame, but that doesn't seem to be enough. I wonder what else is missing?
User avatar
ChrisB
Posts: 548
Joined: Wed Oct 05, 2011 10:37 pm
Location: Surrey
Contact:

Re: Acorn Island

Post by ChrisB »

It was indeed your demo code. Unfortunately I'm rather lost here - any guidance that anyone can offer would be greatly appreciated.
Castle Defender, Untitled Dungeon Game, Night Ninja, Wordle, Waffle, Acorn Island, Beebchase, Ghostbusters
User avatar
marcusjambler
Posts: 1147
Joined: Mon May 22, 2017 12:20 pm
Location: Bradford
Contact:

Re: Acorn Island

Post by marcusjambler »

This is great Chris =D>

I've got it running on my Master with Hitachi CRTC and VNULA no issues, although I haven't walked far yet...
User avatar
lurkio
Posts: 4351
Joined: Wed Apr 10, 2013 12:30 am
Location: Doomawangara
Contact:

Re: Acorn Island

Post by lurkio »

I also have a Master with the "wrong" type of CRTC, and this is what happens when I try to play Acorn Island on it:

https://youtu.be/CdrSuEuLq2A



:!:

There are no such problems when I play it on my Model B.

:idea:
User avatar
ChrisB
Posts: 548
Joined: Wed Oct 05, 2011 10:37 pm
Location: Surrey
Contact:

Re: Acorn Island

Post by ChrisB »

So this is failing to perform the screen start update during the frame. This is the same symptom as the sample code above. Anyone have any ideas how to address this?
Castle Defender, Untitled Dungeon Game, Night Ninja, Wordle, Waffle, Acorn Island, Beebchase, Ghostbusters
User avatar
Rich Talbot-Watkins
Posts: 2054
Joined: Thu Jan 13, 2005 5:20 pm
Location: Palma, Mallorca
Contact:

Re: Acorn Island

Post by Rich Talbot-Watkins »

Not just that, but it doesn't seem to be acknowledging your R6 (vertical displayed) setting in the lower screen (hence seeing the playfield on top as well), and ithe address change looks like it's happening after vsync, as the top bit is scrolling.

I can't quite fathom the possible logic of the VLSI variant that would cause that effect. I think it'd be great to figure it out as most Masters seem to be issue 2s with this type of 6845.
User avatar
lurkio
Posts: 4351
Joined: Wed Apr 10, 2013 12:30 am
Location: Doomawangara
Contact:

Re: Acorn Island

Post by lurkio »

I don’t really understand the details of how the CRTC works or how to manipulate it in code, but let me know if there are any specific tests you’d like me to run on my VLSI Master.

:?:
User avatar
picosonic
Posts: 211
Joined: Mon Feb 17, 2020 12:20 pm
Contact:

Re: Acorn Island

Post by picosonic »

Looks like it's not honouring any of the 6845 register adjustments, particularly R12/R13.

I presume this is just on actual hardware and not in an emulator too?

Have you seen this diff for a fix which was done by Tom Seddon, which is in relation to VLSI 6845 issues on a master?

https://github.com/kieranhj/scr-beeb/co ... b189d20dd1

Some of the values you poke into the 6845 registers may need to be adjusted when talking to the VL6845.

There is also this link with some tests and images where Tom Seddon compares the VL6845 with the Hitachi one. There are some definite differences which will cause things to look different.

https://github.com/tom-seddon/6845-tests

He notes that some of the registers don't update correctly if you poke them at the wrong time.

One last thing, are you disabling shadow memory or are you using it for double buffering?
User avatar
picosonic
Posts: 211
Joined: Mon Feb 17, 2020 12:20 pm
Contact:

Re: Acorn Island

Post by picosonic »

I found some BASIC / z80 code to detect what type of CRTC chip is in-use.

It's from the CPC but is fairly short so porting it to 6502 shouldn't take too long.

Let me know if it's something which might be useful?
6845 type detection
6845 type detection
User avatar
Rich Talbot-Watkins
Posts: 2054
Joined: Thu Jan 13, 2005 5:20 pm
Location: Palma, Mallorca
Contact:

Re: Acorn Island

Post by Rich Talbot-Watkins »

I don't think CPC-land has this variant of 6845 though. They have Hitachi, Motorola (more basic), and two variants which were essentially rough replications of the logic emulated in a custom Amstrad ULA. The VL68C45 which some Masters have is a CMOS implementation of the logic.

Thinking about this some more, I think I misinterpreted the visuals. What seems to be happening is that there are two CRTC frames with the top row count, followed by the playfield. I haven't exactly figured this yet, but it seems like the VLSI variant needs R4 seeing fractionally before the new frame starts.

VectorEyes fixed this by making the very first timer from the initialisation fire 24 ticks previously, after that everything goes smoothly, but it makes it much more sensitive to timing errors.

We still need to nail this one a bit better!
User avatar
ChrisB
Posts: 548
Joined: Wed Oct 05, 2011 10:37 pm
Location: Surrey
Contact:

Re: Acorn Island

Post by ChrisB »

Thanks for continuing to think about this. Are you saying that changing line 80 of your example to

Code: Select all

t1%=(39-vp%)*512-2-24
seemed to resolve the issue - or is another value required?

Is this worth trying on a problematic Master?
Castle Defender, Untitled Dungeon Game, Night Ninja, Wordle, Waffle, Acorn Island, Beebchase, Ghostbusters
VectorEyes
Posts: 572
Joined: Fri Apr 13, 2018 2:48 pm
Contact:

Re: Acorn Island

Post by VectorEyes »

That bloody VLSI CRTC chip! Life would be a lot easier if we could just ship a Hitachi version to everyone who currently has the VLSI one! :)

Anyway ... Rich Talbot-Watkins, Tom Seddon, myself and others have been discussing this and thinking about ways to fix it.

It's worth emphasising that we're sort of shooting in the dark at this point, we *think* we have an idea what's going on but there's still a lot that is unclear.

That being said, the current hypothesis is that on the VLSI variant, you need to set R4 (vertical total) before the start of a frame. It looks like once a frame has begun, if you subsequently set R4, that value won't be honoured until the start of the next frame.

This is in contrast to the Hitachi/Motorola/Toshiba variant, which compares C4 with R4 at the beginning of every raster line. So when you set R4, that new value will be honoured from the start of the next line.

With reference to that rupturedebug.ssd sample code, this means that if you're on a VLSI variant, you need to set R4 *before* the frame starts ... but you still want to set R12/R13 *after* it starts. The code as written sets both R4 and R12/R13 after the frame starts.

The magic adjustment value -24 seems to work because it's the perfect amount to make the Timer1 IRQ fire earlier just enough that the code is setting R4 at the end of the previous frame and then R12/R13 at the beginning of the next one.

However, the timing is extremely tight which makes me nervous. So how do we fix this?

Simple. We move the setting of R12/R13 *after* we've reset the timer latch values and interrupt handler address. So both IRQ handlers now do "Set R4, then set timer latches and IRQ handler, and then set R12/R13" instead of "Set R4, Set R12/R13, set timer latches and IRQ handler".

When you do that, you get a bigger time window to play with. On VLSI CRTC values of between 22 and 36 seemed to work fine, and on Hitachi/Motorola/Toshiba it really didn't care either way by a larger amount.

Attached is a test SSD that contains an example program (thankyou creators of Owlet!) that asks for an adjustment value each time it's run. You can run it on a VLSI machine and confirm that values of 22 to 36 seem to work OK. My feeling would be to choose one which is more conservative, e.g. perhaps 34, but of course I have no idea whether this will actually work within Acorn Island!

vrup_adjustment_test.ssd
(200 KiB) Downloaded 15 times
Hope this is helpful!

You can also see this code using the Owlet link below. The only difference from rupturedebug.ssd is the addition of adjustment to t1%, and the moving of setting R12/R13 after setting all the other stuff in the two IRQ handlers.

https://bbcmic.ro/#%7B%22v%22%3A1%2C%22 ... ALSE%22%7D
User avatar
ChrisB
Posts: 548
Joined: Wed Oct 05, 2011 10:37 pm
Location: Surrey
Contact:

Re: Acorn Island

Post by ChrisB »

Thank you so much for this. I will look to prepare a version of Acorn Island with updated code and some timing variants.
Castle Defender, Untitled Dungeon Game, Night Ninja, Wordle, Waffle, Acorn Island, Beebchase, Ghostbusters
User avatar
tricky
Posts: 7696
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: Acorn Island

Post by tricky »

I did check to see if I had any notes for the VLSI in my code, but I don't.

I'll have to check, but probably set them on the last scan line.

As some of you know, some of my games have the whole of the screen 1 character row high frames with interrupts every two character rows where I set r12/13 etc and then immediately set r12/13 again so there the first is latched for immediate use and the second for use one character row later :)

The timing is tight, probably only 6 or 7 cycles depending on the game and delay from whichever instruction was executing when the timer hit.

I use a continuous timer and update the latched value for the gap two slots ahead. It might sound nuts, but is actually very simple once it works ;) I only update the hight byte of the timer so I have a granularity of 4 scanlines which has always been enough except, I think I have a one scanline delay in one place in one game - maybe.
User avatar
Rich Talbot-Watkins
Posts: 2054
Joined: Thu Jan 13, 2005 5:20 pm
Location: Palma, Mallorca
Contact:

Re: Acorn Island

Post by Rich Talbot-Watkins »

TL;DR: there was a timing error in my original demo and doesn't work the way I intended!

Details:

I was aiming to get R4 set in each screen piece within the top row, but when I added palette changes to see when it was happening, I saw it was happening in the second row, which we already know VLSI won't like.

So I've made some changes to the demo, which we're going to try on a VLSI Master when we can.

Owlet link

Changes:
  • now uses IRQ1V and services the rupture interrupts as a priority; using IRQ2V (as I was doing before, trying to be OS-friendly) introduces as much as 5 scanlines of latency!
  • now syncs the OS 100Hz interrupt to the non-interlaced screen so one never clashes with the other.
  • now takes into account the VSync pulse width when calculating the initial t1%. I deliberately omitted that before as I didn't expect the timing to be that fussy and I was trying to keep it simple.
  • now takes into account the rough cycles of latency between the interrupt occurring and R4 finally getting set in the IRQ handler, plus extra latency getting the initial t1% timer going. This is a fixed amount, plus a variable amount depending on how long it takes the current instruction to finish executing when the IRQ happens. We can roughly estimate it, just to bring the interrupt position safely to the first scanline of each screen piece.
The hope here is that the new code should work on both types of CRTC, while not being too sensitive timing-wise.

If you have access to a VLSI Master, give it a whirl and let me know what happens, bearing in mind this is totally UNTESTED!!!
User avatar
lurkio
Posts: 4351
Joined: Wed Apr 10, 2013 12:30 am
Location: Doomawangara
Contact:

Re: Acorn Island

Post by lurkio »

Rich Talbot-Watkins wrote: Wed Feb 01, 2023 10:06 am If you have access to a VLSI Master, give it a whirl and let me know what happens, bearing in mind this is totally UNTESTED!!!
See video for results on my VLSI Master:

https://youtu.be/anJu2GLrDKs



I get the same results with the program on VectorEyes's vrup_adjustment_test.ssd which seems to work equally well no matter which number from zero to a hundred I input at the start! (Though I didn't try them all!)

:idea:
User avatar
Rich Talbot-Watkins
Posts: 2054
Joined: Thu Jan 13, 2005 5:20 pm
Location: Palma, Mallorca
Contact:

Re: Acorn Island

Post by Rich Talbot-Watkins »

Great, thanks for trying! So that looks correct then! Essentially my and VectorEyes' approaches are the same (just set the registers earlier!) but my reworking is a little more robust I think.

It would be interesting to try adding 64 to t1% to see if it still runs on the VLSI Master - that would show whether setting R4 has to be done in the first scanline (test fails) or whether anywhere in the first row is OK (test passes).

It would then be instructional to try adding 512 to t1% to confirm that it fails when trying to set R4 in the second row!
User avatar
lurkio
Posts: 4351
Joined: Wed Apr 10, 2013 12:30 am
Location: Doomawangara
Contact:

Re: Acorn Island

Post by lurkio »

Rich Talbot-Watkins wrote: Wed Feb 01, 2023 4:23 pm It would be interesting to try adding 64 to t1% to see if it still runs on the VLSI Master - that would show whether setting R4 has to be done in the first scanline (test fails) or whether anywhere in the first row is OK (test passes).
Test passes. (But I didn’t leave it running for long. See below.)

Rich Talbot-Watkins wrote: Wed Feb 01, 2023 4:23 pmIt would then be instructional to try adding 512 to t1% to confirm that it fails when trying to set R4 in the second row!
Test fails. Stationary text is lower than it should be and ghostly echoes of it briefly flash and disappear at top of screen. Scrolling text starts above red banner, scrolls and disappears. Same text (“HARDWARE SCROLLED”) appears static in lower half of screen! Then, after about a minute, the whole display suddenly corrects itself and starts looking and behaving normally (as if test had passed)! Didn’t wait to see if it goes back to being corrupted again after that.

:idea:
User avatar
ChrisB
Posts: 548
Joined: Wed Oct 05, 2011 10:37 pm
Location: Surrey
Contact:

Re: Acorn Island

Post by ChrisB »

So - here goes. Attached is a version of Acorn Island with the VLSI correction included. Can someone please test this version on a VLSI machine?
AcornIsland.ssd
(44 KiB) Downloaded 26 times
Castle Defender, Untitled Dungeon Game, Night Ninja, Wordle, Waffle, Acorn Island, Beebchase, Ghostbusters
User avatar
Rich Talbot-Watkins
Posts: 2054
Joined: Thu Jan 13, 2005 5:20 pm
Location: Palma, Mallorca
Contact:

Re: Acorn Island

Post by Rich Talbot-Watkins »

=D>

Now I need to try this game - looks awesome!!
chrissawer
Posts: 182
Joined: Mon Aug 10, 2020 9:04 am
Location: West Yorkshire, UK
Contact:

Re: Acorn Island

Post by chrissawer »

ChrisB wrote: Thu Feb 02, 2023 6:58 am So - here goes. Attached is a version of Acorn Island with the VLSI correction included. Can someone please test this version on a VLSI machine?
Hi Chris (and others),

Thanks for looking at this. The behaviour of this build on my VLSI Master is as follows.

At the start of the game, the screen is offset to the right, wrapping around. Moving left and right the character stays in the same place with the scrolling mostly working, if you ignore the screen offset/wraparound.

Moving up and down the screen jumps horizontally every move or two. Additionally the character moves up/down the screen instead of staying in the same place.

I can try and make photos or a video if that would be clearer and happy to keep testing any future builds. If you want a faster feedback loop maybe we can look at trying to find a time/date to do some investigating through Discord or Zoom. Probably worth @lurkio testing too to see if the behaviour is any different on his Master.
User avatar
ChrisB
Posts: 548
Joined: Wed Oct 05, 2011 10:37 pm
Location: Surrey
Contact:

Re: Acorn Island

Post by ChrisB »

Thanks for this. I took the "easy" option but it seems it's not good enough :( . Will need to take a closer look but it sounds like I'm missing the frame start. I might put together a couple of options rather than doing one thing at a time.
Castle Defender, Untitled Dungeon Game, Night Ninja, Wordle, Waffle, Acorn Island, Beebchase, Ghostbusters
User avatar
Rich Talbot-Watkins
Posts: 2054
Joined: Thu Jan 13, 2005 5:20 pm
Location: Palma, Mallorca
Contact:

Re: Acorn Island

Post by Rich Talbot-Watkins »

Yes you're going to need to hook into irq1v and do it in a more robust way as per my revised demo - like that it shouldn't be too fussy about precise timing.

If you're using the OS for sound etc, my demo also reprograms the 100Hz clock frequency to 100.16Hz so that it syncs precisely with the non-interlaced 50.08Hz screen refresh. That will stop the OS interrupts from ever clashing with the rupture interrupts, which should also improve robustness!
User avatar
lurkio
Posts: 4351
Joined: Wed Apr 10, 2013 12:30 am
Location: Doomawangara
Contact:

Re: Acorn Island

Post by lurkio »

chrissawer wrote: Thu Feb 02, 2023 5:58 pm At the start of the game, the screen is offset to the right, wrapping around. Moving left and right the character stays in the same place with the scrolling mostly working, if you ignore the screen offset/wraparound ... Moving up and down the screen jumps horizontally every move or two. Additionally the character moves up/down the screen instead of staying in the same place ... Probably worth @lurkio testing too to see if the behaviour is any different on his Master.
Same results on my VLSI Master.

:idea:
Post Reply

Return to “new projects in development: games”