title Module from library BASE_5 : UDSKUG name ('UDSKUG') maclib baselib.lib ; Module unreads a byte from disk input buffer ; This enhanced module allows multiple channel I/O ; Copyright (C) Werner Cirsovius ; Hohe Weide 44 ; D-20253 Hamburg ; Tel.: +49-40-4223247 ; Version 1.0 September 1991 ; ENTRY The location RDPBLK must point to a parameter block ; defined as follows: ; PB+0,1 : Record buffer - default standard ; PB+2 : Record pointer - default 128 ; PB+3,4 : File control block - default standard ; PB+5 : Current user (-1 none) - default none ; EXIT On error carry will be set entry udskug extrn rdpblk,usrget,usrset,decrrn extrn curdma,setdma,setrnd,rndred,dskred udskug: push ix ld ix,(rdpblk) ; Get block call .udskug ; .. do the job pop ix ret .udskug: ld a,(ix+2) ; Get pointer dec a ; Bump pointer ld (ix+2),a ret p ; .. in range push de push hl ld a,reclng-1 ld (ix+2),a ; Init pointer call curdma push hl ld e,(ix+0) ld d,(ix+1) call setdma ; .. set disk buffer ld e,(ix+3) ld d,(ix+4) call .setrnd ; Calculate record call decrrn ; Get last one read call decrrn ; Correct it push hl ld l,(ix+3) ld h,(ix+4) ld de,_RRN add hl,de pop de ld (hl),e ; Set record inc hl ld (hl),d inc hl ld (hl),a ld e,(ix+3) ld d,(ix+4) call .rndred ; Read record pop de push af call setdma ; Set old buffer pop af pop hl pop de ret ; ; Set random record - take care of user area ; .setrnd: ld a,(ix+5) ld b,a inc a ; Test user selected jr z,skpus ; .. nope call usrget ; .. get it ld (curusr),a ld a,b call usrset ; .. set it skpus: call setrnd ret ; ; Read random record - take care of user area ; .rndred: call rndred ; Position record call nc,dskred ; Read record push af call setusr ; Set user on request pop af ret ; ; Set user on request ; setusr: ld a,(ix+5) inc a ; Test user selected ret z ld a,(curusr) call usrset ; .. set old ret dseg curusr: ds 1 end