Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,4 @@
|
|||
LDA #$7F
|
||||
CLC
|
||||
ADC #$01
|
||||
BVS ErrorHandler ;this branch will always be taken.
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
LDA #$FF
|
||||
CLC
|
||||
ADC #$01
|
||||
BCS ErrorHandler ;this branch will always be taken.
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
LDX #$7F
|
||||
INX ;although X went from $7F to $80, INX does not affect the overflow flag!
|
||||
BVS ErrorHandler ;whether this branch is taken has NOTHING to do with the INX instruction.
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
LDA #%01000000
|
||||
ORA #%10000000 ;accumulator crossed from below $7F to above $80, but ORA doesn't affect the overflow flag.
|
||||
BVS ErrorHandler ;whether this branch is taken has NOTHING to do with the ORA instruction.
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
LDX #$FF
|
||||
INX ;the carry flag is not affected by this unsigned overflow, but the zero flag will be set
|
||||
; so we can detect overflow that way instead!
|
||||
BEQ OverflowOccurred ;notice that we used BEQ here and not BCS.
|
||||
16
Task/Integer-overflow/6502-Assembly/integer-overflow-6.6502
Normal file
16
Task/Integer-overflow/6502-Assembly/integer-overflow-6.6502
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
;adding two 16-bit signed numbers, the first is stored at $10 and $11, the second at $12 and $13.
|
||||
;The result will be stored at $14 and $15.
|
||||
|
||||
;add the low bytes
|
||||
|
||||
LDA $10 ;low byte of first operand
|
||||
CLC
|
||||
ADC $12 ;low byte of second operand
|
||||
STA $14 ;low byte of sum
|
||||
|
||||
;add the high bytes
|
||||
|
||||
LDA $11 ;high byte of first operand
|
||||
ADC $13 ;high byte of second operand
|
||||
STA $15 ;high byte of result
|
||||
BVS HandleOverflow ;only check for overflow when adding the most significant bytes.
|
||||
Loading…
Add table
Add a link
Reference in a new issue