;*************************** AMUS Program Label ******************************
; Filename: AMOS.M68 Date: 01/04/89
; Category: SBR Hash Code: 235-426-227-446 Version: 2.0(102)
; Initials: ULTR/AM Name: DAVID PALLMANN
; Company: ULTRASOFT CORP. Telephone #: 5163484848
; Related Files:
; Min. Op. Sys.: AMOSL 1.3B Expertise Level: BEG
; Special:
; Description: AlphaBASIC Subroutine to execute an AMOS command.
;
;*****************************************************************************
;Copyright (C) 1988 UltraSoft Corp. All Rights Reserved.
;Written by David Pallmann
;
;Edit History:
;2.0(100) 12-May-88 Created. Now works with .CMD & .DO files. /DFP
;2.0(101) 27-Dec-88 Correct problem in restoring user partition where
; SAVCMZ(A4) was erroneously coded as SAVCMZ(A5).
; Thanks to Ladd Lindsay of Digital Solutions, Fresno,
; for finding this problem. /DFP
;2.0(102) 09-Jul-90 Restore JOBPRG after call. This helps programs like
; SPM give a more accurate report of program use. /KFC
;
;Calling Format: XCALL AMOS, command$
;Example: XCALL AMOS, "SYSTAT"
VMAJOR=2
VMINOR=0
VSUB=0
VEDIT=102.
VWHO=0
OBJNAM .SBR
SEARCH SYS
SEARCH SYSSYM
;*****************************************
;* XCALL argument list (indexed by A3) *
;*****************************************
;*********************************************************************
;* save our current memory partition (so we can get it back later) *
;*********************************************************************
SAVE.PARTITION:
JOBIDX A0
MOV JOBBAS(A0),SAVBAS(A4) ; save job base address
MOV JOBSIZ(A0),SAVSIZ(A4) ; save job size in bytes
MOVW JOBCMZ(A0),SAVCMZ(A4) ; save job command file size
MOVW JOBCMS(A0),SAVCMS(A4) ; save job command file status
MOV JOBPRG(A0),SAVPRG(A4) ; save job program name [102]
;******************************************
;* create a fake empty memory partition *
;******************************************
NEW.PARTITION:
LEA A1,MEMSIZ(A4)
ADD #4,A1
MOV A1,JOBBAS(A0)
CLR @A1
MOV A5,D0
SUB A1,D0
SUB #10,D0
MOV D0,JOBSIZ(A0)
CLRW JOBCMZ(A0) ; clear command file size
CLRW JOBCMS(A0) ; clear command file status
MOV A4,SAVEA4(A4) ; make a copy of A4 register
PUSH A4
LEA A2,CMDLIN(A4) ; index command line
;******************************************
;* go for it! execute the command line *
;******************************************
;***********************************************************
;* check to see if a .CMD or .DO file is still executing *
;***********************************************************
CMD.DO: JOBIDX ; A6 := JCB address
TSTW JOBCMZ(A6) ; command file running?
BEQ RESTORE.PARTITION ; no - we're done
KBD RESTORE.PARTITION ; get a line (from the command file)
BR EXEC ; go execute it
;****************************************************************
;* restore original memory partition and return to AlphaBASIC *
;****************************************************************
RESTORE.PARTITION:
POP A4 ; restore base register
CMM A4,SAVEA4(A4) ; are we okay?
JNE ERROR2 ; no - better exit
JOBIDX A0 ; A0 := JCB address
MOV SAVBAS(A4),JOBBAS(A0) ; restore job partition base
MOV SAVSIZ(A4),JOBSIZ(A0) ; restore job partition size
MOVW SAVCMZ(A4),JOBCMZ(A0) ; restore command file size
MOVW SAVCMS(A4),JOBCMS(A0) ; restore command file status [101]
MOV SAVPRG(A4),JOBPRG(A0) ; restore job program name [102]
RTN ; return control to BASIC