8x16 and whatever else unreg wants to know

Are you new to 6502, NES, or even programming in general? Post any of your questions here. Remember - the only dumb question is the question that remains unasked.

Moderator: Moderators

unregistered
Posts: 1318
Joined: Thu Apr 23, 2009 11:21 pm
Location: cypress, texas

Re: 8x16 and whatever else unreg wants to know

Post by unregistered »

songZi.ftm is special because it is songZ but moved over to the triangle channel. I honestly cant hear the dash1 notes on triangle channel. I can certianly tell when they are susposed to be playing but I can't hear the notes... that's the problem I've been having. :oops: :(
My sister can hear those notes... and that's awesome! :) :mrgreen:
unregistered
Posts: 1318
Joined: Thu Apr 23, 2009 11:21 pm
Location: cypress, texas

Re: 8x16 and whatever else unreg wants to know

Post by unregistered »

How could this be done? THIS...

Code: Select all

able: 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76, 80, 84, 88, 92, 96, 100, 104, 108, 112, 116

ldx able, x

lda
sta glove+0,  x  ;<something like this... I know it wont work but how could it work? :)
lda
sta glove+1, x
lda
sta glove+2, x
lda
sta glove+3, x

Ok thanks for reading and trying to help me here with this.
Joe
Posts: 650
Joined: Mon Apr 01, 2013 11:17 pm

Re: 8x16 and whatever else unreg wants to know

Post by Joe »

What's the input and output of that snippet of code supposed to be? I think I know what you want, but I'd like to be sure before I start writing code.
unregistered
Posts: 1318
Joined: Thu Apr 23, 2009 11:21 pm
Location: cypress, texas

Re: 8x16 and whatever else unreg wants to know

Post by unregistered »

well, I'd just like to somehow

Code: Select all



sta glove+0+x*4
sta glove+1+x*4
sta glove+2+x*4
sta glove+3+x*4

where x is some value
x: 0, 4, 8, 12, 16, 20,
edit: I'm sorry, I don't know input or output... :(
edit2: Well hmmm............... I want to always be able to specify what place (either 0, 1, 2 or 3) to store the value and I would always like to have it be a multiple of 4.
Joe
Posts: 650
Joined: Mon Apr 01, 2013 11:17 pm

Re: 8x16 and whatever else unreg wants to know

Post by Joe »

Perhaps I should ask a different question:

What are you trying to accomplish? What is the purpose of this code? I haven't been following this thread for very long, so I'm not at all familiar with what you've done so far.
unregistered
Posts: 1318
Joined: Thu Apr 23, 2009 11:21 pm
Location: cypress, texas

Re: 8x16 and whatever else unreg wants to know

Post by unregistered »

I am trying to accomplish creating a new different way of having a RAMbuffer.
Having a ram buffer of size 60. And then I would like to find a way to not have to write out every + number...

Code: Select all

like this

sta cup+0

sta cup+1

sta cup+2

sta cup+3

sta cup+4

sta cup+5

sta cup+6

sta cup+7

sta cup+8

etc....
I'm sorry again. Nevermind... I'll think this over tomorrow. Thank you for being willing to help! :D
Joe
Posts: 650
Joined: Mon Apr 01, 2013 11:17 pm

Re: 8x16 and whatever else unreg wants to know

Post by Joe »

I've seen some code do things like this:

Code: Select all

ldx #$5C
loop:
lda #$AA
sta buffer+0,x
lda #$BB
sta buffer+1,x
lda #$CC
sta buffer+2,x
lda #$DD
sta buffer+3,x
dex
dex
dex
dex
bpl loop
Is this what you mean?
User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: 8x16 and whatever else unreg wants to know

Post by tokumaru »

unregistered wrote:And then I would like to find a way to not have to write out every + number...
If all you want to do is save on typing, assemblers usually offer some kind of repetition command. ASM6 for example has .REPT, which allows you to do this:

Code: Select all

offset = 0
.rept 60
	sta cup+offset
	offset = offset + 1
.endr
This will generate 60 STAs to consecutive addresses, the 6502 will not run any sort of loop.
unregistered
Posts: 1318
Joined: Thu Apr 23, 2009 11:21 pm
Location: cypress, texas

Re: 8x16 and whatever else unreg wants to know

Post by unregistered »

Joe wrote:I've seen some code do things like this:

Code: Select all

ldx #$5C
loop:
lda #$AA
sta buffer+0,x
lda #$BB
sta buffer+1,x
lda #$CC
sta buffer+2,x
lda #$DD
sta buffer+3,x
dex
dex
dex
dex
bpl loop
Is this what you mean?
This is what I wanted yes... but I'm sure there is a possible way to do this. (I think that tokumaru told me that something like sta buffer+1,x isnt possible earlier in this thread.) Thank you Joe. :D I'm going to spend time on this now.
tokumaru wrote:
unregistered wrote:And then I would like to find a way to not have to write out every + number...
If all you want to do is save on typing, assemblers usually offer some kind of repetition command. ASM6 for example has .REPT, which allows you to do this:

Code: Select all

offset = 0
.rept 60
	sta cup+offset
	offset = offset + 1
.endr
This will generate 60 STAs to consecutive addresses, the 6502 will not run any sort of loop.
I did not realise that; that is excellent! Thanks tokumaru! :D I want to save on typing... by creating a loop so the code is cleaner. But I am happy that loopy provided the .REPT for us!
unregistered
Posts: 1318
Joined: Thu Apr 23, 2009 11:21 pm
Location: cypress, texas

Re: 8x16 and whatever else unreg wants to know

Post by unregistered »

unregistered wrote:
Joe wrote:I've seen some code do things like this:

Code: Select all

ldx #$5C
loop:
lda #$AA
sta buffer+0,x
lda #$BB
sta buffer+1,x
lda #$CC
sta buffer+2,x
lda #$DD
sta buffer+3,x
dex
dex
dex
dex
bpl loop
Is this what you mean?
This is what I wanted yes... but I'm sure there is a possible way to do this. (I think that tokumaru told me that something like sta buffer+1,x isnt possible earlier in this thread.) Thank you Joe. :D I'm going to spend time on this now.
I figured it out! :D Well almost.

---
I would really appreciate your help. :)
There is a procedure named next that correctly determines the high and low address for the next column to be drawn... I would like to somehow delay it being used until directly before the second nametable switch. Right before nametable 0 becomes set to the left side again. How could this be done? :? You know so it is like SMB...

