home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / ASMUTL / PC370.ZIP / SVC.DOC < prev    next >
Encoding:
Text File  |  1987-04-25  |  14.9 KB  |  334 lines

  1.  TITLE 'PC/370 supervisor services documentation'
  2.  
  3. Table of Contents
  4.  
  5.   A.  Introduction
  6.   B.  File input and output services
  7.   C.  Program load and execution services
  8.   D.  All supervisor services in SVC order
  9.  
  10.  EJECT
  11.  
  12.   A.  Introduction
  13.  
  14. PC/370 release 2 supports a number of supervisor services through
  15. the standard 370 SVC interface.  In supervisor state, each SVC invokes
  16. pseudo microcode which performs the function requested at native
  17. processor speed.  In problem state each SVC causes a standard SVC
  18. interrupt storing the current PSW at location X'20' and loading the
  19. new PSW from location X'60'.  Supervisor call routines can be user
  20. written to map any SVC into any desired function in problem state.
  21.  
  22.  EJECT
  23.  
  24.   B.  File input and output services
  25.  
  26. The PC/370 supervior calls to the I/O supervisor all require register
  27. 2 to point to the DCB.  The SVC's are as follows:
  28.  
  29.  SVC  FUNCTION  OPTIONS
  30.  
  31.    1  OPEN
  32.    2  CLOSE
  33.    3  READ      register 1 must be address of block or zero
  34.    4  WRITE     register 1 must be address of block or zero
  35.    5  GET       register 1 must be address of area or zero
  36.    6  PUT       register 1 must be address of area or zero
  37.    7  DELETE
  38.    8  SEARCH
  39.   23  RENAME
  40.  
  41. PC/370 Release 2 supports sequential and random access to
  42. files using MS-DOS file handle I/O with directory pathing.
  43. To access a file, a data control block (DCB) must be defined
  44. in the program with fields defined as shown in the dummy
  45. section (DSECT) called IHADCB found in IHADCB.ALC and
  46. demonstrated in TESTIO.ALC.   All fields must be defined
  47. prior to open and cannot be changed while the file is open
  48. with the exception of RCD, BUF, and RBA as described below.
  49.  
  50. An explanation of each field in the DCB follows:
  51.  
  52.   1.  DCBDCB - DCB identifier consisting of the four EBCDIC
  53.                characters ADCB.  These characters are
  54.                varified each time an I/O routine is called
  55.                with the address of the DCB in register 2.
  56.                An attempt is made to exit to the synchronous
  57.                error exit address if there is no match.
  58.  
  59.   2.  DCBDSN - address of up to 64 character EBCDIC path and
  60.                file name followed by a zero byte.  This field
  61.                is automatically translated to ASCII as
  62.                required.
  63.  
  64.   3.  DCBFID - MS-DOS assigned file handle at open time.
  65.                This field must be initialized to high values
  66.                or open routine will assume file is already
  67.                open and take SYNAD exit.
  68.  
  69.   4.  DCBFLG - file condition flags used by I/O routines.
  70.                This field must be initialized to zero except
  71.                user defined buffer bit DFUBUF and user
  72.                requested ASCII file conversion bit DFTRAN may
  73.                be turned on.  No other bits may be modified
  74.                by user.
  75.  
  76.   5.  DSORG  - data set organization EBCDIC code:
  77.  
  78.                  S for sequential
  79.                  R for random file access.
  80.  
  81.   6.  MACRF  - data set access EBCDIC code:
  82.  
  83.                  R for read block with length of BLKSZ
  84.                  W for write block with length of BLKSZ
  85.                  (note PRECL can override BLKSZ on write)
  86.                  G for get logical record into RCD area
  87.                  P for put logical record form RCD area
  88.  
  89.   7.  RECFM  - data set record format EBCDIC code:
  90.  
  91.                  F - fixed length records with length LRECL
  92.                      for get/put sequential access or length
  93.                      BLKSZ for read/write random or
  94.                      sequential access.
  95.                  V - variable length records with length
  96.                      stored in first 2 bytes (valid lengths
  97.                      range from 3 to 64k).  Maximum length
  98.                      allowed for a file is LRECL and only
  99.                      sequential get/put modes supported.
  100.                  T - text records ending with end of record
  101.                      code (EOR usually X'0A' line feed).
  102.                      Maximum length allowed for a file is
  103.                      LRECL and only sequential get/put modes
  104.                      supported.
  105.  
  106.   8.  EOR    - end of record code for text (default NL X'0A')
  107.  
  108.   9.  EOF    - end of file code for text (default X'1A')
  109.  
  110.  10.  LRECL  - length of logical record. Maximum is 64K less
  111.                17 bytes.  Minimum is 3 for RECFM=V or 1 for
  112.                RECFM=F/T.
  113.  
  114.  11.  BLKSZ  - length of block.  Maximum is 64K less 17 bytes
  115.                and minimum is 3.  If zero is specified, a
  116.                default block of 8k will be dynamically
  117.                allocated and deallocated at open and close
  118.                respectively.  BLKSZ should be specified for
  119.                read/write access.  For sequential access,
  120.                larger block size reduces contention between
  121.                multiple files by reading or writing entire
  122.                blocks at one time rather than for each
  123.                record.  If insufficient memory is available,
  124.                the maximum available will be allocated.
  125.  
  126.  12.  EODAD  - end of file exit address. This cannot be changed
  127.                while file is open.
  128.  
  129.  13.  SYNAD  - synchronous error exit.  This cannot be changed while
  130.                file is open.
  131.  
  132.  14.  RCD    - record area address for get/put only.  This
  133.                address may be changed on each get or put by
  134.                placing new address in register 1.  If register 1
  135.                contains zero, then current DCB area will be used.
  136.  
  137.  15.  BLK    - block area address used for direct I/O via MS-
  138.                DOS.  If DFUBUF is not set at open, this area
  139.                is dynamically allocated and deallocated using
  140.                BLKSZ or default for length.  If DFUBUF is set, then
  141.                new block address can be set for each read or write
  142.                by placing new address in register 1.  If register 1
  143.                contains zero, then current DCB block will be used.
  144.  
  145.  16.  RBA   -  relative byte address for random access
  146.                read/write.  First byte of file is zero.  This field
  147.                must be reset for each random read or write.
  148.  
  149.  17.  REN   -  address of file rename followed by zero.
  150.                Only used by RENAME SVC.  Both DCBDSN and REN must be
  151.                initialized in a closed DCB prior to RENAME SVC 23.
  152.  
  153.  18.  IOCNT -  physical I/O count since open.  Larger
  154.                BLKSZ will reduce physical I/O count for
  155.                sequential file access.
  156.  
  157.  19.  PRECL -  physical record length on last read or
  158.                write.  This field is initialized to zero
  159.                at open.  On write, BLKSZ will be calculated
  160.                if this field is zero, else this field will
  161.                overide length allowing short blocks to be
  162.                written.  This is useful in processing files
  163.                of unknown length with fixed block logic.
  164.                The last block read may be short, and the
  165.                corresponding last block written may be short.
  166.  
  167. Do not modify the reserved areas which are only used by
  168. PC/370 IOS while file is open.  See TESTIO.ALC for test
  169. of each access method and error conditions.
  170.  
  171.  EJECT
  172.  
  173. C.  Program load and execution services
  174.  
  175.     SVC  FUNCTION  OPTIONS
  176.  
  177.      15  USEREXIT  transfer control to native code user exit at
  178.                    relative address in reg 15 via far call
  179.  
  180.      25  LOAD      reg 1 points to ASCIIZ path/filename
  181.                    on retrun, reg 0 has file address, reg 1 has length
  182.  
  183.      26  ATTACH    reg 0 must have file address of COM file and
  184.                    reg 1 must have desired length of attached addr. space
  185.  
  186.      27  DETACH    if in attacded address space, exit to next instruction
  187.                    after attach in mother address space else exit to MS-DOS
  188.  
  189.  
  190. PC/370 release 2 includes support for dynamic loading and execution
  191. of 370 modules assembled and linked by A370.EXE and L370.EXE.
  192. Any file including COM and MOD type files can be loaded into free
  193. memory by use of the LOAD SVC 25.  The only argument required is
  194. the address of the path and file name in register 1.  The file name
  195. must end with a suffix of the form .XXX or a zero byte.  The largest
  196. free memory area will be allocated and the file loaded into it.
  197. Register 0 will be set to the address of the area, and register 1 will
  198. be set to the length of the file.  The unused portion of the allocated
  199. area will be freed.  If the load operation was successful, register 15
  200. will be set to zero, else it will be set to 1.  Demo test program
  201. TESTSVC.ALC illustrates the use of the load function to load an 8086
  202. assembly language subroutine and execute it via user exit SVC 15.
  203.  
  204. Any 370 COM file created by L370.EXE and loaded via the load SVC 25 above,
  205. can be executed it its own address space via the attach SVC 26.  Register
  206. 0 must be set to point to the COM file (set by load SVC 25) and register 1
  207. must be set to address space size (minimum set by load SVC 25),  If additional
  208. space is to be included in the attached address space for dynamic use via
  209. GETMAIN/FREEMAIN SVC's 10/11, then the area to be added must be allocated
  210. in the mother address space prior to issuing attach SVC 26 and the total
  211. length of the COM file plus the allocated free space placed in register 1.
  212. A COM file can be executed multiple times via attach by reloading registers
  213. 0 and 1 and reissuing SVC 26.  On second and following calls, the same
  214. address space control block built on the first call in the COM prefix area
  215. is reused (See ASCB.DOC for layout) since it overlays original COM prefix
  216. data.
  217.  
  218. Execution of the attached address space can be terminated via a detach
  219. SVC 27 which restores the mother address space and continues execution at
  220. the next instruction following the attach SVC 26.  The only other way to
  221. terminate the attached address space normally is to issue an exit SVC 0
  222. which exits directly to MS-DOS.  A detach SVC 27 in an address space which
  223. has no mother, will cause exit to MS-DOS.
  224.  
  225. An alternative to using attach/detach to execute dynamically loaded 370
  226. code is to use simple branch and link.  For 370 code linked into COM file,
  227. the 370 code starts X'210' from the beginning of the COM file.  For code
  228. linked into MOD type file by L370.EXE using option M,  the 370 code starts
  229. immediately at the beginning of the file (i.e. the file load address
  230. returned in register 0 by load SVC 25).
  231.  
  232. For example of each type program loading and execution, see TEST25ML.ALC,
  233. Z86SUB.ASM, TEST25S1.ALC, TEST25S2.ALC, and TEST25S3.ALC.
  234.  
  235. The virtual address space estabished for the execution of COM files created
  236. by L370.EXE has the following memory layout.  For a sample DSECT of the
  237. address space control block, see ASCB.ALC.
  238.  
  239.  000 INITIAL PROGRAM LOAD PSW
  240.  008 INITIAL PROGRAM LOAD CCW1
  241.  010 INITIAL PROGRAM LOAD CCW2
  242.  018 EXTERNAL OLD PSW
  243.  020 SUPERVISOR CALL OLD PSW
  244.  028 PROGRAM OLD PSW
  245.  030 MACHINE CHECK OLD PSW
  246.  038 INPUT/OUTPUT OLD PSW
  247.  040 CHANNEL STATUS WORD
  248.  048 CHANNEL ADDRESS WORD
  249.  050 INTERVAL TIMER
  250.  058 EXTERNAL NEW PSW
  251.  060 SUPERVISOR CALL NEW PSW
  252.  068 PROGRAM NEW PSW
  253.  070 MACHINE CHECK NEW PSW
  254.  078 INPUT/OUTPUT NEW PSW
  255.  080 MS-DOS COMMAND LINE WITH LEADING LENGTH BYTE IN BINARY
  256.  100 SVC ATTACH instruction
  257.  102 SVC DETACH instruction pointed by reg 14 at entry
  258.  104 address space control block ASCB for current COM program
  259.  124 reserved
  260.  138 save area pointed to by reg 13 at entry
  261.  180 PC/370 package identification record
  262.  200 beginning of 370 code and default entry pointed to by reg 15
  263.      at entry if no other entry point specified on ALC END statement.
  264.  
  265.  EJECT
  266.  
  267. D.  All PC/370 supervisor services in SVC order
  268.  
  269.     SVC  FUNCTION        REGISTERS input/output
  270.  
  271.       0  exit to MS-DOS  none
  272.       1  open file       reg 2 = DCB address
  273.       2  close file      reg 2 = DCB address
  274.       3  read block      reg 2 = DCB, reg 1 must be address of block or zero
  275.       4  write block     reg 2 = DCB, reg 1 must be address of block or zero
  276.       5  get record      reg 2 = DCB, reg 1 must be address of area or zero
  277.       6  put record      reg 2 = DCB, reg 1 must be address of area or zero
  278.       7  delete file     reg 2 = DCB address
  279.       8  search file     reg 2 = DCB address/reg 0 = return code 0 if found
  280.       9  program trace   3 character trace ID follows SVC (see DEBUG.DOC)
  281.      10  get memory      reg 1 = length/reg 2 = address, reg 0 = 0 if ok
  282.                          if reg 0 > 0, then reg 1 = maximum memory available
  283.      11  free memory     reg 1 = length and reg 2 = address/reg 0 = 0 if ok
  284.      12  ASCII to EBCDIC reg 1 = address and reg 2 = length
  285.      13  EBCDIC to ASCII reg 1 = address and reg 2 = length
  286.      14  set SPIE        if reg 1 = 0, remove SPIE else set SPIE exit to reg 1
  287.                          at SPIE entry, reg 0 and 1 contain current PSW
  288.      15  user exit       reg 15 = entry point to COM 80x86 code via far call
  289.      16  instr. count    /reg 1 = current 370 instruction count
  290.      17  load user exit  reg 1 = ASCIIZ path/file name/reg 0=addr.reg 1=len.
  291.      18  time of date    /reg 0 = hour, minute, second, 100th second,
  292.                          reg 1 = year, reg 2 = day, month, day of week
  293.      19  allocate memory reg 1 = address of MS-DOS real block, reg 2 = length
  294.                          /if reg 0 not zero, then reg 2 = max. available
  295.      20  deallocate mem. reg 1 = address of MS-DOS real block
  296.      21  input byte      reg 1 = device address, reg 0 = byte
  297.      22  output byte     reg 1 = device, reg 0 = byte
  298.      23  rename file     reg 2 = DCB address
  299.      24  display line    reg 1 = attributes, reg 2 = address, reg 15 = row/col
  300.      25  load file       reg 1 = path/filename/reg 0 = address, reg 1 = length
  301.      26  attach program  reg 0 = COM file address, reg 1 = address space lenth
  302.      27  detach program  none (return to instruction after attach)
  303.  
  304.     128 - 191 issue BIOS interrupt call with function = SVC # - X'80'
  305.  
  306.         AX - low bytes of register 0
  307.         BX - low bytes of register 1
  308.         CX - low bytes of register 14
  309.         DX - low bytes of register 15
  310.  
  311.         If carry set by call, then CC =3 else CC = 0.
  312.         8086 flags returned in high bytes of R0.
  313.  
  314.     200 - 256 issue MS-DOS function call using function = SVC # - 200
  315.  
  316.         AX - low bytes of register 0
  317.         BX - low bytes of register 1
  318.         DX - low bytes of register 2
  319.         CL - set to (SVC number - 200) at entry
  320.  
  321.         MS-DOS svcs 9 and 10 support automatic
  322.         EBCDIC and ASCII conversion.
  323.  
  324.         One of the most frequently used SVC's is write to operator.
  325.         For example, to print message on standard output device via
  326.         MS-DOS function call 9, the following 2 PC/370 instructions can
  327.         be used:
  328.  
  329.            LA  R2,=C'THIS IS A DEMO WTO MESSAGE$'
  330.            SVC 209
  331.  
  332. Please send any suggestions for improving this documention.  I tend to
  333. assume that everyone loves to read technical manuals.
  334.