> HighRom2/src 9 Demonstrate using high private/low shared workspace K Only a filing system can use shared absolute workspace in high memory (K so to use high workspace you need to use private relative workspace. 2I However, using private relative workspace in low memory results in being raised above the maximum shared workspace claims. d: nI When your code wants to use the workspace it must call GrabWS. This xH also sets (ws) pointing to your workspace, regardless of where it D is. You can then use (ws),Y -type instructions to access your G workspace, or LDX #offset:LDY ws+1 to point XY to a point within  your workspace. : KOSWRCH=&FFEE:OSNEWL=&FFE7:OSASCI=&FFE3:OSFILE=&FFDD:OSBYTE=&FFF4:ws=&A8  mcode% &1000 P=0 1 P%=&8000:O%=mcode% [OPT P*3+4 BRK:BRK:BRK:JMP Service !EQUB &82:EQUB Copyright-&8000 EQUB &00:EQUS "TESTROM" .Copyright EQUB &00:EQUS "(C)"  EQUB &00 : " .Service ,>PHA:LDA &DF0,X :\ Get workspace flags 6FBMI P%+4: #&40 :\ Toggle bit 6 if bit 7 is zero @OASL A:BPL ServDisabled:PLA :\ Exit if the resultant bit 6 is clear J: T"\ Do the service call dispatch ^4CMP #&24:BEQ Serv24 :\ How much high w/s needed h0CMP #&22:BEQ Serv22 :\ Claim high workspace r:CMP #&21:BEQ Serv21 :\ How much high shared workspace |9CMP #&01:BEQ Serv01 :\ How much low shared workspace : %CMP #&09:BEQ Serv09 :\ Test code RTS : .ServDisabled JPLA:RTS :\ Restore service call and return : : A\ ----------------------------------------------------------- A\ SERVICE &24 - State how much private Hazel workspace needed A\ -----------------------------------------------------------  .Serv24 KDEY:RTS :\ Need one page of private workspace : 1\ ------------------------------------------- 1\ SERVICE &22 - Claim Hazel private workspace &1\ ------------------------------------------- 0 .Serv22 :SCPY #&DC:BCC P%+4:LDY #&DC :\ If run out of Hazel, point to top of Hazel DKTYA:STA &DF0,X :\ Note location of private workspace NOINY:LDA #&22:RTS :\ Claim one page of workspace and return X: b?\ --------------------------------------------------------- l?\ SERVICE &21 - State how much shared high workspace needed v?\ ---------------------------------------------------------  .Serv21 UCPY #&C9:BCS P%+4:LDY #&C9:RTS :\ Need at least nine pages of shared workspace : <\ ------------------------------------------------------ <\ SERVICE 1 - State how much shared low workspace needed <\ ------------------------------------------------------  .Serv01 HLDA OSFILE :\ Check filing system entry point WCMP #&6C :\ If FileSwitch RAM exists, it will be a JMP abs ]BCS Serv1bbc :\ It's a JMP (vec), so always use low workspace on BBC >LDA &DF0,X :\ Get workspace pointer RCMP #&DC:BCC Serv1done :\ If we haven't run out of Hazel, so use it  .Serv1bbc aLDA #&0E:STA &DF0,X :\ Note location of workspace in shared low memory at &0E00  \CPY #&0E+1:BCS Serv1done :\ If enough shared workspace has been requested, exit FLDY #&0E+1 :\ We want one page of workspace  .Serv1done *1\ ROMs sometimes do Break initialisation here 49LDA #1:RTS :\ Restore and exit >: H .Serv2 RRTS \: f+\ Test code, display something with *Ǔ p .Serv09 z LDX #0  .Serv09lp  LDA Serv09Text,X:BEQ Serv09b JSR OSASCI:INX:BNE Serv09lp  .Serv09b  LDX &F4:LDA &DF0,X:JSR PrHex #LDA #"0":JSR OSWRCH:JSR OSWRCH JSR OSNEWL:LDA #9:RTS .Serv09Text (EQUB 13:EQUS "Workspace at &":EQUB 0  .PrHex -PHA:LSR A:LSR A:LSR A:LSR A:JSR PrNyb:PLA  .PrNyb 4 #15:CMP #10:BCC P%+4:ADC #6:ADC #48:JMP OSWRCH : .\ Grab the workspace when I need to use it  .GrabWS $>JSR FindWS :\ Point to my workspace .OLDA ws+1:BMI FindWSdone :\ Workspace in private high memory, done 8GLDA #143:LDX #10:JSR OSBYTE :\ Claim the low shared workspace BR: :\ Continue through to set the pointer again L'\ Set (ws) to point to my workspace V .FindWS `KLDX &F4:LDA &DF0,X:STA ws+1 :\ Get high byte of workspace pointer j