’From Smalltalk 5.5i XM May 1 on 16 July 1980 at 3:58:07 pm.’ ̃

Object asFollows̃

System Primitives
readLoc: readLoc vectorLoc: vectorLoc length: length image: image
[user cr ; show: ’readLoc: ’ ; print: readLoc ; cr ;
show: ’vectorLoc: ’ ; print: vectorLoc ; cr ;
show: ’length: ’ ; print: length ; cr ;
show: ’image: ’ ; print: image ; cr] primitive: 2
writeLoc: writeLoc vectorLoc: vectorLoc length: length image: image
[user cr ; show: ’writeLoc: ’ ; print: writeLoc ; cr ;
show: ’vectorLoc: ’ ; print: vectorLoc ; cr ;
show: ’length: ’ ; print: length ; cr ;
show: ’image: ’ ; print: image ; cr] primitive: 3
"
| image
[image ← String new: 4096.
nil readLoc: 010000 vectorLoc: 0 length: 1024 image: image.
image inspect]

| image i
[image ← String new: 4096.
forç i from: 1 to: 4096 doç [image‘i ← (i - 1) \ 256].
nil writeLoc: 010000 vectorLoc: 0 length: 1024 image: image.
image inspect]

| image i
[image ← String new: 4096.
(dp0 file: ’microfloatmc.br.’) readonly; skipwords: 0421; into: image endError: false; close.
nil writeLoc: 010000 vectorLoc: 0 length: 1024 image: image.
]

| vec i j v1 v2 x1 x2
[vec ← fl10.0001 , fl10.0 , fl9.9999 , fl3.00006 , fl3.00003 , fl3.0 , fl1.4 , fl0.7 .
v1 ← Vector new: vec length.
forç i to: vec length doç
[x1 ← vec‘i.
v2 ← Vector new: vec length.
forç j to: vec length doç
[x2 ← vec‘j.
v2‘j ← (x1 over: x2) - (x1 / x2)].
v1‘i ← v2].
ffiv1]
| i j [(user timeç [forç i to: 1 doç [forç j to: 1000 doç [Float new]]]) asFloat*0.03808]
"
̃
Smalltalk declare:  (RAM0 RAM1 RAM2).̃
"load the RAM"
| image i
[image ← String new: 4096.
(dp0 file: ’microfloatmc.br.’) readonly; skipwords: 0421; into: image endError: false; close.
nil writeLoc: 010000 vectorLoc: 0 length: 1024 image: image.
RAM1 ← image.]
̃

UserView asFollows̃

System quit/resume
overlay: fileid | t [
dp0 stampBoot.
self releaseExternalViews.

"put the ethernet to sleep"
[Effnil [] E sleep].

"turn off display during quit/resume"
t ← mem‘0420. mem‘0420 ← 0.
self InLd: fileid.

"we start here after a resume"
mem‘0420 ← t.
"load the RAM before anything else"
[RAM2 class ff String 
[nil writeLoc: 020000 vectorLoc: 0 length: 1024 image: RAM2]].
[RAM1 class ff String 
[nil writeLoc: 010000 vectorLoc: 0 length: 1024 image: RAM1]].
[RAM0 class ff String 
[nil writeLoc: 000000 vectorLoc: 0 length: 1024 image: RAM0]].
whileç user keyset>0 doç [user show: ’The keyset is stuck’; cr]]
̃

Generator asFollows̃

Code generation
compileIn: class
| block method nargs selector primitive
[parser ← Parser new. root ← thisContext. parser from: sourceStream to: self.
self initSymbols: class.
block ← ParsedBlock default.
selector ← parser pattern: block. nargs ← nTemps.
parser temporaries: block. primitive ← parser body: block.
parser mustBeDone. parser ← nil.
block mustReturn: true "defaults to ffiself".
[method ← [primitive=0 andç nargs=0 [block quickCode] false] []
method ← self generate: block in: class.
method‘1 ← primitive lshift: fl8.
method‘2 ← primitive land: 0377.
method‘4 ← nargs].
class install: selector method: method literals: literals
code: [sourceParagraph is: Paragraph [sourceParagraph]
sourceStream asArray] backpointers: nil.
[HuhFlag [Huh←nil. Huh ← (self decompile: method onto: Stream default) contents. HuhFlag←false]].
ffiselector]
"compile"
̃

Float asFollows̃

Arithmetic
̌arg
[ffiselfǎrg asFloat] primitive: fl01071
̄arg
[ffiselfārg asFloat] primitive: fl01070
ffl arg
[ffiselffflarg asFloat] primitive: fl01067
* arg
[ffiself*arg asFloat] primitive: fl01076
+ arg
[ffiself+arg asFloat] primitive: fl01100
- arg
[ffiself-arg asFloat] primitive: fl01077
/ arg
[0.0=argser notify: ’Attempt to divide by 0.0’]
ffiself/arg asFloat] primitive: fl01075
< arg
[ffiself<arg asFloat] primitive: fl01074
= arg
[arg isNumber [ffiself = arg asFloat] ffifalse] primitive: fl01073
> arg
[ffiself>arg asFloat] primitive: fl01072
̃

Class asFollows̃

Instance access
new [user croak] primitive: fl01066
̃

VariableLengthClass asFollows̃

Instance access
new: length
[length>16384 ser notify: length asString+
’ is too big a String’]
length>8192 ser notify: length asString+
’ is too big a Vector’]
length<0 ser notify: length asString+
’ -- negative length is invalid’]
ffiself new: length asInteger] primitive: fl01065
̃