Points of Required Attention™
Smaghetti, a new Super Mario Advance 4 editor, is currently in development! Check out the thread HERE!

Please chime in on a proposed restructuring of the ROM hacking sections.
Views: 88,275,699
Main | FAQ | Uploader | IRC chat | Radio | Memberlist | Active users | Latest posts | Calendar | Stats | Online users | Search 03-19-24 09:06 AM
Guest: Register | Login

0 users currently in ROM Hacking | 4 guests

Main - ROM Hacking - Binary math question in 6502 ASM (nevermind, I figured it out) New thread | Thread closed


RetroRain
Posted on 01-22-15 07:24 PM (rev. 5 of 01-22-15 09:13 PM) Link | Quote | ID: 159374


Fuzz Ball
Level: 66

Posts: 815/994
EXP: 2430516
Next: 31335

Since: 09-30-07

Last post: 1897 days
Last view: 919 days
I need to take a bank number, in hex, such as 06 or 07, and a 1 to bit 7, and then store it.

How do I do that in 6502?

lda bank_number ; lets just say it is #$06

(I need to make bit 7 of #$06 a 1)

So, if #$06 in binary is 00000110, I need to have it as 10000110, and then store it into an address.

STA bank_switch_address

I just don't know how to do that in 6502 opcodes.

Any help would be greatly appreciated. Thanks!

EDIT - Nevermind, I figured it out. I just converted the original number to binary, and the new binary number to hex, and saw the difference. The difference is 80. So all I have to do is add 80. Thanks for reading though!

You may close this thread if you wish.

____________________
My YouTube Channel

ninjablooper
Posted on 01-23-15 03:10 AM Link | Quote | ID: 159377


Bullet Bill
Level: 49

Posts: 476/509
EXP: 832573
Next: 51310

Since: 10-27-09
From: Earth

Last post: 2961 days
Last view: 2935 days
Okay, if you want me too I'll close it then. If the problem is more complex than you thought or something just PM me and I'll reopen it.

____________________
-Ninjablooper

Main - ROM Hacking - Binary math question in 6502 ASM (nevermind, I figured it out) New thread | Thread closed

Acmlmboard 2.1+4δ (2023-01-15)
© 2005-2023 Acmlm, blackhole89, Xkeeper et al.

Page rendered in 0.018 seconds. (339KB of memory used)
MySQL - queries: 42, rows: 63/64, time: 0.015 seconds.