Variations on OSGBPB

want to talk about MESS/model b/beebem/b-em/electrem/elkulator? do it here!
Coeus
Posts: 746
Joined: Mon Jul 25, 2016 11:05 am
Contact:

Variations on OSGBPB

Postby Coeus » Sat Jan 13, 2018 7:52 pm

I found a description on mdfs.net of the OSGBPB call which documents OSGBPB function 9 as, amongst other things, returning the filenames in a directory that has been opened by OSFIND, as opposed to function 8 which returns the names in the current directory. These two also differ in the way the filenames are layed out in memory when returned. However this is at odds with code in the VDFS ROM. This example is from the one JGH also has on mdfs.net but the one in B-Em is similar.

Code: Select all

 4650 .CatExInfo                 :\ PL=multiple files, NE=full info
 4660 \ &D01 = GBPB block
 4670 \ &D0E = FILE block
 4680 \ &D20 = pathname
 4690 \ NOTE, WSS OSGBPB 9 uses control block differently
 4700 \
 4710 PHA:LDX #12:LDY #255
 4720 JSR CallService:STY &A0      :\ Claim NMI workspace
 4730 PLA:PHA:BPL CatNotInfo:LDY #0
 4740 .InfoLp
 4750 LDA (&B0),Y:STA &0D20,Y:INY  :\ Copy filename to buffer
 4760 CPY #&D60-&D20:BCC InfoLp
 4770 .CatNotInfo
 4780 PLA:LDX #&40:STX &0D00       :\ Null RTI routine
 4790 LDX #&00 :STX &0D0A          :\ Start with first item
 4800 STX &0D0B:STX &0D0C:STX &0D0D
 4810 STX &0D07:STX &0D08:STX &0D09
 4820 .CatLoop
 4830 LDX #&01 :STX &0D01          :\ Fetch one item
 4840 LDX #&20 :STX &0D02:STX &0D0E:\ =>Filename buffer
 4850 LDX #&0D :STX &0D03:STX &0D0F
 4860 LDX #&FF :STX &0D04:STX &0D05
 4870 LDX #&D60-&D20:STX &0D06     :\ Filename buffer size
 4880 PHA:TAX:BMI CatSingleFile
 4890 LDA #&09
 4900 LDX #&01:LDY #&0D:JSR OSGBPB :\ Read catalogue entry
 4910 LDA &0D01:BEQ CatDone        :\ If no more, exit
 4920 .CatSingleFile
 4930 LDX #&0E:LDY #&0D
 4940 LDA #&05:JSR OSFILE          :\ Read info on this entry
 4950 TAY:BNE CatFound             :\ Y=object type
 4960 PLA:BMI errNotFound:PHA      :\ Error if *INFO not found
 4970 .CatFound


So here there is no call to OSFIND to provide a file handle (channel number) to put in the first byte of the control block to specify which directory. I came across this version in the VDFS ROM first but I am intrigued as to what the history is here and why they are slightly different.

crj
Posts: 832
Joined: Thu May 02, 2013 4:58 pm
Contact:

Re: Variations on OSGBPB

Postby crj » Sun Jan 14, 2018 3:52 am

The version of OSGBPB 9 that mdfs.net documents seems to be the one provided by OS_GBPB 9 under RISC OS. I wasn't aware it ever existed on 8-bit OSes, which might explain why VDFS does something different with it.

While we're here: I've been thinking it would be nice to have a pair of "write zeroes" OSGBPB variants. Possibly number them 17 and 18, matching 1 and 2 in every respect except that the memory address is ignored and not modified. I feel that would be in good taste as a filing-system-specific extension other FSes were free to implement if they wished?

User avatar
hoglet
Posts: 7064
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol
Contact:

Re: Variations on OSGBPB

Postby hoglet » Sun Jan 14, 2018 7:56 am

There are some better implementation notes on BeebWiki:
http://beebwiki.mdfs.net/OSGBPB

It seems In general the 8-bit systems only implement A=&01 to&08, unless you are running:
- HADFS (&01 to &0B)
- Watford DFS (&01 to &09)

Dave

User avatar
jgharston
Posts: 3026
Joined: Thu Sep 24, 2009 11:22 am
Location: Whitby/Sheffield
Contact:

Re: Variations on OSGBPB

Postby jgharston » Sun Jan 14, 2018 6:27 pm

Also, the WSS emulator trap &03 &02 for OSGBPB implements call 9 diffrrenyly to the standard, as does the Acorn emulator trap &93. See http://mdfs.net/Docs/Comp/6502/EmulatorOp
When implementing these emulator ttraps or calling them you have adhere yo these exceptions.

Code: Select all

$ bbcbasic
PDP11 BBC BASIC IV Version 0.25
(C) Copyright J.G.Harston 1989,2005-2015
>_

User avatar
jgharston
Posts: 3026
Joined: Thu Sep 24, 2009 11:22 am
Location: Whitby/Sheffield
Contact:

Re: Variations on OSGBPB

Postby jgharston » Sun Jan 14, 2018 6:31 pm

What's the history? Blame warm silence. Why does it do it that way? Blame warm silence.
Whatever you do, note that in the vdfd example you give you are not calling osgbgb, you are calling the osgbgb emulator trap.
And note line 4690

Code: Select all

$ bbcbasic
PDP11 BBC BASIC IV Version 0.25
(C) Copyright J.G.Harston 1989,2005-2015
>_