Page 1 of 2

Creating shoot them up

Posted: Fri Oct 02, 2015 8:25 am
by tonma
Hello, I am a French developer. I play video games since a long time, even before the Atari 2600.

I decided to put my skills to the development of video games. I want to create a shoot 'em up on PC-Engine. Horizontal or Vertical but pure arcade. As the super star soldier, raiden, gradius ... and many others.
I want to start on this format but I do not know the 65c02.

The forum necstasy advised me to come here.
I saw that the huc kit is not updated and it is better to use the assembler.
I will start by reading the tutorials on the site magicengine.

I certainly have many questions. But I will already start with the display of a sprite.

Re: Creating shoot them up

Posted: Fri Oct 02, 2015 1:23 pm
by MooZ
Welcome french comrade!
If you want speed, you'll have to stick with assembler. It's not a big issue once you get the trick.
But before starting you have to be sure of your target (hucard, cdrom (super, arcade, standard?), supergrafx?) as it may results in huge architecture changes.

Anyway feel free to ask anything.

Re: Creating shoot them up

Posted: Fri Oct 02, 2015 4:57 pm
by tonma
I'm glad to find a French community.

I think, i'll begin with CD game. It will certainly be easier to share the finished game.
I'll need to find informations about the architecture difference.

I have just beginning with drawing sprite on screen. And I'll ask a lot of thing, oh yes.

Can we speak in french on your forum ? It'll be more difficult for me when I'll have technical question.

Re: Creating shoot them up

Posted: Fri Oct 02, 2015 5:19 pm
by tonma
I see we'll need "overlay" to make CD-ROM. I think we can make it with pceas2, all I need to do now is testing and understanding the memory bank.

First make a little game.

Re: Creating shoot them up

Posted: Fri Oct 02, 2015 5:31 pm
by MooZ
You can write in french, but english is prefered.

Memory banking can be tricky. It's like a prehistoric MMU.

Re: Creating shoot them up

Posted: Sat Oct 03, 2015 2:36 pm
by tonma
I have now finish my first demo. Two sprites. One idle and the other animate and automatic movement on X.
Image

Lot of things to do like pad controller and array of sprites for enemies control.

Now I wish to draw Background with tiles. I know we need 8*8 pixels and I think we have to put them at $1000.

But with the assembler and include (mkit), I don't know how do that. If you can help me for the beginning, like draw one tile in background layer, I'll do next steps.

Another thing too, I want to print some text on screen (like fps, value of variable...). I see the font.inc in the include, so we certainly can use them for write text on screen. But I didn't see example.

Re: Creating shoot them up

Posted: Sat Oct 03, 2015 5:13 pm
by MooZ
This will look more or less like this:
For background, you first have to create a PCX file with your 8x8 tiles in it.
You include them with:

Code: Select all

  .data
  .bank 5
  .org $C000
tiles_data: .inctile "tiles.pcx"
tiles_pal: .incpal "tiles.pcx",0,1
Suppose that tiles.pcx contains 4 8x8 tiles. You upload them to VRAM with:

Code: Select all

    stw  #$1000, <_di
    lda  #bank(tiles_data)
    sta  <_bl
    stw  #tiles_data, <_si
    stw  #(4*32), <_cx
    jsr  load_vram
    
    map  tiles_pal
    set_bgpal  #0, tiles_data, #1

Re: Creating shoot them up

Posted: Sun Oct 04, 2015 7:12 am
by tonma
Thanks, I'll try this now.
I see you use a macro with load_vram. I will read the include file, it's certainly help me a lot.

Re: Creating shoot them up

Posted: Sun Oct 04, 2015 2:42 pm
by tonma
I try your code whitout success. I think writing at $1000 is good enough but I'm wrong.

I try add map macro for tile_data and change the .org of data. Can you read my code (or download it with my 16*16 pixels tile) and tell me if you see an error.

https://www.dropbox.com/s/j7ptf2k5h0avj ... t.zip?dl=0

I just leave the minium for the background.

Code: Select all

    .include "startup.asm"		


SATB_BASE 	.equ $7F00				

           .bss

satb      .ds 512 ; the local RAM SATB Sprite list


; ----
; main

          
           .code
           .bank MAIN_BANK
           .org  $C000
main:
        
		map tiles_data
		stw  #$1000, <_di
		lda  #bank(tiles_data)
		sta  <_bl
		stw  #tiles_data, <_si
		stw  #(4*32), <_cx
		jsr  load_vram				; include library asm
    
        vsync

		map  tiles_pal
		set_bgpal  #0, tiles_data, #2

		

.anim:
		vsync							

        update_satb satb

        jmp   .anim

		   
	.data
	.bank 5
	.org $E000
tiles_data: .inctile "tiles.pcx"
tiles_pal: .incpal "tiles.pcx",0,2
I've looking Inside the demo in asm of the mkit but he doesn't seem to use the same method.
Thanks for your help

Re: Creating shoot them up

Posted: Sun Oct 04, 2015 6:20 pm
by MooZ
The 2nd parameter of set_bgpal should be tiles_pal.

Code: Select all

set_bgpal  #0, tiles_pal, #2


Next, I had the size parameter (_cx) for load_vram completely wrong. The right value is 64. I thought it was the number of bytes whereas in fact it's the number of 16-bits words to copy.
In order to have tiles display on screen, you have to initialize the BAT (Background Attribute Table). It's an array at the beginning of the VRAM telling which tile (and which palette) to use.
Here's a quick example:

Code: Select all

    ; Compute VRAM address for the tile at position (x=9, y=7) in the BAT
    ldx     #9
    lda     #7
    jsr     calc_vram_addr
    ; Setup VRAM write address register
    jsr     set_write

   ; Switch to VRAM data write
    vreg    #$02

   ; Set BAT tile (9,7) point to vram address $1000 with palette 0
    st1     #$00
    st2     #$01
   ; Set BAT tile (10,7) point to vram address $1020 with palette 0
    st1     #$02
    st2     #$01
   ; Set BAT tile (11,7) point to vram address $1010 with palette 0
    st1     #$01
    st2     #$01
   ; Set BAT tile (12,7) point to vram address $1030 with palette 0
    st1     #$03
    st2     #$01
There's a lot to say about the VDC. A good introduction is Charles pcetech doc.

By the way, with mednafen, you can check the content of the VRAM by switching to the debugger view (alt+d) then going to vram view (alt+2).