Jump to content
IGNORED

Inverting Values


atari2600land

Recommended Posts

Basically, what I need to do is get the number on the left column to get to the number on the right column (and the number on the right column to be the number on the left).


174 80
173 81
172 82
171 83
170 84
169 85
168 86
167 87
166 88
165 89
164 90
163 91
162 92
161 93
160 94
159 95
158 96
157 97
156 98
155 99
154 100
153 101
152 102
151 103
150 104
149 105
148 106
147 107
146 108
145 109
144 110
143 111
142 112
141 113
140 114
139 115
138 116
137 117
136 118
135 119
134 120
133 121
132 122
131 123
130 124
129 125
128 126
127 127

All I can tell from this is that if you add all the rows, they all equal 254.

Link to comment
Share on other sites

I believe what Thomas meant was:

    eor    #$FF
    sec
    sbc    #1

 

That will fulfill the requirement is A+B = 254. Given A, calculate B. It saves a byte of ram and 1 cycle over subtracting using a ZP ram location.

 

 

In the rare case that X is preloaded with #$FF there is an illegal optimization. The resulting 'B' value ends up in the X register:

    eor    #$FF
    sbx    #1

 

  • Thanks 1
Link to comment
Share on other sites

3 hours ago, Omegamatrix said:

I believe what Thomas meant was:


    eor    #$FF
    sec
    sbc    #1

 

That will fulfill the requirement is A+B = 254. Given A, calculate B. It saves a byte of ram and 1 cycle over subtracting using a ZP ram location.

 

 

Well, assuming you have the value in the accumulator to start with. That's cheating :P

 

  • Haha 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...