sasq64 / bass

Advanced 6502 assembler
23 stars 4 forks source link

bug: off-by-one with negative int8 values #35

Closed antis81 closed 3 years ago

antis81 commented 3 years ago

The following code produces off-by-one situations:

!org 0x1000

test_1:  ;results in 0x7f == 127 (vs expected 0xff)
  !test "int8 test with -1"
  lda #<(-1)
  !log "A: {A} (expected: 255)"
  !check A == 255

test_2:  ;results in 0x80 == -128 (vs expected 0x00)
  !test "int8 test with -0"
  lda #<(-0)
  !log "A: {A} (epxected: 0)"
  !check A == 0
antis81 commented 3 years ago

Mmh… actually may be a false assumption as output of the above shows:

hexdump -C result.prg
00000000  00 10 a9 ff a9 00                                 |......|
00000006

# and the code file (bass -l … ) also shows:
1000 : lda #$ff
1002 : lda #$00
antis81 commented 3 years ago

Jop, found it. Sorry for the inconvenience!