Home » Archimedes archive » Zipped Apps » BCPL » BCPL/alib/doc
BCPL/alib/doc
This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.
Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.
Tape/disk: | Home » Archimedes archive » Zipped Apps » BCPL |
Filename: | BCPL/alib/doc |
Read OK: | ✔ |
File size: | 2641 bytes |
Load address: | 0000 |
Exec address: | 0000 |
File contents
BCPL document of 25 Oct 85 17:38:21 Compiler options Default values are given in square brackets. Front end: B [off] stack grows from high to low addresses - point VECs at the end, not beginning C [on] equate cases L [on] enable special LISP operators R [off] 'restricted' language Sn [4] set savespace size T [off] print parse tree Xn [large] set extension level to n $tag set tag to TRUE $tag' set tag to FALSE Dn - ignored - Code generator options: A [off] generate AOF B [on] ensure RB contains address of destination procedure on call C [off] stack checking P [off] profile and call counting K [off] call counting N [off] generate variable names in code S [on] produce compacter code at the expense of speed by compiling various sequences out of line Wn - ignored - Dn [0] set CG debug mode to n. I assure you, you don't want to use this On [1] set CG optimise mode to n Switch options must be preceded by + or -. Options may be separated by commas and spaces. Front end options are seperated from code generator ones by /. If the B front-end option is used, the code generated requires the support of a different (currently non-existent) mclib. The P code generator option currently generates only entry counts. The N code generator option is only partially implemented at present. The library 14 PutByte(vec, offset, value) 15 result := GetByte(vec, offset) 37 result := GBytes(hardware-address, size) 38 PBytes(hardware-address, size, data) 16 result := MulDiv(a, b, c) result = a*b/c result2 = a*b REM c 20 ch := CapitalCh(ch) 21 comparison := CompCh(ch1, ch2) result has the sign of ch1-ch2 (case folded) 22 comparison := CompString(s1, s2) 35 Stop 41 frameptr := Level() 42 LongJump(frameptr, lab) The frame value must be one that is reachable by chaining back from the current frame 43 Aptovec(proc, vec ub) Note that Aptovec uses a stack frame itself 48 CreateCo(function, stacksize) 49 successcode := DeleteCo(cptr) 50 CallCo(cptr, arg) 51 ResumeCo(cptr, arg) 52 CoWait(cptr) 54 vec := GetVec(upperbound) 55 FreeVec(vec) 56 size := MaxVec() 94 error status := SWI(number, args, results) args is a 10 word BCPL vector containing the values for R0 to R9 inclusive results is a 10 word BCPL vector to receive the values of R0 to R9 inclusive after the SWI error status is non-zero if the SWI gave rise to an error 96 Avalue := OSArgs(op, handle, data) result is negative if an error occurred. (otherwise, only significant when op=handle=0) result2 receives the returned data value. 97 byte := OSBGet(channel) (#x1fe returned at end of file) result is negative on an error. 98 error := OSBPut(byte, channel) result is 0 if OK, negative if an error occurred. 99 result := OSFind(op, arg) op=0, (close) arg is file handle op ~=0 (open) arg is file name (BCPL string), returns handle 100 result := OSFile(op, filename, args) filename is a BCPL string args is a BCPL vector containing the values wanted by Brazil OSFile in R2 to R5. Where these are addresses, they are hardware adresses (ie BCPL pointers shifted up two places). result is guaranteed valid only if op is 5 If an error occurs, Result2 is returned non-zero 101 result := OSCLI(command) command is a BCPL string result is False if the command fails, True otherwise If the base of this program is not #x8000, then it tries to run the command as a sub-program. 102 error := OSWrCh(ch) result is negative if an error occurred 103 ch := OSRdCh() Result2 is the value of the carry flag result (cf OSWord 0) 104 result := OSByte(a, x, y). Result is return X value; Result2 is set to return Y value 93 result := OSByte2(a, x, y) Result is negative if an error; otherwise bottom byte = return x byte 1 = return y byte 2 is non-zero if return carry flag set (This is how OSByte should have been: I may later remove it in favour of this). 105 OSWord(number, buffer) If number=0 this does a Brazil ReadLine, and returns the length read as result and the value of the carry flag in Result2 (TRUE if set, FALSE otherwise) If number~=0 does a Brazil OSWord; no result returned 106 buffer := TKRErr(buffer, maxlength) Moves the most recent error string into the given buffer. returns the (bcpl address of the) beffer, just as passed 140 MoveWords(direction, length, from, to) from and to are BCPL addresses 141 FillWords(base, length, value) Initialise !base to base!(length-1) to value. base is a BCPL address. 112 SetEventHandler(event number, data, treatment) Treatment may have one of the values: ev_ignore (0) ev_set_flag (1) data is the (BCPL) address of a word which onoccurrence of the event will be set to a non-zero value ev_call_proc (2) data is the hardware address of a piece of code tobe called when the event occurs. Call conditions are as for the Brazil event handler. No BCPL environment is set up for the call. ev_buffer (3) data is the address of a buffer to be used for the event values. The values written are (event number<<16) + (X value<<8) + Y value. The buffer is a structure of the form insertion_pointer = 0*4 extraction_pointer = 1*4 buffer_size = 2*4 buffer = 3*4 // to (buffer_size+2)*4 Values are inserted into the buffer using the algorithm buffer!insertion_pointer := value; $( LET new_i_p = insertion_pointer+1; IF new_i_p=buffer_size THEN new_i_p := 0; IF new_i_p~=extraction_pointer THEN insertion_pointer := new_i_p $) Escape flag update is treated as event number -1: acknowledgement is done automatically. 46 stream := FindInput(name) 47 stream := FindOutput(name) Special cases are VDU: RS423: RS232: PRINTER: NULL: 29 SelectInput(stream) 30 SelectOutput(stream) 27 stream := Input() 28 stream := Output() 24 ch := RdCh() 26 WrCh(ch) 44 ch := RdBin() 45 WrBin(byte) 76 EndRead() 77 EndWrite() 25 UnRdch() 66 count := ReadBytes(vector, offset, count) 67 WriteBytes(vector, offset, count) 59 Read.Offset(stream, vector) vector!0 is set to the sequential pointer for the file open on stream 60 Set.Offset(stream, vector) Sets the sequential pointer for the file open on stream to vector!0 61 filelength := Extent(stream) 78 n := ReadN() 23 NewLine() 36 NewPage() 19 WriteF(format, a, b, c, d, e, f, g, h, i, j, k) 18 WriteS(string) 79 WriteD(n, digits) 80 WriteN(n) 81 WriteHex(n, digits) 82 WriteOct(n, digits) 83 RdArgs(keys, argv, size) 85 FindArg(keys, w) 108 centisecondtime := Time() 109 timeofdaystring := TimeOfDay() 110 datestring := Date() 90 n := Random(n) 69 PackString(vector, string) 70 UnpackString(string, vector) 63 Abort(n) Called on hardware abort, or library-detected fatal fault. The call is as from the place of the fault; n = 0 for a software-detected fault or the Arthur error code for a hardware trap Note that global n is initialised to #xAE950000+4*n. If used as an address, this will give an address exception, and if branched to will give a prefetch abort. 64 BackTrace() 65 MapStore() Variables 89 random.state 40 stackbase 57 blocklist 144 vdustream 145 errorstream Section format SectionStart = "BCPL" & globinits-SectionStart = 8 bytes of section name (8 data bytes, not a string) = 20 bytes date and time compiled, also not a string. The BCPL system uses the format, eg "07 Oct 85 15:54:35",0,0. Anything different will give odd output from MapStore. = 0 globinits & offset of global in section, global number ... & highest global number used, 0 [ This bit will not be present when using a BCPL system which requires linking rather than joining & &12345678 & offset of word in section requiring relocation .... & &87654321 (note that global initialisations need to be relocated. There's laziness for you). ] Each procedure is preceded by a 12-byte header & -1 = 7, first 7 characters of procedure name (filled with space) Compiled BCPL may preceed that with a word giving the address of static data for the section. Compiled code conventions Registers: RB 8 RL 12 RTS 11 RP 10 RG 9 RGB 7 There is an upwards-growing stack, addressed by two registers. RFP is the frame pointer, RTS the top of stack pointer (actually, it points to the first unused word above the stack). RTS is not always correct within procedures, but it always is on procedure call and must be on return. RG points at the base of the global vector; RGB addresses a set of subroutines within the library. On procedure entry, RB holds the address of the called procedure. It need not be preserved. RL holds the address of the caller's static data, and must be preserved. R14 holds the link: this must be written to both PC and PSR on return. R1 to R4 hold the first four arguments, with others on the stack above RTS in the usual way. Thus, a general procedure would look like: STMEA rts!, {rb, rp, rl, r14} ; save linkage SUB rp, rts, #16 ; new frame pointer STMEA rts!, {a1, ...} ; arguments ... MOV rts, rp ; unwind our frame LDMIB rp, {rp, rl, pc}^ ; no need to restore RB Functions return their result in R1. R0 to R6 and RB may be used without saving their values; so may R13 and moreover it is accessible from BCPL through the name NIL (assignment to NIL from BCPL has the side-effect of updating R6). R6 and R13 are guaranteed untouched by the library, and by BCPL code which does not update NIL.
00000000 42 43 50 4c 20 64 6f 63 75 6d 65 6e 74 20 6f 66 |BCPL document of| 00000010 20 32 35 20 4f 63 74 20 38 35 20 31 37 3a 33 38 | 25 Oct 85 17:38| 00000020 3a 32 31 0a 0a 43 6f 6d 70 69 6c 65 72 20 6f 70 |:21..Compiler op| 00000030 74 69 6f 6e 73 0a 0a 44 65 66 61 75 6c 74 20 76 |tions..Default v| 00000040 61 6c 75 65 73 20 61 72 65 20 67 69 76 65 6e 20 |alues are given | 00000050 69 6e 20 73 71 75 61 72 65 20 62 72 61 63 6b 65 |in square bracke| 00000060 74 73 2e 0a 0a 20 46 72 6f 6e 74 20 65 6e 64 3a |ts... Front end:| 00000070 0a 0a 20 20 20 42 09 20 5b 6f 66 66 5d 09 20 20 |.. B. [off]. | 00000080 73 74 61 63 6b 20 67 72 6f 77 73 20 66 72 6f 6d |stack grows from| 00000090 20 68 69 67 68 20 74 6f 20 6c 6f 77 20 61 64 64 | high to low add| 000000a0 72 65 73 73 65 73 20 2d 0a 09 09 20 20 70 6f 69 |resses -... poi| 000000b0 6e 74 20 56 45 43 73 20 61 74 20 74 68 65 20 65 |nt VECs at the e| 000000c0 6e 64 2c 20 6e 6f 74 20 62 65 67 69 6e 6e 69 6e |nd, not beginnin| 000000d0 67 0a 20 20 20 43 09 20 5b 6f 6e 5d 09 20 20 65 |g. C. [on]. e| 000000e0 71 75 61 74 65 20 63 61 73 65 73 0a 20 20 20 4c |quate cases. L| 000000f0 09 20 5b 6f 6e 5d 09 20 20 65 6e 61 62 6c 65 20 |. [on]. enable | 00000100 73 70 65 63 69 61 6c 20 4c 49 53 50 20 6f 70 65 |special LISP ope| 00000110 72 61 74 6f 72 73 0a 20 20 20 52 09 20 5b 6f 66 |rators. R. [of| 00000120 66 5d 09 20 20 27 72 65 73 74 72 69 63 74 65 64 |f]. 'restricted| 00000130 27 20 6c 61 6e 67 75 61 67 65 0a 20 20 20 53 6e |' language. Sn| 00000140 09 20 5b 34 5d 09 20 20 73 65 74 20 73 61 76 65 |. [4]. set save| 00000150 73 70 61 63 65 20 73 69 7a 65 0a 20 20 20 54 09 |space size. T.| 00000160 20 5b 6f 66 66 5d 09 20 20 70 72 69 6e 74 20 70 | [off]. print p| 00000170 61 72 73 65 20 74 72 65 65 0a 20 20 20 58 6e 09 |arse tree. Xn.| 00000180 20 5b 6c 61 72 67 65 5d 20 20 73 65 74 20 65 78 | [large] set ex| 00000190 74 65 6e 73 69 6f 6e 20 6c 65 76 65 6c 20 74 6f |tension level to| 000001a0 20 6e 0a 20 20 20 24 74 61 67 20 09 20 20 73 65 | n. $tag . se| 000001b0 74 20 74 61 67 20 74 6f 20 54 52 55 45 0a 20 20 |t tag to TRUE. | 000001c0 20 24 74 61 67 27 09 20 20 73 65 74 20 74 61 67 | $tag'. set tag| 000001d0 20 74 6f 20 46 41 4c 53 45 0a 20 20 20 44 6e 09 | to FALSE. Dn.| 000001e0 20 2d 20 69 67 6e 6f 72 65 64 20 2d 0a 0a 20 43 | - ignored -.. C| 000001f0 6f 64 65 20 67 65 6e 65 72 61 74 6f 72 20 6f 70 |ode generator op| 00000200 74 69 6f 6e 73 3a 0a 0a 20 20 20 41 09 20 5b 6f |tions:.. A. [o| 00000210 66 66 5d 09 20 20 67 65 6e 65 72 61 74 65 20 41 |ff]. generate A| 00000220 4f 46 0a 20 20 20 42 09 20 5b 6f 6e 5d 09 20 20 |OF. B. [on]. | 00000230 65 6e 73 75 72 65 20 52 42 20 63 6f 6e 74 61 69 |ensure RB contai| 00000240 6e 73 20 61 64 64 72 65 73 73 20 6f 66 20 64 65 |ns address of de| 00000250 73 74 69 6e 61 74 69 6f 6e 20 70 72 6f 63 65 64 |stination proced| 00000260 75 72 65 20 6f 6e 20 63 61 6c 6c 0a 20 20 20 43 |ure on call. C| 00000270 09 20 5b 6f 66 66 5d 09 20 20 73 74 61 63 6b 20 |. [off]. stack | 00000280 63 68 65 63 6b 69 6e 67 0a 20 20 20 50 09 20 5b |checking. P. [| 00000290 6f 66 66 5d 09 20 20 70 72 6f 66 69 6c 65 20 61 |off]. profile a| 000002a0 6e 64 20 63 61 6c 6c 20 63 6f 75 6e 74 69 6e 67 |nd call counting| 000002b0 0a 20 20 20 4b 09 20 5b 6f 66 66 5d 09 20 20 63 |. K. [off]. c| 000002c0 61 6c 6c 20 63 6f 75 6e 74 69 6e 67 0a 20 20 20 |all counting. | 000002d0 4e 09 20 5b 6f 66 66 5d 09 20 20 67 65 6e 65 72 |N. [off]. gener| 000002e0 61 74 65 20 76 61 72 69 61 62 6c 65 20 6e 61 6d |ate variable nam| 000002f0 65 73 20 69 6e 20 63 6f 64 65 0a 20 20 20 53 09 |es in code. S.| 00000300 20 5b 6f 6e 5d 09 20 20 70 72 6f 64 75 63 65 20 | [on]. produce | 00000310 63 6f 6d 70 61 63 74 65 72 20 63 6f 64 65 20 61 |compacter code a| 00000320 74 20 74 68 65 20 65 78 70 65 6e 73 65 20 6f 66 |t the expense of| 00000330 20 73 70 65 65 64 20 62 79 20 63 6f 6d 70 69 6c | speed by compil| 00000340 69 6e 67 0a 09 09 20 20 76 61 72 69 6f 75 73 20 |ing... various | 00000350 73 65 71 75 65 6e 63 65 73 20 6f 75 74 20 6f 66 |sequences out of| 00000360 20 6c 69 6e 65 0a 20 20 20 57 6e 09 20 2d 20 69 | line. Wn. - i| 00000370 67 6e 6f 72 65 64 20 2d 0a 20 20 20 44 6e 09 20 |gnored -. Dn. | 00000380 5b 30 5d 09 20 20 73 65 74 20 43 47 20 64 65 62 |[0]. set CG deb| 00000390 75 67 20 6d 6f 64 65 20 74 6f 20 6e 2e 0a 09 09 |ug mode to n....| 000003a0 20 20 49 20 61 73 73 75 72 65 20 79 6f 75 2c 20 | I assure you, | 000003b0 79 6f 75 20 64 6f 6e 27 74 20 77 61 6e 74 20 74 |you don't want t| 000003c0 6f 20 75 73 65 20 74 68 69 73 0a 20 20 20 4f 6e |o use this. On| 000003d0 09 20 5b 31 5d 09 20 20 73 65 74 20 43 47 20 6f |. [1]. set CG o| 000003e0 70 74 69 6d 69 73 65 20 6d 6f 64 65 20 74 6f 20 |ptimise mode to | 000003f0 6e 0a 0a 20 53 77 69 74 63 68 20 6f 70 74 69 6f |n.. Switch optio| 00000400 6e 73 20 6d 75 73 74 20 62 65 20 70 72 65 63 65 |ns must be prece| 00000410 64 65 64 20 62 79 20 2b 20 6f 72 20 2d 2e 20 20 |ded by + or -. | 00000420 4f 70 74 69 6f 6e 73 20 6d 61 79 20 62 65 20 73 |Options may be s| 00000430 65 70 61 72 61 74 65 64 20 62 79 0a 20 63 6f 6d |eparated by. com| 00000440 6d 61 73 20 61 6e 64 20 73 70 61 63 65 73 2e 20 |mas and spaces. | 00000450 20 46 72 6f 6e 74 20 65 6e 64 20 6f 70 74 69 6f | Front end optio| 00000460 6e 73 20 61 72 65 20 73 65 70 65 72 61 74 65 64 |ns are seperated| 00000470 20 66 72 6f 6d 20 63 6f 64 65 20 67 65 6e 65 72 | from code gener| 00000480 61 74 6f 72 0a 20 6f 6e 65 73 20 62 79 20 2f 2e |ator. ones by /.| 00000490 0a 0a 20 49 66 20 74 68 65 20 42 20 66 72 6f 6e |.. If the B fron| 000004a0 74 2d 65 6e 64 20 6f 70 74 69 6f 6e 20 69 73 20 |t-end option is | 000004b0 75 73 65 64 2c 20 74 68 65 20 63 6f 64 65 20 67 |used, the code g| 000004c0 65 6e 65 72 61 74 65 64 20 72 65 71 75 69 72 65 |enerated require| 000004d0 73 20 74 68 65 20 73 75 70 70 6f 72 74 0a 20 6f |s the support. o| 000004e0 66 20 61 20 64 69 66 66 65 72 65 6e 74 20 28 63 |f a different (c| 000004f0 75 72 72 65 6e 74 6c 79 20 6e 6f 6e 2d 65 78 69 |urrently non-exi| 00000500 73 74 65 6e 74 29 20 6d 63 6c 69 62 2e 0a 20 54 |stent) mclib.. T| 00000510 68 65 20 50 20 63 6f 64 65 20 67 65 6e 65 72 61 |he P code genera| 00000520 74 6f 72 20 6f 70 74 69 6f 6e 20 63 75 72 72 65 |tor option curre| 00000530 6e 74 6c 79 20 67 65 6e 65 72 61 74 65 73 20 6f |ntly generates o| 00000540 6e 6c 79 20 65 6e 74 72 79 20 63 6f 75 6e 74 73 |nly entry counts| 00000550 2e 0a 20 54 68 65 20 4e 20 63 6f 64 65 20 67 65 |.. The N code ge| 00000560 6e 65 72 61 74 6f 72 20 6f 70 74 69 6f 6e 20 69 |nerator option i| 00000570 73 20 6f 6e 6c 79 20 70 61 72 74 69 61 6c 6c 79 |s only partially| 00000580 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 61 74 20 | implemented at | 00000590 70 72 65 73 65 6e 74 2e 0a 0a 0a 54 68 65 20 6c |present....The l| 000005a0 69 62 72 61 72 79 0a 0a 31 34 09 50 75 74 42 79 |ibrary..14.PutBy| 000005b0 74 65 28 76 65 63 2c 20 6f 66 66 73 65 74 2c 20 |te(vec, offset, | 000005c0 76 61 6c 75 65 29 0a 31 35 09 72 65 73 75 6c 74 |value).15.result| 000005d0 20 3a 3d 20 47 65 74 42 79 74 65 28 76 65 63 2c | := GetByte(vec,| 000005e0 20 6f 66 66 73 65 74 29 0a 0a 33 37 09 72 65 73 | offset)..37.res| 000005f0 75 6c 74 20 3a 3d 20 47 42 79 74 65 73 28 68 61 |ult := GBytes(ha| 00000600 72 64 77 61 72 65 2d 61 64 64 72 65 73 73 2c 20 |rdware-address, | 00000610 20 73 69 7a 65 29 0a 33 38 09 50 42 79 74 65 73 | size).38.PBytes| 00000620 28 68 61 72 64 77 61 72 65 2d 61 64 64 72 65 73 |(hardware-addres| 00000630 73 2c 20 20 73 69 7a 65 2c 20 20 64 61 74 61 29 |s, size, data)| 00000640 0a 0a 31 36 09 72 65 73 75 6c 74 20 3a 3d 20 4d |..16.result := M| 00000650 75 6c 44 69 76 28 61 2c 20 62 2c 20 63 29 0a 09 |ulDiv(a, b, c)..| 00000660 20 20 20 72 65 73 75 6c 74 20 20 3d 20 61 2a 62 | result = a*b| 00000670 2f 63 0a 09 20 20 20 72 65 73 75 6c 74 32 20 3d |/c.. result2 =| 00000680 20 61 2a 62 20 52 45 4d 20 63 0a 0a 32 30 09 63 | a*b REM c..20.c| 00000690 68 20 3a 3d 20 43 61 70 69 74 61 6c 43 68 28 63 |h := CapitalCh(c| 000006a0 68 29 0a 0a 32 31 09 63 6f 6d 70 61 72 69 73 6f |h)..21.compariso| 000006b0 6e 20 3a 3d 20 43 6f 6d 70 43 68 28 63 68 31 2c |n := CompCh(ch1,| 000006c0 20 63 68 32 29 0a 09 20 20 20 72 65 73 75 6c 74 | ch2).. result| 000006d0 20 68 61 73 20 74 68 65 20 73 69 67 6e 20 6f 66 | has the sign of| 000006e0 20 63 68 31 2d 63 68 32 20 28 63 61 73 65 20 66 | ch1-ch2 (case f| 000006f0 6f 6c 64 65 64 29 0a 0a 32 32 09 63 6f 6d 70 61 |olded)..22.compa| 00000700 72 69 73 6f 6e 20 3a 3d 20 43 6f 6d 70 53 74 72 |rison := CompStr| 00000710 69 6e 67 28 73 31 2c 20 73 32 29 0a 0a 33 35 09 |ing(s1, s2)..35.| 00000720 53 74 6f 70 0a 0a 34 31 09 66 72 61 6d 65 70 74 |Stop..41.framept| 00000730 72 20 3a 3d 20 4c 65 76 65 6c 28 29 0a 0a 34 32 |r := Level()..42| 00000740 09 4c 6f 6e 67 4a 75 6d 70 28 66 72 61 6d 65 70 |.LongJump(framep| 00000750 74 72 2c 20 6c 61 62 29 0a 09 20 20 20 54 68 65 |tr, lab).. The| 00000760 20 66 72 61 6d 65 20 76 61 6c 75 65 20 6d 75 73 | frame value mus| 00000770 74 20 62 65 20 6f 6e 65 20 74 68 61 74 20 69 73 |t be one that is| 00000780 20 72 65 61 63 68 61 62 6c 65 20 62 79 20 63 68 | reachable by ch| 00000790 61 69 6e 69 6e 67 20 62 61 63 6b 0a 09 20 20 20 |aining back.. | 000007a0 66 72 6f 6d 20 74 68 65 20 63 75 72 72 65 6e 74 |from the current| 000007b0 20 66 72 61 6d 65 0a 0a 34 33 09 41 70 74 6f 76 | frame..43.Aptov| 000007c0 65 63 28 70 72 6f 63 2c 20 76 65 63 20 75 62 29 |ec(proc, vec ub)| 000007d0 0a 09 20 20 20 4e 6f 74 65 20 74 68 61 74 20 41 |.. Note that A| 000007e0 70 74 6f 76 65 63 20 75 73 65 73 20 61 20 73 74 |ptovec uses a st| 000007f0 61 63 6b 20 66 72 61 6d 65 20 69 74 73 65 6c 66 |ack frame itself| 00000800 0a 0a 34 38 09 43 72 65 61 74 65 43 6f 28 66 75 |..48.CreateCo(fu| 00000810 6e 63 74 69 6f 6e 2c 20 73 74 61 63 6b 73 69 7a |nction, stacksiz| 00000820 65 29 0a 0a 34 39 09 73 75 63 63 65 73 73 63 6f |e)..49.successco| 00000830 64 65 20 3a 3d 20 44 65 6c 65 74 65 43 6f 28 63 |de := DeleteCo(c| 00000840 70 74 72 29 0a 0a 35 30 09 43 61 6c 6c 43 6f 28 |ptr)..50.CallCo(| 00000850 63 70 74 72 2c 20 61 72 67 29 0a 0a 35 31 09 52 |cptr, arg)..51.R| 00000860 65 73 75 6d 65 43 6f 28 63 70 74 72 2c 20 61 72 |esumeCo(cptr, ar| 00000870 67 29 0a 0a 35 32 09 43 6f 57 61 69 74 28 63 70 |g)..52.CoWait(cp| 00000880 74 72 29 0a 0a 35 34 09 76 65 63 20 3a 3d 20 47 |tr)..54.vec := G| 00000890 65 74 56 65 63 28 75 70 70 65 72 62 6f 75 6e 64 |etVec(upperbound| 000008a0 29 0a 0a 35 35 09 46 72 65 65 56 65 63 28 76 65 |)..55.FreeVec(ve| 000008b0 63 29 0a 0a 35 36 09 73 69 7a 65 20 3a 3d 20 4d |c)..56.size := M| 000008c0 61 78 56 65 63 28 29 0a 0a 39 34 09 65 72 72 6f |axVec()..94.erro| 000008d0 72 20 73 74 61 74 75 73 20 3a 3d 20 53 57 49 28 |r status := SWI(| 000008e0 6e 75 6d 62 65 72 2c 20 61 72 67 73 2c 20 72 65 |number, args, re| 000008f0 73 75 6c 74 73 29 0a 09 20 20 61 72 67 73 09 20 |sults).. args. | 00000900 20 20 20 20 20 20 69 73 20 61 20 31 30 20 77 6f | is a 10 wo| 00000910 72 64 20 42 43 50 4c 20 76 65 63 74 6f 72 20 63 |rd BCPL vector c| 00000920 6f 6e 74 61 69 6e 69 6e 67 20 74 68 65 20 76 61 |ontaining the va| 00000930 6c 75 65 73 20 66 6f 72 0a 09 09 20 20 20 20 20 |lues for... | 00000940 20 20 52 30 20 74 6f 20 52 39 20 69 6e 63 6c 75 | R0 to R9 inclu| 00000950 73 69 76 65 0a 09 20 20 72 65 73 75 6c 74 73 20 |sive.. results | 00000960 20 20 20 20 20 69 73 20 61 20 31 30 20 77 6f 72 | is a 10 wor| 00000970 64 20 42 43 50 4c 20 76 65 63 74 6f 72 20 74 6f |d BCPL vector to| 00000980 20 72 65 63 65 69 76 65 20 74 68 65 20 76 61 6c | receive the val| 00000990 75 65 73 20 6f 66 0a 09 09 20 20 20 20 20 20 20 |ues of... | 000009a0 52 30 20 74 6f 20 52 39 20 69 6e 63 6c 75 73 69 |R0 to R9 inclusi| 000009b0 76 65 20 61 66 74 65 72 20 74 68 65 20 53 57 49 |ve after the SWI| 000009c0 0a 09 20 20 65 72 72 6f 72 20 73 74 61 74 75 73 |.. error status| 000009d0 20 69 73 20 6e 6f 6e 2d 7a 65 72 6f 20 69 66 20 | is non-zero if | 000009e0 74 68 65 20 53 57 49 20 67 61 76 65 20 72 69 73 |the SWI gave ris| 000009f0 65 20 74 6f 20 61 6e 20 65 72 72 6f 72 0a 0a 39 |e to an error..9| 00000a00 36 09 41 76 61 6c 75 65 20 3a 3d 20 4f 53 41 72 |6.Avalue := OSAr| 00000a10 67 73 28 6f 70 2c 20 68 61 6e 64 6c 65 2c 20 64 |gs(op, handle, d| 00000a20 61 74 61 29 0a 09 20 20 72 65 73 75 6c 74 20 69 |ata).. result i| 00000a30 73 20 6e 65 67 61 74 69 76 65 20 69 66 20 61 6e |s negative if an| 00000a40 20 65 72 72 6f 72 20 6f 63 63 75 72 72 65 64 2e | error occurred.| 00000a50 0a 09 20 20 28 6f 74 68 65 72 77 69 73 65 2c 20 |.. (otherwise, | 00000a60 6f 6e 6c 79 20 73 69 67 6e 69 66 69 63 61 6e 74 |only significant| 00000a70 20 77 68 65 6e 20 6f 70 3d 68 61 6e 64 6c 65 3d | when op=handle=| 00000a80 30 29 0a 09 20 20 72 65 73 75 6c 74 32 20 72 65 |0).. result2 re| 00000a90 63 65 69 76 65 73 20 74 68 65 20 72 65 74 75 72 |ceives the retur| 00000aa0 6e 65 64 20 64 61 74 61 20 76 61 6c 75 65 2e 0a |ned data value..| 00000ab0 0a 39 37 09 62 79 74 65 20 3a 3d 20 4f 53 42 47 |.97.byte := OSBG| 00000ac0 65 74 28 63 68 61 6e 6e 65 6c 29 0a 09 20 20 20 |et(channel).. | 00000ad0 28 23 78 31 66 65 20 72 65 74 75 72 6e 65 64 20 |(#x1fe returned | 00000ae0 61 74 20 65 6e 64 20 6f 66 20 66 69 6c 65 29 0a |at end of file).| 00000af0 09 20 20 20 72 65 73 75 6c 74 20 69 73 20 6e 65 |. result is ne| 00000b00 67 61 74 69 76 65 20 6f 6e 20 61 6e 20 65 72 72 |gative on an err| 00000b10 6f 72 2e 0a 0a 39 38 09 65 72 72 6f 72 20 3a 3d |or...98.error :=| 00000b20 20 4f 53 42 50 75 74 28 62 79 74 65 2c 20 63 68 | OSBPut(byte, ch| 00000b30 61 6e 6e 65 6c 29 0a 09 20 20 20 72 65 73 75 6c |annel).. resul| 00000b40 74 20 69 73 20 30 20 69 66 20 4f 4b 2c 20 6e 65 |t is 0 if OK, ne| 00000b50 67 61 74 69 76 65 20 69 66 20 61 6e 20 65 72 72 |gative if an err| 00000b60 6f 72 20 6f 63 63 75 72 72 65 64 2e 0a 0a 39 39 |or occurred...99| 00000b70 09 72 65 73 75 6c 74 20 3a 3d 20 4f 53 46 69 6e |.result := OSFin| 00000b80 64 28 6f 70 2c 20 61 72 67 29 0a 09 20 20 20 6f |d(op, arg).. o| 00000b90 70 3d 30 2c 20 28 63 6c 6f 73 65 29 20 61 72 67 |p=0, (close) arg| 00000ba0 20 69 73 20 66 69 6c 65 20 68 61 6e 64 6c 65 0a | is file handle.| 00000bb0 09 20 20 20 6f 70 20 7e 3d 30 20 28 6f 70 65 6e |. op ~=0 (open| 00000bc0 29 20 61 72 67 20 69 73 20 66 69 6c 65 20 6e 61 |) arg is file na| 00000bd0 6d 65 20 28 42 43 50 4c 20 73 74 72 69 6e 67 29 |me (BCPL string)| 00000be0 2c 20 72 65 74 75 72 6e 73 20 68 61 6e 64 6c 65 |, returns handle| 00000bf0 0a 0a 31 30 30 09 72 65 73 75 6c 74 20 3a 3d 20 |..100.result := | 00000c00 4f 53 46 69 6c 65 28 6f 70 2c 20 66 69 6c 65 6e |OSFile(op, filen| 00000c10 61 6d 65 2c 20 61 72 67 73 29 0a 09 20 20 66 69 |ame, args).. fi| 00000c20 6c 65 6e 61 6d 65 20 69 73 20 61 20 42 43 50 4c |lename is a BCPL| 00000c30 20 73 74 72 69 6e 67 0a 09 20 20 61 72 67 73 09 | string.. args.| 00000c40 20 20 20 69 73 20 61 20 42 43 50 4c 20 76 65 63 | is a BCPL vec| 00000c50 74 6f 72 20 63 6f 6e 74 61 69 6e 69 6e 67 20 74 |tor containing t| 00000c60 68 65 20 76 61 6c 75 65 73 20 77 61 6e 74 65 64 |he values wanted| 00000c70 20 62 79 20 42 72 61 7a 69 6c 0a 09 09 20 20 20 | by Brazil... | 00000c80 4f 53 46 69 6c 65 20 69 6e 20 52 32 20 74 6f 20 |OSFile in R2 to | 00000c90 52 35 2e 09 57 68 65 72 65 20 74 68 65 73 65 20 |R5..Where these | 00000ca0 61 72 65 20 61 64 64 72 65 73 73 65 73 2c 20 74 |are addresses, t| 00000cb0 68 65 79 20 61 72 65 0a 09 09 20 20 20 68 61 72 |hey are... har| 00000cc0 64 77 61 72 65 20 61 64 72 65 73 73 65 73 20 28 |dware adresses (| 00000cd0 69 65 20 42 43 50 4c 20 70 6f 69 6e 74 65 72 73 |ie BCPL pointers| 00000ce0 20 73 68 69 66 74 65 64 20 75 70 20 74 77 6f 20 | shifted up two | 00000cf0 70 6c 61 63 65 73 29 2e 0a 09 20 20 72 65 73 75 |places)... resu| 00000d00 6c 74 20 69 73 20 67 75 61 72 61 6e 74 65 65 64 |lt is guaranteed| 00000d10 20 76 61 6c 69 64 20 6f 6e 6c 79 20 69 66 20 6f | valid only if o| 00000d20 70 20 69 73 20 35 0a 09 49 66 20 61 6e 20 65 72 |p is 5..If an er| 00000d30 72 6f 72 20 6f 63 63 75 72 73 2c 20 52 65 73 75 |ror occurs, Resu| 00000d40 6c 74 32 20 69 73 20 72 65 74 75 72 6e 65 64 20 |lt2 is returned | 00000d50 6e 6f 6e 2d 7a 65 72 6f 0a 0a 31 30 31 09 72 65 |non-zero..101.re| 00000d60 73 75 6c 74 20 3a 3d 20 4f 53 43 4c 49 28 63 6f |sult := OSCLI(co| 00000d70 6d 6d 61 6e 64 29 0a 09 20 20 63 6f 6d 6d 61 6e |mmand).. comman| 00000d80 64 20 69 73 20 61 20 42 43 50 4c 20 73 74 72 69 |d is a BCPL stri| 00000d90 6e 67 0a 09 20 20 72 65 73 75 6c 74 20 20 69 73 |ng.. result is| 00000da0 20 46 61 6c 73 65 20 69 66 20 74 68 65 20 63 6f | False if the co| 00000db0 6d 6d 61 6e 64 20 66 61 69 6c 73 2c 20 54 72 75 |mmand fails, Tru| 00000dc0 65 20 6f 74 68 65 72 77 69 73 65 0a 09 49 66 20 |e otherwise..If | 00000dd0 74 68 65 20 62 61 73 65 20 6f 66 20 74 68 69 73 |the base of this| 00000de0 20 70 72 6f 67 72 61 6d 20 69 73 20 6e 6f 74 20 | program is not | 00000df0 23 78 38 30 30 30 2c 20 74 68 65 6e 20 69 74 20 |#x8000, then it | 00000e00 74 72 69 65 73 20 74 6f 20 72 75 6e 20 74 68 65 |tries to run the| 00000e10 0a 09 63 6f 6d 6d 61 6e 64 20 61 73 20 61 20 73 |..command as a s| 00000e20 75 62 2d 70 72 6f 67 72 61 6d 2e 0a 0a 31 30 32 |ub-program...102| 00000e30 09 65 72 72 6f 72 20 3a 3d 20 4f 53 57 72 43 68 |.error := OSWrCh| 00000e40 28 63 68 29 0a 09 20 20 20 72 65 73 75 6c 74 20 |(ch).. result | 00000e50 69 73 20 6e 65 67 61 74 69 76 65 20 69 66 20 61 |is negative if a| 00000e60 6e 20 65 72 72 6f 72 20 6f 63 63 75 72 72 65 64 |n error occurred| 00000e70 0a 0a 31 30 33 09 63 68 20 3a 3d 20 4f 53 52 64 |..103.ch := OSRd| 00000e80 43 68 28 29 0a 09 20 20 20 52 65 73 75 6c 74 32 |Ch().. Result2| 00000e90 20 69 73 20 74 68 65 20 76 61 6c 75 65 20 6f 66 | is the value of| 00000ea0 20 74 68 65 20 63 61 72 72 79 20 66 6c 61 67 20 | the carry flag | 00000eb0 72 65 73 75 6c 74 20 28 63 66 20 4f 53 57 6f 72 |result (cf OSWor| 00000ec0 64 20 30 29 0a 0a 31 30 34 09 72 65 73 75 6c 74 |d 0)..104.result| 00000ed0 20 3a 3d 20 4f 53 42 79 74 65 28 61 2c 20 78 2c | := OSByte(a, x,| 00000ee0 20 79 29 2e 0a 09 20 20 20 52 65 73 75 6c 74 20 | y)... Result | 00000ef0 69 73 20 72 65 74 75 72 6e 20 58 20 76 61 6c 75 |is return X valu| 00000f00 65 3b 20 52 65 73 75 6c 74 32 20 69 73 20 73 65 |e; Result2 is se| 00000f10 74 20 74 6f 20 72 65 74 75 72 6e 20 59 20 76 61 |t to return Y va| 00000f20 6c 75 65 0a 0a 39 33 09 72 65 73 75 6c 74 20 3a |lue..93.result :| 00000f30 3d 20 4f 53 42 79 74 65 32 28 61 2c 20 78 2c 20 |= OSByte2(a, x, | 00000f40 79 29 0a 09 20 20 20 52 65 73 75 6c 74 20 69 73 |y).. Result is| 00000f50 20 6e 65 67 61 74 69 76 65 20 69 66 20 61 6e 20 | negative if an | 00000f60 65 72 72 6f 72 3b 0a 09 20 20 20 6f 74 68 65 72 |error;.. other| 00000f70 77 69 73 65 20 62 6f 74 74 6f 6d 20 62 79 74 65 |wise bottom byte| 00000f80 20 3d 20 72 65 74 75 72 6e 20 78 0a 09 09 20 20 | = return x... | 00000f90 20 20 20 62 79 74 65 20 31 20 3d 20 72 65 74 75 | byte 1 = retu| 00000fa0 72 6e 20 79 0a 09 09 20 20 20 20 20 62 79 74 65 |rn y... byte| 00000fb0 20 32 20 69 73 20 6e 6f 6e 2d 7a 65 72 6f 20 69 | 2 is non-zero i| 00000fc0 66 20 72 65 74 75 72 6e 20 63 61 72 72 79 20 66 |f return carry f| 00000fd0 6c 61 67 20 73 65 74 0a 09 20 20 20 28 54 68 69 |lag set.. (Thi| 00000fe0 73 20 69 73 20 68 6f 77 20 4f 53 42 79 74 65 20 |s is how OSByte | 00000ff0 73 68 6f 75 6c 64 20 68 61 76 65 20 62 65 65 6e |should have been| 00001000 3a 20 49 20 6d 61 79 20 6c 61 74 65 72 20 72 65 |: I may later re| 00001010 6d 6f 76 65 20 69 74 20 69 6e 0a 09 20 20 20 20 |move it in.. | 00001020 66 61 76 6f 75 72 20 6f 66 20 74 68 69 73 29 2e |favour of this).| 00001030 0a 0a 31 30 35 09 4f 53 57 6f 72 64 28 6e 75 6d |..105.OSWord(num| 00001040 62 65 72 2c 20 62 75 66 66 65 72 29 0a 09 20 20 |ber, buffer).. | 00001050 20 49 66 20 6e 75 6d 62 65 72 3d 30 20 74 68 69 | If number=0 thi| 00001060 73 20 64 6f 65 73 20 61 20 42 72 61 7a 69 6c 20 |s does a Brazil | 00001070 52 65 61 64 4c 69 6e 65 2c 20 61 6e 64 20 72 65 |ReadLine, and re| 00001080 74 75 72 6e 73 20 74 68 65 20 6c 65 6e 67 74 68 |turns the length| 00001090 20 72 65 61 64 0a 09 09 20 20 20 20 20 20 20 61 | read... a| 000010a0 73 20 72 65 73 75 6c 74 20 61 6e 64 20 74 68 65 |s result and the| 000010b0 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 63 61 | value of the ca| 000010c0 72 72 79 20 66 6c 61 67 20 69 6e 20 52 65 73 75 |rry flag in Resu| 000010d0 6c 74 32 0a 09 09 20 20 20 20 20 20 20 28 54 52 |lt2... (TR| 000010e0 55 45 20 69 66 20 73 65 74 2c 20 46 41 4c 53 45 |UE if set, FALSE| 000010f0 20 6f 74 68 65 72 77 69 73 65 29 0a 09 20 20 20 | otherwise).. | 00001100 49 66 20 6e 75 6d 62 65 72 7e 3d 30 20 64 6f 65 |If number~=0 doe| 00001110 73 20 61 20 42 72 61 7a 69 6c 20 4f 53 57 6f 72 |s a Brazil OSWor| 00001120 64 3b 20 6e 6f 20 72 65 73 75 6c 74 20 72 65 74 |d; no result ret| 00001130 75 72 6e 65 64 0a 0a 31 30 36 09 62 75 66 66 65 |urned..106.buffe| 00001140 72 20 3a 3d 20 54 4b 52 45 72 72 28 62 75 66 66 |r := TKRErr(buff| 00001150 65 72 2c 20 6d 61 78 6c 65 6e 67 74 68 29 0a 09 |er, maxlength)..| 00001160 20 20 20 4d 6f 76 65 73 20 74 68 65 20 6d 6f 73 | Moves the mos| 00001170 74 20 72 65 63 65 6e 74 20 65 72 72 6f 72 20 73 |t recent error s| 00001180 74 72 69 6e 67 20 69 6e 74 6f 20 74 68 65 20 67 |tring into the g| 00001190 69 76 65 6e 20 62 75 66 66 65 72 2e 0a 09 20 20 |iven buffer... | 000011a0 20 72 65 74 75 72 6e 73 20 74 68 65 20 28 62 63 | returns the (bc| 000011b0 70 6c 20 61 64 64 72 65 73 73 20 6f 66 20 74 68 |pl address of th| 000011c0 65 29 20 62 65 66 66 65 72 2c 20 6a 75 73 74 20 |e) beffer, just | 000011d0 61 73 20 70 61 73 73 65 64 0a 0a 31 34 30 09 4d |as passed..140.M| 000011e0 6f 76 65 57 6f 72 64 73 28 64 69 72 65 63 74 69 |oveWords(directi| 000011f0 6f 6e 2c 20 6c 65 6e 67 74 68 2c 20 66 72 6f 6d |on, length, from| 00001200 2c 20 74 6f 29 0a 09 20 20 20 66 72 6f 6d 20 61 |, to).. from a| 00001210 6e 64 20 74 6f 20 61 72 65 20 42 43 50 4c 20 61 |nd to are BCPL a| 00001220 64 64 72 65 73 73 65 73 0a 0a 31 34 31 09 46 69 |ddresses..141.Fi| 00001230 6c 6c 57 6f 72 64 73 28 62 61 73 65 2c 20 6c 65 |llWords(base, le| 00001240 6e 67 74 68 2c 20 76 61 6c 75 65 29 0a 09 20 20 |ngth, value).. | 00001250 20 49 6e 69 74 69 61 6c 69 73 65 20 21 62 61 73 | Initialise !bas| 00001260 65 20 74 6f 20 62 61 73 65 21 28 6c 65 6e 67 74 |e to base!(lengt| 00001270 68 2d 31 29 20 74 6f 20 76 61 6c 75 65 2e 0a 09 |h-1) to value...| 00001280 20 20 20 62 61 73 65 20 69 73 20 61 20 42 43 50 | base is a BCP| 00001290 4c 20 61 64 64 72 65 73 73 2e 0a 0a 31 31 32 09 |L address...112.| 000012a0 53 65 74 45 76 65 6e 74 48 61 6e 64 6c 65 72 28 |SetEventHandler(| 000012b0 65 76 65 6e 74 20 6e 75 6d 62 65 72 2c 20 64 61 |event number, da| 000012c0 74 61 2c 20 74 72 65 61 74 6d 65 6e 74 29 0a 0a |ta, treatment)..| 000012d0 20 20 54 72 65 61 74 6d 65 6e 74 20 6d 61 79 20 | Treatment may | 000012e0 68 61 76 65 20 6f 6e 65 20 6f 66 20 74 68 65 20 |have one of the | 000012f0 76 61 6c 75 65 73 3a 0a 20 20 20 20 20 20 65 76 |values:. ev| 00001300 5f 69 67 6e 6f 72 65 20 28 30 29 0a 20 20 20 20 |_ignore (0). | 00001310 20 20 65 76 5f 73 65 74 5f 66 6c 61 67 20 28 31 | ev_set_flag (1| 00001320 29 0a 09 20 64 61 74 61 20 20 69 73 20 74 68 65 |).. data is the| 00001330 20 28 42 43 50 4c 29 20 61 64 64 72 65 73 73 20 | (BCPL) address | 00001340 6f 66 20 61 20 77 6f 72 64 20 77 68 69 63 68 20 |of a word which | 00001350 6f 6e 6f 63 63 75 72 72 65 6e 63 65 20 6f 66 20 |onoccurrence of | 00001360 74 68 65 0a 09 20 20 20 20 20 20 20 65 76 65 6e |the.. even| 00001370 74 20 77 69 6c 6c 20 62 65 20 73 65 74 20 74 6f |t will be set to| 00001380 20 61 20 6e 6f 6e 2d 7a 65 72 6f 20 76 61 6c 75 | a non-zero valu| 00001390 65 0a 20 20 20 20 20 20 65 76 5f 63 61 6c 6c 5f |e. ev_call_| 000013a0 70 72 6f 63 20 28 32 29 0a 09 20 64 61 74 61 20 |proc (2).. data | 000013b0 20 69 73 20 74 68 65 20 68 61 72 64 77 61 72 65 | is the hardware| 000013c0 20 61 64 64 72 65 73 73 20 6f 66 20 61 20 70 69 | address of a pi| 000013d0 65 63 65 20 6f 66 20 63 6f 64 65 20 74 6f 62 65 |ece of code tobe| 000013e0 20 63 61 6c 6c 65 64 20 77 68 65 6e 0a 09 20 20 | called when.. | 000013f0 20 20 20 20 20 74 68 65 20 65 76 65 6e 74 20 6f | the event o| 00001400 63 63 75 72 73 2e 20 20 43 61 6c 6c 20 63 6f 6e |ccurs. Call con| 00001410 64 69 74 69 6f 6e 73 20 61 72 65 20 61 73 20 66 |ditions are as f| 00001420 6f 72 20 74 68 65 20 42 72 61 7a 69 6c 0a 09 20 |or the Brazil.. | 00001430 20 20 20 20 20 20 65 76 65 6e 74 20 68 61 6e 64 | event hand| 00001440 6c 65 72 2e 20 20 4e 6f 20 42 43 50 4c 20 65 6e |ler. No BCPL en| 00001450 76 69 72 6f 6e 6d 65 6e 74 20 69 73 20 73 65 74 |vironment is set| 00001460 20 75 70 20 66 6f 72 20 74 68 65 20 63 61 6c 6c | up for the call| 00001470 2e 0a 0a 20 20 20 20 20 20 65 76 5f 62 75 66 66 |... ev_buff| 00001480 65 72 20 28 33 29 0a 09 20 64 61 74 61 20 20 69 |er (3).. data i| 00001490 73 20 74 68 65 20 61 64 64 72 65 73 73 20 6f 66 |s the address of| 000014a0 20 61 20 62 75 66 66 65 72 20 74 6f 20 62 65 20 | a buffer to be | 000014b0 75 73 65 64 20 66 6f 72 20 74 68 65 20 65 76 65 |used for the eve| 000014c0 6e 74 20 76 61 6c 75 65 73 2e 0a 09 20 20 20 20 |nt values... | 000014d0 20 20 20 54 68 65 20 76 61 6c 75 65 73 20 77 72 | The values wr| 000014e0 69 74 74 65 6e 20 61 72 65 0a 09 09 20 20 28 65 |itten are... (e| 000014f0 76 65 6e 74 20 6e 75 6d 62 65 72 3c 3c 31 36 29 |vent number<<16)| 00001500 20 2b 20 28 58 20 76 61 6c 75 65 3c 3c 38 29 20 | + (X value<<8) | 00001510 2b 20 59 20 76 61 6c 75 65 2e 0a 09 20 20 20 20 |+ Y value... | 00001520 20 20 20 54 68 65 20 62 75 66 66 65 72 20 69 73 | The buffer is| 00001530 20 61 20 73 74 72 75 63 74 75 72 65 20 6f 66 20 | a structure of | 00001540 74 68 65 20 66 6f 72 6d 0a 09 09 20 20 69 6e 73 |the form... ins| 00001550 65 72 74 69 6f 6e 5f 70 6f 69 6e 74 65 72 20 3d |ertion_pointer =| 00001560 20 30 2a 34 0a 09 09 20 20 65 78 74 72 61 63 74 | 0*4... extract| 00001570 69 6f 6e 5f 70 6f 69 6e 74 65 72 20 3d 20 31 2a |ion_pointer = 1*| 00001580 34 0a 09 09 20 20 62 75 66 66 65 72 5f 73 69 7a |4... buffer_siz| 00001590 65 20 3d 20 32 2a 34 0a 09 09 20 20 62 75 66 66 |e = 2*4... buff| 000015a0 65 72 20 3d 20 33 2a 34 20 2f 2f 20 74 6f 20 28 |er = 3*4 // to (| 000015b0 62 75 66 66 65 72 5f 73 69 7a 65 2b 32 29 2a 34 |buffer_size+2)*4| 000015c0 0a 09 20 20 20 20 20 20 56 61 6c 75 65 73 20 61 |.. Values a| 000015d0 72 65 20 69 6e 73 65 72 74 65 64 20 69 6e 74 6f |re inserted into| 000015e0 20 74 68 65 20 62 75 66 66 65 72 20 75 73 69 6e | the buffer usin| 000015f0 67 20 74 68 65 20 61 6c 67 6f 72 69 74 68 6d 0a |g the algorithm.| 00001600 09 09 20 20 62 75 66 66 65 72 21 69 6e 73 65 72 |.. buffer!inser| 00001610 74 69 6f 6e 5f 70 6f 69 6e 74 65 72 20 3a 3d 20 |tion_pointer := | 00001620 76 61 6c 75 65 3b 0a 09 09 20 20 24 28 20 4c 45 |value;... $( LE| 00001630 54 20 6e 65 77 5f 69 5f 70 20 3d 20 69 6e 73 65 |T new_i_p = inse| 00001640 72 74 69 6f 6e 5f 70 6f 69 6e 74 65 72 2b 31 3b |rtion_pointer+1;| 00001650 0a 09 09 20 20 20 20 20 49 46 20 6e 65 77 5f 69 |... IF new_i| 00001660 5f 70 3d 62 75 66 66 65 72 5f 73 69 7a 65 20 54 |_p=buffer_size T| 00001670 48 45 4e 20 6e 65 77 5f 69 5f 70 20 3a 3d 20 30 |HEN new_i_p := 0| 00001680 3b 0a 09 09 20 20 20 20 20 49 46 20 6e 65 77 5f |;... IF new_| 00001690 69 5f 70 7e 3d 65 78 74 72 61 63 74 69 6f 6e 5f |i_p~=extraction_| 000016a0 70 6f 69 6e 74 65 72 0a 09 09 09 54 48 45 4e 20 |pointer....THEN | 000016b0 69 6e 73 65 72 74 69 6f 6e 5f 70 6f 69 6e 74 65 |insertion_pointe| 000016c0 72 20 3a 3d 20 6e 65 77 5f 69 5f 70 0a 09 09 20 |r := new_i_p... | 000016d0 20 24 29 0a 20 20 45 73 63 61 70 65 20 66 6c 61 | $). Escape fla| 000016e0 67 20 75 70 64 61 74 65 20 69 73 20 74 72 65 61 |g update is trea| 000016f0 74 65 64 20 61 73 20 65 76 65 6e 74 20 6e 75 6d |ted as event num| 00001700 62 65 72 20 2d 31 3a 20 61 63 6b 6e 6f 77 6c 65 |ber -1: acknowle| 00001710 64 67 65 6d 65 6e 74 20 69 73 0a 20 20 64 6f 6e |dgement is. don| 00001720 65 20 61 75 74 6f 6d 61 74 69 63 61 6c 6c 79 2e |e automatically.| 00001730 0a 0a 0a 34 36 09 73 74 72 65 61 6d 20 3a 3d 20 |...46.stream := | 00001740 46 69 6e 64 49 6e 70 75 74 28 6e 61 6d 65 29 0a |FindInput(name).| 00001750 34 37 09 73 74 72 65 61 6d 20 3a 3d 20 46 69 6e |47.stream := Fin| 00001760 64 4f 75 74 70 75 74 28 6e 61 6d 65 29 0a 20 20 |dOutput(name). | 00001770 20 53 70 65 63 69 61 6c 20 63 61 73 65 73 20 61 | Special cases a| 00001780 72 65 0a 09 56 44 55 3a 0a 09 52 53 34 32 33 3a |re..VDU:..RS423:| 00001790 0a 09 52 53 32 33 32 3a 0a 09 50 52 49 4e 54 45 |..RS232:..PRINTE| 000017a0 52 3a 0a 09 4e 55 4c 4c 3a 0a 0a 32 39 09 53 65 |R:..NULL:..29.Se| 000017b0 6c 65 63 74 49 6e 70 75 74 28 73 74 72 65 61 6d |lectInput(stream| 000017c0 29 0a 33 30 09 53 65 6c 65 63 74 4f 75 74 70 75 |).30.SelectOutpu| 000017d0 74 28 73 74 72 65 61 6d 29 0a 0a 32 37 09 73 74 |t(stream)..27.st| 000017e0 72 65 61 6d 20 3a 3d 20 49 6e 70 75 74 28 29 0a |ream := Input().| 000017f0 32 38 09 73 74 72 65 61 6d 20 3a 3d 20 4f 75 74 |28.stream := Out| 00001800 70 75 74 28 29 0a 0a 32 34 09 63 68 20 3a 3d 20 |put()..24.ch := | 00001810 52 64 43 68 28 29 0a 32 36 09 57 72 43 68 28 63 |RdCh().26.WrCh(c| 00001820 68 29 0a 0a 34 34 09 63 68 20 3a 3d 20 52 64 42 |h)..44.ch := RdB| 00001830 69 6e 28 29 0a 34 35 09 57 72 42 69 6e 28 62 79 |in().45.WrBin(by| 00001840 74 65 29 0a 0a 37 36 09 45 6e 64 52 65 61 64 28 |te)..76.EndRead(| 00001850 29 0a 37 37 09 45 6e 64 57 72 69 74 65 28 29 0a |).77.EndWrite().| 00001860 0a 32 35 09 55 6e 52 64 63 68 28 29 0a 0a 36 36 |.25.UnRdch()..66| 00001870 09 63 6f 75 6e 74 20 3a 3d 20 52 65 61 64 42 79 |.count := ReadBy| 00001880 74 65 73 28 76 65 63 74 6f 72 2c 20 6f 66 66 73 |tes(vector, offs| 00001890 65 74 2c 20 63 6f 75 6e 74 29 0a 36 37 09 57 72 |et, count).67.Wr| 000018a0 69 74 65 42 79 74 65 73 28 76 65 63 74 6f 72 2c |iteBytes(vector,| 000018b0 20 6f 66 66 73 65 74 2c 20 63 6f 75 6e 74 29 0a | offset, count).| 000018c0 0a 35 39 09 52 65 61 64 2e 4f 66 66 73 65 74 28 |.59.Read.Offset(| 000018d0 73 74 72 65 61 6d 2c 20 76 65 63 74 6f 72 29 0a |stream, vector).| 000018e0 09 20 20 76 65 63 74 6f 72 21 30 20 69 73 20 73 |. vector!0 is s| 000018f0 65 74 20 74 6f 20 74 68 65 20 73 65 71 75 65 6e |et to the sequen| 00001900 74 69 61 6c 20 70 6f 69 6e 74 65 72 20 66 6f 72 |tial pointer for| 00001910 20 74 68 65 20 66 69 6c 65 20 6f 70 65 6e 20 6f | the file open o| 00001920 6e 20 73 74 72 65 61 6d 0a 0a 36 30 09 53 65 74 |n stream..60.Set| 00001930 2e 4f 66 66 73 65 74 28 73 74 72 65 61 6d 2c 20 |.Offset(stream, | 00001940 76 65 63 74 6f 72 29 0a 09 20 20 53 65 74 73 20 |vector).. Sets | 00001950 74 68 65 20 73 65 71 75 65 6e 74 69 61 6c 20 70 |the sequential p| 00001960 6f 69 6e 74 65 72 20 66 6f 72 20 74 68 65 20 66 |ointer for the f| 00001970 69 6c 65 20 6f 70 65 6e 20 6f 6e 20 20 73 74 72 |ile open on str| 00001980 65 61 6d 20 20 74 6f 20 76 65 63 74 6f 72 21 30 |eam to vector!0| 00001990 0a 0a 36 31 09 66 69 6c 65 6c 65 6e 67 74 68 20 |..61.filelength | 000019a0 3a 3d 20 45 78 74 65 6e 74 28 73 74 72 65 61 6d |:= Extent(stream| 000019b0 29 0a 0a 37 38 09 6e 20 3a 3d 20 52 65 61 64 4e |)..78.n := ReadN| 000019c0 28 29 0a 0a 32 33 09 4e 65 77 4c 69 6e 65 28 29 |()..23.NewLine()| 000019d0 0a 33 36 09 4e 65 77 50 61 67 65 28 29 0a 0a 31 |.36.NewPage()..1| 000019e0 39 09 57 72 69 74 65 46 28 66 6f 72 6d 61 74 2c |9.WriteF(format,| 000019f0 20 61 2c 20 62 2c 20 63 2c 20 64 2c 20 65 2c 20 | a, b, c, d, e, | 00001a00 66 2c 20 67 2c 20 68 2c 20 69 2c 20 6a 2c 20 6b |f, g, h, i, j, k| 00001a10 29 0a 0a 31 38 09 57 72 69 74 65 53 28 73 74 72 |)..18.WriteS(str| 00001a20 69 6e 67 29 0a 0a 37 39 09 57 72 69 74 65 44 28 |ing)..79.WriteD(| 00001a30 6e 2c 20 64 69 67 69 74 73 29 0a 0a 38 30 09 57 |n, digits)..80.W| 00001a40 72 69 74 65 4e 28 6e 29 0a 0a 38 31 09 57 72 69 |riteN(n)..81.Wri| 00001a50 74 65 48 65 78 28 6e 2c 20 64 69 67 69 74 73 29 |teHex(n, digits)| 00001a60 0a 0a 38 32 09 57 72 69 74 65 4f 63 74 28 6e 2c |..82.WriteOct(n,| 00001a70 20 64 69 67 69 74 73 29 0a 0a 38 33 09 52 64 41 | digits)..83.RdA| 00001a80 72 67 73 28 6b 65 79 73 2c 20 61 72 67 76 2c 20 |rgs(keys, argv, | 00001a90 73 69 7a 65 29 0a 38 35 09 46 69 6e 64 41 72 67 |size).85.FindArg| 00001aa0 28 6b 65 79 73 2c 20 77 29 0a 0a 31 30 38 09 63 |(keys, w)..108.c| 00001ab0 65 6e 74 69 73 65 63 6f 6e 64 74 69 6d 65 20 3a |entisecondtime :| 00001ac0 3d 20 54 69 6d 65 28 29 0a 31 30 39 09 74 69 6d |= Time().109.tim| 00001ad0 65 6f 66 64 61 79 73 74 72 69 6e 67 20 3a 3d 20 |eofdaystring := | 00001ae0 54 69 6d 65 4f 66 44 61 79 28 29 0a 31 31 30 09 |TimeOfDay().110.| 00001af0 64 61 74 65 73 74 72 69 6e 67 20 3a 3d 20 44 61 |datestring := Da| 00001b00 74 65 28 29 0a 0a 39 30 09 6e 20 3a 3d 20 52 61 |te()..90.n := Ra| 00001b10 6e 64 6f 6d 28 6e 29 0a 0a 36 39 09 50 61 63 6b |ndom(n)..69.Pack| 00001b20 53 74 72 69 6e 67 28 76 65 63 74 6f 72 2c 20 73 |String(vector, s| 00001b30 74 72 69 6e 67 29 0a 37 30 09 55 6e 70 61 63 6b |tring).70.Unpack| 00001b40 53 74 72 69 6e 67 28 73 74 72 69 6e 67 2c 20 76 |String(string, v| 00001b50 65 63 74 6f 72 29 0a 0a 36 33 09 41 62 6f 72 74 |ector)..63.Abort| 00001b60 28 6e 29 0a 09 20 20 43 61 6c 6c 65 64 20 6f 6e |(n).. Called on| 00001b70 20 68 61 72 64 77 61 72 65 20 61 62 6f 72 74 2c | hardware abort,| 00001b80 20 6f 72 20 6c 69 62 72 61 72 79 2d 64 65 74 65 | or library-dete| 00001b90 63 74 65 64 20 66 61 74 61 6c 20 66 61 75 6c 74 |cted fatal fault| 00001ba0 2e 20 20 54 68 65 20 63 61 6c 6c 0a 09 20 20 69 |. The call.. i| 00001bb0 73 20 61 73 20 66 72 6f 6d 20 74 68 65 20 70 6c |s as from the pl| 00001bc0 61 63 65 20 6f 66 20 74 68 65 20 66 61 75 6c 74 |ace of the fault| 00001bd0 3b 20 6e 20 3d 20 30 20 66 6f 72 20 61 20 73 6f |; n = 0 for a so| 00001be0 66 74 77 61 72 65 2d 64 65 74 65 63 74 65 64 0a |ftware-detected.| 00001bf0 09 20 20 66 61 75 6c 74 20 6f 72 20 74 68 65 20 |. fault or the | 00001c00 41 72 74 68 75 72 20 65 72 72 6f 72 20 63 6f 64 |Arthur error cod| 00001c10 65 20 66 6f 72 20 61 20 68 61 72 64 77 61 72 65 |e for a hardware| 00001c20 20 74 72 61 70 0a 09 20 20 4e 6f 74 65 20 74 68 | trap.. Note th| 00001c30 61 74 20 67 6c 6f 62 61 6c 20 6e 20 69 73 20 69 |at global n is i| 00001c40 6e 69 74 69 61 6c 69 73 65 64 20 74 6f 20 23 78 |nitialised to #x| 00001c50 41 45 39 35 30 30 30 30 2b 34 2a 6e 2e 09 49 66 |AE950000+4*n..If| 00001c60 20 75 73 65 64 20 61 73 20 61 6e 0a 09 20 20 61 | used as an.. a| 00001c70 64 64 72 65 73 73 2c 20 74 68 69 73 20 77 69 6c |ddress, this wil| 00001c80 6c 20 67 69 76 65 20 61 6e 20 61 64 64 72 65 73 |l give an addres| 00001c90 73 20 65 78 63 65 70 74 69 6f 6e 2c 20 61 6e 64 |s exception, and| 00001ca0 20 69 66 20 62 72 61 6e 63 68 65 64 20 74 6f 0a | if branched to.| 00001cb0 09 20 20 77 69 6c 6c 20 67 69 76 65 20 61 20 70 |. will give a p| 00001cc0 72 65 66 65 74 63 68 20 61 62 6f 72 74 2e 0a 0a |refetch abort...| 00001cd0 36 34 09 42 61 63 6b 54 72 61 63 65 28 29 0a 0a |64.BackTrace()..| 00001ce0 36 35 09 4d 61 70 53 74 6f 72 65 28 29 0a 0a 56 |65.MapStore()..V| 00001cf0 61 72 69 61 62 6c 65 73 0a 38 39 09 72 61 6e 64 |ariables.89.rand| 00001d00 6f 6d 2e 73 74 61 74 65 0a 34 30 09 73 74 61 63 |om.state.40.stac| 00001d10 6b 62 61 73 65 0a 35 37 09 62 6c 6f 63 6b 6c 69 |kbase.57.blockli| 00001d20 73 74 0a 31 34 34 09 76 64 75 73 74 72 65 61 6d |st.144.vdustream| 00001d30 0a 31 34 35 09 65 72 72 6f 72 73 74 72 65 61 6d |.145.errorstream| 00001d40 0a 0a 0a 0a 53 65 63 74 69 6f 6e 20 66 6f 72 6d |....Section form| 00001d50 61 74 0a 0a 53 65 63 74 69 6f 6e 53 74 61 72 74 |at..SectionStart| 00001d60 0a 09 3d 09 22 42 43 50 4c 22 0a 09 26 09 67 6c |..=."BCPL"..&.gl| 00001d70 6f 62 69 6e 69 74 73 2d 53 65 63 74 69 6f 6e 53 |obinits-SectionS| 00001d80 74 61 72 74 0a 09 3d 09 38 20 62 79 74 65 73 20 |tart..=.8 bytes | 00001d90 6f 66 20 73 65 63 74 69 6f 6e 20 6e 61 6d 65 20 |of section name | 00001da0 28 38 20 64 61 74 61 20 62 79 74 65 73 2c 20 6e |(8 data bytes, n| 00001db0 6f 74 20 61 20 73 74 72 69 6e 67 29 0a 09 3d 09 |ot a string)..=.| 00001dc0 32 30 20 62 79 74 65 73 20 64 61 74 65 20 61 6e |20 bytes date an| 00001dd0 64 20 74 69 6d 65 20 63 6f 6d 70 69 6c 65 64 2c |d time compiled,| 00001de0 20 61 6c 73 6f 20 6e 6f 74 20 61 20 73 74 72 69 | also not a stri| 00001df0 6e 67 2e 0a 09 09 54 68 65 20 42 43 50 4c 20 73 |ng....The BCPL s| 00001e00 79 73 74 65 6d 20 75 73 65 73 20 74 68 65 20 66 |ystem uses the f| 00001e10 6f 72 6d 61 74 2c 20 65 67 0a 09 09 22 30 37 20 |ormat, eg..."07 | 00001e20 4f 63 74 20 38 35 20 31 35 3a 35 34 3a 33 35 22 |Oct 85 15:54:35"| 00001e30 2c 30 2c 30 2e 0a 09 09 41 6e 79 74 68 69 6e 67 |,0,0....Anything| 00001e40 20 64 69 66 66 65 72 65 6e 74 20 77 69 6c 6c 20 | different will | 00001e50 67 69 76 65 20 6f 64 64 20 6f 75 74 70 75 74 20 |give odd output | 00001e60 66 72 6f 6d 20 4d 61 70 53 74 6f 72 65 2e 0a 09 |from MapStore...| 00001e70 3d 09 30 0a 0a 67 6c 6f 62 69 6e 69 74 73 0a 09 |=.0..globinits..| 00001e80 26 09 6f 66 66 73 65 74 20 6f 66 20 67 6c 6f 62 |&.offset of glob| 00001e90 61 6c 20 69 6e 20 73 65 63 74 69 6f 6e 2c 20 20 |al in section, | 00001ea0 67 6c 6f 62 61 6c 20 6e 75 6d 62 65 72 0a 09 20 |global number.. | 00001eb0 20 20 2e 2e 2e 0a 09 26 09 68 69 67 68 65 73 74 | .....&.highest| 00001ec0 20 67 6c 6f 62 61 6c 20 6e 75 6d 62 65 72 20 75 | global number u| 00001ed0 73 65 64 2c 20 30 0a 0a 5b 20 54 68 69 73 20 62 |sed, 0..[ This b| 00001ee0 69 74 20 77 69 6c 6c 20 6e 6f 74 20 62 65 20 70 |it will not be p| 00001ef0 72 65 73 65 6e 74 20 77 68 65 6e 20 75 73 69 6e |resent when usin| 00001f00 67 20 61 20 42 43 50 4c 20 73 79 73 74 65 6d 20 |g a BCPL system | 00001f10 77 68 69 63 68 20 72 65 71 75 69 72 65 73 0a 20 |which requires. | 00001f20 20 6c 69 6e 6b 69 6e 67 20 72 61 74 68 65 72 20 | linking rather | 00001f30 74 68 61 6e 20 6a 6f 69 6e 69 6e 67 0a 0a 20 20 |than joining.. | 00001f40 20 20 20 20 20 26 20 20 20 20 20 20 20 26 31 32 | & &12| 00001f50 33 34 35 36 37 38 0a 0a 09 26 09 6f 66 66 73 65 |345678...&.offse| 00001f60 74 20 6f 66 20 77 6f 72 64 20 69 6e 20 73 65 63 |t of word in sec| 00001f70 74 69 6f 6e 20 72 65 71 75 69 72 69 6e 67 20 72 |tion requiring r| 00001f80 65 6c 6f 63 61 74 69 6f 6e 0a 09 20 20 2e 2e 2e |elocation.. ...| 00001f90 2e 0a 0a 09 26 09 26 38 37 36 35 34 33 32 31 0a |....&.&87654321.| 00001fa0 28 6e 6f 74 65 20 74 68 61 74 20 67 6c 6f 62 61 |(note that globa| 00001fb0 6c 20 69 6e 69 74 69 61 6c 69 73 61 74 69 6f 6e |l initialisation| 00001fc0 73 20 6e 65 65 64 20 74 6f 20 62 65 20 72 65 6c |s need to be rel| 00001fd0 6f 63 61 74 65 64 2e 0a 54 68 65 72 65 27 73 20 |ocated..There's | 00001fe0 6c 61 7a 69 6e 65 73 73 20 66 6f 72 20 79 6f 75 |laziness for you| 00001ff0 29 2e 0a 5d 0a 0a 45 61 63 68 20 70 72 6f 63 65 |)..]..Each proce| 00002000 64 75 72 65 20 69 73 20 70 72 65 63 65 64 65 64 |dure is preceded| 00002010 20 62 79 20 61 20 31 32 2d 62 79 74 65 20 68 65 | by a 12-byte he| 00002020 61 64 65 72 0a 09 26 09 2d 31 0a 09 3d 09 37 2c |ader..&.-1..=.7,| 00002030 20 66 69 72 73 74 20 37 20 63 68 61 72 61 63 74 | first 7 charact| 00002040 65 72 73 20 6f 66 20 70 72 6f 63 65 64 75 72 65 |ers of procedure| 00002050 20 6e 61 6d 65 20 28 66 69 6c 6c 65 64 20 77 69 | name (filled wi| 00002060 74 68 20 73 70 61 63 65 29 0a 43 6f 6d 70 69 6c |th space).Compil| 00002070 65 64 20 42 43 50 4c 20 6d 61 79 20 70 72 65 63 |ed BCPL may prec| 00002080 65 65 64 20 74 68 61 74 20 77 69 74 68 20 61 20 |eed that with a | 00002090 77 6f 72 64 20 67 69 76 69 6e 67 20 74 68 65 20 |word giving the | 000020a0 61 64 64 72 65 73 73 20 6f 66 20 73 74 61 74 69 |address of stati| 000020b0 63 20 64 61 74 61 0a 66 6f 72 20 74 68 65 20 73 |c data.for the s| 000020c0 65 63 74 69 6f 6e 2e 0a 0a 0a 0a 43 6f 6d 70 69 |ection.....Compi| 000020d0 6c 65 64 20 63 6f 64 65 20 63 6f 6e 76 65 6e 74 |led code convent| 000020e0 69 6f 6e 73 0a 0a 52 65 67 69 73 74 65 72 73 3a |ions..Registers:| 000020f0 0a 0a 52 42 09 20 20 20 38 0a 52 4c 09 20 20 20 |..RB. 8.RL. | 00002100 31 32 0a 52 54 53 09 20 20 20 31 31 0a 52 50 09 |12.RTS. 11.RP.| 00002110 20 20 20 31 30 0a 52 47 09 20 20 20 39 0a 52 47 | 10.RG. 9.RG| 00002120 42 09 20 20 20 37 0a 0a 54 68 65 72 65 20 69 73 |B. 7..There is| 00002130 20 61 6e 20 75 70 77 61 72 64 73 2d 67 72 6f 77 | an upwards-grow| 00002140 69 6e 67 20 73 74 61 63 6b 2c 20 61 64 64 72 65 |ing stack, addre| 00002150 73 73 65 64 20 62 79 20 74 77 6f 20 72 65 67 69 |ssed by two regi| 00002160 73 74 65 72 73 2e 09 52 46 50 20 69 73 20 74 68 |sters..RFP is th| 00002170 65 0a 66 72 61 6d 65 20 70 6f 69 6e 74 65 72 2c |e.frame pointer,| 00002180 20 52 54 53 20 74 68 65 20 74 6f 70 20 6f 66 20 | RTS the top of | 00002190 73 74 61 63 6b 20 70 6f 69 6e 74 65 72 20 28 61 |stack pointer (a| 000021a0 63 74 75 61 6c 6c 79 2c 20 69 74 20 70 6f 69 6e |ctually, it poin| 000021b0 74 73 20 74 6f 20 74 68 65 20 66 69 72 73 74 0a |ts to the first.| 000021c0 75 6e 75 73 65 64 20 77 6f 72 64 20 61 62 6f 76 |unused word abov| 000021d0 65 20 74 68 65 20 73 74 61 63 6b 29 2e 20 20 52 |e the stack). R| 000021e0 54 53 20 69 73 20 6e 6f 74 20 61 6c 77 61 79 73 |TS is not always| 000021f0 20 63 6f 72 72 65 63 74 20 77 69 74 68 69 6e 20 | correct within | 00002200 70 72 6f 63 65 64 75 72 65 73 2c 20 62 75 74 0a |procedures, but.| 00002210 69 74 20 61 6c 77 61 79 73 20 69 73 20 6f 6e 20 |it always is on | 00002220 70 72 6f 63 65 64 75 72 65 20 63 61 6c 6c 20 61 |procedure call a| 00002230 6e 64 20 6d 75 73 74 20 62 65 20 6f 6e 20 72 65 |nd must be on re| 00002240 74 75 72 6e 2e 0a 0a 52 47 20 70 6f 69 6e 74 73 |turn...RG points| 00002250 20 61 74 20 74 68 65 20 62 61 73 65 20 6f 66 20 | at the base of | 00002260 74 68 65 20 67 6c 6f 62 61 6c 20 76 65 63 74 6f |the global vecto| 00002270 72 3b 20 52 47 42 20 61 64 64 72 65 73 73 65 73 |r; RGB addresses| 00002280 20 61 20 73 65 74 20 6f 66 20 73 75 62 72 6f 75 | a set of subrou| 00002290 74 69 6e 65 73 0a 77 69 74 68 69 6e 20 74 68 65 |tines.within the| 000022a0 20 6c 69 62 72 61 72 79 2e 0a 0a 4f 6e 20 70 72 | library...On pr| 000022b0 6f 63 65 64 75 72 65 20 65 6e 74 72 79 2c 20 52 |ocedure entry, R| 000022c0 42 20 68 6f 6c 64 73 20 74 68 65 20 61 64 64 72 |B holds the addr| 000022d0 65 73 73 20 6f 66 20 74 68 65 20 63 61 6c 6c 65 |ess of the calle| 000022e0 64 20 70 72 6f 63 65 64 75 72 65 2e 20 20 49 74 |d procedure. It| 000022f0 20 6e 65 65 64 20 6e 6f 74 0a 62 65 20 70 72 65 | need not.be pre| 00002300 73 65 72 76 65 64 2e 20 20 52 4c 20 68 6f 6c 64 |served. RL hold| 00002310 73 20 74 68 65 20 61 64 64 72 65 73 73 20 6f 66 |s the address of| 00002320 20 74 68 65 20 63 61 6c 6c 65 72 27 73 20 73 74 | the caller's st| 00002330 61 74 69 63 20 64 61 74 61 2c 20 61 6e 64 20 6d |atic data, and m| 00002340 75 73 74 20 62 65 0a 70 72 65 73 65 72 76 65 64 |ust be.preserved| 00002350 2e 20 20 52 31 34 20 68 6f 6c 64 73 20 74 68 65 |. R14 holds the| 00002360 20 6c 69 6e 6b 3a 20 74 68 69 73 20 6d 75 73 74 | link: this must| 00002370 20 62 65 20 77 72 69 74 74 65 6e 20 74 6f 20 62 | be written to b| 00002380 6f 74 68 20 50 43 20 61 6e 64 20 50 53 52 20 6f |oth PC and PSR o| 00002390 6e 0a 72 65 74 75 72 6e 2e 20 20 52 31 20 74 6f |n.return. R1 to| 000023a0 20 52 34 20 68 6f 6c 64 20 74 68 65 20 66 69 72 | R4 hold the fir| 000023b0 73 74 20 66 6f 75 72 20 61 72 67 75 6d 65 6e 74 |st four argument| 000023c0 73 2c 20 77 69 74 68 20 6f 74 68 65 72 73 20 6f |s, with others o| 000023d0 6e 20 74 68 65 20 73 74 61 63 6b 0a 61 62 6f 76 |n the stack.abov| 000023e0 65 20 52 54 53 20 69 6e 20 74 68 65 20 75 73 75 |e RTS in the usu| 000023f0 61 6c 20 77 61 79 2e 20 54 68 75 73 2c 20 61 20 |al way. Thus, a | 00002400 67 65 6e 65 72 61 6c 20 70 72 6f 63 65 64 75 72 |general procedur| 00002410 65 20 77 6f 75 6c 64 20 6c 6f 6f 6b 20 6c 69 6b |e would look lik| 00002420 65 3a 0a 09 53 54 4d 45 41 09 72 74 73 21 2c 20 |e:..STMEA.rts!, | 00002430 7b 72 62 2c 20 72 70 2c 20 72 6c 2c 20 72 31 34 |{rb, rp, rl, r14| 00002440 7d 20 3b 20 73 61 76 65 20 6c 69 6e 6b 61 67 65 |} ; save linkage| 00002450 0a 09 53 55 42 09 72 70 2c 20 72 74 73 2c 20 23 |..SUB.rp, rts, #| 00002460 31 36 09 09 3b 20 6e 65 77 20 66 72 61 6d 65 20 |16..; new frame | 00002470 70 6f 69 6e 74 65 72 0a 09 53 54 4d 45 41 09 72 |pointer..STMEA.r| 00002480 74 73 21 2c 20 7b 61 31 2c 20 2e 2e 2e 7d 20 09 |ts!, {a1, ...} .| 00002490 3b 20 61 72 67 75 6d 65 6e 74 73 0a 09 20 20 20 |; arguments.. | 000024a0 2e 2e 2e 0a 09 4d 4f 56 09 72 74 73 2c 20 72 70 |.....MOV.rts, rp| 000024b0 20 09 09 3b 20 75 6e 77 69 6e 64 20 6f 75 72 20 | ..; unwind our | 000024c0 66 72 61 6d 65 0a 09 4c 44 4d 49 42 09 72 70 2c |frame..LDMIB.rp,| 000024d0 20 7b 72 70 2c 20 72 6c 2c 20 70 63 7d 5e 09 3b | {rp, rl, pc}^.;| 000024e0 20 6e 6f 20 6e 65 65 64 20 74 6f 20 72 65 73 74 | no need to rest| 000024f0 6f 72 65 20 52 42 0a 0a 46 75 6e 63 74 69 6f 6e |ore RB..Function| 00002500 73 20 72 65 74 75 72 6e 20 74 68 65 69 72 20 72 |s return their r| 00002510 65 73 75 6c 74 20 69 6e 20 52 31 2e 0a 0a 52 30 |esult in R1...R0| 00002520 20 74 6f 20 52 36 20 61 6e 64 20 52 42 20 6d 61 | to R6 and RB ma| 00002530 79 20 62 65 20 75 73 65 64 20 77 69 74 68 6f 75 |y be used withou| 00002540 74 20 73 61 76 69 6e 67 20 74 68 65 69 72 20 76 |t saving their v| 00002550 61 6c 75 65 73 3b 20 73 6f 20 6d 61 79 20 52 31 |alues; so may R1| 00002560 33 20 61 6e 64 0a 6d 6f 72 65 6f 76 65 72 20 69 |3 and.moreover i| 00002570 74 20 69 73 20 61 63 63 65 73 73 69 62 6c 65 20 |t is accessible | 00002580 66 72 6f 6d 20 42 43 50 4c 20 74 68 72 6f 75 67 |from BCPL throug| 00002590 68 20 74 68 65 20 6e 61 6d 65 20 4e 49 4c 20 28 |h the name NIL (| 000025a0 61 73 73 69 67 6e 6d 65 6e 74 20 74 6f 20 4e 49 |assignment to NI| 000025b0 4c 0a 66 72 6f 6d 20 42 43 50 4c 20 68 61 73 20 |L.from BCPL has | 000025c0 74 68 65 20 73 69 64 65 2d 65 66 66 65 63 74 20 |the side-effect | 000025d0 6f 66 20 75 70 64 61 74 69 6e 67 20 52 36 29 2e |of updating R6).| 000025e0 09 52 36 20 61 6e 64 20 52 31 33 20 61 72 65 20 |.R6 and R13 are | 000025f0 67 75 61 72 61 6e 74 65 65 64 0a 75 6e 74 6f 75 |guaranteed.untou| 00002600 63 68 65 64 20 62 79 20 74 68 65 20 6c 69 62 72 |ched by the libr| 00002610 61 72 79 2c 20 61 6e 64 20 62 79 20 42 43 50 4c |ary, and by BCPL| 00002620 20 63 6f 64 65 20 77 68 69 63 68 20 64 6f 65 73 | code which does| 00002630 20 6e 6f 74 20 75 70 64 61 74 65 20 4e 49 4c 2e | not update NIL.| 00002640 0a |.| 00002641