# > BLib.GoMMC 1.01 15-Feb-2005 # =============================  GoMMC access routines ( --------------------- 2' Depends: String: FNuc(), FNstr0() <: F# PROCmmc - Issue GoMMC command P# ----------------------------- Z action% - GoMMC action d" addr% - BBC memory address n mmc% - GoMMC address x# ----------------------------- #mmc_(action%,addr%,mmc%,num%) T!X%=&1212:X%!2=action%:X%?4=&01:X%!6=addr%:X%!10=mmc%:X%!14=num%:A%=&B0:&FFF1: : + FNmmc_Type - Return GoMMC object type + ------------------------------------- Lݤmmc_Type(A%):A%<4:="NONEFSIMTOOLDISK",A%*4+1,4) =" "+h0(A%,2)+" " : 1 FNmmc_Find - Find an entry in GoMMC catalog 1 ------------------------------------------- < name$ - onject name to add, can be terminated with '*' 1 mem% - 64 bytes of memory for object entry  % Returns: 0 - Object not found 5 <>0 - Object found, mem% contains info 1 ------------------------------------------- ݤmmc_Find(A$,mem%) " csz%,n%,l%,match% ,Dmem%!0=0:mmc_(&4003,mem%,0,64) : Read global catalog 6Dmem%?8=13:$mem%<>"GoMMCCat":=0 : No global catalog @@csz%=mem%!16:csz%=0:=0 : Catalog empty J,A$=uc(A$):A$,1)="*":l%=A$-1 l%=255 T)n%=0::mmc_(&4003,mem%,512+64*n%,64) ^+match%=uc(str0(mem%+16)),l%)=A$,l%) h.n%=n%+1:n%=csz% match%:match%:=n% =0 r: |/ FNmmc_Add - Add an entry to GoMMC catalog / -----------------------------------------  name$ - object name to add # size% - size of object to add  type% - object type  subt% - object subtype 1 mem% - 64 bytes of memory for object entry  6 Returns: 0 - No GoMMC catalog or catalog full 6 <>0 - GoMMC data address of new object 2 mem% - contains object catalog info / ----------------------------------------- +ݤmmc_Add(name$,size%,type%,subt%,mem%)  csz%,free%,add% size%=(size%+511)-512 Dmem%!0=0:mmc_(&4003,mem%,0,32) : Read global catalog Dmem%?8=13:$mem%<>"GoMMCCat":=0 : No global catalog &'mem%?8=0:csz%=mem%!16:free%=mem%!20 0"GoMMCCat":" **No global catalog**":=0 csz%=mem%!16:free%=mem%!20  csz%: n%=0 csz%-1:mmc_(&4003,mem%,512+64*n%,64):" "d(n%+1,2)" "mmc_Type(mem%?0)" "h0(mem%?1,2)" "h0(mem%!5,6)" "h0(mem%!9,6)" "str0(mem%+16),14)8: *@!mem%=free%:mem%!4=(512+csz%*64+511)-512:!mem%=!mem%-mem%!4 4mmc_(&0201,0,0,0) >B4h0(X%!7-32,6)2h0(mem%!5+2,6)1h0(mem%!1,6)" Free space" H =free% R: \ Sort the GoMMC catalogue f ------------------------ p? sort% - object word to sort by, or 0 to sort by type+name z1 mem% - 64 bytes of memory for object entry  & Returns: 0 - No GoMMC catalog / <>0 - Number of catalog entries / ----------------------------------------- ݤmmc_Sort(sort%,mem%)  swap%,diff%,csz%,n% #mem%!0=0:mmc_(&4003,mem%,0,32) #mem%?8=13:$mem%<>"GoMMCCat":=0 csz%=mem%!16: csz%<2:=1 :swap%=0: n%=0 csz%-2 Hmmc_(&4003,mem%+00,512+64*n%,64):mmc_(&4003,mem%+64,&240+64*n%,64) diff%=0: sort%:diff%=mem%!(sort%+64)-mem%!sort% A%=0::diff%=mem%?A%-mem%?(A%+64):A%=A%+1:A%=A%-12*(A%=4): diff% A%=64 Z diff%>0:mmc_(&4103,mem%+00,&240+64*n%,64):mmc_(&4103,mem%+64,512+64*n%,64):swap%=1  n%: swap%=0:=csz% :