::: Area #157 (comp.sys.acorn.programmer) Message: #33288 (Read 5 times, has 0 replies, 2100 bytes) Date : Tue Jun 23 18:43:02 1998 From : John Alldred of fidonet#2:254/27.2 To : All Subject: Re: BASIC line numbering In article , In off the Post wrote: > > Does anyone know how line numbers are stored in a BASIC program? I think I do; at least, I thought I did > .... I have a simple > little search procedure that searches a BASIC program (good for finding > the line numbers in large programs, or the occurences of strings or > variables etc.). Well, in !Edit, F4 can do that, and F5 comes in handy too (and of course there are two other editors available, whose names escape me ATM as they're not often mentioned here ;-) > However, sometimes it gives an incorrect line number > using my method, which is something along the lines of:- previous code > line would finish with a CR (13) Strictly speaking, each line /starts/ with CR; but no matter, it's still a /separator/ between lines > then the next line number would occupy the following two bytes (hi/low). Indeed they do (and the byte after that is the total number of bytes in the line, including itself, the CR, and the two line-number bytes, and should be used when hopping down the program). There shouldn't be any problem; apart possibly from BASIC being a bit inconsistent about whether line numbers over 32767 are permitted: the end of a BASIC prog is /supposed/ to be indicated by &0D &FF (the CR, the high byte having all bits set, but/and no low byte), but BASIC often balks (or grinds to a stop) at /any/ top-bit-set high byte. NB; This posting will inevitably be followed by one from a /real/ BASIC guru who will point out my mistakes ;-) John -- Error in !BOOT: it's on the wrong !foot. __ ZFC: B _ www.protovale.co.uk/john/ | _ |_ _ |_||| _| _ _ _| john@protovale.co.uk (_j(_)| )| ) | |||(_|| (-`(_| in and around Oxford --- EchoMaker 0.47 * Origin: The Arcade BBS Usenet News Gateway (2:254/27.2)