Skip to content

Commit bc2d256

Browse files
committed
Add comment to explain >>>
1 parent bb13a4a commit bc2d256

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

Processor.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,7 @@ export class Processor {
381381
const v1 = this.registers[A];
382382
const v2 = getAddress ? this.readMem(getAddress(operand)) : operand;
383383
//sbc should be the same operation as adc but with the bits of the memory byte flipped
384+
//>>> coerces to an unsigned int so that the bitwise invert ~ works as expected, otherwise in JS ~0xff == -255
384385
const sum = this.internaladc(v1, (~v2 >>> 0) & 0xff);
385386
this.registers[A] = sum;
386387
}

test/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
6502_functional_test.bin

0 commit comments

Comments
 (0)