[Coco] DATA FILE LISTER

coco at jechar.ca coco at jechar.ca
Sun Apr 16 15:53:14 EDT 2023


On 2023-04-16 15:26, William Astle via Coco wrote:
> You're making the HD$ field 1 byte long in the FIELD command.
> 
> On 2023-04-16 13:07, coco--- via Coco wrote:
>> All
>> 
>> I a trying to open a data file with 64 byte records and print each 
>> record to the screen. I call it LIST.BAS
>> 
>> The code is shown below the main program ends at line 460 the 
>> subroutines
>> are just for showing a directory and then returning to a 80 col mode.
>> 
>> 100 '(c)2023 Charlie  coco at jechar.ca GNU.
>> 110 'Program to LIST a data file.
>> 130 CT=0:'COMPUTER TYPE 0=UNDETERMINED
>> 140 CT=PEEK(&HFFFE)*256+PEEK(&HFFFF)
>> 150 'IF IT IS A COCO 3 THEN SET TO HIGH SPEED
>> 160 IF CT=35867 THEN POKE 65497,0
>> 165 PRINT "CHOOSE DRIVE ( 0,1 or 2)";
>> 166 INPUT D
>> 170 CLS
>> 175 TB$="        "
>> 180 IF  CT=35867 THEN GOSUB 6400
>> 185 PRINT "    CHOOSE THE FILE TO DISPLAY":PRINT
>> 190 DIR D
>> 200 PRINT "FILE NAME ";
>> 210 INPUT F$
>> 260 F$=F$+":"+CHR$(48+D)
>> 270 GOSUB 8000
>> 300 OPEN "D",#1,F$,64
>> 310 FIELD #1,1 AS HD$
>> 305 DP=1
>> 380 'LOOP
>> 390 :GET #1,DP
>> 400 :PRINT TB$;HD$
>> 410 :DP=DP+1
>> 430 IF DP<20 THEN GOTO 380
>> 440 CLOSE #1
>> 460 END
>> 6400 'SUB TO PUT SCREEN IN 64 COL MODE
>> 6410 WIDTH 80:CLS 5
>> 6420 POKE &HE046,17:WIDTH 80:POKE &HFE04,64:POKE &HF871,&H80
>> 6430 POKE &HF875,&H2B:POKE &HF876,&H80:POKE &HFE06,&H2C
>> 6440 'Two Cols
>> 6450 POKE &HFE04,32
>> 6460 RETURN
>> 8000 'SUB TO PUT SCREEN IN 80 COL MODE
>> 8010 WIDTH 80
>> 8020 POKE &HE046,21:WIDTH 80:POKE &HFE04,80:POKE &HF871,&HA0
>> 8030 POKE &HF875,&H2E:POKE &HF876,&H60:POKE &HFE06,&H2F
>> 8040 POKE &HFE04,80
>> 8050 RETURN
>> 
>> The problem is that only the first byte prints for each record.
>> Where have I gone wrong ?
>> 
>> Charlie
>> 
> 
> --
> William Astle
Thanks that was It I needed to put the record length in two places in
the OPEN command and in the FIELD command as well ministry solved!
Now I just need to work on tidying up some things like stoping at <EOF> 
and
pageing.


More information about the Coco mailing list