Path: news.weeg.uiowa.edu!news.uiowa.edu!hobbes.physics.uiowa.edu!math.ohio-state.edu!caen!usenet.coe.montana.edu!news.uoregon.edu!cie.uoregon.edu!nparker From: nparker@cie.uoregon.edu (Neil Parker) Newsgroups: comp.sys.apple2.programmer Subject: Re: Pascal info Date: 22 Sep 1993 08:47:52 GMT Organization: The Universal Society for the Prevention of Reality Lines: 75 Message-ID: <27p3fp$1de@pith.uoregon.edu> References: <27h20p$3sd@vixen.cso.uiuc.edu> NNTP-Posting-Host: cie.uoregon.edu In article <27h20p$3sd@vixen.cso.uiuc.edu> wogg0743@uxa.cso.uiuc.edu (Shakespeare) writes: >Can anyone tell me where in memory old Apple II Pascal kept its disk >routines and what the conditions were when they were called? This is for >an emulation project. In version 1.1, the disk routines are on the language card, in the second bank $D000-$DFFF area (the one you get by referencing $C083). There are four routines, corresponding to the four Pascal "unitio" calls (UNITREAD, UNITWRITE, UNITCLEAR, and UNITSTATUS). The entry points in version 1.1 are as follows: DWRITE: $D028 DREAD: $D02C DINIT: $D683 DSTAT: $DCC5 Parameters are passed in the accumulator and on the stack. For all calls, the accumulator contains the unit number. For DREAD and DWRITE, the stack looks like this: Control word (ignored) Drive number (word; apparently the same as the unit number) Buffer address (word) Byte count (word) Block number (word) Return address (word) TOS --> The "Control word" is the MODE parameter from the UNITREAD/UNITWRITE call, and is ignored for disk drive accesses. The "Buffer address" is the address of the data to be read or written. The "Byte count" is the number of bytes to be read or written; it need not be a multiple of 512 (the block size), in which case the DREAD routine must read the final block into a temporary buffer and hand only the requested amount of data back to the caller (DWRITE can safely round the byte count up to the next multiple of 512, since extra garbage at the end of the block doesn't matter). For DINIT, the only thing on the top of the stack is the return address. For DSTAT, the stack looks like this: Pointer to status record Control word Return address TOS --> The "Control word" has the following format: Bit Purpose --- ------- 15-13 User-defined 12-2 Reserved 1 0=call is for unit status, 1=call is for unit control 0 0=return status of output channel, 1=return status of input channel The DSTAT call should fill out the status record as follows: 1st word: Number of bytes buffered in direction asked for. If this can't be determined, store a 0 here. 2nd word: Number of bytes per sector 3rd word: Number of sectors per track 4th word: Number of tracks per disk Each of the four calls should pop its parameters off the stack before returning, and should return an IORESULT code in the X-register. - Neil Parker -- Neil Parker No cute ASCII art...no cute quote...no cute nparker@cie.uoregon.edu disclaimer...no deposit, no return... parker@corona.uoregon.edu (This space intentionally left blank: )