LnSOS BOOT 1.1 SOS.KERNEL SOS KRNLI/O ERRORFILE 'SOS.KERNEL' NOT FOUND%INVALID KERNEL FILE: xةw,@  ȱlmi8#)!)  SOSIO ,DEVTRAN.TEXT k8k*XMOVE.TEXT0k9k-USEXMOVE.TEXT k9k-READ.ME.FIRST  k6Dk+SOSDEV.TEXTTk7Lk,SOSFILE.TEXTcCk7Zk,SOSUTIL.TEXT k7k+SOSMEM.TEXT$k8k,SOSDATA.TEXT k8k,SOSPLUS.TEXT k8kSOSIOu' *SOSIO.CODE$o k +ISOSIO.TEXTkKk,IPSOSIO.TEXT*kYk+ASMSOS.TEXT9 k64k,SOSEQUS.TEXT@ k6:k-SOSIOMAC.TEXTK >dLԡm#i㰼m#iЕOLԡȱfg hi !dLԡ憦  Ljmkm l y`2 Lԡ8(Je稽)ʈ@L:Copyright 1981 1982 1983 Apple Computer Inc.  Function SOS_Set_Lev ( Level : Integer; Var RetCode : Integer ) : Boolean; Function SOS_Get_Lev ( Var Level : Integer ) : Boolean; {$ENDC} {$IFC SOS_Utility_IO} Function SOS_S_Fence ( Priority : Integer ) : Boolean; Function SOS_G_Fence ( Var Priorlean; Function SOS_Get_EOF ( RefNumb : Integer; Var Low, Hi, RetCode ) : Boolean; Function SOS_Set_Mark ( RefNumb, Base, Low, Hi : Integer; Var RetCode ) 7: Boolean; Function SOS_Set_EOF ( RefNumb, Base, Low, Hi : Integer; Var RetCode ) 6: Boolean; ean; Function SOS_Set_B_Mark ( RefNumb, Base, BlockNumb : Integer; Var RetCode ) :: Boolean; Function SOS_Set_B_EOF ( RefNumb, Base, BlockNumb : Integer; Var RetCode ) 8: Boolean; Function SOS_Get_Mark ( RefNumb : Integer; Var Low, Hi, RetCode ) : Boor; Var RetCode ) : Boolean; Function SOS_Flush ( RefNumb : Integer; Var RetCode ) : Boolean; Function SOS_Get_B_Mark ( RefNumb : Integer; Var BlockNumb, RetCode ) :: Boolean; Function SOS_Get_B_EOF ( RefNumb : Integer; Var BlockNumb, RetCode ) 9: Bool Function SOS_Write ( RefNumb : Integer; Var OutputBuf; NumbBytes : Integer; 7Var RetCode ) : Boolean; Function SOS_S_Write ( RefNumb : Integer; Var OutputBuf; OffSet, 9NumbBytes : Integer; Var RetCode ) : Boolean; Function SOS_Close ( RefNumb : Integemb : Integer; Var InputBuf; BytesReq : Integer; 6Var BytesRead, RetCode ) : Boolean; Function SOS_S_Read ( RefNumb : Integer; Var InputBuf; OffSet, 8BytesReq :Integer; Var BytesRead, RetCode ) : Boolean; Integer; Var RetCode ) 9: Boolean; Function SOS_Open ( Var Path; ReqType, Pages : Integer; Var SysBuf, RefNumb, 6RetCode ) : Boolean; Function SOS_New_Line ( RefNumb, Flag : Integer; NewCh : Char; Var RetCode ) 7: Boolean; Function SOS_Read ( RefNue, FileList; ListLeng : Integer; :Var RetCode ) : Boolean; Function SOS_Volume ( Var DevName, VolName, TotalBlks, FreeBlks, RetCode ) 5: Boolean; Function SOS_Set_Prefix ( Var Prefix, RetCode ) : Boolean; Function SOS_Get_Prefix ( Var Prefix; Length : Function SOS_Destroy ( Var Pathname, RetCode ) : Boolean; Function SOS_Rename ( Var OldPath, NewPath, RetCode ) : Boolean; Function SOS_Set_Info ( Var Pathname, FileList; ListLeng : Integer; :Var Retcode) : Boolean; Function SOS_Get_Info ( Var Pathnam981 1982 1983 Apple Computer Inc.rce): INTRINSI''')xPxxINTEGER xREAL &J~CHAR \n SOS_D_Info ( DevNo : Integer; Var DevName, DevList, RetCode ) 5: Boolean; {$ENDC} {$IFC SOS_File_IO} Function SOS_Create ( Var Pathname; FileID, AuxID, Storage, EOFBlk : Integer; 8Var RetCode ) : Boolean; ,Copyright 1D_Status ( DevNumb, StatusCode : Integer; 9Var StatusList, RetCode ) : Boolean; Function SOS_D_Control ( DevNumb, ControlCode : Integer; :Var ControlList, RetCode ) : Boolean; Function SOS_Get_D_Num ( Var DevName, DevNumb, RetCode ) : Boolean; Functio { Set to TRUE to compile SOS calls for: } {$SETC SOS_File_IO := TRUE} {$SETC SOS_Device_IO := TRUE} {$SETC SOS_Utility_IO := TRUE} {$SETC SOS_Memory_Mgt := TRUE} {$SETC SOS_Plus_IO := TRUE} {$IFC SOS_Device_IO} Function SOS_ity : Integer ) : Boolean; Function SOS_Set_Time ( Var Time ) : Boolean; Function SOS_Get_Time ( Var Time ) : Boolean; Function SOS_Get_Analog ( Mode : Integer; Var Value, RetCode ) : Boolean; Function SOS_Terminate : Boolean; {$ENDC} {$IFC SOS_Memory_Mgt} Function SOS_Request_Seg ( Base, Limit, SegId : Integer; Var SegNumb, =RetCode ) : Boolean; Function SOS_Find_Seg ( SrchMode, SegId : Integer; Var FiveInts ) : Boolean; Function SOS_Change_Seg ( SegNumb, ChgMode : Integer; Var Pages, =RetCode)hhhhh\h[`[ x)H(H`2h(h)hhhhhh[a[ x\ȑ)H(H`>h(h)hhhhhhii[\]b[ x)H(H`Lh(h)hhhhhhii[\]c[ x)H`hah^h_h]hh\h[[ xȑ)H(H`?97531.*(' fh(h)hhhhЍ L h(h)hhhhhhh\h[[ xȑ)H(H`"@h(h)hhhhhh[[ x\ȑ)H(H`>h(hȑ)H(H`A:7431.*(' hh(h)hhhhЍL h(h)hhhhύ1hhhhhhh\h[`[ x]_ȑ^`)H(H`M;7421.+$! th(h)hhhhэL_ h(h)hhhh΍5hhh[ xȑ)H(H`"@h(h)hhhhύ&hhhhh\h[[ xm]m^^m_j^jȑ)H(H`MA=;:2/.,) th(h)hhhhэNL7 h(h)hhhh΍7hhh _h*`^ah]hh\h[[ xh(h)hhhhhhh_h`hhh\h^][[ xȑ)H(H`86.*'$"!^h(h)hhhhhhh_h`hhheheL :h(h)hhhhhhh\h[[ xȑ)H(H`"@h(h)hhhhhhh\h[hh^hh]hh\h[[ xȑ)H(H`,)&" Nh(h)hhhhhhhhh_h`hh^]h\h[[ xaȑb)H(H`B@742.,+(! rh(h)hhhhhhhhh_h`hhheheLj @Lh(h)hhhhhhh^hhh]\[[ xȑ)H(H`0&# Rh(h)hhhhhhhhhhe]dhcha[t_u`hbhhh\[ x^ȑ)H(H`SROMIHGFEDB8652h(h)hhhhhȑ)H(H`QA10-*'%$lh(h)hhhhhhhhhhhhhh_]^\[[ xb`ȑca)H(H`A@=:7541.'$ h(h)hhhhhhhh]\[[ xȑ)H(H`%"hh]\[[ xȑ)H(H`%"Lh(h)hhhhhhhhhh_]^\[[ xȑ)H(H`-,)&#! ^ÍL č>h(h)hhhhhhh`hhhhh_]^\[[ xh\h^`]_ a[[ xȑ)H(H`8430-*'%$ lh(h)hhhhhhh fh*geh]hdhhbhchah`r^s_hh\[[ xȑ)H(H`]ZWVUSPNLHGFED;865h(h)hhhhhhYL) 5h(h)hhhhhhhh^_h]hh\h[[ xȑ)H(H`G0-+($"!`h(h)hhhhhhhhhh[\][ x^ȑ)H(H`+(%#"Zh(h)hhhhhhhhhh ) : Boolean; Function SOS_G_Seg_Info ( SegNumb : Integer; Var FiveInts ) : Boolean; Function SOS_G_Seg_Numb ( SegAddr : Integer; Var SegNumb, RetCode ) : Boolean; Function SOS_Rel_Seg ( SegNumb : Integer; Var RetCode ) : Boolean; {$ENDC} {$IFC SOS_Plus_IO} Function Up_Load ( Var Char_Set ) : Boolean; Function At_Sign ( Var Object ) : Integer; {$ENDC} Implementation E Integer; Var FiveInts ) : Boolean; Function SOS_Change_Seg ( SegNumb, ChgMode : Integer; Var Pages, =RetCode ) : Boolean; Function SOS_G_Seg_Info ( SegNumb : Integer; Var FiveInts ) : Boolean; Function SOS_G_Seg_Numb ( SegAddr : Integer; Var SegNumb, RetCode ) : Boolean; Function SOS_Rel_Seg ( SegNumb : Integer; Var RetCode ) : Boolean; {$ENDC} (H`Rh(h)hhhhhhhhh\h[d[ xȑ⨪])H(H`0,*)Veh(h)hhhhhhhhh`hh^h_h\h][@[ xaȑ)H(H`:7531.,+& hh(h)hhhhhhh]hh\h[e^ȱ_A[ x^L8 )H(H`DA=:7310' lh(h)hhhhhhhhh]hh\h_^[B[ x^ȑ_)H(H`<93/,*)& jh(h)hhhhhhh\h[dC[ x Function SOS_Destroy ( Var Pathname, RetCode ) : Boolean; Function SOS_Rename ( Var OldPath, NewPath, RetCode ) : Boolean; Function SOS_Set_Info ( Var Pathname, FileList; ListLeng : Integer; :Var Retcode) : Boolean; Function SOS_Get_Info ( Var Pathnaman; Function SOS_D_Info ( DevNo : Integer; Var DevName, DevList, RetCode ) 5: Boolean; {$ENDC} {$IFC SOS_File_IO} Function SOS_Create ( Var Pathname; FileID, AuxID, Storage, EOFBlk : Integer; 8Var RetCode ) : Boolean; unction SOS_D_Status ( DevNumb, StatusCode : Integer; 9Var StatusList, RetCode ) : Boolean; Function SOS_D_Control ( DevNumb, ControlCode : Integer; :Var ControlList, RetCode ) : Boolean; Function SOS_Get_D_Num ( Var DevName, DevNumb, RetCode ) : Boole} Interface { Set to TRUE to compile SOS calls for: } {$SETC SOS_File_IO := TRUE} {$SETC SOS_Device_IO := TRUE} {$SETC SOS_Utility_IO := TRUE} {$SETC SOS_Memory_Mgt := TRUE} {$SETC SOS_Plus_IO := TRUE} {$IFC SOS_Device_IO} F {^he ""SOS Interface--February 1, 1983"Version 1.1" } {^fo ''Page %'ISOSIO' } {^zs} {^kw } {$C Copyright 1981 1982 1983 Apple Computer Inc.} {$SETC Intrinsic_Unit := TRUE} { File SOSIO } Unit SOSIO; {$IFC Intrinsic_Unit} Intrinsic CODE 58; {$ENDC !"#$%&'(A O^ˡ:.oolean; Function SOS_G_Seg_Info ( SegNumb : Integer; Var FiveInts ) : Boolean; Function SOS_G_Seg_Numb ( SegAddr : Integer; Var SegNumb, RetCode ) : Boolean; Function SOS_Rel_Seg ( SegNumb : Integer; Var RetCode ) : Boolean; {$ENDC} H` Dh(h)hhhh)H(H`Copyright 1981,1982,1983 Apple Computer, Inc.2347h*h+HH+H*H`&&&&v~.T4JPVz :@* : 8 R  x]L( )H(H`40-+*!Vh(h)hhhhhhhhh\h][D[ x^ȑ)H(H`,*'%$Th(h)hhhhhhh\h[E[ xȑ)H(H`"@h(h)hhhhhh  x)H(e, FileList; ListLeng : Integer; :Var RetCode ) : Boolean; Function SOS_Volume ( Var DevName, VolName, TotalBlks, FreeBlks, RetCode ) 5: Boolean; Function SOS_Set_Prefix ( Var Prefix, RetCode ) : Boolean; Function SOS_Get_Prefix ( Var Prefix; Length : Integer; Var RetCode ) 9: Boolean; Function SOS_Open ( Var Path; ReqType, Pages : Integer; Var SysBuf, RefNumb, 6RetCode ) : Boolean; Function SOS_New_Line ( RefNumb, Flag : Integer; NewCh : Char; Var RetCode ) 7: Boolean; Function SOS_Read ( RefNu Function SOS_Get_EOF; External; Function SOS_Set_Mark; External; Function SOS_Set_EOF; External; Function SOS_Set_Lev; External; Function SOS_Get_Lev; External; {$ENDC} {$IFC SOS_Utility_IO} Function SOS_S_Fence; External; Function SOS_G_Fence; Write; External; Function SOS_Close; External; Function SOS_Flush; External; Function SOS_Get_B_Mark; External; Function SOS_Get_B_EOF; External; Function SOS_Set_B_Mark; External; Function SOS_Set_B_EOF; External; Function SOS_Get_Mark; External; External; Function SOS_Set_Prefix; External; Function SOS_Get_Prefix; External; Function SOS_Open; External; Function SOS_New_Line; External; Function SOS_Read; External; Function SOS_S_Read; External; Function SOS_Write; External; Function SOS_S_ernal; Function SOS_D_Info; External; {$ENDC} {$IFC SOS_File_IO} Function SOS_Create; External; Function SOS_Destroy; External; Function SOS_Rename; External; Function SOS_Set_Info; External; Function SOS_Get_Info; External; Function SOS_Volume; {$IFC SOS_Plus_IO} Function Up_Load ( Var Char_Set ) : Boolean; Function At_Sign ( Var Object ) : Integer; {$ENDC} Implementation {$IFC SOS_Device_IO} Function SOS_D_Status; External; Function SOS_D_Control; External; Function SOS_Get_D_Num; Ext ) : Boolean; Function SOS_G_Seg_Info ( SegNumb : Integer; Var FiveInts ) : Boolean; Function SOS_G_Seg_Numb ( SegAddr : Integer; Var SegNumb, RetCode ) : Boolean; Function SOS_Rel_Seg ( SegNumb : Integer; Var RetCode ) : Boolean; {$ENDC} ory_Mgt} Function SOS_Request_Seg ( Base, Limit, SegId : Integer; Var SegNumb, =RetCode ) : Boolean; Function SOS_Find_Seg ( SrchMode, SegId : Integer; Var FiveInts ) : Boolean; Function SOS_Change_Seg ( SegNumb, ChgMode : Integer; Var Pages, =RetCodeity : Integer ) : Boolean; Function SOS_Set_Time ( Var Time ) : Boolean; Function SOS_Get_Time ( Var Time ) : Boolean; Function SOS_Get_Analog ( Mode : Integer; Var Value, RetCode ) : Boolean; Function SOS_Terminate : Boolean; {$ENDC} {$IFC SOS_Mem Function SOS_Set_Lev ( Level : Integer; Var RetCode : Integer ) : Boolean; Function SOS_Get_Lev ( Var Level : Integer ) : Boolean; {$ENDC} {$IFC SOS_Utility_IO} Function SOS_S_Fence ( Priority : Integer ) : Boolean; Function SOS_G_Fence ( Var Priorlean; Function SOS_Get_EOF ( RefNumb : Integer; Var Low, Hi, RetCode ) : Boolean; Function SOS_Set_Mark ( RefNumb, Base, Low, Hi : Integer; Var RetCode ) 7: Boolean; Function SOS_Set_EOF ( RefNumb, Base, Low, Hi : Integer; Var RetCode ) 6: Boolean; ean; Function SOS_Set_B_Mark ( RefNumb, Base, BlockNumb : Integer; Var RetCode ) :: Boolean; Function SOS_Set_B_EOF ( RefNumb, Base, BlockNumb : Integer; Var RetCode ) 8: Boolean; Function SOS_Get_Mark ( RefNumb : Integer; Var Low, Hi, RetCode ) : Boor; Var RetCode ) : Boolean; Function SOS_Flush ( RefNumb : Integer; Var RetCode ) : Boolean; Function SOS_Get_B_Mark ( RefNumb : Integer; Var BlockNumb, RetCode ) :: Boolean; Function SOS_Get_B_EOF ( RefNumb : Integer; Var BlockNumb, RetCode ) 9: Bool Function SOS_Write ( RefNumb : Integer; Var OutputBuf; NumbBytes : Integer; 7Var RetCode ) : Boolean; Function SOS_S_Write ( RefNumb : Integer; Var OutputBuf; OffSet, 9NumbBytes : Integer; Var RetCode ) : Boolean; Function SOS_Close ( RefNumb : Integemb : Integer; Var InputBuf; BytesReq : Integer; 6Var BytesRead, RetCode ) : Boolean; Function SOS_S_Read ( RefNumb : Integer; Var InputBuf; OffSet, 8BytesReq :Integer; Var BytesRead, RetCode ) : Boolean; External; Function SOS_Set_Time; External; Function SOS_Get_Time; External; Function SOS_Get_Analog; External; Function SOS_Terminate; External; {$ENDC} {$IFC SOS_Memory_Mgt} Function SOS_Request_Seg; External; Function SOS_Find_Seg; External; Function SOS_Change_Seg; External; Function SOS_G_Seg_Info; External; Function SOS_G_Seg_Numb; External; Function SOS_Rel_Seg; External; {$ENDC} {$IFC SOS_Plus_IO} Function Up_Load; External; Function At_Sign; External; {$ENDC} Procedure SOS6RetCode ); Procedure SOS_New_Line ( RefNumb, Flag : Integer; NewCh : Char; Var RetCode ); Procedure SOS_Read ( RefNumb : Integer; Var InputBuf; BytesReq : Integer; 6Var BytesRead, RetCode ); Procedure SOS_S_Read ( RefNumb : Integer; Var InputBuf; Offar DevName, VolName, TotalBlks, FreeBlks, RetCode ); Procedure SOS_Set_Prefix ( Var Prefix, RetCode ); Procedure SOS_Get_Prefix ( Var Prefix; Length : Integer; Var RetCode ); Procedure SOS_Open ( Var Path; ReqType, Pages : Integer; Var SysBuf, RefNumb, Procedure SOS_Rename ( Var OldPath, NewPath, RetCode ); Procedure SOS_Set_Info ( Var Pathname, FileList; ListLeng : Integer; :Var RetCode ); Procedure SOS_Get_Info ( Var Pathname, FileList; ListLeng : Integer; :Var RetCode ); Procedure SOS_Volume ( Vnfo ( DevNo : Integer; Var DevName, DevList, RetCode ); {$ENDC} {$IFC SOS_File_IO} Procedure SOS_Create ( Var Pathname; FileID, AuxID, Storage, EOFBlk : Integer; 8Var RetCode ); Procedure SOS_Destroy ( Var Pathname, RetCode ); O} Procedure SOS_D_Status ( DevNumb, StatusCode : Integer; :Var StatusList, RetCode ); Procedure SOS_D_Control ( DevNumb, ControlCode : Integer; ;Var ControlList, RetCode ); Procedure SOS_Get_D_Nmb ( Var DevName, DevNumb, RetCode ); Procedure SOS_D_I$ENDC} Interface { Set to TRUE to compile SOS calls for: } {$SETC SOS_File_IO := TRUE} {$SETC SOS_Device_IO := TRUE} {$SETC SOS_Utility_IO := TRUE} {$SETC SOS_Memory_Mgt := TRUE} {$SETC SOS_Plus_IO := TRUE} {$IFC SOS_Device_I {^he ""SOS Interface--February 1, 1983--Version 1.1" } {^fo ''Page %'IPSOSIO' } {^zs} {^kw } {$C Copyright 1981 1982 1983 Apple Computer Inc.} {$SETC Intrinsic_Unit := TRUE} { File IPSOSIO } Unit PSOSIO; {$IFC Intrinsic_Unit} Intrinsic CODE 58; {)+,-./01234567A RO^ˡ_Data; External; End. { Of Unit SOS } Set, BytesReq 8: Integer; Var BytesRead, RetCode ); Procedure SOS_Write ( RefNumb : Integer; Var OutputBuf; NumbBytes : Integer; 7Var RetCode ); Procedure SOS_S_Write ( RefNumb : Integer; Var OutputBuf; OffSet, 9NumbBytes : Integer; Var RetCode ); Procedure SOS_Close ( RefNumb : Integer; Var RetCode ); Procedure SOS_Flush ( RefNumb : Integer; Var RetCode ); Procedure SOS_Get_B_Mark ( RefNumb : Integer; Var BlockNumb, RetCode ); Procedure SOS_Get_B_EOF ( RefNumb : Integer; Var BlockNumb, RetCode rocedure SOS_Rel_Seg; External; {$ENDC} {$IFC SOS_Plus_IO} Procedure Up_Load; External; Function At_Sign; External; {$ENDC} Procedure SOS_Data; External; End. { Of Unit SOS } Procedure SOS_Terminate; External; {$ENDC} {$IFC SOS_Memory_Mgt} Procedure SOS_Request_Seg; External; Procedure SOS_Find_Seg; External; Procedure SOS_Change_Seg; External; Procedure SOS_G_Seg_Info; External; Procedure SOS_G_Seg_Numb; External; PS_Get_Lev; External; {$ENDC} {$IFC SOS_Utility_IO} Procedure SOS_S_Fence; External; Procedure SOS_G_Fence; External; Procedure SOS_Set_Time; External; Procedure SOS_Get_Time; External; Procedure SOS_Get_Analog; External; rocedure SOS_Set_B_Mark; External; Procedure SOS_Set_B_EOF; External; Procedure SOS_Get_Mark; External; Procedure SOS_Get_EOF; External; Procedure SOS_Set_Mark; External; Procedure SOS_Set_EOF; External; Procedure SOS_Set_Lev; External; Procedure SOS_Read; External; Procedure SOS_S_Read; External; Procedure SOS_Write; External; Procedure SOS_S_Write; External; Procedure SOS_Close; External; Procedure SOS_Flush; External; Procedure SOS_Get_B_Mark; External; Procedure SOS_Get_B_EOF; External; P Procedure SOS_Set_Info; External; Procedure SOS_Get_Info; External; Procedure SOS_Volume; External; Procedure SOS_Set_Prefix; External; Procedure SOS_Get_Prefix; External; Procedure SOS_Open; External; Procedure SOS_New_Line; External; Procedure SO_Status; External; Procedure SOS_D_Control; External; Procedure SOS_Get_D_Nmb; External; Procedure SOS_D_Info; External; {$ENDC} {$IFC SOS_File_IO} Procedure SOS_Create; External; Procedure SOS_Destroy; External; Procedure SOS_Rename; External; SegNumb, RetCode ); Procedure SOS_Rel_Seg ( SegNumb : Integer; Var RetCode ); {$ENDC} {$IFC SOS_Plus_IO} Procedure Up_Load ( Var Char_Set ); Function At_Sign ( Var Object ) : Integer; {$ENDC} Implementation {$IFC SOS_Device_IO} Procedure SOS_Dure SOS_Find_Seg ( SrchMode, SegId : Integer; Var FiveInts ); Procedure SOS_Change_Seg ( SegNumb, ChgMode : Integer; Var Pages, =RetCode ); Procedure SOS_G_Seg_Info ( SegNumb : Integer; Var FiveInts ); Procedure SOS_G_Seg_Numb ( SegAddr : Integer; Var Procedure SOS_Get_Time ( Var Time ); Procedure SOS_Get_Analog ( Mode : Integer; Var Value, RetCode ); Procedure SOS_Terminate; {$ENDC} {$IFC SOS_Memory_Mgt} Procedure SOS_Request_Seg ( Base, Limit, SegId : Integer; Var SegNumb, =RetCode ); Proced Procedure SOS_Get_Lev ( Var Level : Integer ); {$ENDC} {$IFC SOS_Utility_IO} Procedure SOS_S_Fence ( Priority : Integer ); Procedure SOS_G_Fence ( Var Priority : Integer ); Procedure SOS_Set_Time ( Var Time ); fNumb : Integer; Var Low, Hi, RetCode ); Procedure SOS_Set_Mark ( RefNumb, Base, Low, Hi : Integer; Var RetCode ); Procedure SOS_Set_EOF ( RefNumb, Base, Low, Hi : Integer; Var RetCode ); Procedure SOS_Set_Lev ( Level : Integer; Var RetCode : Integer );); Procedure SOS_Set_B_Mark ( RefNumb, Base, BlockNumb : Integer; Var RetCode ); Procedure SOS_Set_B_EOF ( RefNumb, Base, BlockNumb : Integer; Var RetCode ); Procedure SOS_Get_Mark ( RefNumb : Integer; Var Low, Hi, RetCode ); Procedure SOS_Get_EOF ( ReA Q B HHHO^rO^FINCLUDE SOSPLUS.TEXT 0.ENDC 0 0.INCLUDE SOSDATA.TEXT 0.END SOSDEV.TEXT 0.ENDC 0 0.IF FILEIO 0.INCLUDE SOSFILE.TEXT 0.ENDC 0 0.IF UTILIO 0.INCLUDE SOSUTIL.TEXT 0.ENDC 0 0.IF MEMMGT 0.INCLUDE SOSMEM.TEXT 0.ENDC 0 0.IF PLUSIO 0. ; " " MEMMGT .EQU 01 ; " " PLUSIO .EQU 01 ; " " ; 0.INCLUDE SOSEQUS.TEXT 0.INCLUDE SOSIOMAC.TEXT 0 0.IF DEVICEIO 0.INCLUDE FUNCTION .EQU 01 ;01 = .FUNC; 00 = .PROC DEVICEIO .EQU 01 ;01 = TRUE; 00 = FALSE FILEIO .EQU 01 ; " " UTILIO .EQU 01 inked to the function version of the interface, SOSIO or ISOSIO. ; If it is 00, the routines will be procedures and the object file ; should be linked to the procedure version IPSOSIO. ; ***************************************** 0.NOMACROLIST 0.NOPATCHLIST ; ; Conditional assembly directives : a TRUE setting assembles the ; specified routines. ; ; If FUNCTION is 01, the routines will be functions and should be ; l and files which comprise the assembly language routines of the ; Apple III Pascal/SOS interface. ; ; Version 1.1 ; ; Copyright 1981, 1982, 1983 Apple Computer, Inc. ; ;*************************************0.TITLE "Assembly routines for SOSIO--1 February 1983" 0.PAGE ;****************************************************************************** ; ; File ASMSOS.TEXT: ; ; This is the file which coordinates the multiple diskettes ; 8:;<=>?ABCDEFGHI50 .EQU ZPAGEF ZTEMP51 .EQU ZPAGE10 ZTEMP52 .EQU ZPAGE11 ZTEMP60 .EQU ZPAGE12 ZTEMP61 .EQU ZPAGE13 ; ; SOS Call Codes ; REQSEG .EQU 040 ZPAGE8 ZTEMP21 .EQU ZPAGE9 ZTEMP22 .EQU ZPAGEA ZTEMP30 .EQU ZPAGEB ZTEMP31 .EQU ZPAGEC ZTEMP40 .EQU ZPAGED ZTEMP41 .EQU ZPAGEE ZTEMPZTEMP02 .EQU ZPAGE2 ZTEMP03 .EQU ZPAGE3 ZTEMP10 .EQU ZPAGE4 ZTEMP11 .EQU ZPAGE5 ZTEMP12 .EQU ZPAGE6 ZTEMP13 .EQU ZPAGE7 ZTEMP20 .EQU EG4 ZREG20 .EQU ZREG5 ZREG30 .EQU ZREG6 ZREG50 .EQU ZREG7 ; ; Temporary Register Map ; ZTEMP00 .EQU ZPAGE0 ZTEMP01 .EQU ZPAGE1 028 RETURN1 .EQU 02A ; ; Register Map ; ZREG00 .EQU ZREG0 ZREG01 .EQU ZREG1 ZREG02 .EQU ZREG2 ZREG10 .EQU ZREG3 ZREG11 .EQU ZR4 ZREG3 .EQU 0E6 ZREG4 .EQU 0E8 ZREG5 .EQU 0EA ZREG6 .EQU 0EC ZREG7 .EQU 0EE ; ; Return Address Zero page locations ; RETURN0 .EQU ZPAGE11 .EQU 022 ZPAGE12 .EQU 024 ZPAGE13 .EQU 026 ; ; Permanent Zero Page registers ; ZREG0 .EQU 0E0 ZREG1 .EQU 0E2 ZREG2 .EQU 0E 014 ZPAGEB .EQU 016 ZPAGEC .EQU 018 ZPAGED .EQU 01A ZPAGEE .EQU 01C ZPAGEF .EQU 01E ZPAGE10 .EQU 020 006 ZPAGE4 .EQU 008 ZPAGE5 .EQU 00A ZPAGE6 .EQU 00C ZPAGE7 .EQU 00E ZPAGE8 .EQU 010 ZPAGE9 .EQU 012 ZPAGEA .EQU SCHAR&00FF ; -> LSB SOSCHHB .EQU SOSCHAR/256. ; -> MSB ; ; Temporary Zero Page Registers ; ZPAGE0 .EQU 000 ZPAGE1 .EQU 002 ZPAGE2 .EQU 004 ZPAGE3 .EQU  .TITLE "SOSIO Equates" ; ; Extended Page Equates ; XPGSTART .EQU 1600 INITXPG .EQU 16EF SOSCHAR .EQU 0C00 ;SOS character set image SOSCHLB .EQU SO FINDSEG .EQU 041 CHANGESEG .EQU 042 GSEGINFO .EQU 043 GSEGNUMB .EQU 044 RELSEG .EQU 045 SETFENCE .EQU 060 GETFENCE .EQU 061 SETTIME .EQU 062 GETTIME .EQU 063 ANALOG .EQU 064 TERMINATE .EQU 065 DSTATUS .EQU 082 DCONTROL .EQU 083 GETDEVNO .EQU 084 DINF0.MACRO POP 0PLA 0STA %1 0PLA 0STA %1+1 0.ENDM 0 ; ; Pushes the return address in the location specified. ; 0.MACRO PUSH 0LDA %1+1 ;High byte first 0PHA 0LDA %1 rameter ; format is: ; ; SOSCALL (SOS Call Number),(SOS Block Pointer) ; 0.MACRO SOSCALL 0BRK 0.BYTE %1 0.WORD %2 0.ENDM ; ; Saves the return address in the location specified ; N 0JSR PUSHBOOL 0.ENDC 0.ENDM ; ; Call the specified SOS service using "SOSBLK" ; 0.MACRO SOS 0BRK 0.BYTE %1 0.WORD SOSBLK 0.ENDM ; ; Call the specified SOS block (i.e. execute the call). The pa Removes the bias for a "FLAGGED" Pascal Function ; 0.MACRO FUNCBIAS 0.IF FUNCTION 0PLA 0PLA 0PLA 0PLA 0.ENDC 0.ENDM ; ; Pushes a "TRUE" if A = 0; otherwise a "FALSE". ; 0.MACRO RETVAL 0.IF FUNCTIO0.TITLE "SOS_IO Specific Macros" ; ; (File SOSIOMAC.TEXT) ; ; ; Generates the ".FUNC" or ".PROC" statement ; 0.MACRO FUNCPROC 0.IF FUNCTION 0.FUNC %1,%2 0.ELSE 0.PROC %1,%2 0.ENDC 0.ENDM ; ; JLMNOPQRA ^O^ա .EQU 0CD SETMARK .EQU 0CE GETMARK .EQU 0CF SETEOF .EQU 0D0 GETEOF .EQU 0D1 SETLEVEL .EQU 0D2 GETLEVEL .EQU 0D3 .EQU 0C6 GETPRE .EQU 0C7 OPEN .EQU 0C8 NEWLINE .EQU 0C9 READ .EQU 0CA WRITE .EQU 0CB CLOSE .EQU 0CC FLUSH O .EQU 085 CREATE .EQU 0C0 DESTROY .EQU 0C1 RENAME .EQU 0C2 SETINFO .EQU 0C3 GETINFO .EQU 0C4 VOLUME .EQU 0C5 SETPRE 0PHA 0.ENDM ; ; Removes the bias for a Pascal Function ; 0.MACRO RMVBIAS 0PLA 0PLA 0PLA 0PLA 0.ENDM ; ; Moves Location1 -> Location2 ; 0.MACRO MOVE 0LDA %1 0STA %2 0LDA %1+1 0STA %2+1 0.ENDM ; ; Initializes the specified zero page registers to access the switched ; in bank (i.e. standard addressing). From one to four zero page ; addresses may be specified. ; ; A is destroyed, X and Y remain as DevNumb value. ; ; Exit - SOS return code. ; ; Global Registers Used: ; ; ZREG00, ZREG01 ; ; Coroutines Used: ; ; CODSTCNT ; ;****************************************************************************** ;OS DSTATUS call; returning a status list and ; the SOS return code. ; ; Date Entered: November 17, 1980 ; ; Revisions Made: ; ; Stack Usage: ; ; Entry - Return code, StatusList pointer, StatusCode value, ; ; ; File SOSDEV.TEXT ; 0.TITLE "SOS DSTATUS" 0FUNCPROC SOSDSTATUS,4 ;****************************************************************************** ; ; Name: SOSDSTATUS ; ; Level/Kind: 0 ; ; Purpose: To perform a SSUVWXYZ[\]^_`aA O^0STA XPGSTART+1+%3 0.ELSE 0.IF "%2"<>"" 0STA XPGSTART+1+%2 0.ENDC 0.ENDC 0.ENDC 0.ENDM is. ; 0.MACRO LOCALREG 0LDA #0 0STA XPGSTART+1+%1 0.IF "%4"<>"" 0STA XPGSTART+1+%2 0STA XPGSTART+1+%3 0STA XPGSTART+1+%4 0.ELSE 0.IF "%3"<>"" 0STA XPGSTART+1+%2 0.REF COSTCNTC,CODSTCNT ; 0LDA #DSTATUS 0STA COSTCNTC ;Set the DSTATUS code 0JMP CODSTCNT ;Jump to the coroutine 0.TITLE "SOS DCONTROL" 0FUNCPROC SOSDCONTROL,4 ;****************************************************************************** ; ; Name: SOSDCONTROL ; ; Level/Kind: 0 ; ; Purpose: To perform a SOS DCONTROL call; returning the SOS ; return code. ; ; Date Entered: Name ptr., device #. ; ; Global Registers Used: ; ; ZREG00, ZREG01, ZREG02 ; ;****************************************************************************** ; 0.REF PARAM0,PARAM1,PARAM2,PARAM3,PARAM4 0.REF PARAM5,; Level/Kind: 0 ; ; Purpose: To perform a SOS DINFO call, picking up all of the information. ; ; Date Entered: December 5, 1980 ; ; Revisions Made: ; ; Stack Usage: ; ; Return code ptr., device list ptr, device n0STA (ZREG01),Y ;MSB device number 0PUSH RETURN0 0RTS 0.TITLE "SOS DINFO call" 0FUNCPROC SOSDINFO,4 ;****************************************************************************** ; ; Name: SOSDINFO ; ;Assume Y = 0 0STA (ZREG02),Y ;Post return code LSB 0LDA PARAM3 0STA (ZREG01),Y ;LSB device number 0TYA 0INY 0STA (ZREG02),Y ;MSB return code #2. 0STA PARAM0 ;Parameter count 0LDA #ZREG00 0STA PARAM1 0LDY #0. 0STY PARAM2 ;Pointer to device name & Y 0SOS GETDEVNO ;Issue request to SOS 0RETVALARAM1,PARAM2,PARAM3,SOSBLK,PUSHBOOL ; 0POP RETURN0 0FUNCBIAS 0POP ZREG02 ;Return code ptr. 0POP ZREG01 ;Device number ptr. 0POP ZREG00 ;Device name string ptr. 0LDA ; Date Entered: September 10, 1981 ; ; Revisions Made: ; ; Stack usage: Return code ptr., Device number ptr., Device Name ptr. ; ;****************************************************************************** ; 0.REF PARAM0,Pet the device number" 0FUNCPROC SOSGETDNMB,3 ;****************************************************************************** ; ; Name: SOSGETDNMB ; ; Level/Kind: 0 ; ; Purpose: Gets the device number of the passed device name. ; YTE 0. 0.WORD SOSBLK 0RETVAL ;Assume Y = 0 0STA (ZREG01),Y ;LSB return code 0TYA 0INY 0STA (ZREG01),Y ;MSB return code 0PUSH RETURN0 0RTS 0.TITLE "G PARAM2 ;Status/control Code 0PLA 0PLA 0STA PARAM1 ;DevNumb 0PLA 0LDA #3. 0STA PARAM0 ;Parameter count 0BRK ;Issue request to SOS COSTCNTC .B0POP ZREG00 ;Status/control list (pointer) 0LDA #ZREG00 0STA PARAM3 ;LSB Status/control list ZREG 0LDY #0. 0STY PARAM4 ;MSB Status/control list ZREG&Y 0PLA 0STA PARAM0,PARAM1,PARAM2,PARAM3,PARAM4 ; 0LDA #DCONTROL 0STA COSTCNTC ;Set the DSTATUS code CODSTCNT POP RETURN0 0FUNCBIAS 0POP ZREG01 ;Return code ptr. 00, ZREG01 ; ; Global Variables Used: ; ; RETURN0, SOSBLK, PARAM0-4 ; ;****************************************************************************** ; 0.DEF COSTCNTC,CODSTCNT 0.REF SOSBLK,PUSHBOOL 0.REF ovember 17, 1980 ; ; Revisions Made: ; ; Stack Usage: ; ; Entry - Return code, StatusList pointer, StatusCode value, ; DevNumb value. ; ; Exit - SOS return code. ; ; Global Registers Used: ; ; ZREGPARAM6,SOSBLK,PUSHBOOL ; 0POP RETURN0 0FUNCBIAS 0POP ZREG02 ;Return code ptr. 0POP ZREG01 ;Dev. list ptr. 0POP ZREG00 ;Dev. name ptr. 0PLA 0STA PARAM1 0PLA 0LDY #0. 0STY PARAM3 0STY PARAM5 ;Init Y & ZREG ptr. MSB 0LDA #ZREG00 0STA PARAM2 ;Dev. name ZREG 0LDA #ZREG01 0STA PARAM4 ;Dev. list ZREG0STY PARAM10 0STY PARAM13 ;First and fourth bytes 0STY PARAM2 ;ZREG MSB 0PLA 0STA PARAM9 ;Storage type 0PLA 0POP PARAM7 ;Aux. ID 0PLA 0STA P0 0FUNCBIAS 0POP ZREG01 ;SOS return code ptr. 0PLA 0ASL A 0STA PARAM11 ;Second byte 0PLA 0ROL A 0STA PARAM12 ;Third byte 0LDY #0. ************************************************************* ; 0.REF PARAM0,PARAM1,PARAM2,PARAM3,PARAM5 0.REF PARAM6,PARAM7,PARAM9,PARAM10,PARAM11,PARAM12 0.REF PARAM13,PTRPRM6,SOSBLK,PUSHBOOL ; 0POP RETURNe ptr., EOF blocks, Storage type, Auxiliary id, ; File id, Pathname ptr. ; ; Global Registers Used: ; ; ZREG00, ZREG01 ; ; Files Used: ; ; Creates a file upon successful completion. ; ;*****************0.TITLE "SOS CREATE" ; ; SOSFILE -- SOS file calls ; 0FUNCPROC SOSCREATE,6 ;****************************************************************************** ; ; Name: SOSCREATE ; ; Stack Usage: ; ; Return codbdefghijklmnopqrstuvwxyz{|}~A G>O^B2),Y 0TYA 0INY 0STA (ZREG02),Y ;Post return code 0PUSH RETURN0 0RTS 0 0LDA #9. 0STA PARAM6 ;Length 0LDA #4. 0STA PARAM0 ;Param count 0SOS DINFO ;Issue SOS call 0RETVAL ;Assume Y = 0 0STA (ZREG0ARAM6 ;File ID 0PLA 0LDA #8. 0STA PARAM5 ;Length 0MOVE PTRPRM6,PARAM3 ;Create list pointer 0POP ZREG00 ;Pathname ptr. 0LDA #ZREG00 0STA PARAM1 ;ZREG ptr. LSB 0LDA #3. 0STA PARAM0 ;Parameter count 0SOS CREATE ;Issue SOS call (assume Y =0) 0RETVAL 0STA (ZREG01),Y ;Return code LSB 0TYA 0INY 0STA (ZREG01),Y 0FUNCPROC SOSGETINFO,4 ;****************************************************************************** ; ; Name: SOSGETINFO ; ; Stack Usage: ; ; Return code ptr., List length, File list ptr., Pathname ptr. ; ; Global********************************* ; 0.REF COINFO,SSGINFO ; 0LDA #SETINFO 0STA SSGINFO ;Set the SOS call to SETINFO 0JMP COINFO ;Go to the coroutine 0.TITLE "SOS GETINFO" SOSGETINFO is used to ; execute the call. ; ; Global Registers Used: ; ; ZREG00, ZREG01. ; ; Files Used: ; ; The passed pathname is used in the SOS call. ; ;*********************************************NFO,4 ;****************************************************************************** ; ; Name: SOSSETINFO ; ; Stack Usage: ; ; Return code ptr., List length, File list ptr., ; Pathname ptr. The COINFO coroutine in 0SOS RENAME ;Issue SOS call (assume Y = 0) 0RETVAL 0STA (ZREG02),Y 0TYA 0INY 0STA (ZREG02),Y ;Post return code 0PUSH RETURN0 0RTS 0.TITLE "SOS SETINFO" 0FUNCPROC SOSSETI PARAM2 0LDA #ZREG01 0STA PARAM3 ;New path ZREG 0LDA #ZREG00 0STA PARAM1 ;Old path ZREG 0LDA #2. 0STA PARAM0 ;Param. count LK,PUSHBOOL ; 0POP RETURN0 0FUNCBIAS 0POP ZREG02 ;Return code ptr. 0POP ZREG01 ;New path ptr. 0POP ZREG00 ;Old path ptr. 0LDY #0. 0STY PARAM4 0STY G00, ZREG01, ZREG02. ; ; Files Used: ; ; File pointed to by passed pathname. ; ;****************************************************************************** ; 0.REF PARAM0,PARAM1,PARAM2,PARAM3,PARAM4 0.REF SOSB;****************************************************************************** ; ; Name: SOSRENAME ; ; Stack Usage: ; ; Return code ptr., New pathname ptr., Old pathname ptr. ; ; Global Registers Used: ; ; ZRE (ZREG01),Y 0TYA 0INY 0STA (ZREG01),Y ;Post return code 0PUSH RETURN0 0RTS 0.TITLE "SOS RENAME" 0FUNCPROC SOSRENAME,3 TY PARAM2 0LDA #ZREG00 0STA PARAM1 ;Pathname ZREG number 0LDA #1. 0STA PARAM0 ;Param. count 0SOS DESTROY ;Issue SOS call (assume Y = 0) 0RETVAL 0STA ********************************* ; 0.REF PARAM0,PARAM1,PARAM2,SOSBLK,PUSHBOOL ; 0POP RETURN0 0FUNCBIAS 0POP ZREG01 ;Return code ptr. 0POP ZREG00 ;Pathname ptr. 0LDY #0. 0S; Return code ptr., Pathname ptr ; ; Global Registers Used: ; ; ZREG00, ZREG01 ; ; Files Used: ; ; Attempts to destroy the file with the passed pathname. ; ;********************************************* ;MSB 0PUSH RETURN0 0RTS 0.TITLE "SOS DESTROY" 0FUNCPROC SOSDESTROY,2 ;****************************************************************************** ; ; Name: SOSDESTROY ; ; Stack Usage: ; Registers Used: ; ; ZREG00, ZREG01, ZREG02. ; ; Files Used: ; ; The passed pathname is used in the SOS call. ; ;****************************************************************************** ; 0.REF PARAM0,PARAM1,PARAM2,PARAM3,PARAM4 0.REF PARAM5,SOSBLK,PUSHBOOL 0.DEF COINFO,SSGINFO ; 0LDA #GETINFO 0STA SSGINFO ;Set the SOS GETINFO call COINFO POP RETURN0 0FUNCBIAS 0POP 0SOS SETPRE ;Issue SOS call (assume Y = 0) 0RETVAL 0STA (ZREG01),Y 0TYA 0INY 0STA (ZREG01),Y ;Post return code 0PUSH RETURN0 0RTS 0.TITLE "SOS GETPREFIX" 0FUNCPROC SOSGE ;Prefix path ptr. 0LDY #0. 0STY PARAM2 0LDA #ZREG00 0STA PARAM1 ;Prefix path ZREG 0LDA #1. 0STA PARAM0 ; ;****************************************************************************** ; 0.REF PARAM0,PARAM1,PARAM2,SOSBLK,PUSHBOOL ; 0POP RETURN0 0FUNCBIAS 0POP ZREG01 ;Return code ptr. 0POP ZREG00 ;****************************************************************************** ; ; Name: SOSSETPREFIX ; ; Stack Usage: ; ; Return code ptr., Prefix pathname ptr. ; ; Global Registers Used: ; ; ZREG00, ZREG01. 0LDA PARAM8 0STA (ZREG3),Y ;MSB # free blocks 0LDA PARAM6 0STA (ZREG2),Y ;MSB # total blocks 0PUSH RETURN0 0RTS 0.TITLE "SOS SETPREFIX" 0FUNCPROC SOSSETPREFIX,2 ost LSB return code 0LDA PARAM7 0STA (ZREG3),Y ;LSB # free blocks 0LDA PARAM5 0STA (ZREG2),Y ;LSB # total blocks 0TYA 0INY 0STA (ZREG4),Y ;MSB return code 0LDA #ZREG0 0STA PARAM1 ;Device name ZREG 0LDA #4. 0STA PARAM0 ;Param. count 0SOS VOLUME ;Issue SOS call (assume Y = 0) 0RETVAL 0STA (ZREG4),Y ;P. 0POP ZREG1 ;Volume name ptr. 0POP ZREG0 ;Device name ptr. 0LDY #0. 0STY PARAM4 0STY PARAM2 0LDA #ZREG1 0STA PARAM3 ;Volume name ZREG 0.REF PARAM5,PARAM6,PARAM7,PARAM8,SOSBLK,PUSHBOOL ; 0POP RETURN0 0FUNCBIAS 0POP ZREG4 ;Return code ptr. 0POP ZREG3 ;Free blocks ptr. 0POP ZREG2 ;Total blocks ptr Global Registers Used: ; ; ZREG0, ZREG1, ZREG2, ZREG3, ZREG4. ; ;****************************************************************************** ; 0.REF PARAM0,PARAM1,PARAM2,PARAM3,PARAM4 ************************************************************************* ; ; Name: SOSVOLUME ; ; Stack Usage: ; ; Return code ptr., Free blocks ptr., Total blocks ptr., ; Volume name ptr., Device name ptr. ; ; NFO .BYTE 0 0.WORD SOSBLK 0RETVAL 0STA (ZREG02),Y 0TYA 0INY 0STA (ZREG02),Y ;Post return code 0PUSH RETURN0 0RTS 0.TITLE "SOS VOLUME" 0FUNCPROC SOSVOLUME,5 ;*****0STY PARAM2 0LDA #ZREG01 0STA PARAM3 ;File list ZREG 0LDA #ZREG00 0STA PARAM1 ;Pathname ZREG 0LDA #3. 0STA PARAM0 ;Param. count 0BRK SSGI ZREG02 ;Return code ptr. 0PLA 0STA PARAM5 ;List return length 0PLA 0POP ZREG01 ;File list ptr. 0POP ZREG00 ;Pathname ptr. 0LDY #0. 0STY PARAM4 TPREFIX,3 ;****************************************************************************** ; ; Name: SOSGETPREFIX ; ; Stack Usage: ; ; Return code ptr., Maximum prefix length, Prefix pathname ptr. ; ; Global Registers Used: ; ; ZREG00, ZREG01. ; ;****************************************************************************** ; 0.REF PARAM0,PARAM1,PARAM2,PARAM3,SOSBLK,PUSHBOOL ; 0POP RETURN0 0FUNCBIAS 0POP ZREG01 ;Ret0LDA #3. 0STA PARAM0 ;Param. count 0SOS NEWLINE 0RETVAL 0LDY #0. 0STA (ZREG00),Y ;LSB return code 0TYA 0INY 0STA (ZREG00),Y ;MSB return code 0PUSH POP ZREG00 ;Return code ptr. 0PLA 0STA PARAM3 ;New line character 0PLA 0PLA 0STA PARAM2 ;New line on/off 0PLA 0PLA 0STA PARAM1 ;Reference number 0PLA with the passed reference ; number. ; ;****************************************************************************** ; 0.REF PARAM0,PARAM1,PARAM2,PARAM3 0.REF SOSBLK,PUSHBOOL ; 0POP RETURN0 0FUNCBIAS 0; Stack Usage: ; ; Return code ptr., Newline character, Newline on/off, ; Reference number ; ; Global Registers Used: ; ; ZREG00 ; ; Files Used: ; ; Sets the newline mode of the file0STA (ZREG2),Y ;Reference number 0PUSH RETURN0 0RTS 0.TITLE "SOS NEWLINE" 0FUNCPROC SOSNEWLINE,4 ;****************************************************************************** ; ; Name: SOSNEWLINE ; athname ZREG 0SOS OPEN ;Call SOS (assume Y = 0) 0RETVAL 0STA (ZREG3),Y 0LDA PARAM3 0STA (ZREG2),Y 0TYA 0INY 0STA (ZREG3),Y ;Post the return code M0 ;Parameter count 0MOVE PTRPRM7,PARAM4 ;Open list ptr. 0PLA 0STA PARAM7 ;Request access type 0PLA 0POP ZREG0 ;Pathname ptr. 0LDA #ZREG0 0STA PARAM1 ;PSTY PARAM2 0LDA #ZREG1 0STA PARAM9 ;System buffer ZREG 0PLA 0STA PARAM8 ;# pages 0PLA 0LDA #4. 0STA PARAM6 ;Length of Open list 0STA PARA; 0POP RETURN0 0FUNCBIAS 0POP ZREG3 ;SOS return code ptr. 0POP ZREG2 ;Reference number ptr. 0POP ZREG1 ;System buffer ptr. 0LDY #0. 0STY PARAM10 0the passed pathname. ; ;****************************************************************************** ; 0.REF PARAM0,PARAM1,PARAM2,PARAM3,PARAM4 0.REF PARAM6,PARAM7,PARAM8,PARAM9,PARAM10,PTRPRM7 0.REF SOSBLK,PUSHBOOL ptr., Reference number ptr., System buffer ptr., ; # of pages value, Request access type, Pathname ptr. ; ; Global Registers Used: ; ; ZREG0, ZREG1, ZREG2, ZREG3. ; ; Files Used: ; ; Opens a file under turn code 0PUSH RETURN0 0RTS 0.TITLE "SOS OPEN" 0FUNCPROC SOSOPEN,6 ;****************************************************************************** ; ; Name: SOSOPEN ; ; Stack Usage: ; ; Return code 0STA PARAM1 ;Prefix path ZREG 0LDA #2. 0STA PARAM0 0SOS GETPRE ;Issue SOS call (assume Y = 0) 0RETVAL 0STA (ZREG01),Y 0TYA 0INY 0STA (ZREG01),Y ;Post reurn code ptr. 0PLA 0STA PARAM3 ;Maximum pathname length 0PLA 0POP ZREG00 ;Prefix path ptr. 0LDY #0. 0STY PARAM2 0LDA #ZREG00 RETURN0 0RTS 0.TITLE "SOS READ" 0FUNCPROC SOSREAD,5 ;****************************************************************************** ; ; Name: SOSREAD ; ; Stack Usage: ; ; Return code ptr., Bytes actually read ptr., Bytes requested, ; Input buffer ptr., Reference number ; ; Global Registers Used: ; ; ZREG00, ZREG01, ZREG02. ; ; Files Used: ; ; Reads from the file with the passed reference number. ; ;********0STA PARAM0 ;Parameter count 0SOS WRITE ;Issue call to SOS (Y = 0) 0RETVAL 0STA (ZREG01),Y 0TYA 0INY 0STA (ZREG01),Y ;MSB return code 0PUSH RETURN0 0RTS 0.TITLE ffer ptr. COWRITE PLA 0STA PARAM1 ;Reference number 0PLA 0LDY #0. 0STY PARAM3 ;0 -> MSB ZREG 0LDA #ZREG00 0STA PARAM2 ;LSB ZREG 0LDA #3. .REF PARAM0,PARAM1,PARAM2,PARAM3,PARAM4 0.REF SOSBLK,PUSHBOOL ; 0POP RETURN0 0FUNCBIAS 0POP ZREG01 ;Return code ptr. 0POP PARAM4 ;# bytes 0POP ZREG00 ;Bu Registers Used: ; ; ZREG00, ZREG01. ; ; Files Used: ; ; Writes to the file with the passed reference number. ; ;****************************************************************************** ; 0.DEF COWRITE 00FUNCPROC SOSWRITE,4 ;****************************************************************************** ; ; Name: SOSWRITE ; ; Stack Usage: ; ; Return code ptr., Number of bytes, Buffer ptr., Reference number ; ; GlobalG00 ;IBufPtr + OffSet (LSB) 0STA ZREG00 0PLA 0ADC ZREG00+1 ;IBufPtr + OffSet (MSB) 0STA ZREG00+1 0JMP CSREAD ;Go to SOSREAD coroutine 0.TITLE "SOS WRITE" RETURN0 0FUNCBIAS 0POP ZREG02 ;Return code ptr. 0POP ZREG01 ;Bytes read ptr. 0POP PARAM4 ;# bytes requested 0POP ZREG00 ;Offset 0PLA 0CLC 0ADC ZREs from the file with the passed reference number. ; ;****************************************************************************** ; 0.REF PARAM0,PARAM1,PARAM2,PARAM3,PARAM4 0.REF PARAM6,PARAM7,SOSBLK,PUSHBOOL,CSREAD ; 0POP ; Return code ptr., Bytes actually read ptr., Bytes requested, ; OffSet, Input buffer ptr., Reference number ; ; Global Registers Used: ; ; ZREG00, ZREG01, ZREG02. ; ; Files Used: ; ; Readread 0PUSH RETURN0 0RTS 0.TITLE "SOS (String) READ" 0FUNCPROC SOSSREAD,6 ;****************************************************************************** ; ; Name: SOSSREAD ; ; Stack Usage: ; ;Call SOS (assume Y = 0) 0RETVAL 0STA (ZREG02),Y 0LDA PARAM6 0STA (ZREG01),Y 0TYA 0INY 0STA (ZREG02),Y ;Return code 0LDA PARAM7 0STA (ZREG01),Y ;# bytes actually PARAM3 0LDA #ZREG00 0STA PARAM2 ;Input buffer ZREG 0PLA 0STA PARAM1 ;Reference # 0PLA 0LDA #4. 0STA PARAM0 ;Parameter count 0SOS READ 0POP ZREG02 ;Return code ptr. 0POP ZREG01 ;Bytes read ptr. 0POP PARAM4 ;# bytes requested 0POP ZREG00 ;Input buffer ptr. CSREAD LDY #0. 0STY ********************************************************************** ; 0.REF PARAM0,PARAM1,PARAM2,PARAM3,PARAM4 0.REF PARAM6,PARAM7,SOSBLK,PUSHBOOL 0.DEF CSREAD ; 0POP RETURN0 0FUNCBIAS "SOS (String) WRITE" 0FUNCPROC SOSSWRITE,5 ;****************************************************************************** ; ; Name: SOSSWRITE ; ; Purpose: ; Issues a SOS write request to the file with the passed reference ; number, AFTER adding in the offset to the buffer pointer. ; ; Stack Usage: ; ; Return code ptr., Number of bytes, OffSet, Buffer ptr., ; Reference number ; ; Global Registers Used: ; ; 0LDA #GETMARK 0STA SBMRKEOF COBMRKEOF POP ZREG00 ;Return code ptr. 0POP ZREG01 ;# of blocks ptr. 0PLA 0STA PARAM1 ;Reference number 0PLA 0LDA #2***************************************************************************** ; 0.DEF COBMRKEOF,SBMRKEOF 0.REF PARAM0,PARAM1,PARAM2,PARAM3,PARAM4 0.REF PARAM5,SOSBLK,PUSHBOOL ; 0POP RETURN0 0FUNCBIAS Stack Usage: ; ; Return code ptr., # of blocks ptr., Reference number ; ; Global Registers Used: ; ; ZREG00, ZREG01. ; ; Files Used: ; ; Gets the mark of the file with the ref. number passed. ; ;* ;Post the return code 0PUSH RETURN0 0RTS 0.TITLE "SOS GET (block address of) MARK" 0FUNCPROC SOSGETBMARK,3 ;****************************************************************************** ; ; Name: SOSGETBMARK ; ; 0STA PARAM1 ;Reference # 0PLA 0LDA #1. 0STA PARAM0 0SOS FLUSH ;Write out SOS buffer 0RETVAL 0LDY #0. 0STA (ZREG00),Y 0TYA 0INY 0STA (ZREG00),Y************************************************************************ ; 0.REF PARAM0,PARAM1,SOSBLK,PUSHBOOL ; 0POP RETURN0 0FUNCBIAS 0POP ZREG00 ;Return code ptr. 0PLA Name: SOSFLUSH ; ; Stack Usage: ; ; Return code ptr., Reference number. ; ; Global Registers Used: ; ; ZREG00 ; ; Files Used: ; ; Flushes the file with the passed reference number. ; ;****** (ZREG00),Y 0TYA 0INY 0STA (ZREG00),Y ;Post the return code 0PUSH RETURN0 0RTS 0.TITLE "SOS FLUSH" 0FUNCPROC SOSFLUSH,2 ;****************************************************************************** ; ; 0POP ZREG00 ;Return code ptr. 0PLA 0STA PARAM1 ;Reference # 0PLA 0LDA #1. 0STA PARAM0 0SOS CLOSE ;Distress signal 0RETVAL 0LDY #0. 0STA file with the passed reference number. ; ;****************************************************************************** ; 0.REF PARAM0,PARAM1,SOSBLK,PUSHBOOL ; 0POP RETURN0 0FUNCBIAS ******************************************** ; ; Name: SOSCLOSE ; ; Stack Usage: ; ; Return code ptr., Reference number. ; ; Global Registers Used: ; ; ZREG00 ; ; Files Used: ; ; Closes the ZREG00 0PLA 0ADC ZREG00+1 ;BufPtr + OffSet (MSB) 0STA ZREG00+1 0JMP COWRITE ;Go to SOSWRITE coroutine 0.TITLE "SOS CLOSE" 0FUNCPROC SOSCLOSE,2 ;**********************************0POP RETURN0 0FUNCBIAS 0POP ZREG01 ;Return code ptr. 0POP PARAM4 ;# bytes 0POP ZREG00 ;Offset 0PLA 0CLC 0ADC ZREG00 ;BufPtr + OffSet (LSB) 0STA ZREG00, ZREG01. ; ; Files Used: ; ; Writes to the file with the passed reference number. ; ;****************************************************************************** ; 0.REF COWRITE 0.REF PARAM4 ; . 0STA PARAM0 ;Parameter count 0BRK ;Call SOS SBMRKEOF .BYTE 0 0.WORD SOSBLK 0RETVAL 0LDY #0. 0STA (ZREG00),Y ;Post return code 0CLC 0LDA #0FF ;((mark + 511) div 512 ) P; mod 32768 0ADC PARAM2 0LDA #1. 0ADC PARAM3 0STA PARAM3 0TYA 0ADC PARAM4 ;High byte -> A 0ROR A 0T;****************************************************************************** ; ; Name: SOSGETMARK ; ; Stack Usage: ; ; Return code ptr., High byte count ptr., Low byte count ptr., ; Reference number ; ; Glob COBSMEOF,SSBMEOF ; 0POP RETURN0 0FUNCBIAS 0LDA #SETEOF 0STA SSBMEOF 0JMP COBSMEOF ;Jump to co-routine 0.TITLE "SOS GET MARK" 0FUNCPROC SOSGETMARK,4 erence number ; ; Global Registers Used: ; ; ZREG00 ; ; Files Used: ; ; Sets the EOF of the file with the ref. number passed. ; ;****************************************************************************** ; 0.REFSOS SET EOF (to block address)" 0FUNCPROC SOSSETBEOF,4 ;****************************************************************************** ; ; Name: SOSSETBEOF ; ; Stack Usage: ; ; Return code ptr., # of blocks, Base type, Ref0BRK ;Call SOS SSBMEOF .BYTE 0. 0.WORD SOSBLK 0RETVAL 0LDY #0. 0STA (ZREG00),Y 0TYA 0INY 0STA (ZREG00),Y 0PUSH RETURN0 0RTS 0.TITLE "0STA PARAM3 0STA PARAM6 0PLA 0STA PARAM2 ;Base type 0PLA 0PLA 0STA PARAM1 ;Reference number 0PLA 0LDA #3. 0STA PARAM0 ;Parameter count K 0STA SSBMEOF COBSMEOF POP ZREG00 ;Return code ptr. 0PLA 0ASL A ;Block # -> # of bytes 0STA PARAM4 0PLA 0ROL A 0STA PARAM5 0LDA #0. ***************************************************** ; 0.DEF COBSMEOF,SSBMEOF 0.REF PARAM0,PARAM1,PARAM2,PARAM3,PARAM4 0.REF PARAM5,PARAM6,SOSBLK,PUSHBOOL ; 0POP RETURN0 0FUNCBIAS 0LDA #SETMAR; Return code ptr., # of blocks, Base type, Reference number ; ; Global Registers Used: ; ; ZREG00 ; ; Files Used: ; ; Sets the mark of the file with the ref. number passed. ; ;************************* ;Go to the co-routine 0.TITLE "SOS SET MARK (to block address)" 0FUNCPROC SOSSETBMARK,4 ;****************************************************************************** ; ; Name: SOSSETBMARK ; ; Stack Usage: ; number passed. ; ;****************************************************************************** ; 0.REF COBMRKEOF,SBMRKEOF ; 0POP RETURN0 0FUNCBIAS 0LDA #GETEOF 0STA SBMRKEOF 0JMP COBMRKEOF ame: SOSGETBEOF ; ; Stack Usage: ; ; Return code ptr., # of blocks ptr., Reference number ; ; Global Registers Used: ; ; ZREG00, ZREG01. ; ; Files Used: ; ; Gets the EOF of the file with the ref. 0STA (ZREG01),Y ;MSB block count 0PUSH RETURN0 0RTS 0.TITLE "SOS GET (block address of) EOF" 0FUNCPROC SOSGETBEOF,3 ;****************************************************************************** ; ; NAX ;Save MSB block count -> X 0LDA PARAM3 ;Low byte -> A 0ROR A 0STA (ZREG01),Y ;LSB block count 0TYA 0INY 0STA (ZREG00),Y 0TXA al Registers Used: ; ; ZREG00, ZREG01, ZREG02 ; ; Files Used: ; ; Gets the byte mark of the file with the passed reference numb. ; ;****************************************************************************** ; 0.DEF COGMRKEF,GMARKEOF 0.REF PARAM0,PARAM1,PARAM2,PARAM3,PARAM4,PARAM5 0.REF SOSBLK,PUSHBOOL ; 0POP RETURN0 0FUNCBIAS 0LDA #GETMARK 0STA GMARKEOF COGMRKEF POP ZREG00 ; Return code ptr., High byte count, Low byte count, File Base, ; Reference number ; ; Global Registers Used: ; ; ZREG00 ; ; Files Used: ; ; Sets the byte EOF of the file with the passed rcode 0PUSH RETURN0 0RTS 0.TITLE "SOS SET EOF" 0FUNCPROC SOSSETEOF,5 ;****************************************************************************** ; ; Name: SOSSETEOF ; ; Stack Usage: ; PARAM0 ;Parameter count 0BRK ;Call SOS SMARKEOF .BYTE 0 0.WORD SOSBLK 0RETVAL 0LDY #0. 0STA (ZREG00),Y 0TYA 0INY 0STA (ZREG00),Y ;Post return PARAM5 ;High byte count 0POP PARAM3 ;Low byte count 0PLA 0STA PARAM2 ;From specified base 0PLA 0PLA 0STA PARAM1 ;Reference # 0PLA 0LDA #3. 0STA 0.REF PARAM0,PARAM1,PARAM2,PARAM3,PARAM5 0.REF SOSBLK,PUSHBOOL ; 0POP RETURN0 0FUNCBIAS 0LDA #SETMARK 0STA SMARKEOF COMRKEOF POP ZREG00 ;Return code ptr. 0POP EG00 ; ; Files Used: ; ; Sets the byte mark of the file with the passed reference numb. ; ;****************************************************************************** ; 0.DEF COMRKEOF,SMARKEOF *************************************** ; ; Name: SOSSETMARK ; ; Stack Usage: ; ; Return code ptr., High byte count, Low byte count, File Base, ; Reference number ; ; Global Registers Used: ; ; ZRF ; 0POP RETURN0 0FUNCBIAS 0LDA #GETEOF 0STA GMARKEOF 0JMP COGMRKEF ;Jump to the co-routine 0.TITLE "SOS SET MARK" 0FUNCPROC SOSSETMARK,5 ;***************************************; ZREG00, ZREG01, ZREG02 ; ; Files Used: ; ; Gets the EOF of the file with the passed reference number. ; ;****************************************************************************** ; 0.REF COGMRKEF,GMARKEO********************************* ; ; Name: SOSGETEOF ; ; Stack Usage: ; ; Return code ptr., High byte count ptr., Low byte count ptr., ; Reference number ; ; Global Registers Used: ; ARAM3 0STA (ZREG02),Y ;Low MSB 0LDA PARAM5 0STA (ZREG01),Y ;Hi MSB 0PUSH RETURN0 0RTS 0.TITLE "SOS GET EOF" 0FUNCPROC SOSGETEOF,4 ;********************************************* (ZREG00),Y ;Assume Y = 0 0LDA PARAM2 0STA (ZREG02),Y ;Low LSB 0LDA PARAM4 0STA (ZREG01),Y ;Hi LSB 0TYA 0INY 0STA (ZREG00),Y ;Post return code MSB 0LDA P0STA PARAM0 ;Parameter count 0LDY #0. 0STY PARAM5 ;Zero out the 4th byte 0BRK ;Call SOS GMARKEOF .BYTE 0 0.WORD SOSBLK 0RETVAL 0STA ;Return code ptr. 0POP ZREG01 ;High byte count ptr. 0POP ZREG02 ;Low byte count ptr. 0PLA 0STA PARAM1 ;Reference # 0PLA 0LDA #2. eference number. ; ;****************************************************************************** ; 0.REF COMRKEOF,SMARKEOF ; 0POP RETURN0 0FUNCBIAS 0LDA #SETEOF 0STA SMARKEOF 0JMP COMRKEOF ;Jump to the co-routine 0.TITLE "Set the system open/close level" 0FUNCPROC SOSSETLEV,2 ;****************************************************************************** ; ; Name: SOSSETLEV ; ; Stack Usage: ; ; A jO^B0LDA PARAM1 0STA (ZREG00),Y ;LSB level 0TYA 0INY 0STA (ZREG00),Y ;MSB level = 0 0PUSH RETURN0 0RTS 0 ************************ ; 0.REF PARAM0,PARAM1,SOSBLK,PUSHBOOL ; 0POP RETURN0 0FUNCBIAS 0POP ZREG00 0LDA #1 0STA PARAM0 0SOS GETLEVEL 0RETVAL 0LDY #0 **************************************************** ; ; Name: SOSGETLEV ; ; Stack Usage: ; ; New file level ptr. ; ; Global Registers Used: ; ; ZREG00 ; ;******************************************************L 0LDY #0 0STA (ZREG00),Y ;LSB return code 0TYA 0INY 0STA (ZREG00),Y 0PUSH RETURN0 0RTS 0.TITLE "Get the system open/close level" 0FUNCPROC SOSGETLEV,1 ;**************************0POP RETURN0 0FUNCBIAS 0POP ZREG00 ;Return code ptr. 0PLA 0STA PARAM1 ;File level (1..3) 0PLA 0LDA #1 0STA PARAM0 ;Param count 0SOS SETLEVEL 0RETVA Return code ptr., new file level ; ; Global Registers Used: ; ; ZREG00 ; ;****************************************************************************** ; 0.REF PARAM0,PARAM1,SOSBLK,PUSHBOOL ;  ; ; File SOSUTIL.TEXT ; 0.TITLE "SOS set user event fence" 0FUNCPROC SOSSFENCE,1 ;****************************************************************************** ; ; Name: SOSSFENCE ; ; Level/Kind: 0 ; ; Purpose: ;Time string ptr. 0LDA #18. 0LDY #0 0STA (ZREG00),Y ;Set the count byte 0CLC 0LDA ZREG00 0ADC #1. 0STA ZREG00 0LDA ZREG00+1 0ADC #0. September 10, 1981 ; ; Revisions Made: ; ;****************************************************************************** ; 0.REF PARAM0,PARAM1,PARAM2,SOSBLK,PUSHBOOL ; 0POP RETURN0 0FUNCBIAS 0POP ZREG00 ;****************************************************************************** ; ; Name: SOSGETTIME ; ; Level/Kind: 0 ; ; Purpose: Returns the current system time in an 18 character Pascal ; string. ; ; Date Entered:AM1 0LDA #0 0STA PARAM2 ;Time string pointer 0SOS SETTIME ;Issue request to SOS 0RETVAL 0PUSH RETURN0 0RTS 0.TITLE "SOS Get the System Time" 0FUNCPROC SOSGETTIME,1 ZREG00 0LDA ZREG00+1 0ADC #0. ;Bump the ptr. to first data ch. 0STA ZREG00+1 0LDA #1 0STA PARAM0 ;Param. count 0LDA #ZREG00 0STA PAR************************************************ ; 0.REF PARAM0,PARAM1,PARAM2,SOSBLK,PUSHBOOL ; 0POP RETURN0 0FUNCBIAS 0POP ZREG00 ;Time string ptr. 0CLC 0LDA ZREG00 0ADC #1. 0STA ; ; Name: SOSSETTIME ; ; Level/Kind: 0 ; ; Purpose: Takes a Pascal string 18 characters long and sets the system ; time. ; ; Date Entered: September 10, 1981 ; ; Revisions Made: ; ;******************************nt priority 0TYA 0INY 0STA (ZREG00),Y ;MSB " " 0PUSH RETURN0 0RTS 0.TITLE "Set the system time" 0FUNCPROC SOSSETTIME,1 ;****************************************************************************** BIAS 0POP ZREG00 ;Event fence ptr. 0LDA #1. 0STA PARAM0 0SOS GETFENCE ;Issue the SOS call 0RETVAL 0LDY #0. 0LDA PARAM1 0STA (ZREG00),Y ;LSB eve: ; ; ZREG00 ; ; Stack Usage: ; ; User event fence ptr. ; ;****************************************************************************** ; 0.REF PARAM0,PARAM1,SOSBLK,PUSHBOOL ; 0POP RETURN0 0FUNC; Name: SOSGFENCE ; ; Level/Kind: 0 ; ; Purpose: To get the current SOS user event fence. NOTE: NO error code ; returned. ; ; Date Entered: September 18, 1981 ; ; Revisions Made: ; ; Global Registers UsedETFENCE ;Issue the SOS call 0RETVAL 0PUSH RETURN0 0RTS 0.TITLE "SOS get the user event fence" 0FUNCPROC SOSGFENCE,1 ;****************************************************************************** ; ************************************** ; 0.REF PARAM0,PARAM1,SOSBLK,PUSHBOOL ; 0POP RETURN0 0FUNCBIAS 0PLA 0STA PARAM1 ;Event priority 0PLA 0LDA #1. 0STA PARAM0 0SOS STo set the SOS user event fence. NOTE: NO error code is ; returned. ; ; Date Entered: September 18, 1981 ; ; Revisions Made: ; ; Stack Usage: ; ; User event fence ; ; ;**************************************** ;Bump the ptr. to first data ch. 0STA ZREG00+1 0LDA #1 0STA PARAM0 ;Param. count 0LDA #ZREG00 0STA PARAM1 0LDY #0 0STY PARAM2 ;Param. ptr. to time string 0SOS GETTIME ;Issue the request to SOS 0RETVAL ;Assume Y = 0 0PUSH RETURN0 0RTS 0.TITLE "SOS get analog info" 0FUNCPROC A O^B PTERM .BYTE 0 ;PARAM0 = 0 0 ; Date Entered: September 21, 1981 ; ; Revisions Made: ; ;****************************************************************************** ; 0BRK ;DON'T CARE ABOUT THE STACK 0.BYTE TERMINATE 0.WORD PTERM0FUNCPROC SOSTERMINATE,0 ;****************************************************************************** ; ; Name: SOSTERMINATE ; ; Level/Kind: 0 ; ; Purpose: Terminates the currently executing program and interpreter. ; LDA PARAM2,X ;Transfer 4 byte value 0STA (ZREG00),Y 0INY 0INX 0CPX #4. ;Four bytes? 0BCC $010 ; -No 0PUSH RETURN0 0RTS 0.TITLE "SOS Terminate"  ANALOG ;Issue the SOS call 0RETVAL 0LDY #0. 0STA (ZREG01),Y ;LSB return code 0TYA 0INY 0STA (ZREG01),Y ;MSB 0TAY ;Zero out both index regs. 0TAX $010 0POP ZREG01 ;Return code ptr. 0POP ZREG00 ;Joystick value ptr. 0PLA 0STA PARAM1 ;Joystick mode (0..7) 0PLA 0LDA #2. 0STA PARAM0 ;Parameter count 0SOS 1 ; ;****************************************************************************** ; 0.REF PARAM0,PARAM1,PARAM2,PARAM3,PARAM4 0.REF PARAM5,SOSBLK,PUSHBOOL ; 0POP RETURN0 0FUNCBIAS SOS return code is posted. ; ; Date Entered: September 21, 1981 ; ; Revisions Made: ; ; Stack Usage: ; ; Return code ptr., Joystick readout ptr., Joystick mode ; ; Global Registers Used: ; ; ZREG00, ZREG0 SOSGETANALOG,3 ;****************************************************************************** ; ; Name: SOSGETANALOG ; ; Level/Kind: 0 ; ; Purpose: Returns the requested joystick readout in four contiguous ; bytes. A ; Return code ptr., Pages ptr., Change mode, Segment number ; ; Global Registers Used: ; ; ZREG00, ZREG01 ; ; ;****************************************************************************** ; 0.REF PARAM0,PARAMN0 0RTS 0.TITLE "SOS Change Segment address" 0FUNCPROC SOSCHANGESEG,4 ;****************************************************************************** ; ; Name: SOSCHANGESEG ; ; Stack Usage: ; #08. $010 STA (ZREG00),Y 0TYA 0BEQ $020 0DEY 0LDA PARAM3,Y 0JMP $010 $020 LDY #09. ; (Assume A = 0) 0STA (ZREG00),Y 0PUSH RETUR#0. 0STY PARAM10 ;MSB Segment number 0LDA (ZREG00),Y 0STA PARAM3 0INY 0LDA (ZREG00),Y 0STA PARAM4 ;Set the page request count 0SOS FINDSEG 0RETVAL 0LDY 0POP ZREG00 ;Structure ptr. 0PLA 0STA PARAM2 ;Segment Id. 0PLA 0PLA 0STA PARAM1 ;Search mode 0PLA 0LDA #06. 0STA PARAM0 ;Param count 0LDY ;****************************************************************************** ; 0.REF PARAM0,PARAM1,PARAM2 0.REF PARAM3,PARAM4,PARAM10,SOSBLK,PUSHBOOL ; 0POP RETURN0 0FUNCBIAS Name: SOSFINDSEG ; ; Stack Usage: ; ; Packed structure of: ; ; Pages, Base, Limit, SegNumb, RetCode; ; ; Segment Id., Search mode. ; ; ; Global Registers Used: ; ; ZREG00 ; ; ;MSB return code 0STA (ZREG01),Y ;MSB segment number 0PUSH RETURN0 0RTS 0.TITLE "SOS Find Segment" 0FUNCPROC SOSFINDSEG,3 ;****************************************************************************** ; ; 0SOS REQSEG ;Issue SOS call 0RETVAL 0LDY #0. 0STA (ZREG00),Y ;Return code LSB 0LDA PARAM6 0STA (ZREG01),Y ;Segment number LSB 0TYA 0INY 0STA (ZREG00),Y PARAM5 ;Segment Id. code 0PLA 0POP PARAM3 ;Limit page address 0POP PARAM1 ;Base page address 0LDA #04. 0STA PARAM0 ;Param count 0.REF PARAM0,PARAM1,PARAM3,PARAM5 0.REF PARAM6,SOSBLK,PUSHBOOL ; 0POP RETURN0 0FUNCBIAS 0POP ZREG00 ;SOS return code ptr. 0POP ZREG01 ;Segment number ptr. 0PLA 0STA ; ; Return code ptr., Segment number, Segment ID, Page Limit, ; Page Base. ; ; Global Registers Used: ; ; ZREG00, ZREG01 ; ; ;****************************************************************************** ; ; ; SOSMEM -- SOS Memory Management Calls ; 0.TITLE "SOS Request Segment" 0FUNCPROC SOSREQUESTSEG,5 ;****************************************************************************** ; ; Name: SOSREQUESTSEG ; ; Stack Usage:1,PARAM2,PARAM3 0.REF PARAM4,SOSBLK,PUSHBOOL ; 0POP RETURN0 0FUNCBIAS 0POP ZREG00 ;Return code ptr. 0POP ZREG01 ;Page ptr. 0PLA 0STA PARAM2 ;Change segment mode 0PLA 0PLA 0STA PARAM1 ;Segment number 0PLA 0LDY #01. 0LDA (ZREG01),Y 0STA PARAM4 0DEY 0LDA (ZREG01),Y 0STA PARAM3 ;Pages requested 0LDA #03. 0ST0STA PARAM1 ;Segment number 0PLA 0LDA #01. 0STA PARAM0 ;Param count 0SOS RELSEG 0RETVAL 0LDY #0. 0STA (ZREG00),Y 0TYA 0INY 0STA (ZREG00),Y 0PU0 ; ;****************************************************************************** ; 0.REF PARAM0,PARAM1 0.REF SOSBLK,PUSHBOOL ; 0POP RETURN0 0FUNCBIAS 0POP ZREG00 ;Return code ptr. 0PLA PROC SOSRELSEG,2 ;****************************************************************************** ; ; Name: SOSRELSEG ; ; Stack Usage: ; ; Return code, Segment number. ; ; Global Registers Used: ; ; ZREG0G00),Y ;LSB return code 0LDA PARAM3 0STA (ZREG01),Y ;LSB segment number 0TYA 0INY 0STA (ZREG00),Y 0STA (ZREG01),Y 0PUSH RETURN0 0RTS 0.TITLE "SOS Release Segment" 0FUNC0POP ZREG01 ;Segment number ptr. 0POP PARAM1 ;Segment address 0LDA #02. 0STA PARAM0 ;Param count 0SOS GSEGNUMB 0RETVAL 0LDY #0. 0STA (ZRE*********************************** ; 0.REF PARAM0,PARAM1,PARAM3 0.REF SOSBLK,PUSHBOOL ; 0POP RETURN0 0FUNCBIAS 0POP ZREG00 ;Return code ptr. **************************** ; ; Name: SOSGSEGNUMB ; ; Stack Usage: ; ; Return code, Segment number, Segment address. ; ; Global Registers Used: ; ; ZREG00, ZREG01 ; ;*******************************************Y #09. ; (Assume A = 0) 0STA (ZREG00),Y ;MSB Return code 0PUSH RETURN0 0RTS 0.TITLE "SOS Get Segment Number" 0FUNCPROC SOSGSEGNUMB,3 ;**************************************************0STA PARAM9 ;Segment Id. MSB 0SOS GSEGINFO 0RETVAL 0LDY #08. $010 STA (ZREG00),Y 0TYA 0BEQ $020 0DEY 0LDA PARAM2,Y 0JMP $010 $020 LD0POP ZREG00 ;Packed structure ptr. 0PLA 0STA PARAM1 ;Segment number 0PLA 0LDA #05. 0STA PARAM0 ;Param count 0LDA #0. Global Registers Used: ; ; ZREG00 ; ;****************************************************************************** ; 0.REF PARAM0,PARAM1,PARAM2,PARAM9 0.REF SOSBLK,PUSHBOOL ; 0POP RETURN0 0FUNCBIAS **************************************************************** ; ; Name: SOSGSEGINFO ; ; Stack Usage: ; ; Packed structure of: ; ; Base, Limit, Pages, SegId, RetCode; ; ; Segment number. ; ; 0STA (ZREG00),Y ;MSB Return code 0LDA PARAM4 0STA (ZREG01),Y ;MSB pages changed 0PUSH RETURN0 0RTS 0.TITLE "SOS Get Segment Information" 0FUNCPROC SOSGSEGINFO,2 ;**************A PARAM0 ;Param count 0SOS CHANGESEG 0RETVAL ;Assume Y = 0 0STA (ZREG00),Y 0LDA PARAM3 0STA (ZREG01),Y ;LSB pages changed 0TYA 0INY SH RETURN0 0RTS utine : If "FUNCTION" Then ; Begin ; If A = 0 Then "TRUE" ; Else "FALSE" ; End; ; ; Register Usage : Entry - A is the SOS return .BYTE PARAM18 .BYTE PARAM19 .BYTE PARAM20 .BYTE PTRPRM5 .WORD PARAM5 PTRPRM6 .WORD PARAM6 PTRPRM7 .WORD PARAM7 PTRPRM10 .WORD PARAM10 ; ; A Level 1 SubroPARAM6 .BYTE PARAM7 .BYTE PARAM8 .BYTE PARAM9 .BYTE PARAM10 .BYTE PARAM11 .BYTE PARAM12 .BYTE PARAM13 .BYTE PARAM14 .BYTE PARAM15 .BYTE PARAM16 .BYTE PARAM17 pyright 1981,1982,1983 Apple Computer, Inc." ; SOSBLK .EQU * ;SOS parameter area PARAM0 .BYTE PARAM1 .BYTE PARAM2 .BYTE PARAM3 .BYTE PARAM4 .BYTE PARAM5 .BYTE ,PARAM0,PARAM1,PARAM2,PARAM3 0.DEF PARAM4,PARAM5,PARAM6,PARAM7,PARAM8,PARAM9 0.DEF PARAM10,PARAM11,PARAM12,PARAM13,PARAM17 0.DEF PARAM19,PTRPRM5,PTRPRM6,PTRPRM7,PTRPRM10 0.DEF PUSHBOOL ; 0.ASCII "CoY ; ; Purpose: To provide the necessary return address and SOS data area. ; ; Date Entered: November 29, 1980 ; ; Revisions Made: ; ;****************************************************************************** ; 0.DEF SOSBLK ; ; File SOSDATA.TEXT ; 0.TITLE "SOS Interface routines data structure" 0.PROC SOSDATA ;****************************************************************************** ; ; Name: SOSDATA ; ; Level/Kind: 0/Pascal--For data ONLA O^B code ; ; Exit - A is restored ; Y is not modified ; X is destroyed ; PUSHBOOL .EQU * 0.IF FUNCTION 0TAX 0POP RETURN1 0LDA #0. 0PHA 0TXA 0BEQ $010 0LDA #0. 0BEQ $020 $010 LDA #1. $020 PHA 0PUSH RETURN1 0TXA ;Restore the SOS ret. code 0.ENDC 0R0LDA #SOSCHLB ;Low byte 0STA ZTEMP00 0LDA #SOSCHHB ;High byte 0STA ZTEMP00+1 0LDX #4 0LDY #0 $010 LDA (ZTEMP00),Y 0STA (ZREG00),********************************************************************* ; 0.REF PUSHBOOL ; 0POP RETURN0 ;Save the return address 0FUNCBIAS 0POP ZREG00 ;Char. set pointer 0LOCALREG ZTEMP00 ; Entry - Return address, character set image pointer. ; ; Global Variables Used: ; ; ZTEMP00 is used to load the SOS image from $C00 through $FFF ; ZREG00 is used as the character set register. ; ;*********he current Apple III character set and put ; it (1K) where indicated by the pointer passed as argument. ; ; Date Entered: August 3, 1980 ; ; Revisions Made: 20 Jan 81 ; ; Register and Flag Usage: ; ; Stack Usage: ; ; ; File SOSPLUS ; 0.TITLE "Special Character Set Builders" ; 0FUNCPROC UPLOAD,1 ;****************************************************************************** ; ; Name: UPLOAD ; ; Level/Kind: 0 ; ; Purpose: To fetch tA Q B , O^BTS 0 Y ;Save it 0INY 0BNE $010 ;1/4K? 0INC ZREG00+1 ; -Yes 0INC ZTEMP00+1 0DEX 0BNE $010 ;All done? 0TXA 0RETVAL ;Post a "TRUE" value if a P; function 0PUSH RETURN0 0RTS 0.TITLE "Returns the address of variable as integer" ; 0.FUNC ATSIGN,1 ;****************************************************************************** ; ; Name: ATSIGN ; ; Level/Kind: ice information list returned by SOS} FUNCTION GetSOSNum(PasNum:INTEGER):INTEGER;FORWARD; FUNCTION GetPascalNum(SOSNum:INTEGER):INTEGER;FORWARD; PROCEDURE Introduction; BEGIN #WRITELN('Welcome to the wonderful world of device translation!'); #WRITELN(it # of device specified} $SosNum, {Sos device number of device specified} $RetCode:INTEGER; {Return code from SOS calls} $Error: BOOLEAN; {no device specified} $DevList: PACKED ARRAY [0..10] OF 0..255; @{DevPROGRAM TestDevTranslation; USES {$Using SOSIO.CODE} SOSIO; {Uses SOS_IO device calls in functional form} VAR InString, {user input} $SosName:STRING; {Sos Name of device specified} $PasNum, {Pascal UnA B D^!0PUSH RETURN0 0RTS ; Date Entered: September 23, 1981 ; ; Revisions Made: ; ;****************************************************************************** ; 0POP RETURN0 0PLA ;Remove the Function bias 0PLA 0PLA 0PLA 0/F ; ; Purpose: Allows the Pascal programmer to manipulate any stack/heap ; pointer as an integer; i.e. the returned value. Returns ; the value of the address of a Pascal variable. ; 'Type in a device and I will translate it.'); #WRITELN('Formats are: SOS device number (e.g. 1) or Pascal unit (e.g. #4)'); #WRITELN('or even a SOS device name (e.g. .rs232)'); #WRITELN; #WRITELN('Type just a [RETURN] to exit'); #WRITELN; #END; FUNCTION GetSOSNum{PasNum:INTEGER):INTEGER}; #{returns SOS device number of unit numbered PasNum; $0 if no such unit or no SOS device in that unit #} #TYPE Byte = 0..255; #VAR &Data: PACKED RECORD /RegularUnits: PACKED ARRAY [1..20] OF Byte; /UserUD^!ame='') } )IF SosNum = 0 THEN Error := TRUE; )IF Error THEN WRITE(CHR(7)) {Sound a bell} )ELSE Writeln(SosName:16,' <=> ',SOSNum:2,' <=> #',PasNum); &END; #UNTIL InString= ''; END. e, DevList, RetCode) THEN /BEGIN /Writeln('SOS error #', RetCode, ' from SOS_D_Info'); /END; ,PasNum := GetPascalNum(SosNum); ,IF PasNum = 0 THEN SosNum := 0; ,END )ELSE ,BEGIN ,Error := TRUE; ,END; ){NOT Error => (SOSNum=0 <=> PasNum=0 <=> SosN2Writeln('SOS error #', RetCode, ' from SOS_D_Info'); 2END; /END ,ELSE /BEGIN /Error := TRUE; /END; ,IF SOSNum = 0 THEN PasNum := 0; ,END )ELSE IF Number(InString,SosNum) THEN ,BEGIN ,{must have typed a number} ,IF NOT SOS_D_Info(SosNum, SosNam)ELSE IF InString[1] = '#' THEN ,BEGIN ,{must be a Pascal unit number} ,Delete(InString,1,1); {remove # sign} ,IF Number(InString,PasNum) THEN /BEGIN /SosNum := GetSOSNum(PasNum); /IF NOT SOS_D_Info(SosNum, SosName, DevList, RetCode) THEN 2BEGIN e name} ,SosName := Instring; ,IF NOT SOS_Get_D_Num(InString, SosNum, RetCode) THEN /BEGIN /Writeln('SOS error #', RetCode, ' from SOS_Get_D_Num'); /END; ,PasNum := GetPascalNum(SosNum); ,IF PasNum = 0 THEN SosName := ''; ,END '9'] DO &BEGIN &Number := TRUE; &n := n*10+ORD(S[i])-ORD('0'); &i := i+1; &END; END; BEGIN #Introduction; #REPEAT &READLN(InString); &IF LENGTH(InString) >0 THEN )BEGIN )Error := FALSE; )IF InString[1] = '.' THEN ,BEGIN ,{must be a SOS devic{adjust index appropriately} *PasNum := PasNum+107; *END; 'END; $GetPascalNum := PasNum; END; FUNCTION Number(S:STRING;VAR n:INTEGER):BOOLEAN; #VAR i:INTEGER; BEGIN #NUMBER := FALSE; #S := CONCAT(S,' '); #n := 0; #i := 1; #WHILE S[i] IN ['0'..'UnitStatus(0,Data,0); {ask interpreter for table} 'PasNum := SCAN(41,=CHR(SOSNum),Data)+1; {find SOSNum in table} 'IF PasNum = 42 THEN *BEGIN *{scanned off end of table} *PasNum := 0; *END 'ELSE IF PasNum > 20 THEN *BEGIN *sNum:INTEGER; #Data: PACKED RECORD ,RegularUnits: PACKED ARRAY [1..20] OF Byte; ,UserUnits: PACKED ARRAY [128..147] OF Byte; )END; ) BEGIN $IF SosNum = 0 THEN 'BEGIN 'PasNum := 0; {avoid "holes" in Unittable} 'END $ELSE 'BEGIN 'GetSOSNum := Data.UserUnits[PasNum]; 'END $ELSE 'BEGIN 'GetSOSNum := 0; 'END; END; FUNCTION GetPascalNum{SOSNum:INTEGER):INTEGER}; {returns the Pascal unit number of the SOS device numbered SOSNum; 0 if none found } TYPE Byte = 0..255; VAR #Panits: PACKED ARRAY [128..147] OF Byte; ,END; ) BEGIN $UnitStatus(0,Data,0); {ask interpreter for table} $IF PasNum IN [1..20] THEN 'BEGIN 'GetSOSNum := Data.RegularUnits[PasNum]; 'END $ELSE IF PasNum in [128..147] THEN 'BEGIN; adjusts the bank and address values accordingly ($bb:00xx becomes $bb-1:80xx). 0.PAGE 0 ; Also supplied in this module is the function ADDRESS: ; FUNCTION address(VAR x): integer; ; This returns the address of x as the value of the function. It is uy $2000 to produce addresses in the ; range $0000 to $FFFF. This could produce an address of the form $bb:00xx, ; i.e., a reference to a zero page. X_movebytes checks for this case and They return segment addresses of the form $bb:pp, where the ; pp is in the range $20 to $9F for banked-switched or segment addressing. ; X_movebytes uses extended indirect addressing. Thus the pp value must be ; converted to a 4-byte address and offset bs to use Pascal's bank. Thus the following two calls ; are functionally equivalent: ; x_moveleft(-1, address(s), -1, address(d), 0, n) <==> moveleft(s, d, n) ; Segment and bank values for data may be obtained by the SOS request_seg or ; find_seg calls.; partial = number of bytes in final (or only page) to move. ; X-moveleft will move pages*256+partial bytes from the source at the address ; src_bank:src_addr ($bb:xxxx) to the destination at address dst_bank:dst_addr. ; A -1 for a bank value meane address in the destination bank ($0000 to $7FFF). As ; with src_addr, the ADDRESS function may be used to get the ; address of a Pascal variable. ; pages = number of whole 256-byte pages to move. using the ; function ADDRESS also supplied in this module and ; described below. ; dst_bank = bank number of destination. A special value of -1 means ; use Pascal's bank. ; dst_addr = pag; ; where: src_bank = bank number (0, 1, 2, ...) of the source. A special value ; of -1 means use Pascal's bank. ; src_addr = address of 256 byte page in the source bank ; ($0000 to $7FFF). This may be obtained ; wish to use the rest of the bank space in larger machines. ; X_moveleft has the following Pascal declaration and call: ; PROCEDURE x_moveleft(src_bank, src_addr, ; dst_bank, dst_addr, ; pages, partial: integer)ionally, it does ; the same thing, i.e., moves bytes, in ascending order, from a source to a ; destination. But unlike moveleft, x_moveleft can move the bytes no matter ; which bank they are in. It is designed to be used in Pascal programs which | ; *--------------------------------------------------------------------* ; This module is the code for the procedure x_moveleft. X_moveleft is a ; generalized version of Pascal's moveleft procedure. Funct | <<< X_moveleft >>> | ; | | ; | Extended version of Pascal's moveleft for moving data across banks | ; | ).TITLE "X_moveleft - Extended moveleft for moving bytes across banks" ).NOPATCHLIST ).NOMACROLIST ; *--------------------------------------------------------------------* ; | | ;seful for ; moving Pascal data with X_MOVELEFT as illustrated above. ; ; Macro to push a word on to the stack. ; 0.MACRO PUSH 0LDA %1+1 0PHA 0LDA %1 0PHA 0.ENDM ; ; Macro to pop the stack into a word ; 0.MACRO POP 0PLA 0STA %1 0PLA 0STA %1+1 0.ENDM 0.PAGE ; The following macro saves SRC_BANK and DST_BANK (passed as the ; first parameter, %1, an extended address bank pointer) in SAVE_SRC_BANK ; and SAVE_DST_BANK, respectively, and then sets the new value from ; the stack (SRC_BANK .EQU 1601+SRC_ADDR ; X-byte for src_addr DST_ADDR .EQU 0E2 ; page ptr to write bytes to DST_BANK .EQU 1601+DST_ADDR ; x_byte for dst_addr ( RETURN .EQU 0 ; return address SA bytes from the address src_bank:src_addr (extended ; indirect addressing form bb:xxxx) to address dst_bank:dst_addr. A bank of ; -1 means to use the Pascal bank. SRC_ADDR .EQU 0E0 ; page ptr to read bytes from END; $1 .ENDM ; END; {chkwrap} 0.PROC X_MOVELEFT,6 ; ; PROCEDURE x_moveleft(src_bank, src_addr, ; dst_bank, dst_addr, ; pages, partial: integer); ; Move pages*256+partial ; IF address>=$FF00 THEN 0BCC $1 ; BEGIN {set to next bank} 0SBC #80 ; address := address-$8000; 0STA %1+1 ; bank := bank+1; 0INC %1+1601 ; ; the bank, i.e., bb:nnnn becomes bb+1:nnnn-$8000. Note that the corresponding ; bank register is at the address+$1601. 0.MACRO CHKWRAP ; PROCEDURE chkwrap(address: integer); 0LDA %1+1 ; BEGIN {chkwrap} 0CMP #0FF nk} 0.PAGE ; The following macro guarantees that the base pointer %1 (an address) will not ; wrap into zero page during next 256 increments of the pointer. If it would, ; then adjust the address to be in the first bank of a bank pair and increment E $3 ; BEGIN {make bank-1:80xx} 0LDA #80 ; addr := addr+$8000; 0STA %1-1601+1 ; 0DEC %1 ; bank := bank-1; $3 PLA ; END; 0.ENDM ; END; {setba ; 0CMP #0FF ; IF newbank<>-1 THEN 0BEQ $1 ; bank := newbank+$80; {high bit on} 0ORA #80 ; 0STA %1 ; $1 LDA %1-1601+1 ; IF addr<256 THEN {have bank:00xx} 0BN0.MACRO SETBANK ; PROCEDURE setbank( newbank: integer; C; VAR bank,temp: byte; C; VAR addr: integer); 0LDA %1 ; BEGIN {setbank} 0STA SAVE%1 ; temp := bank; {save Pascal's value} 0PLA ual macro substitution to generate correct name. ; addr = a page address (src_addr or dst_addr) which is always ; $1601 below the bank register. We look at the msb here, ; hence, we look at bank-$1601+1. bank") ; newbank = new value for bank which is popped off the stack ; (from x_moveleft's call parameter list) by this macro. ; temp = place to save bank's former value before it is clobbered. ; Uses texty the main loop. ; ; This macro is commented as a pseudo procedure with the following declaration: ; ; PROCEDURE setbank(newbank: integer; VAR bank, temp: byte; addr: integer; ); ; ; where: bank = extended address bank pointer (%1, "src_bank" or "dst_; word in zero page, and modifies it and %1 (bank register), if necessary, to ; make sure that the address does not point to the zero page of the bank pair ; (to avoid the hole in the memory map). Zero page wraparound during execution ; is taken care of bpopping it off). It turns the high bit on to enable indirect ; addressing. ; Follows convention that value of -1 means that the Pascal bank is to ; be used. It also checks the address currently pointed to by the corresponding VE_SRC_BANK .EQU 2 ; used to hold $16E1 across routine SAVE_DST_BANK .EQU 3 ; used to hold $16E3 across routine COUNT_Z .EQU 4 ; "Z"-byte of number of bytes to move COUNT_Y .EQU 5 ; "Y"-byte COUNT_X .EQU 6 ; "X"-byte (keep count bytes in order) A; PROCEDURE x_moveleft(src_bank,src_addr, A; dst_bank,dst_addr, 0POP RETURN ; pages,partial: integO^ {stack because it's a function} 0PLA ; ( 0PUSH RETURN ; address := tos; {param is still H; on top of stack} 0RTS ; END; {address} 0 0.END RETURN .EQU 0 ; 0POP RETURN ; FUNCTION address(VAR x): integer; H; BEGIN {address} 0PLA ; 0PLA ; {Remove the extra words on the} 0PLA ; AVE_DST_BANK ;dst_bank := save_dst_bank; 0STA DST_BANK ; 0PUSH RETURN ; 0RTS ; END; {x_moveleft} 0.FUNC ADDRESS,1 ; 0 ; FUNCTION address(VAR x): integer; ; Returns the address of "x". ; 0STA @DST_ADDR,Y ; 0INY ; 0CPY COUNT_Z ; 0BNE $1 ; EXIT LDA SAVE_SRC_BANK ;{put things back the way they were} 0STA SRC_BANK ;src_bank := save_src_bank; 0LDA Sges} F; END; {moving count_x*256 pages} PARTIAL LDA COUNT_Z ; {move remaining partial page} 0BEQ EXIT ; FOR y:=0 TO count_z DO 0LDY #0 ; dst_addr^[y] := src_addr^[y]; $1 LDA @SRC_ADDR,Y 0BNE $1 ; 0 0INC SRC_ADDR+1 ; src_addr := src_addr+256; 0INC DST_ADDR+1 ; dst_addr := dst_addr+256; 0DEC COUNT_Y ; END; {moving count_y pages} 0JMP MOVE_PAGES ; count_y := 256; {count_x*256 paL ; 0DEC COUNT_X ; PAGE_LOOP LDY #0 ; {move 1 page of 256 bytes} $1 LDA @SRC_ADDR,Y ; FOR y:=0 TO 255 DO 0STA @DST_ADDR,Y ; dst_addr^[y] := src-addr^[y]; 0INY ; pages} 0CHKWRAP DST_ADDR ; chkwrap(dst_addr); 0CHKWRAP SRC_ADDR ; chkwrap(src_addr); 0LDA COUNT_Y ; FOR j:=count_y DOWNTO 1 DO 0BNE PAGE_LOOP ; BEGIN {move count_y pages} 0LDA COUNT_X ; 0BEQ PARTIA ; setbank(dst_addr,dst_bank,save_dst_bank); 0POP SRC_ADDR ; 0SETBANK SRC_BANK ; setbank(src_addr,src_bank,save_src_bank); MOVE_PAGES ; FOR i:=count_x downto 1 DO A; BEGIN {move count_x*2560STA COUNT_Y ; count_y := (pages MOD 256)+ 0PLA ; (partial DIV 256); 0ADC #0 ; count_x := pages DIV 256; 0STA COUNT_X ; 0 0POP DST_ADDR ; {pop rest of the parameters} 0SETBANK DST_BANKer); 0POP COUNT_Z ; BEGIN {x_moveleft} 0PLA ; {set x,y,z values to reflect the 0CLC ; bytes to move: x*256*256+Y*256+z} 0ADC COUNT_Y ; count_z := partial MOD 256;  t.pp-32)*256-1; ,free_bank := base_bank; ,free_addr := base_addr; ,alloc_segment := pages; ,END; {WITH} &END; {alloc_segment} #{*-------------------------------------------* $| free_segment - free the allocated segment | $*----------------------NOT sos_find_seg(2, 127, find_plist) THEN 2BEGIN 2writeln( 5'Cannot allocate segment (SOS find_seg error ', rc, ')'); 2pages := 0; 2END; /END; & ,base_bank := base.bb; ,base_addr := (base.pp-32)*256; ,limit_bank := limit.bb; ,limit_addr := (limi/{SOS_FIND_SEG returns FALSE if the number of pages originally 0requested cannot be allocated; the maximum number of pages 0available is placed in the pages field of FIND_PLIST in that 0case. We call SOS_FIND_SEG again to be sure we can get it.} /IF oc_segment} )WITH find_plist DO ,BEGIN ,pages := maxint; {try to get all we can} , ,IF NOT sos_find_seg(2, {may cross bank boundaries} @127, { $7F, a user segment type} @find_plist) THEN /BEGIN artial: integer); &EXTERNAL ; #FUNCTION address(VAR x): integer; &EXTERNAL ; #{*------------------------------------* $| alloc_segment - allocate a segment | $*------------------------------------*} #FUNCTION alloc_segment: integer; &BEGIN {allk} &free_addr: integer; {free space at this address} #{*--------------------------------* $| External (assembly) Procedures | $*--------------------------------*} #PROCEDURE x_moveleft(src_bank, src_addr, dst_bank, dst_addr, pages, 8p&base_addr: integer; {segment starts at this address} &limit_bank: integer; {segment ends in this bank} &limit_addr: integer; {segment ends at this address} &free_bank: integer; {free space in this ban-------------------------------------*} &find_plist: 4PACKED RECORD {find_seg param list} 7pages: integer; 7base: bbpp; 7limit: bbpp; 7segnum: integer; 7rc: integer; 4END; &base_bank: integer; {segment starts in this bank} -----------*} #VAR &i, NumStrings: 0..MaxString; & &StringLoc: array [1..MaxString] OF RECORD Kbank, addr: integer; IEND; & &s: string[255]; &{*-----------------------------------------* '| Data Used for SOS Segment Manipulations | '*----mum number of strings which can be entered in :the sample program} : #{*-------* $| Types | $*-------*} #TYPE &bbpp = 6PACKED RECORD {bank/page (bb:pp) from find_seg} 9pp, bb: 0..255; 6END; #{*-------------* $| Global Data | $*-- PROGRAM uses_x_moveleft; #USES {$USING SOSIO.CODE} sosio; {This program uses the SOS_IO package in 0functional form to access the SOS memory management calls} # #{*-----------* $| Constants | $*-----------*} $ $CONST ( (MaxString = 100; {Maxi---------------------*} #PROCEDURE free_segment; &VAR )rc: integer; &BEGIN {free_segment} )IF NOT sos_rel_seg(find_plist.segnum, rc) THEN ,writeln('Could not release segment (SOS release_seg error ', rc, ')'); &END; {free_segment} #{*---------------------------------------* $| alloc - allocate space in the segment | $*---------------------------------------*} #PROCEDURE alloc(amount: integer {nbr of bytes to allocate} ; 3VAR bank, addr: integer {location of allocated space} );&writeln('And that''s all of them!'); &free_segment; & #END {USES_X_MOVELEFT} . mStrings := NumStrings - 1; {Last is invalid: blank or no more room} & &writeln('Now we write them back out:'); &writeln; & &FOR i := 1 TO NumStrings DO )BEGIN )getstring (s, StringLoc[i].bank, StringLoc[i].addr); )writeln(s); )END; ) &writeln; )writeln('Enter a string. Blank line terminates.'); )readln(s); )NumStrings := NumStrings+1; )putstring (s, StringLoc[NumStrings].bank, StringLoc[NumStrings].addr) ) &UNTIL (s='') OR (NumStrings=MaxString) OR (StringLoc[NumStrings].bank<0 ); & &Nut} #{*-------------* $| Main Program| $*-------------*} & #BEGIN {main program} &init; & &NumStrings := 0; & &REPEAT ){Read in a number of strings into the extra space; build *an array of addresses} ) ber *in this case.} )IF pages<25 THEN ,BEGIN ,IF pages>0 THEN free_segment; ,writeln('Program terminated due to insufficient memory'); ,exit(PROGRAM); ,END; )writeln( 'Maximum storage space available is ', pages, ' pages.'); )writeln; &END; {inir; &BEGIN {init} )writeln(chr(28)); {Clear viewport} )writeln; )write('USES_X_MOVELEFT'); )writeln; ) ) ){Get maximum number of 256 byte pages from SOS} )pages := alloc_segment; ) ){Terminate if number of pages is less than 25, an arbitrary num){We read back 256 bytes since length byte is stored away. We thus can )read back any string.} ) & &END; {getstring} & & #{*-----------------------* $| init - initialization | $*-----------------------*} #PROCEDURE init; &VAR )pages: intege--------*} #PROCEDURE getstring( VAR image: string; bank, addr: integer ); & &VAR image_addr: integer; { address(image) } * &BEGIN & &{ Read the string back } )image_addr := address(image); )x_moveleft(bank, addr, -1, image_addr, 0, 256); ) the extra memory from the Pascal bank} )x_moveleft(-1, image_addr, bank, addr, 0, string_len); & &END; {putstring} & & #{*------------------------------------------* $| getstring - retrieve string from storage | $*----------------------------------clude length byte} & &{allocate space in the extra space for the string} )alloc(string_len, bank, addr); & &IF bank<0 THEN )BEGIN {no more segment space} )writeln('No space available for string'); )END {no segment space} &ELSE {Move the string to #PROCEDURE putstring( image: string; VAR bank, addr: integer ); & &VAR image_addr: integer; { address(image) } *string_len: integer; { number of bytes of string plus 1 } * &BEGIN &image_addr := address(image); & &string_len := length(image)+1; {inN ,free_addr := free_addr + amount; ,END; &END; {alloc} #{*----------------------------------------* $| putstring - insert string into storage | $*----------------------------------------*} rrent_bank := 32767; )remain := top_of_current_bank-free_addr+1; )IF amount>remain THEN ,BEGIN ,IF free_bank