jb@csustan.UUCP (john birchfield) (10/01/86)
It appears I forgot something for the unshar program - here follows the dos_a.a source in shar form - use unshar to extract it or /bin/sh on un*x before you download ... A thousand pardons for not getting IT (whatever it is) together enough to get it all out on the 1st pass ... *~*=*-*=*~*=*-*=*~*=*-*=*~*[cut-here]*~*=*-*=*~*=*-*=*~*=*-*=*~*=*-*=*~* #! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create: # dos_a.a # This archive created: 10-01-86 7:03:42# By: (Tandy1200 (home)) export PATH; PATH=/bin:/usr/bin:$PATH echo shar: "extracting 'dos_a.a'" '(3828 characters)' if test -f 'dos_a.a' then echo shar: "will not over-write existing file 'dos_a.a'" else sed 's/^ X//' << \***_Shar_Eof_Upload_*** > 'dos_a.a' X; DOS_A.A - low level stuff - access to DOS - mostly used by X; routines in DOS_C.C - a small attempt to get more X; Un*x Library compatibility into the C-Ware compiler. X; X X; This code is neither complete nor faithful but it is X; somewhat of a start ... X X; --- 24 Sep '86 --- X; -- John Birchfield -- X X X X X; SET_DTA_ - used by opendir () and readdir () {see below} X; to establish the current dta { Disk Transfer Address } for X; subsequent i/o operations. Not needed anywhere else X X; Usage: set_dta (dirp); X X CSEG X PUBLIC set_dta_ Xset_dta_: X push bp X mov bp, sp X mov si, [bp+4] X mov dx, si X mov ah, 1ah X int 21h X mov sp, bp X pop bp X ret X X X X X; A_OPEN_DIR_ - Used by opendir (&direct) in DOS_C.C X; direct is a structure which is filled in by MsDos X; on a successful call ... see DOS.H - the direct X; parameter is set up in readdir () by a call to set_dta () X X; Usage: if (a_open_dir (name)) X; call_was_good X X PUBLIC a_open_dir_ Xa_open_dir_: X push bp X mov bp, sp X sub sp, 2 X mov word [bp-2], 1 X mov si, word [bp+4] X mov dx, si X mov cx, 37h X mov ah, 4eh X int 21h X jnc a_od_good X mov word [bp-2], 0 Xa_od_good: X mov ax, word [bp-2] X mov sp, bp X pop bp X ret X X X X X; A_READ_DIR_ - Used by readdir (&direct) in DOS_C.C - Look X; at the code in readdir (&direct). All useful information X; is returned to struct direct as readdir performs a set_dta X; to it's address. X X; Usage: if (a_read_dir ()) X; call_was_good X X PUBLIC a_read_dir_ Xa_read_dir_: X push bp X mov bp, sp X sub sp, 2 X mov word [bp-2], 1 X mov ah, 4fh X int 21h X jnc a_rd_good X mov word [bp-2], 0 Xa_rd_good: X mov ax, word [bp-2] X mov sp, bp X pop bp X ret X X X X X; CHDIR_ - chdir (path) can be used by any user function if the X; need arises. It returns TRUE for FAIL and FALSE for success. X; this value seems to be what Un*x returns - PATH is a NULL X; terminated character specifying the desired base directory X; to change to. X X; Usage: if (chdir (path)==0) X; SUCCESS; X PUBLIC chdir_ Xchdir_: X push bp X mov bp, sp X sub sp, 2 X mov word [bp-2], 0 X mov dx, word [bp+4] X mov ah, 3bh X int 21h X jnc good_cd X mov word [bp-2], -1 Xgood_cd: X mov ax, [bp-2] X mov sp, bp X pop bp X ret X X X X X; MKDIR_ - Mkdir takes a directory or path name and attempts to X; create a corresponding directory - If successful then 0 is X; returned - if not -1 is returned X X; Usage: if (mkdir (directoryname)==0) X; SUCCESS; X PUBLIC mkdir_ Xmkdir_: X push bp X mov bp, sp X sub sp, 2 X mov word [bp-2], 0 X mov dx, [bp+4] X mov ah, 39h X int 21h X jnc good_md X mov word [bp-2], 1 Xgood_md: X mov ax, [bp-2] X mov sp, bp X pop bp X ret X X X X X; IOCTL - ioctl (&ioctlbuf) is the generic ioctl hook from X; C to MsDos. It is not very close to Un*x in it's X; implementation. The confusion is generated by the requirement X; to go here and there in MsDos to get the same information X; about a device or file that Un*x provides from one system X; call. All information returned by this call is provided in X; the structure ioctlbuf. If IOCTL was successful, it returns X; 0 - otherwise get out your MsDos Manual. X; X; The structure is defined in IOCTL.H and looks like ... X X; struct ioctlbuf { X; unsigned cmd, AX Register X; handle, BX Register X; cnt, CX Register X; devdata; DX Register X; }; X X CSEG X PUBLIC ioctl_ Xioctl_: X push bp X mov bp, sp X mov si, [bp+4] X mov al, [si] X mov bx, [si+2] X mov cx, [si+4] X mov dx, [si+6] X mov ah, 44h X int 21h X mov si, [bp+4] X mov [si], ax X mov [si+2], bx X mov [si+4], cx X mov [si+6], dx X jnc good_ioctl_call X or ax, 1h X jmp ioctl_call_exit Xgood_ioctl_call: X mov ax, 0 Xioctl_call_exit: X pop bp X ret X X END ***_Shar_Eof_Upload_*** if test 3828 -ne "`wc -c < 'dos_a.a'`" then echo shar: "error transmitting 'dos_a.a'" '(should have been 3828 characters)' fi fi exit 0 # End of shell archive -- John Birchfield lll-crg.arpa!csustan!jb 411 Crane Ave., Turlock, CA 95380 (209) 634-6243