Author Topic: Scanline timer or equivalent in PCE hardware  (Read 974 times)

spenoza

  • Hero Member
  • *****
  • Posts: 2751
Scanline timer or equivalent in PCE hardware
« on: April 11, 2012, 05:26:37 AM »
So, is there a scanline timer interrupt or a relatively accessible method of duplicating the function of one within the PCE hardware? Specifically, it would be nice to have a fixed tile area at the top or bottom of the screen that doesn't use sprites that can accommodate a playfield that can scroll in any direction, despite the playfield and the status area being comprised of tiles.

See Super Mario Bros 3 on the NES for a perfect example of this.

Is this something the PCE can replicate without too much trouble?
<a href="http://www.pcedaisakusen.net/2/34/103/show-collection.htm" class="bbc_link" target="_blank">My meager PC Engine Collection so far.</a><br><a href="https://www.pcenginefx.com/forums/" class="bbc_link" target="_blank">PC Engine Software Bible</a><br><a href="http://www.racketboy.com/forum/" c

Arkhan

  • Hero Member
  • *****
  • Posts: 14142
  • Fuck Elmer.
    • Incessant Negativity Software
Re: Scanline timer or equivalent in PCE hardware
« Reply #1 on: April 11, 2012, 08:07:11 AM »
Are you saying you want to break the screen into various sections, one of which scrolls every direction, while another stays still?


....like the status bar on a ton of PCE games?

and Pyramid Plunder?
[Fri 19:34]<nectarsis> been wanting to try that one for awhile now Ope
[Fri 19:33]<Opethian> l;ol huge dong

I'm a max level Forum Warrior.  I'm immortal.
If you're not ready to defend your claims, don't post em.

spenoza

  • Hero Member
  • *****
  • Posts: 2751
Re: Scanline timer or equivalent in PCE hardware
« Reply #2 on: April 11, 2012, 08:50:59 AM »
That effect uses background tiles and not sprites? If that's so, awesome. Question answered.
<a href="http://www.pcedaisakusen.net/2/34/103/show-collection.htm" class="bbc_link" target="_blank">My meager PC Engine Collection so far.</a><br><a href="https://www.pcenginefx.com/forums/" class="bbc_link" target="_blank">PC Engine Software Bible</a><br><a href="http://www.racketboy.com/forum/" c

Arkhan

  • Hero Member
  • *****
  • Posts: 14142
  • Fuck Elmer.
    • Incessant Negativity Software
Re: Scanline timer or equivalent in PCE hardware
« Reply #3 on: April 11, 2012, 09:16:28 AM »
Yeah.. Atlantean does this too.    The entire HUD display is just a 16 pixel tall section of the background.  No sprites.

Pyramid Plunder is a 32 pixel tall section instead.

It's still all background tiles. 
[Fri 19:34]<nectarsis> been wanting to try that one for awhile now Ope
[Fri 19:33]<Opethian> l;ol huge dong

I'm a max level Forum Warrior.  I'm immortal.
If you're not ready to defend your claims, don't post em.

spenoza

  • Hero Member
  • *****
  • Posts: 2751
Re: Scanline timer or equivalent in PCE hardware
« Reply #4 on: April 11, 2012, 09:30:01 AM »
Good deal. That's what I wanted to know. Thanks!
<a href="http://www.pcedaisakusen.net/2/34/103/show-collection.htm" class="bbc_link" target="_blank">My meager PC Engine Collection so far.</a><br><a href="https://www.pcenginefx.com/forums/" class="bbc_link" target="_blank">PC Engine Software Bible</a><br><a href="http://www.racketboy.com/forum/" c

ccovell

  • Hero Member
  • *****
  • Posts: 2245
Re: Scanline timer or equivalent in PCE hardware
« Reply #5 on: April 11, 2012, 01:41:58 PM »
Ahem.


Of course, the PCE has a scanline timer and HSync interrupt.  IIRC, Tomaitheous implemented a pretty flexible scanline scrolling system in MagicKit.  Did he add it to HuC as well?

Arkhan

  • Hero Member
  • *****
  • Posts: 14142
  • Fuck Elmer.
    • Incessant Negativity Software
Re: Scanline timer or equivalent in PCE hardware
« Reply #6 on: April 11, 2012, 02:18:59 PM »
^^^ Yeah that's the demo I was looking for (in another thread).  I showed it to OldMan (he was asking about it).     Its wayyyyyyyyy at the end of Zeograd's homebrew listing.

I don't know if Tom added anything to HuC.  I don't think he did, since he doesn't use HuC himself.  

Aetherbyte's stuff has flexible scanline scrolling.  It's sorta built in already to HuC.  With a bit of fiddling you can get it to do what you want.
[Fri 19:34]<nectarsis> been wanting to try that one for awhile now Ope
[Fri 19:33]<Opethian> l;ol huge dong

I'm a max level Forum Warrior.  I'm immortal.
If you're not ready to defend your claims, don't post em.

Bonknuts

  • Hero Member
  • *****
  • Posts: 3292
Re: Scanline timer or equivalent in PCE hardware
« Reply #7 on: April 11, 2012, 03:36:27 PM »
So, is there a scanline timer interrupt or a relatively accessible method of duplicating the function of one within the PCE hardware? Specifically, it would be nice to have a fixed tile area at the top or bottom of the screen that doesn't use sprites that can accommodate a playfield that can scroll in any direction, despite the playfield and the status area being comprised of tiles.

See Super Mario Bros 3 on the NES for a perfect example of this.

