Skip to content

Commit

Permalink
BUGFIX: F_SIZE set the wrong value.
Browse files Browse the repository at this point in the history
  • Loading branch information
skx committed May 19, 2024
1 parent ea4c3fc commit d973b01
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cpm/cpm_bdos.go
Original file line number Diff line number Diff line change
Expand Up @@ -1278,13 +1278,13 @@ func SysCallFileSize(cpm *CPM) error {

// Store the value in the three fields
fcbPtr.R0 = uint8(records & 0xFF)
fcbPtr.R1 = uint8(records & 0xFF00)
fcbPtr.R2 = uint8(records & 0xFF0000)
fcbPtr.R1 = uint8(records >> 8)
fcbPtr.R2 = uint8(records >> 16)

// sanity check because I've messed this up in the past
n := int(int(fcbPtr.R2)<<16) | int(int(fcbPtr.R1)<<8) | int(fcbPtr.R0)
if n != records {
return fmt.Errorf("failed to update because maths is hard")
return fmt.Errorf("failed to update because maths is hard %d != %d", n, records)
}

// Update the FCB in memory
Expand Down

0 comments on commit d973b01

Please sign in to comment.