rt mov #40*4 ,w.nlen+windsc ; amount to map map$s #windsc ; do it please bcs 90$ ; oops inc mapcnt ; Stats 10$: mov #1 ,r0 ; success, exit return ; bye 90$: movb @#$DSW ,r0 ; error, return the error code return unmapc::tst #idspac ; I/D space version. If so, we bne 20$ ; Yes, exit. mov r.gid+regdsc,w.nrid+windsc ; don't need to remap. mov #WS.WRT ,w.nsts+windsc ; do a map next (redundant) mov #40*4 ,w.noff+windsc ; offset 4kw from region start mov #40*4 ,w.nlen+windsc ; amount to map clr highmap ; indicate which part of index mapped tst fmap ; Will fast mapping function? beq 10$ ; No mov #100050 ,r0 ; Yes, setup for fast mapping mov #40*4 ,r1 ; Offset mov #40*4 ,r2 ; Size iot ; Try it out tst r0 ; Successful? bpl 20$ ; Yes. ; 10$: map$s #windsc ; do it please bcs 90$ ; oops inc mapcnt ; Stats 20$: mov #1 ,r0 ; success, exit return ; bye 90$: movb @#$DSW ,r0 ; error, return the error code jmp maperr ;*********** TEMP return .endc ; if EQ, EXTEND .sbttl allocate memory for index .if eq ,EXTEND ; mapping to a region for buffering .ift mapmac::mov r1 ,-(sp) ; save it cmp highmap ,#3 ; Mapped already? beq 10$ ; Yes, don't bother then mov #3 ,highmap ; Not mapped to index anymore mov #40*2 ,w.nlen+windsc ; amount to map mov #40*20 ,w.noff+windsc ; offset 16kw from region start tst #idspac ; I/D space? beq 5$ ; No mov #40*14 ,w.noff+windsc ; Yes,offset 12kw from region start 5$: map$s #windsc ; do it please bcs maperr ; oops inc mapcnt ; Stats 10$: mov 4(sp) ,r1 ; macro buffer number mul #1000 ,r1 ; buffers are 512 bytes in size mov #120000 ,r0 ; base address of the window add r1 ,r0 ; offset into the window mov (sp)+ ,r1 ; pop saved r1 return ; back to caller now mapwin::mov 2(sp) ,r0 ; get offset into index to return tst w ; which window are we working on? beq 20$ ; file window number zero cmp highmap ,#2 ; already mapped correctly? beq 10$ ; yes, skip the remap mov #40*4 ,w.nlen+windsc ; amount to map mov #40*14 ,w.noff+windsc ; offset 12kw from region start tst #idspac ; I/D space? beq 5$ ; No mov #40*10 ,w.noff+windsc ; Yes,offset 8kw from region start 5$: map$s #windsc ; do it please bcs maperr ; oops inc mapcnt ; Stats mov #2 ,highmap ; show that we are not mapped to low 10$: br 50$ ; and return the address 20$: cmp r0 ,#3777 ; is there room for this in first 4kw? blos 40$ ; yes sub #4000 ,r0 ; no, map up to next 4kw boundary cmp highmap ,#1 ; already mapped here ? beq 30$ ; yes, skip the remap mov #40*4 ,w.nlen+windsc ; amount to map mov #40*10 ,w.noff+windsc ; offset 8kw from region start tst #idspac ; I/D space? beq 35$ ; No mov #40*4 ,w.noff+windsc ; Yes, offset 4kw from region start 35$: map$s #windsc ; do it please inc mapcnt ; Stats mov #1 ,highmap ; show that we are not mapped to low 30$: br 50$ ; and return the address 40$: tst highmap ; mapped to the low 4kw of index ? beq 50$ ; yes mov #40*4 ,w.noff+windsc ; no, remap to the low 4k area of index mov #40*4 ,w.nlen+windsc ; amount to map tst #idspac ; I/D space version? beq 45$ ; No clr w.noff+windsc ; Yes, start mapping at the start. 45$: map$s #windsc ; do it please inc mapcnt ; Stats clr highmap ; say we are already mapped 50$: asl r0 ; each entry is 2 words in size asl r0 add #120000 ,r0 return maperr: movb @#$DSW ,r0 mov r0 ,-(sp) mov #fmt ,-(sp) call xprintf exit$s getvm:: clr r0 ; failure (?) mov 4(sp) ,r1 ; window number to allocate tstb indcre(r1) ; already cbeen called ? bne 100$ ; yes, die tst r1 ; which window are we doing beq 10$ ; main one mov #<4000*4>/4,@6(sp) ; alternate index br 20$ 10$: mov #<4000*10>/4,@6(sp) ; size of index (8kw) 20$: mov #120000 ,r0 ; base of apr5 mapping incb indcre(r1) ; remember that we were called already 100$: return allbuf::mov #4*4 ,@2(sp) mov #1PDPMEMMAC[.050036]PDPMEM.MAC[.050036]    X14|H [4;Ik(&'( k ߫H&P` \RrPP2PPzPP{PPPPP2P~\$\\TD 0D \~ hi) +\ ^( n ^( np\^txY\^ˀ\!kVk<\F˰<˴ˬ\VVkˤ1`@lP ABCDEFGHIJKLMNOPQRSTUVWXYZ$.?0123456789<@<SЬTЬ UQS>?\\\\\\\\\`:#@'="\abcdefghi\\\\\\\jklmnopqr\\\\\\\~stuvwxyz\\\\\\\\\\\\\\\\\\\\\\{ABCDEFGHI\\\\\\}JKLMNOPQR\\\\\\\\STUVWXYZ\\\\\\0123456789\\\\\  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`ABCDEFGHIJKLMNOPQRSTUVWXYZ{|}~@ggh<i|o<m<4p<p<k|Zn<l fr rwx<x<x<x޺<w@]@@fjnr]Ze@@|> | |v<H|  |  |xz|  |zt f r   < &^ @&@'*/V,"?Lh:hmBmz|z{x`y~|fN|@@|@͂|@ ݃ƃ<ns<|Ŏ |️|ep|u|-@率|<ᄇ2ֻr||ZRM | ntB|xyvZw|J=|R>|J? nnaa|bddf20000 ,r0 tst #idspac beq 100$ mov #100000 ,r0 100$: return .endc ; if eq, EXTEND .sbttl allocate memory for index .if ne ,EXTEND .ift ; Note: Old method via extk$s ; ; char *getvm(size_of_block,block_number,&amount_allocated) ; ; Request size is in number of index blocks. Each index block ; is 4 bytes for the PDP-11. .mcall extk$s ,gtsk$s .save .psect rwdata .even vmbase: .word 0 vmtop: .word 0 vmalloc:.word 0 .psect index ,rw,d,gbl,rel,ovr windex::.word 0,0 ; extra at top of task .restore getvm:: tst vmbase ; do we have anything yet ? bne 10$ ; yes sub #40 ,sp ; no, do a gtsk$s to find it out mov sp ,r1 ; point to the buffer gtsk$s r1 ; get task info mov g.tsts(r1),r1 ; get task image size bic #1 ,r1 ; insure even mov #windex ,vmbase ; save base address of this then mov r1 ,vmtop ; save top address also add #40 ,sp ; pop buffer 10$: mov 2(sp) ,r1 ; number of entries to allocate sub vmalloc ,r1 ; less what we already allocated mul #4 ,r1 ; size of allocation in bytes ash #-6 ,r1 ; size of allocation in 32 word chunks bic #^c77 ,r1 ; drop any bits propagated over extk$s r1 ; request from exec bcs 90$ ; it failed ash #6 ,r1 ; convert back to number of bytes all clr r0 ; and convert back to number of entries div #4 ,r0 ; and return the count mov r0 ,@6(sp) ; send it back to caller add r0 ,vmalloc ; keep track of allocation so far mov vmbase ,r0 ; return base address also br 100$ ; exit 90$: clr r0 ; error exit, return address of zero 100$: return ; exit .endc ; if ne, EXTEND .sbttl allocate buffering for the work file .if ne ,EXTEND .ift ; char *allbuffer(&n_allocated,min_number,max_number) ; ; Allocate cache for disk workfile buffering. At some point ; later we will create a dynamic region (if a free apr is ; around) and write a new cacher to dynamically map things. ; It returns the number of 512 byte blocks allocated. .save .psect rwdata cache: .blkb 1000*4 .restore allbuffer:: mob #4 ,@2(sp) mov #cache ,r0 return mapcache:: unmapcache:: mapwin:: return .endc ; if ne, EXTEND .end