Search found 35 matches
- Sat Jun 14, 2014 1:10 pm
- Forum: NESdev
- Topic: Unsigned Integer Division Routines
- Replies: 30
- Views: 35739
Re: Unsigned Integer Division Routines
I have written a number of division routines in 6502 assembly, and I'm posting them here for other people to use. :) These routines start with any value (0-255) in the accumulator and finish with the integer division result in the accumulator. They are all constant cycles and do not use X or Y. Mos...
- Sat Jun 14, 2014 9:50 am
- Forum: NESdev
- Topic: Unsigned Integer Division Routines
- Replies: 30
- Views: 35739
Unsigned Integer Division Routines
I have written a number of division routines in 6502 assembly, and I'm posting them here for other people to use. :) These routines start with any value (0-255) in the accumulator and finish with the integer division result in the accumulator. They are all constant cycles and do not use X or Y. Most...
- Wed Jun 11, 2014 11:12 pm
- Forum: NESdev
- Topic: Simulating decimal mode
- Replies: 19
- Views: 13055
Re: Simulating decimal mode
I just realized that you are storing Absolute,X and not Zeropage,X. In this case a TYA has to be added back in since there is no STY Absolute,X instruction. It now uses 18 bytes which is still not too bad. ldy #$D0-1 sec .loopDivTen: iny sbc #10 bcs .loopDivTen adc #$DA sta StringBuffer+1,X tya sta ...
- Tue Jun 10, 2014 9:54 pm
- Forum: NESdev
- Topic: Simulating decimal mode
- Replies: 19
- Views: 13055
Re: Simulating decimal mode
Oh! Hey, Omegamatrix. I do recognize the name from this thread: http://atariage.com/forums/topic/113254-fast-divide-by-seven/page-5 Off topic: I'd planned to ask a few people eventually, but I've generally operated under the assumption routines posted in threads like that are public domain. Is this...
- Tue Jun 10, 2014 9:07 pm
- Forum: NESdev
- Topic: Simulating decimal mode
- Replies: 19
- Views: 13055
Re: Simulating decimal mode
True, my binary -> decimal routines takes a total of 23 bytes, and I don't think it's possible to shrink it further (it could be simplified if 0-9 digits were 0-9 in the pattern table instead of $d0-$d9 but I don't want to do that). ldy #$00 - cmp #10 bcc + sbc #10 iny ;Y count tens bne - + ora #$d...