It is currently Sat Oct 21, 2017 6:58 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 44 posts ]  Go to page Previous  1, 2, 3
Author Message
 Post subject:
PostPosted: Mon Apr 20, 2009 3:42 am 
Offline
User avatar

Joined: Fri Nov 12, 2004 2:49 pm
Posts: 7232
Location: Chexbres, VD, Switzerland
Hey, just something about the doc...
Dish says it's good to never disable the NMI is good, but I can see two reasons to disable it :
- When redrawing something when the screen is turned off, if an NMI happens between two $2006 writes, the NMI will acknownledge the interrupt by reading $2002 and the result would be very bad (this has actually happened to me once).
- When starting a sound effect/a new piece of music if the music engine is called while the sound effect/music is initiated, BAD things could happen.

Unless you programm the NMI to not even acknownledge the interrupt depending on the state of the main engine, and because that NMIs on the 6502 are edge based and not state based, I guess it would be a workarround to issue 1, algouth it's not really "clean".

_________________
Life is complex: it has both real and imaginary components.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 20, 2009 8:17 am 
Offline
User avatar

Joined: Wed Nov 10, 2004 6:47 pm
Posts: 1845
1) Which is why you don't unconditionally read $2002 or set the scroll. Note that I made both of those conditional in my latest version.

2) The music engine should do all of that anyway. Starting a new track or playing a sound effect should equate to changing a single area of RAM.

Only real concern I had that was unavoidable was for mappers which require serial writes to a register. MMC3 style address/data regs can be guarded against easily enough:

Code:
swapmmc3:
  lda #$81
  sta soft8000     ; nmi would then copy this to $8000 before exit
  sta $8000
  lda pagenumber
  sta somewhere  ; if this is necessary
  sta $8001


Howver MMC1 style serial writes are pretty much impossible to guard against, and so you'd need to disable NMIs around them


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 20, 2009 9:35 am 
Offline
Formerly ~J-@D!~
User avatar

Joined: Sun Mar 12, 2006 12:36 am
Posts: 445
Location: Rive nord de Montréal
Drag wrote:
tokumaru wrote:
frantik wrote:
here is a buffer read routine i came up with based on a simplified version of SMB's routine..

The only problem with your code is that it's quite slow... INY, DEX and BNE for every copied byte is terribly inneficient. Unfortunately I don't have a better suggestion that doesn't require much more ROM.

If there's more ROM available, I can always recommend my pseudo-DMA idea. In my current project, I use a variation of it that is limited to 32 bytes at a time, so it doesn't need so much ROM.


You could kinda compromise and do it both ways at the same time, like StarTropics II. :P

Assume X is the loop count (the number of bytes remaining that we need to transfer).

Basically, it has an unrolled loop of:
Code:
<subtract 8 from X>
LDA buffer,Y
STA $2007
LDA buffer+1,Y
STA $2007
...
LDA buffer+7,Y
STA $2007
<add 8 to Y>


plus the normal loop:
Code:
LDA buffer,Y
STA $2007
INY
DEX
BNE -


The unrolled loop is the equivalent of a loop of 8, so what the program does is use the unrolled loop, copying 8 bytes each time, (subtracting 8 from the loop count each time), until the loop count is < 8, in which it just uses the normal loop for the remaining bytes.

So basically, if you need to transfer 5 bytes, it uses the normal loop with an X of 5.
If you need to transfer 8 bytes, it uses the unrolled loop once.
For 16 bytes, it uses the unrolled loop twice.
For 20 bytes, it's the unrolled loop twice, and the normal loop with an X of 4.

It doesn't rely on huge unrolled loops, indirect jumps, tables, or anything of the sort, yet offers a better efficiency for transfers that are >= 8 bytes in length.


This is exactly the Duff device! http://en.wikipedia.org/wiki/Duff%27s_device


Top
 Profile  
 
PostPosted: Thu Mar 11, 2010 8:03 pm 
Offline
User avatar

Joined: Tue Mar 09, 2010 11:12 pm
Posts: 83
Location: Rosario, Argentina
Disch wrote:
...I was bored and needed a break from my other project...

thanks mate! (a.k.a. "you should get bored more frequently") :lol:

_________________
sorry about my english, i'm from argentina...

http://nestate.uuuq.com


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 14, 2010 10:09 am 
Offline
User avatar

Joined: Tue Dec 13, 2005 4:19 pm
Posts: 290
Location: Gainesville, FL - USA
Disch wrote:
http://nesdevhandbook.googlepages.com/index.html

It's a start! We'll see how much I can actually get done before getting bored and moving on. XD


Since this thread was brought back from the dead, I'll mention that this link isn't working. You can get to the index, but subpage links are dead.

_________________
http://www.no-carrier.com


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 14, 2010 10:13 am 
Offline
User avatar

Joined: Wed Nov 10, 2004 6:47 pm
Posts: 1845
Yeah apparently googlepages doesn't work anymore. Talk about lame.

I don't have any free webhosting these days =(


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 14, 2010 10:16 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19113
Location: NE Indiana, USA (NTSC)
Disch wrote:
I don't have any free webhosting these days =(

wiki.nesdev.com


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 14, 2010 11:13 am 
Offline
User avatar

Joined: Wed Nov 10, 2004 6:47 pm
Posts: 1845
Well I didn't mean for nesdev stuff, I meant for general filesharing.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 14, 2010 4:51 pm 
Offline

Joined: Thu Dec 24, 2009 12:23 am
Posts: 60
Location: Igloo and Bear Land (Canada)
Oh, it works, except you have to download http://nesdevhandbook.googlepages.com/theframe.html (AKA chapter 1 AKA the only chapter).


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 19, 2010 8:11 pm 
Offline
User avatar

Joined: Sat Aug 14, 2010 7:12 pm
Posts: 53
thanks a lot Disch. hat's off. it's a great doc this one you whipped up.


Top
 Profile  
 
PostPosted: Sat Dec 29, 2012 6:47 pm 
Offline

Joined: Fri Oct 12, 2012 1:29 pm
Posts: 1
Does anyone still have access or a copy to this guide?

Thanks!
Jarrod


Top
 Profile  
 
PostPosted: Sat Dec 29, 2012 11:11 pm 
Offline

Joined: Thu Jun 04, 2009 9:07 am
Posts: 29
I managed to find this, not sure if that's all of it. I also don't have the stylesheet.

Also, it won't let me attach html nor .txt, but zipping it is ok?

EDIT: Sorry koitsu, apparently it's false positive-ing, calling it an attack vector if I don't zip it regardless of extension.


Attachments:
theframe.zip [11.6 KiB]
Downloaded 122 times


Last edited by Hangin10 on Sat Dec 29, 2012 11:43 pm, edited 1 time in total.
Top
 Profile  
 
PostPosted: Sat Dec 29, 2012 11:24 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 9:28 pm
Posts: 3192
Location: Mountain View, CA, USA
.txt attachments should absolutely work. .html or .htm don't work, but I'm planning on fixing that in a moment.


Top
 Profile  
 
PostPosted: Sat Dec 29, 2012 11:26 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 9:28 pm
Posts: 3192
Location: Mountain View, CA, USA
Like I said, .txt works just fine. .htm, .html, and .css have been added.


Attachments:
cider_pork_stew.txt [1.4 KiB]
Downloaded 310 times
Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 44 posts ]  Go to page Previous  1, 2, 3

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 5 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