Is this something the PCE can replicate without too much trouble?

 You've already got your answer, but contribute some more specifics.

 There's an Hsync interrupt service. You tell it what 'scanline' number to generate the interrupt, and it does when it reaches that scanline. When the interrupt hits, you can change a number of registers for the display on that given scanline; scroll X position, scroll Y, position, BG on/off, sprites on/off, VCE colors, etc. You can even generate interrupts for none showing scanlines (scanlines in vblank area). If you write to the audio chip, you can use this to do 16khz samples or such updates.

 I wrote a bunch of stuff for HuC (even some code for the executable too). Zeo took most of it, but it never got published afaik; SGX duplicates for all main video functions (sprite,tilemap,etc), arcade card access, some additional CD functions not on the list, some new hsync routines, long pointer access, etc. I had some of it up on my old site, but nothings posted anymore. I made something for Xavier (hsync). Not sure if he ever used it. I never used HuC for my own stuff, but I've spent a good amount of time messing around with it and the backend lib. Only a handful of people use HuC and they all seem to have their own custom stuff for it, so there's really no sense in trying to make new functions for it for the public to use (which sucks).

Arkhan

  • Hero Member
  • *****
  • Posts: 14142
  • Fuck Elmer.
    • Incessant Negativity Software
Re: Scanline timer or equivalent in PCE hardware
« Reply #8 on: April 11, 2012, 05:03:23 PM »
I wrote a bunch of stuff for HuC (even some code for the executable too). Zeo took most of it, but it never got published afaik; SGX duplicates for all main video functions (sprite,tilemap,etc), arcade card access, some additional CD functions not on the list, some new hsync routines, long pointer access, etc. I had some of it up on my old site, but nothings posted anymore.

Why didn't Zeo publish it?

Though, the stuff built into huc is decent enough for splitting the screen.
[Fri 19:34]<nectarsis> been wanting to try that one for awhile now Ope
[Fri 19:33]<Opethian> l;ol huge dong

I'm a max level Forum Warrior.  I'm immortal.
If you're not ready to defend your claims, don't post em.

cabbage

  • Sr. Member
  • ****
  • Posts: 342
Re: Scanline timer or equivalent in PCE hardware
« Reply #9 on: April 11, 2012, 07:20:51 PM »
I'd love to dig through your old HuC stuff, Bonknuts. It sounds like you wrote some really useful stuff.

HuC can do horizontal split-screen so easily, but I wish the screen could split into more than 4 segments... ie control individual scanlines--for making wavy raster effects

Bonknuts

  • Hero Member
  • *****
  • Posts: 3292
Re: Scanline timer or equivalent in PCE hardware
« Reply #10 on: April 12, 2012, 09:35:13 AM »
Quote
Why didn't Zeo publish it?
'Dunno.

HuC can do horizontal split-screen so easily, but I wish the screen could split into more than 4 segments... ie control individual scanlines--for making wavy raster effects

 Even if you have such control, the array support for such effect will slow you down almost to a crawl. I ran into this problem many years ago with HuC and one of the solutions was to build in support for wavy effects directly into the hsync routine. But then the problem creeps in that more flexibility makes the routine more complicated and requires more space. Doing any sort of custom hsync routine to control all scanlines is fairly easy, but you got to get around the slow array access in HuC first. Later I just made backend ASM functions for array read/write, but it never looked as clean/nice as native C code. Arkhan has a work around for this, but I don't know if it's public.

Arkhan

  • Hero Member
  • *****
  • Posts: 14142
  • Fuck Elmer.
    • Incessant Negativity Software
Re: Scanline timer or equivalent in PCE hardware
« Reply #11 on: April 12, 2012, 02:33:12 PM »
The workaround for HuC arrays is to not access them with C.  Use Assembly.

You can also f*ck with the HuC scrolling to add more lines, like Atlantean.   There's like 8 sections, and it's still HuC
[Fri 19:34]<nectarsis> been wanting to try that one for awhile now Ope
[Fri 19:33]<Opethian> l;ol huge dong

I'm a max level Forum Warrior.  I'm immortal.
If you're not ready to defend your claims, don't post em.

Bonknuts

  • Hero Member
  • *****
  • Posts: 3292
Re: Scanline timer or equivalent in PCE hardware
« Reply #12 on: April 12, 2012, 06:44:00 PM »
Cabbage: I found my AC+SGX lib for HuC. If you want to try it out, I can post a link to it (I have a source demo to go with it, but I should probably clean that one up).

 Here's the manual for the SGX part: http://www.pcedev.net/HuC/SGX_manual/sgx_lib.html
 The VPC window section most likely needs a section all its own to really explain it what the parameters do.
« Last Edit: April 12, 2012, 06:50:24 PM by Bonknuts »

touko

  • Hero Member
  • *****
  • Posts: 953
Re: Scanline timer or equivalent in PCE hardware
« Reply #13 on: April 12, 2012, 10:16:52 PM »
Tom i'am interested by your lib (XAV is also interested) ,because my next project should be on SGX .

And of course,manual is welcome ;-) .
« Last Edit: April 12, 2012, 10:19:15 PM by touko »

Bonknuts

  • Hero Member
  • *****
  • Posts: 3292
Re: Scanline timer or equivalent in PCE hardware
« Reply #14 on: April 13, 2012, 12:08:29 AM »
Tom i'am interested by your lib (XAV is also interested) ,because my next project should be on SGX .

And of course,manual is welcome ;-) .

 www.pcedev.net/HuC/sgx_ac_lib_ver_1_2.zip  :)

It doesn't have that custom hsync lib that I did for Xav, though.