Search found 35 matches
- Fri Aug 11, 2017 2:47 pm
- Forum: Homebrew Projects
- Topic: WIP: Wizard of Wor
- Replies: 167
- Views: 96032
Re: WIP: Wizard of Wor
I'm well. Looking for to see this homebrew develop.
- Fri Aug 11, 2017 12:34 pm
- Forum: Homebrew Projects
- Topic: WIP: Wizard of Wor
- Replies: 167
- Views: 96032
Re: WIP: Wizard of Wor
The modulo is the problem here, given an integer divide by 24 such as: ;; void __fastcall__ div24(unsigned char d); _div24: lsr lsr lsr sta TEMP lsr lsr adc TEMP ror lsr adc TEMP ror lsr rts How can I determine a modulo? Is it sitting here in temp at some point? -Thom Modulo is easy, there are a fe...
- Fri Jun 17, 2016 9:09 pm
- Forum: NESdev
- Topic: 255 rubies in "The Legend of Zelda"?
- Replies: 20
- Views: 8357
Re: 255 rubies in "The Legend of Zelda"?
The problem isn't that, the problem is doing it quickly. What's the fast method for doing this on the NES? I think having a 256 LUT, which outputs 0 to 99. And for the last digit in the 100s place, simply check of the original byte is greater than 200 (populate a 2) or greater than 100 (populate a ...
- Tue Apr 19, 2016 11:20 pm
- Forum: Newbie Help Center
- Topic: Playing with division routine
- Replies: 15
- Views: 6772
Re: Playing with division routine
Okay so that first ROL should be an ASL. I don't know why it was a ROL... whoops! After correcting that... an actually testing it (which I didn't do before =x) it seems to now be working. Sorry for the confusion. #org 0, 0, 16, 0 #byte 'NES', $1A, 1, 0 #org $C000, $10, $4000, 0 quotient = 0 dividen...
- Sat Feb 13, 2016 7:05 pm
- Forum: NESdev
- Topic: [FIXED] Decimal 16 bit variables and CPU time/ROM space...
- Replies: 14
- Views: 5851
Re: [FIXED] Decimal 16 bit variables and CPU time/ROM space.
Here is a link to some of the routines I wrote for very fast hex to decimal: http://forums.nesdev.com/viewtopic.php?p=130363#p130363 These routines are all tested and confirmed working. They are in subroutine form and can be used for smaller conversions. A summary is below: ;slow routine - 174 bytes...
- Thu Apr 16, 2015 11:25 pm
- Forum: Newbie Help Center
- Topic: Fast 16bit modulus? (Y scroll for values > 240)
- Replies: 10
- Views: 6134
Re: Fast 16bit modulus? (Y scroll for values > 240)
I ran across this topic. I thought about doing a quick mod 240 for 16 bit, and came up with this: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; 16 bit mod 240 ; By Omegamatrix ; 39-42 cycles, 32 bytes ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; lda dividendHigh ;3 @3 and #$F0 ;2 @5 sta temp ;3 @8 eo...
- Sat Aug 09, 2014 11:33 pm
- Forum: Newbie Help Center
- Topic: KIL opcodes and such
- Replies: 35
- Views: 11874
Re: KIL opcodes and such
Undocumented instructions are really useful when you're under tight timing constraints, if they can do the job faster than the equivalent official instructions. They're often used in Atari 2600 homebrew, because on that system you have only 76 cycles per scanline to update playfield, players, missi...
- Wed Jul 09, 2014 2:34 pm
- Forum: NESdev
- Topic: Unsigned Integer Division Routines
- Replies: 30
- Views: 41174
Re: Unsigned Integer Division Routines
chitselb are you using 16 bit? I do have a 16 bit divide by 10 routine that you could tweak to get a div 40 and mod 40. That being said if you can just use multiply 40 then you probably way better off. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; UNSIGNED DIVIDE BY 10 (16 BIT) ; By Omegamatrix ; 126 c...
- Thu Jul 03, 2014 7:23 am
- Forum: NESdev
- Topic: Unsigned Integer Division Routines
- Replies: 30
- Views: 41174
Re: Unsigned Integer Division Routines
I glanced at Massalin's paper and that looks like an interesting solution they found for BCD. I will have to read it more later when I have time. I thought more about the computation today. It would be nice to also include ORA and AND, both zeropage and immediate. It's all the immediates that explod...
- Tue Jul 01, 2014 11:39 pm
- Forum: NESdev
- Topic: Left button crashing code when checking position...
- Replies: 12
- Views: 5417
Re: Left button crashing code when checking position...
tokumaru gave the best advice here. You'll always solve your problems way quicker by simply seeing what value is actually getting loaded with a debugger. If it is not a branch problem, then maybe some other things you might try/check are: - check if 'buttons' is really, truly getting updated with th...
- Tue Jul 01, 2014 9:50 pm
- Forum: NESdev
- Topic: Left button crashing code when checking position...
- Replies: 12
- Views: 5417
Re: Left button crashing code when checking position...
Wow. That is just not practical to use without branch error checking. Good to know.lidnariq wrote:Are you perhaps using NESASM? It's kind of famous for not giving an error on an out of range argument (i.e. the final BCC may be trying to jump more than 128 bytes earlier in the code).
- Tue Jul 01, 2014 9:28 pm
- Forum: NESdev
- Topic: Unsigned Integer Division Routines
- Replies: 30
- Views: 41174
Re: Unsigned Integer Division Routines
Clever. I think I'll keep these routines handy for future needs. I don't suppose you've considered rigging up a super-optimizer and letting it loose on the problem? It seems like a relatively limited number of permutations to search through, though I suppose the immediate fudge factor might cause t...
- Sat Jun 28, 2014 10:54 am
- Forum: NESdev
- Topic: Hex to Decimal
- Replies: 25
- Views: 16908
Re: Hex to Decimal
I've wrote a couple more 16 bit number (0-65535) to decimal routines. My old, original routine took 258 bytes, and 150-162 cycles. That routine however was not set up for JSR. To do so would requires 3 more bytes, and 15 cycles. That brings it true cost to 261 bytes, and 165-177 cycles. The first ne...
- Wed Jun 18, 2014 11:00 pm
- Forum: NESdev
- Topic: Hex to Decimal
- Replies: 25
- Views: 16908
Re: Hex to Decimal
I took a look and realized there is a easy way to chop another couple of bytes out of the routine by eliminating a branch. This will bring the total size down to 41 bytes, which is not too bad. The downside is that doing so will add an extra 3 cycles to some cases, including the worst case. To me th...
- Tue Jun 17, 2014 9:54 pm
- Forum: NESdev
- Topic: Hex to Decimal
- Replies: 25
- Views: 16908
Re: Hex to Decimal
Maybe you can put a comment explaining it; if needed, it can then be changed between ADD #100 or SBC #-101 or a branch instead of BIT, depending on the mapper, if it is necessary to do so. Good idea. I added in the comment with some choices. I also added some ASCII support. Cost was just 2 bytes an...