edit.
unregistered
Posts: 1318
Joined: Thu Apr 23, 2009 11:21 pm
Location: cypress, texas

Re: 8x16 and whatever else unreg wants to know

Post by unregistered »

unregistered wrote:I would really appreciate your help. :)
There is a procedure named next that correctly determines the high and low address for the next column to be drawn... I would like to somehow delay it being used until directly before the second nametable switch. Right before nametable 0 becomes set to the left side again. How could this be done? :? You know so it is like SMB...

edit.
Nevermind!!!!!!!! FIGURED IT OUT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! :D :mrgreen:
unregistered
Posts: 1318
Joined: Thu Apr 23, 2009 11:21 pm
Location: cypress, texas

Re: 8x16 and whatever else unreg wants to know

Post by unregistered »

Thank you tepples for trying to help me... well you were logged in right after my post. I have a small question... does the console start at reset: when you turn it on? I think maybe it does... but does anyone know for sure? :)
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: 8x16 and whatever else unreg wants to know

Post by tepples »

Essentially the CPU does this when you power it on:

Code: Select all

  sei
  jmp ($FFFC)
So if the vector at $FFFC points to your reset handler, then yes, it'll start at the beginning of your reset handler.
unregistered
Posts: 1318
Joined: Thu Apr 23, 2009 11:21 pm
Location: cypress, texas

Re: 8x16 and whatever else unreg wants to know

Post by unregistered »

tepples wrote:...So if the vector at $FFFC points to your reset handler, then yes, it'll start at the beginning of your reset handler.
AWESOME, THANKS tepples! :D
unregistered
Posts: 1318
Joined: Thu Apr 23, 2009 11:21 pm
Location: cypress, texas

Re: 8x16 sprite is really a 16x32 pixel image?

Post by unregistered »

tepples[color=#8040FF], on page 69,[/color] wrote:Here's the logic:
  • At the start of the level, before turning on rendering, draw all columns from valid_left through valid_left + 31.
My level starts out already drawn on nametable 0 and nametable 1. So could I pretend that they were drawn as columns?
Post Reply