Creating shoot them up

hu, cd, scd, acd, supergrafx discussions.
tonma
Posts: 12
Joined: Fri Oct 02, 2015 8:08 am

Creating shoot them up

Post by tonma » Fri Oct 02, 2015 8:25 am

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.

User avatar
MooZ
Site Admin
Posts: 389
Joined: Sun Jun 22, 2008 3:19 pm
Location: Lvl 3
Contact:

Re: Creating shoot them up

Post by MooZ » Fri Oct 02, 2015 1:23 pm

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.

tonma
Posts: 12
Joined: Fri Oct 02, 2015 8:08 am

Re: Creating shoot them up

Post by tonma » Fri Oct 02, 2015 4:57 pm

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.

tonma
Posts: 12
Joined: Fri Oct 02, 2015 8:08 am

Re: Creating shoot them up

Post by tonma » Fri Oct 02, 2015 5:19 pm

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.

User avatar
MooZ
Site Admin
Posts: 389
Joined: Sun Jun 22, 2008 3:19 pm
Location: Lvl 3
Contact:

Re: Creating shoot them up

Post by MooZ » Fri Oct 02, 2015 5:31 pm

You can write in french, but english is prefered.

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

tonma
Posts: 12
Joined: Fri Oct 02, 2015 8:08 am

Re: Creating shoot them up

Post by tonma » Sat Oct 03, 2015 2:36 pm

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.

User avatar
MooZ
Site Admin
Posts: 389
Joined: Sun Jun 22, 2008 3:19 pm
Location: Lvl 3
Contact:

Re: Creating shoot them up

Post by MooZ » Sat Oct 03, 2015 5:13 pm

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

tonma
Posts: 12
Joined: Fri Oct 02, 2015 8:08 am

Re: Creating shoot them up

Post by tonma » Sun Oct 04, 2015 7:12 am

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.

tonma
Posts: 12
Joined: Fri Oct 02, 2015 8:08 am

Re: Creating shoot them up

Post by tonma » Sun Oct 04, 2015 2:42 pm

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

User avatar
MooZ
Site Admin
Posts: 389
Joined: Sun Jun 22, 2008 3:19 pm
Location: Lvl 3
Contact:

Re: Creating shoot them up

Post by MooZ » Sun Oct 04, 2015 6:20 pm

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).
Attachments
bg.zip
(8.78 KiB) Downloaded 56 times

Post Reply