[Coco] BASIC09 problem

Bob Devries devries.bob at gmail.com
Tue Feb 24 21:56:41 EST 2015


I'm trying to write a small procedure in Basic09 to write to the last 
sector on a disk(image). It's not working the way I thought it should. 
Maybe someone can see my error?

DIM sector(256):BYTE
DIM path:INTEGER
DIM lof:INTEGER
BASE 0
OPEN #path,"/x0@":UPDATE
GET #path,sector
lof = sector(1)*256+sector(2) (* returns 2880 on the image I'm using *)
SEEK #path, (lof-1)*256 (* should go to the start of the last sector *)
(* 2880 - 1 = 2879. 2879 * 256 = 737024 *)
GET #path, sector
PUT #path, sector
CLOSE #path
END

The line with SEEK #path is where it is going wrong. (lof-1)*256 returns 
16128.

I'm sure it should be a simple error in my code, but I can't see it.

Regards, Bob Devries
Dalby, QLD, Australia



More information about the Coco mailing list