Author Topic: The beginning of PCEASM programming - a few questions.  (Read 1557 times)

siudym

  • Newbie
  • *
  • Posts: 10
The beginning of PCEASM programming - a few questions.
« on: November 22, 2021, 04:54:30 AM »
Hello
I would like to get to know the PCE architecture to start programming something in PCEASM.

Searching the internet, I did not find any satisfactory answers to my questions.
Therefore, I would like to know:

1. What is the best PCE emulator to test the written code and to have SPRITES or NAMETABLE view (unfortunately the ones I found don't have it).

2. From what I read, NAMETABLE in PCE has 1024 bytes ($ 000-03FF) of 32x32 size and one 8x8 tile address is supposed to have 2-bytes - not very correct because it should have 2048 bytes. It is very unclear:

https://www.chibiakumas.com/6502/pcengine.php
Quote
"TileMap has to be at $0000 .. and it takes AT LEAST $0400 (it's minimum size is 32x32, and each definition takes 2 bytes)"

Due to this question, I do not know what the order of nametable tiles in PCE looks like - does it start like in NES (one-byte NAM)
xx00, xx01, xx02, xx03 ... xx1E, xx1F
xx20 ...
xx40 ...
(...)
Or like SMS (two-byte NAM)
xx00, xx02, xx04, xx06xx ... xx3E, xx3F
xx40 ...
xx80 ...
(...)

??

3. I have read PCE has the ability to access VRAM and VDP directly from the main processor loop without the need to perform additional graphics update functions, e.g. during VBLANK NMI? That's true? Are there maybe any limitations though? (For example, SegaMS can be written to VDP in the main loop (cpu loop) but you often have to make some delay between sequential writes due to slower transfer to VRAM.)
4. What exactly does a VRAM map look like? I found one but it is unclear - because if VRAM has 64K, why addresses from 8000 to FFFF are "unused"?

Quote
$0000   $03FF   Min Tilemap (Tiles 0-63)
$0400   $0FFF   Possible Tilemap (Tiles 64-255)
$1000   $7FFF   Tiles 256-2048
$7F00   $7FFF   SATB sprite table
$8000   $FFFF   PC-Engine only has 64k, so this is unused

5. I couldn't find any good examples of HELLO WORLD in PCEASM - are there any? Correct reset code, joypad reading code, etc. Unfortunately, often different "hello world" have many errors and more confuse than advise.


DarkKobold

  • Hero Member
  • *****
  • Posts: 1198
Re: The beginning of PCEASM programming - a few questions.
« Reply #1 on: November 22, 2021, 09:19:35 PM »
1. I like Bizhawk, you can at least output the background and VRAM in separate windows.

2. I don't know crap about the Nametable, HuC handles that for me, sorry.

3. If you try and write palette data mid-frame, you get artifacting issues. Also, if you're changing both the VRAM and sprite size in the same frame, you often get glitchy looking graphics, due to the VRAM updating immediately and the SATB not being updated until the next frame. Otherwise, VRAM  updates during a frame are strangely A-OK. (It's one of the coolest things about the Turbografx, being a new retro dev)

4. Aside from the Sprite attribute table, I'm pretty sure the VRAM is completely open. You can put your tile map data pretty much anywhere. You can mix sprite and tile data to your hearts content. I think that's why you can't find a good map, it doesn't care if a sprite is at $0900 and a tile is at $6000, or vice-versa. 

Also 4. Because VRAM is in uint16, not bytes. Look at that link you sent. You'll see you always write data in byte pairs, not in singular bytes.

5. Unfortunately, I also can't help with this. The HuC tutorial is great. Don't know much from the ASM side.
Hey, you.

siudym

  • Newbie
  • *
  • Posts: 10
Re: The beginning of PCEASM programming - a few questions.
« Reply #2 on: November 23, 2021, 06:39:24 AM »
I read a bit more about PCE. Now I know that VRAM is 16-bit or 32KBx16.
The system is very flexible, so a bit confusing for me when I switch from NES programming, which is very stiff :)

Currently, I have the biggest problem with creating graphics - earlier TILE (TILEBased) editing programs are not compatible with PCE graphics. I noticed that frequently used graphics are 4bit PCX format, but I do not have software for this purpose.
What's the best way to edit / draw graphics for PCE (4bit PCX)?

