It is currently Fri Dec 15, 2017 10:32 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 22 posts ]  Go to page Previous  1, 2
Author Message
PostPosted: Thu Feb 02, 2006 4:27 am 
i have a question about logic.. thanks.. now my gun sounds good!!

Code:
.gun_sound
        pha
        lda #$09
        sta $4015
        lda #$87
        sta $4000
        sta $400C
        lda #$AA
        sta $4002
        lda #$A2
        sta $4001
        lda #$0E
        sta $400E
        lda #$09
        sta $4003
        lda #$08
        sta $400F
        pla

        ldx #20  ; number of vblanks to wait
        jmp .WaitV_nTimes
        jmp .gun_sound

.WaitV_nTimes
   lda $2002
   bpl .WaitV_nTimes
   dex
   bne .WaitV_nTimes

   ldy #$09 ; only for explain my question
.data
   db "Hola Mundo. Pando"


Note: i cut off any code...
I use it on my emu virtuanes.. I get my Hola Mundo, etc.....
and i get a good fx sound like a machine gun.. but my question is..

when you call jmp .WaitV_nTimes and bne says: now.. i exit of label named .WaitV_nTimes..

i was thinking that next instruction to execute is ldy #$09.. but
virtuanes output says to me that next instruction is jmp .gun_sound.. this is returning from caller and executing instruction next to caller... it's possible??? im new on assembler 6502..

i was thinking that only with rts or rti.. it was returning from caller...
what happened???


Top
  
 
 Post subject: anothers questions..
PostPosted: Thu Feb 02, 2006 8:40 am 
mr .admin suggest me group questions in a single forum... then i am doing it..

i understand now that nametables get info from pattern tables and attribute tables and show it on display... is right??

then if i wanna showing sprites... i have to getting info from pattern tables and make something with famous OAM.. sprite ram???

how is logic to show a sprite in front of my background???
my demos show only background..
i wanna show any sprites... another thing is: if i wanna showing a sprite like super mario, must i know tile order in pattern tables??? or exists an automatic form of arrange it??? because in pattern tables head is on middle, but foots are near to upper top.. how can i arrange it???


Top
  
 
 Post subject: ps
PostPosted: Thu Feb 02, 2006 8:41 am 
i wanna arrange in execution time....


Top
  
 
PostPosted: Thu Feb 02, 2006 2:00 pm 
Offline
Site Admin
User avatar

Joined: Mon Sep 20, 2004 6:04 am
Posts: 3488
Location: Indianapolis
lord_Chile wrote:
i was thinking that next instruction to execute is ldy #$09.. but
virtuanes output says to me that next instruction is jmp .gun_sound.. this is returning from caller and executing instruction next to caller... it's possible??? im new on assembler 6502..


It's not possible. It just ends with a branch, so it'd go to the next instruction (LDY #$09). There must be a mistake or misinterpretation somewhere.

Quote:
i understand now that nametables get info from pattern tables and attribute tables and show it on display... is right??

then if i wanna showing sprites... i have to getting info from pattern tables and make something with famous OAM.. sprite ram???


Yes and yes.

Quote:
i wanna show any sprites... another thing is: if i wanna showing a sprite like super mario, must i know tile order in pattern tables??? or exists an automatic form of arrange it??? because in pattern tables head is on middle, but foots are near to upper top.. how can i arrange it???


The sprites are 8x8 (there's an 8x16 mode, but I've never used it myself). You have to assign each tile to each sprite individually and place them all by their X/Y coordinates.

Quote:
i wanna arrange in execution time....


I'm not sure what you mean.. that's the only time it can be done. :)
Normally I'd define a starting position for each sprite (so each one would be 8 pixels away from eachother, to form a larger object). Then in the code move them all together.

Reserve a page of RAM for sprites (like $200-$2FF). Then in your vblank code, write $02 to the $4014 register to copy it to OAM. I'd advise not even messing with the $2004 register, just so you know.

I made a macro to help me out when I want to quickly place a sprite in a starting position. I'm not sure if it'd be any good for you (probably requires CA65), but you can see it in here at the end: http://www.parodius.com/~memblers/nes/macros.s


Top
 Profile  
 
 Post subject: about graphics and logic
PostPosted: Mon Feb 06, 2006 8:48 am 
thanks.. a question: .CHR contains only pattern tables???? and can it be more than 8 kb???? like kirby..

and logic contains name tables, attribute tables and palettes...????

another thing.. how nes game lemmings bypass 8 sprite limitation.. you can haveing more than 10 lemmings in a row!!..

thanks..


Top
  
 
PostPosted: Mon Feb 06, 2006 8:58 am 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10165
Location: Rio de Janeiro - Brazil
lord wrote:
thanks.. a question: .CHR contains only pattern tables???? and can it be more than 8 kb???? like kirby..

Yes, you can have more, but only 8kb at a time (unless using MMC5 where you can get 12kb), if you use a mapper with CHR switching capabilities. Or if you use CHR-RAM, wich means you can change the contents of the pattern tables at will, using code and data from PRG ROM.

Quote:
and logic contains name tables, attribute tables and palettes...????

Yes, your program has to handle those things. You'll either be just copying that kind of data, or calculating it in realtime, depending on what you're doing (game/demo/cutscene/etc).

Quote:
another thing.. how nes game lemmings bypass 8 sprite limitation.. you can haveing more than 10 lemmings in a row!!..

Why ask the same thing in two different posts? Go read the other one, please.


Top
 Profile  
 
 Post subject: sorry and thanks
PostPosted: Mon Feb 06, 2006 9:07 am 
sometimes i ask same question on different post because.. it is not very much large "question" and i like getting different view points.. i understand like work pattern because im trying make a super mario guide with all hex address inside it... and each 16 byte i analyze tiles.. and more hehehe... good.. when i end all 512 tiles... i will send it to download ;o) only is for say thanks for all..


Top
  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 22 posts ]  Go to page Previous  1, 2

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group