Fix off by 1 error

This commit is contained in:
Byron Lathi
2023-10-25 20:39:55 -07:00
parent 6fabd23125
commit 6f36d2fcc4
3 changed files with 176 additions and 171 deletions

View File

@@ -158,12 +158,15 @@ _start:
sec
sbc #$02 ; don't handle carry, assume low byte is not 0 or 1
clc
sta tmp1
ldx data_start + 1 ; load x as high data start
phx
ldx sectors_per_cluster ; multiply cluster num (minus 2) by sectors_per_cluster
@4: adc tmp1
lda #$00
@8: adc tmp1
dex
bne @4
bne @8
plx
clc
adc data_start ; add that to low data start

View File

@@ -118,10 +118,12 @@ _main:
sec
sbc #$02 ; don't handle carry, assume low byte is not 0 or 1
clc
sta tmp1
ldx data_start + 1 ; load x as high data start
phx
ldx sectors_per_cluster ; multiply cluster num (minus 2) by sectors_per_cluster
lda #$00
@4: adc tmp1
dex
bne @4