## Search found 188 matches

Sat Sep 22, 2007 11:25 am
Forum: NESdev
Topic: I thought i knew how to add and subtract....
Replies: 12
Views: 4324
You don't really need to check the carry flag inbetween bytes. You just gotta not modify the carry flag until all your adds or subtracts are done. So yeah, the carry flag was designed with that in mind. so i might have hear wrong or misunderstood, but the carry flag needs to be cleared or set befor...
Sat Sep 22, 2007 11:15 am
Forum: NESdev
Topic: I thought i knew how to add and subtract....
Replies: 12
Views: 4324
I believe you need to check the carry flag when you add the low bytes together. If it's set, you add 1 to the sum of the high bytes. As for subtraction, I believe you need to check the carry flag when you subtract the low bytes. If it's clear, subtract 1 from the difference of the high bytes. no, t...
Sat Sep 22, 2007 11:09 am
Forum: NESdev
Topic: RTK's guide: Assembly in one step
Replies: 14
Views: 5533
Programmatically, the easiest way to negate a byte is to XOR it with \$FF (inverting all the bits: 1's become 0's and 0's become 1's) and then add 1. Take the number 2, for example. In binary it is 00000010. After XOR'ing it with 11111111 you get 11111101. Add 1 and you get 11111110, which is \$FE. C...
Sat Sep 22, 2007 11:03 am
Forum: NESdev
Topic: I thought i knew how to add and subtract....
Replies: 12
Views: 4324

### I thought i knew how to add and subtract....

Hi there, I thought i knew and understood how to add and subtract using the aritmetic instructions ADC and SEC, but these docs seem tp be proving me wrong. ok in addition you CLC - clear tha carry flag and in subtraction you SEC - set the carry flag. point taken. but whats this?? A 16-bit addition r...
Sat Sep 22, 2007 7:45 am
Forum: NESdev
Topic: RTK's guide: Assembly in one step
Replies: 14
Views: 5533

### Re: RTK's guide: Assembly in one step

\$FE - \$100 = 18446744073709551614, in calc.exe :roll: i guess cause there's no number threshold for it to be aware of? it's because it treats everything as unsigned when in hex mode 1) enter hex mode 2) input FE 3) press - 4) input 100 5) switch to dec mode 6) hit = result: -2 or input FE, switch t...
Fri Sep 21, 2007 9:36 pm
Forum: NESdev
Topic: RTK's guide: Assembly in one step
Replies: 14
Views: 5533

### Re: RTK's guide: Assembly in one step

nice trick. i'll have to keep that one in mind as i practice. i'm sure i'll have plenty of chances to work that out very soon.(opens up calc.exe) -edit- hmm... \$FE - \$100 = 18446744073709551614, in calc.exe :roll: i guess cause there's no number threshold for it to be aware of? well, darn, FE isn't ...
Fri Sep 21, 2007 6:40 pm
Forum: NESdev
Topic: RTK's guide: Assembly in one step
Replies: 14
Views: 5533

### Re: RTK's guide: Assembly in one step

Dwedit wrote:Whenever you JSR, the "return address" is two bytes, and that gets pushed onto the stack. Stack is 256 bytes large, so that's 128 nested calls.
cool so i kinda guessed the first one right, thanks!!!
Fri Sep 21, 2007 4:40 pm
Forum: NESdev
Topic: RTK's guide: Assembly in one step
Replies: 14
Views: 5533

### RTK's guide: Assembly in one step

Hi, i'm reading http://nesdev.com/6502guid.txt and i have a couple of questions these were originaly parts of an email thread i started to someone who's been really nice to help me, but i think i might be able to cut him a bit of slack if i post on these boards(thanks blargg) ok first thing i notice...