Using PCEASM when converting an image to PCX (uncompressed format, 16 colors (4bpp) it always pops up "Unsupported or invalid PCX format!"
« Last Edit: November 23, 2021, 09:29:08 AM by siudym »

Leander

  • Newbie
  • *
  • Posts: 17
Re: The beginning of PCEASM programming - a few questions.
« Reply #3 on: November 25, 2021, 09:49:43 AM »
I noticed that frequently used graphics are 4bit PCX format, but I do not have software for this purpose.

http://grafx2.chez.com/

siudym

  • Newbie
  • *
  • Posts: 10
Re: The beginning of PCEASM programming - a few questions.
« Reply #4 on: November 27, 2021, 05:15:59 PM »
I've already read a lot and many things have become clear. I wrote a simple demo (Hello World) in PCEASM - very nice system, great graphics  :D
At the moment I don't know about PSG music - I have to read more here.

My test demo ROM:
https://dl.dropboxusercontent.com/s/82w9q2mqiaqr8f5/pcetg16_demo.pce

Video:
https://www.youtube.com/watch?v=G8tZt1-_xEQ

Gredler

  • Jr. Member
  • **
  • Posts: 97
Re: The beginning of PCEASM programming - a few questions.
« Reply #5 on: November 29, 2021, 01:15:59 AM »
Looking awesome, great work!

siudym

  • Newbie
  • *
  • Posts: 10
Re: The beginning of PCEASM programming - a few questions.
« Reply #6 on: November 30, 2021, 06:49:44 AM »
Are there any PSG Audio library for music and sound effects? For use in code.
« Last Edit: November 30, 2021, 03:54:11 PM by siudym »

Leander

  • Newbie
  • *
  • Posts: 17
Re: The beginning of PCEASM programming - a few questions.
« Reply #7 on: December 07, 2021, 03:49:06 PM »
Looks good

siudym

  • Newbie
  • *
  • Posts: 10
Re: The beginning of PCEASM programming - a few questions.
« Reply #8 on: July 30, 2022, 05:31:51 AM »
« Last Edit: July 30, 2022, 11:16:32 AM by siudym »

Leander

  • Newbie
  • *
  • Posts: 17
Re: The beginning of PCEASM programming - a few questions.
« Reply #9 on: July 30, 2022, 11:14:35 AM »
Cool,any chance for micro knight port to Genesis?
« Last Edit: July 30, 2022, 11:46:32 AM by Leander »

siudym

  • Newbie
  • *
  • Posts: 10
Re: The beginning of PCEASM programming - a few questions.
« Reply #10 on: July 30, 2022, 01:31:40 PM »
It was my first game that I wrote :) I was already thinking about rewriting it to all systems I know for ASM. I have to write from scratch, more correctly, because now I don't have the original code anymore.

Leander

  • Newbie
  • *
  • Posts: 17
Re: The beginning of PCEASM programming - a few questions.
« Reply #11 on: July 31, 2022, 07:40:28 AM »
I hope you decide to code it for other systems,it's a fun and challenging game.

siudym

  • Newbie
  • *
  • Posts: 10
Re: The beginning of PCEASM programming - a few questions.
« Reply #12 on: January 07, 2024, 07:46:29 AM »
Multi-screen game - it is a test demo (2022) of certain programming solutions, not a full-fledged game:

Download ROM:
https://dl.dropboxusercontent.com/s/cqn5dosvxyjue5d/wielomap.pce

https://www.youtube.com/watch?v=MsIL-WJJ8hc

Recently I haven't had the time or inspiration to continue writing with PCEAS, but who knows, I'll probably come back again someday.  :)

Originally code written for Z80 (MSX) and rewritten for PCE:

https://www.youtube.com/watch?v=sn19PLKZABs
« Last Edit: January 07, 2024, 07:54:41 AM by siudym »

roflmao

  • Hero Member
  • *****
  • Posts: 4822
Re: The beginning of PCEASM programming - a few questions.
« Reply #13 on: January 08, 2024, 10:30:50 PM »
Awesome!

Necromancer

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 21332
Re: The beginning of PCEASM programming - a few questions.
« Reply #14 on: January 09, 2024, 08:37:57 PM »
Neato stuff.  I really need to get my shit together and get them on the TED for test driving.
U.S. Collection: 97% complete    155/159 titles