D0_Microcode_Nov1979 D0 Microcode Nov1979

User Manual: Pdf D0_Microcode_Nov1979

Open the PDF directly: View PDF PDF.
Page Count: 282

DownloadD0_Microcode_Nov1979 D0 Microcode Nov1979
Open PDF In BrowserView PDF
BuilduCodeTutorial.bravo
,Building a disk for microcode developlnent.
This tutorial will take you stepwise through a procedure for installing the appropriate
, software on a disk for microcode development. Because this procedure involves two disks
and because mem'bers ,of the microcode group utilize parts of this procedure in the daily
development environment, it was decided that the several parts of this build 'procedure
should remain disjoint rather than be integrated into a single 'command file.
There is a document which contains the procedure outlined below in flow- chart form. It
is on [Iris] < wdO> BuilduCocleCharLprcss, .sil.. It may be helpful in giving an overview of
the process despite its considerable abstractions. .
'
=7 Be aware that this procedure requires two disks!
=7 Command files referenced' below usually have self- contained documentation.
=7 Build paths for various modes (Alto, DO, Software-bootable. pushbutton- bootable, etc.)
will be addressed at the appropriate points below.

1. Spin up a clean (or craseable) disk on your Alto. Boot the NetExec and invoke·
.NewOS.boot (see Alto User's Handboo:k, pp 6). ,Usc the long installation dialog. DO erase
the disk~ and do not change any parameters. ' The A Ito. program host can be Tris, wlaxc,
411 etc. and the Alto program directory should'be Alto. You do not need a big SysDir.
2. Retrieve and exccute [Iris] < welO> BareBoncs.cm.
This will install mi nimal soTtware util'i tics (Bravo, EmPress, etc.) on ybur disk for'
working with microcode. Don't forget to edit the HARDCOPY section of your User.cm
and to initialize Bravo before contil1lling to step three.
3.RctrievC~lnd execute [ Iris] < weIO>MidasDisk.cm.
This will install Sw,it and the rvli das loader/debugger on the disk.

4. Retrieve and execute [Iris]  IvlicroA ll.cm.
This w-ill assemble the entire complCmentof DO
a hardcopy of this fiIe.
",

"
microcodc~

It is probably' worth getting

=7 Should we tell user 'to chcGk for errors here?

As vou arc doubtless awarc, there are two' modes of microcode for the DO: A Itocon;patible and DO- compatible. The following prose assumes Alto- mode in normal tcxt
and DO- mode in parenthesizcd text, e.g. the phrase "cxecute@:.i\1to- Mumble.cm (~tDO­
tv1umhlc.cm)" implies"n't1'lllingAlto- Mumble.cm for an I\lto- mQclc build and DOtvlulllbIc.cm for a DO'"tnodebuil.d.
.

?:Q{ctri~vc and)e~e~ut~[ IrisJ, ~3Mcsal.cm
I hIS bUIlds the first block

01-

(nDMesal.cm).
"
the rrllcrocode, BMesa1.mb (BDiv1csal.mb).

7.(RGtrieye and)execute [Iris]  BAI'v1esa.cm (BDi'v1esa.cm) ..
This builds the second block of the" microcode, BAMcsa:n1b (BDIvIcsa.mb).

8. Check you r disk di rectory for the ex istel1ce of the 111 ic r<'cock bi 11 ary fi lcs that should
have been prouuccd by the two precedi ng steps: BMesa l.1ll.b and BA ivlesa.m b
(BDi\'lcsal.mb and BDf\.'1esa.mb). STORE thesc two files on your local file server and spin
down the disk. \Ve "viII now go to the second disk, since the current one probably has

2

only a few hundred free pages relllaining.
9. Using another clean or eraseable disk, build a Basic Mesa. 5.0 disk as follows:
A. Invoke NewOS.boot from the Nettxec as detailed in step 1 of this procedure.
B. Retrieve and execute [Iris/Isis]  McsaDisk.cm.
This Basic Mesa 5.0 disk will contain Bravo. Other utilities may be added later if free
space is available. Don't do it now!

10. Retrieve the following files:
[your- IFS]  BMesal.mb, BAMcsa.mb (I3DMesa1.mb, BDMesa.mb)
[ Iris]  MakeLoaderFile.bcd
For creating pushbutton- bootable microcode only:
[ Iris]  MakeAltoBooLm If (MakeDOBoot.mlf)
[ Iris]  AltoBooLcm (DOBoot.cm)
[ Iris] <1\ 1to> MoveToKeys.run
For creating software- bootable microcode only:
[ Iris] rvfakeAsb.mlf (rvlakcDsb.mlf)
11. If you want software- bootable microcode, this is the last step. If not, skip this step
and go to step 12.
For software- bootable microcode only, execute:
MakcI.oadcrFile.bcd MakcAsb.m]f (Makel.oaderFile.hcd tv1akeDsb.mlf)
This should produce the software- bootable microcode file named A MesCl.sb (DMesa.sb) on
your disk. This completes the build procedure. The steps belcnv pertain only to building
push bu tton - bootabfe microcode.
12. if you wallt pushbutton-bootable microcode, then continue with this step.]f you want
software- bootable microcode, go back to step 11.
.
For pllshbutton- bootable microcode only, execute:
tvIakeLoaderl;'ile.bcd MakeAltonoot.mlf (MakeLoaderFilc.bcd I\1akeDOBoot.mlf)
This should produce the bootable microcode file named AltoBoot.bt
make this microcode PUSH BUTTON- bootable. execute:
@;AltoBoot.cm

(@DDBoot.cm)

This disk should now be plishbutton- bootable on a DO. Try it.
13. End of procedure.

(D013oot.bt). To

MicroAll.cm

//
II
II
II

3-Nov-70 19;15;63

[Iris]Holp-wdO.bravo;
Micro: Machine-Independent MicroAssembler by Fiala, Deutsch, Lampson.

II Micro assembles a sequence of source files with default extension ".mc" and outputs
II four files whoso extenS'ions are ".MO", ".ER", ".LS". and ".ST". The default namB for
these is the name of the last source file assembled. Note that appl'ied to this
II commandf"ile (MicroA11.cm) there is a hack in the file OOLang.mc that causes the file
II extension ".MD" to be changed to ".OIB". The pertinent lino from DOLang.mc is:
II
"BUILTIN[SETMBEXT@,47];
*Set .mb file

1/

II You must have tho microcode assembler on your disk
II
[lris]Micro.run
or [Maxc]Micro.run
II
II

and the global files
[Iris]GlobalDefs.mc and DOLang.mc

II
II

and the definitions file(s) as necessary for each module.
[Iris]UIDefs.mc, DMDefs.mc, EtherDefs.mc, XWDefs.mc, OccupiedDefs.mc

II
II
II
II
II
II
II
II
II
II

The fo11ow'ing is true for the assembly commands below:
 defaults to 
The "/0" means that symbol table (.ST) output will be stlppr'essed.
The "/u" means that all source character's win be converted to upper case.
The "/b" means the binar'y will be l'istcd on tho file named before the slash.
Outputs from Micro.run are as follows:
FileName.DIB - D-machine intermediate binary
FileName.ER
- error list
FileName.LS
- assembly I isting
FileName.ST
- symbol table

II IUTFP (Interim User Terminal, Full Page)
II Requires [Iris]UIOefs.mc
micr%/u UIInit
micrololu UITask
micrololu Key
II UTLF (User Terminal, Full Page)
II Requires [Iris]LFDefs.mc
micrololu LFlnit
micrololu LFTask

II IROC (Interim Rigid Disk Controller)
II Requires [Iris]EtherDefs.mc
micrololu EtherInit
micrololu EtherTask
micrololu r5232Sio

II EtherNet masquerading as XWire
II Requires [Iris]XWOefs.mc
micrololu XWlnit
micrololu XWTask
micr%/u XWSi02
II Nova emulator
micro/o/u Nova

II Mesa emulator, DO mode
micrololu MesaLS
micrololu MesaJ
microlo/u MesaX
micro/o/u MesaP

II Mesa emulator, Alto mode
micrololu aMesaLS/b AltoMode MesaLS
micro/o/u aMesaJ/b AltoMode MesaJ
micrololu aMesaX/b AltoMode MesaX
II BitBlt (Bit Block Transfer), both Alto and DO modes
micrololu BitBlt
micro/o/u aBitBlt/b AltoMode BitBlt

II Initialization: devices and memory
micro/o/u Initialize
m.,icrolo/u Alnitial izelb AltoMode Initial ize

II Fault handler
microlo/u Fault

II Dead start and timer code
micro/o/u Timer

Page

MicroAll.cm

II Two Stage Overlay code
micro/o/u Overlay

Blocks I and II reserved words
nequires [Iris]MoveToKeys.rul1
[IrislOAMesa.cm
Last modi t'led on August 11, HJ79
II Last editor was Maxion.

1/

II Duilds second block of DO microcode, Alto-mode.
II Ge"erBtes DAMesa.mb, which CO" be loadod into a D-machino and run by Midas.
II This procedure requires nbout gO free disk poges.
II
II
II
II
II

DocumentBtio":
[Iris]Holp-wdO.bravo
MicroD Manual by roler Delftsch
For or'ig'ins of AMesaLS, etc. and athOl' ".dib" files see [Iris]MicroD.run
II
and tho .dib Filos (default extension) llalTlod in the cOlllmnnds below.
II The result of running this command file will be the generation of:
II
EJIIMesa.MB
["voked by the global "1m" switch.
-.csmap for each file.
II
Invoked by tho global "/m" switch.
-.occupied for each file.
II
Illvoked by the globo'j "1m" swHch.
~·.regs for oach file.
II
MicroDlmlolr BIIMosa/o MesalOccupied Nova IIMesaLS IIMcsaJ IIMcsaX MasaP ADitBlt

Page

3-Nov-]9 19:15:53

B'lreBolles. cm

II [lris]Microi\ll.clil

The ".dH)" Files are output from the MicroJ\S5embler, Micro (Micro.rulI).

II fIIis command rne requ'ires tlw following files on YOUI' disk:
II
[Iris]BDMesal.em
II Last modified by Chang on October 10, 1979 fi:42 PM
II modified by Chang on Suplembor 7, 1979 1:25 PM
1/ MOdified by t-luxion on !\UlIust 24,

1979

II Builds first block of DO microcode, DO -mode.
1/ Genorates UDMosa1.mb,

which

CUll

be loaded into .. D-machine and I'un by Midas.

II This procedure requires about 120 frco disk pagDs.
II Documentation:
1/ [Il'is]t'licrolll1.cm
II Tho ".dib" files arc output from tho t.1icrol\ssembler, M-jcro (Mler'o.r·un).

II This command file requires the follovrinf) files on your' disk:
II

II

[Iris]MicroD.run
and the .dill files (default extension) named in the commands below.

II The result of runll'ing
1/
BDMesal.Mfl

II
/I
/I

this command file will be the generation of:

-.esmap for each file.
-.occupied for each file.
-.regs for each file.

Invoked by the global "1m" switch.
fllvoked hy tho global "1m" swHch.
Invokod by tile global "1m" switCh.

MicroD/m/o/r DOMosnl!o ~10sn20c:;lIp-iod lFlnit LFTask Key DIHnit DMT(l5k HOC XWInit XI'ISio2 ;(WTasK rs2::J2Siu FaulL Illiti::llizc Ovol'lay Timer

B/iosal.cm

3-Nov-1G 19:15:53

II [Iris]BuildSys.cm
II Last modified on August 17, 1979
II Last editor was Maxion.
/!
/!
/!

This command file blinds t.he DO fIIicrocode system.
It 'is essentially the concatun:Jtion ot' th=< ".cm" files 'in the commands belol'J PLUS
the apparatus to crc:Jte the pushbuttoll & soft boot files for lIlt.o- and DO-Iuodes.

II Documentation:
II Self contained and

[Iri~JHelp-wdO.bravo

Sal ient results:
II Create the pushbutton & soft boot files for IIlto- and DO-modos.
I! These f'iles will be named IIltoBoot.bt, AMesa.sb, DOBoot.bt, and Dt4esa.sb
II where ".bt" indicates pushbutton-boatable and ".sb" indicates software-boatable.
I!

This command file requires t.he following !"i les on your disk:
[Iris]MicroO.I'un
[Iris]MakeLoadcrFile.bcd
1/
[Iris]MakeAll.mlf
I!
... and all the appropriate ",dib" f'iles f'eqll"ired for tile ".em" files be'low.
I! It is ulua'i to have run M'icrollll.cm bofol'e runninu this Fne.

I!
I!

II

II Build first block of DO microcode, Alto-modo: BMesal.mb.
@BMesal.cm
delete BMesal.dls
II Build second block of DO microcode, III to-mode: CIlMesa.mb.
@IlAMesD.crn
delete DAMesa.dls
II Build first block of DO :niCI'ococie, DO-modo; DDMesal.mb.
@BDMcsal.crn
delete DDMesal.dls
II Build second block of DO microcode, 00 mode: "OMesa.mh.
@BOMesa. crn
delete BOMesa.dls
II CreaLe the pushbutton & soft boot files for Alto- and DO-modes.
MakeLoaderrile Makellll.mlF

Page

Com.em

3-Nov-79

19:15:53

lMPHESS.RUN Gacha/f 6/p daisy/h A1toMode.mc !3AMesaOcclIpicd.mc flDl-lcsalocclIpicd.mc £lDMesaOccllpil1d.mc BitBlt.mc OMe~aloccupied.mc DOLallg.mc
··DMOefs.mc DMIn1t.mc DMTask.mc EthcrDefs.mc Ethorlnit.mc EtherTnsk.mc Fault.mc GlobalDefs.mc Initialize.mc Kernel.me Key.me LFdufs.mc LF
";nit.me LFkey.lllc Lftask.lllc t.1esaloccupied.mc Hesa2occlIp'ied.mc Mesa,J.mc McsaLS.mc Me~ilP.me MesnX.mc Nova.IIlC OCCllphHIOofs.mc Ovel'lay.lllc RO
··C.mc ROCdefs.mc rs232Async.mc rs232AsyncTest.mc rs232Bit.mc rs232!3itlest.mc rs232Byte.mc rs2320yLoTc5t.mc rs732Dcfs.lllc rs232occupicd.mc
u
RS232SIO.mc rs232Test.mc Timer.mc IHDefs.mc UIInit.lIle UlTask.lIlc XlMoveToKeys. rUIl
[Iris]DMesa.em
II last modified on 28 August 1979.
II last editor was Maxion.
II Builds midas boot version, DO mode
II This fi10 is basically undocumented, but will beimprovod latol'.
(I'm not even sure what it's fOl' 01' if "it works. - RM)

I!

MicroD/c DMesa/o Nova UIInit UITask Key DMlnit DMTask EtherInit EtherTask rs232Sio MasalS MesaJ MesaX MasaP 01tOIt Fault mTnitialilo

ExtantFiles.cm

3-Nov-79 19:15:53

Paga

II [Iris]MidasDisk.cm
II Last modified on August 20, 1979
II Last editor was Maxion.
II This command file:
II will (r~)install Midas (loader/debugger) on your frosh (or present) disk;
will (re)install Swat on your fresh (or prosent) disk;
II
(Swat is helpful, but not essential.)
/1
will handle ONLY Midas and Swat - nothing more! I
II requires about 610 disk pages to run.
/1

II Documentation:
II Self contained and

[Iris]~e1p-wdO.bravo

1/ Get Swat and install it.

Also got appropriate Midas files.

FTP Iris Directory/c  Retrievelc InstallSwat.run

t

t

Directory/c  Ratrieve/c AMesa.midas BAMosa.mb BDMosa.mb BDMesal.mb BMesal.mb Boot.midas DMasa.midas DOLoader.mb Kernel.mb Midas.mida
··s Midas.programs Midas.run User-Midas.programs
Instal1Swat
Delete InstallSwat.run
Delete MidasDisk.cm
II Initialize Midas.
Midas/i

II Delete Dumper.boot if you wish.
II Dolete DMT.boot if you wish.
/1

Swat users:

Consider obtaining the new file Swat. help.

rs232BuildSB.cm

3-Nov-79 19:16:53

II [Iris]Micl'o. run
(the micl'ocode assembler)
II
[I ris]rs232Test.cm
II Last modified on June 1, 1979
II Last editor was BRO.
II This command file builds RS232 microcode test programs.
II Salient output files from this command file are the microcode binaries:
II
rs232AsyncTest.mb
II
rs232ByteTest.mb
II
rs232BitTest.mb
II Documentation:
II Micro: Machine-Independent MicroAssembler by Fiala, Deutsch, Lampson
II MicroD Manual by Peter Deutsch
II This command file requires the following files on your disk:
II
[Iris]Mlcro.run
(the microcode assembler)
II
[Iris]rs232Async.mc
for asynchronous test only
II
[Iris]rs232Bit.mc
for bit asynchronous test only
II
[Iris]04

U.QUIT:"{6,l,O,O}q
y

Copy temp.ts

~

bravo.ts;URAVO/d user.em temp.ts

FONT:O HELVETICA B HELVETICA 10 HELVETICA B
FONT: 1 HELVETICA 7 IlELVETICA (\ HELVF.TICA 7
FONT:5 HELVETICA 12 HELVETICA 12 HELVETICA 12
OFFSET: Standard offset " 4
lAOS: Standard tab width = 635
LEAD: Line load"ing " 6, PUI'agr'aph leading = 12
NESTED: Delta left = 635, Delta right = 0
SCREEN: Screen top" 25. System window end ~ 90, Screen bottom" 780
MARGINS: Paragraph rnarg"in = 2998. Left margin = 2998. Right marg"in = 20598
[IIA ROCOPY]
I I'i s
PREFERREOFORMAT: PRESS
PRESS: Dllisy
PRINTEDRY: "DaleKnutsen"
EXTENSION: . mesa
FON r: IIELVETICA 10 MRR

liDS':

[CIIAT]
BELL: DING FLASH
ROHDER: BLACK
rONT: Gachal0.al
LINEFEEDS: OFF
TYPESCHIPT: Chat.t! 10000
TYPESCRTPTCHARS: OFF ON
[DDS]
rmn: llelveticalO.a"'
SMALLFONT: sysfont.al
CONTEXT: not ('.ill or ".run or *.image or
rULLINIT: NO
SELSPEC: •
SOIlT BY: name, extension
SHOW: s ilf)

sys~

[TOOLS]
BITMAP: [x: 64. y: 128, w: 478, h: 400]
DEBUG: No
ToolsFont: SysFont.al
File"ost: Iris
FilcDil'cctory: 
[L ibrariun]
Server: Marion
Root: 
NameSuffix: mesa
Bcdllllcket: [Iris]
DefallltContentsLocation: [Iris]
Limpels: poirrtsto
Children: comprises (*>
Levels: 2
'
LevelSpacing: 32
InLevclSpacing: 16
NameThru: Yes
Sideways: True
[MAIl.CHECK]
HOST: Maxc
NEWMAIL: CHAT @H MSG.DO/D
TIME: YES
[EXECUTIVE]
Font: lIelvetica12
evontBooted: Login /1 Hi. Dalel
eventRFC: FTP II eventRFC
evcntlnstall: 1/ eventInstall
eventAboutToDie: II ~ventAboutroDie
eventUnknown: II eventUnknown
eventC I ockWrong: SetTime 1/ even tCl ockWronq

or *.cm· or *.scratch" or dds· or swat* or bravo.·)

Page

3-Nov-79 19:15:53

"lil~t

'.lodHied by Sancilnan on Februill'Y 2:3, 19'1!)

CUILTIN[SET,ll];
SET[AltoMndo, 1];

1.1:36 J'.M

3-Nov-79 19:16:63

BAMesaOccupicd.mc

* MicroD 8.11 (OS 16) of July 1, 1979
•

at 17-0ct-79 11:69:10

INSERT[OccupicdDofs];
TITLE[BAMesaOccupied];
• Locations reserved on pago 0
IMRESERVE[O,
IMRESERVE[O,
IMRESERVE[O,
IMRESERVE[O,

2, 75];
156, 10];
173, 4];
300, 32];

• Locations reserved on page 1
IMRESERVE[l, 0, 400];
• Locations reserved on page 4
IMRESERVE[4,
IMHESERVE[4,
IMHESERVE[ 4,
IMRESERVE[4,
IMRESERVE[ 4,
IMRESERVE[ 4,
IMHESERV[[4,
IMHESERVE[4,
I14I1ESERVE[4,
IMRESERVE[4,

0, 340];
341, 1];
345, 1];
351, 1];
365, 1];
361, 1];
365, 1];
371, 1];
375, 1];
377, 1];

• Locations reserved on page 5
IMRESERVE[5, 0, 400];
• Locations reserved on page 6
IMRESERVE[6,
IMRESERVE[6,
TMRESEHVE[6,
IMRESERVE[G,
IMRESEHVE[6,

0, 363];
365, 1];
371, 1];
375, 1];

377, 1];

• Locations reserved on page 7
IMRESERVE[7, 0, 400];
• Locations reserved on page liB
IMRESERVE[11, 0, 366];
• Locutions reserved on page 14B
IMRESERVE[14, 137, 241];
• Locations reserved on page 15B
IMHESERVE[15, O. 376];
IMRESERVE[ 15, 377, 1];
• Locatiolls I'eserved on page 16B
IMRESERVE[16, 0, 357];
END:

Page

DDMesaloccupied.mc

3-Nov-79 19:15:53

* Micr'oD 8.11 (OS 16) of July 1, 1(179
•

at 17-0ct-79 11:09:37

INSERT[OccupiedDefs];
TITLE[BDMesalOccupied];
• Locations reserved on page 0

IMRESERVE[O, 100, 233];
IMRESERVErO, 335, 23];
IMRESEnVE[O, 361, 17];

* Locations reserved on page 1
IMRESERVE[I, 100, 206];
• Locations reserved on page 2

IMRESEnVE[2,
IMRESERVE[2,
IMRESERVE[2,
IMHESERVE[2,

100,
372,
374,
376,

242];
1];
1];
1];

• Locations reserved on page 3

IMRESERVE[3, 0, 307]:
IMRESERVE[3, 370, 3];
IMRESERVE[3, 374, 3];
• Locations reserved on page

IMRESERVE[7, 27, 1];
IMRESEnVE[7, 76, 1];
* Locations reserved on page lOB

IMRESEnVE[lO, 0, 363];
, Locations reserved on page 12B

IMRESERVE[12, 0, 375];
• Locations reserved on page 13B

IMRESERVE[13, 0, 306];
• Locations reserved on page 140

IMRESERVE[14, 0, 137];
.• Lucatiolls reserved on page 150

IMRESERVE[15, 300, 1];
• Locations reserved

011

page 16B

IMRESERVE[10, 0, 320];
• Locations reserved on page 170

IMHESEHVE[17, 140,40];
END;

Page

8DMesaOecupied.mc

3-Nov-J9 19:15:63

• Micl'oD 8.:11 (OS 16) of July 1,1919
•
at IJ-Oct-79 11:11:10

INSERT[OccupiodDofSl;
TITLE[BDMesaOccupied];
• Locations reserved on page 0
IMRESERVE[O,
HIRESrRVE[O,
fM!lLSEflVE[ 0,
IMRESEHVE[O,

2, 22];
156, 10];
173, 4.1;

300, 32];

• Locations reserved on page 4
INRESEflVE[4,
ftWLSEHVE[4,
n1RESrnVE[4,
IMHESEflVF[4,
IMRESEHVE[4,
IMIlESEIlVE[4,
IMHESERVE.[4,
IMIlESfI1VE[4,
IMIH:SERVE[4,
IMHESERVE[4,
IMRESERVE[4,

0, 332];
335, 1];
341, IJ;
345, q;
351, 11;
355, 1];
361, 1];
365, 1];
371, 1];
375, 1];
3/7, 1];

• Locations reserved on page 5
IMHESrRVE[5, 0, 400];
., I.ocat·ions reserved on page 6
IMHESEHVE[6,
IMHESEIlVE[6,
JMRLSEHVEL6,
IMRESrHVE[6,
IMHESfRVE[6,
IMHESfRVE[6,
IMIlEsrHVE[G,
IMIlESEIlVE[6,
HlflESfHVE[G,
H1HESEHVE[G,
IMHESFIlVE[ 6,
IMHESLRVF[6,
IMHESF..IlVE[6,

0, 324];
325, 2];
331, 3];
335, 3];
HI, 3];
345, 3];
351, 3];
355, 3];
361, 3];
365, 11;
371, 11;
375, IJ;

377, 1];

* Locations reservod on page 7

IMRESrHVE(7,
IHHES fIlVE 17,
IMHESrRVE[7,
[MHESlRVE[7,
U1HESr:nVE[ 1,
IMHESrHVE[7,

0, 360];
361, 1];
3G5, 1];
371, 1];
315, 1];
377, 1];

• Locations reserved on page liB
IMHESERVE[11, 0, 316];
• Locations reserved on page 140
IMRESEI1VE[14, 137, 233];
• Locations reserved on page 15B
IMHESEHVE[15, 0, 372];
IMRESEIlVE[15, 377, 1];
• Loeat ;OIlS reserved on page 160
IMRESEHVE[16, 0, 357J;
END;

Page

3-Nav-70 10:16:53

[litOI lome

ins 0 rt [dO 1an g] ;
NOMIDASINIT;lANGVERSION;MULTDIO;
insort[GlobalDofsl;
rITLE[flITflIX);

%

• Last modiFied by Chang, September 11, 1979 8:46 AN, interrupts off problems
modil'iod by Johnsson, June 28, 1979 8:50 AM
BBTable format

* WORD

o
1

'l

3
4

6
7
10
11
12

13
14

15
16

17
20
7.l

22

n

NAME
FUNCTION
bit 0 long Oitblt; bits 14-17 function (see below)
unused
ORCA
Destination BCA
Base Core Address of dest bit mop
Destillat-ioll IlMn
DOMR
Bit Map Width in words
00
s
t
-j
n
a
ti
0
n
DLX
LX
Left X oFfset from first bit
DTY
Destination TY
Top Y ofFset from first scan line
OW
De s till a Vi 0 n W
Width in bits of bit map
011
Destination II
Height ill scan lines of bit map
Sou,'co fiCA
SflCA
SI3MR
Source OMR
SLX
Souree LX
STY
Source TY
GrayO
These fou,' wO"ds are tho Gray Block
Grayl
GrayO is used on tho-first itom,
Gray2
Grayl un the second, Gray2 on tho third,
Gr'ay3
Gray3 Oil the fourth, GrayO on the fifth,otc.
LongSourceL.o
LongSou rcoB i
Lon!JDestLo
LOllgDostlli
[\ it BLT fUllc t -i OilS
CODE
0

MA, Mil

12
13
14

0
0
0
0
1
1
1
1
0
1
1
1
0

15
16
17

1
1
1

1
2
3
4

5
6
7
10
11

0
1
1
1

0
1
1
1

0
0
0
0
0
0
0
0

SALUFOP
R
R

on
on

T
T

XOR T
n AtJD notT
R on notT
n OR notT
R XNOIl T
R AND T
xxx
R on T

II

n xon

T

R I\ND notT
R OR T
R OR T
n xon T
11 AND notT

Dost

f-

S"C

Src on Dos t
S,'c xon Dost
notSrc AND Dest
notS rc
notSrc OR Dest
llotS,'C XOR Dest
Src I\ND Dost
( S "C AND Gry ) on (notSrc I\ND Dest)
(Src I\ND Gry) OR Dest
( S "c AND G"y ) XOR Dest
not(Src AND Gry) AND Dost
Gry
G,'y OR Des t
Gr'y XOIl Dest
110 lG ry AND Des t

interprotatioll of bbFunction bits
00
01

02-05
06

07

lO-12
13
14-17
%

mesa long pointor
mesa called = t / nova called
unused
bot to top = 1 / top to bot =0
r to 1 = 1 / 1 to " = 0
which-innerloop index
zo "0
Bitblt fUllction code

0

Page

3-Nov-79 19:15:&3

BitBlt .mc

"dispatch tables for bitblt
SEr[ OUP IP , I.SIl1 FT[UOP 1,1011;
S[ I[BOPZ!>, LSIIl FT[nUP2, 10]];
SET[OOTLA, ADO[BBPIP ,lOOl!
SET[BUILB, AOO[B8PIP,120]1
SET[8131LC, AOD["BPIP,l~Ol]
SET[nBILO, ADD[BDP1P,160]]
SET[BOTLE, ADD[BOPIP,200JJ
SET[BBILDX, ADD[BOPIP, 220]]
SET[hbIdisp,ADD[BUPIP,240]]
SET[UOr,
ADD[UUP2P,340]]

BurA dispatch values
set[110NRM,7];
sct[BBDSf,6];
set[BBSHC,5];
sct[UBUTlI,4];
sct[llBlnI, 3];

sct[bhILtypcO,
set[bblLtypel,
set[bbIL type2,
set[bbILtype3,
set[bbILtype4,

*no rcfi1"i
*destillatioll refill
*sOlll'ce refi"ll
·sourcD and destination refill
* item ref i 11
00]
02]
04]
~O]

10]

Page

BitS 1t. me

%

3-Nov-79 19:15;bJ

Initialization
determination of bit blt direet-iolls
(top to bottom
left to I"ighl) dt._y < sty
(top to bottom
right to leFt.) (dty , sty) and (dlx > slx)
(bottom to top, loft to r'i9ht) «tHy" sty) and (dlx ~< slx»
or (dty > sty)

%

ONPAGE[BBP2] ;
bhp2 ret;

return;

~H**~*~**

Start of Alto Code

~**~***$*.~~~*~*****~***~.*$*~*~~~.***.*****

NovaBitOLT;
*AC2,AC3 are a base register pointi"9 to tho DitD~r table
ACO (- 21c, task;
'Stkp points to ICOM in ACt
Stkp f- ACO;
I\CO" Dc, goto[hbBitOLT]; "ACO is the "elltered froln Novil" flag
*n$**~~*$ Elld of Alto Code **~****.$*~**~* •• ~**~.****~*~******.**.~*~**~*
MesoOitBLT: 1u .. xfWDC; ·T has address of table
skip[ALU~O];
N\~W (- (NW~J)

or (lOOOOOe);

~di!iable

interrupts in xHJDCIIO

J\C2 (- T;

r ,-

ACJ
ACO

MDShi, task;
f- T;
-Long pointer to DitULT table in AC2,AC3
f- 40000C,
goto[bbOitDLT];

"get 110re wilen finished, with test of "entered From Mesa" flag pending
bbExit:
~n~******

Start of Alto Code

*.***$**~**~**~****~*.~.*********.*.*****~*.

db1ooto[bbMdone,bbNrJolle,ALlJII0];
+#*~*****

[Ild

of Alto Code

*$*~*~.***************.******~****~***.*******

• bhMdone:
10adpnge[4];
stack&-2, gotop[MosaDDretl;
bbMdolle:
stack&-2, loadpage[4J;
N\~W f- (NWW) and not pOOOOOC), gotop[MesaOOret];
*n¢·***~~

bbNdolle:

Start of Alto Code

~***~************.*.****~*.**********.*****~

10adpiloe[nePage];
gotop[neNuskipl, FFl@[l7];

*0*******

End of Alto Code

*.******************.********.*****~$*********

*commoll bitblt code
bbOIlOLT:
pfetcht[AC2,bhFunction,0], co11[hbp2ret];*fetch function
pFetcb2[AC2,bbRTEMs1x,12],task;*foteh slx alld sty
bbSrcQAddrLo ~ zero ;
pfotch2[AC2,bbRT[Mdlx~4J;·fetch dlx and dty
t<-(17c), task;
t ~ ( 1$ h[ AC 0,11) 0 1'( t) ;
pfotch7[AC2,bbItomWidth,6], call[bbp2ret];*fetch dw and dh
bbFlInetioll<-(bbFlIllction)alld(t);*InslIl'o no garbago and lIlask bit 0 if entered from Novo
t'-(ACO) ;
l.ask,hbFunctiollf-(bbFunction)or(t); ""called from Mesa" bit
t ~ 1df[bbFuIlCtioll,14,2] ;
lu .- bbItemWidth;
RTEMP~ T ,skip[aluIlO];
lu <, ldf[bbfunclioll,l,l], goto[bbfx;t]; *Completion return - item width is zer'o
RTEMP .. t;
lu f- (RTEMP) xor (Jc) ;
sk'ip[aluIlO] ;
goto[bbTO] , bbSrcQAddrLo .. (1c)
*if function is 14-17, source not used,use tbll'
T " bbRTf:t~dty;
LU ~ (bbRTEMsty) - (T) ;
~calc sty - dty
GOTO[bbBT1,alu(O],froezeresult;
bbA3:
GOrO[bbTn,ALUNO];
bbA4;
r .. bbRTEMdlx ;
LU .. (bbRTEMslx) - (T) ;
*calc slx - dlx
DBLGOTO[bbTBRL,bflTOLH,ALU(O] ,t f- Stack;
bbBT1: GOTO[bbBTLR] ,t f- Stack;
"bottom to top, left to right
bbTB;
GOTO[bbTBLR] ,t f- Stack;
·top to bottom, left to right

Page

!lilBl t.me

sty

3-Nov-79 19:15:53

Page

ror left to right, top to bottom
specific initialization
sty + Icam

hbTDLIl:
bbllTEMsty ~- (bbIlHMsty) + (T);
GOTOp[bbGenl Illi t], bbflTEMdty <- (bbHTEMdty) + (l)
fOI' 'Ieft to I'ight , bottom to top
specific initialization

bbllTLIl:
task,l ~ (bbItemsllemaining) - (T) - 1
hbllTEMsty t- (bbRTEMsty) + (l) ;
bbRTEMdty t- (bbRTEMdty) + (T);
GOrOp[bbGenlInitJ.bbFunction~(bbFunction)or(1000C);·set

L to R bit

for right to left . top to bottom
specific initialization
bbTBIlL:
bbRTEMsty t- (bbRTEMsty) + (T) ;
task.bbllTENdty t- (bbRTEMdty) + (T)
t t- bbf1TUlsl x ;
t t- (bbf1rEMdlx) - (t);
bbSDNonOvorlap t- t ;
lu t- ldffbbSDNonOver1ap,O,12] ;
s k ip[ it luIlO]. bbt~ i 1111sSDNonOve 1'1 ap'-( zo 1'0) - (t);
goto(bbGenlInit];-L to R iF non-overlap < IOOb
lu t- ldf[bbltemWidth,O.12] ;
skip[aluIlO] ;
got.o[bhGelllInitl;"L to R if item 'Iength
lOOb
hi t- (bbltonMidth) - (t) ;
skip[carryJ;
goto[bbGcnl[nit];"L to R if item width < non-overlap
GOTOfbbGenlIllit) • bbl'unctioll'-(bbFunction)or(400C) ;-n to L

4

3-Nov-79 19:15:53

BitBlt.mc

5S

general init ial ization
calc ss
(lsll[4](sbca + (sty"

sbmr»)

bbGenlInlt:
sklp(r evon] • lu ~ bbSrcQAddrLo ;
goto[bbillnosrc]. pfutch2[AC2.bbDOCA.2];
pFetch2[AC2. bIJSOCA.IO] ; $fetch SbCil and

S

I-

slx)

Page

24 bits

hill I'

goto[bbLongSrcGet.r=O],lu~bbFunction;

hbLongDestGet:
L<-22c;
go to [hbDes Uni t], P fe lc h2[AC 2, bbDestQi\dd r'Lo 1;
hbShortDestGet:
L' IJIJDI3CA;
task.bbDestQAddrLo<-t;
IJbDes LQAdddli.,( zero); 'shon form sct"up
'T ... dLy 'I' Ulllill'.
16-1J i t pl'oduct
bbDestlnit:
r <- bbD[lMR;
HTEMP <- T;
T <- Dc, call[bbDestMulJ;
bbDcstMul:
HTEMP ~ rsh[HTEMP,l]. goto[.+2, Roven];
T ... (hIJRTEMuty) ~ (T);
hblnEMdty .. lsh[bbRTHldty, 1], goto[. ~2, ALU~O];
re tu rll;
bhDestMulDollo:
hhDestQi\ddrLo<-(bhDostQi\ddrLo)+(t);
sk ip[nocarl'Y], v'l sh[bbDcstQAddl'Lo, 4]; "movo DestQAddr to DestStartBit
hhDe s tQAdd rH i « bbDcs tQAdd I'll i )+ 1;
IJhDestStart[litLo~t;

goto[,+1],t<-rsh[lJbDnstQi\ddrLo,14];
V(lsh[bbDestQAddrlli ,-1])+(t);
t ask, b h De s t S t a rWi Wi <-t ;
t'bbHTEMdlx;*add dlx to DestStartUit
bbDestSta~t[litLo"'(bbDestStartBitLo)+(t);

sk'ip[IIocarry],t .. bb[temWidth;
bbDestStart[litHi<-(bbDestStartBitHi)+l;* DestStartOit /lOW complete
bbM'inusItemWidth ,- (zero) - (T) ;
*wallt mintls 'item width
test For specific initializatioll (bottom to top)
lu<-ldf[bbFunction,6.1] ;
goto[lJbILXO,alu=O] ;
this will go to bbilxO if t to b
orb b i 1 x 1 if b to t
bbILXl:

t ,. bbSOMR ;
task.hbSBMR ~ (zero) - (t)
t <- bb[)[lMR ;
bbD[lMR <- (zero) - (t) ;

bbILXO:
T .. (Stack);
bbItcmsRemainingMinusl .. (bbItemsRomaining) - (T) - 1 ;
skip[alu>=O] • bbrtcmsRomain'ingMinus2 ,- (bbItemsRomainingMinusl) - 1 ;
lu ~ ldf[bbFunction,l,l]. goto[bbExit]; ·Completion return - no items remaining
bbG rayCnt .. T ;
sk ip[ I' evell] , 'Ill ,. bbSrcQAddrLo;
goto[.+2] , SB ~ bbDestSta~tBitLo
SO ~ bbSrcStartBitLo ;
task.DO ~ bbDestStart[litLo
MNBR ~ bbMinusItemWidth;
bbfd:

DISPi\TCH[bbFunction, 14,4]
DISP[bbFUNOO] ;
will dispatch to bbfunN for function N

5

o IU3H.mc

3-Nov-79 19:15:53

AT[IlBf',O] ;'~alufop <-- [O,O,r 01' t]
goto[bbEndInit] , T ~ (204C)
!lot.o[bbEndInit] , T .- (304C) , Ar[DOF,1] :*salllfop <- [I,O,r 01' t]
goto[bbEndTnit] , T ~ (363C) , AT[UIlF,2] ;*sallifop <- [I,D,r xor t]
Al[DDF,3] :*solufop ~ [l,O,r and not t]
bbFUN03:
goto[bbEndInitJ
T ~ (327C)
bbrUN04:
~loto[bbEndlnit] , T ~ (074C) , AT[BOF,4] :'salufop <- [O,l,r or not t]
bbfUN05:
goto[bbEndlnit] , T ~ (IU4C) , AT[nRF,5] ;·saluFop <- [1,1,1' 01' t]
IJbFUN06:
not.o[bb[ndlnitj
T <- pedC)
AT(l1l1F,6J ;*salufop <- [1,l,r xnor t]
bbFmJ07:
goto[bbEndlnitJ , r ~ (lullC)
Al[OBF,7] ;*soll1Fop <- [1,I,r and t]
bbFU~J10:
T ~ (200C) , AT[OBF ,10] ;
*sulufop <- [x,O,x]
goto[bbEndInit] , bbFunction <- (lJbFunction) OR (40C);
*type 1 tl'ilnsfer
bbHJNl1:
T 1- (:l04C) , Ar[nIlF,l1] ;
*saluFop <- [1,O,r or t]
GOTO[bbEndlnit] , bhFullct-ion .- (bbFlInct-ion) Of! (100C) : MtypoJ 2 transfer
"solllfop ~ [I,D,r xor t]
bbFU~Jl2:
T ~ (3GJC) , AT[1l0F,l2] :
GOTO[bbEndInit] , bbFlInction <- (bbFlInction) OR (lOOC) ; *typo 2 transFer
·sahll'op <- [l,O,r <1nd 1I0t t]
bbFUN13:
T <- (327C) , iI_T[0I1F,13] :
GOrO[bbEndln-itJ , bbFunction (- (bbFlIllction) Oil (lOOC) : *type 2 transFel'
bbFUNl4:
T t- (204C) , AT[BBF,14] :
'salllfup <- [O,O,r or t]
GOTO[bbEndln-it] , bbFlInctioll <- (bbFlIllction) OR (20DC) : "type 4 transFel'
·salllfop
~ [1,0,1' or t]
bbHJN15:
T ,- (304C) ,_AT[BllF,l5] :
GOTO[bbEndlniL] , bbFlInction <- (bbFlInction) OR (l40C) : "type 3 t"(jnsFer'
'sallifop ,- [1,O,r' xor t]
bbFUN16:
T (- (363C) , M[BBF,1ll] :
GOTO[bbEndInit] , bbFunction <- (bbFlInction) Oil (140C) : *tYfle J transfor'
·solllfop ~ [1,0,1' and not t]
bbFLJN17:
T t- (327C) , AT[IHlF ,11] :
GOrO[bbEndInit] , bbFlInction ~ (bbFlInction) OR (HOC) : *typo 3 transFer'
bbfUNOO:
bbFUNOI;

bb~UN02:

bbEndTnit :

LOADPAGE[RBPll ;

GUlOP[bbFirstltom],sallif

<- t;

Page

6

3-Nov-7U In:15:53

BitBlt.mc

UNPAGE[fJI1Pl] ;
Inlier loops
Functions 0-7
bblnrlorLoops:
hbILAlZ :
call[.+lJ , AT[l1fJIDISP,bbILtypeO] ;
OIJ LCOTO[ bb ILA2 , htl HA X, /.\0] ,
T ' (BOFA[Sf.l[bbSOUnCFJ]) or (t) ;
bbILA2: DISP[bbILAl] , DH[bbDEST] ~ (OfJFnX[On[bhOEST]]) SALUrOp (T) ;
bbILAX: DISP[bhIlAl] , OD[bbDEST] ~ (ODFD[DD[bbDFSI]]) SALUFOP (I) ;
bbILi\l: roturn , AT[ODILA,DflNRM] ;
%
bbila2 will go to
no refill required
bb i1 a 1
source refill requ"ired
bbilas
clost ret'i "11 requi red
bbilatl
source and dest refills required
bbilasd
item rofill required
bbil ai
%

function 10
bbILlJ1:
call[.+l] , AT[OOIDISP,bbiLtypel]
f ~ (OOFA[SO(bbSOUnCEJJ) or (t) ;
bbIL132: DISP[bbIU13] , RTEMP (. T ;
'5 copies of the following code al'e
"requil'cd to save tho dispatch data
*from the BOrA executod previollsly
%
bbilb2 will go to
bbil b3
no I'of"ill rel)ui red
source ref"ill required
bb i1 b3s
dest rer-ill reqU"ired
bbil b3d
source and dest refills required
bbil b3sd
"item l'ofi"ll required
bbilb3i
%

bbILB3: DD[bbDEST]
T (.

nTE~lp

~

(DO[bbDEST]) AND NOT(T) , AT(DDILB,BBNRM]

;

T ~ (bbGRY) AND (T) ;
bbILD6: retuI'11 , DD[bbDEST] (. (OOHl[DO[bbDESlJ]) Oil (T) ;
bbILD3S:

DD[bbDESTJ

~

(DD[bbDEST1) AND NOT(T) , AT[BBILO,BnSRC]

T ,- HTEMP ;

r
bbILBGS:
bbILD3D:
bbILD6D:

~

(hbGRY) AND (T) ;
GOTO[bbILDS] , DD(bhDEST] .- (Bl1r-B[DB(bbDESTll) OR (1)

DI1[bbDEST] ~ (DO[bbDEST]) AND NOT(T) , AT[BBILB,BDDST] ;
call[bbtul'yJ,T ~ RTEMP ;
GOTO[bbILBD] , DB(bbDEST] ~ (I1DFD(DB(bbDESTJ]) OR (T) ;

bbILD3SD:
DB[bhDEST] • (DO[bbDEST]) i\tJD NOT(T) . AT[BB.lLD,BDDHI]
cal I [bbt!]I'Y.l , r ~ HTU-1P ;
bbILD6SD:
GOTO[bbILOSDj , DB[bbDESf] ~ (I1DrB[DD[bbDESf1]) OR (T)
bbTL03T:
bbILBGf:
bbtU ry:

DO[hbDFST] • (DU[bbOEST]) AND NOT(T) . AT[UOILD,BBfTM]
cdll[bbtUry],f ~ "TEMP;
GOTO[bbILBI] , DI1[l>bD[ST] ~ (DOFO[DO[bbDFST]]) OR (T) ;

r. (bbGRY) AND (T),l'oturn ;

Page

Page

3-Nov-79 19:15:53

Oi Hl1 t .me

funct 'i OilS 11-13
bbIl.Cl:
bbILC2:
bbIl.CJ:

%

call[.+l] , AT[BRIDISP,hhIl.typo2] ;
T t- (BDFA[SB[bbSOllRCE]J) 01' (t) ;
DISP[bbIl.CJ] , T <- (bbGRY) lIND (T) ;
return, OI3(bbDEST] <- (flnFOX[DI3[hhDEST]]) SAl.lJroP (T) , Al[BIHLC,nONRM]
bbilc2 will go to
bb i 1 c3
no ronll I'equ ired
bbilc3s
source refill required
bbilc3d
dost l'oFill I'oquired
bbilc3sd
source and dest reF'ills r'()quirod
bbnc3i
item ref"il I r'equirod

%

functions 14
bbIl.E1x:
call[.+l] , AT[BBIDISP,bbIL.type4] ;
T ,. (fHlFA[A"IlOnes]) ;
bbILE3: O[SP[bbIL.E4] , T ~ (bbGRY) and (t) ;
bblL[4: I'cturn . DB[bbDEST] ~ (SOFO[DB[bbDEST]]) SALUFOP (T) , AT[fJDILE,OBNRM]
%
bbile3 will go to
bbile4
no rofill requi red
bbilells
source refill required
bbile4d
dest rcfill required
bbile4sd
source and dest ref'ills reqwired
bbilcll,i
item I'onll required
%
functions 15-17
bbIl.Dl:
bll[L.03:
bbIL04:
%

%

call[,tl] , AT[BI3IDJSP,bbILtypo3] ;
T < flBFA[J\IIOlles] ;
DISP[bbILDII] • T ~ (bbGRY) AND (T) ;
!'ctlll'n . DS[bbDEST] ~, ([lnF[lX[DIJ[LLOEST]]) SJ\LUrOp (T)
bbild3 will go to
bLil(H
no refill I'cquil'ed
bhild·ts
soul'ce reFill requ'irod
bhi 1 dlld
dest ref i 11 requ ired
bbild4sd
source alld dest reFills r'cquirod
bbild4i
item refin required

• AT[I313ILD,BBNHM]

8

OitH It. mc

3-Nov-79

19:15:53

*Source refill
bbSoli rcaRcf -, 11 :
bbilUS:
bbILAS: DBLGOTO[bbNoSrcFetch,bbSrcFoteh,R ODDl , bbSreQAddrl.o .. (bhSrcQAddl'Lo) ~ (4C) , AT[BBIlA,OOSRC]
bbILC3S:
GOTO[bbSoureeRcfill] , OB[bbDESTJ .. (OBFAXrOB[bhDEST]]) SAlUFOP (T) , ATrOBILC,OBSRC] ;
bbllD4S:
GOTO(bbSourceRufill]
DO[bbDEST]" (OUrUX[OB[bbDEST]]) SALUFOP (T) , AT[BUILD,OOSRC] ;
bblLEtlS:
GOTO(bbSouf'ceHefill]
DO[bb~ES(]'" (OOFI1[D£l[bbDESr]]) SALUFOP (T) , Al(llBILE,BBSRC] ;
bblLret:
bb~joSrcFotch:

ra tUI'n
bbSreFoteh:
goto[.+3,nocarry];
bbSrcQAdd rH i (.( bbS reQAdd I'll i) + (tlOOe )~1;
nop;'call't lOud hi basB rog -In m-i pl'Beeding a memory OIl(lI'ation
PF ETCH4[bbSr'cQAdd I'lo, bbSOURC E, 0] , I'fltlll'n ;
"Dest ref-Ill
bbDes tRefi 11 :
nop:
bbOestReFi 1-1 x:
GOTO[bbDustFuteh] , PSTOREtI[bbDestQAddrLo,bbDEST,O];
hbILBD:
hbIlAD: GOTO[bbDustRefillx] , AT[BBIlA,BDDST] :
bbILC3D:
GOTO[bbDestRefill]
DD[bbDESTJ ~ (OBfDX[DB[bbOEST]]) SALUrOp (T) , AT[BBIlC,BBOST] ;
bbllD40:
GOTO[bbDestRufilll ' Dn[bbOEST] ,. (nnrnX[On[bbDEST]]) SM_UrOp (T) , AT[BOIl.D,nnDST] ;
bbILE4D:
GOTO[hbDestRef111] , DD[bbDEST] ~ (BOrO[OD[bbOEST]]) SALUFOP (T) , AT[BnILE,OBDST] ;
bbDflstreteh:
bbDestQAddrLo ,. (bbOestQl\ddl'l.o) + (tiC);
goto[.+J,nocorry];
bbDestQAdd rlli .. (bbDes tQAdd .. 1I i) q 400c) +1;
oop;*cao't load hi base reg in m-i preceding a memory operation
goto[bb ildisp] , PFETCII4[bbDestQAddr'Lo,bbOEST,O] :

Page

9

BitSl t,me

3-Nov-79 19:15:53

Source and Dost rofill
bbSrcDostRof111:
btl I LLISD:
DfllCOTO[iJbDostRef 11,bbSr'cOestFetch,R 000] , bbSrcQAddrLo'- (bhSI'cQAddl'Lo) + (4C) , AT[IHlILA,BBBTII]
bbTLASD:
GOTO[bbSl'cDcstRefll]
DB[bbDEST]'- (fJBFIlX["I)[l[hbD[SrJ]) SALUFOP (T) , AT[flRILC,rmBTII] ;
bblLC3SD:
GOTO[hbSI'cDestitef 11]
DB[IJIJDESTl <- (BBFBXli)f)[bbOESl]]) SALUfGP (T) , AT[flUILD,BBlntl] ;
bbILD4SD:
GOTO[bhSrcDestRef 11]
DB[bbDEST] <- (fJDFfl[DB[bbDEST]]) SALUFOP (T) , AI[BBII_E,SOOTH] ;
bbILE4SD:
bbS.'cDes t retch:
goto[,+3,lIoearry];
bbSrcQlldd r-fl-j .-( bbS rcQlldd rlli ) + (400c) + 1;
nop; *can' t load hi base reg in rn--I preced_ing a memory opel'ation
f'F ETCIl4[ bbSrcQAdclr'Lo, bbSOlJRCE. 0] • goto[ bbDest He F i 11:1

Pago

10

DitOlt.mc

3-Nov-79 19:15:53

Common return to inner loops
bbILDISP:
cnll[bbILrct] , DDFO ;
DISPIITCII[bbFunction,10,4]
DISP[bbIlIllorLoops] ;
deponding upon tho loop typo th"is will go to
%
function 0-7
type
bbi1alz
function 10
type
bb11bl
Function 11-13
typo
bbilcl
function 15-17
typo
bbildl
function 14
bbi1elx
type
%

Page

11

BitBlt.mc

3-Nov-79 19:16:53

Item refill
test if right to left or left to right
bhItemRcfl11:
bhILOT:
~bILAI: GOTO[bbILI] , 1u( 1df[b Function,7,1] , AT[OnILA,BOITM] ;
bbILC3I:
GOIO[bbItemRef 11]
DO[hbOEST] ~ (ORFBX[OB[bbDEST]]) SALUFOP (T) , AT[OnILC,BOITM] ;
bbILD4I:
GOTO[bhItcmRnf 11] , DD[hhDEST1 ~ (80FAX(DO[bbDEST]]) SALUFOP (T) , AT[BUILD,DBITH] ;
GOTO[bbltcmRcF 11J , D8[bbDEST] ~ (BBFO[OR[bbDESr]]) SALurop (T) , AT[BBILE.BUITM] ;
bbILE4I:

bhILI:

goto[bbContRtoL, a1u1l0]

Page

12

3-Nov-79 19:15:53

l3itl31t .mc

cooonon item refill
bbComItemRefill:
pstore4[bbDestQAddrLo,bbDEST,O]
call[bbILret],stack <- (stack) +
;*lIpdat'eicorn (TOS if caned by Mesa, ACl if called by Nova)
GOTO[.+3,R ). 0] , bbItemsRemainingMinus2 <- (hbItemsRemainingMinus2) - 1 ;
bbExitpl:
LoadPage[bbp2];
lu <- 1df[bbFunct ion,l,l], gotop[bbExit]; ~Colllpletion l'otUf'n
-Tost for interrupts
1u .. NWW,skip[R>=O];
db1goto[bbDestUpdate,bbSrcUpdate,n ODD],lu'-bbSI'cQAddrLo; ~Interrllpts disabled by Nova
skip[ALunO],lll .. ldf[bbFlInction,l,l];
db 1[Jo to [bbDo stUpda te. bbSl'cUpda ta, HOOD], lU"bbS l'cQAddd_o;
·n**~**~~

Start of Alto Code

*$.**.*~**~*.~**~***~*~*~*~*~~*.***~~**$~.~$

dblgoto[bbMosaInt,bbNovaInt,ALUnO];
·n*·**~**

End of Alto Code

*~***~***~**~*.*~+*.~*~*.~.***~~*~~*******~***

bbMes ill n t:
LoadPage[ opPage3];
T <- 1c, ca 11 p(MIPend]; *back up the Mesa PC by 1
dblgoto[bbDestUpdaLe.bbSrcUpdate,R ODD],lu<-bbSrcQAddrLo;
"Since wo arc now in a subroutine, and since tho Nova only
"chocks for intorrupts at buffel' ronll and duPing Jumps,
"things are complicated. We s'imulate a JMP ;+0
~n*****~*

Start of Alto Code

*******~***~*

•• ****~~************.*****~*.**

bbNovaInt:
T <- ldf[GETHSPEC[127],15,2];
LoadPil\lc(ncPagc]; *Poillt the jump-to PC at the BitOLT
T ~ (PCB) + (T), gotop[JMP];
~n·**~*** End of Alto Code ******.*****~ •• ~*~**~*.**.******~******.****.*
bbSrcUpdate:
skip[r>=Ol.t ~ lsh[bbSBMn,41 ;
bbSrcS t a rtIJi til i .-( bbS I'CS ta rtBi til i) - (2 Dc) ;
bbSr'cStal'tBitLo <. (bbSl'cStaI'tBitl.o) + (t)
5k ip[nocaI'l'Y]. t<-rsh[bbSDMR,14];
bbS,'cStal'tBHlIi <- (bbSrcSlaI'tBitll'i) + 1 ;
bbS,'cSt.ilrtBitlli <- (bbSrcStartBitlli) + (t);
bbDestUpdate:
skip[r>=O].t ~ 1Sh[bbDBMR,4] ;
bbOe s tSt a r t.rJ i til i <- (bbDos tSta ('W i til i ) - (20c) ;
bbDo5LStarLBitLo ~ (bbDestStartBitLo) ~ (t)
sk ip[nocarr'yl. t<-rsh[bbDBMR, 14];
bbllestStanBitili ,- (bbDestStartBitlli) ~ 1 ;
bbDestStartBitlli .- (bbDestStartBitlli) + (t);
bbFi l'stItcm:
bbTouchSoul'coPages;
call(bbILrotl;*task switch
GOTO[lJbTollchlles LPagos. R ODD],
V-I bbMi IIUS Item~li d t h )+1;

lu~bbSI'GQlldd,'Lo

RrEMP~(zcro)-(t);

call[bbSclbbSQA];
t<-(hbSrcStartOitLo) alld not (17000Qc);
RTEMP~(RTEMP)I(t);

skip[carry1.RTEMP<-rsh[RTEMP,14];
goto[bbTSPl] ;
skip[a1uIl0];
RTEMP<-(20c) ;
bbTSP1:
t<-RTEMP<-lsh(RTEMP, 10];
call[.+l];*avoid mom pass-around
p f et G h4 EbbS ,'cQlldd I'Lo. bbSOIJHC E];
t~RTEMP<-(RTEMP)-(400c);

skip(alu 7
BUILTIN[SETPOST@,44];
·Set post-evaluation macro (SETPOST@[mem,macro])
DU1LTIN[SETMBEXT@,47];
·Set .mb file extcnsion
COMCIIAf10[ -];

·Makes ''''-'' work like "%" at beginning of 1 ines

SETMOEXH1[OIB] ;
M@[SUB,ADD[1I1,NOT@[1I2],l]];
'X,Memur'y du(;laf'atiolls mllst have namcs and sizes agreeing w'iLh those in
Midas, except that 1M must agl'ce with the form expected by MicroO.
%

MEMORY@[IM,t24,10000,W@,W@];
MEMORY@[I1M,20,400,RSRC@,RSINK@];
MEIo!ORY@[TMLOCK, 1,10000, W@,W@];
MEMORY@[VERSION,20,l,W@,W@];
];
IM[ILC0,0];

M@[\~@,

"Dummy macro required for memol'y definitiolls
"Location counter for 1M

%Memory lock Control macro
IMRESERVE[page lI,first address,number of addresses]
Will not allocate 'in the reser,ved locations
%

FLX@[LOCK@,O,O];
M@[IMRESERVE,INLOCK[Z@,ADD[LSHIFT[1I1,10],1I2]]
REPEAT@[1I3,Z0[(LOCK@[l])]]
]
VERSION[VLC@,O];
J~@[

IMUN RESERVE, H1LOCK[ Z@, ADD[ LSlIl FT[III, 10] ,112]]
REPEAT@[IIJ,Z@[(LOCK@[O])]]
]
VERSION[VLC@,O];
FLX@[VERS@,O,17];
%Second arg of LIST controls listillg of memories as follows:
1 = (TAG) I1nl1l1 IlI1JlIl nflllll " .
2 ~ (TAG) Fl<-3, F2<-4, '"
4 = numerically-ordered list of address symbols
10 = alphabetically-ordered list of address symbols
%
LIST@[IM,7]; LIST@[RM,5]; LIST@[,ll];

3-Nov-79 19:15:53

DOLann·mc

Pagu

%Throo macros define parameters from which constants, RM values, or
1M data can be constructed:
MP[NAME,octalstringJ makes a parameter of NAME;
SP(NAME,Pl,P2,P3,P4,P5,P6,P7,P8] makes a parameter NAME equal to the sum
or Pl, 1'2, P3, P4, P5, P6, P7, alld PB, whore the Pn may be pUl'~O, CND@[ IJ JC@[1] JA7@[O] SEr[ALUTESTFlG@.l]];
MI~I-@1I2I3IT8,CND@[11 JC@l1] .1".7@(IJ];
M@L-f9R)=O.CND@[lj JC@[l] JAl@[O]];
M@[-@Il [VEN.CNO@[I] JC@[2J JA7@[lJ];
M@[-@IOAITEN,CNO@[I] JC@[31 JA7@[OJ);
M@[-@NOMO.CNO@(l] JCf9[3] JA7@[I]];
M@[-@NOINTPENDING,CND@[l] .1C@[O] JA7@[O] nRANCH~IIFT];
M@[-@OVF,CND@(I] JC@[O] JA7@[11 SET[ALUTESTFlG@,lJBIlANCIISHIFT];
W~[ -@OPCNOCIIK,eNO@[IJ JC@[1] JA7@[Ol I3RANCIISIITFT];
M@[-@SPAHLNOBIlANCII,CND@[1] JC@[I] ,]A7@[IJ OIWJCIISIIIFT];
M@[-@INQU,\O,CND@[I] JC@[2J JA7f9[O] BIlANCIISIIIFT];
M@[--@NOTlMEOUT,OlD@[lJ JC@[2J JA7Cil[l] BRANCHSIIIFT];
"M@[-@,];
M@[DBAf@,IDF@[-@N3.Wl@[OIJ W2@[1I2](-@N3,-@1I4),W2@[Nl] Wl@[N2](-N3,-1I4)]];
M@[BAT@.JDF@[-@1I2,Wl@[1I1] (-@1I2,-@1I3),W2@[Nl] (-N2,-1I3)]];
M@[GOTOX@,Wl@[1I1] IFE@[CSFLG@.I,JC@[6],JC@[4]]J;
%Branch ond Goto
The branch and goto macros are now identical and are
interchangeable. If the next micro-instruction to be executed
is in a different page, the macro must have a P following it.
Thus GOTOP[xyz] is used when xyz is in a difFeront page from
the current micro-instruction.
This occurs only when the m-i
preceding the current one docs a lOADI'AGE.
%

M@[DBLGOTO,OBAT@[0I,OZ,#3,#41];
M@[DBlGOTOP,CIIPAGE@[I] DOAT@[#I,#2,1I3,#4]];
M@[OOLIJRMJCfI,D8AT@[1I1,1I2,#3 ,114]];
M@[OBLORMJCHP, CIIPAG E@[ 1] DUAT@[1I1,#2 .113, fl4]];
M@[GOTO,IFSE0[N2#3, .GOTOX@[R1],
OAT@[#I,#2,03]]1];
M@[GOTOP. I FS E@[1I2113, ,GOTOX@[ /11 J CIIPAGE@[l].
OAT@[1I1,#2,1I3J]1];
M@[ORANCfI,IFSE@[1I2113"GOTOX@[01].
OAT@[1I1,1I2,1I3J]1];
M@[BRANCIIP,IFSE@[1I2113,.GOTOX@[1I1] CHPAGE@[1J,
8AT@[#I,02,1I3]J1];
M@[SKIP,GOTO[.+2.#1]];
.,*** •• **0* External References
M@[GOTOEXTEIlNAL,IFSE@[IIZ#3, ,
RETCl@[2] JC@[4] JA@[AND@[lIl,377]],
ER@[No.conditional.external.goto]J];
M@[CAllEXTEIlNAL,IFSE@[N2#3, ,
W2@[.+lJ RETCl@[3] JC@[5] JA@[AND@[1I1,377]].
ER@[no. a ['g s . allowed. in. ex te rna 1 . call's]]];
M@[LOAOPAGEEXTERNAl,FFl@[5] FF2@[01]];

Page

3-Nov-79 19:15:63

DOl.ang.mc

%Colls must normally be executed from even locations. because
the f'etul'n is to the collef"s address or:l.
Mic.roO will only pi
macros are required to be calls from odd locations to Did tha
instruction buFfer rofi 11 In iero-code in ro-oxecut"ion following
loading of tho buffer.
The macro RCALI["I=O]. WR~JC;
• jump For illegal sector. WR ~ garbage?
lu ~ commandword. goto[.+2. f' even]; 'tost Df'iveModifier
newdiskadd ~ (newdiskadd) xor (IOCODrive);
nop; * cill1 connot be even target of condtiona1
TASK, PSTOREl[KBADDRESS, NEWDISKADD. CSDOiskAdr];
T~$Track[OLDDISKADD]:
• Is old track
LU"($Track[NEWDISKADD]) XOR (T); • . . . the same as new track?
COTO[MoveArm. ALUnD]. LU~(COMMANDWORD) AND (SeekOnly);
GOTO[JustSeek, ALUnO]. T~$Sector[DISKSTATUS]; • jump for seek only
T~(SSector[NEWDISKADD]) XOR (T). GOTO[DSWJ6. IOATTEN];
DBU;OTO[SectorAlll. AtSector, ALUnO]. RPP~OC;
., at tho I'ight sector?
$

soclor wakeup clean up
SectorAll: NOPj
SectorAl11: WR~SetSBekldle;
OUTPUT[WR. DSKCMMD], GOTO[OSWJ7. IOATTEN];
NOPj
NOP;·two m-i after outputs

• SET SEEK IDLE COMMAND

• process sector intorrupt mask
PFETCHl[KBADDRESS. S[CTORWAKEUP. CSBSectorM~sk], TASK;
* "llow task switch before pl'eceeding storage I'eferenco interlocks
T~PROCESSWAKEUPREGl;

T ~ SECTORWAKEUP.(SECTORWAKEUP)OR(T);* SECT INTERUPT MASK
checking IOATTEN CBuses endless loop ••
PSTOREl[KnADDRESS, DISKSTATUS, CSBStatusl; • set current disk status
warning no tasking allowed from here to the last pstore beforo DSWC2
loadpage[O]; • get bi ts to Oil into N\>JW
callp[OoInt]; * set NHW and IntPending; uses regs 0.1; no task
• get link to next DCD
PFETCHl[DCBADDRESS. OCB, IOCBNext], CALL[IOTask];
LU ~ RPP. GOTO[DSWCX. R>=O]; • Check for error
DCB ~ (DCB) and (OC); • error. don't chain • insure read comp
WR~ones;

PSTORE1[KBADDRESS. WR. CSDDiskAdrl. CALL[IOTask];
RPP ~ PostIOCB;
DSWCX: LU ~ (RPP) XOR (PostIOCD); • check data loop or seek command
GOTO[OSWC2. ALUIIO];
LUf-DCBADDRESS;
GOTO[DSWC4, ALU=D], LU~DCBADORESS;
• just completed IOCB, post status and cdr the IOCD chain
PSTORE1[KBADDRESS, DCB. CSBNext]; • new DCB pointer to kb10ck
PSTORE1[DCBADDRESS. DISKSTATUS. IOCBStatus], CALL[IOTask]; • into dcb
NOP;'why is this nop here?7?
T ~ DCBj • Chain to new DCB
DCBADDRESS ~ T; • p,'oceed i f something there
DSWC4: RPP.OC. GOTO[DSWAI. AlUIIO]; • jump to process next IOCB
NOP; • end of IOCB chain
DSWC2: WR.ResetWakeup;
OU rpUT[WR. DSKCTRLA]; • RESET SECTOR WAKEUP
WR~WR. COTO[OSWTASK];
• INTERLOCK!!!!
• seek only • NO ERROR interrupt
JustSeek: PFETC" 1 [DCIlADDRESS. PROC ESSWAKEUPREG 1. IOCBTrans fe rMask];
RPP~PostIOCB. GOTO[SectorA1l1];
• seek in progress
SeekServico: LU. (DISKSTATUS) AND (SeekFailed);
GOTO[SeekFai1ure. ALUMD], LU ~ (DISKSTATUS) AND (SeeklnProgress);
GOTO[.+2, ALURO];

Page

DMTask.mc

RPPt-OC, GOTO[DSWfl2];
GOrO[SectorAlll];

3-Huv-79 19:15:53

* seek dono

" set arm in motto'!
MoveArm: T<-$Disk[OLDDISKflDD]; * SEE IF WE ARE CIIAt,IGING DISKS
LUt-($Disk[NEWDISKADD]) XOR (T);
WR<~etScekIdlo. GOfO[SwitchDrive, ALUNO];
* jump to switch drives
OUTPUT[NFWDISKADD. DSKADD]; • OUTPUT NEW SEEK I~rO
WR~SendDiskAddross, TASK;
T<-$CylilluIJr[NEWDISK/\DD]; ~ CIIECK FOR CHANGE IN TR/\CK .lIDDRESS
LlJt-($Cylinder[OI.DDISKADD]) XOR (1);
GOTO[. ~2, /ILUIIO], RPP'-Secking;
PSTORE1(KBI\DDRESS, NHIDISKADD, CSnDiskAdr], GOTO[DSIVTASK]; " hd switch
OUrPIJT[WH, DSKCTBLB];
• SET SEND DISK I\['lDnESS
WR<-SctStrobH;
OUTPUT[WR, DSKCTRU\]; • set strobo
GOTO[ScctorAll], RPP<-Sooking;
• SET SEEK flag
• switch d"ives
SwitchDrive: OUTPUT[WR, DSKCMMD]; • SET SEEK IDLE COMMAND
WR'-Rese tWakeup;
OUTPUT[WR, DSKCTRLA]; • RESET SECTOR WAKEUP
OUrpUT[NEWDISKADD, DSKADD]; • DISK CHANGE OVER
WRt-ones;
T~WR~(WR) XOR (IOCBOrive);
• don't clobber drive
NEWDISKADD~(N[WDISKADD) OR (T);
PSTORE1[KBAODRESS. NEWDISKADO, CSBDiskAdr];
GOTO[DS~ITASK], RPPt-Sceking;
"WE HILL RE-DO SEEK AFTER DISK CHANGEOVER

Page

DMTask.mc

3-Nov-79 19:15:53

• on right sectof', prepilf'o ror transfer
AtSectol'; nop;
rASK, PFETCIi1[DCOADDRESS, KDat.iI, IOCRlleadoI'Pointer];
*U'an:;"iatG aHo style read/check/write °lnto IIlDC st'yla
• Tho cnmr.lands fOI' each field are as fooflows
•. Alto fllllC":'ioll IRDC
Let xa ~ high ordor bit of aOI to f!fnetoion
00
road
10
Let ya ~ °low ol'der bit of al to ftlnetiol1
01
check
11
Let xi ~o high order bit of IflDC function
11
wrHe
01
Let yi = low ol'der bit of IIlDC function
10
write
01
then xi a -xu and yi = Xii + ya
.. The old method uses 24. words of code and executes 6 instruction to do the
.. command translation. Notoice with awe that the neVi method use:; but 6 words
• of code and excutes 6 instructions.
T ~ (COMNANDWORD) AND (HoaderLabelDataMask);
* get command field
WIl ... T;
WI~ <- (RSH[HR, 1J) OR (T);
• shift high bits over low
WR ,- (Wft) AND (124C);
.. °low ordel' hits
task,T ~ (CONMANDHORD) ornot (250C);
\~R <- (WR) ornot (T);
RP'-OC;
T<-IIeade rS i ze, CALL[ SotSho rt F io 1 dCon stan l s J;
WP"'OC, GOTO[DSHJI0, IOATTfN];
OUfPUT[Hfl. DSKCMMD];
• output command to disk
ProcessField: CP~llesetWakoup;
OU fPUT[CP. DSKCTRLA]; 'reset socto I' wakeup
WR"'OataTaskAl10w;
OUTPUT[WH, DSKCTR LO]; • sot DATA TASK ALLOW
CP=O];
GOTO[.+2, ALU=O]; • bug? eventually resets CP to CPRead
CP'-CPWrite, GOTO[WriteDisk]; • header or l'lbel
WR<-DataTaskAllow; * processing data field
OUTPUT[WR, DSKCTRLB];
WR<-(WR). GOTO[FieldAll]; * STOP KOB BUrFER
CP~RoadPing,

* ooutput loop (read store and send data to the doisk kob buffer)
• [if quad align and wc>4 do iofetch4 else do output one]
•••••• warning no tasking allowod between the output wp and the buffer command
WriteDisk: T <- ReadMemCount;
WR ~ (WR)+T; * WIl has a copy of KData
LU<-(WR) AND (3C); • CHECK QUAD BOUND
GOTO[DDWPl, ALUNO], LU~(ReadMemCount)-(4C);
GOTO[DDWP, ALU3
OUTPUT[WP, DPWP];
• OUTPUT WRITE POINTER
nop;
• two m-i after output
T ~ (ReadMemCount)-1;
IOFETCH4[KData, OPUT], GOTO[DDWV];
• OUTPUT 4 WORDS

* write a single word onto disk
DDWP1: T <- (ReadMemCoullt)-1;

Page

DMTask.mc

DOWP:
OOWV:

3-Nov-79 19:15:53

PFETCH1[KDaLa, WR];
OUTPUT[WP, DPWP];
OUTPUT[WR, onUFFER];
ReadMemCuunt f "( ReadMomCollnt) -1;
GUTO[.+2, AUJ=O], WP~(WP)+l;
GOTO[F ie Itll\ 11 ~I;
CP~CPHoad;
* STOP WRITHJG

* GET ONE FROM MEMORY

* ourpUT WRITE POINTER
• OUTPUT ONE
• DOWN COUNT WORD COUNTER
jump for Cllt! of field

~

WR~OntaTaskAllow;

OifrrUT[WR, DSKCTRLB]; * STOP KOB BUFFER
I.U<-WRITH1EMCOUln, GOTO[ODWU1];

• input loop (we road kib buffer and send data to tho main storo)
" if quad al ign and wc)4 do then iostore4 else do "input one
° iF wc<4 sot Forco wakeup on ono, in the disk and set cp = to ono for
• term ina t i 011
.uouwarning no tasking a"llowed between the output r'p !lnd the buffer command
RoadDisk: T ... l<-(Rp)+I; * invoke interlock so that po"inter ok before data arrives
IOSTORE4[KData, IPUT], GOTO[DOWUj;
• INPUT 4 WORDS
• I'oad a single word from disk
T <- (WrituMemCount)-l;
DOWO:
OUTpUT[RP, OPRP];
• OUTPUT READ POINTER
RP'"(RP)+I; "' invoke "inter"lock so that pointer ok beforo data arrives
INpUT[WR, DKIB];
* INPUT ONE TO WR
PSTOREl[KData, WR];
• PUT IT IN MEMORY
vi riteMcmCoull t ... (viri teMemCount) -1;
DDWU:
• DOWN COUNT WORD COUNTER
DOWU1: GOTO[EndFinld, ALU=O], LU~RPP;
l.U<-RSH[\~l'iteMemCollnt, 2];
GOTO[.+2, AWl/OJ, WR."WakeMeEveryWol'd;
OUTPUT[WR, DSKCTRLD], GOTO[Fie1dAll];
GOTO[FieldAll];

DOvlO 1:

$
dispatch for next field
[ndField: GOTO[StartLabe"l, ALU=O], LU(-(HPP) XOR (LabelFlag);
GOTO[StartData, ALU=O], RPP<-PostIOCB;
* LADEL done, 00 DATA
GOTO[EndSector];

* prepare for' the label field
StartLabel: pFETC!ll[DCBADDRESS, KData, IOCOLabelPointer];
T"'LabelSize, CALL[SotFieldConstants];
RPP<-LailclFlag, GOTO[NexLFiu1d];
• F"lag forlalHJl
• prepare for tho data field
Stal'tDala: pFETCfll[OCAADDRfSS, KData, lOCDDataPointer];
T'-D!lt as i ze, CALL[ Se t Fi 0"1 dColt stan t s] ;
NcxtField: COMMANDWORD<-LSH[COMMANDWORD, 2], GOTO[ProcossFie1d];
• clean up after a data transfer
• ddwz+4 is the soc tor wakeup point after a data t~ansfer
••• warning must reset data task allow before tasking
[lldSector:
WR~WakcupAllow;
OUTPUr[WR, DSKCTRLD]; * turn orF data task allow
WR ~ WR, call[cReturnJ; * interlock on WR insures completo before task switch
nop; • fOI' the task, task must happen befor'e tlds pfetch
TASK, INpUT[DISKSTATUS, OSTATUS]; • status (after next sector mal'k)
PFETCH1[DCBADDRESS, PROCESSWAKEUPREG1, IOCDTransferMask];
• NO ERROR INTERRUPT MASK TO PROCfSSWAKEUPREGl
DISKSTATUS~(OISKSTATUS) XOR (SectorMask);
DISKSTATUS~(DISKSTATUS) OR (IOCHStatusValid);
WR~ClearStatus, GOTO[DSWJl.l, IOATTEN];
OUTPUT[WR, OSKCTRLA];
GOTO[SectorAll], RPP<-PostIOCO;
DSWJL1: GOTO[DSWJ];
* set counts and pointers for field processing, call with field size in T
SetFieldConstants: LU ... KOata1;
ReadMemCount <- T, use CTask, GOTO[SetShortFieldConstantsl, ALU=O];
PF etc hl[DCAADDRESS, KOata l, IOCBAdd I'es sExton d] ;
WriteMemCount ... T; * avoid PFctch/pass around path problems
LU ... (Wl'lteMemC'lunt) XOR (LabelSizc); * kludgy test for label 01' data
GOTO[.+2, At"U=O];
KOata! ... $OataExtend[KDatal], GOTO[.+2];
KOata! ... $LabelExtend[KDatal];
KOatal ... T ... LSII[KOatal. 10];
KOata1 <- (RSII[KOatal. 10]) + 1;
use CTask;
KData1 <- (LDF[KData1, 10, 10]) OR (T). return;

SetShortFieldConstants: ReadMemCount ... T, use CTask;
SetShortFieldConstantsl: WriteMemCount <- T. return;
• task switch only for non-emulator wakeups
IOTask: LU<-APCTASK;
use CTASK,GOTO[cRETURN, ALU=O];
NOP;
cRETURN: RETURN;
• errors come here
SeekFailure: NOP, GOTO[DSWJ];
OSW.J6: NOP, GOTO[DSWJ];

• error entl'y points to OSWJ, error handler

Page

4

DMTask.mc

3-Nov-/9 19:15:53

DSWJ7: NOP, GOTO[DSWJ];
DSWJ10:NOP, GOTO[DSWJ];
DSWJ:
INi'UT[DI SKSTATUS, ()STATUS];
* get til sk status
DISKSTATUS<-(DISKSTlHUS) XOR (SectorMask);
., invel't sector' InFo
DISKSTATUS<-(DISKSTATlJS) OR (IOCBStatu:;Va1irJ);
* insta II 17 fOl' alto
DISKSTATUS~(DISKSTATUS) OH (IOCBHardwaroError);
errcnt ~ (errcnt) + .l ;
WR~WakeupAl1ow;
•••• - warning this has to be done beFore tasking
OUTPUT[WR, DSKCTRLB];
., cleal' data task anow, it might b\l set

* GET ERROR MASK, TASK BUT DONT CHECK AITEN
• tho current status will be posted into kblock and tho deb
DSWM:
HPP<-onos;· SET ERHOR Fl.AG -into state eontr'ol
nop;*two m-i aFtor output
pr ETCII1 [DCllADDRESS, PROCESSWAKEUPHEG 1. IOCB EITO rMas k], ea 11 [eRetu rn];
rwp; • allow task svlitch bofol'f) proceed-ing storag') ref,)I'cnco intor1ocks
LLJ'DCBADDHESS;
GOTO[DSWK, ALURO], WR~ClearStatus;
PHOCESSWAKEUPREGJ.'-OC; * cleat' my interrupt relJester
DSWK:
OUTPUT[WH, DSKCTHLA]. GOTO[SectorA11];
• DO A CLEAR STATUS
• lOCO command not valid
IIIva1 idSeal:
DISKSTATUS<-(DISKSTATUS) OR (IOCDChockEI'I'or). GOTOr.DSvll<]:
• illegal sector
DSWL:DISKSTAIUS~(DISKSTATUS)

DSWJL12:GOTO[DSI1J];
DSWJL:
GOTO[DSWJ]:
cnd[dm]:

OR (IOCBIllega1Sector), GOTO[DSWM];

"orI'OI' ontl'Y points

Page

3-Nov-79 19:15:53

Ethe rOo fs ,me

TITLE[EthurOefs];

" Defs for DO nricl'ocoae en"Jlat,lng II.:

Paga

ttl

Ethem;;t

*La:;l modified by Murray on Septembor 27, HlJ9 4:0:) AM, ,'\dd UdlcTimer,
• modified by JohnssD~ on Fcbruary 15, 1979 1:01 PM
SET TASK [0]; "For

EIReset

R addressing

MC[ EOReset, OR@[LSlIlFT[EOTosk,41, 01];
MC[UHeset ,OR@[LSHHT[EITask,4],O]];

• Ethernet I/O Address Regi sters
Sel[EIData, 3];
* Input data
Set[Elliost, 1];
" Input data
., Status/State r'cgister (I'(lad)
Set[EStatus, 2J;
Se t [ E00 0 t a, 1];
'" Output data
Set[EReadStato, 2];
MC[EHState, 2J;
'" Stote register read
Sut[EWriteState, 0]; MC[EViState, 0];
• State register writc
• State Hegistor command words
MC[ESetPurgoMode, 260];
MC[ESetOutplitEOP, 107];
~1C[EEnableInpllt, 220];
~ICrE[nilblcOutput, 103-1;
MC[rOisabltlfnput, 200];
MC[EDisableOlItput, 100];
MC[EDisablelnputOlItput, 300J;
• Status bits
SET [ESICOLL, 200];
SET [rSODL,
100];
SET [SIDI.,
401;
SET [[SOCOLL,
20];
SET [FSCHC,
10];
SET [ESOFAlJLT, 1\];
SET [(SOPAn,
2];
SET [FSICMD,
1\];
SET [rSOCMD,
21;
SET [ESIT,
1];

r

• Enabl es 'input
• Ellable!. output, Jam

* Enables Jam
" Cloars O~tputEOP, disables Jam
" Disables input, output. cloars outpulEOP, Jam

• noceiver-detoctod collision (Jam)
• Output data lato (Undol'run)
* Illput datalatc (Ovorrun)
" Transmitter-detocted collision (Collision)
* £lad CHC
'. Output DataFaul t (maskod fOl' now)
" Output [lad Pal'"ity (masked FOI' now)
" Input command isslied ,'" Uot in hal'dw:lI'c:
" Output comtndlld isslied
..
for' AILo elllulation only
"IlIcol'rcct"ly torminated packet (Bad Al-iglllllent)

t~C[ETS~lASK, ESIDL, ESCI1C, ESIT];
" Statlls bits I'eported for input command
MCP:OSt.1ASK, lSODL. ESOCOLL];
"Status bits reported for output command
MC[ECNDI3ITS, ESICMD, ESOCMD];
"Colilmand b'its

fl- registol's for input and output task

RV[EBnse,Ol;
" Base register fOl' first 611K space; 0 alld 1 used by DoInt
IlV[Ulaselli, 1];
HVrrPIH.2J;
" Buffer base register
RVIEPIHlli, 3];
HV[I:Count, 4];
"Main loop counter
IN[LTIMP, G];
"Tcmpol'al'y registers
RV[EHMPl, 6];
I1V[[HM n 2, 7];
I1V[LFlilU, AND@[OH@[LSIIHT[EITask,4J.I0],77]];
* input undel' output flag (reg 10 of EITask)
MC[prnilndomno[J, 37/];
" NUllibel' or random number (HUI1 rO[Jister)
MC[pI"ONoLifyReg,3110J;
,', negistor usod for timer notify
"Dispatch table locations
Set[EEUase, LSHIFT[EEPage, iOJ];
Set[EESIOLOG, ADD [EEUase, 20J];

• Dispatch location for SIO

"Address constants
Set,[EOStal'U_o\., ADD[LSIlIFT [EDPage, 10], '1201]; " Output ,notify location
Sot[EOTinwl'DoneLoc, ADD[LSHIFT [[OPage, 10], 130]];
" Output rimorDone notify location
Set[fISLllrtLoc, ADD[LSIIIFT [DPage, 10]. 14011; " Input notify locntion
Setl.EIAbortLoc, ADD[LSHIFT [EIPage, 10], 150]J; " SII) abon notify location
• Cont.rol block addl'esses (fol' Alto emu'lation, relative to GOO)
MC[[Pl.OC, 0"1;
• Post location
MC[EPLOCl, 200];
• Post location (relative to 400)
MC[EBLOC. 1];
"Interl'lIpt bi t lJIask
MC[EBl.OCl, 201];
" Interrupt bit mask (relative to 400)
MC[EELOC, 2];
"Ending word COUllt
MC[ELl.OC, 3];
"Load mask
/,lC[EICLOC, 4];
"Input count
MC[EICLOC1,204];
"Input count (I'olativo to 400)
MC[EIPLOC, 5];
"Input pointer
MC[EOCLOC, 6];
"Output count
MC[EOPLOC, 7];
"Output pointer
MC[EIILOC. 10];
"Host address for addross ,'ecognitioll
MC[EIlLOC1, 210];
" Host addl'ess for addr'css recognit.ion (relative to 400)
" Timor masks (slot is EOTask)
Sot [ETimorRunning, 6];
.. State 5is simple timer
Set [ETimerIdle. 4];
• State 4 is idlo
MC[ETimerMask, LSHIFT [ETimerRunning, 14]];
MC[EIdleTimer, LSHIfT [ETimor'Id-le, 14]];
ether constants required in both in it and code (Midas mesa only)
" Microcode post codes (small integer in left half, olles in right half for XOR),
Note: valuo is complemented to get constant less than 8 bits,
Use XNQR for formation of post code,
MC[ESIDON,
NOT~ [377]];
" Input done
MC[ESODON, NOT@ [777]]; " Output done
MC[ESIFlJL,
NOT@ [1377]];
" Input buffer overflowed
MC[ESLOAD, NOT@ [1777]J;
" Load overflow
MC[ESCZER, NOT@ [2377]];
* Word count zero in input or output command

EtherOefs.mc

NC[ESAORT, NOTS [2777]];

* Miscellaneous
MC[ECOLLMASK, 10000];

3-Nov-79 19:15:53

~

Command aborted (by SID)

• Mask for collislon detection

Page

3-Nov-79 19: l6:53

Etherlnit.mc

Page

illsert[dfJlnngl:
NOMIDASINIT;LANGVERSION;MULTDIO:
in5crt[GlobnlOefs]:
insert[EthorDefs]:
title[Ethorlnit];
"Last moc.iif"ied by Murrny 011 September 12. 1979 7:1\5 PM
-Last lilodir"led by Juhnssoll on April 7. 1979 12:32 PI·1
SET TASK [0]: *For "egiste,' addressing.

Add Dum;ny Output task rnit

This COUl) real"ly runs at task level [ITask

ETHERNET INITIALIZATION ~ubroutino (executed by [ITask).
\v"i11 only ho cn"I"led if the,'e is an Ethernot bO.1rt! iiI the mach"lne.
Road Ethernot 10 f'~m board Dnd form constant to be returned by SID.

ON rAGE [EtherInitPago];
Ethel'Init:
T <- GETHSPEC[103] xor (377C). at[EtherInInitLoc]; *Stkp (invel'tou)
LOaso <- pEHostRcgx: *rHostReg is ill Lhe emulator's R space
Slkp t- ElJase;
Input[Stack. [IHost];
Stack <- (Stack) AND (377C);
., IDin "ight half
SLack <- (Stack) on (77400C);
Compllte value for EONotiFy rogistor'. used for notify arter' timor wakoup.
[[3ase (- AND@[0377. [aT ilne rDoneLor.]C;
* Low 8 bits of APC
[nase <- (EBase) on (OR@[lshift[EOTask.14].AND@[7400.EOTimerDoneLocJJC); • Hioh 4 bits of APC
ElJaselli ,- pEONotifyHcO;
Stkp 0 [lJnseHi. [BaseHi

r '"

<-

T;

Enasa;

Stack '" T;
HFTURN. Stkp '" EOasclli; "r'(lstOI'O Stkp
°NoLo - baso registers 01'0 initialized each time input or output is started. so we
'do not neeu to uo "it hero.
flETUflN. at[EthcrOutlnitLoc]; *DumlilY Illit For Out Task.
elld[othorillit];

3-Nov-70 19:16:53

Etherfask,mc

Page

insert[=O], T ~ ECount (- (ECount) + 1;
-, R)"O ,,) count -is lel'O
-. Ctreck buffer al igllfllellt,
• Compute how many singles before fil'st quadwonJ, and form loop counter in ETempl.
Address:
xOO => no s-inglos, loop cOllnt ~ -1
Addross:
xO! ,,> J singlus, loop count ~ 2
Adell'ess:
xlO ,,> 2 singles, loop count = 1
Arldress:
xl1 =) 1 singles, loop COUllt = 0
T ,. (F P t I') ... (T) ~ 1;
• Form 5 t a I't .1 d d I'e s sin T
[Tempt (- (ZERO) - (T);
• COII'l)lellient, illGI'emont
ETempi (- (LDF[Elempl, IG, 2]) - 1;
CALL [UAlignE], T (- ECoullt;
• Set return for EIAlign loop
EIAlign:
GOTO [ETQuad, R(Ol, ETompt ~ (rTen~l) - 1;
GOrO [FlIllifFulll. R>=OJ. T .. [Count ,- ([Count) -\ 1;
ItJPUT [E fefllp2, F!Data];
LU f- ETelllp2;
• Abort
fIAlignE:
RETURN, PStorol [EPtl', ETernp2];
• Now s ta r't (fuadwo rd output.
• Adjust LPtl' and EColint rOI' ~-word transfers,
EIQuad: [Coun t ... ([Collnt) + (3C);
CALL [[[Loop], EPtl' (- (EPtl') - (GC);
, Set rotll/'n addl'ass fOI' Ell_oop
" Read t_lw Hardware Input Buffer into tllo Main HCfIlory In Buffer,
EILoop: GOTD [ElQuadf'ull, R>"O], T (- [Count' ([Count) \- (=O], [Count ,- (ECount) ... 1;
GOTO [UAttnS, IOAHUIl, r .- ([COunt) + (GC);
"Set lip T rOI' PStorel
INPUT [Efemp, EIDdtaJ;
LU (- Elemp;
RETURN, PStorel [EPtr, ETemp];
• We get IWI'e whon IOATTEN is detected in ULoop.
• NlImbCI' of word loft in buFFor " J - [Count + 1 (CRC) ~ Excess count.
EIAttnl:
NOP;
EIAttn: INPUT [ETemp, EStatus];
" Road Status
T <- LDF[ETemp, 10,21;
• Isolato Excess Count
ECoull t ,- ([Coun t) XNOfl (OC);
• COfllp-lemel)t
ECount (- ([Count) \- (l1C);
• Inc rClllU/I t, add 8
ECount ~ ([Count) + (f);
• Add excess count
EIAttn2 :
T (- ETemp;
ETomp ~ (ETemp) ANO (124400C);
SKIP [ALU=O];
NOP%BR[J\KPOINT%;
[Temp'" T;
ETemp (- (RSH[ETcmp, 10]);
" Shi ft down status
[lemp .- (ETemp) AND (FISMASK);
'. Mask out uninterest.ing status bits
Elelnp .. (ETemp)XNOR(ESIDOI~);
• Post input done status
* StOI'Q EECLOC.
UPost: CALL[ElaskRet], PStore1 [EBase, [Count, [ELOC!];
• Post status, disable interface (purge packet too), anti TASK.
• Post status in ETemp, disable value in ECount.
[IPostA:
ECount ~ [DisableInput, CALL [EPost];
End of packet.
ESaseHi ~ OC; *ropair base registes smashed by EPost (Oolnt)
EUase (- 200C;
EBase ~ (EBase) 01' (400C), GOTO [EIIOLE];

*

Get hero when an IOATTEN is detected during lhe EISingles loop.
• Number of words left in buffor = 1 - ECount + 1 (CRC).
EIAttnS:
ECount (- (ECollnt) XNOR (OC);
* Complement
[COUllt .. (ECount) + (3C);
" Increment, add 2
GOTO [EIAttn2], INPUT [[Temp, EStatus];
• We get here when the input buffer is exactly full.
o First check if IOATTEN is high, indicating that tho last word was the CRC.
EIBufFulll:
NOP;
EIBufFull:
SKIP[NOATTEN], ETemp (- 1C;
GOTO [EIAttn2], INPUT [ETemp, EStatus]; "Last word input was CHe
• Read ono more word to see if the next is the CRC word (Which we will discard).
ECount ~ OC;
• No words left in buffer
CALL[ETaskRet], INPUT [ETemp, EIData];
* After wakeup, check IOATTEN.
NOP;
• Can't check for Attn here
GOTD [EIAttn2, IOATTEN], INPUT [ETemp, EStatus];
IOATTEN =) Word was CRC
Elernp .. OC;
GOTO [EIPOST], ETemp (- (ETemp) XNOR (ESIFUL);
• Input buffer overrun, post status

Paqe

EtherTask.mc

3-Nov-79 19:15:63

• Get here 11' input buffer' has zero word count. Post.
EICOuntZero:
ETemp ~ OC;
GOTD [EIPost], [Temp ~ (ETemp) XNOR (ESCZER);
• Input micr'ocodeis notified here by emldiltor SIO when AC0(16: 171 = :I.
• Milnufacture "Abort" status and post. (Input hardware will be disabled ogain, which doesn't matter.)
EIAbort:
EElaselli f' OC, AT [EIAbortLoc];
., Set up base pointer' to loc 600
EBase ~ 200C;
EBase ~ (FBuse) OR (400C);
ETemp ~ [CMDBITS:
GOTO [EIPostAl, ETemp ~ (ETemp) XNOR (ESABRT):
• Alto-emulation OUTPUT MICROCODE
• Output microcode is notified at [OStart by the emulator (at SIO).
• Some initialization is done. and the Irc set up to EOIDLE, enable hardware and TASK.
[OStart:
CALL [EINIT]. ETemp ~ EEnableOutput, AT [EOSLartloc]:
• Idle state of the Ethornet output task
PFetchl [l'Base. ETempl. [LLOC!]:
* I'etch Cllr'l'ent 'Ioar!
SKIP [R>~Ol, T ~ (LSII[ETempl , 1]) + 1: * Form neVi load, chock it' old overFlowed
GOTD [[OLDOV]. [Temp ,- DC;
• Post Load overflow "tatus
[Temp" T:
" Store updated 10 no input set up
OU1PlIr [nemp, EWl'iteState];
* Start :i'imple timor with low 7 bits of random number.
• Timer slot is [OTask,
ETemp2 ~ [TimerMask;
• Compute timer word
T (- CTASK;
* Timel' slot is samo as output task no.
T ~ (E T em p 2) 0 II (T);
EOLoadTime,':
ETemp1 (- LSII[ETempl, 4];
ETelllp 1 " (ETempl) OR (T). TASK;
LoadT ime r[ [Temp 1] ;
EOIDLE:

Timer has expired, Check if input (under output) came in.
EOlimerOolle:
GOTO [[OMoreTirne, H EVEN], UJ ~ Ulag, AT [EOTimfJrDoneLoc];
* Check if pkt came in (EFlag
ETemp (- EDisableOutput;
• If so, abort output
OUTPUT [ETemp. EWriteState];
CALL[ETaskHet];
NOP;
• Check if still more time to elapse beforo start of transmission (High part of random number >"0).
EOMoreTime:
ETompl ~ 177C;
• Set up maximum timer value
GOTO [EOLoadTimel'. R>oOJ. ECount .. (ECollnt) - 1;
" Enab'le output and shut off the receiver (in case it was turned on).
[OOegin:
T ~ EIResot:
ETemp <-- [DisableInput;
OUTPUT[ F.T emp ] ;
ETemp ~ (EEnab'leOutput);
OUTPUT [ETetnp, [WriteState];
• Set up EPtr and ECount for single word transfers.
[OSetup:
T ~ [OCLOC;
CALL[EBSetup]:
• Subroutine returns with:
EPtr' = OPtr + OCOUllt - I, ECount = "OCOUl1t
• Check for zero count.
GOTO [EOCountZero, R>=O]. LU (, ECount;
.. R(O ,,> cOlJnt is zero
• Compute how many singles before first quudword, and form loop counter in ETompl.
Address:
xOO ,,> no singles, loop count =-1
Addr'ess:
xOI => 3 singles, loop count
0
Addl'ess:
xl0 => 2 s'ingles, loop count = 1
Address:
xU =) 1 singles, loop count = 2
T ~ ECount;
T <-- (EPtr) + (T) + 1;
.. Form start address in T
ETempl ~ (ZERO) - (T);
• Complement, increment
CALL [EOAlign]. ETempl ~ (LDF[ETempl, 16, 2]) - 1:
rOAlign:
GOTO [EOQuad. R(O], ETempl .. (ETempl) - l'
GOTO [EONoMorel, R>=O], T ~ ECount ~ ([Count) + l'
PFetchl [EP t I', ETemp];
LU <-- ETemp;
.. Abo rt
GOTO[ERet], OUTPUT [ETemp, EOData];
• Now start quadword output.
• Adjust [Ptf' and [Count for 4-word transfers,
WQuad: ECount ~ (ECount) + (3C):
CALL [EOLoop], EPtr <-- ([Ptr) - (GC);
.. Set return ~ddress for out loop
.. Output from the Main Memory Output BuffoI' to the Hardware Output Buffer.

1)

EtherTask.mc

3-Nov-79 19:15:53

[OLoop: GOlD [f:OQuadEmpty. R)"O.\, T ,< ECollnt ,< (ECoullt)
[EOAbort. 10ATTEN];
RETURN, IOFetch4 [EPtr, EOOata];

Goro

,~

Page

(4C);

• Normal exit From Output Loop is here

• 7 - XWCount • nwnbor of singles remaining
• T is set LIP for next location.
[OQualiEmp ty:
[Coun t (- ([Coun t) XOR (7C);
CALl,[EOSingles]. [COllClt (- ([Count) - l '
EOSingle5:
GOTO [[ONoMorc, R(O],
ECount ~ ([Count) - I;
PFetchl [EPtr, [Temp1;
T ,< (ZERO) -I- (T) +
1, Hemp;
• Abol't
GOTO[ERetJ, OUTPUT [ETemp. [OOata];
• Wo're dono output'ing words. Set output EOP.
FONoMorol:
NOP;
[ONoMore:
ETemp " ESetOutputEOP;
OUTPUT[ETemp,EWritoStato];
• Set OutputEOP
CALI.[ETaskRet];
• Should he woken up here after hardware's done sending packet or an error
EOENO:
INPUT [ETemp, [Status];
" Read Status
EOENDl:
T ... ETomp;
ETemp (- (fTomp) AND (5JOOOC);
SKIP [ALU~O];
NOP %OREAKPOINT%;
• BREAK < Bad Ouput Status
ETemp (- T;
LU ,< (Hemp) MID (ECOLLMl\SK);
'. 1.ook at collis'ion bit
GOTO [EOCOLL.. ALUIIO-\, ETemp'-EDisableOutput;
-, IILUIIO =) Collision, try again
• If not collision, form st.atus. Could be good packet or lIllderrun (ODL),
('COUllt ,- OC;
ETolilp ,< RSII(ETemp, 10];
-. Shift down status
[lomp " ([Temp) AND (EOSMIISK);
• Remove unintcresting bHs
Elmnp ... (ETomp) XNOR (ESODON);
EOPost: CALLfUaskReCj. Pstorel [lOose, ECount, [ELOC!];
• Stol'e oud count
[Count ,- EDisablcOutput, CIILL [EPost];
GOTO[,J'iWIH.IIKPOINT%;
• Shouldn't get here,
We arrive hero after an IOl\TTEN is detected in the main loop, indicating an error condition.
" IOIITTEN will be tl'ucif a coli ision or underrun has occulJ) The fault was dotccted all page 6 and was due to a Pf'etchil,
Tilis is
·'a jump in5tI'Llctiol1 buffer ['crill. We procood as in case I without
'setting PCF.
*4) The fault was due to all Xfer buffer refill (MemStat[IJ:IG]
·XforFixup).
This is handled just like a jump.

=

·'5) Tho fault occllred during the oal'ly phases of Xfer.
We want to bar.k
·out and redo thcinstruction, but CODE may have ch=PCX) thon PCX-·l else PCX-9 (if PU retch, 1"> :;toro
Stkp ,. RTEMP, 1u ,. T;
• pO'lnt to count, test rosult to a1u
Stack ,. (Stack) + 1, skip[a'll, It 0]; * count + 1; now test fetcil/3tor'e
T .. (PCXHog) - 1, [Juto[FPCOx];
• fotch; done with fhup
Stack&-1, call[DecGlorp];
• source - I
Stack&e2, call[DecGlorp];
" dest - 1
T .. (PCXRog) - I, 90to[FPCOx];

OocG1 01'1):

Stack" (Stack) - I, return;

FixPCOn1y:
T .. (PCXRe!) - l,IIT(FixDisp,O]; "normal PC flxup
!'PCOx:
RTEMP (- T, skip[alu>"O];
PCO ,. (PCB) .. (4c);
• rcx was 0, inst startodin previous quadword
lu ,. (PCFRog) - (T); "test for PCX largo, rCF sllledl
PCF .. HTEMP, skip[alu>=O]; "PCFis always PCX"I, on'ly PCO is in doubt
PCB (- (PCB) - (4c);
·"el'!} PCfJ,PCF is corl'oct pc to save for trap.

It will bo done th"ough KFCB.

StartMemTrap:
T 0 SStkp, ut[SturtMomTrapLoc];
SMTl'px: RTEMP .. pPipeHeg, task; 'Point stkp to pipe reg'isters
Stkp .. RTEMP, RTEMP .. T;
MemStat .. Normal;
r <. (Stock&+l) and (177c);
·low 7 bits of VPoge
r .. (lsh[Stack&~l,7]) or (T);
Ohigh 7 bits of VPagc
xfOTPReq <. (zero) or not (T);
xFOTPRcg ,- (xfOTPRcg) and 110t (140000c);
stack&+3, task; ·point to flags
r <-ldf[Stack, 12, 1]; "Tost Dirty': 0=> pa~lc fault
Stkp .. HTfMP, 1u (. T;
"Restore stkp
sk ip[f\lU"O], L.oadPage(7];
r 0 sWritcProtcct. gotop[kfcr];
r <- sPagoFault, gotop[kFcl'];

END;

Pago

GlobaWefs.mc

3-Nov-79 19:16:53

fITLE[GlobalDefs];
• Last Modified by Chang on October' 10, 1970 7:29 PM, revised RDC & X\J-codes
• Modified by Chang on Soptenilior 17. 1979 5:36 PM, New ROC-codes
, Modified by Chang on Septembel' "I, 1979 4:27 PM, clean page 2
• Modified by Chang on AUfjllst 23, 1979 2:42 PM, move Tlmel"s regs & CSfl
• Modified by Chang 011 August 13, 1979 3:03 PM, RDC Intogr,lt"ion
• Modified by Chang on August 2, 1979 2:09 PM, Change XW-Tasks numbera
• Modified by Chang on Ju"ly 6, 1979 6:07 PM, Two XWiros
"ModiFied by Johll'ison on June 15,1979 3:18 PM, add Kernel register's (new Midas)
'I~oclified by Challg on May 27,1979
4:41 PM, for Ovel'"\ay bootill[J (midilS)
"~lodHied by JOhliSSOIl on May 14, 1979
8:53 AM
"Modi t'ied by Challg on May :to, 1979 B; 27 AM
"Modified by Sandman on May 8, 1979 11:58 AM
"'Mod"i f ied by ,)ohnsson on May I, 1979 3: 06 PM
I[)F@[Mi dasl3oot, , Se t [Mi dasOoot, 0]];
lDF@[XHire, , Set[XWire,O]];
"Task Numbers
Set[EOtask,12]; ·Ethernet Output -- DO mode
Set[EItask,13]; "Etherllet Input ."- DO mode
Set[EOtask2,6]; "Ettlol'net Output -- DO mode (second hoanl only)
Set[EItask2, 7]; "Etllernet Input ."- DO mode (second boa I'd only)
Set[Otask,10]; "II1DC
• MC[Rdcfask, 11]; "SMOOO, implies a set[lhlcTask!, 11];
Set[fldcTask, 11];
Set[uiUTFPTASK, 14J; "IUTFP
SOL[TTask,16];
Sd[nFTask,4]; *nS232 frame task
SutlRnrask,5]; ·I1S232 bit lask
, •••••••••••••••••••••• CSO Assignments
Set[XOStartCSR, 1776~O];
• Output CSO (boa/'d 1)
SetfXIStartCSfl, 177660];
" IIIPllt CSO (board 1)
SetlXOStal"tCS02, 177540];
" Output CS[l (boa/'d 2)
Sel.[XIStal'tCSfl2, 1775GO];
• [1I[lllt CS[l (boal'd 2)
SET[I1S232CS[lLoc,177500];
• CSO location
Set[RDCCSOValue, 177620];
" RDC CSO
~**********.***~****~***~**~**~****~.*

"Page Assignments
Set[InitPage,16];
Set[InitPagel,2];
Set[InitPage2,l];
Set[1.oadCSPago,l];
Sel.[Timel'l'age, 0];
Sel.[TimcrinitPagol,21;
Set[TimerinitPage2,2];
"'NOTF. - an initial"ization is "cl'ammcd onto tho same page.
Set(DiskInitPaqe,21; 'ThrowawilY init code for disk
SutlOisklilil.Lo<-,Add[l.shift[Di:;klnil.l'ilge,10],2()3JJ; "Disk initialization
Sot[OisplaylnitPage,21; *Thl"OWawilY init code for IUTrP
Set[DisplayTnitLoc,Add[Lshit't[DisplayTnitPage,10],207]]; 'Display initialization
Set[RdclnitPage,7:i; *lhl'owaway illil. eode fOl' SA4000
Se t[ Rde In i Wase, Add[ I.s h if t[ Hrlc1n i tPage, 10 J, :3,10 JJ; ·SMOOO
Set[Rdeln i tLoc ,Add[l.shi ft[HdeIn 1tPage,lO] ,340]J; "SA4000 III itia"1 izatiol1
Set[ UherlnitPage, 2];
5et[Ethel'1l1lnitLoc,AddfLshifl.tEther'InitPage, 10], 210]1; "Ethernet "initialization
Sel[ [ttw rOu tIni tLoc, Add[ Lsh i r t[ El.he rIn !tPage, 10],212 J]; "Ethe rllet in i t i a Ii zat iOI1
• --) (2nd board only)
Set[EtherInitPagc2,2J;
Sot[ EtllCrlllInitLoc2, Add[Lsh i fL[EtherIn itPage ,10J, 214J]; "2nd Etllol'lIet in itial ization
Set[EthorOutInilLoc2,Add[Lshift[EtherInitPage,10],216J]; "2nd Ethernet initialization
Set.[FEPagc,3]; "Ethernet m"icrocode
Sel.[EOPage,3];
Se t [ F I P a\1 e ,3] ;
Set[KeyPage,11]; "Keyboard translation table
Set[KeyTable,add[lshift[keypagc,10],140]];
MC[KeyTab"lell, alld@[keytable,7400]);
MC[KeyTablaL, and0[keytable,317]];
Sel.[opPagcO,4J; ·These cannot move easily, since the hardware forces the t'irst instruction
Set[opPagel,5]; 'ot' each bytecode to start at 2001 + (4 " opcode)
Set[opPage2,6];
Set[opPage3,7];
Set[MulDivPage,4];
Sc t[ LRJPage, OJ;
Set[ClrDvPage,4];
Set[faultPage1,14];
Set[DRPAGE,10J; 'Disk mic/'ocde
Set[DRPAGE2,11J; ·~~re disk microcode
set[hbpl,
11];
*bitblt page 1
Sct[uiUTFPPage,12]; 'Display microcode
Set[lIePage,1];
Set[HdcPage, 13]; • SMOOO main task
%
••••••• , •••••• page-assignment for ROC
Set[HdcPagel, 13]; *SMOOO, main task
Set[l1dcPage2, 13]; ·SA4000, used to be
Se t [HdcPage3, 17 J; ·SMOOO, used to be
Set[RdePage4, 17J; ·SMOOO, used to be
Set[RdcPage5, 17J; ·SA4000, used to be

page
page
page
page

"RdcOverflow"
"RdcOve rf low"
"RdcOvert'low"
"RdcOvert'low"

$*********$**~*****$********

%
set[bbp2,
14];
Sot[xfPage1,15];
SET[pl'Page, 16];

*bitblt page 2

Set[DOootOoneLoc,Add[lshift[InitPagel,10],375]J;

Page

Gloha·'DeFs .me

3-Nov-70 19:15:63

Set[KrCRLoc,Add[lshift[oppagoJ,10],76]];
Se t [P7T ai 1 Loe, Adel[ Ish·i rt [OPfl age3, 10 J ,27]];
Set[LoudGCLoc,Add[lshift[xfPngol.l01,300]];
Set (neNos ki p Loc ,Add[ 1 s h i ftC neP ane , 101,2131] ;
Set[InitEndLoc,Add[lshift[TimorPane,10],20]];
Set[EEStartLoc,Add[lshift[E[Pago,10],105]1;
Set[SLortMo~rrapLoc,Add[lshift[FaultPagcl,10],16]];

Set[PNIPDose,Add[lshift[TimerPage,10j,166]];
" Pilot high l'e501l1tion clock
Se t T ask [TT ask] ;
RV[ClockLo, 50];
nV[Clockll i, 51];
• The follow·ing 5 definitions ~lUST MIHCH THOSE IN flS232C MICflOCOD[!!!
• Also, code depnnds on fllNotify valuo being zero!
MC[flINutify,O]; • Inpllt bit notify least s in. byte addross
MC[flONotifY,lJ; • Output bit notify least sig. byte addross
MC[flPNotifY,2]; '. Poller notify least sig. byte address
HV[EONotify, 40];
$
Ilegister containing notify vahle for' Ethernet
RV[EONotify2, 44];* Rogister containing notify v~lue for 2nd Ethernet
flV[HFNotifY,4D];
• Registor containing frame notiFy values
RV[RXNotify,47];
• flegister containing bit notiFy values
• End of flS232 defillitions
HV[RSIrnage ,JI2];

"Image of RS232 hardware I'ogistor'

" Kernel reg·isters
SetTask[ 17];
RV[RXAlU,7D];
'AI~ result and SALUF
RV[RXAPC,75];
"APCTask&APC
HV[HXCTASK, 74]; "'CTASK. NCIA
RVrRXPPB,JJ1;
·Page,Parity,BootReason
nV[IlXS1K,72];
'Stackpointer
flV[lnt~p, l1J;
·'tempol'ary
HV[FFaul t, D6]; °FI ags tell what to do wi til fault
~IC[FFallltAdd, 366]; "Addl'ess of FFault
SetTask[O];
"Registol' definitions for Nova and Mosa emulator
"The Mesa Stack.
These locations cannot movo, since the hardwar'e does overf"low checking on
"those registors.
RV[StackO, 1];
flV[Stackl, 2];
RV[Stack2, 3];
RV[Stack3, 4];
RVrStack4, 5];
RV[Stack5, 6];
flV[Stack6, 1];
RV[Stack7, 10];
" Registers used to hold con~tants
HV[f1400, Hi]; ·const.ant 400
RV[AllOnes,16]; '·1
nV[RZero,17]; ·0
"Nova contral registors
RV[ACO,20]; "'QlIadword block for ACO-3
MC[pACO,20]; *fl address of ACO
RV[AC1,21];
[lV[AC2,22];
nV[AC3,23];
flV[CAflRY,24]; "Nova carry bit in bit 15d
nV[tlv/W, 25] ;
MC[pIJWW,25]; ·pointel' to NWW
'Base registors
RV[Nova,26J; "Baso of Nova address space
RVPJovah,27];
RV[PCB,30]; "PC base register pair
RV[PCBh,31];
nV[PC, 30];
flV[PChi, 31];
flV[OMA,32]; "temporary base register' used by CONVERT
flV[DMAh,33];
nV[SMA,34]; *temporal'y base register llsed by CONVERT
flV[SMAh,35];
RV[MDS, 36];
RV[MOShi, 37];
RV[GLOBAL, 54];
RV[GLODALhi, 55];
flV[xfMY. 56];
RV[xfMX, 57];

• must be quad aligned

nV[LPdest. 56];
RV[LPdestlli,67.1;

• Long BLT

RV[COOE, 60];
RV[COOEhl, 61];
RV[LOCAL, 64];
flV[LOCALhi, 65];

• must be GLOBAL + 2

Page

G-'obaWefs.mc

3-Nov-79 19:15:53

RV[LP,66]; ·long pointer base pair
nV[LPhi,67];
HV[P£3ase, 26];
• PSB base register
HV[PBasehi, 27] i
RV[Quouel,44]; • Queue base I'egister for 1)I'ocess mach-inory
HV[QueliellJi, 45];
IIV[Ououe2, 46J; • Quell(J base register for' pl'OCOSS machillary;
RV[QlIellc2hi, 47];
"Ouf Fers
nV[IBUF,40J; *4 wOl'd illstl'uction buffer (nM 40-43)
RV[Hlufl, 1\1];
nv fT Bu f 2, 42:1;
HV[TlJuf3, 13];
IlV[xnuf,44]; *Quadward temporary buffer (RM 114 - 47)
MC[pxnuf, 44J; 'po inter to xl3uf
nV[xl3ufl, 45]:
I!V[xBuf2, 4G];
HV [ x nII f 3, 47];

'rime registers far p/'ocess timoout;
HV[Curl'ontTimo, 62];
I!V[fickCount, 63];
'0 the I'
HV[xfrsi, 32];
HVfxfHlink, :13];
RVI RUllk, 33];
HV[xfGfiWol'd, 34]; "holds wo/'d 0 of global frame
RV[x fRsav, 35];
HVr[flld,501; ·Nova Effective add/'ess
RV[Mell1Stat, 50]:
HV[HOlf,51]; "usod by MUL and DIV
HVrx fFramo, 51];
HV[RTEMP,52];
HV[HTEMPl,53]; "used by Illterrllpt Test
HV[Hesu1 t, 531; "temporary
HV[intHH1,54]; "'used by Interrupt test
HV[INTX,55]; ·used by Interrupt test
HV[xnXII.56]; "tfHnporllI'Y used by CONVERT
nV[I-JW,5G];
nV[IICflVE,57]; "lIlust be WWI-l
HV[xIJDe5t,57]; "temporary lIsed by CONVERT
nV[XflT,57]; "registo/' used as temporary when initializing DB as all index into x£3uf
RV[xf13rkByte, 74];
'Process registel's
73];
RVlMQ, 66];
HV[PIlFI ags, 71];
IlV(Prev, 70];
HVIQTcmp, 12];
HV[QTcmphi, 13];
HV[PflTime, 72];
HV[flTomp2, 67];
flV[ [Temp, 12];
HV[lTcmpl, 13];
HV[Intfype, 14];
IlV[IntLcvcl, 57J;
nv l EM Li n k, 10];
INtP /'oces s,

HVrxfTemp, 72];
HV[xt'Templ, 73];
nV[xfTcmp2, 66];
RV[xfCount, 67];
IlV[xfllTPrcg, 71];
nV[xfXTPrcg, 70];
flV[xfOTProg, 11];
RV[Ef!ostfleg,75]; "Ethernet host register' (accessed by Ethernet code during S10)
MC[pEHostRegx, 74]; "pointer used during Ethernet initialization (points to 74 because
'INPUT to the stack does 11 push
RV[xfWDC, 7G];
RV[xfxrS/'cg, 77];
*bitb1t registers
rv[bbDEST,
rv[bbRTHlslx,
/'v[bbflTEMsty,
rv[bblHEMdl x,
rv[bbRTEMdty,

44];·Quad-word buffer coincident with xBuf
44] :
46];*paired with bbRTEMs1x
46];
47];*paired with bbRTEMd1x

/'v[bbSOUHCE,

70];*Quad-word buffer

rv[bbS rcQAdd rLo,
rv[bbSrcQllddrHi,

32];*map base reg
33];*paired with bbSrcQAddrLo

rv[bbDestQAddrLo,
rv[bbDestQAddrHi,

56];"map base reg
57];"paired with bbDestQAddrLo

rv[bbSBCA,
rv[bbGRY,
rv[bbSBMR,

5]

rv[bbDOCA,
rv[bbGrayCnt,
rv[bbDBMR,

4]
4]
~p1l1red

with bbSBCA

6]

6]
7] 'paired with bbDBCA

Page

G10balDeFs.mc

3-Nov-70 19:15:53

rv[bbMi"usItemWidth,
66]
f'v[bbJterrMid th,
66]
rv[bbItcmsRclllainillgMi"lIs7.,()1] ·pail'ed with
rv[bb I tClIlsRclllil i II i ngMinlls 1,67]
rv[bbItemsHemcl"inillg,
6n

bhItI]IIl~litlth

which "Bed "ot bH pail'cd
rv[bbSrcStartOitLo,
12] ;
rV[bbSrcStartOi tIIi,
13 ];
rv[bbDesLStartOitLo,
14];
rv[bbDestSt.'lrtOi tlli,
20]; "coincident with ACO

~rcgi5ters

"v[bbMi I1l1sSDNonOvc rl ap,
rv[bbSDNoI10vcrlap,
rv[bbMlnusOitsRcmaining,
rv[bbMillusNlIlllOi tsTI'un,
rv[bbFUllc t ·iOIl,

24] ;
24J;

~coillcident

with CAnIlY

51] ;
53 J;
11];

HV[xCNT,G2];
RV(DevIlidex.62];
·Constants
MC[I"tPendingB it. 10J;
MC[xfAV, 1000];
MC[xfSDOffset, 100];
MC[xfGFT, 1400];
MC[Nol'llla1, OJ; '" Things ·in MemStat
MCLl'reeFralllo, 10];
MC[EarlyXfer. 4];
MC r£Ill Fix up, 31;
MC[BltLFlxup, 2];
MC[XfcrFixup, 1];
*FI'ame fOrlililts
MC[xfPcOFfsot, l];
MC[xfRctLillkOFrset, ;:>'j"
MCrLllr;allol'oOft'set, 11;"
MC(xt'GriOffset, OJ;
MC(GlooalZcroOffset, 3];

n L
L
L
n G
$

in G

"StateVccto" format
MC[StkPOffset, 10];
MC[DestOffsot, 111;
MC[SollrceOffset, 12];
'50 indicies
MC[sStackError, 2];
MC[~WakelipErrur, 3J;
MC[sXforTrap, 4];
MC[sUnin~leme"ted,5];

MC[sAllocListEmpty, 6];
MC[sCont,'olFault, 7];
MC[sCsegSwappedOut, 10];
MC[sPagcFault, 11];
MC[sWriteProtcct, 12];
MC[sLlnboul1d, 13];
MC[sZeroDivisor, 14];
MC[sDiv ideCheck, 15];
MC[sHardwareError, 16];
MC[sP,'ocessfrap, 17];
MC[sBoundsFault, 20];
MC[sPoil1tcrFaul t, 21];
MC[FirstProcess, 75];
MC[LastProcess, 76];
MC[FirstStateVoctor, 77];
MC[CurrentPSB, 21];
MC[ReadyQ, 22];
MC[CurrentState, 23];
MC[ReadyQhi, 1];
MC[IntStopPC,25];
MC[StopStopPC,26];
MC[MEStopPC,27];
MC[MXDStopPC,30];
MC[MREStopPC,31];
MC[MXWStopPC,32];
MC[NOTIFYStopPC,33];
MC[BCASTStopPC.34];
MC[REQUEUEStopPC,35];

*Nova o"try point constants

• RS232 SIO address constants
Set[RS232SIOLoc, add[LShift[EEPage,10], 370]];
%

•••••••••• move the followings to DOLan9.mc
~If mode not deFined, make it Pilot
IDF@[AltoMode, ,SET[AltoMode, 0]];
·This statement defines comments *0 is Alto u"d •• is Pilot
IFE@[AltoMode,O,COMCHAR@[fl],COMCHAn@(=]];
·Print Message telling Mode
IFE@(AltoMode,O,ER@[Pllot.3.0,Microcode],ER@[Alto/Mesa.G.O.DO.Microcode]];
·Mac ros

Paga

4

GlobalDefs.mc

M@[OPCODE, AT[2001,LSHIFTINl,2]]];
·Cyclor-masker functions
M~rFIXVA, "5@[3] FZ@[341] HI];
M@rF() 1"1111, l.DF I: II 1,17 ,1:1 1;
M@[Form2, BS@[J] FZ@[342] 111];
M0[For~J,I.Dr(1I1,16,2]J;

MW[Form4, US@[3] FZ@(J4J] HI];
MO[FormNinus4, BS@[3j FZ@[361] H1];
%

End;

3-Nov-79 19:16:63

Page

5

Initialize.me

3-Nov-79 19:15:63

BUILTIN[insert,24];
insel't[dOl ~0]; "advance to next device
devRET; return; "return to DI3
*I.ook up each slot table entry 'In tho device table
014;
xCNT ~ 40c;
sUp <- xCNT;
xCNT ~ 17c;
assigned ~ Oc; " Bit mask of asignod tasks
DI4x:
DevIndex ~ Oc; "base of dovice table in control store
DItly;
T ~ Dovlndex, call[GotCon]; "get a device ID From the device table
1u ~ (stack) xor (T); ·compore w'ith the slot toblo entr'y
goto[DevFound, alu=O], lu ~ T;
DItlu:
goto[014y, ALUIIO], DevIndex .' (DevIndex) + (2c); 'check for end of tablo (zero entry)
stock ~ 17c; 'end of tablo reached without match - set slot's t.ask to 17 (unused)
DItlz;
xCNT ~ (xCNT)-I;
*check for all slots pl'ocessed
stack&-l, dblgoto[DI4x, 015, ALU>=O]; *set to next slot
DevFoLJlld;
nop; *u'llocation constl'aint
T ~ (DevIndex)+l, call[GetCon];
initpc ~ T;
T (- LOf[illitPC,ltl,4]; * Task lJumber' about tei get
contemp (- T;
contemp ~ LSIl[contemp,4];

aS5i~)ned

3-Nov-79 19:15:53

Initialize.me

Page

Cyc1uControl ~ contemp;
T ~ WFA[A110nes];
LU ~ (assigned) AND (T);
SKIP[ALU~O];

GOTO[DI4u], LU ~ Ie;
• Keep looking, task already assigned
ass"igned'" (assigned) OR (T);
T ,- inHpc;
·U*~***·· Start of Alto Codo •• $ • • • • • *.* ••••••••••••••••••••••• * ••••••••
stack'" T, goto[D14z1; *I'cplace slot table entr'y with devico tab-Ie entry
*H·~·****

End of Alto Code

*=$~*~$*~

Start of Pilot Code

**~*~*.~*~*.****.$*.****~**.****.*~~~**~*~*
**~**.~*$*.~$.~~**.**.*.~~~.*.~$***~.*~**.~

stack'" T;·replace slot tub"le ontry with dovico tab"le entl'Y
r'burl ... T; • dev"ice tablo entr'y conta"ins task assignment
T ,- StkP;
rbufO (- T; • save the device pointel'
rbufl'" (rbuFI) AND (17C); • get the task assignment
T (- (LSH(rburl, 4]);
.. bur 1 ,- T;
StkP ,- ('bufl;
T ... (l'buFl) + (171400C);
rbufO'" (rbufO) XDR (377e);
Stack'" T;
StkP ... rbufO, Goto[DI4z]:
*;;:111>11""*:11:11011
Elld of Pi 10t Code **'jI:II:III11****1I**I/I*****"'1'IIiI:fIlfIllIl\!ljI:t!Jfjlk:k*1\I1lI*'lc,Ja*Jj(1"1"1iI1!
'Clock out new controller ID's
DIG:
xCNT ... 57c;
s"tkp ,- xCNT, call [C10ckOutPatternJ:
·Ca"11 a"ll tllc Init routines
xCNT ,- 17c, cal1(DI6]; *do call to
xCNT (- (xCNT)-I, goto[DI7, 11<0];
lu ~ ldrr(stack),4,141; ·check For
goto[,+3, ALU:O], T ... Stack&-l;
Dcv]ndex ,- T; ·set up to call Init
APC&APCTusk ... Devlndex; "call Init
l'01.U rn;

set up TrC for loop below

DI6:

017:

Inlt PC

=

0 (no initialization required)

rout"inc for device
routine FOI' controller - l'etUl'fts to DIG

LOildPage[InitPage];
ErrorCnt ,- (lOc), goto[BootEll1l1lators]; ·Set up retry count for disk boot

ClockOutPattern:
usoctask;
r (- APC&AI'CTASK;
1'1 inkO (- T;
xCNT (- llc; "flo thl'ough the slot table backwards
COrl:
Devlndex'~ 2c; 'DevIndox used for loop count
COP2:
T'" (stack) xor (IC): "'cOlnplemont bit
GENSRCLOCK;
"send"bit
stack'" rcy[stack,l]; "get next bit
Devlndox ... (Dov Ind,)x) - 1, [joto[COP2, 1'> ;0];
xCNT (- (xCNT)-l; *all slot table entries dono?
stack&-I, goto[COI'I, alu>~O]; "get next Vlord
APC&APCTASK ..... linkO, goto[devRET];
GetCon: contcmp ,- T; 'word index into Dtab
contomp' (contcmp) I" (AND@[lshift[DtabBase,ll, 17400]C);
contclllp ,- (contomp) 01' (AtJO@[lsllirt[lJtabOase,l], 377]C);
can temp (- r'sh[con'tomp,l]; "instruction address ill CS
T , (ldf(AllOnes,17,1]) and (T); ·low bit tells which half
APC&APCTask ... contemp;
flEADCS;
T ... CSDATA, roturn, AT[lslliFt[InitPage7.,10],100]; "locatiolllllust be even
OnPage[InitPage];
Ooot [mul a to r's :
lu (- OootType, goto[BootScGondBlock, R evon];
loadpage[InitPagel];
gotop[DiskBootDone];
t ... x1'Temp, 10adpage[O];
gotop [L1IJ loop];
"Read disk Sector 0 into page 0 (starting at location 1).
DiskBoot:
10adpago[0];
r... SturtDiskBoot, callp[PNIP]:
initrO ~ Oc; ·word 520 - II0t used by disk
in itr! ... Oc; ·word 521 - IOCB pointel'
in"itr2 ... Oc; ·word 522 - disk status
initr3 ... Oc; "word 523 = -1 to force a seek
t~(R400)or(120c);

pstore4[Nova,initrO],CALL[initRET]; 'c10ar KBLK at 521-523 (520 is also cleared)
"Set liP the IOCB at 1000b
mlA<--lOOOC ; "set up base I'og i ste rFo I' DeB
PSTORE2[DMA,initrO,O],CALL[initRET]; 'clear pointer to next DCB at 1000b, statlls at 1001b
xCNT .. 44000C; *disk command goes at location 1002 (read, I'ead,
PSTORE1[DMA,xCNT,2], CALL[initRET];
xCNT ... 2000C: *lIeader goes at 2000 (unlike ALTO)
PSTOflEl[DMA,xCNT,3], CALL[initRET]:
xCNT ... 400C: "label goes at 402 (like ALTO)
xCNT ... (xCNT) + (2e);
PSTOREl(DMA,xCNT,4], CALL[initRETJ:
xCNT ... Ie;
PSTOHE1(D~lA,xCNT,5],

CALL[initI1ET]: *data goes at 1

read)

Initia1izo,me

3-Nov-79 19:15;53

·Sinco we will initialize the interrupt SystBM lutor, we do not nacd to worry about 1006 or 1001
"Location 1008 is unused
xCNT .- lC;
PSTOREl[OMA,xCNT,11], CALL[initRET]; ·Oisk addross 0, with RESTORE bit at 1009
T ... 2000C;
T .- (z e 1'0) + (T) 1-1;
PSTOHE1[Hova,xCtH], call[1nitRET]; *smash header' at ~OOlb
'Start tho disk
initrl ... 1000c; *word 521 - lOCO pointer
initr'3'" (7eI'0)-1; "word 523 " -1 to fOf'ce a seek
T ... (R400) + (120C); 'storo block above in 520-523 (wof'ds 0 and 2 aI's zero)
PSTORE4[Nova, ill it rO], call [initRET];
·Wait for tho disk to storo good status in the DCO, retry if status is bad
EITorCountX ,- 20c;
D\~Set:
Oovlndex'" (zel'o)-I; ·loop cOl/nt for status wait
DiskWait:
Pfetch1[DMA,xCNT,11; ·fetch status word at 1001b
r ... 17C, cal1[in1tHET];
1u ... (ldf[xCNT,4,4]) xor (T);
!J()to[StatusSloI'Hd,ALU~O], lu ... ldf[xCNT,10,lO];
Dovlndox <- (DevInuex)-I;
goto[DiskWait,ALUNO];
[rrorCountx ,- ([l'rorCountx) --I;
goto[DWSet,ALU>=O];
~JoStatus

:
T ,- NoDiskStatus, goto[InitFailJ; "timed out wa-iting for disk to stOI'C status

StatusStored:

dblgoto[GoodStatus, Incf rCnt,

ALU~O],

FREUEHESULT;

GoodStatus:

T'- (2000C) ; *check header at 2001
r (- (zero) + (T) + 1;
I' FETClll [Nova, xC NT] ,CALL[i nit RET];
LU'-xCNT;
[ncE rCnt:
skip[AI.UIIO], Erl'orCnt <- (EJ'rol'Cnt)~I;
go tor 1.0 adO t he rCS] ;
goto[UootFail,AI.U < 0]; ·bad header', try again
goto[DiskOoot];
llootFail:
r ,- nadOoot, goto[InitFail}; "read 10 times, but headcI' was wrong

'SUBROUTHIE PilIP puts the number in T into the ma-intenanco pancl
°It will be used after initialization is complete
*Does not task unless called FI'om task 0
ONPAGE[O];
ptnp:

lIsectask, niHIl' ,- T, al[PNIPOase,20];
r ~ APC&APCTask, at[PNIPOase,17];
RCNT ~ T, CiearMPancl, call[_+l], at[PNIPOase,O];
PNloop: RTEt~Pl ~ 1\C, at[I'NIPOase,l];
IHEM!'1 (- (RHt~Pl) 1, dblgoto[_'I",Al.lJ
LoadTimer[RTMP];
"Notify task 16, address 7030 to set up timer task
H1MP ~ (lG7000C);
RTMP <- (HTMP) OR (30C), goto[KNotify]:
Ca1l[TimerlnitDo~e],

111[7030]; *Set TPC[16] to TimorTask

"The simple timer task assumes slot 17 expired. since all others were cleared.
Time rTas k:
Refresh[REFR];
1u (- Tilllor;
·read timel' to clear the wakeup
REFR <- (RErR) + (20c):
R1MP <- (SOODOC);
*build timer constant
RTMP <- (RTMP) OR (277C):
*simp1e timer,vallie ltd.slot 17b
AddToTimor[RTMP];
CheckStop:
T <- Pl'inter';
rtTMP (- T:
LU (- (RTMP) AND (lOOOOe)
GOTO[MidasStop,ALUnO] ;
Time rRet;
HETURN:
MidasStop:
LU ~ T, goto[MidasStop],SotFault, AT[7003]; "Midas recognizes a mouse halt as
"a task 16 breakpoint that was not set by the user.
It cont-iuues from (absolute) MidasStop+l
MidasRestart;
return, AT[7004];

Ko rnol ,me

$I'oturn to task 17. address 7400
TimerlnitDolle:
RIHP ~ (177400C). goto[KNotify];

3-rJov-79 H)':15:53

Pago

Kernel.me

J-Nov-79 19:15:53

-Page Zero stuff
·We put theillstruct ion for Buffflrl1efi"ll hero ..
xJ71x:
gotop[xJ77x], al[377];
"dumlllY illstl'll!:tioll
loadpafJe[Ol, gotorx377x], at[O]; -Emulator buffur refill codo is on paga 0
T <- APCTASK&APC, AT[1]; "Fault entr'y . .Save /\PC first, then till;) other volatile regs.
RXAPC ~ T, Ar[IOO];
T .. GETIlSPfq ltll], AT[llH];
·ctar.k, ncia
RXCTASK .. T, AT[102];
T t· (GETRSPEC[103]) xor (377c) , AT[103J;
~sstkp, stkp (sUp is read complemented)
RXSTK <- T, IIT[104];
HTMP .. 20c, M[105]; *Set stkp to 20 in caSH there was (\ stuck overflow pending
Stkp ,. RIMP, Al[106];
T .. (CETRSPEC[1071) xl10r (Dc), AT[107]; *alufesult, saluf (hoth read complelllBnted)
RXALU <- T. AT[tlO];
T ,. GETRSP[C[157], LOADPAGE[O], AT[l1t]; ·page, pnl'ity, bootreason
RXPPO .. T, RF.SETEI1RORS, AT[112];
*Notify Task 17, address 7505 (breakpoint communication)
RTM!> .. (177400C), AT[tl3];
RTM!> < (RTMP) OR (IOuC), AT[ 114];
APC&APCTASK .. RIMP, AT[116];
RETURN, AT[116];
'The go overlay will send control to UserFault (120) iF PARITY fl 0 and FFAULT"O];
REFR ... (REFR) + (20C);
T t· Printer; "Got PI"inter data
RTMP ... T'
T ... PI"inter; *Insist that the printer yield tho some data throe t"irnes.
I.U'" (RTMP)-(T);
r.· Printer, Goto[.+2,ALU=O];
Goto[RH];
LU <- (RTMP)-(T);
Goto[.+2,IILU=0];
Goto[RH];
T ~ LDF[RTMfl,O,2]; *Get strobe/aek bits
LU ... (LDF[HWSTAT,lG,2]) xor (T);
·Compaf'o to desired lJ"its
T ... RTMP, GOTO[RH,IILuno];
*if rea<.:hed, clear all bits
IHMP ... 400C;
Printer ~ RTMP, RTMP <- r;
'restore RTNP
DisPiltch[RWSTAT,lJ,Z'I;
"dispat<.:h 011 sLate bits of rwstat
LU (- (HWS"fIlT) MJD (4C), DISP[H'JildStroboOFf);
"setup by to/word
Selltl:
Re<.:v;
R\1:

l1eadStroueOff:
USECTASK, GOTO[ReadMore, ALUnO], AT[RWDisp,O];
"Got A~othsr by to if word set
r , I1DATA, IlETURtJ;
ReadMore:
HWSTAT ~ Recv8yte, GOTO[RW];
°Go got a~othor by to
ReadStroueO~;

I1PIlT;

r ... I1HMask[RH1P], AT[I1WDisp,l]; "Get Data Byte
nOMA ,- (LSII[nOATA,10l) Oil (f); *Mol'go Byte
"State'-O, Look
RWSTAT'" (RWSTAT) liND (4C);
I1fMP ... (100400C);
'Set RdAck
Pri~tBr ... nTHP, GOTO[HW];

fOI'

IlDStro off,

*llel'e on Write Ack On - state'" 3
RWSTIIT'" (HWSTAT) XOR (lIC), GOTO[RW], AT[RWDisp,Z];
*lIsl'o on Write Ack Ofr
IlOATA <- I.SII[IlDATII.I0], goto[SonuMol'e, ALUflO], AT[RWOisp,3];
lu ,. loro, !Joto[RoadSLrobeOfF]; ·Il1U5t. do no~ .. tasking rotul'fl
SendMore:
RWSTAT ,. Se~d[lyte, goto[Send];

END;

rotain llyto/word

3-Nov-79 19:15:53

Key.mc

in so rt[ dOl ~Ol;
uiTMSG<' (uiTMSG) OR (170C); *negiltive number, extend sign
Ill" (lIiMI'STATUS) AND (40C); *klllllgy test fOI' x or y
t<· 1 sh[uiTMSG, 11], sk ip[IILU"O];
t,· lIilMSG; "this is Y
lIiMOUSEDEL.XY'- (lIiMOlJSI:OEL.XY)+t;
IliMOlJSEDELXY~ (uiMOLJSEDELXYj AND NOT (400C), goto[keyNoTaskFieldDonc];

koyllS:

t<- I'sh[uiTMSG, 7];
uirJUnONS'" t;
lll'- lIiTMSG, use C Task, dblgoto[keyFieldDone, keyldle,

keyStroke: lIiXMSG<- (lsh[uiXMSG, 10]) or t;
keyIdle: uiMPSfATUS0 OC;
keyNoTaskFieldDone: USB CTask;
keyFieldDone: lIiTMSG<- Oc, return;

1'<0];

Ll't( 20C) ,GOTOr 1I i BUFD2 , fl>~O J;
£UFE rCII16[uillJ\SE ,lIiDIlADDH] ,GOTO[uiUUFD2X, ALU>=O];
uWWA'-T'-(uiDWA) I-(ZOC), HETUHN;
uiIJUFD2: lIiVSCOUWr ,- (lIiVSCOUtJT)-l,DIlLGOTO[lIiENDFHLO,lIiCONT.H(O]; 'check For field don\)
lIiIlU!U2X: lIiVSC()UNr • (lliVSCOUNT)-I,DIlLGOTO[uiUlf)flELD,lIiCONT,H(O];
i CONT: II I SLC<-( lIi SLC)- 1, DllLG010[uiDCOI)ONl. ,lI i~1DCn2 ,H( 0];

II

*Cal cuI ate the next
1 ine' S 1I itJllUrPTR
* in tho shadow of the 1 as t 10F[lC1I16
lIiMDCB2: uiNIlUfPTfl .- 311C;
f·-LDF[lIiDIlA,14.1I];
lIiNflUrPIR • (lIHJBUFPTR)-(T);
r.-IUIMIISK[ 1I i NWRDSJ;
lIiNOUrPTH (- (lIiNBUFPTR)-(T);
OU1PUI[lIiIlUFPIR,uiBPREG], goto[xpreVSO];

* file DC [l i s fill ish e d .
uiDCBDON[:
lu' lIH1PsrATUS, call[keyCheck];
T'-( Ili I INK);
lIiBASEl <- OC. GOrO[lIiGetNextDCO,J\LUhOJ;
"fhe DCB r.ha in is exhausted.
OUTPUT[uiBUrPffl.uiBPflEG]; "Send read BLJFI'Tfl to the hardware
T f- 2C. can[uiCheckCursor]; "'does TIISK ratu('(\
goto[uiVSl];
uiGetNextDCIl:
lIiBASE • T; *T contains LINK. Set base reglstel' to point to next DCIl
OUTPUT[uiBUFPTH,uifWfllG]; 'Send I'ead nUFPTfl to the hardware
uiNBUFl'Tfl <- 377C; "Tnit for later'
nop;*two instr aFter output
PFETCII2[uillJ\SE,uiDOJ\.2]; "'Fetch DIlA,SLC
lIillUrJlTH (. 317C; 'Lnit for' later
'Check for long pointer addressing
PfETCH2[uiOJ\SE,uiLINK,O]; "Fetch Link,NWRD~
LU~uiSLC,goto[uiLong,fl=O];
uiCX ~ (uiCX)~(1000C);
LU" LDr[lIiCX,3.1J;
GOTO[uiSENDCX,ALU=O];
uiCX "GC;
'finished disp'lay'ing the cursor
ulCY (- 10000C;
uiSENDCX:
OUTPUT[oiCX,uiCXREG];
Olltputw=O];
"must update RTC
uifEMP1<-400C;

'Si\\fe

T<-(uiTEMP1)~(30C);

PFETClll[ui!1ASE ,uiTEl4P1];
uiTEMPl ,- (uiTEMPI) .' 1;
PSTORE1[lIiOASE,uiT[MP1]:
'cause vertical Field interrupt
lIiNORTCOV:
STKP <- ui fEM!';
10adpage[O];
r (- lIiNWflOS, callp[Do[l/tJ;
lIiNOTMR:

call [uiWAKEOFF.I;

"interrupt mask fetched frol/1 421 above

*fleturns to u iVS5

3-Nov-79 19:15:53

LFtask,mc

Page

*Post tho keyboard
uiVS5:

lu ~ LHMASK[uiXMSGJ, call[uiKPOST];
lu t- I IIt.1ASK[uiXMSGj , cal1[uiKPOST];
I~~ uiMPSTATUS, call[keyChock];
uiUASE ~ ZERO, GOTO[pruVSG]:

°do "it again

for othel' byte

ui KPOST:
lIifH1P (, KoyTabloll,goto[,+2,alllIl0]; ·if no oilt.a, I'olur'n ['ight away
u'iX~ISG ,- lsh[lIiXtlSG,10],roturn: ·shift to othel' keyboard char
lIiTENP ~ (lIiTEMP) or (KoyTahloL);
t '-ldr[lIiXMSG,l,5]; 'Get word number (4 bytes pOI' word)
lIiHMP " (lIiHMP) + (T); "Form final address
t (- 'ldf[uiXMSG,6,lJ; "set 112 to high/low wor'd
APC&AP(TASK (- niTE/,IP; *Addr'ess to road in Control Store
HEADCS; "get lhe wOI'd
t • CSDIITA, AT[uiUHPflASEADDR,300]; 'lIlust 110 at an even locatioll fOI' READCS
uiDflA .- t;
III <- IDI·[wiXMSG,7,1.]; "'low 01' high byte
gotor, '2,aluIl0], uWASE <- 177000C;
uiDOA .. HSII[lI'iDLlA, 10]; ·Nuud upper byte
lIHlASE <- (uil1ASE)+(34C); -lIillASE ... 177034C
T(-(LDr[uiDBA,H;,Jl); "Got word nUlnbor
PfETCIIl[lIirlASF,lIiNW[mS]; "lIiNWHDS is a temp
futch ,1llto kbd word
uiDIlA <- LOr[u'iDLlA,11,4]; "Get bit l1umber
lIiBASE (- (uinA:'E)I(T); "fix base register' for store
uirEMP (. T~' 100000C; 'Do the fUllction uiTOIP (, 100000 rsh'ift uiOBA
uiDBi\
lIiHMP

~,

(,

HSII[uiDnA,l], goto[,+?,REVEN1; ., test bit 15
T <- RSII[u HEMP ,1]; "shifL 1

uinllA (, HSII[uiDOA,11, !Jolor, ~7.,R[VENJ;
uiTEMP (. r (. HSII[lIiTEMP,2j; "s hi ft 7.

ui KDD:

uiD[JA
lIiHMP

(,

uiO£lA
u i rEMP

(.

...

"tost bit. 14

..

HSH[uiDIlA,l], goto[,+2,REVEN]; "test bit 13
T
HSII[uiTEMP,4]; "shift 4
HSfI[uiDOA,11, goto[,+2,REVENJ;
HSII[uiHMP ,10]; 'shift 8

,. r ,-

"tes t bit 12

"test fOl' key down (0) or' up (1)
ui X~iSG ,- 1sh[ui XMSG, 10], DBLGOTO[lIi KDOWN ,uiKUP, 1'>"0];

uiKOOWN: uiNWHDS .. (uiNvIHDS) AND NOT (T), GOTO[uiKSTOHE]: "key dowll,
lIiKUP: uiNWHDS " (uiNWHDS) OR (T); "key up, set bit
uiKSTORE: goto[lIiCURRET],PSTORE1[uiI1ASE,lIHJWRDS,O]; "store wOI'd
preVSG:

uHlUIPTIl

<-

;377C, call[uiWi\KEOrr];

"r'eturns to lI'iVS6'

clear bit

LFtask.mc

3-Nov-79 19:15:53

Page

·Set up the cursor.
"Get cursol' coordin,ltes 'fl'OOl 42Gb (X). and 427b (Y).
uiVS6: T ... (uiIlUrpTr!)~(?/C); *uiflUffJTn = 377 on entry.
PFEfCIl2i:u iBASE ,lIiCX]; -Cursor X. Y coordinates
lll<- uiMPSTATUS, cal1(keyCheck];
uiCY <- (uiCY)~l;
"The cur~or X coullter is 10Clded by HSF fl';.HI1 CXREG.
It is
'clocked by [(EdgeClock and SolCul'sM) or (NClk and (HSF 01' VS'»].
"The cur:;or hardware COLIllts the X offset from end of horizontal synch.
"IIlUst fudge FOI' illterval between horizontal synch alld blank.
lIiCX'· (uiCX)+(40C);

\ole

'The cursor buffer is divided into 8 segillents with G nibbles in a segillont.
*Tho tLil'SOI' Hse-If is 16 bits (4 nibbles) wide but a segment Inll~t have 5
"nibbles to allow for a cursor lIot aligned on a nibl>le boundary.
The sixth
'n'illll-le must be all zero.
The harwal'e ors this nibble wHh all displityed
'nibbles fol"lowing tile cursor.
Loadillg CX[lr.G witll a f) disable~ the cursor
"by oring this zero nibble From the cursor with tl-is[llay data al·1 across the
"1 inc.
"Wilen the cursor is visible, -X is loaded int.o tho CXflEG 'in the
·scan lille preceding the Clll'SOI', ilnd this value is loaded into
"the cursol' counter by liS.
vJhen VS=O, tho cursor CQuntel' is
'incremented by NClk, alld when it becomes D, the next (j rdblJles an]
"sellt to tho display.
"lIel'e, ViC wallt the cursor' coulltel' to addross the cursor buffor so
"that we can load it one ~eglllellt at. time.
rlw c"rsor' segrlw'lt is CXREG[ll:6].
'We start with se!jment 1, CXI1[G<- 1000C, :Itld durillg each of the
'next 8 scan 1 inc times we will selld (j bytes of cursor data followed
"hV a sixth nibb-Ie of Ulr'o to the buffer, thell increment the se!llilont vaiuein
"uiCXREG.
°uiVSCOUNT is usod to hold the value to be loaded into uiCXI1EG.
uiVSCOUNT ,- 1000C; "Start load ilt Rogment. 1.
"The even scan lines of the cursol' will IJt) displayed H CY is oven
"and the r ie-Id is cvnn, OJ" if CYis odd and the fie Idis odd.
'Otherwise, the odd scan 'I ines w·i 11 be displayed.
uiI3LJFPTR'" (uiI3UFP'rn).(32C); *uiBUFPTR <- 431b
r... LOF[uiCRWOnD,17,lj; "adjust offset Rccording to evon/odd field
1<- (Ull[uiCY,17,1]) XOR (T);
1<- (llil1UrpTn)~T;
*starts itt either 4Jlb 01' 4321J
uiDBA ~ T, goto[uIMORrCSETUP];

8

3-Nov-79 19:16:53

LFtask.mc

Page

*LoaLi one ~egment of' the CUI'SOI' memory (Ii nibbles plus one zero nibb-Io).
"The address was set up durillg tho prcviolJs scan lillO,
uiMORECSETUP: OUTPUT[uiVSCOUNT, uiCXREG]. call[ulWAKEOFF1;
T'-- uiDBA;
*Pointer' to cursor senmcnt
PfETCII1[uiHASf.. uiTEMP]; "Fetch scgment
llJ~ uiMPSTATUS. call[keyCheck];
uiDflA+' (uiDIM)+(2C); *Increment poillt.er (by? duo to -interlace)
IHSPATCII[uiCX. 16,2]; 'Determine amount to shift word,
DISP[.+1J. uiTf.MP1~ 17C;
r.- OC. GOTO[uiSIICDONE].
AT[uiSIICUR.O];
T<- LSII[lIiTEMP, 3J,
AT[ulSIlCUn.l];
uiTFMP'- nSII/,lIiTEMP, 1]. GOTO[uiSHCDONE];
T'-LSII[uiTEMP, 2].
AT[uiSIICUR.2];
lIi-1EMP<- RSH[uiTEMP, 21. GOTO[lIiSIlCDONE];
AT[uiSHClJR,3];
T~ I.SII[lIiTEMP. 1],
uiTEMP'- RSH[uiTEMP, 31. GOTO[uiSIlCDONE];
uiSIlCDOIJE: uiTEMPl<- (lIiTEMPl) AND (T);
u iCNT" 2C;
u-iSENDCLOOP: T'- LDF[uiTEMP. 0,4];
'Loop fOl' First 4 bytes
uiNWRDS<-- T; *uiNWRDS is a temporary, not used durinn VS,
OlJTPUT[uiNWRDS, uiCURSM];
uiOH'- (uiCNT)-l, skip[RlicroD 8.7 (OS 16) at' JUlie 8, 1979
• Last edited by Chullg, September 12, 1919 10:52 AM
edited by Cililng, JlIly 6, 1979 6:12 PM
• od i ted by Johnssoll, ,JUIlIJ 18, L9H) Ii: 24 PM
fNSERT[OccupiedDefs];
TITLE[Mesal0ccupied];
" L.ocations I'eserved on page 0
IMHESEHVE[O,
HIRESERVE[O,
IMRESERVE[O,
!MRESERVE[O,
TMIlESERVEr:O,
IMRESEflVF.[O,
IMHESERVErO,
INHESERVE[O,
IMIlESEHVE[O,

0, 2];
100, 56];
156, 10];
166, 5];
173, 4];
177, 74J;
:~OO, 32J;
335, 23];
361, 17J;

• buFfer trap anti fault

* PNIP
~

PNIP

• ll1J

• Locations reserved on page 1
IMI1ESEHVE[l. 100,
JMHESERVE[l, 273,

142J; • overlayed I inkune ·Ior.ation
IJ;
" oVeI'layed linkane locatioll

• location~ reserved on page 2
[I>IIlESEHVE[2,
TMHlSrnVE[2.
IMHfSLHVF[Z.
IMRESEflVE[2.
IMI1ESEHV[(2,
IMHESERVE(2,

*

0, 100J;
100, 1721;
310, GO];
372, 1];
3/4, IJ;
376, 1];

•
'.
•
•
•
•

Reserved for HS232
ovel'lavable init code
He5erv~d for HS232
overlayable init code
overlayable init code
ovorlayoble init code

Locations rescr'vnd on page 3
TMRESERVE[J, 0, 367];
HHlES[RVE[J, 370, 10];

• Locations reserved on page
IMRESERVE[7, 27, IJ;
IMHESERVE[7, 76, 1];

• oV()I'layed 1 inkage location
.. overlayed linkage location

• Locations r'eservf1d all page lOB
IMRESERVE[lO. 0, 363];
.. I.ocations l'tJservcd on page 12B
IMIlESERVE[ 12" 0, 361];
•

I~catiolls

reserved on page 14B

IMRfSERVE[l4, 0, 137];
• Locations reserved on page 158
IMRESEHVE[15, 300,

IJ;

• overlayed linkagp, location

• locations reserved on page 16B
IMHESERVE[16. 0, 370];
• Loc at ion S

I'D se

IMHESERVE[17, 0, 140J;
IMHESEIIVE[11, 0, 40];
END;

• initialization

rvcd on page 17B
.. kernel
.. Key Trallslation Table

Pago

Mesa2occupiod.mc

3-Nov-79 19:15:63

• MicroD 8.6 (OS 16) of April 27, 1979
at 18-Jun-79 1G:08:59
• Last edited by Chang, July 16, 1979 3:16 fM
* edited by Johnsson,· Juno 18. 1979 4:27 PM
INSERT[OccupiedDefs];
fITLE[Mesa20ccupied];
• Locations reserved on pago
IMRESERVE[O,
IMRESERVE[O,
[MHESEHVE[O,
HlRESERVE[O,
H1I1ESERVE[O.

21·

0,

156, 10];
173, 4];
300, 32];

• Locations reserved on page 2
rMRESERVE[2,

100, 63];

" Locat iOlls reserved on page 4
fMRESERVE[4.

0, 340];

[I~RESEflVE[

3~

4,

1, 11;

345, 1];
351, 1];
355. 1];
361, 1];
l~tH[SEIlV[[4, 365. 1];
fMIlESERVE[4, 371. 1];
IMRESERVE[4. 375, 1"1;
IMRESEIlVE[4, 377. 1];
IMRESEIlVE[4,
IMHESEHVE[4.
IMIlESEIlVE[4,
mRESEIlVE[4,

• Locations reserved on page 5
JMIlESERVE[5, 0, 400];

• Locations reserved on page 6
IMRfSERVf[G.
H1HESEIlVE[G,
HHlESEHVE[G.
[MRESFHVE[G.
IIHlESERVE[G.

0, 362];
365. 1];
371, 1];
375. 1];
377. l];

• Locations reserved on pago 7
IMRESERVE[7, 0, 400];

• Locations roservod on page 110
IMRESERVE[II, 0, 36G];

• Locations roserved on page 138
IMIlESEIlVE[13.

"

Locatio~s

O. 400];

reserved on page 140

IMRESERVE[14. 137. 24t];

• L.ocatiolls reserved on pago 150
lMflESERVE[15, 0, 374];
IMRES[RV[[15. 377, 1];

" Locatiolls reserved on page IGI3
IMRESERVE[16. O. 35/];

• Locations reserved on page 178
IMRESEnVE[17. O.
EUD;

.. buFfe r t rap and faul t

2, 12j;

140];

• PNIP
" PNIP
* LRJ

3-Nov-/9 19:15:53

MusaJ.mc

inse r't[ dlrt ang];

NOMIDASINIT;LANGVERSION;MULTDIO;
inst: n[c; I o!JnlOefs:l;
III U:[mj];

MESA JUMP AND ARITHMETIC INSTRUCTIONS

* lust lIlodificu by Johllsson, .Juno 11, I97!) 11:27 At.!
• last !nodif'ied by Sandmiln, t4ay 9, 1979 ;;>:2<1 PM
• last lIlodiFied by Sandman, March 13, 19/9 G:30 PM
%
This codo nsslI!nes that PCB"PClJh is it base register pa'ir pO'int ing
to the current instruction qundword.
Tho low two blts of PCB ill'O 0,
ilnd tllo low 3 bits of Lho PC (which point to a byte witldn t.he quadword)
are kopt in the (llarelwaf'e) registol' pcr.

Since codo segments cannot cross G4K LJolindal'-ies, anti are l'imited to
32K words ill len~lth, tile two bytes of PCBh are forced to be equal,
rnther than having the lenst significant byte differ from the msb
by 1 as is the normal case for base reg-istel's.

PCF is incI'Clllontcd by Lhe funct.ions NextIlist alld NextData.

It -is
assumed that the registel' PCX is loaded ilutomatically fl'OIll peF at
the start of every bytecode.

Dilly the low 3 bits of PCI' al'eloatled by PCF<--, but pcr and PCX
contain 4 bits so that overflow will be handled properly.
%

MesaRef'illG: gotop[Mesallefill], Pfetch4[PCB,IBUF,"O];
.~**~~*** Efld of Pilot Code ****~********.*********~~**************~*****

*=***.11**.~

JWx:

*fl*******

JWx:

JWp:

T-3

**********************~~**************~.***~

T <- (PCFnEG) + (T);
AllOnos ~ T ~ (A110IIBS)+(T), dblgoto[JWp,JWn,ALU>=O];

*u*******

JWn:

Start of Alto Codo

'-4~r+l

*T-l

Elld of Alto Code **********************************************

T '" 100000C; *negative displacemont - put in the bit that the shift is about to lose
T (- (rsh[A1l0nes,l]) or (T), goto[JBy];
T ~ (rsh[Al10n8s,l]), goto[Jl)y];

MesuJ.mc

'~av-79

19:16;63

"Jump Equal 11. 11"2 . . 9:
T
( s t ae kF,-l ) . call [JEGEVtestJ. °FC()ue[212] ;
JEQ2:
Loud T fo " bypas~ kllH.lgo
T l- T goto[,)nECom] ;

..

JEQ3:
JEQ4:
JEQ5:

..
T ..
T ..

(stack&"l) . call [JEQODtest], opcode[2LI];
(Form1[AllOncs]) j (T) • goto[JnOCom];

T

(staek&-l). call [JEQODtest] . opcodc[21~J;
( F rl:12 [A 11 0 II c S ] ) I- (T). gotu[JnOComJ;

T
T

T
JEQ6:
JEQ7:
JEQ8:
JEQ!J:

.

,

T
f

I-

T

II-

T
T

I-

T

°

...
,.
,.

T

T

(staek&-l). cal'l [JEQEVtcst]. opcode[214];
(Forml[J\IIOncs]) I- (T) • gotu[JnECom];

call [JEQEVtcst]. opcor.lc[2lG];
(Fo rOl2 [A 11 Ones]) + (T). [joto[JnFCom];

(stackt~-l).

(stack&-1) . call [JEQODtest]. opcodc[2Jll ;
(Form3[A110nes]) + (T) . goto[JnOC:om];
(stack&-l). ca 11 [JEQEVtosl]. opcude[2?°I;
(furOl3[AllOIlBS]) -I- (T) • goto[JIlECOIII];

I-

,- (stack&-l). call [J[QODtcst]. opcode[nt];

...

(l'orllll1[1\110ne5])

+ (T) •

gotu[JnOCom];

JEQ[Vtcst:
Iu <. (stack&-l) .. (T);
dblgotu[JEQjlllp.JnRET.alll"O]. T

(ldf[GETRSI'EC(l27].11.1]);

I-

JEQODtest:
lu ,. (s t il c k& -1) - ( T ) ;
dblgoto(JEQjmp,JnRET.alll=O], r ,. OC;
JEQjmp:
T

(ldf[GETRSPEC[127].1A.3])

I-

-I-

(T).

I'etuf'n;

'Jump Equal Byte
JEQn:
JEQnx:
Ejrnp:
EjlllpX:
Onojmp:
Onojmpx:
s t k di f:

T ~ (Stack&-l).call[stkdifl,lIsectask, opcOd~[222];
T ~ 2c. dblgoto[Ejmp.Onoj"~.ALU~O];

*

l

contains length ofinstllction (2)

T

~

(NcxtData[IUUF]) - T;

r

~

(PCFI1EG)

+ (l),

goto[Jnl'];

lu ... NoxtData[InUF];
lu

~

Ncxtlnst[IBUr],cQl1[JnREfx];

1 u <. (s t

it c k& "1)

-

(T).

I'e t IIl'n ;

Page

McsaJ.lllc

3-Noy"9 19:15:53

-Jump Not Equal n • n~2 .. 9:
JNE2:
T ... (stuck!l,-l). call [JNEEVtest], opcoJo[223];
1 ,- r. goto[JnEColII];
Load T 1'0 I' bypass kludgo

.

JNE3:

T
T

JNE4:

T
T

JNE5:

T
T

JNE6:

T
T

JNEl :

T
T

JNE8:

T
T

JNE9:

T
T

,-

(stack&-l). call [JNEODtcst]. opcodc[224];
~
(T) • goto[:JnllCom] ;

,- ( FOl'lnl[AllOncs])
•
.'... (stnck&-l)
(Forml[A1IOncs])
r.L\ 11

[JNEEVtcst]. opcodc[225]:
+ (T) • goto[JnECom];

... (stack&-l). call [JNEOlltost] , opcodo[?ZI:lJ;

...
...

(Form2[Al'lOllos:J) + (T) • goto(JnOCom];

(stack~<"l)

. call [JNEEVtost], opcode[227];
+ (T) , goto[JnECom];

.' (Fo 1'012 [A 11 Ones])

(stack&-l). Cil 11 [JNEODtes t], opcode[230];
(Form3[AI1Ones]) + (T) • gOtO[JIlOCOIll);

<-

...

... (stack&-l), call [JNEEVtest], opcode[231];
(Form3[AllOlles])

t,

+ (T) ,

goto[.JnECom] ;

... (stack&-l) , call [JNEODtes t]. opc~def232J;

...

(Form~[AllOnos])

~

(T) • goto[JIlOCom];

JNEEVtest:

Iu ... (stack&-l) - (T);
dblgoto[JNEjmp,JNEnojlllp,aluUD], T ... (ldf[GEfnSPEC[127].lJ,l]);

JNEODtest:
lu <- (stack&-l) - (T);
dblgoto[JNEjmp,JNEllojlll[),aluIlO], T

t,

DC;

JNEjlllp:
T.o (ldf[GETnSrEC(121],1~,3]) + (T),

return;

JNEnojlllp:
lu ... NextInst[IBUF]. call[JnRETx]; .
'Jwnp Not Equal Byte
JNEB:
T'" (Stack&-l),call[stkdif]. usectask. opcode[233];
JNEOx: T ~ 2c, dblgoto[Ojmp,Enojmp,ALUUO];
Ojmp:
fnojlllp:

• T contains length of instuctioll (2)

T
lu

(NcxtData[IBUFJ) - T. call[Ejlllpx];

to

<-

NaxtData[IBUF],call[Onojmpx];

5

3-Nov-79 19:15:63

t,lllsaJ ,me

"Jump less Byte - jump if (IDS-I) < IDS
JlD:
1 ~ (Stack&-1),ca11[stkdiF],lIscctask, opcodn[234]:
JLDx:
r., (RZero )+1, dll1goto[JLDpos ,JLOneg ,AlU)-'O], Ff1F.EZEflE:SUl.T;
JLDpos: T .' (RZlll'O) I, (T) + 1, dblgoto[Onojmp,EJmp,rtO:)VF'I;
JLDneg: T ~ (RZero) + (T) + 1, dblgoto[Ojmp,Enojmp,NOOVFj;

"JUr.l/l Greater Equal Oyte
JGEO:
JGEBx:
JGEI3pos:
JGEOlleg:

T

~

T

I-

(Stack&-l),cnll[stkdif],usectask, opcode[2351;
(Rloro)+l, dlllgoto[JGEOpos,JGEl3neg,IILU>'O.l, FREEZFHESUI .. T;
T
T

~
~

(RZero) + (T) + 1, (/t;lgoto[Enojllip,Ojmp,Ollf];
(flZero) + (T) + 1, dIJ1uoto[Ejlllp,Ollojlilp,OIJF];

'Jump G reate r Byte
JGI3:
Stack&-l,usoctask,cull[stksw'l, opcode(236];
1u I- (Stack&-2) - (I), goto[JLBx];
'Jump Loss Equal Byte
JLEU:
Stack&-l,usectask,call[stksw], opcode(237];
III ~ (Stack&-2) - (I), uoto[JGEDx];
stksw: 1 .. staek&+.L,

retlll'l1;

'Jump UIIS igncd l.ess Byte
JULD:
T" (Stack&-l), lIsectask,call[stkdif], opcoda[240];
JUll3x:
1'" ,2e, dblgoto[Onojmp,Ejmn,Cal'ry];
',Jump UIIS iglled Groator Equal [lyte
JUGE[l:
r~· (Staek&-l), usoetask,eall[stkdif], opeod'o[2H];
.JUGEDx: T ,,' Ze, dbigoto[Ojmp,Ellojrnp,Cal'I'Y];

*Jrnnp Unsiglled Greatel' Dyte
.JUG13:
StiICk&-l,useelask,ea'll(stksw], opcode[242];
lu ~ (Stack&-2) - (1), gOLO[.JULDx];
'Jump lIlis igned Loss Equal [lyte
JULEO:
Stack&-l,lIsoctask,eall[stksw], opeodo[243];
111 ,- (Stack&-2)
(1), goto(JUGEOx.l;
"Jump Zel'o Equal Byte
.JZ[QD:
lu I- (Stack&-l), goto[JEQBxl, opeodo[244];
'.Jump 70ro Not Equal Bytc
JlNEU:
III ~ (Stack&-l), goto[JNEBx], opeodo[24S];

Pago'

T

t·

* T

I-

o!.l

'. r,'

3-Nov-79 10:15:53

MesaJ,mc

"'Jump Indexod Byte
~~*~~~.**

JHl:

Slart of Pilot Corto

*~~$*~*~**$~*~~.~***$*.~**~~*~*~.~**$.*****

r .-

Stack&-l, uscctilsk, cnll[stkdif], opr.odeI:2'1G];
Hoto P Hlnojmp, C,I r If] ,St He k&" 1;
lu ... CyclcContl'ol <- NnxtDala[lBUF]; "got alpha
r <- NextDnta[IBUF]; "Bet beta
(lhm"~k[GctnSpec[1l./:IJ) OR T; "Cyc'leConlrol
r • (l'sh[Stack, 1]) ~ (f), task;
PFETClll[CODE, RTEMP];
Stack&-l. dblgoto[;} W1 •.JIilr. Reven];

T ..

JIbl:

J Wr:

is in bits 0:7

T ... (ldf[HTEMP.O,lOl). fJot(J[J~lx];
T .- (rhmask[HHMP]). goto[JWx];

JIl3nojmp:
lu ,.. NnxtData[IBUF]. canrJHlnojmpx]; ·skipalpha

*n·*****~

JIB:

T

*U******~

Start of Alto Codo .~~*~.***.*************~***~~.****.~****~*.*
~ sUnimplctllented. goto[doTrapP6]. opcode[246];
FI1CI of Alto Coda **********~****~****~**.*~~~**.*.~***~$*~*.$*$

"'Jwnp Indexed Word

*.;*'11 * 'f!-II 1< * Sta,'t of P-ilot Coda "'*****'''**~*******'''**:\I,,_:jI;JIm****'"4I1II:}I*;JI:****''I**:)I
JIW:
T 0 Stnck&-l. usectask. call[stkdifl. opcodh[247];
~1()t:o[,JlWrlnjtllJl.cilrr'y].St.ilck&q;
•
111 .- Cyc1eCotltro1 .' NoxtData[IBUF]; "fJet alplla
., .- NextOata[HIUF]; *get beta
*::::"'***:fI*~ Lild of Pilot Code **·"***:fI**iC*:~·~:}I***;fI**:iI**:II';fI:I:******'k*'~******:II*:1I*
~n***~·**

JIW:

Start of A1to Codo

~****~*********~******~~********************

III ' GeLHSpec[12!]. ~kip[R even]. opcodc[247];
III ' NextDilta[I£luF];
T .- Stack&-l;

IIstlctask, call[stkdifJ;
Uoto[JIWllojrnp. carry] .Stack&'l;

r • NexLData[IfJUF]; *!Jcl beta
lu ( CyclcContr'ol .- tlextData[HIUF]; "get alplla
*0***·*** Fild of Alto Codo **************~****iC**********************~***
.- (lhmask[GeLflSpcc[127]]) OR T;

r • (Stack&-l) + (T).task;
PFETClIl[CODE, HTEMP];
r ~ "TEMP. goto[JWxl;

*CycleColltrol is in bits 0:7

J[Wnojlllfl:
lu ~ NoxtData[IOUf); "skip alpha
.JlW'tUjIIlpX :
SLack&-l; "adjust trw stack
lu ,- NuxLData[IRUF]. can[JnIlET];

·skip be"a

Pa'J e

J-Nov-79 19:15:53

·MosaJ.mc

*ADD
@IIDD:
Addx:

T

~

lu

Stack&-l, opcodo(Z50];

NcxtInst[IOuf];

~

Stack'" (Stuck) + (T),
'SUO
@SLJB:
SlIbx:

NIRot;

T ... Stack&-l, orcodo[251];

III ... NextInst[IBuF];

0tuck

I·

(St<1ck) - (T), NIl1ot;

'Multiply - The hlnll hulf of tho 32-bit product is l'lft above the top of the stuck
• pI'oduct low in Stack, hi in flTEMPl
• mult ipl illl icand 'Iowin I1TEMP, hi in xn!x
• mull. i p 1 i 0 J' i II x fMY
@MUL:
T ... RTEMPI ... Dc, opcode(25Z];
SIILUF'" r, call[PopToT]; • Salllt' " 0 is a no op
xfMY ... T, UseCTask, call[PorTofJ;
Stack&il <. Oc, skir[uluIlO]; • to:)ts xfMY ... T
Stuck&+l ... Oc, goto[mdPopj;
I1TEMP ... T, call[.+11;
xfMY • (,'sli[xf~IY,lJ) sa"ilIFop (T), skip[reven]; • tllP of 100p1
Stack ,- (Stack) + (T), dblnot.o[lllllIDono, MULa, u'lu=O];
t.IULb:
r t· I1THIP (. (11IrMP) + (T), f,·eel.ol1csult, skip[">=O];
I1THIP1 (. (RrE~ll'l) + 1, lJsoColltllsCin, goto[mlllLong);
rHEMPl , (RTEMPl) + I, UsoCulitAsCin, return;
MULa:

FroezoResu'l t, Boto[MULb];

mullon!]:
xrMX ... lc, call[. q];
lu'" (xfMY) salufop (T), skir(J'cvon]; ., tor of 10op2
Stuck'" (Stack) + (T);
RTE~IPl (. (RHtWl) I I, UseColltllsCirr;
RrEMP ... (IHEMP) ~ (T);
T ... xt"MX, Ff'cezoResu1t;
xfMX ... (xfMX) I· (T)' 1, UseColltllsCin;
xfMY <. rsh[xfMY ,1J, sk ip[ raven];
T t· RrrMPl ( (RTfMPl) + (T), dblgoto[mdPush, MULe, alu=O];
r (. RTEMP, retllrn;
MULc:

T ... RTEMP,

return;

Jill/IDono; T ... (R1TMPl)

~

1, LJseCoutAsCin, goto(mdPush];

mdl'usll: Stack&l·l (. T, Boto[lIIdl>op];
mdPop:
Stack&-l, goto[P6Tail];
PopToT: T ... Stack&-l,
"Duuble
OBI.:
T ...
l'ushTl'6:

~reezeResult,

lsh[Stack&-l,lJ~

Stack&~l

return;

Opcode(25J];
lu ... Nextlnst[IOUF];
~ T, NIRET;

8

MesaJ.mc

3-Nov-79 19:15:63

"Div-lde (TOS-l)ITOS.
Sing-Ie wo1'l1 d-ividend, single wOI'j (I-!v"lsor, no check FOI' overflow.
-Tho romaindor is leFt abovo tho stack.
@OIV:
MNUR ~ StackS-I, opcodo[254];
T ~ Oc, goto[LDIVx];
"Long Divido - (TOS-l),,(TOS-I')ITOS.
Double word d-ividolld, singl0 wohl div-isol', no check fol' overflow.
*Tlle I'cmaillcior is -left above the stack.
* dividend low in Stack; hi -in IHEMP
• Iliv isorill T
• quotient appears -in Stack; remainder -in RTEMP
@LUIV:
MNBn ~ Stack&-l, coll[PopToT], opcode[265];
I_DIVx:
nTHI!' ~ T, LoadPage[opPagoO];
T ~ MNBn, gotop[.+1];
onpage[opPageO];
lu ,- (llfEMP) - (T), goto[zerod-ivide, (lIu~O];
goto[dividecheck, carry];
nop;
rcnt 0 17c, call[divStart];
lu .. nTEMP1; • top or loop
nTEMP (- (fHEMP) -- (1), skip[alu=O]; " subtract divisor
Stack .- (lsh[Stack,lJ) ~ I, dblgoto[divsl, divsO, r

17 • usc zero

MesaJ.mc

3-NaY-79 19:1G:53

*Ooublo i\dd
@Di\[)D:
MtWR t- Stilck&-l, call[GetTDccSH.?], opeotlt;[2G4J; ~p(lil1t to lsI> <.It' top lIoubloViord
Stuck 1- (St.ack) " (T); " add low hit'i
Stack&+l, goto[d~ddC, curry];
T .. MNflR, gotori\r1dx]; " pick lip hi(J1J bUs of t.op {loulJlewol'Cl
dl\ddC:
T t- (~lmHl) t 1, goto[l\ddx]; ., pic!<. up high hits of top dotibloVlol'd
"Double Subtract
@OSlHl:
MNflR,' Stack&-l, cal1[GetTDecStk2], opcouc[2G5];'point to lsb of top doub'lewe/'d
5tack ~, (Stack) ,- (T); " subtract low hi ts
Stack&+l. (Joto[dSubC, 1I0Carry]; 'point to msb of socond dOl/Ii'lewold
T .. MNOR, goto[Subx]; "remomber IOsb of top doublflword (lOS)
dSubC:
T (- (MNflR) t :I, goto[Subx];
GotfDccStk2:

T (- (Stack&-2),

return; *grah it,

point to lsh of socond doubleword

·Doub1e Signed Compare:
"IF (TOS-2) .. (T05-3) < TOS,,(TOS-l), push -1
"If (TOS-2) .. (TOS-3) = TOS .. (TOS-l), push 0
"If (TOS-2)" (lOS-'3) > TOS •• (TOS-l). push 1
"Comparisons al'c signed
DCOMP:
T' (Stack&-2) I (IOOOOOc), Opcotlu[2G6];
Stack ~ (Stack) + (100000c). goto[OUCONPY1;

'Double Comparo:
"If (TOS-2) .. UOS-3) < TOS .. (TOS-l). push -1
orr (TOS'2),.(TOS-3) = TOS .. (TOS-1). push 0
oIf (TOS-2) .. (TOS"3) > 10S .. (TOS-l), push 1
·Compar'isons arc ullsigncd
OUCOMP: T ~ Stack&-2. Opcode(207J;
OUCOMPy:
Iu t- (Sto1ck&+l) - (T); "Compare msb's. point at Ish of higl1 doublelVord
goto[DLJCompal'eLowflits. I\LU'O]. T <- Stack&-2. IHHlEflESULT; "gl'ablsb of top doubleword.
"point at 'Isb of second doub'lawol'd
IlLJCompx:
dblfjoto[OUCompL, DIiColllpG. NoCar'I'Y];
T <- (Rlero) - 1, fjoto[DUCompEqu31];
T f' (flZoro) + 1, gnto[DUComp[qual];

DUCoIllJlL:
OUCOlllpG:

DUComparoLowBits:
T 1- (Stack) - (T);
goto[OUCompEqlfid. ALUoOJ. rflEEZERESULT;
clblgoto[OUCompL, DUCompG, NoCal'ry.l;
DUCompEqual:

Stack

t-

T, goto[P6Tai1];

"I\DOOI - on DO. cquiY31ellt to ADD
110001:
goto[Adclx]. T .. Stack&-l. Opcodc[270];
·Unused opcodes on page 6
f • SUllilHplol1l()lILed.
T t- sLJnimp'lelllolltcd.
T , sLJnimplcfllonted.
1 <- slJllilllplell1cnted.
T " sUnirnplemontod.
1 (, sUnirnplllmented,
T <- sUnilllp1ementcd.
doTr'apP6:
LoadPago[opPage~J;

gotop[k Fe r];

END;

Ylit.o[dofr'If FQf f'otlll'I1S, qlladOVr occurl'ed.
See I.LDFl.
Cal f[Incll]. rrotcfll[GLOFlIIL.R1EMP];
Pfetchl[GLOSAL,Stack], goto[DoubloRaadTail];
'Store Global 11. n~0-7
PStorol[GLOBAL.Stack.3], goto[P~Taill, Opcodo[61]
SGO:
PStorel[GLO[lAL.Stack.~]. goto[P~Tail]. Opcodo[52]
SGl:
SG2 :
PStorul[GLOQAL.Stack.61. goto[P1\Taill. OpcOde[53]
PStorel[GLOHAL,Stack,61, goto[P4TaiIJ. Opcodo[64]
SG3:
'StOI'O Global Byte
SGB:
T ~ NoxtData[IBUF]. opcode[55];
PStorel[GLO[lAL.Stack]. goto[P4Tail];
"Load Immediate n. n=0-6
lu ~ NextTnst[IBUF], Opcodo[6G];
LIO:
Stack&'l ... Dc, fIlHET;
T ,- lc. goto[PlIshT]. Opcodo[57];
L.I 1:
LI2 :
T ~ 2c. goto[PushT]. Opcode[GO];
LI3 :
T ,- 3 c. got 0 [I' u s hT:J. 0 pcod 6 1 J ;
LI4:
r <- 4c. ~Joto[PlIshlJ. Opcode[62];
I ... 6c. goto[Pushlj. Opcode[63];
LIb:
l.I6:
r rOc. QoLo[PlIHhf], Opcode[64];

°[

'Load Immediate Negative 1.
LIN1:
T ~ (lero)-I, goto[Pu5hT]. Opcode[65J;
"Loild IIIIIlIediate Negativo Infinity
LINI:
r ~ 100000c. goto[PII5hTJ, Opcode[GG];
"Load Inlllleu"i ate By ttl
LID:
T ~ NoxtData[IDUFJ. Opcodo[67];
PushT: hI <- NuxtIllst[IUUF];
Stack&+l ~ T. NIRET;
·Load Immodiate Word
*=*******

LIW:

Start of Pilot Code
<-

*=*****~*

End of Pilot Code

*D*******

Start of Alto Code

LIW:

*******.***.***~~****'*~********************

Cyc"loContl'ol ... NextData[HlUF]. Opeoue[}O"j;
T ... NcxtData[IBUr];
111

**********************~**********************
***.*.**.***~***.******~************.*******

"fu ~ GetIlSpec[127], sk"ip[R even]. Opcodo[70];
lu ... NextData[IBuF];
r ~ NextData[I8UF];
"1'1 ~ CycloControl (- NextData(IBUF];

~N*******

T

End of Alto Code
~

****************.*****************************

(lhmask[GotRSpcc[127]]) OR T, goto[PushT];

"Load Immediate Negative Byte
LIND:
T'" 177400c, opcode[71];
T ... NextData[IOllf] OR T, call[PushT];

Page

3-Nov-70 19:15:63

Mesal.S.mc

"Local Address Byte - since MDS 'is 64K ill"igned. the

lAORU:

T

~

LADHllx; T

j-

~lolJI

LOCAL, Opcodu[72];
(NflxtData[IllUF])" + (T). ca"ll(PushT];

"Global Address By to
GADIlB:
T t- GLOOAl., goto[LADRflx].

'unused opcodes on page 4
T t- sUnimplcmcntod,
T t- sUnimplcmcntcd,
T t- sUnimplemcntcd.
T ... sUnimplemelltod.
doTrapP4:
LoadPagc[opPageJ];
gotop[kfcr];

Opcode[J3];

goto[doTrapP4].
goto[doTrapP4],
goto[doTrnpP4].
goto[doTrapP4],

opcode[74]
opcode[/6]
opcodo[76J
opcode[71"!

haH of the bast) reg"ister' "Is I.

3-Nov-19

Ml1saLS.mc

19:1b:~3

~ComJlJon

tan ilot Code *****.*****~*********~***~**~**~*****.~******

@J(r:

~H*******

Start of Alto Code

*.*************~**~****.*******************.

AlignField:
usectask, gotop[AFO];
ollp a ne [6];
AF6:
T <-- apc&apcta5k;
HTHlP (- T'
111 (- GetIJSOx];
IlTEMP f- T;
Stllck&-l, return; °T

T (,

Sw~ppod

~~*~*~~**

WSF:

f·

S~opped Oyte
T ~ Stack&-l.

~/SPointer:

~Writo

Page

f-

pointer

Field

Start of Pilot Code

**~$*~*.~~**.**.~***~**~*~$~~.*~**~*~.*~~*~

SLack&-l, opco~o[132];
T (, NoxtData[IBl,;FJ;
lu f- CycleControl f- NextData[IBUF];

*=**·illjcllll\llfl

[Ild

of Pilot Code

1\I**~*:f,I:II**:tI**!}I***:/I:"***I"I!tIjl**I\II/I***:tl*'''*'II*II III * ;k:ll :II * ~I *:Ii :II >II:tl 11::/1 * * Irite Jndiroct Global Pair Long
WIGPL:
T ... NextDatn[I£lUF I, opcode[152];
RTEMP ~ T, coll[GlohalLP];
Pdtorol[LP,Stackj, goto[PGTail];
*Format a long pO'inter froll1 a local selector', ,offset pair'
LocalLP:
T ... Rr01Pl (, Gc; ",'temp! is a flaq fOI' ciccLPTR (below),
r t (ldf[HTEMP, 10, 4]) t- (T); *note - high half of poinLer' is fetched first
Pfel.chl[LOCIIL, l.Ph i J, goto[decLPTR];
Locall.Py:
Pfetclll[LOCIIL,LP]; "'low halt'
1.0calLPx:
r (, (LPh'i) anti (377c);
T t, LPhi ... (lsh[LPhi, 10J) +(T) + 1;
LPhi .- (t"ixVII[LPhi]) a" (T); "if we dedde to tr'ap 011 rcfer,]nces to pilge 317, do it here
T ... 1 dI'[HTEMP , 14, 4], return;
"F U, '11\ d t a l 0" gpo i n t lJ I' f rOIll a 9 1 u b al s e 10 c to,', ,0 f f ~ e l p a i I'
GlobalLP:
T " HTEMPI ,-' 4c;
T <- (ldf[llTEMP, 10, 4]) + (T); "note - high half of pointer is fetched fi,'sf.
Pfetchl[GLO(JIIL, LPhi], gota[ docLPTR];
GlobaHPy:
Pl'etchl[GLOllIIL,LPj, goto[LocilllPx]; "Jow half
decLPTIl:
T

t·

lu t, ldf[I1TEMP1,17,lJ; ·where to return (T is written here)
(1I110ne5) + (T), dblgot.o[LocalLPy,GlobillLPy,IILUIIOJ;

PallO

10

MesriLS.mc

3-Nov-79 19:15:b3

'Road Str"ing LOllg
RSTRL: T ~ CNextDota[IBUF1, call[RWSrRLx], opcode[153];
T '" i'sh[IHHIP1, 1], call(Fotr.hLPfuIHHW]:
III •. IlHMP1, dblgoto[IlSTRLoft, HSlfHlight, Reven], LoatJPage[4]:
Fotcil"IN[]RLPToflHMP:
r ,- MNIJR:
FntchLPToRTEMP: Pfotchl[LP,RTEMP], goto[P5Rut]: • allow timo to wrIte T
HWSTnLX:

T ~ (Stack&-l) + (T);
HTEMPl .- T, goto[StackLP]; *RTEMPI

<-

$tl'ing index

-Write String Long
WSTflL: T <- CNextData(HlUFJ, ca11[flWSTRLx], opcode[lG4]:
T <- rsh[flTEMP1,1], coll[FctchIPToRTEMP];
RTEMPl ,. T, dblgotu[WSfRLLoft, WSTflLllight, fleven]: "test low hit of HTEMPI
WSTIlLl.eft:
T <- lsh[SLack&-l, 10J:
RTEMP <- (rhmosk[IlTFMPJ) or (T), goto[WFLx];
WSrRLRight:
T <- rhmask[Stock&-l]:
IHEMP .- (lhlllosk[flTEMP]) 01' (T), got.o[WFLx];
"Head Field Long
*=******* Start of Pilot Code ~****~.~~****$~*****~.**~*$~~****~.~~~.*~~*
MNUfl ~ CNoxtOota[IBUF], coll[StDckLP], opcode[155];
lu .- CycloControl .- CNuxtData[JBUF], ca 11 (FetchMNllRLPToStack]:
~~******* End of Pilot Codo ***********~***.**.******~**~****************

HFL:

Start of Alto Codo ~* •• ****~*~~**~*~****~.**.**~**~.*****.*~**~
lO.ldpage[fl], r.all[AlignF·ield], Opcode[lfiG];
RfFMfl ~ T, call[StackLP]:
T ~ RTEMP, call[FetchLPfoStack]:
~H******* End of Alto Code *****$******.***.*****~~*$***********.~*******

*u*******

I!FL:

RFLx:

lu

~

NextIllst[IlJUr], call[RFx];

FetchMNIJHLflToSLack:
T ~ MNBR:
i"etchLPToStack: Pfctchl[I.P,Stack], goto[P5Ilet]; " allow time to Vlrite T
'WI'ite Field Long
Start of Pilot Code .************~*****~***********************
MNBR ~ CNextData[IBUFJ, call[StackLP], opcode[156]:
lu ~ CycleControl ~ CNuxtDnta[IBUF], call[Fotr.hMNllHLPToflTEMP]:
*=*****~* End of Pilot Codc ******************************~**************
$=*******

WFL:

Start of Alto Code *******.**********************************~*
luadpagn[G], cilll[AligIiFiolll], Opcodo[lG6];
IHEMP , T. call [StackLP]:
r <. HTEMP, call[FetchLPToRTEMP]:
*H******* End of Alto Code ~**~***********************~******************
~n~******

Wft:

WHy:
\>/fLx:

llfEMPl , f:
T <. WFA[Stack&-l]:
HfEMP ~ (W~B[RT[MP]) or (T):
T f- nTE~1pl;
PsLorcl[lfl,HTEMP], goto[PfiTail];

"Rood F iel d Stack Long
IlrSL:
T'- Stack&-l, call[TtoRTEMP1. opcodc[1[j71:
CycleControl f- HTEMP, coll[StockLP]:
T ~ rsh[HTEMP,lO];

Start or Alto Codo ****************************************.***
f- GetRSpcc[127].
skip[R even]:
<- NextOota[IBuf];
*H******* Entl of Alto Code ******************************** •• ************

*0*******

lu
lu

Pfetchl[LP,Stack], goto[RFLx]:
'Write Fiold Stack Long
WFSL:
T f- Stack&-l, call[TtoHTEMP], opcode[160]:
Cyc 1 eColit rol ,. RTEMP, ea 11 [S tac kLPl;
T ~ rsh[RTEMP,10], call[FetchLPTollrEMP]:
*h*******

lu
lu
*0*******

Start of Alto Code
~ GutRSpuc[1~7],
~ NextData[IBuf]:

Elld of Alto Code

RTEMPi
TtoRTEMP:

<-

*********************~.***************.*****

skip[R even]:

****************.****************.~*****$*****

T, goto[WFLy]:
HTEMP ... T, return:

MesaLS.mc

3-Nov-70 19:1fi:63

'lengthen Pointer
alP:
T ~ Stack, upcodc[161];
goto[PusI1TPG, J\LUJlO],
... rsh[MDShi,lO];
r f- Oc;
PushTP5:
lu ... NaxtInst[IBuf];
Stack&+l f- T, NIRET;

"test For NIL.

*Store local Double Byte
SLDD:
T (- t-Jox tData[I£lUFJ, opcode[162];
Pstorn2[lOCAL,Stack], call[SQf];
Pstorel[LOCAL,stack], call[IncS2Tl];
Pstorel[l.OCAL,Stack], goto(\~SD£lxl;
'Store Global Double £lyle
SGDO:
T ~ NoxtData[IOUF], opcode[163];
Pstor'o2[Gl.OBJ\L,Stack], call[SQT];
Ps to ['01 [G LOBAL, stack], ca 11 [IncS2T1];
Pstorol[GLOOJ\L,Stack], goLo[WSDBx];
"'Push
PUSH:

Stack&~l,

*Pop
POP:

Stack&-l, goto[PGTail], opcode[165];

~Joto[P5Taill,

opcode[1Ci4];

"Exchange
[XCII:
T.- Stack&-l, Opcode[lGG];
MNUH (- Stack, Stack (- T, NoHogIL.ockOK;
r .- MNBR, goto[PushIPG];
*~*******

Start of Pilot Code

*.*******~****~******~~****.~~~***********~

'Link Byte - equivalent to PUSIIX; LIO; SUO; SLO;, X is above stkp
LINKS:
r·- NextData[TBlIF], opcodl~[lG7];
StackKQ;
Stack f- (Stack) - (T);
Pstor'ol[l0CJ\I., Stack, 4], goto[P5Tail];
~=*******

End of Pilot Code

~*$t****~**~****~~*****~~****~***~~**t*~**~~*

Start of Alto Code **********************$*******************~*
·Link Byte - equivalent to PUSHX; LIO; SUO; SLO;, X is above stkp
LINKO:
T ,- NoxtOata[IOUF], opcode(16J];
Stack&~l, LoadPa[Je[6];
StfC******;~******,I=*******:/l.i}!*****
*H****~**

"DlIp I icate
DlI .. :
1 (. Slad,&-l, 0I'code[110];
Stilck&~2 0 T, goto[P5Tail];
*=***~*~*

Start of IJilot Code

***~***************I/I*~******************~~$

*NIL Check
NIL.CK:
f ' Stilckllrl, Opcode[l71];
NILCKx: Stack&>l, dblgoto[doTrapP5, P5Tail,

ALU~O],

T (.

sPointerFalllt;

'"NIL Check Long
NILCKl: T 0 St

bit 10

~>

bits IG,17

bits 12 -15

0
1
2
3

~)

=)
=)

=)

Flags.

Its interpretation is:

Clean Queue
Clean Queue
Requcue not done
Requeuo dono
Notify
I3I'oadcast
Na:wd NotiFy
lIut used

Opcode Dispatch

1\11 flag constants excopt NakeciNotifyFlags are cycled I'ight 1 in order
to sot bit 0 if necessary.
%
-rlag va"l lies
MCrMEFI "ns, 0] ;
SETU1Eloc, OJ;
MCI"MREFlags, 21J;
SET[MRr"loc, 2];

.

Dispatch to

"

Dispatch to :'. , Cloan Queull

MC[MX~JFlags,

"
"

Dispatch to 5, Cloan Queuo

*

Dispatch to LO, Clean QUOUIl 1, Not i fy
Disp,ltch to 10, Clean Queuo 1, Oroadcas t

51];

SET[MXWloc, 5];
MCp~XDFlags, 61];
SETr~IXDloc , G];
MC pIOn rVF 1 a9 s. 100];
MCLOCASTFlags, 102] ;
SET[Wakelloadloc, 10];
MC[REQFlags, 130];
SET[REQloc, 131;
MC[NakedNotiFyFlags, 2];
MC[RequeueOccured, 200] ;

"

Dispatch to

G, Clean Qucue

*

Dispatch to 13

'"

Clean Queue 1, Na~,erJ Notify, not cycled
Roqueue occlll'ed, not cycled

'"

3-Nov-79 19:15:53

MesaP.mc

Page

ONPAGE[opPogeO];

*ME
@ME:

GOTO[CheckLong1].

PRFlags ~ (NEFlags). opcode[l];

'" Monitor Lock

*MRE
@MRE:

GOTO[CheckLong2].

PRFlags (- (MREF"I<:Igs), opcodp[2];

" CV.

*MX\!J
@MXH:
~IXWx :

PRFlags .. (MXWrlags) , opcode(3];
T .. Stack&-l;
GOTO[CheckLong2], Process ~ T;

Lock

*

Time, CV, Lock

~MXD

@MXD:

GOTO[CheckLongl],

PRFlags ~ (MXDFlogs), opcode[4];

*

Monitor Lock

GOTO[CheckLongl].

PRFlogs ... (~JOTIFYFlags), opcodc[5];

$

CV

PRFlags ~ (BCASTFlags).

" CV

"NOTIFY
@NOTIFY:

*nCAST
@OCAST: GOTO[ChockLongl],

*IlEQUEUE
@IlEQUfUE:
PRFlans ~ (REQFlags). goto[MXWx],

opcodc[B];

opcode[l];

., Process, Q1,

ChockLong2:

r <-- (373e); ., Stkp vallie for' two 10llg point~r operands (4).
T ... (IIStkp) XOIl (T);
'" Chock for stack SilO of 4,
r ... IlIIMask[MDShi]. dblgoto[Short2, LOlIg2, ALUIIO];

Checklongl:
T (. (375e);
• Stkp value for one 10l1g pointer' operand (2).
T ,. (nStkp) XOR (T);
" Check for st.ack sizo of 2.
T ,. flIlMask[MOShi], dblgoto[Stlol'tl, l.ong1, AlUIIO];
Short2: QlIellc2hi <-- T, call[FixQuello2];
T .' HII~lasklt4DSh i], goto[Short1];
1.011g2:

r ... Stack&-l;
Quelle2hi ... T, call[FixQuellc2];
T ~ Stack&-l, goto[Shortl];

LOllY 1;
r ,. Stock&-l;
Sho rt 1: Queue 111 i ,. T, goto[ F i xQuelic 1];
FixQueue2:
T ... QlIclIc2hi ... (lsh[Queue2hi,10]) + (T) + 1;
Quollo2hi ... (fixVA[Queuo2hi]) or (T);
r " Stad&-l;
Quollo2 <-return;

r.

FixQlIeuel:

r <-- Stack&~l, TASK;
Queue! (. T;
1u ... (QlIouelhi) OR (T);
T " Quellelhi, skip[alu ~ 0];
r " QUfluelhi ... (lsh[QU8l101hi.lO]) • (T) + 1;
Quollolhi ~ (fixVA[QlIelielhil) or (T), goto[ProcessOps];

ProcessOps:
LoadPago[ p "Page];
Di spatch[PRr1ags,

11, 4], !jotop[ProcessDi spatch];

OnPage[prPagc];
ProcossDispatch:
PRFlags ,. RCY[PRFlags,

1]. Disp[MEllter];

Q2

MesuP.me

3-Nov-79 19:15:53

I.hn itor Entel';
Input
Aaso rogister pointing at mon1tor queus

Queue1
Temps
MQ

process hanule

Constants
CurrontPSB
218, address of CurronLPSO
lockBit
100000B, lock bit or Monitor Lock
MEnter: T ~ (CurrentPSO), cnll[QueuelToMQ], AT[ProcossDisp, MEloc];
lu ~ MQ, goto[MELocked, R >= 0];
MQ ~ (MQ) AND NOT (LockOit), call[MQToQuDuel]:
MRENoAbort:
Stack&.t ~ lC;
~ even location
PrTail: loadPage[opPageO];
goto[P4Ta"il];
MELocKcd:
PFctchl[PBase, Process], goto[MREnterFalledJ;

Monitor ReEntor;
Input
Queuel
Queue2

flase register point'in(J at loonitor queue
Base rogistel' pointing at condit'ion q,ueuo
Temps

PBase
Pl'ocess
l!Temp!

Oase register of PSOs
process handle
temp

Constants
LockBit
100000B, lock bit of '·Ionitor Lock
ClcanUpOffset
1, offset of cleanup link 'in PSB
FlagsOffset
3, offset. of flans anu priority in PSB
CUI'fcntPSB
21B, address of Cllrl'CntPSO
sProccssfrap
on, offset of sProcessTl'ap in SD

MREntcr:

r (- (ClIrrcntPSB), call[QllouelToMO], AT[Pl'ocussDisp, MHEloc];
I IlPUase foProcassj;
III ,- MO, goto[MREntcrrailed, R >~ 0];
• innor!) 1'11'1 bH
UseCfask., call[ClcilnUpQlIcue];
" Cleall up Qucuel
MQ ~ (MQ) AND NOT (LockUit), call[MQToQlleuHl];
r ,- (PI'ocess) " (ClcanlJpOffset), call[/nl'oToPBase];
T ~ (Process) + (FlagsOffseL), call[PUaseToRTempl];
lu (, (RTempl) AND (AlJol'tPcn(]'ing);
goto[MRENoAbort, alu ~ OJ;
T (- (sProcessTl'ap);
PRTrap: LoadPage[opPage3];
gotop[k.fcr];
Cil

MREllterFa'iled:
T ~ Qucuel;
Queue2 ~ T, TASK;
r (- Qucuclhi;
Quelle2h'j (- T;
T f- (Pl'ocess) + (FlagsOffset), cal1[P[3aseToRTempl];
Quellclhi ~ (ReadyQhi), call[ReadylnQlIcucl];
HTempl ~ (RTempl) OR (Entel'Failed), cal1[RTemplToPBase];
UseCTask, call[RcqllouOSub];
T f- PRFlags, goto[ReSchcdule];

Pago

3

J-Nov-79 19:15:53

MosaP . file

Monitor Exit and Depart;
Input
Queue1

Basa register pointing at

monitor que us

MXDepa I' t:
UseCTask, call [ExitMon], AT[Pr'ocessDisp, MXDloc];
T ~ PRFlags, goto[ReSchedule];
Exit Monitor;
lnpu t
Base re(rister pointing at

Queuel

monitor quoue

Temps
PDase
MQ
Process
EMLink
LockBit
[xitMun:

Base register of PSBs
process handle
process hand Ie
return link
Constants
10000013, lock bit of Moni tor Lock

r ~ APC&APCTask, call[QueuelToMQ];
EML"ink ,- T;
T ~ MQ 0 (MQ) AND NOT (LockBit);
goto[EMUnlock, alu ~ 01;
pretchlrl'llase. Process]. ca·llrllead.ylnQueue21;
UseCrask. call[HequeueSub];
call[QllouolToMQ);
• Requeue llIay have changed MQ
guto[EMUnlock];
DIU II lock:
I~Q <- (MQ) OR (LockBit);
PSlurel[Qucuol. MQ. 0]. call[Pllllot];
APC&APCrask ,- EMLink. goto[PRllet];

Paga

Masur.me

3-Nov-7D 19:15:63

Monitor Exit Rnd Wait;
Input
Base register pointing nt con~ition quouo
Base ['Oniste!' pointing at mOil"itor quelle
Timeout value

Queuo2
Queuel
P roco S5
Tomps
POase
MQ
PIlTime
HTempl

Oase register of PSBs
pl'ocess handle
holds timeout va'lua
process handle

Constants
1000000, ww bit of Condition
1000000. lock bit of Monitor Lock
LockUit
1, offset of c"leililup 1 ink "in PSO
Cll:anUpOf fsot
2, offset of flags nlld priol'ity in PSO
TilllcOffset
1'1 agsOffset
3, offset of flags nnd Pl'iOl'ity in PSO
Wait"ingOnCV
lOB, WaitingOIlCV bit of PSO
400, A/)ortPendillg hH oj' PSfJ
I\bortPolldirrg
TirneoutAllowed 100H. TimHoutAllowed bit of PSO
21B. adell'ess of CUI'relltPSB
CurrenLPSO
3440. address of Timeout timo in Memory
TimeLocnt"ion
~JWfJi

t

MXWait: T (- Process. AT[ProcessDisp. MXWloc];
pnTime ~ T, UseCTask. call[CleanUpQueue];
T ~ QTomp, call[SwapQTcn~AndQ2];
UscCTask. call [ExitMon];
T .. (ClirrentPSIl). cilll[POaseToProcess];
T ,- (Process) + (FlarJsOfF~et), cal-I[PILlseToRTcmpl1;
lu , (HTolllpl) AND (JI/)ortPcnding);
gol.o[MXHAbort. alu II 0];
PFeLchl[QTomp. MQ, OJ;
ral1[PflRet];
MQ ,- (MQ) AND NOT (1'II-IBit). goto[MXvJOntoCV. R)= 0];
PStol'cl[QTclllp, MQ. 0-1. call[PIIRet];
I .. PRflags, goto[llcScheelule];
/olXWOntoCV:
111 ,- PRTime;
HTempl (- (RTempi) OH (WaitingOnCV). goto[MXl'lllavoTime, alu" 0];
I .. (Timcl.ocation). call[PHilseToCurrolltTimc];
T '" Curl'clltT imo;
Pf1Tillic <- (PRT-ime) ~ (T);
noto[MX~lavoTimex, alu II 0];
PRTime .. (PRTims) + 1;
MXWllaveTime:
nop;
MXWHilvclilflex:
Qucliolhi (- (ReadyQhi). call[lloadyInQlIcuel];
r (- Qlelllp. call[5wapQfelllpAndQ2];
I ' (PI'OCCSS) + (FlagsOrrset), call[HTelllplfoPBase];
lJseCTask. call[RcquclIcSlIh]:
f .. (Process) + (lilfleOrfset). call[PHTimeToPBaso];
r .. Pf1Flags. goto[lleSchedule];
MXWAbort:
T .. PRFlags. goto[lleSchcdule];
SwapQTelll[)AndQ2 :
WJBn " Quoue2. Qucue2 (, T. NoRegILockOK;
T <- MNBR;
Qremp ,- T;
T ,- QTemphi;
MNBH <- Queue2hi. Quolle2hi <- T, fJoRegILockOK;
T .. MfJBR;
QTcmphi ,- T, I'eturn;

M()saP.mc

3-Nov-79 19:15:51

Notify Droadcast;
Input
Base reg"lster of queue '.0 bo flot iFiod

Queue!
Temps
POase

MQ
RTempl
Process
PRfime
PRFlags

Base register of PSBs
process halldhl
process handle
process handle
Did something
f"I ags

COllstants
1000000, ww bit of Condition
~Ieglnf ini ty
1000008
3, offset of cleanup link in PSO
Fl agsOfrset
WaitingOIlCV
108," WaitinnOnCV bit in !'SO
WWOit

Wakoflcad:
UsoCTask, callfCleanUpQueuel, IIT[ProeessOisp, Wakclleadloc];
WIlLoop:
PRTime <- (ZOI'O), ca"ll[QuellotToMQ];
MQ ~ T ~ (140) AND NOT (WWUit);
III '" l.DF[PHFlalls, 16, 1J, goto(WIlExit, aiu cc 0];
f <- MQ, cu11[POuseToProcoss];
f (- (PI'ocess) I (F"lagsOffsct), ci\ll[Pfla~;eToHTempt];
PHfimc <- (le), call[RcadylnQlIcuo2];
HTempl <- (RTempl) liND NOT (HaitingOnCV), call[flTcrnplToP8ase];
LJsoCTas k, ca 11 [RequolJeSub J;
1u <- PRFluqs, !lotofWIIl.oopx, R odd];
III (- LD F[ P 11 F 1 a 9 5, 1G, 1 ], got 0 [ WII Ex it] ;
WIIL.oopx:
goto[WIlLoop];
WIlExit: f '" PHFlags, goto[ReSchedule, alll = 0];
ll1 <- PHrime, db1goto[SelWWBit, tJolkedIJotified, H even];
SetWWllit:
/.IQ (- (HWBit), call[MQToQlIeuel];
.. evell locution
Nu kedNo Li f'i ed:
IntLevel <- (IntLovel) ~ 1, LoadPage[OpPageO];
• odd location
goto[CheckCV];

Puge

MosaP.mc

3-Nov-79 19:15:53

Requeue i
calling instruction must include UseCTask
Input
Queue1
Queuo2
Process

Base rowister pointing at. queue
Base register pointing at queue
p I'oce ss hand 'I e
Output

RoSched

BOOLEAN
Temps

PBase
PI'ev
RTemp
RTempl
RTemp2
RLink

Oase rogistol' of PSBs
process handlo
Process,'link until insert,
process halldlo, pl'iority
pror:ess handle, priori ty
return addl'oss

than PI'OCOSS,PI"iol'ity

Constants
CleanUpOffset
I, offset of cleanup ,link in PSB
FlngsOffsot
3, orfset of flags and priority in PSB
Priority
7, priority bits
RequeueOccured 2000

RequeueOp:
UseCTask, call[RequeueSub], AT[ProccssDisp,
T <- PRFlags, goto[HeSchedulo];

REQloc]i

ROCluouoSub:
T <- APC&APCTilSk;
Hl. illk ,- T;
r <- Process, call[PBasoToRTomp];
lu <- (RTomp) - (T);
lu <- Quouolht, goto[RQGotPP, alu = 0];
"only 0110 process
goto[RQLoopl, alu = OJ;
" Quellol NIL, T ' PI'ocess
PFotchl[Queuol, Prov, 0], call[PRRotJ;
T <- Prev, goto[RQLooplx];
HQLoopl:
Prev <. T;
HQLooplx:
Prcv <. T, call[PBaseToI1Tompl];
T ,. HTolllp1;
lu ~ (Process) - T;
goto[RQl.ooplx, a1u II 0];
T .- P rev;
call[llTompToPUase];
* RTemp has Process.link
RQFixCV:
1u <- Quouethi;
r <- (Process) + (CleanLJpOffset), goto[I1QllaveQI, alu 1/ 0];
PStorol[PUaso, RTemp];
ca11[PHl1et];
goto[RQlnsrt];
RQGo tPP:
r ,- Prev .. (Zel'o), goto[RQFixCV];
ROllaveQl:
PFetchl[QlIBlIel, RTempl, 0];
T <- I'I'OCOSS, cal1[PHRet]i
111 .- (RTomp1) - (T);
goto[RQIlIsrt, alu # 0];
PSto l'elrQueuel, P rev, 0];
call[PI1Relj;
goto[RQlnsrt];
RQlnsrt:
pretchl[Qucue2, Prev, 0], ca1l[PRRet];
lu .- Prev;
T <- Procoss, goto[RQNilPP, alu = 0];
T t- (Process) + (FlagsOffset), call[PBaseToRTemp];
T <- (Prcv) + (F1agsOffsot), call[PBaseToRTcmpl];
RTomp ~ (HTomp) AND (Priority);
T <- (RTcmpl) AND (Priority);
lu .. (RTemp) - T - 1;
T <- Prov, goto[RQFixQ2, alu < 0];
goto [RQLoop2];
RQLoop2 :
Prev t- T, call[PUaseToRTempl];
T t- (HTempl) + (FlagsOffsot), ca1l[POascToRTemp2]:
T <- (RTemp2) AND (Priority);
1u t- (RTemp) - T - 1;
T <- RTempl, dblgoto[RQInsrtHero, RQLoop2, alu )= 0];
RQFixQ2:
PStorel[Queue2, Process, 0], ca11[PRRet];
HOIns rWe re:
T <- P rev;
call[PUaseToRTempl]i
,
T <- Process, call[RTomplToPAaso]i
T <- Prev, call[ProcossToPBase];
RORet:
T <- (Process) + (TimeOffset), call[ZeroToPBaso];
APC&APCTask <- RLink;
PRFlags <- (PRFlags) OR (RyquelleOccured), return;
RQNi 1 PP:
T ... Process;
call[ProccssToPBase];
PStorel[Queue2, Process, 0], goto[RQRot];

Page

MesaP,mc

3-Nov-J9 19:16:63

Page

CleanUpQueuo;
th"is routine cleulls lip a queue which lIlay possibly
have been left in a mBSS by Roquoue,
calling instr'uGt"ion must inGlude UseCTask
Input
PRFlags

ovon

=)

clean Queue1, odd

=)

clean QuoueZ

Temps
POase
RTomp
RTompl
MNBR
Rlink

nase rogister' of PSBs
pl'ocess handle
process handle
process handle
retul'n address

Constants
WWB it
100000D, ww bit of Condition
( I oanUpOf f so t
I, oHsot of cleanup 1 ink in PSO
CleilnUpQuoue:
T ~ APC&APCTask;
RLink ~ T, call[CQueuoToRTemp];
• get pointer to t~il
RTomp ~ (RTomp) AND NOT (WWOit);
* igllOI'O ww hi t
T ~ (RTemp) + (CleanUpOffset), goto[CURet, alu ~ 0];
~ get head of quells
Pfetchl[PBase, rnelllp1J, cal "I [PHHot];
III (- T (- RTump1;
lu ... (HTemp) - (T), goto[CUHetx, alu=OJ;
RTemp ... T, goto[CUEmpty, alll = 0];
CULoop: T (- (HTolllp) + (CloanUpOFfsot), call[POasoToHTemp1];
• got head of queue
lu '" T ~ RTempl;
lu ... (RTomp)
(T), goto[CUFoulldlload, alll~O];
goto[ClJElllptyx, alu = 01;
Rfomp ... T, goto[CUloop];
CUEmpty:
RTomp ... (Zoro), goto[ClJFixCV];
CUElllptyx:
Rfolllp ~ (Zero), goto[CUFixCVJ;
CUFoulldlfead:
MNOR ... T ~ RTolllp;
CUloop2:
RTemp ... T, call[POaseToRTompl];
T '" IITemp1;
lu ... (MNIlR) - (T);
goto[CUloop2, alu no];
nop;
CtJFixCV:
callrRTompToCQueue];
CURet: APC&APCTask' flLink, [Joto[PIlRet];
CURotx: APC&APCTask ~ RLink, goto[PRRot];
CQlIclIoTollTemp:
lu (- PRFl ags, DlllGo t.o[Queue I ToRTornp, QuclIc2ToRTomp,
RTcmpToCQucue:
lu ... PHFlags, DBlGoto[HTempToQueuol, RTernpToQuoue2,

)~

0];

)=

0];

8

MesaP.mc

3-Nov-l9 19:15:53

RoSchedu·lo;
Input
T

contains PRFlags
Tomps

PRase
rnemp
RTompl
MNBR
HLink

Baso registor of PSUs
process handlo
process hand 1e
process handle
l'etul'n address

Constants
EnterFailod
1000008. EnterFailed bit of PSB
ClcanUpOffset
1. offset of cloanup lillk in PSB
FlagsOffset
3. offset of priority and l'"Iilgsin PSB
FrameOffset
4. offset of FI'ame ill PSB
CleallUpOffset
1. offset of cleallup 1 ink ill psn
Priority
7. priority bits ·in PSB
StkPOffsot
lOll, offset of stack pointel' in state veclol'
OostOffsot
11B. offset of dest ill stato voctor·
CurrelltPSB
210. Curront process
RoadyQ
Z2!l. Ready queue
CurrentState
23D. Current state

lleSchedulo:
goto[PrTai I. tJoIl2Bit.8]:
nap:
[lltReScil:
r <. (CurrcntStale), call[PllasoToRTemp]:
l~adPaDc[OpPago3]:

callp[SavPClnFramc];
LoadPage[xFPagel]:
xfTemp ~ T. UscCTask. callp[SavoState]:
T • (ClIl'rcntPSB). call[PBaseToRTempl];
"RTcmpl'- currentPSB
r ~ (RTcmpl) + (FramcOffsot). call[LocalToPDase]:
IdleIntRS;
T <- (RcadyQ):
call[PBaseToRTompL];
lu ,. T .- Rfempl;
III ~ xfWOC, goto[NoncRcady, alu
0];
call[POascToProcoss];
* Process ~ roadylist.Jink
T .- Rlemp.

* setup for now process
T (- (Process) ~ (FlagsOft'set). cal·,[POaseToHTompl]:
IHemp ( (xfAV):
r ,-. (IlTl!I"p) ~ (Fil'stStatoVcctor). call[Pl3asoToIHclIlp];
MNBR ~ Hrolllpl, TASK:
HTompl <- r <- (HTempl) AND (Pl'iority):
HTompl (. (LSII[HTcmpl. 2]) + (l):
T ( (L~;II[Rrolllpl, 1]) + (f). TASK:
RTomp ~ (RTowp) + (T);
T ~ NNBR, goto[NoEntcrFailed. R )= 0]:
IHempl ,. T;
RTcmpl <- (RTumpl) ANO NOT (EnlurFailed);
T <. (Proc9ss) e (FlagsOrrset). cal1[RTemplToPOase]:
T ~ RTemp. call[ZcroToPBase];
• stack[O] (- 0:
HTcmpl ~ Ic;
• stkp ~ 1
T ~ (IlTemp) e (StkPOf'fsct), call[RTemplToPBase]:
NoEll terFa i 1 cd:
r <. (I'I'OCOSS) ~ (FramcOffsct):
call[POaseToRTempl];
T ,- (IlTclIlp) + (OostOffset). call[RTernplToPOaso]:
r <- (CuITelltPSIl). ca·I·I[ProcessToPBaso];
* currontPS13 <- process
T <- (CurrentState). call[RTcmpToPBase]:
T <- RTump, LoadPage[xfPagel];
xfTemp <- T. gotop[LoadState]:
NoneTleady:

r <- (sWakeupError). goto[PRTrap. alu nO]:
RTemp .- (Zoro):
PRFlags <- (Zero), call(IdleLoop];
* clear PRFlags in idlo int
IdleLoOI):
goto[Idlolnt. IntPending]:
PRRet:
return;
Tdlelnt:
LoadPage[OpPage3];
T <- (GotIlSpec[103]) XOR (3IlC). gotop[MIPcndx];

9

3-Nov-79 19:15:5J

MesaP.mc

POasoToPI'ocCSS:
PFetchl[PBase. Process]. return;
ProcessToPllase:
PStorel[PBase. Process]. return;
POaseToflTemp:
PFotchl[PfJasc.
RTompToPflasc:
PStorel[PBase.
PAaseTollTcmpl:
PFotchl[POase.
[Hemp 1 ToPOase:
PStorel[POase.

RTeml)]. return;
flTcmp].

return;

IlToiflpl]. goto[PHflet];
IlTompll. goto[PRRet];

POaseTornemp2 :
PFetchl[PfJase. RTelllp2]. ['eturn;
QlIeue1ToRTemp:
PFotchl[Quolicl. rnemp. 0]. roturn;
HTBmpToQueuol:
PSturel[Quouel.HTemp.O]. returll;
QlIcuo2ToRTomp:
PFetchl[Quouo2. HTcmp. 0]. rcturn;
RTempToQucllc2:
PS to ['e 1[QlIeuo2 • RTemp .0], retu ['n;
QlIollolfoMQ:
PFetchl[QlIollel.MQ.O]. goto[PRRot]:
MQToQlIeuel:
PStorel[QlIouel.MQ.O]. goto[PRRctJ;
PHTimcToPOasc:
PStol'cl[PBase. flHrimc]. return;
lcroToPOasc:
PStorcl[pnase. RZero]. l'etlll'll;
Loca·' ToPnase:
PStorel[POase. Local]. I'ctuj'n;
PBaseToClIrrentTime:
PFetchl[POase. CurrelitTimc]. I'oturn;
RcarlyIIIQlIoue 1:
Queuct

<-

(ReadyQ). I'oturn;

ReadyIIIQucue2:
QlIouc2hi <- (RoarlyQhi);
Quouo2 .. (ReadyQ). rotul'n;

Page

10

~losuP

3-~ov-79

omc

19:15:53

Interl'upt Processing;
Input
WW
r-ickCoullt
Curr'ontTimo

Wakeups Waiting register
Ilumber' of ticks until sCullillg PSHs reQuir'od
current timo

Temps
[ntLevel
IntType
Hemp
Hempl

pointer to CV array eloments
oven =) idle loop interrupt
toml)
temp

Constants
WW3it
1000003, ww bit of Condition
TimuOffsot
2, otfsot of time in PSO
F1agsOffset
3, offset of nags and pr'itll'ity in PSB
HaHilluOnCV
100, HaiLingOnCV bit of PSB
NakedNotifyF1ags
" [nterrupt Processing
onpage[OpPagoO);
[Ilter'rur t :

WW

~

(WW) AND NOT (TimorBit), goto[TimorInterrupt, alu H 0];

[nlLovo1

~

(CVOaso);

ChockCV:
call [TliisCV];
ThisCV: WW <- HSII[\~ 0];

~U*******

r "(Zero) - T;
xfTemp ( (Zero).

~n****~*~

pcOkay:

(T) + 1;

End of Alto Code

$**~*****.****~****~********$**~*~~~*******~.*

, xfFrame contains dost

T .. xfFl'ilIIt****lfIttJ$***.\:/fl:t!;,JfIfr:t<·/!:f!1lI1\1'Il;\l**:JI-lI:fI:tI***",*IjII/I ..

***~$***~~**$~*

**

•• ***.*.****~*~***~~.~***¥~**

nop;
• allow page filull to happen before load page
tend:

IHEMP ,. T;
" PC backup 'inLol'\'UPL from bitbl t ()lIte,'s here
r .. (GetRSpec[ 103]) xor (37 Ie); " savo Stkp

MIPondx:

" -int()rl'upt through NOP enters hHro
RT[MP 1 ,. 342 c;
"RS Imaqe
Stkp ~ RTEMPI, RT[MPI ~ T, NoReglLockOK;
• saved Stkp
r ,. Stack ,-- (Stack) and not (IlIlPcndinnllit);
[15232 ... T;
" turn off IntPond inn
Stkp ,- IlTEMP 1;
III .. tlWW;
lu ' xI'WDC, goto[nothing, alu = 0];
T .. r([[MP, goto[Disabl()d, aluIfO];
". load PC backup
[litType ,. T, goto[Dolntol'rupt, alu ~ 0];
PRFlags .. (loro);
• clear flags so that interrupt can or in
its stat().
In case of no pc backup done in Jilt Idle loop
InLType ... (Ie), call[P/Ret];
I ,- (PCrreg)
T;
skip[alu>=O], xfTemp ... T;
PCB ,- (PCO) - (4c);
PC F ,- x FT emp ;
Dolnter,'upt:

r ..

NW\~;

N~JvJ

,- (Ze 1'0 ) ;

WW ... T, LoadPago[OpPageO];
lu" LDF[~JW, 13, 1], lloto[Intel'rupt];
Dis a IJ led: I'e t U'·II ;
nothing: roturn;
*U*~~**~~

Start of Alto Code

***********~*~*~***.*******.****************

-'Ret.urn to Nova.
Hluf eOlltai'!s tho PC at which Nova execution is to begin
Mstop:
NWW'-- (NWH) or (100000c), call[SavPCinFramo];
Ms lopx: task, t ,- currell tstate;
pfetchl[MDS,xftemp];
loadpagefxfpagel], T ... R7ero;
uscctask,callp[Sav()StaLe],rCBHf-T;
HTemp ,. FFaultJ\dd, call [FFS1];
Stack ,. (Stack) and not (lc); • FFIIULT <- "crash on pago fault"
DMAII ... T ... Dc;
SMAil .. T,loadpag()[nePage];
T .. Illuf, gotop[JMP];
*H*******

End of Alto Code

********~**************.*****.***.******.*****

'Start from Nova. T has addrf"lss for LoadStato, xfMX even =) soft boot xfer
MStal't: LOCAL'" Oc, call[FFaultStack]; • LSTFgo loads state from LOCAL+T
Stack'" (Stack) or (lc);
lu ~ xfMX, goto[LSTFgo, R odd]; • FFAULT ... "trap on page fault"
*H*******

Start of Alto Code

*************~****.**~*************.********

Stkp ... Rlero;
10adpagc[xfPage1];
Stack&+l ~ 2c, gotop[xFer];
*n*******
*=*******

End of Alto Code **********************************************
Start of Pilot Codo **~*$**~****~*******~************~* •• ***~.*

10adpage[xfPagel];
Stkp ~ Rlero, gotop[xfer];
~=*******

End of Pilot Code

**~***************.******.*************~*****

FFaultStnck:
RTEMP .. FFaultAdd;
FFS1:
Stkp" RTEMP, rotuI'n;

Page

10

MesaX.mG

3-Nov-79

19:15:63

SavPCinFrame
input rngisters
Mesa PC
output registers
xfMY
holds Xfer SOURCE
LOCAL
holds local base register
temps
RTEMPI

PC, PCF

SavPCinFrallle:
T ... CODE;
T ... (PCfl)

*CODE!1i and PChi ill'O equill, 51) VIC only noed to WOITY about the low wort!
- (T); "15 bits, sillce code segmc,lls aro < 32k.

Start of Pilot Code
HTEMPI ... f;
T ,. PCFre)];

~~******.

~~*~*~~***~*.***~.**~**~~~*~$~~~*~*~*~~~*~*

RTH1Pl ,. (lsh[HTEMPl,l]) + (T); ':'byte PC (ro'intive to C) of theinstrllctioll to b\) cxecuted
"when thh framo Ilext runs.
*~~*~*~** [I,d of ~ilot Code ***~*******~~***.***.~****~***~~*******~*****

Start of Alto Code *~**.*.~******** ••• ~*****.~~**.***~****.*~~*
T ,- 1 df[GetRSpcc[ 127J, 14,31 + T, sk ip[R evon];
RTEMPI «lura)
T, goto[StorPC];
RTEMPI ... T, goto[StorPC];
~H*****·* E11~ of Alto Co do .*****.*************~**.**¢.*~~****~*****~****

~H~*****~

StorPC: Pstorcl[LOCAl., HTEMPl, 1];
t •. LOCIIL;
xfMY ,. t, reLlIl'll;

Page

11

MesaX.mc

3-Nov-79 19:15:bJ

GelL.ink
T

CODE
GLOOAL
HTEMP

fetches control link from global frame
input reg isters
Table ofFset for link
codo base registor
global base register
output registers
will cOlltain link
temps

01'

Page

r;ode 3ea

IHEMP

GetLink:
'Ill <. xfGfHlord , goto[Framelink,R even']; "xfGfiHord was set up by Loadgc when this
'frame became current.
codelillk:
rr ETClll [CODf. ,RTEMP], rotu rn;
Fl'umelillk:
PFETClll[GLOOAL,RTEMP], roturll;

12

MesaX.mc

3-Nov-79 19:15:63

onpage[opPage3];
~lesannFn17:

*EFCO

~

l~EFCO:

@EFCI :
@EFC2:
@EFC3:
(~EFC4

:

(~ErC5:

tIErCG:
0EFC7 :
@EFCB:
(1EFC9 :
@ErC10:
@EFCll:
l~ErC12 :
@EFC13:
@EFCltl:
@EFC1!.i:
(jEFCIJ:

gotop[MesaRefl11], Pfotch4[PCO,rnUF.4j, ot[3777];

EFC16
t ~- (1e)
got.o[ofel"
(2e)
goto[efcr]
t
COOE[304];
OPCODE[305];
OPCODf[306] ;
OrCOOF[307];
OrCOOE[310];
OPCOOE[311] ;
OPCOOE[312] ;
OrCOOE[313]:
OPCOO[[314] ;
OPCOlJE[315J;
OPCOOE[316];
0I'COUI'[31/];
call[efcr']. OPCODE[:J2°1;

t

t
t

t
t
t
t

t
t
l
t
t
t

t
t
L

(-

,.
...
,.

,.

.(-

...
,.
(.

(.
(( ..
(.

...
(-

xfcount
xfcount
xfcollnt
xt'eOllnt
x fCOllll t
XfCOlillt
xfcollnt
xfcOllnt
xfcolllll
xfCOlillt
XfCOllllt
xfcoullt.
xfcount
xfcoulll
xfroUJ!l
xfeount

...
~~

.

(-

...

..
..
(-

(.

,.
,.
(.

,,.

,

.

...

( 4C)
( GC)
( 10C)
(l?C)
( 14C)
( 16C)
(20C)
(22C)
(24C)
(26C)
(30C)
(32C)
(34C)
(36C)
(·10C)
(42C)

OPCOO[[321J
OPCODE[J2;>'j
OrCODF[323]
OPCOOf[324]
0I'COD[[325J
OI'COOF[ 32G I
OPCOO£[327]
OPC()OE[330]:
0I'COO[[331];
0I'COOL:[332] ;
OrCOOE[333];
0I'CODE[334];
0I'CODE[3J5];
OPCODE[33GJ:
0I'CODF.[33/J:
0I'COOF(31\0J:

T' NextOatal:llluf] . OPCODE[341J;
xfcollnt ,- (701'0) I- (t) + 1:
xfcoullt (. Islr[xfcollnt.l] • goto[ 1 fcr];

lfel':
xfMX ... 70['0 • call[SavPC;nFI'ame];
loadpago[xfpagcl]:
xftomp"'(400e).goto[XferGt]:*setllp xftcmp with 2 " Xfel' trap reason

3-Nov-79 19:15:53

~fesaX.mc

·SFC
@SFC:
sFcr:

goto[sfcr],T

~

stack&-l , OPCODE[342];

xfMX .- t , r.i(ll [SavPC inFI'arne];
loadpage[xfpagel];
go toxfe r:
~loto[Xfor]

;

'RET

@RET:

*LLK[l
@LLK[l:

T+-(LOCAL)+(Gc) , OPCODE[343];*codo for XTSreg if Xfel' trap
LoadPuge[xfpagel];
xftc/Ilp'-(lOOOc), callp[Clier.kXferTrap];"setup xftemp Wit~l ;1 • trap rcason in case of Xfer' trap
task,pFctchl[LOCAL, xFMX, 2J;
• Fetch dC9tination link (Qt xfrctlinkoffset)
MetnStat ,- (FrecFrame); • sot FrocF1C1fj .
I oadPage[ xfpagcl], r ~ xfMX;
GOTOp[Xfcrs], xft.fY ,- (OC);
T

~

NoxtData[IAuF] , OPCODE(344];

c ill I [ri e t Li

r

<-

11 k ]

, T (- (L e 1'0)

-

(T) - 1;

HTEMP, goto[PlIshTI'/];

*PORTO
(<)JlORIO: cal"l[SavPCiI1Framc] ,0I'CODE[345];
f ,- stack&-l;
task, xftemp ~ T;
pstorcl[MDS,xfMY];
Lask,T <- (zero) ~ (T) ~ 1;
pftltchl[MDS,xf'MX];
f ~ xftemp , loadpafje(xfpagel];
fjoto[Xfer] , xfMY ~ T;

·PonTI

@PORTI: Stack&+I, OPCODE[34G];
lit ,- xfMY;
fjoto[portinz,alu=O] , T ~ Stack&-l;
p s l 0 ('a L[ MDS , Rz a ro ] , L all [ P 7 II e t] ;
T <- (Illaro) + (T)f 1;
portinz:
goto[P7Taill,PSTOREl[MOS,xfMY];
*KFC[l
OKFCI3:
f

~

NextOata[IDlIf] , OPCODE[347];

kfc 1':
IHEMP' T, call[SavPCinFramc], at[KFCHLoc];
loadpagc[xfpagol];
goto[MTrapJ;
"DESCH
@OESCI3:
T ~ xrCfiWord, OPCOOE[3501;
llTEMP ~ T;
rlcscbcom:
r <- NoxtDato[IBuf];
IlTEMPl .- t;
t ~ (RTEMP) and not (li7c);
t ~ (lsh[nfEMP1,1]) ~ (t) + 1;
goto[P7Tail],stack&+1 ~ t;
*DESC[lS
@DESCBS:
T <- (STACK&-l) l- (xfgfiofFsct), OPCODE[351];
pfetchl[MDS,RTEMP], goto[descbcolll];

Page

14

J-Nov-79 19:15:53

NcsaX.lJlc

·I3LT
@ClU:

LP ~ Dc, OPCODE[352];
t'·MOSh i;

flLfcom:
LPhi~t;

• fi xup: fetch '"> count + 1; 5to,'e =) source-I, dest--i, count+1
NemStat ~ BltFixup,ca1I[BlTx]; • set return addross to 8LT100p;
OtTI oop:

lu .. 5tack&'·1;
, T ,- stack&+I; *get sou,'ce, point to count
stack " (stack) ,- 1; 'decrement count
pfetchl[LP,RTENP];
~tack&+l; "point to dost
T (. stack&·'2; "Het des t, point to SOllrco
pstorel[MDS,RT[MP];
stack ~ (stack) + l;*increment source
Stack&l-2;
Stack <- (Stack) + 1, goto[IlUillt, IlIlPendin!I]; "increlilent dest
stack&-l, return; "point to count, return to BLTloop
goto[8LTdel1~},a'I\FO]

OLTx:

stack&-2;
gotoll'lrall],MemStat ,- Normal;

OLTdano:
OLTdonflx:

[JUint: 10adpage[opPagoO];
BLTstop:
T ~ lc, gotop[NOPint];
*Bl TI.
0BLfl.:

T ~ (Stack&-l) alld (377c), OPCODE[363];
LPdesthi <- T;
T <- lPdesthi (, (lsh[IPdesthi,lO]) + (T) " 1;
LPdesthi ,. (fixVi\[LPdesthi]) OR T;
T ~ Stack&-2, 10adpager6];
LPdest .- T, callp[StackLP]:
I1TEMPl ,. (Zero);
MumStat <- IlltLF'ixup; • fixup: sOI,,'ce~T, dcst+r, count+l
Stack&1-3, cal1[BLTUoop];
• point to COlillt

BUL1oop:
lu ,. Stack;
• read cOllnt, point t.o source 10
T <- I1TEMP1, goto[OLTldonc,a1u=O];
pfetchl[LP,I1TEMP];
Stack <- (Stack) - 1;
• docrement count
I1TfMPl ~ (RTEMP1) + 1;
"incremcnt offsct
psto I'e 1. [Lildes t , HTEMP 1;
goto[OLTL int. [ntPendingJ:
,'etul'n; " gocs to BLTLloop
BLTLdonc:
stack&-3, goto[ULTdonBxl;
OLTLint:
Stack&-2;
call [IlLTLbulllpl; • wait for pagu fault before IIpdat'ing stack
Stile k&+2, Cil 11 [BLTLbllmp];
loadpage[opPagoOJ, goto[BI.Tstop];
BLTLbump:
Stack ~ (Stack) I- (T) I- 1;
Stack&l-l, skip[nocal'l'Y];
Stack <- (Stack) + 1, return;
rotu rn;
'ULTC
@BlTC:

T <- CODE, OPCOD[[354];
LP <- T;
T <- CODEh1, GOTO[OlTcom];

"DUCl
@OLTel: T

<-

sUnimp1emented, goto[kfcl'], Opcode[365];

Pane

15

~lesaX,mG

3-Nov-79 19:15:5J

*I\LLOC
lMLLOC:

T

~ STACK&-l , 0I'COD[[356];
londpage[xfpagel];
canp[illlocSub] , xfATProg t" l;
goto[allocrf,H odd] ,Ill t" xFFI1AME;
PushTP7:
\joto[PlTail], staek&+l·t" t;
1'711.,t:
return;

alloerF:
call[SovPCinFramo];
loadpag.,[xfpogol]:
xFATPl'og t" lsll[xfATPl'eg,2] , goto[DoAllocTrap]:
*FREE
@FIlEE:

T

~ Stack&-l,loadpag.,[xfpogel], OrCODE[J67];
callp[FreeSub], Mp.IIlStat ~ (FreeFI'ome);

P7Toil: lu
I'Hailx:

~

Noxtlnst[IBuf], aL[P7failLoc];
NII1ET;

*Incroment viakeup Oisab'le Countor (D'isabln rntorr'upts)
@IWDC:
goto[1'7rail],xfwdc t" (xfwdc) + 1 , OPCODE[J60];
'"Decrement Wakeup Disable COllnter ([nab'le Interrupts)
@DWDC:
task,t ~ (11400) or (52c), OPCOOE[361];
pl'etchl.[Nova,xft!llllp];
xfwdc ~ (xfwdc) - 1;
t (. xFtemp;
NWW t" (NWW) or (t);
~lotorDvJl)Cnone. alu=01:
"soeir any 'intolTupts
HTTMJl ( J42c;
"po i Ilts to IlSImage
r ( (CeLHSpecllOJ}) XUI' (3nc); " ('ead Stkp
Slkp ~ nIEMI'. RTEMP ~ T;
T ... Stack (- (Stack) or (IntPolldillglli t); 'k sot IntPend'ing
IlS232 (. T;
St kp ,. liTEMI';
, dispatch tho naxt instruction by hand to allow one
• instruct ion without intf)('I'upt
DvJDCnone:
T (. Nex tData[Inuf];
xt"I3I'kllyto ,.. T. loadpage(xrl'ane1];
T ~ xfBrkDyte ~ (xFBrkByte) on (40400c).gotop[doBreakl3ytey]:

'srop
~H*******

@STOP:

Start of Alto

Cod~

~~*~***************.%**************.t~******

~

*n*~*****

SLopStopPC. goto[MstopJ • OPCOOE[362];.
•
Elld of Alto Code *.**~********~**********.****.*$****$*********

~~******~

Start of Pilot Code

@srol':

(- sUnirnplolllented. goLo[kI"cr] . OPCOO[[362];

.=.*~****

[Il~

'CATCH
UITCII:

IBur

of Pilot Code

******~~**.***t*~*

•• ~****.******~*~.~~~.*~*

****************~*********************.**$***

lu ,. NextData[InUF].call[l'7Tail]. Opcode[3lJ3];

Pags

16

3-Nov-79 19:15:63

MosaX.mc

Page

*M[SC - extended opcodes accessed by dispatching on alpha
0MISC:
T ~ NextDnta[IBUF], opcode[364];
LoadPagc[xfPagel], IHEMP .. T;
gotop[.+l], Dispatch[RTEMP, 14, 4];
OnPage[xfPagel];
D i sp[@ASSOC];
~Ii

scTail:
MiscTa"ilx:

~

dispatch on second byte

lu ~ Nextlnst[IBUF], AT[MiscDisp,20];
NIRET;

• Associate - TOS contains map entry, (TOS-i) contains VP which is to get it.
@ASSOC: T .. (Stack&-l), AT[MiscDisp,O};
Call[MopLP], xOuf .. T;
ASSOC1: XMap[LP, xOuf, 0], goto[MiscTail];
• Set Flags
@SETF:
T .. (Stack&-l), AT[MiscDisp,l];
Call[MapLP1, xBuf ~ ~;
XMap[LP, xlJuf, 0];
T .. LSH[xlJuf3,10];
~ Put Flags"card,blkO in loft byte
r .. x[lufl " (RHMASK[x[lufl]) OB (T); ., blkl,l'owiJddl' in low byte
T (, (lEnO) or not (T);
• push old nags & page
Stack&+l (- T;
• push ohl fl,1!jS & page
lu (. (ldf[xlluf3,l1,3]) -1;
• =0 if [;lap ellll'Y ~ VACANT
goto[.'2,ALUII0], xBuf (. (xBuf) nnd (70000C);
'" isolate new nags,
goto[IISS0Cl], xlluf ... T; * Vacant ontl'y, lise old flags, oldpage
r ,- (Stack) and not (170000C); "Get old page numbel'
goto[IISSOC1]. xnuf ,. (xnuF) or (f);
'new Flags, old page
'Subrollt"ine MapLP cr'cates a base register
MapLP:
T <- LSH[Stack,10];
LP , T;'
., Set low' Base
T .. LlIMask[Stack&'1];
!]oto[.'2,R)"O], Ll'l1i (- T;
"
goto[.+2,lIlll)·'O], Ll'l1i <- T;
•
I.Phi .. (LPhi) on ('lOOOOC);
*

i9nol'0 LogSE

pair from a virtual page IIIlmb01' for the Map opcodes,

Set high byte of high base
Set high byte of high base
set bit 1 if 0 is set.

t~iscRet:

RETURN;

;II

one

instrllctiofl to allow I.l'hi to be wl'itten

• Ilead & WI'ite Ram format: stack='l0:43"addr, (stack-l)~'IO:43,
@Ilcadllam:
r (. LDr[Stack&-l, II, 111], IIT[Miscf)i~p,2];
IHEMP ... T;
call[CSRcadJ, T <- lC;
" read 20:37
cnl"l[CSRnad], T ( OC;
* rcad 0;17
call[CSRend], T .. 3C;
" read 40; 43
r " RUMP;
GOTO[MiscTnilJ. Stack'" (LSII[Stack, 1'1]) or (T);

(stack-2}=0:IJ,
., get ncldress

(stnck-3)=20:37.

., Subroutino CSRead reads control ,toro for ReadRalll opcode.
CSRead; IIPCTIISK&IIPC <- IlTEMP;
lleadCS;
r .. CSData. IIf[MiscDisp,22]; ·slIccessor of CSOp mllst be even
return, Stack&+l <- T;
@WritcRalll:
T " Stack&-l, AT[MiscDisp,3];
" got 40:'13, ,address
RTEMP ... T;
T .- LDr [flTEMP, 0, 4 J ;
* get 40:43
LU .. Stack&-'l;
• bits 0:17
APCTASK&IIPC <- RTEMP;
• value of apctask a don't care
WriteCSO&2 ;
LU <- Slack&-l, IIT[MiscDisp,241;
" bits 20:37
IIPCTASK&IIPC <- RTEMP;
"value of apctask a don't care
WritoCSl, goto[MiscTail];
@JwnpRam:
NOP, IIT[MiscDisp,4];
* Filler
APCTASK&APC <- Stack&-I, Call[MlscRet];
, The notif"ied microcode mllst not task until it 'is ready to return to emulator!
CAU.[MiscTailxl, lu " NextInst(IBUF];
%**~.******$*****~***.*$**************~**************. *******

SET[ LllJ[lase, IIDD[LSHlFT[LRJpago ,10], 300]];
MC[VcrsionID,O];
MiscTr'ap:
LoadPago[OpPage3];
gotop[kfcl'] ;
@LuadRamJ :
T .. (stack&-l) xor (Ie), AT[MiscDisp,3];
RTEMP1~T, 10adpago[opPagol];
* save bits, jump complemented
T .. (Stack&-l) and (377c), callp[StackLPx];
pfetchl[LP,RTEMP,O], call[MiscRet];
LU .. (RTEMP) XOI' (VersionID);
T ~ sUnimplemented, GOTO[MiscTrap,aluffO];
T .. (GetRSpec[103]) xor (377c);
RTEMP .. FFaultAdd;
Stkp .. RTEMP, RTEMP <- T;
Stack ~ (Stack) and not (lc);
10adpage[LRJpage];
Stkp ~ RTEMP, gotop[.+l];
OnPage[LRJpage];
LRJenter:
t <- xfTemp ~ lc, AT[LRJBase, 0];
nop, AT[LRJBase, 1];
$
wait for write of xfTemp to avoid bypass problem

17

l.\csuX .mc

3-Nov-79 19:15:53

LllJ1 00[1:
pfetchl[LP ,xBuf2], call [LRJlncCollntJ, Al[LRJflusn, 2];
pfctchl[LP, xOuf J, c,Hodd], AT[LRJ[Jase, 12];
'. odd i f no jump
APCTIISK&J\PC (. (xOufl), cal 1[JlIlllpRet] , J\T[LRJflase, 22]; • set TPC
T <- (GHtRSpec[ 103]) XOI' (377c), AT[LR,lBase, 23J;
rrrEMP (- rFilultJ\dd, 1\T[I.HJBase, 24J;
Stkp , RTEMP, HITMP " T, AT[LflJBase, ?5J;
Stack ~ (Stack) or (Ie). J\T[LRJBase, 26];
loadpagc[ 'II, 1\T[LlUflase, 27];
Stkp .. HITMP, gotop[P41ail], J\f[LllJDaso, 30J;

fOl'

I'etur'n

JumpHet. :

flE
~

rUHN,

AT[LRJBase, 31J;

OnPagc[xfPaOol];
Tho Foflowinq is fol' byte code CLRDov --- clcar all devices and timers

Srf[QDnasc,lshift[C1rDvPage,10]];
SET[Od1oc,J\DD[ODBase,303]];
MC[OdxL,J\ND@[Odloc,377]];
MC [Odxll ,Olll~[ l!jOOOO, J\ND@[Odl oe, 1400]]];
SET[QdretLoc,Add(ODBase,307]];
MC[QdRetl.,AND@[QdretLoc,3 77 1J;
MC(QdRetll,MJD0[OdretLoc,7400]];
@CLllDev:
nTEMP

~

(lOOOOOC), J\T[MiseDisp,4];

1~i\dPngelClrDvPage];

fHU,fP (- (nTEMP) Ofl (16C), gotop[ClearTirners];' clear out all but memory refr'esh
OnPagc[ClI'OvPnoe];
ClearTimcrs:
·Claar out all Timers cxcept one
NOP;
NOP;
NO";
task;
HfSFTMEMEnRS;
·Clear nny pending momory errors
l.U (- (InUW) AND (17C); *t.her'c are 15d timors to be cleared
"fEMP ~ (RTEMP) - 1,GOTO[ClearTimcl's, ALUNO];
1.0ADTIMER[~r[MP];

Odtask: RTEMP ,. OdxL; "Ouiosco tasks 15b to 1
nTEMP ,. (RTEMP) 01' (Odxll);
Staek&~l ~ OdnotL;
Stack" (Stack) 01' (QdRctll);
Odloop: J\PC&J\PCTJ\SK 0 flTEMP;
CLDI'ot: r'etul'n; >goes t.o Odx
Qdx:
Odxy:

APC&J\PCTJ\SK <- stack,call[Cl.Dret], AT[Odloc]; "Notify comes here. Leavo task's TPC pointing at Qdxy.
goto[ClDl'et]; • gets hCl'e if wakeup

Qd ret:

lu .. ldf[RTEMP,0,3], AT[OdretLoc]; *Devlndux points to this location
RHMI' (- (RTEMP) - (lOOOOC), dblgoto[ZapDevicos,Od100p,ALU=O];

ZapDevices: T ~ 177400C;
RTEMP (- Dc,
ZapDloop:
OUTPUT[RTEMP];

*scnd a 0 to all I'egisters of al'l devices, hopefully quiescing them

T (. (zo 1'0) + (T) + 1;

goto[ZapDloop,ALU=O]; • check for non posted overf'low
RTEMI' t- (RTEMP) + 1;
Stkp t- RTEMP 1;
Stack&+l ~ T, loadpage[7];
T t- RTEMI', gotop[PushTP7];
*H*~***·*

End of Alto Code

***********************~**********************

"Read printer
@HPRINTER:
T <- PRINTER, ilt[MiseDisp, 12];
Stack&+l t- T, goto[MiscTail];
'Write pl'inter
@WPRINTER:

PRINTER <- Stack&-I, goto[MistTail], Bt[MiscDisp,13];

19

3-Nov-79 19:15:53

McsaX.lllc

Paye

'Il itULT
BitBLT: Stuck&-l, LoadPugo[bbp2], Opcode[366];
T ~ Stuckl+1, goto[MesaDitIlLT];
·STARlIO
@STARTlO:
T " s tackl-l, LoadPage[HPage], Opcode[36G];
f ~ stack&-t, LoudPage[opPage3J, Opcode[366];
goto[pl'eEESIO], Hrnll'l ... lc; *RTEMPlis tho retuI'1l incl'iC aue , J 0] , 2731:1 ;
Set[mdl'au e ,l1];

"Nova EOlld ator
"Assullies that PC 'is in the base re!listel' PCB and in PCI'.
On elltry,
"PCI' points to t.he First (even) byte of an 'instruction. (jtld entr,Y
"points are neSkipx, neNoskip,
Even entl'ies arc neSkip, IIllflosk'ipx.
"'rhe instruction at locat.ion 1 (fllJfFor'RefnlTrap) is
"loadpage[O], gOl.o[377], , which sends control to locatioll 377
"on lIle pagll that tlid the (abol'tnd) NextIlIst/Next.Data.
He would
"!ikn the instruction at 0 to bn a PFetch4, but alas, D/,2 addressing
"doesn't work, since this is the only casein which an .1borted
"'illstl'uct.ion is not executed ililinediately, and 112 is not loadod
*ill the cycle following an aborted instruction (so the disp'!acement
'won't be loaded).
NovaReFill:

!Jotop[.+11. Pfetch4[PCB,IBUF,4], at[lIel)ase,37l];

ONPAGE[O];

"buffer ruril'! for Nova

PCB (, (PCO)
PCI' ,- RZt::i'o;

~

(4C);

[wUest:
L.oadPa!le[ ilePagf~ 1];
IU ~ NHW, gotop[.+2,R>'O];
onpage[nePagol];
l'eturn;'intol'l'lipts are cJ'isai)'!ed
HotO[.12,ALlJIIO], T ( (111\00) 01' (52C); "stal't base register setup
retul'll; "110 pClluinginterr'lIjJts
DMA 0 T,u5ecLask;
T • apc&apctask,task;
intRTN (- r;
Pfetch2[DMA,~JW,O]; "fetch HH and ACTIVE

r ..

NH\~;

WW .. r ( (WH ) 0 r (T);
T .. (I\CfIVE) AND (T);
GOTO[-intT13,ALUIIO], RTEMP ( T;
NHW" (DC);
*no active interrupts - inactive ones are in WW - clear NWH
PSrORE1[DMA,WH,O];
'store WW, II\SK
APC&APCTASK .. intRTN;
intRET: DMA <- DC, return; 'f'estore the base register
·we are going to start an interrupt
intT8:
T <- INTX (- (lC) ;
*INfX will contain interrupt mask
NWW <(100000C);
·disable interrupts, clear NHW
CAI.L[intT13A] , RTEMPl (- T ;
"RTEMPI win contain interrupt leve'!

index

intTBA:
RTEMP .. RSH[RTEMP,l], GOTO[intT9,R ODD];
T .. INTX .. LSfI[I1JTX, 1]
RTEMPl .. (RTEMPl) + 1, RETURN;

·loop to get number of the highest priority interrupt

intT9:
WW .. (HW) AND NOT (T);

*enter int routine - save other intorrupts in WW
PSTOREl[DMA,~I\~,O],task; 'store WH at 452b, TASK
T .' (ldr[GETIlSPEC[127],14,J]); ·recover the PC
PCB .. (PCB) + (T);
lu .. intRTN, goto[,+2,Rodd]; °intRTN even means we got here from neSkip, and
·we must increment the PC before saving it away
PCB" (PCB) + 1;
T .. (R400) OR (IOOC) ;
PSTOREl[NOVA,PCB], call[intRET];
*save PC at 500b, TASK
T" (RHMPl) + (T),loadpage[nePage];
*T (- address of new PC
gotop[BRlx];
ONPAGE[nePage]
lleSkip:

FF1@[17],

j

cal1[eSkip]; *lloSkip is evoll

/Jova,me

3-Nov-79 19:16:53

l1oNoskip:
]'<- CNcxtData[HJlJF1. ea'll[neSl], at[noNoskipl.ocl: "neNoskip L; odd
Dispateh[RTEMP,lO.:l], gotopJESx]: *dispatch 011 f'il':;t, :) bits of OpCOdH

lIoSlcipx:

rJ0to[noSkip]; 'noSkipx is odd

neNoskipx: goto[neNoSkip]; *ncNoskipx is even

oSKip:

FF1@[lJj. goto[neNoskip]; *can't cause burror rofill

Paue

3-Nov-Y9 19:]6:63

Nova.me

Page

"SlJBROUTINE nesi does setup for 2Acc;instructions, calculat.es ofF,jctive addl'css
'for lAce instruct ions,
Rotlll'ns R addl'css of IICO in 1'.

neSt:

IH01P ..

T,dbl!Joto[n~)2I1cc,llelAcc,l1?hit.8]:

ne2l1ec: PCr[IBUf] " l'cy[PCFlIAUF],3]; "put NoLoJd bit int.,.} bit Hi
neSlret:
T (. rIlCO, rotUl'll: "pointel' to ACO
nelAcc: Dispatch[PCF[IrlUF],5,4]; "get EfFective /Iddl'cs:; - dhpatch on I,X,and disp.O (16 \-word block above (i.e. NI1ROS),
"The high halves of bilse reg'isters St4A ulld DMA (l1'e asslifiled to bo set up.
CONVERT:

T ~ ldf[PCF[[DUF],IO,10],AT[NEXA,7];
*Jisplacement
T ,- (AC2) + (T) I- 1;
PFETCH1[Uova ,ACl], call [AC3toT];
"fetch dlJU
PFETCHl[Nova,HTEMP];
*fctch selF-relative pointer to xw
f<-J.\CO, fASK;
DMA f- T, FF1@[17];
*setup I'or later, iHlllance PC
Tf'fHEMP; ·self·-re·lative pointer to xw
f'-AC3'(AC3)+(T)+1; "add pointe!'
PFETClll[Nova,xnXII];
'fetch hd, ,xh
ACl (- T ,.
(ACl) AND (llC), TASK;
*mask dba
RTUW ,- 16C;
HTH1P , (Rf[MP) - (T);
r, Er /\d, CA L L[ 1'1 XDM/I]; 'D~IA"DMA + (hd" xn N\>JIlDS)

FIXDMA: xnXII' (xnXII)I-(17"l400C);
DMA'-(DMA)+(T),GOTO[DMAfixed,ALU~O];
PStol'o-1LDMA, xlluf, OJ, nOlo[CVXx]; 'soul'ce exhau,ted
f .. WrA[AC3]:
"source cont.l·ibut.ioll to sccond dest word
XBI • (XflI) + 1, goto[xnCVX, IILU'O]; "if it is zero, we are done
III ,- 1dfrXBI,16,2]; "check whethel' we are sti"ll in the qlladword
Stkp' XBI, noto[doSingleWord,ALU~OJ;
Stack ,- (Stuck) or (T), gOLo[xnCVx]; "OR the second Dest word
uoSingleHord: Pfet.chl[DMA, xnDEST, 1]; "fetch socond dest word
call[xnPG2flET];
xnDEST ( (xIIDEST) or (T);'50 XflDEST will be written
Ps to re 1 [DNA, xnD[ST, 1'1 ,ca 11 [xnPG2 HET]; 'UGH
nop; "allocation cOllstraint
xnCVX:
CVXx;

PStore.-J[DMA,xflllf,O]; 'stol'e buffer
T (- [fAd; "get NWRDS
DMA(' (DMII) + (T), GOTO[ xnCVLOOP];

xnCNVEND:
AC3 f- HSH[AC3,l],
AC3toT: T f- AC3, return;

%
xnCVLOOP;

xnCVX:
CVXx:

dblgoto[NoSkipx,l1eNoskipx,Rodd];

SMMTf-(SMA)+l;

PF ETCHl[ 110 va, AC3], CALL [xnPG 2 RET]; • fetch sou ['ce
xnXH"(xnXII)-t,GOTO[xIICNVEND,R(O]; "test count
PFETClll[DMA,xnDEST,O]; "fetch destO
CycleControl ~ AC1,task;
T ~ RF[AC3]; 'source contribution to first dest word
xnDEST ~ (xI1DEST) or (T);
Pstorel[DMA, .xnDEST,O];
CycleControl ~ RTEMP, goto[,+2,R>=0];
T ~ Eflld, goto[CVXx];
T ~ WFA[AC3];
'source contribution to second dest word
goto[xnCVX, ALU=O];
Pfetclll[DMA, xnDEST, 1], call[xnPG2RET]; "fetch second dest word
xnDEST ~ (xI1DEST) or (T);
Pstorel[DMA, xIIDEST,I];
T~EfAd; °get NWRDS
DMA~(DMA)+(T), GOTO[xnCVLOOP];

xnCNVEND:
AC3toT: T
%

~

AC3,

IIC3 ~ RSH[AC3,1],
relurn;

dblgoto[NeSkipx,noNoskipx,Rodd];

8

3-Nov-79 19: 15:53

tlova. me

'ExtDn~ed

DIR:

Opcades with no

displac~ment

or parameter

Nlvl'J (- (flJl-lvi) OR (lOOOOOC) ,goto[CoIilRetl. AT[NEXB,O]

EIR:

T ~ (Ri00) OR (52C),goto[EIRcomj, AT[NEXO,l];
ElHcom: I'fETClll[Nova ,vi"i I, CALL[xnPG2RET];

!:tRz:

BRI:

BRly:
BRIx:

IlCLK:

T .-

~J\.J;

NWW

0

(NWW) OR (r);

NWW

~

(NWW) AND NOT (lOOOOOC);

PCF[IOUF], dblgoto[EIRz,ORIy,Rodd];
T ~ PCB, cafl[GPCl]; "ETR must test
r ~ T, goto[JMP];

fOl'

*etr

interrupts NOH.

"di r - ()IOOO

61001

~Ie

T .- (R400) OR (52C), goto[EIRcom], I\T[NEXO,2] ; ~bl'i - 6100?
T .- (1l400) OR (lOOC);"fetch PC FI'om 'focation 500
PH rClllr.Nova, EfAu], CALl,[xnPG2RET];
T

~

[rAd, goto[JMP];

T

<-

(R,100) OR (JOe), AT[NEXn,3] ;

$rclk -

610\13

PFETClfl[Nova ,AC01;

fHEHP " (32!jC),TASK; "Get flTCLo\~ from task 16's R's
IlTU4P ... (35t.C).TASK; "Get RTCLOW from task 10's l1's
~ RTEHP;
T ... LDF[STACK.l,12],GOTO[xnNRDOVF,R>=0];
STKP

°tho low bits overflowed. but tho uisplay
*haun't Botton al'ollnd to updat inq the high bits yet.
I\CO .- (I\CO)+1;

xnNHDOVF:
SID:

ACl

~

T. goto[ncNoskip],FFl@[17];

T .- ACO. 10adpageropPaqo3-j. AT[NEXU.4]; ;'sio
I1IEMPl ... Dc, gotop[preEESIO]; 'I1T[HPl~O means return to Nova

simulate .1M1' .+1

~Jova,

mc

3-Nov-79 19:15:63

"[]LT and []LKS
·slow straight forward blt with no check'ing fOl' source alld dost overlap
registers:
racO
address of f'irst source Y/ord - 'L (OLT), or dat.a to be stOl'OU ([]LKS)
racl
address of last destindtion word
rac2
ullused
rac3
negative word count
- GlOnS
ACO ~ T ~ (ACO) +1, AT[NEXB,5]; Obit
Pl'titchl[Nova, frrEMP], ca'I', [xnPG2RET]; "'fetch 50l.H'CO
III (, AC3;
AC3 ~ T (- (AC3) + I, goto[Bldono, AlU~O]; "tGst GOUlit " 0 alld illCl'fJlIlent it
T <- (I\Cl) ,~ (T), loadpage[OJ; 'form destination address
Pstol''.)l[NoVCl,IHEMP], callp[1nt.TestJ; "tho l'fJturn link must be odd, so that if an 'intor'l'upt
"occurs from IntTest, the saved PC will not be incremented .. ,
PCf'[IBUF], dblgoto[FllTxx,BLKSxx,Rodd'I, al[lief:};Jso,7]; "thus, t.lds iocation must be odd
BITxx:
ACO" T (, (ACO) ~ 1, goto[fH,Tx];
BLKSxx: T <- ACO, gOLo[BLKSx];
"flU

nu:

ULlx:
Bloop:

[]Ldone: AC3 <- OC, goto[ComRet];
"BLdolle:
AC3 (, OC, goto[STA((I;

'STAq rerills IIJUF Mid advances PC

"fll.KS - 61006
nLKS:
r ~ ACO, I\T[NEXU,6]; °blks
Bl.KSx:
RTHIP ,- T, goto[Oloop];
"SIT- 61007
"SIT:
GOTO[xIIUIUMPTRAP], AT[NEX[],l]

'sit

JMPRAM: T'" 20c , AT[tJEXB,10] ; *jmpl'am - 61010
III ... (rhmask[AC1l) xor (T) ;
T ... ACO, goto[NEtoMesa,alu~Ol
GOTO[xIIUtJIMPTRAP] ;
NEtoMosa:
GLOfJALhi " OC; "Initialize
LOCALlli ... Dc;
HFMSTAf <- Dc;
xfXTSReg ,- Dc;
MDS {- Dc;
xfMX " Ic;
TickCoullt " 3c:
xfTemp " T, LoadPilge[7];
MDSlli ~ Dc, gotop[MStilrt];
COIliHet: GOTO(neNoskip], FF1@[17];
HDIl/IM:

som~)

Mesil Emulator reg"isters

"common ending forinstnlctions which advances PC

ACO'- (LUlU) - 1 , GOTO[ColI,RetJ, AT[NEXB,l1];

WRTRAM: GOTO[ComRct], AT[NEXB,12];

"n]r'ilill - 61011

'wrtr'am- 61012 (nop)

"dirs - 61013
D[RS:
rrl@[17J,I\T[NEXB,13];
NWW'" (NWW) or (IOOOOOC), dblgoto[neNoskip,lIcSkip,Rin ACO
OIV:
loadpagc[mdPagc],T ~ AC2, AT[NEXC,l];
r.anp[Divido], LlJ'" (ACO) - (T);
"d>iv
FF1@[1I],lu ,> nCNT,dblgoto[neSkip,neNoskip,Reven..l; "Advanef) PC

llNPAGE[lIldPago] ;
Divide: dblgoto[noDiv,doO>iv,carrY],I1C1H"
noDlv:
return; "BCNT odd means no skip

doDiv:

17C;

lIsectask;

r " apc&apctask;
flTEMPl" T; *save link
T ~ AC2, ca11[UDIVenter];
1u ,> rcy[Cill'l'y,1]; ~loop RETURNs to here
ACO'" (ACO) - (T), dblgoto[UDIVlt,UDIVlf,ALU (lsl1[AC1,'1]) -I- 1, dblgoto[UDIV3t,UDIV3f,H rnFMP1, goto[LJDIV4f];
APC&APCTask .. RTEMPI. goto[UDIV4f];'

ONPJI.GE[noPage] ;

3-Nov-79 19:15:ti3

Nova.me

"OIAGNOSE1:
'xnXC02:

GorO[xIIUNH1PTRAPj. /ll[NEXC. 2J ; "diarJflosol

*DtAGNOSE2:
·xnXC03:

GOTO[xnUNIMPTRAP]. AT[NEXC.3]

;~diaglluso2

BIlBLT: T ~ Novnh. LoadPage[bbp2]. AT[NEXC.4J;
AC3 ~ T. gotop[NuvaBitBLT]:
GOTO[xnUNTMPTRAP].
GOrO[xnUNIMPnU\p].
GOTO[xnUNIMprRAPj.
GOlO[xnUNIMprRAP].
GOTO[xnUfIIMPIHAPI.
GOTO[xnUNIMPTRAP1.
GOIO[xIlUNU1PTRAP],
GOTO[xnUNIMPTRAP].
GOTO[xnUNIMPTRAPI.
GOTO[xnUNHlPTRAI'],
GOTO[xIlUNIMpTRAP].

'xnXC05:
'xnXCOG:
'xnXC07:
'xnXCIO:
*xnXCl1:
·xnXC12:
"xnXC13:
'xnXC14:
·xnXC15:
'xnXCIG:
'xIIXC17:

AT[NEXC.6] ;
AT(NEXC.6] ;
AT[NEXC.7] ;
AT(NEXC.ID]
AT[NEXC,ll]
Af[NEXC.12]
J\f[NEXC,13J
AT[NEXC.14]
AT[NEXC.15]
IIT[NEXC ,161
AT[NEXC.17]

save the current pc + 1 in memory location 527b
and jump to location po·inted to by location 530b + in5t[3.1]
xnUNIMPTRAP:
r ,. (ldF[GETRSPEC[12/],14.3]) ~1;
PCD ~ (pCO) + T ;
r.- (R41)0) Oil (InC) ;
fASK . PS10Rf1fNova,PCD]
f ~ (1l400) OR (lJDC) ;
T ~ (ldf[PCF[IBUF].3.5]) + (T). goto[RRlx];
EtlD;

Page

L3

Occup1edDcfs.mc

J-Nov-79 19:16:53

* Standard preamble for xxxOccupied.mc files produced by MicrjQ
• last edited April 23. 1979

3:41 PM

Insert[DOLannl;
NoMi das III it; lar:gVe rs -i all; Ml.IltDIO;

3-Nov-79 19:15:63

Ove rl ay .me

BUILTHI[i lise I't ,24];
insert[dOlang];
NOtHDJ\SItIIT;
LMJGVEHSION;
MlJLTOIO;
insert[GlobalDefs]; "task and page assignments
TITLE [Ova 1'1 ay] i
~last edit by Chang, J\ugust 13, 1979
3:07 PM, RDC Intei]I'ation
* edit by Jollllsson, June 15,1970 3:24 PM, new reyistel's
'odit by Chang, .June 4, 1.979 2:09 Pt~, For MlOJ\S Overlay booting
"edH by Challg, May 27, lain 6:3n [>1-1, for Overlay boot!ng
'euit by Johlls~on, May 15, 1979 3:27 PM, PNIP f-ix
*cdH by C1111n\) , May 10, 19i9 8:31 I\I~, add new Ethernet 10
"edit by Sandman, J\pril 6, 1979 3:50 PM

"Modified March 6, 1979 by CPT. /\dded fau'l t

handl ing

nV[I'linkO,34]; 'subroutine I'eturn link
"Rogisters for othor sections of initialization
RV[xCNT,20]; 'used evorywhere
nV[DevIndex.211; "used in Deviceln"it
nV[contemp,22]; 'used in DevieeInit
HV[initrO,40]; 'used in DiskOoot
HV[in'itr1,41]; 'used ill DiskOoot
I1V[illitr2,42]; "used ill DiskOoot
HV[inilr3,43]; 'used 'in DiskOoot
IlV[ErrorCnt,44]; 'used in DiskOoot
nV[El'I'orCollntx,45]; "used in DiskBoot
RV[tcmp,51];
INS[f{T[DMdefs];
SetTask[O];
• MC[NcxtDiskJ\ddr,237];
HV[OootOiskl\ddr,37]; 'RDC Integration
MC[CSMemStart,4000];
"telllpor'ary memory startill!) addl'oss fOl' CS 'image
I1V[MemJ\ddr,51];
'" current addl'oss for CS image
nV[VersionID,52J;
"Maintenance Panel Normal Operation Codes:
MC(StartDisk[Joot ,1/0]; °120d
MC[SystcmRunnillg, 202]; o.l.JOd
"'Maintenance Panel Failure Codes:
MC[NotEnou\)hMemory,145]; "101d
MC[tlilrlMap, 146]; *102u
MClNoUiskStatus,lll]; '121d
MC[[Jad8oot,172]; "122<1
SEfTJ\SK[O];
OIiPage[ Ini t.Page];
OootSccondOlock:
LoadPage[LoadCSPage];
gotop[OootSOlock];
OnPage[LoadCSPage];
llootSBlock:
xcrn (, rraul tJ\dd;
stkp<-xOIT ;
LlJ (- (stack) and (40000c) ;*check Midas Present bit in FFAULT
goto[l3ootLoader, alllIlO];
MemJ\ddr ~ CSMemStart;
'" Skip VersionID at location CSMemStart (4000)
ClearMPanel; .** ••• ~ •••••••••••••• ". remove this word after testing
xCNT<-NextOiskJ\ddr;
stkpf-xCNT;
tf-stack;
"get next disk address from reg 237
t f- OootDiskJ\ddr;
'set next disk address fl'om reg 37
xCNT<-t;
OMi\<-( 1000e);
"dcb addl'ess
psto l'el[DMA, xCNT, IOCODi skAd r! J, ca '1'1 [LoadCSRe t. J ;" next dis k add res s
readnextblock:
IncMPanel; " •••••••••••••••••••••• remove this word after testing
ErrorCnt(-( lac);
sotdcb:
Oevtndex <- (zero) - 1
inHrO f- Oc;
initrl<-Oc;
initr2<-Oc;
pstore2[DMA,initrO,IOCBNext],call[LoadCSRet];
initr3f-Oc;
tf-(R400)or(120c);
pstore4[Nova,initrO],call[LoadCSRet];*clear disk communication cells
xCNTf-(zero);
"disk status
pstorel[DMA,xCNT,IOCBStatus],call[LoadCSRet];
xCNTf-(44000c);
·disk commBnu
ps to rc 1 [DMA, xCNT, IOCBConlinand], ca 11 [LoadCSRet];
xCNTf-(1400c);
*header address
pstorelLOMA,xCNT,IOCOHeaderPointer].ca11[LoadCSRet];
xCNTf-(2000c);
*labe1 address
pstore1[DMA,xCNT,IOCBLabelPointer],ca11[LoadCSRet];
xCNT~(3000c);
"data address
pstorel[DMJ\,xCNT,IOCBDataPointer],call[LoadCSRet];
start the disk
startdisk:

Page

Overlay.me

3-Nov-7Y 19:15:63

initrl'-1000c; * VianI 521 --, IOcn point~r
"initrJ<-(zero) - 1; ~ WOI'U 523 " -1 to Force a seek
t~"(n400)+( 120c) ~ • store into 520-523 (WOI'US 0 and
uro lel'o)
pstore4[Nova,initrO], call[LoadCSnet]; ~ucb address
wait for completion
Ei'l'orCountx ... 20c;
SelDW: Dovlndex ... (zoro)-J; 'loop count for status Vluit
WuitDisk:
Pfetchl[DMA,xCNT,l]; *felch status word at IOOth
T ,- l'lC, call[LoadCSRot];
III ." (ldf[xCNT,Il,'lJ) xor (T);
qnto[Statllsliere,i\LLJ"O], lu (" ldf[xCNT,lO,10];
Uevlndcx .- (Dovlndex)-l;
goto[WaitDisk,ALUHO]:
Er'l'orCountx (- (ErrorCollntx) -1;
goLo[SetDW,ALU)=O]:
LoadPoge[InitPage]:
T (- rJoDiskStatlls, gotop[IIl'itFail]; "l"imcd alit waiting for disk to storo status
StatusHere:

dblgoto[NoFaultStatus,IncECollnt,ALU:O],FREEZERESULT;

NoFaultSLatlls: IIOp;
call(loadmi];
goto[rcodnextblockJ;
IncECoun t:
[ I' 1'0 rC II t ... ([ r 1'0 rC n t )-1 ;
goto[lailOoot,ALU < OJ; "had headol', tl'y again
goto[OooLSBlockl;

FallBoot:
LoarJPiI!le[InitPage];
r ... BodOoot, gotop[JnitFail];
OnPoqc[InitPaqe];
LoadOt he rCS:
Loodl' agee LoadCSPagc 1;
xon (- FFaultAdd, gotop[,+l];
OnPage[LoadCSPilgo];
<-- xCNT;
LU'- (stack) and (tlOOOOc); "check FOI' Midas Presellt
goto[MidasPilusD, oluND]:
LPhi (- zero;
II' (, CSMDIllStart;
Rr[l.lPl (" zero; * ,JUIJIP nag
LoadPage[LRJPogn];
gotop[I,nJenterl:
~tkp

loadnl'i :
lIsectosk;
t<-apc&apctask;
r"1 in kO' t;
contclllp"'(3tlOOc);

*Iast address

~

1

of disk data

nextmi:
t<"cont.emp<-(contcmp)-l:
pfetcltl[Nova, init r2] ,call [LoadCSnot];
L( contcmp<-(eontelllp) -1;
pfe te It 1[ Nova, in H,I'O] ,CiI 11 [LoadCSRet];
t ~ ldf[initr2,0,ltl):
in it r3·-t:
t( cOTlt.ernp'-(contemp)-l;
pfCLcltl(Nova,initrl],eall(LoarJCSRet];
Mcmi\ddr <- t " (MemAddl') ... 1;· copy into memol'Y
pstorel[Nova,initr2].call[LoadCSRDt]:'write into memory
MCllIl\ddr <- t <- (Memi\ddl') + 1;* copy into lIIemory
pstorel[Nova,initrO],call[LoadCSRetj:"write Into momory
MemAddr ( t (- Ulcmi\ddr) '" 1;" copy intn mernory
ps to rel[Nova, in it 1'1 J ,co 1'1 [Lo'ldCSRet J; *vlI'i tei lito melllO I'y
lu<--(lnitr3)xnor(170000c);
·look For rn-i address
7777
goto[TransFerDone,alu·O];
t, Idf[contemp, 7,10];
""look for mem audress ~ 3001
goto[nextrni,alu#O];
t<--(2000c);
pfctchl(Nova,xCNT],call[LoadCSRet];
nap;
pstorel[DMA,xCNT,IOCODiskAdr!],call[LoadCSRet]:·next disk address
apc&apctask<-rlinkO;
LoadCSRet:
Return;
TransferDone:
t<-(2000c);
pfctchl[Nova.coQternp], call(LoadCSRet]; "get next sector address
xCNT <- NextDiskAddr;
stkp.-xCNT;
T <- (eolltemp);
stock <- (T); * save the next disk oddl'ess
BootDiskAddr <- (T); " save the next disk. address
GOTO[BootLoader];
Boot Loade r:

LoadPage[ I ni tPage];
gotop[DiskBoot];

MidasPause:
MidasWait:

NWW <- (IOOOOOe), :
BreakPoint, goto[MidasPause];

*.~**.**

•• "***. added the following for overlay, will be over-writton later
OnPage[LRJPage];

Set[LRJBase,Add[lshift[LRJPage,10],300]];

3-Nov-70 19:15:5J

Ovorlay.me

LRJentor:
t ~ xfTemp ~ lc, AT[LRJOase, 0];
nap, AT[LflJOase, 1];" waH for Wl'itd of xfTemp to avo'id bypa~;}; pl'ob'lolll
LrtJloop:
pfetchl[LP, xOuf2], cid 1 [LRJIncCollllt], AT[LRJOase, 2];
pfetchl[I,P,xOuf],cull[lRJIncCount], AT[LRJDasD, 3];
pfetehl[LP,xllufl],call[LrtJIncColJnt], AT(LR.JOase, 4];
r 1- 1 or [x B1I f 2 , 0 , 14], AT [L BJ na so, 5];
• au d 1'0 S ~>
xBuf3 ~ T, AT[LRJOaso, 6];
III <- (xBur3) XNOR (170000c), at[LRJBaso, 7]; *look for m-i address
7777
T <, xBUf2,!JoLo[RilIilLoaded,alu=0], I\T[U1JDase, 10];
UJ (- xUuf, AT[UUlJaso, 13];
IIPC&I\PCTIISK (- XBlIf:J, IIT(LRJBasc, 11];
WRITECSO&2, IIT[LRJBase, 14];
LU ~ xOurl, IIT[LRJOaso, 15];
I\PC&APCTASK (- xOur3, IIT[LR,1Oa50, HI];
WRITECSl, I\T[LRJOasD, 17];
T <- xfTomp, goto[LRJloop], AT[LRJOaso, 20];
LRJIneCount:
T (, xfTomp

~

(xfTemp) + 1, goto[,JlImpRet], AT[LI1JlJase, 211;

R'llilloadod:
HTEMP1, GOTO[,1-2,Roddj, IIT[LrtJflaso, 12];
" oud if no jump
IIPCTiISK&I\PC <- (xBurl), eall[JulIlpllotj, IIT[LRJflase, n'];' ~et TI'C for I-oturn
T <- (GotRSpoc[103]) xor (377c), AT[LRJDaso, 23];
RTEMP ~ rFnu1tAdd, AT[LRJDasc, 241;
Stkp ~ RTENP, RTEMP ~ T, IIT[LRJUase, 25];
Stack ~ (Stack) or (le), IIT[LRJUase, 26];
lo~dp~gB[4], IIT[LRJUaso, 27J;
Stkp ... RH~lP, gotop[PHni1J, IIT[1.I1JOase, 30J;
IIOp. IIT[LRJEJase, 2t];*",·"u··wi11 be ovcl'--writtnll 1ator
IIOP, goto[.], IIT[LRJOase, 30];,*"u··**wiI1 be QV<.)I--wl'it.tcn latOI'
JUlllpRot:
R[TURN, IIT[LRJflaso, 31];
follow'ing are for linkiloe, wi'11 be ovel'-wl'itLoll lat.er

KFer:

OnPage[opPage3];
goto[,], ilt[KFCRloe];

P7Tail: goto[,], at[P7Tai1loc];
OnPage[xfPilgel];
Loatlge: goto[.], ilL[Loildgeloc];

neNoskip:

tNO;

OnPane[noPage];
goto[.], at[noNoskipLoe];

Page

3-Nov-79 19:16:53

flDC.me

F "j "10 ROC. me
L<\st edit hy Jim Frandeen October' 1-1, 1979 0: 12 PM
This vnr'sion pro"loads 16 VJords fol' write opel'ntions.
*~~$$*~.*.~*.$**~.~~***$***~*~.*.*.~*~**.~*~~.~$*~*$**~~~*~~*~*$.~*

Insert[HdcD'1fs];
IlTLE[ Hi!) i dD is kCon troll 01'];
SET TASK[RdcTask];
ON PAGE[RdcPagoJ;

*currontly l1b

9d

HdSectorWakeup:
%Como horo ovory time we get a sectol' wakeup. We g,~t a soctor wakeup at tho ond of ovel'y data sector. 138:1 sectors go by oVf)ry ~e<:olld, s
.,~() we get a wakoup ovory 123 microseconds. l=O];
"Viell, it's time For 0 break." TheFaee says to knock it off fo,' a wll"ile and not process any more JOCBs until he gets thill!l~ fi(Jllred out.
"\OJe could get out of here Cluicker ii' we didn't have to check Synch. But we must check it cvol'y time, oven if there is Ilolllin!] to do. The
"'I"oce will nol be sdtisFieu unless we say "[ Got it" by sel.ling tiH 0 of th<: controller word "in tho CSB,
r'(lldcCSOptr)+(HdcCSBcolltroller);
"Set displacement to store S:/nch.
Pstol'el[RdcZeroBaso, RdcSYllch]; ·Store <0 in csb,contro'llOf'.
GoTo[lldClearWakeup];
RdIdlel:
·Come here if Syncll is not negative. We might have work do. Test 10CBptr to sec if it is non-zero.
f(,f1dcIOCOptl';
"'T points to roCB.
I1dldle2:
·Come here from Cha"ill when a cOlllmand has been processed, and seo if thel'e is another IOCIl waiting.
I1dcStale~RdcIdle,

Gofo[RdNewIOCO,ALlJnO];
"If 10CB is waiting
NOP;
·Placement constraint
"Wen, shoot, thel'e is nothing FOI' us to do this time. Oh well! Look al the Synch ViaI'd a 1111 see if allY ~lesa processes neue! to be notified
"about this soctor wakeup. If 1I0t, sUp the cal"! to DoInt to save timo. We need to split as fast as possible and give the machine to sam
""eone else.
RdEndSectorWakeup:
*Synch could be lIsed to schedule Mosa processes that want to know about this sector wakeup.
Since Pi"lotis not currellt Iy us ing tilis feat
"ure, this has boen is disabled to save space.
Tho Following con~ents could be removed to ollable the feature for Pilot. IF DOL,ang would
*. anow more than one ComChar, we could make this a comditional assembly!!
%"·*******Stal't of Pilot Sector \IIakeup Code*-*"**"*"*"'"'''''-'''''
I"'(HdcCSBptr)+(HdcCSBsynch);
Pfetchl[RdcZuroOasc, RdcSectorSYllch];
"Fetch Synch wOI'd fl'om CSB.
lUf-RdcSectorSynch;
GoTo[l1dClearWokeup,ALU=O];
"IF Synch is zero.
T... (RdcSectorSynch) OR (RdcAllowTask).
Call [RdTas kI FNotZe r'o];
LoodPage[O] ;
CallP[Dolnt].
·Set NWW and IntPending; uses registers 0,1.
IOStrobe;
"Terminate the wakeup
"Continue here after the next sector wakeup.
Input[RdcDiskStatus, RdcStatusJ. "Road status r'eg ister' from control 1 er.
GoTo[HdSectorWakeup];

·!·**·····Start of MicrocodeDriver Code······ .. ····*·············
T"'(RdcCSBptr)+(RdcCSOsynch);
Pfetchl[RdcZeroOase,RdcSectorSynch];
"Fetch Synch word from CSB.
RdcTemp~l1dcWakoupReg;
"Load address of NWW.
T'-(GetRspoc[103]) XOI1 (377C);
"Save StkP. right side up.
Stkp"RdcTemp,
RdcTemp"'T;
·Set Stkp to NWH, save old Stkp in Temp
T"'RdcSectorSynch;
*Get bits to OR into NWW.
Stockf-(~tack) OH (T);
*Set f!WW.
Stkp"'(RdcTemp), *Set DriveChange to zero
Call[HdTasklfNotZero]j

HOC.me

3-Nov-79 19:15:53

Page

HdC loa r~Ja keup:
·Terminate the wakeup and go to sleep Linti'! tho lIext sector' wakeup.
r.all[HdStrobo];
"Continue hore at tho next sector wakeup.
InputLHdeD iskStatus, HdcStatlJs], *Hcad status reg"istol' from cont roll el'.
GoTo[ HdSoeto I'y!akeup];
HdNewIOCB:
°Boy, Wow!! We have sonwth"ing to do! Time's a wast'n! When tho Contl'o1"lor turns on OUI' wakoup lJteh, we are oilly 56 bytes fl'OIil the seeto
We on"ly have 60 ndcroseeonds aftel' sector wakeup to gct "nady and send a cOllllrland to the COlltr01"ler. No telling how much time tla
**s ill ready gone by. We didn't get Ollr wakeup call lInt"il we 'IIorn t.he highest priority "';ask. And the evil DiskControllcr runs at a higher
""pl'iorit.y task love"l. We have already executod 9 instructions since wakeup. If the Iloader shu\'ls up before we sfllid the command. we will !J
"'*flt lOAtten and ServiceLate. And you know what that means! ~Jo win have to wait ono more disk revolution. AnJ TheOut:;ideHorld will not b
"*e pln.'lsod!
"A I'ule of the game is that we have to task to g"ive up control of the CPU aftol' every dozen or' so microinstr·uct"ions.
Wo mllst task twice
·'before we can get ollr command ready, and once lIIore before VlO send t.ile hendel' data t.o the Controller. And we don't know when we will get
'* scheduled again aFtor a task. Tho Bvi"1 DisplayController is a gluttun for CPU cylces. IF we don't t.ask oFten enough, tilu display will
"'n icker. And the Out.s ideHorld win I'ea"lly be pissed! At the same Virne, the sector mark is less than 60 microsoconds awn"y. So we better
'*hLII'ry! Try to avoid branches that causo bUI'ps, and beat "it down to State DataTransfel'.
-r and IOC[Jptr point t.o tho new 10([1" Fetch the llew tlisk adtlress fl'om thp. fil'st two I'/ol'ds of the IOCFl into NewDI'"iveCylinder' anti NewlleadSe
"clof'.
next twoinstruct"ions calculate a pO"intflr to CSn.t1iskAddl'ess[of the drive VIe are about to access].
Pfetch2[HdcZeroOase,RdcNowDriveCylinder];
"''''I' mark.

'"0

T' (RtlcCSl3ptr)+( HtlcCSBd iskAddress),
Call[RdTuskIfNotZeroJ;

*T points to CSU.diskAddrcss[drive 0].

r<-(lDF[ HdcNewDrivoCy 1 i IIde 1',0,2]) +T;

'T point.s to CSIJ.cihk,'ddr·css[current dl'ive.l.

"Thel'e wa~ our f"i rst task sw"i teh after 12 instl·uctions. Hero we go aga"in.
LLJ'-(HdcDiskl\ddressPtr) XOH T;
"'Test For drive change since last command.
HdcDiskAdc1ressPt.r·-T,
·Updat.o pointel' to CSO.diskAddrcss[dl'ivo].
SkiprAIU~OJ;
"If no drive change.
HdcSlilte'HdcDI'iveChange;
"New drivo this wakeup.
''1etch the curr'ont cyl illdel' addl'css of lho dl'ive we arc about to rofertJllce
I' fe t c h L[ Hdcle roUas e, HdcCulTen lCy"1 "i II de 1'];

fl'OIll

the C513. This win bo set to -1 if we must recalibrate.

"'Send the drive and Iwad to the cOlltrollcl'. Drive isin tho two low ol'der b"its of DiskAddressPtl'. DiskAddressPtr
*"s[{lrive]. IIeudis "ill NewiieadSoctor.
T'"(LDF[RdcNewlleadSector,O.lOJ); "lIead Is in hits 14-17
T'-(LSllr1hlcDiskAddl'essPtl',4]) OH T;
'"Dr'ivo is in bits 12-13
Hdc I emp'"T;
Output[HticTemp, HdcDrive/llead]; 'Send drivo and head to cOlltrollel'.

poill~s

to CSB.ciisUlddres

'See "if the drive has changed since the last commalld. The State wi 11 be Idle (an even state) 01' OriveChallqo (all odd state)"
LU<-(HdcState),
"This is ollr First obstaclo, If the dr"ive has changed sincH the last cOlllmand, we will have to wait for the Controller to tell us the new
"drive is ready.
Guro[lltlDI'iv{)CllaniJc,H Odd];
"'IF drive change
IldDI'iveHoady:
"The drive has not changed. See i f we need to recal ibr'ate.
LU'-( HticCu r rontCyl i lido r) ,
Skip[H>=OJ;
"If rccal not required.
'wen, this "is obstacle number two.
Tho dl'"ive mllst be rocalihrilted before we can"cxecute any cOllllllilnds. This means we must move tho disk
"*al"ln back to track O. Seek orrol's cause this to ha"ppen. Goro Hvcal anti continuo at TestrorSoek when the drive hilS been I'ecalibrated. If
''''lIO seek is required after recalibration, continuo at SOf)kColliploto after tho heads have settled.
LU~(ndcDiskStatus) AND (RdcTrackO),
GoTo[HdHccal];
"The drive is ready, and we we do not noed to recalibl'ate.
Seo if wc need to seek. We will 1I0t noed to seek if tho disk address is for
Hlle of the fixed hoads or if Ctll'relltCylinder is equa"l to NOVlCyl"indor" Test fOI' t.ho S,lOlC cylilldel' first to save time.
T'- Hd dJewCy 1 i nde r'" ( LDF[ HdcNewO ri veCy 1 in de r, 10,10] ) ;
"Hemove head add re s s from NewHeadCy 1 i fide I'.
HdTestFol'Seck:
LU~(HdcCurrentCylinder)-T;
"Test for different cylindor.
T~(HdcIOC[Jptr)+(RdcIOCOnext),
·Prepare to fetch.
Gofo[HdScekComplote,AI.U=O];
"If CurrentCy"linder = NewCylinder

0

'Hore we aro stuck at the last obstacle. It looks l"iko wo will have to seok boforo we call execllte a commilnd. Go move the disk arm to the
·"new cylinder and continue at SeekComplete when thc heads have settled at tho new cylinder.
IU'-(LDF[I1t1cNewHeadScctor,4,1]), *Tost for fixed heads.
GoTo[RdSeek];
HdSeekComplote:
*Ho made it past the last obstacle. The disk arm is sitt"ing at tho right cylinder. Get tho command ready to send to the Contro11ol'.
"'Fetch the rest of the data we fleed from the lIext four words of the lOCO: Next.IOCO points to the noxt IOCB in tho Chain, if any (Note: we
•• must load this again at HdChain); Command is t~e command to uxecute; LongPointer and LongPointerl point to the data For the transfer 0
"poPiltion. Note that this operation destroys registers that wOI'e being used for other' things during the seek. If the commalld is seek onl
""y, ,we are through with ttds IOCB.
Pfet.ch4[HdcZeroBase, HdcNextIOCB];
·T~(RdcIOCBptr)+(HdcIOCBnext).
HdcCownand~(HdcCommand) AND NOT (RdcSeekOits),
Call[RdTaskIfNotlero];
Output[HtlcZeroOase, RdcMom[JuFfAdr];
·Set MomBufAdr to zero.

·Continue after our second task switch after 14 instructions.
This was the first reasonable place to task.
LU~LDF[HdcCommand,10,10];
·Haader, label, and data commands
HdcCommand~(RdcCommand) OR (RdcAllowWake) ,
·If seek only
GoTo[HdEndCommand,ALU=O];
·Continue if command is not soek only.
"-****·***Start of Pilot Codo········*···········*·····**····***
*Gct LongPointer ready to point to the data al'ea in memory.
If flP[0:23] is a base pointer, BP[0:7] is in bits 0-7, and BP[0:7]+1 is in
··its 8--15.
HdcLongPointerl~T~LSH[RdcLongPointerl,10];

HdcLongPointerl<-(RSH[RdcLongPointerl,10])+I;

3-Noy-j9 19:16;t3

RDC.mc

RdcLongPointerl~(L[)F[RdcLongPointor1,10,101)
·~*~~*~*~~End

of Pilot

OR T;

Codo·~~~~t*~*****.***~*.~***~.**

UJ<"( HticColHmand) AND (RdcDatilvll'iteOrVer'ify);
T"RdcIOCl3ptr,
'Sot displacement for' Fetch.
GoTo[RdPrepareSectorWait,ALU=O];

Page

•• ~~*.~.~

"If flat wl'lto or vorify.

'Continue if wl'ito or verify operClt"ioll.
Pr"aloud the Controner' buffe,' wit.h the he:\d(H' andlClbel data and lGI) words of dClta.
IOFetch20[RdcZeroBClse,RdcOutptltJ,
"Senti the lieadOl' data.
call[RdTaskIFNotZero];
T~OC;
·Set displClcement for IOFetch.
IOFotch20[RdcLonf.)Poillter,RdcOutputl;
"Transfer' 20 datil wdrds to the Controller' bufFer.
RdPrcpareSectorWait;
RdcSccto rTimeOu lCotln t'-RdcSecto rT illluOu tvla kelJps;
RdSoctorWait:
·lIerc we aro ready to send a command to tile Contl'oller.
L.ook to soo if tho sectol' cOllling up is tho one we want to access. CurrentSeGtor
u'is what we think the next scctor will be.
T<-L.DF[RdcNewlloadSectol', 10,10],
"T" sector specified by command.GoTo[RdScctorTillleOut, ALU~O];
'If sector time out
LlJ<'( RdcCurrontSector) XOR T;
HdcS Late'-RdcDat aT I'an s Fe 1',
GoTo[HdDataTransFer',AI.U~O:I;
°Go for it!!
"Can you hel'ieveit'l We 11lIrl'ied all the way dOVin here, alld thh 'isII't oven the sector we need to access. Go back to sloop until the IIext
"sector wakeup. Then continuo at SoctorWait abovo, nnd check that sector.
ndcState~RdcSecLorWa1t,

GoTo[RdEndSoctorWakeup];

"Go bClck to sleep.

RdDat.afl'allsfer:
"llore we =0];
"If not last data transfer
'Continue IHlI'e on the 16Lh wakeup.
GoTo[HdClearHakoup]:

Ignore byissuillg IOStl'ollo

RdHoadOata:
'Collie here for data field I'oad opel'ation.
Call[HdStl'obe]; "Tel'minato the wakeup.

and go to sleep. Tho next. wakeup is f!quivalent to sector wakeup,

Iswe IOSlrobf) to tOrillinate the header field UI' label Fiold wakeup ,.\lid no to sloop.

"Continuo here on the First data field wakeup.
Set MemBufl\dr to 210. Do Pl'illleIData to start the controller.
·Set MemOuffl\dr to 21
Call[HdPrimeIdatal;
HdcTomp'-T'-'OC;
"T is c1'isplacement for IOSlore alld Interlock.

T~21C,

HdHeadOata2 :
·Repeat tho following loop 16D times: Read 16D words 'into the data buFfer.
IOStol'ol\l HdcLongPointel',HdcJnput],
"Transfel' 4 bytes 1'1'0111 Controller
Call[HdTplus4NoTask];
"Ilicrelllelit T and Temp by 4.
10Stol'()I\\Hdcl.ongl'ointEJI',HdcIllput],
*T('allsfer 0\ byte:s f.'om Cont.luller
Call[HdlplllS4]; ·'Illcl·enfOnt. T and Telllp hy ,1 and task.
10Storetl[HdcLOllgPointOI',lldclnput],
"Transfel' -1 bytes from COlltroller
Call[Hdrp'llIs4NoTask];
"'Increment T and Tomp hy 'l.
IOStol'e4(RdcLongPointel',lltlclnput],
*f('ansl'er' last 4 byL()s hytes fl'om
Call[l1tlSt.rohe]; "lenninate the wakeup.
LU"'(HdcTelllp) XOIl (37~C);
"Test for all bytes tl'ansfel'red.
IldcTernp"T"( RdcTelllp)+ (4C) ,
"IIlC remell t d i spl acemell t.
Goro[RdReadData2,I\LUIIO];
"If not last transfer

Issue TOStrobe to terminate the wakeup and go to sleep.
buffer to lIIemor,Y.
burfel' to meulol'y.
buffer to memory.
Contl'oller buffel' to memory.

"Como hero aftel' the 17th wakcup. When tho lasL block has been tl'ansferre=O]; >If Curl'ulllCylindol' > NowCylinder.
'Continue iF seek dircction is positive.
RdcColilinanu<-lldGSeuk+D,
"S()t for positive direction seek.
GoTo[lldSeekLoopJ;
RdSeekNeg:
Rd cComllIan d'·RdcSce k -0;
"Set sock command Fo r neg a t j ve seek.
f~(zero)-T;
·Seuk counts up instead of down,
RdSeckl.oop:
·Send seck commands to Controller.
r = nllllIbur of lracks to suek in negativu forlil. This crazy machine can =O];

*If not recalibrating

Check the Status word at each wakeup

1111

3-Nov-79 19:15:53

RDC.me

Page

'Tho seek has completed, and we are reca1ibrating. Go soo if we are at track 0 yet.
UJ"(RdcD"iskStatus) fiND (HdeTrackO).
Gofu[Hdl1eca1];
HdHeadSott1e:
·Cowe here wilen tho soek has completed. Now we must wait for tho heads to settle at the new cylinder. All that seoking was a shock to tho
·'i,· little sensors. Go to s"leep and cOllnt sector wdkctlps unt.il we tllink tile ileads halle settled down.
T"'HdcD"iskflddressPtr;
·Set base to poillt to csb.disi=O];
'COIilB here if retry cOllnt has been exceeded.
RdErrorCountExceeded:
"This is a breakpoint label.
"'Hf)port 0(,['01' il" url'or cOllnt ira5 been excuoded.
Go To l fldf1epo rtE I' r'o I'];
Hdf1et ry:
*\letry the command the next time tilt) sectol' comes al'ound.
Pstorcl[HdcZeroBase,RdcTelllpl;
'Update retry count.
HdcS t ate'-RdcSec to I'Wa it,
Go fo[ HdEndSectoI'Wakeup];
'Retry
RdDataIOlltten:
"IOlltten in state RdcData, after' the data transfer. If the error is due to a HatcErr'or'. we win retry i f the error' count in the lOCO is n
**ot yet negative; otherwise we will report tho er'rol'. If the State is ne[)ative, the error occurred in the label field; otherwise the el'I'
'*01' occured in the data fiold.
LU<-HdcState,
'Test for label el'I'or.
Sk"ip[f1>~O];
"If 1I0t label el'l'or_
HdcState'-fldcLabelErr'or, "ErTor occurrredin the label field.
GoTo[ f1dTestErrol'];
IldcState<-RdcDataErl'or,
"Error occurl'od in the data field.
GoTo[RdTestError];
HdReportEn'ol':
T'-23C,
"The Cont roner pl aces the syndrome ill words 23b and 24b.
Call[f1dPrimeldata];
'Start tho Con t roll e I' •
RdcTemp0HdeTclllp;
O[nterlock for Pl'imeldata
llipu t[RdcSyndrome, HdclnputDllffer];
*Get syndl'ome fl'orn Contl'oller,
[nput[HdcSyndromel,HdcInplitBuFfer];
*Get next word of syndrome.
r<-(fldcIOCBptr) + (RdcTOCBsyndrome);
'Set displacement to store syndrome.
Pstore2[HdcleroOasD,RdcSyndrome],
'Store syndrome in IOCB
GoTo[RdEndComllland];
RdSeekTimeOllt:
·From state Seek.
II seek timo ollt error has occurl'ed.
RdeState<-RdcSeekTilileOut,GoTo[RdForceReca11;
RdSoeto rT imeOllt:
'From state SectorWait.

The sector has timed out.

HdcState~RdcSectorTilileOllt,GoTo[RdForceRecal];

3-Nov-78 19:16:63

RDC.me

PAGE[RdclnitPaDO];
·This is tho ROC initialiLation code.

ON

This is throw-away coda that lives in a soparate paco from the ROC microcode.

*Redofino temporary registers f0r initialization.
RV[RdcRegO, ADD[RdcRegDoBe,O]];
RV[RdcRegl. ADD[RdcRGgDa~8,lJl;
RV[RdcReg2, AUD[RdcRugAase,2]J;
RV[RdcReg3, ADD[RdcRogOosn,3]];
Rdctnit:
RdcRugO~OC,

AT[RdelnitLoc];

I!dcRegl~OC;

IldcHeg2i--OC;
RdcRog3i--OC;
RdcZol'oBase<-OC;
RdcCSBptr<-AND@[IlDCCSBValuu, 377JC;
*Spt Controller Status Block address to 720.
RdcCSf1ptrt set. McmlluffJ\dr to zero ri[Jht after sending tho command to the Contr'oller: Otherwise
"" we get spur'jolls IOALtenill the labe'l field, ,'i .e., na orror' bits al'e sot. und ther-'') is no vorify 01-1'01'.
we Ill'cload the buffer for a VlI'ite opol'dtion, we lIIust not set ~lel!lF3l1ffAdr to lel'O artol' we execute tho command, This causes [oALLeni
the heador' Fio'id.
In fact, tlds may be the cause for the whole problel11 we WCI'() having.
Once in a wll'ile, llIilyhe MemfluFrJ\dl' was gettin
'.g set to zero before an of t.ho d-1ta had been sont to the Controller'.

ii,

"'11

%

[f

3-Nov-79 19:16:53

RDCdefs.mc

File RDWefs.mc
Last edit by Jim Frandeel1 September' 19, 1970

Page

2: 19 PM

.~~$**.*.*~~.*~~~$***.~$*~*~~$*.$*~*~*~***.$~**~~**~**.**¥.~,$

'x,
This microcode is wl'itton to run undor Pilot
'~ts of statcments as follows:

01'

undel' Super, the mir.rocodo drivol' wrHton by Jim Kats·iroumbas. The r;lOdc d0puuds all Lwo so

To run under Pilot:
1I1s0 l't[DOLang];
NoMidasInit; LangVorsion; MultDib;
Illscn[Gl obalOefs];
Set[PllotMode,l];
To I'un under Super':
III se I'tl: StJPEHDEFS1;
Notlidaslnit; Lan9Vel'sion;
SutlPilotModu,O];
%

Ins tl I' t [DO Lan g] ;
NoMi dus In it; LangVe I'S ·iun; MultDi b;
Inscl't[GlolJalDefs];
Set[PilotMode,11;
[I.

[@[Pi 1otMode, 1 ,Comeha r@[ ! J ,ComC ha r@[ - ] 1;

·!········Start of MicrocodeOriver Codo····················,····
Set[RdcInitPage,ROCnPAGE1]; "Throwaway init code for SI\4000
S(! tl Hdcfn i tLuc, Addrtsh H tr ndC£n HPa!le, 10],011;
MC[lldcWakeupReg,IO];
,,! ',·····""End of Mil:rocodeDr'ivCI' Codc"··"·"···"',·"·····,,',,,·,,·,,,,·,,
SET TASK[HdcTask];

'ctlf'!'eJl t ly lIb = 9d

SET[RdcOasc, LSfIIFT[HdcPage, 10]];
*Tlle rollowing are definHions For' the reg isters that belon!) to the ROC micropr'ogl'am task,
SETrHdcrirstHegistel', LSlllrT[HdcTask,4]];
"Tile nrst registel' in the block assigned to the HOC task (currently 220B),
SII[l!tlcflngBaso,ANOO[GO,lldcFirstRcgistel'U;
'This makes all or lil() renistel' i1dtll'essos G bits 10llg,
'Ilcghter 0 is dcstl'oyed across sectol' wakeups. III the DataLI'rol' I'outille, it is used to fetch the syndl'ome from the Contl'ollel', St)"tOI'S.YII
'·"cll is used to load CSII, synch at tho end of sector wakeup,
IlV[lldcSyndrome, AOO[lldcHegnasc, 0]];
flV[HdcSectorSynch, ADD[fldcllcgOase, 0]];
"HOf]istol'.l is dostroyed across scct.or wakeups.
*'sYlltll'omu FI'OIli Lhe Controller,
HVIHdcTcmp, ADD[Hdcllegllasc,l.Jl;
HV[HdcSynclr'omel, ADDlfldcllcgBase, 1.11;

romp is used For' a temporal''y I'ogistel'. In the DataErrol' I'out·inc, it ·is lIsed t.o fetch t.he

"DiskAddl'e:;sPtl' points to CSO.diskAddl'ess[clirrent drive]. It is lIsed to updatc CSO,diskAddl'ess when Lhe drive changes and also to see i f
**the drive has c1l1ln(Jcd since the last command,
nV[HdcLJiskAddl'essPL 1', IIOD[Hdcl1cgOase, 211;
'Cul'rontSector cantil ins the curl'cnt sector number of tho CUI'f'ent drive selected. It is upd;lted at each sector wJkeup,
HV[HdcCul'rcntSecto r, AODl.lldcHegOasc, 3J];
·'The next foul' registers must bc consecut.ive and quad wOl'd aligned: Next.IOCO, Comilland, l.ongPo·intel', and l.ongPointel'1. They :43 PM fixed GlobalfJcfs conflicts
modified by BnD on ,June 25, 1!)7Q 11:44 AM
Ve rs ion 3.0
insort[Globa"iDefs] ;
insort[RS232Defs];
., This micl'ocode usos a timer to simulato il hardwill'!) wakeup
" Task 4 fOI' tho Framu task, and task ti fOI' tile bH task.

1'01'

the fral'w task.

It usos

SET TASK [RBTask];
ONPAGE [RHPagc];

*

IoJakeup occurl'od all input t illlel'.

Get input bit vallie and dispatch 011 input state,

RIWako: $R1I3i tDisp[RStatol, AT [IHWakoLoc];
DISP[nIChockStart], T ~ (RS232) AND (RI232Data);
" Start bit dotected, check bit to be sure its

il

start bit and not noise.

RICheckStar't: GOTO [RIGood, ALU'O], T ( (HDataMask) MID (llDataSizeMask). AT [flIBitLoc.O];
RISetStal't: I OAD1 fMEIl[HIHa I fBi tLo];
LIl ( (RDataMilsk) AND (IlDataSlow);
SKIPON [I\LUIIO];
REfUHN;
NOP;
NOP;
GOrO rrnilllerReturn-I, LOADT1MERfIHllalfBitHil;
" Good start bit,

increment to next state and set wllole bit timer

RlGood: HIDat.a ~. T;
IlTNextState: HStatc ... (RStatc) • (flTBStatelncr);
HISctTiIlWI': ADDfOI[m.R[IlIfl(110itLo];
LU ~ (HDataMask) AND (RDataSlow);
SKIPON (I\LUIIOj;
f1tTUHN;
Nap;
NOP'
GOlD [llT illlcrl1c!tuf'n]. LOADTH1ER[HIFlIlIBi tlli];
" Data bit in,
Shift ·into panially assembled chal'actel'.
" state to check stop bit.

If end or cllal'.Jcter,

IUShiftOit.: HState (- (flStatc) XOH (f).
DlILGOrO IHlNextStaLc. RISCLTilllel'.

AT fBIBitLoc,ll;
(HSH[HLD,\til.1]) Ult (1);

n

ODD],

BlDat.a (

increment

• Justify character and check parity bit.
SHTJlIstDisp[I1DataMask].
Ar (HlIlitLoc.2J;
OISP [IlIJustHy]. nState «RState) XOH (T);
IlTJlISlify:
GOlD [H[Parity]. RWilta (- RSfI[RIDat;I,3],
AT [HIJustLoc.O];
AT [IlIJustLoc,l];
GOrO rI11Pal'itv]. RIData ( HSII[lllData.2I,
AT [RIJustLoc,2];
GOra [HIParitV]. RIData' HSH[I1IOata,l],
RIParity:
$nParityDisp[RDataNask].
I\T [HIJustLoc.3];
illSI' [RJPar'None]. RState ... (J1State) + (HIOStateInGI');
RJParNone:
GOlO fnICheckStop]. ROTelllpl (- T,
I\T [HIParLoc.O]
IHPal'Odd:
GOlD [HTParChk], LlJ (. LDF[HState, RIPal'ityOit, 1],
AT rHIParLoc.1]
HIPar(ven:
GOlD (HIPal'Chk], LU ,- (LDF[RState, HIParitylJit, 1])
1.
AT [lllPal'Loc.21
f11ParOne:
GOTO rllrParChk]. 10 ,. LDF[llflTempl. IHParit.yBit, 1],
AT lRIParloc,3]
AT [RIParLoc.4]
f1lParZero:
GOTO [HlParChkJ. LlJ ' (LDF[RBTempl, Rlpal'ityBit. 1]) - 1.
Rlpal'Chk:
GOTO lHIParGood, I\LUII01;
RIData ... (RIData) OH (J1IDataParityErr);
HIParGood:
GOTO (HISetTimer];
• Stop bit in.
Chock to verify that this is a stop bit (Data=1).
If not it's
" either fram·ing orror or a break.
Set break/framing error COllnter.
HICheckStop:GOTO[I1ITurnon,ALUIIO].
GOTO [RINextStateJ, RIData ... (RIData) OR (3000C);

I\T [RIBitLoc,3J;

* Checking for either framing error or break character. We do that by decrementing the
* break/framing error counter each bit time until thelintJ retul'ns to tile idlo state.
• If the counter goes negat·ive, wc call it a break.

If not,

it is just a framing error.

SKIPON [ALIJ~OJ, RWata ... (RIData) - (400C).
I\T [RIBitLoc,4];
DOL.GOTO [HINot ifyB reak, RINot ifyF rame, H=01, LU ... RIOata;
HIData ... (IlIOata) + (400C);
GOTO [IlISetTimer];
RINotiFyFrame: GOTO [RITurnOn]. RIData ... (HIData) OR (RIOataFrameErr);
RINotifyBreak: GOTO [HITurnOn], RIData ~ (HIData) OR (RI0ataBreak);
" Notify fralile task that input has wOf'k
RITurnOn:
SKIPON [H=O], RODaLa ~ (LSH[HOData.l01) OH (T);
GOTO (HOldle]. RState'- (HState)
(ROBStatelncl');
r ,- Stilek;
cora [HONoxtStatoj. RS232 f- T;

• Senll lIata bi t
ROScnllCIlill': T (, I.DF[ROData.7.1].
HStalc • (RStatc) XOR (T);
r (, Slack f- (Stilck) OR (1);
HOScnclllit:
115232 f- T;
DIll.GOTO [HONextState. HOSetTimcr, Il ODD].
fHHJnxlStaLo: HState (- (RStato) I, (HOBStalelncl');
HOScLTilllcr: SrKI' " HStackSavu;

AT [ROBitLoc.2];

nOData ,- HSlIlI10Data.l];

ADDTOTJM[RLHOrlillBitl~l;

HOLoarJTimel': l.U • (HDiitaMask) AND (HDataSlow);
SKIPON [M,UIIO];
HETURN;
NOP;
NOP;
GOTO [RTimerRetul'Ilj. IOADfIMEH[ROFullllililij;
HOSeLTimerl: (iOfO [IWLoal/limer]. LOADTINER[HOruIIBitLo];
• Send parity bit i f parity set
HOParity:
T f- $HStoplJits[HDataMask].
$HParilyDisr[HDataMask];
Il[SI' [fWl'al'Nolll!j, P.ODiita f- T;
HOP •.lf'None:
GO TO [ROltilcl, HSlate' (HState) AND NOT (11OIlSlat.eM;lsk).
1l0ParOdd:
GOTO [ROPill'rvellj, HStato ~, (IlSlilte) XOH (ROPal'ityMnsk).
HOPar[von:
GOTO ll!Ol'al'Sendj. 1 ,- LDr[nSlate. IWParityBil. 1J.
ROl'ill'One:
GOTO [neWill'Sendl. T ,- le.
HOParZero:
GOTO flWPaI'Send]. T .- OC.
HOParSend:
T .- Slack ,- (Stack) OR (T);
RS232 (- T;
GOTO [HOSetTifller]. RStato ( (I1Stilte) AND NOT (ROBStatcMask);

AT [ROBitl.oe.3];

AT
AT
Al
Af
AT

[nOPal'l,oe,Ol
[IlOPal'Loc.q
rnOPal'l_oc,2]
[HOPaI'Loc.3]
[1l0Pal'Loc,4]

* Id'ie states. used fOI' illlin!j line and sellding break
Stack ~ (Stack) OR (IC).
nrTUHN. STKP ~ RStilckSave;
GOTO [HOSetTimer].

AT [ROBitLoc.4];
AT [HOBitLoc.5];

J-NoY-79 19:16:53

rs232Async.mc

Poge

SET TASK[Rnrosk];
ONPAGE [RBPago];
• Notify framo task that poller has work
RPTurnon:
SKJPON [R(O]. nState
LOADTIMER[nrrBmoTimorl];
RTimerRoturn: NOP;
RETURN;

~

(nStnte) OR

(O"@[~PActive!.

RXActlve!]C). AT [RFWakeLoc];

rs23211sync ,mc

3-Nov-70

19:1G:53

Pane

SET TASK[RFTask];
ONrAGE [RFPageJ;
•
•
•
•
"
•
•
•
"
•
•
•
•

Frame dispatch code
rhe fl'ilme code works in the ronowing Wily:
Whenever the input bit code, output bit codo, or pollor code has some work for tho
fl'onJe tosk to p~rform, it set the appropriate bit in HStoto 'indicating Vlork Iros to
be done (llIActive, flOAd-ive, or HPActivc) and tholl -if the fr.)ma code 'is not clirrollt"ly
running (RXActivo ind'ic;otos fl'ame code rllllllillU), "it sots RXllr;tbe ~nd loods RframcTililA.rl
vrith a short timer,
Hhcn this timer exp'ires, contro'l is passed t.o t.he following
in5tf'uclions,
They simply do a RETUflN with UseCTa,;k set to f'ot.llrn t.o tile lost plnce
the Frome code did 0 TASK.
III addition, they rolond tho til!ler, so that after the next
rASK, the frame code will ag;:l'in get cont.I'ol.
The rl'ame cede Cil!] ~!len run us though 'it
were a normal task doillg nETUfHJS to ~J'ivo contro I to othors.
Whel1 it has fin'ished
processing, it check the Hlllct'ive, nOActive, and RPllctive bit.sin HState to sooif
mOI'e wOl'k needs to be dOllo.
If /lot, i t c'lears RXllctive and idlos the frame timel'.
UseCTask, AT [RFWakoLoc];
flETUflN, I~ADTIMEH[RFramoTimerl];

• The following code is used to initially set registers and the TPC for the framo task,
SET TJiSK[O];
f ~ RO, IIT[flS232StartLoc];
• Notify frame
HO ~ $flSoLDisplo[RETask,HS232Startlocl];
IW , (RO) Oil ($HSetllisplii[HFTask, HS232Stul't.Locl]);
IIPC&APCTask ~ HO;
Hf rUHN, HO <. r;
* flos to I'e HO

Las~

at RS232Startl

SEr TASK[RFTask];
HFl'ameTimerl ,. AND@rHFShortTimorLo,37rjC, liT fRS2:J2StartLocl-l;
nFrameTimori ~ (HFrameJimorl) Oil (ANO@[flFShortTimorLo,1774001C);
Hl\ilsol'a~loO ,. OC;
HBasei'ageOl.o ,. OC;
HSt.ate .. OC;
flPtl~SU ~ AND@[RS232CSDLoc,377]C;
GOTO [HChkActivo], I1PlrCSll ,. (RPtI'CS!)) OH (AND@[RS23?C;Bl.oc,177t100]C);
" Checks to see i f any part of HS232 code dosil'os service.
If so, the uppropriate codo 'is
" branched to.
If not, the frame timer is tUI'ned off to kin th,} framo wakoups.
HNonollctive: RTomp2 .. (RTomp2) Ofl (IIND@[I1FIdloTimerLo,177400]C);
lOAOrINEIl[Hfemp2];
rHlP, TIISK;
HStato (. (nState) AND NOT (IlActiveMask);
IlClikActive: LU ,. (RState) MID (flJActive):
" Check input activo
Gorn [flIFf';,llneSlol't, ALLlIIO], LU (- (HState) liND (ROActive);
Chock oULput activo
l;OTO IROFramoSlar·t, lII.UIIO] , LU (- (nSlate) liND (RPActive);
"Chock [loller octive
DIILGOTO [Hl'ollerStal't, IlNoneAclive, ALUIIOj, HicIIlp2 '·IIIW@[IlFldluTimel'i.o,3111C;

rs232l1sYflc.mc

3-Nov-79 19:15:63

SET TIISK(RFTask];
ON PIIGE[l1rPago];

* Poller.
'" Ghallgo.

Updates ToDCE bits a~d checks FromDC[ bits notifying the user when tho bits
I\lso. handles commands

RPollorStart: T ~ (I1PtrCSR) + (RlndexToDCE);
CAl.L [RRTaskj. PFetch2[HBascPageO. I1PToDCq;
• Process commands. If break in pr·ogr'(1ss. shift bit in nOData t.o tho
• I'inht. ~Ihoil it makos ROData ODD. urea\<'. "iF finished. Clear bl'oak
• ill progress and restart tr·unsmittol'.
LlJ .- (RStato) liND (I1BreakInPro(lress);
GOTO [IlPDoCllld, iIl.lJ"O]. $IlPCmdDispfIlPToDCE];
GOrO [I1PCmdE. R)~O], 110Data .. (RODatil) - 1;
crno [I1PStartXmtr]. I1State • (HStiltO) AND NOT (R[3reakInPI'ogress);
HPDoCmd:
DISP[.+l];

• Commands
• 0
Command proccossed
• l
Nop
• 2
Hesot
stortRocoivor
• 3
'4
s t a I' tTl' J n s mit t 0 I'
'5
Stop Ilocelver
• G Stop TransmiLter
"J
Sond Break
'10
SoL ParilmoLer
"U
Clear Hin!) Indicator
• 12
Clear break dotected
'13
Cloilr Data LosL
• COlilmand c 0 c) Command procossed
'" Don'L tOllch command field in case
HPNoCmd:

" Command = 1 ~> NOP
., Sot cOlilmand field to zero.
HPNop:

is in middle of storing a command.
liT [I1PCmdLoc,O];

Used to I'lake sure poller is alive.

COTO [HPCmdE].

• Command = 2
• Nap for now.
RPlloset:

~Iosa

GOTO [RPCmdEl],

=)

AT [IlPCmdLoc,l];

l1eset
•• 00 WE NEED THIS COMMAND? ••
(iOTa [I1PCmdE],

AT rI1PCmdLoc,2];

• (onoand = 3 => Start Hecoivor
• Start receiver timcrs and set input state to waitIng for start bit
HPStart.Hcvr: LOADPAGFrnBPago].
CALLP[HISeLStart];
GOlD [I1PCmdF]. nState ~ (I1Stato) AND NOT (I1IRStatoMask);

AT [npCmdloc,3];

• Command = 4 ") Sta~t transmitter.
" Set tranSllIittol'Vimol':; and sel output state to sond ing idle.
flPSlartXlIIll': T., (HPlI'CS[3) + (HlndoxCharOul).
HTemp2 ~ 100000C;
I'Sto rel[flllascl'agoO, I1Tol1lp2];
LOAUPIIGE[flBPa!)el;
CIILLP[HOSetTilllerl];
HState ~ (I1State) AND NOT (HODStilteMask);
COTO [HPCmdE], flOOilta ~ 200C;

IIf [HPCmdLoc.4];

• Command = 5 ~> Stop receiver.
• Set idle timer for reccivor bit code.
flPStopl1cvr: I1Temp2 " IIND@[IlIIdleTimerl.o,l774001C.
I1Telllp2 ~ (nlemp2) 011 (AND@[I1IIdleTimerLo.377]C);
GOTO [RPClIldE], LOIIIHIMEH[RTomp2];

AT [HPCmdLoc.5];

* Command = 6 =) Stop transmittel' and id·le 1 inc.
• Set short timor and sot lino to 1.

HPStopXmtr: RState ~ (RStato) AND NOT (HOBStateMask),
I1State ~ (RStato) + (110BStateIncr4);
I1StackSavo .. pl1SImage;
r ~ (GetRSpoc[103]) XOH (377C);
I1StackSave .. T, STKP ~ I1StackSave. NoRegILockOK;
T ~ Stack ~ (Stack) OR (iC);
STKP ~ RStackSave;
RS232 ~ T;
HOSltortSet: RTemp2 ~ AND@[ROShortTimerLo,I77400]C;
RTemp2" (I1Temp2) 011 (IIND@[ROShortTimerLo.377]C);
GOTO [I1PCmdE]. LOADTIMER[RTemp2];
• Command = 7 =) Send Break
• Set output state to sendbreak. enable break timer, and set
HPBreak:

AT [I1PCmdLoc.6];

sho~t

I1Stato ~ (RState) liND NOT (110[3StateMask).
RState ~ (RState) + (ROBStateIncr5);
BOData ~ 62C;
GOTO [ROShortSet]. I1Stato .. (RStatc) OR (I1UreakInProgress);

• Command = 10 =) Set Parameters
• Load registers from DO memory

timer
AT [I1PCmdLoc.7];

3-Nov-79 19:15:53

rs232Asyne .me

RPSetParm:
T ... (RPtr-CSB) ~ (flIndexParm),
CALL [HFi xflaseReg], PFetch2[fUlasePageO, fHlufillase];
PFctch4[flBufOase, RIFullOitLo,O];
CALL [flRTusk], PFetch2[HllunJaso, ROFulllJ-itLo,4];
GOrO [RPCmdE], PFotchl[HBufBase, RDataMask,6];
• Command"
f1PRing:

11

z)

Pags

AT [RPCilldLoc,lO];

C1eal' fling Indicatol'

GOTO [HPCm(!E], RPFI'omDCf.

~-

(P.PFl'omDCE) :\ND ~lOT (RFI'omDCERing), AT [flPCmdLoc.,l1];

• Command" 11 -) Clear Break Detected
HPNoO reak:
• Command
RPLost:

GOTO [flPCmdE],

=

11

=)

nPFromDCE (- (RPFI'omDCE) AND NOT (Rrrr;IIlDCf:fll'cak) ,AT [f1PChldLoc,12];

Clear Data Lost

GOTO [HPCmdE],

HPFl'onillCE ... (RPFromDCE) AND ~OT (RrromDCELost),

AT [RPCmdLoc,lJ];

• Cleal' command r-ic1d
RPCmdE:

*

HPToOC[ ... (RPToOCE) AND (377C);
r ... (HPtI'CSfl) + (HIIl!iexTof)CE), TASK;
PStorol[flBasePagcO, RPToDCE];

Set ToDCE bits,

RPCmdEl:

RStackSave ~ pRS[moge;
T , (GetflSpec[lOJ]) XOH (377C);
IlStackSave ,- T, SlKP .- HStackSave, NoHeg [LockOK;
f . (HProDC[) OR NOT (RToDCFMJsk);
Stack'- (Stack) AND NOT (HToDCEMask);
T • (Stack) .- (Stack) Ofl NOT (T);
IlS232 ,- T, TASK;
STKP ~ RStackSave;

• Check FroIllDC[ bits illld post lIser if they have ch,II1fjcd,
Note that the bits arc IIcgative
• logic,
Also, flPNew willl contedll any nOIl-/Jar'dwal'c bits that have to be set (I ike
• DataLost, B,'eakDetected, Bl'eakIIIPI'ogress),
T (- (HS23?) Ofl NOT (RFl'omDCOlask);
HPNew (- (RPNew) OR NOT (T);
T .- (RPFl'omOCE) AND NOT (IlNotLatchedMask);
flPNew ~ (HPNew) all (T);
r ... (flPtrCSB) + (RllldexFl'omDCE), TASK;
PStorol[RflasePageO, RPNew];
T \- f!PFroIllDCE;
LU .- (RPNuw) XOR (T);
GOlO [RNoDCEChange, ALU'O], T , (RPtrCSB)
Nap,
CALL_ [IlPos t], PFetchl[HBasePageO, RTemp2];
RNoDCEChnllge: flPNcVl , OC;
GOlD [HChkl\ctive], RSlate'- (RState) AND

f

(RllldexMnsk);

1m,.

(HPActivo);

3-Nov-79 19:16:63

rs237.Async.mc

SET TASK[RFTask]:
ON PAGE[nrPage];
" Input event, h'lve received a character'.
O-ispatch on -input eV~lnl.
• [vents aro:
* 0 =) Reccdved a good character. Store it in lOCO buffo,',
• 1 =) Received break, S-ignal Break detected.
• 2 =) Rocoived character with pal'ity errol'.
Sot error and :.tore C!lo1racter ill TOCB.
* 3 ,,> Hoceived character with Framcdng 01'1'01'. Sot error and stol'e character ill 10Cll.
HHr'alJ1eStart: CALL (flGetPt.rIOC!3], T ,- (flPaCSB) I- (RlndexIOCUln);
nFState ~ (HFState) OR (nrStateInput);
CALL [RGetPtrs], UseCTask;
'corn [nlOataLust, ALU=O], T ~ $RI[venlOisp[nOata];
0ISP[.+1], nTomp2 ~ RStatFrameErr;
•
•
•
'"
,

Events are:
0 ~> Character received OK
'I ,,) !3reak received
2 =) Parity error
3 =) Framing error

corn

[RIStoreChar],
COTO [RIFinish-j, RPNew'" (RPNew)
nTcmp2 ~ IlStatParityErr,
NOP,
CALL [nSetStatusl;

• Character rece ived, storo

it

all

in buffer,

AT [I1Ifvolltl.oc,O];
AT [HIF.vGntLOC,l);
AT [RI[vontLoc,21;
AT [fLlLvcntLoc,3];

(RFromHCEOI-eak),

If not enoll(jll

room in buffer, aelvililco to next

* IOCB unless HCmdFnrJ set in which case set OAll\LOST and VI.lit fOl' frume to en(1.
nI Slo ['cCha I':
LU '
GOlD
11Illul'Full:
NOP;
CAl_I.
GOlD
H[MusUnd:
GOra

CALL [RnTask], T (- (RRCOlillt) ,- (RRCOlillt) I- 1;
• Vcr-ify l'OOr:! -in buff 01'
(HMaxCoun t)
T;
[HUlufSpace, ALU)=O], LU ... (RColilmand) AND (HCmdEnd);
GOrO (HlMustEnd, AL.LJIIO], nnCollnt <- (HHCoullt)- 1;
[ROonoIOCB);
[RIStoreChar];
CALL [HSct.Status], Rfemp2 ,- RStatLost;
[RIDoBCCJ;

• Hoom -in buffer.
Store character in buffer.
Th-is is sl i(jlitly complicaterJ due to the
.. Fact that we are storing a byte ratllel' than a word.
nOffset+RHCollllt gives tho byte
• offsot into the buffoI'.
RIBurSpace: nOrfSet (- (HOrrSet) + T;
HOnSel ( (ROffSel) - 1;
GOlD [nIStol'o[vcn, Il EVEN], T (- RSII[ROffSet, 1];
PFetchl[IlBufllaso,RTomp2];
r ... fHIMASK[HDataJ. CAU_[HIlTask-j;
IHemp2 '" (1IIMI\SK[HTelllp2]) Oil T;
GOTO [HIDoStore];
HIStorefv()n: T ,- LSII[IH)ata, 10];
HTemp2 (- T;
IUDoStore:
T <- nSlIlHOrFSet,l], TASK;
PStorel[HBufllase,nTemp2];
IHOoflCC:
CALL [HDoOeC];
• Now dispatch on frame state
• States are:
," 0 ~) just inputted it character, chock i f special case
, 1 ~) just inputt ing first. part of OCC, incl'clnent state
* 2 =) just inputted socond half of BCC, check -it and end frame
, 3 ~) count-ing down to end of frame, "if RFSt<1te(O end the rramo
snrStateOisp[nrStato);
0.fSP[.+1];
•
•
-,
•
•
•

State = O.
Normal state, check if specia"1 type of character.
Special types are:
0 0) not special type. Do nothing.
1 =) BCC starts accumulating AFTER this character. Set ROCC ~ 0
2 =) DCC received AFTER this character.
Increment FStatc to recelvlng OCC state.
3 =) Frame ends in n characters.
Set rState to countdown to end of frame.
$RICharDisp[RTemp2],
DISP [,+1], IlTemp2 ~ (LOF[IlTemp2,16,2])-1;
GOTO [RIFinish],
GOTO [RIFinish], Ilace ~ oe,
COTO [RIFinish]. RFState'" (RFState) + (RFStatelncr),
T <- LSII[RTemp2,14],
nFState'" (RFState) + (RFStateIncr3):
GOTO [RICheckEOF], RFState <- (RFState) OR (T);

• State = 1.

Inputting first half of OCC.

GOTO [R!Finish], IlFState

~

AT [RIFrallloLoc,O];
AT [RISpecLoc,O];
AT [RISpecLoc,l];
AT [IlISpecl.oc,2];
AT [RISpecLoc,3];

Increment FState

(RFState) + (RFStatelncr),

• State = 2.
Got second half of BCC. Check that accwnulated
• and set BCe erl'or if not.
Then end the frame.
LU ~ RBCC,
GOTD [RIOCCOk, ALU=O]:
NOP;
CALL [RSetStatus], RTomp2 ~ RStatBCCErr;
RIBCCDk:
GOTD [nIEndFrame], RFState <- (RFState) -

AT [RIFrameLoc,l];

oce

is equal to zero
AT [RIFrameLoc,2];

(RFStatolncr2);

• State=J.
Ending fl'ame after n charactel's.
DecI'ement top part of RFState checking it
* fi"5t to see if has gone negative. It' it has, end of fl'ame has occurred, so reset
• FState and end the frame.

rs<'32Async.mc

a-Nov-I9 19:15:53

RtCheckEOF: SKIPON [R=O]. LU " (RCommand) AND (nCmdEnd). I\T [BOFrameLoe,O];
GOTO [nOEndFrame.IILlJIIO]. RRCollnt .. (RI1Collnt) + 1;
RONextIOCB: NOP;
CI\LI. [ROone10Cn];
GOTO [RODi spateh1;
"Got chal'acler. scnd it. I\gain. things al'c
" are sendillg a byte rathel' tllilll a word.

~Iinhtly

complicated iJy the fact that we

HOGotChar:
T ... (RMaxCount) .. T;
ROffSet .. (ROffSet) ~ T;
HOff Set ~ (ROFfSet) - I;
r (. RSII[nOffSet.1]. TIISK;
I'rctchl[Rllllf[la~c, BDota];
GOTO [ROSendOdd. BODO]. LlJ ~ ROffSct;
HOSendfvclI: GOrO [RODonCC]. Rnata ... RSH(HOata.10l;
ROSendOdd:
GOTO [HODollCC], HOata <- flIlMIISK[HOata];
• End of frame, since wc got hOl'e. we must want to end fralllo,
* transmitter.

50

set state toid'ling

BOEndFralne: RFState (- (RrState) + (RFStateIIICf"~). CIIU,[RRrask];
GO TO [RONuSaveJ, HOata (- 100000C:
, JlIst sent charac.ter before [lCC. send fi rst £lCC character and 'increment state
BOSen dOCe:
T ... RHMASK( Bl3eC].
Imata (- r. CALL [RHraskl;
HOlllt;rFriIlJlc: GOTO [IWNoSilve I. Ilf"State ( (flFSt,lte)

AT [HOFrameLoc,l];
I

(HfStdtclllcr');

• Jus t sen t fi rst ha I f of BCC, send the second hal f.
GOlO [ROSOfl[J[JCC]. RI3CC (- RSII[I1I3CC, 10].
" Just sellt second half of BCC. look

fOl'

AT [ROfl'amcLoc.2];

more characters

ROldleXmtl': RFState (- (RrStale)
(RFStatelncr3),
GOlO [ROCheckCollnt]. LIJ (- RRCoullt;

AT [ROFrameLoc.J];

• Just idled transmitter, mark lOCO complete and advancc to next locn
GOlD [RONextIOCB].BrStatc ... (RFState)
•
•
•
•

(RrStateIncr4).

AT [1l0Framel.oc,4];

Calculate ncc and check for special characters
Save IOCn registers
Save CSO rcgisters
Chcck for more work

ROOoOCC:

CALL [BOoBCC];
$I1ICharOisp[RTemp2];
!lISP [.+lJ;
GOTO [ROFinish].
GOTO [ROFinish], RnCC ~ OC,
GOTO [ROFinish]. RFState ~ (RFState) + (RFStateIncr).
ROFinish:
CALL [RSavoIOCO].
RONoSave:
CALL lRSavcCSI3], T (- (RPtrCSD) I- (R1ndexIOCBOut);
GOTO [RChkActive]. RState ~ (RState) AND NOT (ROActive);

AT [ROSpecLoc,O];
I\T [ROSpecLoc.l];
AT [ROSpecLoc,2];
AT [ROSpecLoc,3];

9

f's232J\sync .me

3-Nov-79 10:15:63

Page

SET TASKlRfTask];
ONPAGE[ nFPage];
, Finish off lOCO buffor.
[f status is zero. set status to slIccess.
• Dequeue lOCO from chain.
Issue naked notify.
• If new TOCO exists. reloa(/ registel's from IOCB.
IlDoneIOCU:
UseCT;lsk;
T ~ APC&APCTask. TASK;
nSave '0 T;
nOoncIOCOl:LU ~ (IlComp) AND (nCmpStatus);
SKIPON [ALlINO];'
nColilp (0 (nComp) + (nStatOk);
CALI.. [HSavclOCfl]. nComp (- (nComp) on (nCmpProc);
CI\LL [lHlextIOCIl], T +- (npt.rIOCB) 1· (HlndexNoxt);
T +- (HCommand) AND (OH@[IlCllIdvlakeAI1!,nClIldWakeErr!]C);
LU (- (RComp) AND T;
GOTO [HGotIOCB, 1\ I..lI= OJ , T +- (nPtrCSfl) + (nInduxMask);
NOP;
CI\LL [npost], PFetchl[nOasePagoO. nTemp2];
GOrO [HGetIOCD];
• Get buffer pointers.
I1G e tP t rIOCI): I1ETUrlN. Pr etch4 [HB  (rn23?Data), AT [I1HIi\!cndino

~T

nOSelldZOI'O: RS232 ~ T,
GOTO [110Tul'1I01l0, R<01, lU ~ ROICotll1t;
nState ~ (RStata) + (ROOStataIl1cl');
ROSetTimel': GOTO [ROStackReset], LOADTIMEfl[ RO:;yncTilllol'j;
ROfurl1onO:
RState ~ (nState) + (ROAStato[l1cr2);
GOTO [110Turnon]. [lOlCounL ,- 4C;
" Selld ono and switch state Lo SfJl1dZero if ROIColillt

Ollf,S

[ROOitloc, OJ;

<

ROSondOllo: T ~ Stack ,- (Stack) OR (lC),
GOTO [ROSelldIt, R>~O], ROICOunt ... (ROICoullt.) - 1;
GOTO [IWSendIlJ, RState " (RState) - (1l0flStatolncl');

AT [RORilloc,!];

• Send next character bit
Goro [ROInsert. 1l<0], HOICol/nt ,. (1l01Count) - 1,
r ~ lDF[HOOata.7,1];
SKIPON [AlUnO].T ~ Stack ~ (Stack) Oil (T);
H01Collnt ,- 4C;
flS232 ~ T;
HOScnullit:
DBLGOrO [HOTurnon. HOSetTimer, n ODD].IHlDilt:a ,-

AI [nOUitLoc, 2J;

11~;IIr:flOn;lta.l];

• Idle st.ate used to idle 'I inn
GOTO [HOStackReset]. Stack
• Need to insert a zero.
1l0lnsert:
110Sond [ t ;

~

(Stack) OH (lC),

AT [HOBitl,oc, 3J;

Output zero bit and rBset anD bit counter

1l01Count (. 4C;
GOIO (IIOSOlTiIllOI']. I1S232 ... T;

• Got next charactor to be sent and not'ify fame task work IH)ods to be clollo
• Notify framc task tl1at output has wOI'k

no rUI'nOIl:

LOADTIMEl1r 1l0SyncTimerl;
T • (HI'LrCSn) + (IIIndexChaIOut);
PFotchl[ll11ascPngeO. ROData];
r ~ 2 OOC;
GOrO [110Notrlag. H)oO]. rWData ... (LSII[HOData.10]) on (T);
HOSendr-lag: H01Collnl t- 4C;
HSlato' (nState) - (ROllStatolncr2);
HONotFlag: SKIPON [1l<0], RState. (IlSLate) OR (OIl@[110Active!. RXA(:tivpl]C);
LOADTIMER[llfralllefimerll;
HOStackl1osot: ecno [HfimorReturnl, STKP , IlStackSav,e;

rs232Dit.mc

3-Nov-19 19;15:53

SET TASK[RDTask];
ONPAGE [nFrage];
• Uolify frame task that ponel" has work

RPTurnon:
SKIP ON [R(O]. RState
LOAOTIMER[RFrameTimerl];
RTimernoturn: NOP;
RETURN;

~

(RState) OR (OR@[RPAct1ve!. RXActive!]C). AT [RPWakeLoc];

rage

3 -Nov-7t] 19; L6; 1)3

f's232131t.mc

!j

SET TASK[RFTask];
ONPAGE [RFPageJ;
•
"
•
•
'.
•
•
•
"
•
•
•
,

Frame dispatch code
rhe t'rumo code wOI'ks "in the rollowillg wU'y;
Whenever the input bit corle, outPlit bH code, 01' poller' cotto has SOIlW work for tho
frame tusk to porform, it set the appropr"iate bH "in H.3tatc illliicrt"iiHl 'Nor!" hilS to
be r/one (RIActive, ROActivll, or RPAct"ive) and Lhon i f tile fl'am(J code is not cUI'I'ently
I'unning (RXActive 'indicates Frame code ['llnnill\l), "it sets RXrlct"!'1e alldloo1ds RI"',"'liIerimorl
with a short timor,
When this timel' expires, contro"1 "is passed to tlw following
instrllctions,
They simply do a RIOTlJf!N with lJseCrns\<: set to return til tile last placo
Lhe frame coae d"id a TASK,
In addition, thOy relo,ld the t il,"H', SiJ that aFter the next
TASK, the frame code will =O], LU (- (I1Collllllallel) AND (RClildEnd);
RIIJuHull:
GOTO [flTMustElld, ALUIIO], HRCount <- (IU1Coullt) - 1;
NOP;
CIILL [HOolleIOCB1;
OULGOTO [IUUatilLos t, RTStoreChill', ALU=O], $RTF:velltD isp[IWal.a·l;
BIMusHnel:
CALI [flSotStatus], f S~nt a charactor/opening flag
• 1
) Sent HCel
"2
) Serlt I3CC2
• 3
> Sent closing/opening nag

*

nODi s patc h: $RFSLl teDi s p[ RF Sta to] ;
DISP[,+1], T .. HRCount .- (nnCount) - 1;
• A character has beon sent, soe if ilny more cllaraGt()I's in buffel',
• [f nothing in buFfer, check [ndFrJfIle bit ancJiF set, end the framo,
ROCheckCount: GOTO [ROGotChar, AlU>=O], LU (- (nCornrnand) AND (nCrntiEnd),
GOrO [1l0EndFr'arne, AlUIIO], HRCollnt <- (llRCount) t 1;'
RONex l £OCB: NOP;
CALL LIlDonoIOCB];
GOTO [RODispatcll];
• Got <:-Iiar'acter, send it.
Again,
• ar'o sending a byte rather' than

,j

AT [HOFr'ameloc,O];

thillgs are slightly cornplicnted by tho filct that we
wor'd.

ROGotChar:
T ... (RMaxCount) - T;
1l0ffSot <- (HOff Set) + T;
1l0ffSet ( (1l0fFSet) - 1;
r ,. HSII[ROfI'SoL,l]. TASK;
PFe tchl [llUlI m'I,O, RDatil];
GOTO [ROScntlOdd, Il ODD], LU ,- ROffSet;
HOSend[verr: GOlO [HODo[lCC], RData t HSII[HData, 10];
ROSenrlOdd:
GOTO [1l0DoflCC]. IWilta <- IlIiHf,SK[I1Datil];
" End of Frilme,

send fir'st OCC charilcter

ROEn d Frame: T ,- IHIMASK[ HaCC];
110SencJ1JCC:
l"OJ. HODato ,- (LSII[ROData.10]) OR (l);
GOTO [HOlule!. I1Statc «RState)
(HOIlSLatcIncr);
GOTO [ROSendChal-]. RState (- (IlStaLc) I- (HO[lStatelncr);

• Send data bit
ROSendChar: T (- LDF[RODala.7.1].
IH [110BitLoc.2J;
IlSLate ~ (RState) XOR (T);
r <- Stack (- (Stack) OR (T);
IlOScnd[JiL:
RS232 ,- T;
Illll.GOTO [HONtlxtState. nOSctrimol'. n ODD]. RODola ,- HSfI[ROData.1];
HUNextSlatc: nStatc ( (IlState) I- (nOflStatelncr);
HOSet rime 1': LOADTT ME nr nOSyn cT lme r];
fHlStackHeset: GOIO [HTilllcl·netllrn]. STKP ~ nStackSave;
., Send parity hit if pal-ity set
nOParity:
$llrarityDisp[HDatoMask1.
DrSI' [IlOPal-Nollel. RStatc (- (RState)
(nOI3StatcIncr7.);
nOPa I'Nonc:
GO ro rnOStart].
tiOra [IHlPar[volI]. RState (- (HStato) XOIl (fWParityMask).
fHlP" rOdd:
nOPa l'Evell:
GOTO rnOP;lrScllU]. T (- LDFLIlSlatc. nOPal'ityl3it. 1],
GOTO [HOPal'Sontl]. T ,- Ie.
noP" rOnG:
ROPal-Zel'O:
GOTO rnOParSentl]. T (- ~C.
r (- Stack (- (Stack) on (T);
HOra rSelld:
GOrO [HOSctTimcr]. nS232 (- T;

AT [ROBitLoc.3];
AT [HOl'arl.or..

AT

[HOParLor.,2]
J\T [HOParLoc.31
AT [nOParLoc.4]

• Slate lIsed hy pollel' to stop transmiLtel'.
GOlO [nOStacklleset]. Stack (- (Stack)

on

(le).

0"1

AT [HOParLoc.l]

AI (IlOflitLoc.tlj;

rs232Byte.mc

3-Nov-79 19:15:63

SET TASK[RBTask];
ONPAGE [RFPago];

* Notify framo task that pallor has work
RPTurnon:
SKIPON [RCOJ. RState
LOADTIMER[HFramoTimerl];
RfinlCrRntuI'II: NOP;
RETURN;

~

(RState) OR (OR@[RPActiva!. nXActivo!]C). AT [RPWnkeLoc];

Page

3

rs2320yte,I11C

J-Nov-79 19:1G:53

SET TASK[RFfask];
O~PAGE [nFPage];

*
"'
•
•
,
"'
•

*

*
•
•
•
•

Frame dispatch code
The I"I'UII1O code works in tile fol"lowinrJ way:
\'Ihencver tho "input b it code, output hoi t codo, 01' pollel' code has SOIOO work for tho
frumo task to porform,it set the appropl'iato b it in R5t..}te "indir.aL il19 work has to
be dono (HIilct"iva, ROilctiv(), 01' I1PAct"ive) ilnd then if the friwlo code "is not clll'rsntly
running (nXllct iva indiciltos fl'arno coele I'unlling), it sots I1XAct iva anclloads HFrallloTimol'i
with a short tilllOI',
When this t"imol' eXpir'os, control is passed to the following
illstl'ucl"ions,
TlI(:y simply do a RETLJR~J with UseCTask sot. to return Lo tho lCl5t placo
the fl'allle codo did i\ TIISK,
In aeldition, tlwy reload the timor, so that aftnr' the next.
TASK, the frame coele w"ill ag;:Jin get control.
Tho frame code Cill1 then run as thollnh it
wore a no 1'111 a 1 ta:;k do"ing nETUnNS to \live control to others,
When it has finished
PI'Oc(!ss"ing, "it check tho HTActive, nOI\ctivlJ, alld I1PI\ctivo bits in HState to soo if
more work needs to be dono,
If not, it c Il)ars HXAct"ive and idlos the frame timer',
UseCTask, AT [nrWnkoLoc];
HETUHN, lOilDTINER[HFrameTirnerl];

•

rhe following codo is used to initially set renisters ilnd t:,e TPC for tho fl'DlIle task,
SET TIISK[O];
f ~ no, III[nS232Startloc];
• Notify task 0 at nS232Stnrtl
HO ~ $RSetDispLo[I1FTask,RS232Startlocl];
rtO ,. (nO) on ($HSotDisplli[rtFTilsk, rtS?.12.Starl.Lod]);
APC&APCTDsk ~ no;
HETunN, rtO ,. T;
• nestoro rtO
SET TASK(rtFTask];
HFrollloTilllerl ~ IIND@rnrShortTimerlo,J771C, Ar rnS232StortLocl1;
Hfl'omofimel'l'" (RFrLlllloTinwrl) on (AND@[HFShortTilllorLo,l77400"IC);
IlBasol'ageO ~ oc;
RBnsePageOLo ~ OC;
HState < OC;
HPtl'CSB (. AND@[nS2,12CSBLoc,3J!]C;
Goro [RChkllct.ivel, HPtrCSl1 ,. (1lI'tl'CSI3) on (AND@[nS232CSl1Loc,l77400]C);

* Chocks to see if any part of RS232 codo desil'os sorvice.
, [f not, tho fl'amo timor is lunloel ofF to kin

If so,
the frame wakellps,

it "is branchod to.

RNonellclivo: RTemp2' (IHmnp2) OH (AND@[nFldleTir:lerLo,l77I\OO]C);
lOIlDTIMErt[IlTmnp2];
NOP, TIISK;
nStato ... (nStato) AND NOT (RActiveMask);
RChkllctivo: llJ ... (rtStato) AND (rtIActive);
" Check inpllt active
GOTD [HIFramoStnrt, ALlJIIO·I, lLJ ,. (rtStato) liND (HOActive);
"Clwel<. output ilctivo
GOIO [HOrrameStal't., ilLUIIO], LU • (IlSlatu) litH) ([(['ilctivo);
• C!leck pollOI' active
D131.G010 [rtl'o llorSlart, HNoliellc t iva, I\I.UIIO] , III t:mp2 • Mm(~[Hrrdlt: I imcrLo, JIIJC;

rs232Byto.mc

3-Nov-70 19:15:53

Page

SET TASK(RFTask];
ON PAGE[RFPage];
• Poller.
• change.

Updntes ToDCF. bits and checks FromDCE
A'lso, halldles commands

lJit.~

;lotifyin9 the lIser when the bits

BPoll erStJr't: T ,. (HPt rCSB) + (rnndexToDCE);
CALL [HHrask], PFetch2[BBasePageO, RPToDCEj;
• Process commands
$BPCmdDisp[RPToDCE];
DISP[ RPNop 1;
• Commands
"0
Comilland r)l'occossed
• 1
Hop
'2
Reset
• 3
slnrtRoceivor
'4
startTransmittor
• fi
Stop Receiver
• 6
Stop Transmitter
., 1
Sond Bl'oak
Set Paramoter
• 10
"11
Cloal' Hilln Indicator
• 12
Clear brnak detected
• 13
Cloar Data Lost
• Commalld '" 0 =) COlllmand processed
'Don't even clear Ollt command fio'id
WNop:

GOTO [HPCmdE 1],

AT [RPCmdLoc,O];

• Command = 1 =) Nap
• Clear Ollt command field
GOTO [HPClIldE],
, COlIlIIILlIId
• NOP for

= 2

=)

AT [RprmdLoc,l];

Reset

1I0W

GOTO [HPCmdE],

AT [RPCmdLoc,2];

• Command = 3 =) Start Heceiver
• Start recoiver timol's and set 'input state to waiting for synchronization
RISYllcTimel' f- AND@[HISYllcTilllerLo,l77~OO]C,
HISyncTimor' f- (IHSyncTinwr') OH (ANDcl[RISyncTimel'Lo,37/]C);
LOADTIMER(RrSyncTimer];
GOTO [RPCmdE], RState ~ (HState) AND NOT (R1RStHteMusk);

AT [HPCmdLoc,3];

, Command = 4 =) Sta~L transmitter
',. Set transmitter timers and set output state to sending idlc
T +- (HPtrCSB) t (RTndcxCllarOut),
RTemp2 t 100000C;
PStorel[HUHsePageO, HTomp2];
nUSYllcTimer' AfW@[HOSyncfirnol'l.u,177400]C;
nOSyncT imer' ( (ROSyncTimcl') OH (ANO@[ROSYllcJimerLo,377]C);
LOADfrMlH [ROSyncTimorl;
HStatc +- (HSLato) AND NOT (RUDStateMask);
GOro [RPCmdE]. HOData .. 200C;

AT [RPCmdLoc,4];

• Co~"and = 5 =) Stop rcceiver
• Set idle timer
RTcmp2 .. AND@[RIIdleTimerLo,177400]C,
nfemp2 f- (Rlomp2) OR (AND@[HIIdleTimcrLo,377]C);
GOIO [RPCmdEj, LOADfIMER[HTemp2];

AT [RPCmdLoc,5];

* Command = 6 =) Stop transmittcr and idle line
• Set short timor and set line to 1
RTemp2 f- AND@[ROShortTimerLo,177400]C,
RTemp2" (RTamp2) OR (AND@[HOShortTimerLo,377]C);
HStackSavo f- pRSImage;
T f- (GetRSpec[103]) XOR (377C);
RStackSave .. T, STKP +- RStackSavD, NoRegILockOK;
T f- Stack f- (Stack) OR (IC);
RS232 ,. T:
STKP f- RStackSave;
LOADTIMER[RTcmp2];
RState f- (RSlate) AND NOT (ROBStateMask);
GOTO [RPCmdE], RState +- (RState) + (HOBStateIncr4);

AT [RPCmdLoc,6];

• Command = 7 =) SOlid Break
• Unimplemented
GOTO [RPCmdE],

AT [RPCmdLoc,7];

* Command

= 10 =) Set Parameters
• Load registers from DO memory

T f- (RPt,'CSB) + (RIndexParm),
CALL [RFixDasoReg], PFetch2[RBasePageO, RBurBase];
PFetchl[RBufBase, RDataMask,6];
GOTO [RPCllldE], PFetchl[RBufBasc, RSyncChar,7];

* Command

= 11

=)

Clear Hin9 Indicator

AT [RrCllldLoc,10];

rs?32Byte.mc

Gora

3-Nov-70 19:16:53

[HPCIIl!JE].

• Command ~ 11

=)

GOTO [RI'CmdE].

*

Cooonnnd

=

RPFrornDCE

t·

(flPFromDCE) AND NOT (IlFI'omDCUliilg). i'IT [flPClIldLoc.ll];

Clenl' fl'infl Indicator
RPFrornDCE ,- (RPFroIllDCE) AND NOT (IlFI'omDCfBl'cuk).AT [RPCmdLoc.12];

11 =) Cleor Ring Indicator

GOTO [RPCmdE]. RPFromDC[ (. (RPFromDCE) AND NOT (RFremDCELost). AT [RPCmdLoc.13];
• Clear commalld Field if not already cleared
IlPCmdE;

RPToDCE ,. (RflroDCE) fiND (3nC);
T ,. (RPtrCS(3) j (lllndexToDCE). TASK;
PStorel[RDasePngeO. APToDCE];

• Sel TaDCE bits
RPCmdEl:

RStackSavf~ ... pl1SIlliage;
T ... (GetIlSpec[103]) XOR (377C);
RStackSave <- T. STKP (- RStackSave. NuRegILockOK;
T <- (IlPToOCE) all NOT (RToDCEMask);
Stack <- (Stack) AND NOT (RToOCEMask);
I < (Stack) <- (Stack) Oil NOT (T);
HS232 (- T. TASK;
STKP <- RStackSave;

" Check FromOCE bits and post user if they have changed.
Noto that the bits.al'c ncgative
"lo!}"ic.
1\"150. RPNew willl contain any non-har'dwaro bits that have to be set (l'iktJ
" OataLost. UroakDetected).

r (. (RS?32) OR NOT (RFromOCEMask);
" Get FromDCE bits
"PNow ~ (RPNow) OR NOT (T);
r. (I1PFl'oITlDCE) AND NOT (RNotLatchelll.lask); * Save ONlatliced bits
HPNew ~ ("PNew) OR (T);
r (. (HPtI'CSfI) 1- (Hlnciexll'omDCE). TASK; "Store /fOW FrolnDCE bits;
PSto l'ol[Rl3asePagcO. HPNew];
T {.. IWFI'omDCE;
• Get old FromDCE bits
L11 f· (RPNow) XOR (T);
'" Compal'c Lo new FromDCE bits
ceHO [flNoDCEChallgc. ALU=O]. T { (RPtI'CS13) ~ (Rllldexl~i.\sk);
LoadPagclRUPage]:
CALL [flPost]. Pfetclil[110asePageO.RTcmp2];
flNoDCECilange: RPNew (- DC;
GOlO [RChkActive:\. nStuto ... (HState) fiND NOT (RPActive);

Pane

3-Nov-7D 19:16:53

r'S2320yte.mc

Paye

SET TASK[nFTask];
ON PAGE[RFPage];
fnput eV/1nt, have reco'ived a churactnr'.
Dispatch on inplJt event.
V e n t s u 1'0 :
=) Rcc(J"ived n good chal'uctor.
Store it in lOCH buffilr,
• 1 =) Received break. NOT IMPLEMENT~D YET.
• 2 =) Reccived char'ador w"ith p;\rity OI'rOI'.
Set cl'rol' and stor'(j ci1arllcterin IOCB.
* J ~> Poceived charactor with frumoing 01'1'01'. Set orror all\! store chur'uctor' 'in IOCIl.
,h

I,

[

* 0

InFramoStart: CALL [IlGetPtrIOCfl], T" (flrtrCSfl) l- (RlllclexIOCllln);
RFStute ~ (RrState) OR (RFStatolnput);
CALL [RGetPtrsl, UseCTask;
GOTO [RTDatnLost, ALU=O],$RIEventU;sp[ROata];
DISr[. '1], IHomp2 (- RStatFrallle[I'!';
GOTO [RIStol'eChar],
GOTO [RIFinish],
RTelllp2 ~ RStutParityErr,
NOP,
CALL [RSotStatus];

AT [RIEvontLoc,O];
Ar [RIfvontLoc,I];
AT [RILventLoc,21;
AT [RIEventLoc,3];

, Character r'eceivod, store it in buffer'.
If not enouflh I'oom in buffer, advance to next
" IOCB unless HCmd!:nd set in which C,\SC set DIITIILOST and wait for FrullIl) to cnd.
• If the curl'ent sLat.) is zero, chock if SYI~ characther' and Lhrow away if so.
!lISto r'cClla 1': $I1FS ta teDi !;p[ HFState];
DTSP[.+lJ, T ~ RSyncChar;
GOTO
GOTO
GOTO
GOTO

[HIChcckSynl, LU f- (RData) .. T,
[HfNoCllDck], T f- f1RCOllnt ... (RHeount)
[HTNoCllcck], T (- RHCounl (- (f1HCount)
[f1ICheck.S.vn], LU ... (RData) - T,

~
l-

II r [RISynLoc, 01
/If [RISynLoc, 1]
AT [HISynl.oc,2]
I\f /RlSynLoc,31

l,
1,

InChockSyn: GOTO [lnNoChock, ALUIIOJ, T (- (RRCount) (- (fWCount) + 1;
GOTO [RINoSnvel;
HHloChock: l.U ... (flMaxCount) .. T;
GOTO [RHlufSpilCO, Al.U)=O], LlJ (- (RCo!llmilnd) MID (RCrndEnd);
RHIllfrull:
GOTO [RTMustEnd, AUJII0.l, 1U1Count .. (HI1Count)
1;
NOP;
CIILL [RDoneIOCB];
G010 [RIStor'eChar1 ;
CALL [RSctStatus], RTemp2 ... RStatLost;
HIMustEnd:
GOlD [H rEndF ramo];
" Hoom in buffer.
Store character in buffoI',
This is ~;l ight ly comp'l icatcd due to the
" fact that we are storing a byte rathel' than a word.
HOrfsetl'HRCount g'ive5 the byte
" off5et into the buFFel'.
IHUufSpace: IWffSot (- (ROffSet) l- T;
HOFfSut (. (HOIT;r1t) .. 1;
GOrO [H [Sto['dven, R EVEN], T (- f1SH[ROffSet, 1J;
p~ etch1 [Hflu rAasc ,11Te/llp2];
1(- RIlHIISK[HOata/, TASK;
RTernp7 <- (11I1~ASK[nlemp2]) 011 T;
GorO [RIDoSLureJ;
RIStoreFv0n: T (- LSII[HDuta,10];
RTemp2 ... l;
HlOoStore:
T (HSII[ROffSet,1], TIISK;
PStorel[HflufOosu,RTemp2];
RI000CC:
CAI,L [RDoDCC];
" Now dispatch on fl'arne state
* States are:
" 0 =) just inputted a char'ucter, check i f special case
" 1 =) just il/puLt ing fi,'st part of [lCC, 'increment state
* 2 =) just inputted second half of flCC, check it and end frame
* 3 =) counting down to end of frame, if IlFState(O end the frame
$RFStoteDisp[RFState];
DISP[.+l];

*

State = O.

Normal state, check i f special type of character.

* Special types are:

"°
" 1
" 2
• 3

=)
=)
=)

=)

not special type.
Do nothing.
BCC starts acculliulating AFTER this character.
Set RBCC ,. 0
BCC received liFTER this character.
Increment FState to recelvlng DCC state.
Frame ends in n characters.
Set FStote to countdown to end of frame.
$RICharD1sp[HTelllp2],
DISP [_+1], RTemp2 f- (LDF[RTemp2,16,2])-1;
GOTO [f1IFinish],
GOTO [RIFinish], ROCC ~ ~C,
GOTO [RIFinish], RFState'" (RFStote) + (RFStateIncr),
r <- LSII[RTernp2,14],
RFState ... (RFState) + (RFStatelncr3);
GOTO [RICheckEOF], RFState <- (RFState) OR (T);

" State

=

1.

Inputting first half of BCC,

GOTO [RIFill'ish], HFState

~-

AT [RTFrameloc,O];
liT [RISpecLoc,O];
AT [RISpecLoc,l];
AT [RISpucLoc,2];
AT [RISpecLoc,3];

Increment FState

(RFState) + (RFStatelncr),

AT [RIFrameLoc,l];

" State = 2.
Got second half of BCC.
Check that accumulated BCC is equal to zero
" and set BCC error if not.
Then end the frame.
LU <- RBCC,
GOTO [RIBCCOk, ALU=O];
NOP;
CALL [RSetStatus], RTemp2 f- RStatBCCErr;
RIBCCOk:
GOTO [RIEndFrame], RFStata f- (f1FState) -

AT [RIFrameloc,2];

(RFStateIncr2);

rs23 2U.Yte.lIlc

3-Nov-79

Pane

19:16:53

• State=3.
Ending frame after n Cll.ll'acters.
Decl'emont top prlf't of HFStato check'ing it
• first to see if has gone negative.
[f"it has. elld of frame 11U5 occll[,I'(~d. so reset
• FState and end the frame.
HICheckEOF: SKIPON [1l t. ino idlo.
Send syncs

:·i =~ 3~~~i~~n~y~C~;lUracter.
~

Got next character from IOCfL
3 => Just sent chill'aeler before BCC. Sond fil'st haH of BCC.

" 4 ~> Just sent fir8t hillt' of BCC. SOlid second half of BCC .
.• 5 .,> Just sent ln~t Il.l'1t· of I3CC. Idle transmittal'.
• 6 =) Just idled transm'itter. Signal IOCB complete.
RODisputch: $RFSlateDi~p[RrState];
DISP[.t-l]. T f' HHCount (, (RRCollnt) - 1;
• Idle lillo.

Send f'irst sync and 'Ioar! sync counter

T (. RSyncChul'.
RData ... T;
r (, ($RSyncCollllt[RDalM1ask]) - 1;
ROSYIICCOlIll t (, T;
HrState " (IlrStato) + (RFStateIncr');
" Sending syncs.

Check i f enough have becn senl.

AT [ROrrameLoc.O];

if so start sending charactef'S

SKIPON [1l(0-1. 1l0SYllCCollilt (- (flOSyncColillt) - I,
GOIO [HONoSavc];
HI'State ,. (1lI'State) + (RFStatelncl');
GOTO [IlOChockCOlIlltj, LU .. IH1Collnt;

AT rHOFramel.oc.l];

• A character has been sent. see if any more chal'acters in huffer.
in burrel'. check [ndFrame hit and if set. elld lhe Frame.

'" II' 11Oth'ing

IlOChockCollnt: GOTO [ROGotChar, ALU>~O], UJ (. (I1Cornrnand) AND (RCmdEnd). AT [HOFrallleLoc,2];
GOTO [HOEndFrame.AUlIIOJ. IlRCouilt (- (HHCoullt) + 1;
HONext £OW: tWP;
CALL [HOolloIOCB];
GOra [HODispatch];
'" Gut character. sefid it. Again. things iJl'e slightly compl icated by the fact that we
<11'0 send ing n byte rathel' than a word.

'"

HOGotChar:
r (, (HMaxCoullt) - r;
HUff Set ~. (llOI"fSuL) + r;
1l0FrSel ~ (IlOffSet) - 1;
r ,- HSII[IlOf'fSct,lJ. TASK;
rrelch1[HBufflase, IlOala];
GOTO [ROSendOdd. R ODD]. LU ~ IlOffSet;
HUSell;s
" Activi ty bits
• Inpllt pa,' i ty "las k
" Output par'j ty lIla~k
" IIIPlit parity bit
" OUPlit parity bit

• State of "State after Resot command

3-Nov-79

l's2320efs .me

L9:15:53

*FState h"i ts
• Noto: Upper byte is clearod at and of frame

!.:qRrcountIncr,
MCiRrSt~tcColllltBits

0100001
,17UOOO]

MClRrSlateMask,
W:[llrStateInput,

000016J
000001]

W:rRFStatclncr,

000002]
000004]

MC[RFStatcIncr2,
~IC

rHFS tat e Inc I' 3 ,

MCrRFStateIncr4,

OOOOOu]
OOOOtO"1

HC[RFStnteIncr5,
MCrnrStut{)Incr6,
~1C[nF S ta tc Inc 1'7,

000012]
000014J
0000161

• Increlllcnt vallie to countdown
., B"its IIsedin EOr countdown
., Fstate bits
., Recciv()I' aeUva (must be ODD bit)

*

FState

increments

Pane

4

3-Nov-79 19:1G:63

rs2320ofs.mc

• RIDota Events
MCfR CDataGoodChar, 0000001
NC[RIDotaBreak,
OOO~OOl
000400]
MCrRIDataAbrt,
MC[RIDataParityErr, 001000]

•
•
•
•

MC[n[DaLa~lag,

$

Got a good character (async, byte sync. bit sync)
Break detected (async)
Got on abrt (bit sync)
Parity error (async)
Got n flag (bit sync)

$

Framillg error

MC[RIDntaFrameErr,
MC[R[DataIdle,

001000J
001100]
001400]

(a~ync)

• Idle line (bit sync)

• ROntaMaskBits
MC[RDataSlow,
MC[RDataSizeMask,

000001];
000360];

'. Slow speeJ, less thilll 1200 balld
• Bits for data size in hits

Paye

f's232Defs.mc

.

Indico:; il1to

3-Nov-79 19:15:53

eso

MC[RlndexStartStop.
t·:C[fllndexMask,
HC[HlndexToDCE,
MC[RIndexFromDCE,
MC[fllnduxfOCHOut,
MC [ RTnde xCha 1'0 u t ,
MC[flIndexFStatoOut,
MC[RlndexOCCOut.
NC[fllndexTOCnIn,
NC[flLndoxChnrIn,
tiC [ IlJ n(I I) x FS tat e III ,
IIC[HlnduxBCCln,
MC[llIntloxllCC rilb Ie,
MC[llIlIduxPal'nl,
t'lC[ flI ndexOut' Pt r,
MC[fllndexNoxt,
MC[IlIlIdexOffsct,
t-1C [fl1 nLiexCoull t,
MC[1l1Ildext-laxCollnt,
I·IC [n LIlcieXCOmmall d,
t-1C I: III rrdnxComp,

ilnd

TOeD
0];

l:l ;
2];
3J;
4J;
5];
6'1 ;

71;

10];
llJ;

1:'] ;
13];
I4] ;
16];

01
7.1

.31
4]
5J
6)

7]

* Index to start/stop status

··
··.,
··
·
··

Index
IndHx
Index
Index
Indux
Inde"

naked notify mask ll"i ts
ToDCE b i ts/Col:l,nal1d
F romDC E bit:;
Output IOCIl po-in tor' in csn
Out.put chilra<;tOf' buffef'
tn Outpu t fSlate
Ind())~ La Output BCC
to [nput lOCO po into I' -j n CSO
., Indox
IlId'3X to [npll t Clli1f'Gctor bu f f c r
Index to fnpu t FState
Index to [nplI t oce
'•." Index to Bec tzllJl0 poirrtol'
Index to Pal'arnotcr tdock poi lite r

·,
·

Index
Index
111dox
"., Illdex
[II dex
* lll\lox
.• Indox

to
to
to
to
to

to OnFfcr pointeI' ill IOeB
tJox t IOcrl r-iel d -i II lOCFl
to Offset t"ieltJ in -lOCIl
t.o COUlit field -ill roCB
tiJ t,laxCollil t field in lOCB
to COllllilalld riol d in fOCll
lo Completion field -ill rOCB

1.0

I's?J20ofs.mc

3-Nov-79 10:15:53

• TIMER CONSTANTS
SEr[RrimerValuB,377];

SE1[RIfimurSlotl,o,Ol;
SFT[RITimel'Slotll i, 1];
SLT[ROTimnrSlotl~,2J;

Srf[nOTimorSlotili,3];
Sl1[llrrimorSlotl.o,I&J;
~ET[RTimcrIdlc,4];

SFT[ROTimurSync,13];

rr

SL
IlT illlc rCollnt, 14 'I;
SET[IlITimerSync,17];
SETrIlTilllerSimplc,5];
~;E"I [IlFT imo I'Val Lie, 3:1;

• NegativD timor valuo for DSC timers
$
Input timor s'lot (low)
• Inp~t timer slot (hi)

* Output timor slot (10)

• Out.put timel' slot (hi)
Fr Vlol'tlS replacetl by ti,l) lIliCI'ocodes
loadpa~JelOl, goto[x3'/lxJ, al[O]; "burFer rofill code is on page 0
f ~ APC&APCTask, yoto[FoultOccuredJ, AT[IJ;
"First, mllst snve apc
Faul toccu rod:
RXAPC < T, AT[BeginFault];
T .- GEfI1SPEC[t47], AT[10l];
"ctask, ncia
RXCTASK' T. AT[102];
T'" (GETHSPECP03J) xor (3l7c), I\T[103J;
"ssti (T);
uiMOUS[O[I.XY ,. (uHl0USEDELXY) MID NOT (400C);
lIiNOINCXY: lIitolPSrATUS (- (uiMPSTATUS) > (400C),GOTO[lIiMOFlEMSG]; "Incremellt pal't by 1
uiPflRT5: T

<-

lIiTMSG ( FlSIl[lIiIMSG,l], DOLGOTO[lIiMSGONE,uiMSGHRO,WATTHl], fll[uiPART,5];

uiMSGONE: T <- uiTMSG (. ('.IiTMSG) OR (IOOOOOC);

"'OR a 1

I)

it into tllo rnessJgc.

"Incr'cment (Negative) count.
uiMSGZERO: uiMPSTA1US ~ (uiMPSTATUS) + (4000C), OIlLGOTO[uiMOIlEMSG,uiENOMSG,H=O]; 'save buttons
uiKBDCHflNGE: t (. ldl'[uiH1SG.4,10]: "keyboard data
uiXMSG (. (1sIl[uiXt~$G,10J) or (t);
lIHJOKflDCHANGE: LJSFCTflSK;
uiMPSTATUS ~ (uiMPSTflTUS) fiND NOT (177400C),R[lURN; ·Clear count and part.

UITask.mc

3-Nov-7J 10:15:53

*00 hOI'izolltal processing.
\~o know that the contl'Ollol' needs dnta.
xpreVSO:
DISPATCII(uiMPSTATUS,ti,3], call[uiCHKMSG];
preVSO: T~ 2C, call[uiChockCursor];

uiVSO:

OUTPUT[uHWUFPTI1,uiOPREG]; ·pr'ecomputeti uHl3UFPTR to hardware.
T ~ (u100A) AND NOT (llC);
uWWA t- T;
'Start the First IOFElCI!
ui D~IT:
TOrE rCII16[ 1I iOASE.u iDOADDI1];
'Calculate the read bufFer' pointer, tho count, alld noxt I·ino's DOli
'-in the shadow of the f"iI'St IOFETCII (If thero is to be ITI:>:'e than 0110).
T • lIiUUFPTR ~ 377C;
uiNJllJFPTI1 (- (liiNfllJFPTr<)-P57C); "From here Oil, uiNOUFPTIl is llsed
*for the count (-(NWRDS + (ADURESS and 170»)
T'- HIII~IIS K[ u i NWHOS:1 ;
lIiBlJFPTR'" (uiBlJrPTB)-(T); *377-- numbor of wonts fOl' tho display
uiLlIJFPTR'- (uiOUrPTfl_) OH (IOOOOOC); 'Wakeup disable bit
f'- (HIIMASK[lIiNWHDS])'(T); • T'· 2*N\liHDS
uiDI1i\'·{uiDLlA)+(T); *uiDElA is now set up For the next sc;::n l-ine
ui D~IA'l ,-( u iOWA)' (;;:OC) ,CALl.[u iOWTl];
*Loop fOl' sf)cond thr'ough Ntil IOFETCH.
uiDW"ll: lIiNBUrpll1«lIilHlUrpTfl)'(20C),GOTO[uiBUI[)2,H>~O:J;
LOFETCH lB[ u WASE ,lJiDIlADDWl, COTO[lI iBUrD2X, ALU>~O];
uiDWA0T~{uiDWA)+{20C),fl[TURN;

uilllJrD2; uiVSCOUNT ,. {uiVSCOUN"I)-l,DBI.GOrO["lIiINDFHl.D,uiCONT.He.
'Post. the mouso COORDINi\TES to C(jf·O.

*\'iH

lIiV5J: lIiBASE ... OC;

r. (lIiBUFPTR)+(2[\C); *'12'11> AND '12Gb .~ ~l()lIse x ;"HI ..'/.
PFETCII2[uiOASE, JiDDA]; "lIiOflA S.
D1 51' !\TCH[ uiMPsr A TUS, !i, 31,
L Li: Iii CIIKMSG J;
uiMOUSEDLLXY ...

cr.

LCY[uIMUU~EDELXY,11],Dnl~OTO[uiSEM1,lIiNSEMl,n =0];

uiKDOWN: uiNWIlDS (- (uiNWRDS) AND NOT (T), GOTO[uiKSTOHE]; "key down, cleal' bit
uiKUP: IliNWIlDS ,- (uifJ\1HDS) on (T); *key III', set bit
uiKsronE: goto[uiMSGRTNl],PSTOIlEl[uiBASE,uiNWRDS,O]; ·store word
PI'{JVSG:

uillUFPTH f- 317C,

call[uiWAKEOFF];

"r'eturns to u'iVS6

PU[.JIJ

UITask./,lC

3-Nov-79 19:16:63

"Set up tile cursor.
'Get cursor coordill(ltes From 42Gb (X), (Inti 47./b (Y).
lIiVS6: T ,- (lIiBUFrTIl)+(27C); 'uiBUI'PII1 ~ 377 on ellt-I'Y,
I'FETCII2[u iBI\SE ,lI iCX]; ·Cursor X, Y cooruin(ltes
lH3P/ITCII[uiMPSTATUS, 5,:J], CALL[u iCIIKMSG];
*Expe/'imcnt has detormined that the cursor -is 3 niiJblos to Lhe left
'ilnd one sClp.4j.COTO[uiSrNDCLOOPJ;

*Loop for fil'st II bytes

uiDOIJ::CUR:

OIJTPUT[uiHMPl,uiCUHSWj; "Scnd !ith byte.
1.1)' Lor [ll iVSCOUN T. J. 1];
OUl flU If u iT E:.MP, u i cunsMl. COlOr ui csr. TlJPDONE . ALlI!lO 1; 'H.MP is 0 (6th byte)
"Ilicrement segment address
uiVSCOUNT .. (uiVSCOUNT)~(lOOOC),GOTO[uiMOIlECS[llJP];

lIiCSETlIPDOfJE:
r<- LDI[uiCX.6.101; 'ex COllnts nibbles. /lot bits
lIiCX" (LFRO)-T; "lind it is nogated.
LU'\IiCRvlOrm. goto[uiCSDONE,RODD]; "Test field
lIiCY'(lIiCY)-(lC);
uiCSDON[:
uiVSCOUNT<-5C;
OUTPUT[uiVSCOUNT. uiCXI1EC], call [u iWAKEOFF]; *rotuf'/1S to uiVS10

UITask.mc

3-Nov-70 19:16:53

·~J6 arc in the la~t scan 1 ille of 11 vert ical s.vnc pulse.
'Set up lIiVSCOUNT for tho ncxt field.
"uilHlK ilas I'v420, fetched during VS4.

u iVSIO: lIiCRl>lOHD •. (li iCnWORD) AND NOT (2C); 'ProVS ... 0
OLJTPllT[lIiCRWOflO,lIiCHEG];
lIiOUFPTn (. (lIiBUFPTR) OR (lOOOOOC);
III (. LOF[lIiCIIHOI1D,17,1];
T ... lIiLINESPEkFHLD,DnI.GOrO[uiEVX,uiODX,AL.U"O];
lIi[VX: lIiVSCOUNT , T, COTO[lIiDCflDONE];
lIiOUX: lIiVSCOUNT ... (ZEHO)-(T).I, GOTO[lIiDCDDONE];
enu[lIitask];

Pago

10

3-Nov-79 19:15:53

XWOeFs.mc

Titlo(XWOefs];

Dofinitions For XBrox wiro microcudo

, Last modiFied by Murray on September 15, 1979 12:03 PM
[lase re!] changes
modiFied by Murray on Septembor 13, 1970 7:47 PM
modit'"ied uy Challg on I\ugust 22, 1079 6:00 PM, [!love Timol"s regs & (SB
mollified by Chall!] 011 I\ugust 10, H170 8: 13 MI, He-Chilnyo CSfl
mocl-iried by Chang all August 3, 1~79 12:00 PM, Challgo CSfl A~s-igll!I"1IltS
mOdified hy Chang 011 JUliO 25, 1979 9:36 PM, [ONotify2 = 344
modified by Roy Ogus on June 13, 1979 12:25 PM
SET TASK [0]; -ror' R address

in~J

%
• Defs in GlobalDers
Set[EIrask, *J;
• Wire input task Ilumber
Sot[EOTask, ·-1;
• Wire output task l1ulilbor
Set[ElTask2, *];
-, Wire input task number (secolld controller)
Sct[EOTask2, *];
"Wire output task !lumber (se(.ol1d contro-I'ler)
Set[EEPage, "];
"Ellwlatol' (for SIll) page number
Setr UPage, "J;
* Hire input paue number'
Sel[EOrage, "];
* Wire output page numbsl'
%

-"Dispatch table locations
Set[EEflase, LSflTFT[[[Page, 10]];
Set[[[SIOLoc, AOD [[[flase, 1201J;
• Dispatch locntion for SIO (bits 16,11)
Se l[ [[2SIOLoc, 1\00 [[EBase, 1401];
, Dispatcll locatioll tor" SIO (bits 14,15)
'" Note Fo-llowillg def in GlobalDeFs:
"Sot[flS232SIOLoc, add[LShi n[HPage ,10], 370]];
"'Add'"ess constIakup [litmask
MC[XWlndexNoICIICollnt, ['"I;
"" COUllt of t"imes when no fCB chain (For test only)
~IClXWrndoxScratch, 101;
'" Quad word scratch al'oa
, MACHOs: Tile attn on the XWil'e is backwards to avo"id the Ol'illlcl'Burp
ipNOATTEN. Ir[@[XWi 1'0. 0, SKTP[NOATTUJ], SKIP[TOATHNll];
M@[$GoTo[OATTHI, IF[@[XWirc, 0, GOTO[lll, [oArrEN], GOrO[l/l. IJOATTHJ]]l;
~1@I$Sk

XIHnit.mc

Page

J-Nov-7D 19:16:53

insert,[rlOl ang];
NOMIDASINIT;LANGVEnSION;NULTDIB;
illso l·t[Gl obalDo fs];
inse l·t[XWDefs];
t itl e[XWIni t];
·Last modified by MlirrilY on Septembel' 15, ID7~
11:22 AM
Merge in XWInit2 and "ilse Register changes
• modified by HurrilY on September 14, 1979
12:48 AM
• modified by Hoy Oglls all June 13, 1979 12:21 PM
"For registol' addl'ossing.
SET TASK [0];

This code actually runs at the assiglled task 'Ievul.

ETHERNET controller INITIAl IZATIO/J.
Will only be called if there Is an Ethernet board in the machine,
nead Ethernet ID from hoard and form constant to be I'Htlll'lIed by SID.
Setup Notify valilo 'ill EONotifyReg
ON PAGE [EtherlnitPage];
XIInit:

CALL [XWSOtllp], X\Hump'" pEHostRegx, AT[EtheI'IIlIlIitLoc];
Input[StaGk, EIllost];
Slack " (Stack) AND (Jl7C);
" HostNumbor 'ill I'ight half
Slack <- (St.ilck) on ([F[@[X~li f'e, 0, EtherIOCSMask, XWi reIDCDMaskJ);
RETURN, Stkp <- XWTemp4; ·restore Stkp

XOInit:

CALL

[X\~Sr.tllf1],

XWTemjl ,- pFONolifyneg, AT[Etllel'OutfnitLoc];

Compule vulue for [ONotify register, used for notify ilfter timor wakeup,
X~lTulllP ,- AND@rOJ77, [OTimerDolicLoc'IC;
'l.ow 8 b'its of APC
XWTOlilP ,. (XIAJrcmp) OR (OR@[lshiFtJUHask,1'Q,AND@[/400,EOTimel'l)oneLocl]C);
T " X\oJTemp;
Stack'" f;
RETURN, Stkp ... XWTcmp4;

" lIigh 4 iJits of APC

·restore Stkp

• Second Doa I'd
XlInit2:
flETUI1N,

XOln il2:

CALL [XWSetllp],
Stkp ,- XWfemp4;

XI-Hemp <- pEliostRcgx. Al[Ethcr[n[nitl.oc2'1:
"1'ostOl'e Stkp

CALl. [XWSetup], XWfemp

<-

pEONotifyReg2, AT[ElherOutInitLoc2];

Compute value For EONotify register. used for notify after timer wakeup.
XWTemp ... AND@[03/7. EOTimer[)onel~clC;
• Low 8 bits of APC
XWllJllljJ" (XWTump) on (01H)Llshirt[EOTusk2,14I.Mm{~[1'100.E.OTiltlcl'l)ollul.ocJ]C);
r • X\oJTemp;
Stack <- f;
REf URN, SUp' XWTemp4; *restol'u Stkp

XWSutup:

r ... InitialCSB;
XWCSII (. T;
XWCSIlHi (- OC;
XWIOCFJII i " OC;
T

<- GUnSPEC[103] xor (J77C);
UseCfask, XWTelllp4 ,. T;
RETURN, Slkp ... XWTemp;

en (I [ x VI i re i II it] ;

*Stkp (inverted)

• lIil)h

bilsofAI'C

XWlnH2.lllc

3-Nov-79 19:15:53

Pagc

illsert[dOl ann];
NOMTOASI~IT;LA~GV[RSION;MULTOln;

illsert[GlobalDofs];
insert[XvlOefs] ;
t.itle[XWlnlt2];
"Last 1i1Odified by Roy Ogus on June 22. 1979

3:55 PM

SET TASK [OJ; *FoI' register addressing.

This code I'Dally

!'llnS

at task level EITask

HI/UnlET controllol' HllTl/\UZATTON.
rhis subroutine is for the second conLI'oPe,' board (exacuted by EITask).
Hill olliV be called if tliel'e 'is a second Ethernet board 'in the machine.
~/in ollly bo called uftCI' init of r-irst controller (which :;ot host uddross).
Initializes the notify register'.

ON PAGE [EthorInitPage];
XWirclnit2:
T <- GETRSPEC(103] xor (JI'lC). at[Elhr.)I'InitLoc?l; 'Stkp ('invorted)
COlilpute value for EONotify2 registor. IIsed fOI' not'ify :,IFtor tinl'1l' wakeup.
XWflase , . .'INDOrOJ77. [OTilllerDolleLoc'IC;
• Low 8 b'i ts of APe
X\4flase <- (XWUaso) OR (OH(~[lshift[LOTask2.14].I\ND@[1400.EOTilllol·Ool1eLoc:IJC);
XWBasell i " rEONol i f.vncq2;
Stkp " XHRasclli. Xl4llasell'i <- T;
T (, XI'/Base;
Stack " T;
HUI/RII. Stkp (, XWlJasefli; "restoro Stkp
"Note
hase registers arc ini t ia lized each t ill1[) input 01' outpulis disabled. so w(]
·do not lIeed to doil he!'e as long as input alld output arc d'isablod hefol'e enabled.

end[xwireinit2];

• lIigli 4 hits of I\PC

XI/Si 0 .mc

3-Nov-79 19:15:53

i 11 S e r·t [ dOl an!J 1;
NOMIDASIN IT; LMIGVEI1SION; WILlOID;
insert[GlobolOcfs];
inse rtiXWDefs];
rITI.E [XHSIO];
.. Xerox \~ir'e microcode (Oef,> ill X~JOofs)
.• Hrittell by Roy Ogus.
%
Last modified by noy Ogus - Juno 13, 197n 12:31 PM

I·Jotes:

- This version handles 1 Ethernet or 1 Xerox wir'[! bonrd.
- This module has SIO code For XWil'e.
- Contains Conditional assembly.
XWire~O for Ethornets, XWire=t for Xerox WIre boards.

Log:

- File 1'8o!'ganizatioll (Janual'y 15, 1919 11:23 AM).
- Conditiona'l assembly (February 4.1979 5:30 P~l).
- UPorado to 3.0 (April 12. 1979 fJ:14 PM).

%
SET TASK [OJ;

" EMULAIOR TASK -- SIOillstruction
ON PAGE [EFPage];
"flJi s code execut.es at task

" We goL hore arte/' Lho S10 instruct.ion has been issued.
rhe SIO control bits al'e in ACO.
" J'woboilrd furmat (lIsin!] 10CBs):
SID bits 16. 17: Board 1.
o
NOP
1
Disable output (TPC is initialized).
{'
Disable input (TPC is init.ia'iiLod).
3
Disable board 1 (TIlC not init'ial'ized)
SIO bits 14,15: Board 2.
o
Unused (NOP)
1
Disablo output (TPC is initialized)
2
Disable input (TPC is initialized)
3
Disable board 2 (TPC not initialized)
Note: HS232 SIO bits are 10, 11.
"
•
,
•

fo unable boards. use OUTPUl[Commund, StateRegistcrl;
Boa/'d 1 : Stateno!] istp.rl = LSIIIFT[EOTask, I)].
Board 2 : StaleltlJgisler2 " LSIIIFT[EOfask2, 4] .
Commands:
EnableOutput = 103fl.
Enoblelnpllt = 220£1.

", S lOre turn s (i n IIC 0) :
IICO[0:2J- 3
IICO[3:7]
3m
ACO[lOB:17flJ

Al to-emul;ltion Etlwrnot IIIlcl'ocoort:
HHMP ,. iIilD0[EOTilSk2.1i'J. cr,Ll. [XWKiIITimol'];
r .- XOW J' i l cSt ate 2. C1\ LL [ X\vl) i s a b 10 .] ;
r , XIVIri tcStato2. CJ\U[XWDisablo];
GOrO [[[51000110];
XWOisablo:
OUTPUT[HCNTJ. GOTO[XWOally];
XHKi·llTimor:
RrfMP t- (IlTEMP) + (XWIdleTimor);
LoadT imOJ'[llTEMP]. RETUHN;
END;

Pago

3-Nov-J9 19;16:63

X~lTask.mc

insart[dOliJng~l;

NOtHDAS INIT; LANGVE nSION; MULTDID ;
in50rt[GlobalDefs];
inse rt[XWDefsJ;
ITrLE [XWTask]; • Xerox \oJiro miCl'ocode (DeFs in XWDefs)

• Last modified by Murray on September 21, 1979 3;01 AM
motiHied by Murray 011 Septembllr 15, 1979 Base ['eg c;hallges
modified hy MUI'f'ay on September 13, 1979 J:4"1 PM
written by Roy Ogus (early 79).
%
rhi3 module contains basic code for a single controlle~.
F i'e X\1SI02 cOlltain5 Staf'tIO code for two boards.
This version has Ethernet address recognition.
DJCOU!lt
XWPtr
XWPtrili

R5
H6
H7
HlO
Rll
R l2
Rl3

Xv/IOCn

R14
n15
H l6
H17

XWTcmpl
XIHemp2
XIHemp3
XWTomp4

X~J[OCntl

-

Ouffnr displacement

- Buffel' word COUll to I' (quaelword burfe I')
-

i

XWCS£l
XHCSBfli

It I'egisters

R4
n5
R6
117

(used by Dolnt)
(used by OoInt)
Tempo ra ry 1'0 gi s Lot'
- Comp'lel ion word

Bliffer pLr (low) ( current roCB)
fluf fa I' p tr (high) (curront IOCn)

- Base register 1'0 I' current IOCA ( low)
(11 igh)

- Base reg -i ste r 1'0 r cllrrent :WCB
- Base reg "iste,' fo r csn (low)
Bil:;O

register 1'0 I' CSB (high)

TempOl'a ry
Temporary
- Temporal'y
- rClilpo r'il ry

reg is te I' (quadworel bll f fo 1')
register
rng ister
reg is tor

that oveday normal use
- first word of CSB (not cUI'rently used)
- Short pointcr to next lOCO
- 1I0st adell'ess (low
input only)
- 1I0st aeldl'ess (high -input only)

X~/CSOI

XWNextTOCB
XIIiALo
X [Ilf1fli

Page

XWTask.mc

INPUT

3-Nov-79 19:15:53

MICROCODE

Input CSIl
00
01
02
03
0'1
05

OG-07
10-13
1IJ --17

(reserved rOt' emulator control)
Short pointer to First IOCB
Host I.lddross (low word)
Host address (high word)
Input wakeup bit mask
Packets missed (For debuHn-inO)
(unused)
quadword scratch burer
Used by test program

Inpu t lOCO
00

01

02
03

04
05

06
07

Link to next lOCO
(llnused)
Commond word
Completion word
Amount used "in buffer
Length of buffer
Low pointer to buffer
lIigh pointer to buffer

%

SET TASK [0];

* For R-register addressing

UN PAGE[EIPage];
• Input microcode is notH"ied at XIStart toinjt"ia"' ize.
XIStal't:
XlolTemp <- XWDisableInput. CAL.I"[XWOutStilLe]. AT [EIStaI't.Loc];
ADOHESS HECUGIIITION: Ethernet encapsulation assumed.
Check if the p<1cket.
is explicitly for this host (dest=us).
or is broddcast (dest=O).
or if tho host is promiscuous (U5=0).
• There are two wakeup points.
XIBllgin: No prefetch of CSB has been done.
XIFastBeg in: PI'cretch of CSO has been dOlle.
XIOegin:
PFctch4 [XWcsn. XWCSBI. XWlndexHoadcr!]; "Fetch first 4 words of CSO
XIFastBcgill:
10Slore4 [XWCSO. XIData. XW[ndcxScratch!]; "Read in ~ words to scratch al'ea in CSO
LU ... nlll~ASK[XIII/\Lo];
SKIP [AtUnO]. PFetch4 [XWCSO. XWlcmpl. XWIndexScratch!];
GUlO [XIForMeJ. T ... XWNextIOCO; • we are promiscuous
T <. nSIl [XWTempl. 10]; "Iligllt justify desL"illatioll host in T
SKIP [ALUI/O]. LU" (RII1.tllSKPTlIALo]) XOIl (T);
COlO [XHOI'Mll!. I ... XWNextIOCn; "Oroddcast
SKIP [liLliI/O];
GOTO [XIrorMe]. T ... XWNextIOCB; "Packet explicitly for me
, Packet not accepted by filter.
Tell the hal'dwilre to ignore the I'est of the packet, i.e. purge packet.
XIPurge:
XWTemp ... XWSetPurgeMode; CALL[XWOutStatc];
• Heturn here after wakcup
GOTO [XIFastnegin];
GET DUFFEll STARTED
, Check for no lOCO available (in caSH it was a slow wakeup).
XI Fo rMc:
GOTO[XIIlldcxOK. AI.UIIO]. XWIOCI3 <- T; • ALU"O =) No IDCO
.". No IOCB. BUlllp counter in CSB.
Pfetchl[XWCSIl. XWTelllp, XWIndexNoICI3Collnt!];
XWTemp ... (XWTemp)+l;
PStorel[XWCSn. XWTemp. XWlndexNoICBCount!];
XIPul'geSlow:
XWTemp ... XWSctPurgeMode; CALL[XWOutState];
• Ileturn here after wakeup
GOTO [XInegin];
., Set lip roCO.
XIIndexOK:
Check for rUllt packets «-= 3 l'Iords. excluding CHC).
IOATTEN=l (0 on XIHrc) =) EOP =) sllldll packet
$Sk i pNOATTEN;
GOTO [XIPIII'ge];
NOP; "lI"lignlllent(7) Ether
CALL[XWBSetup];
XWCount ... (XWCount)-(4C);
SKIP [ALlI>=O];
GOTO [XIMark]. T .. XWCompletion ... XWErrorZeroBuf;
NOP; "Alignlllent(1) XWire
r ... OC. CALL[XWStoreTelllps];
CALL[XILoop]. XWCount ... (XWCount)-(4C);
Main loop-cllecks for end of buffer. thon checks ATTEN For end-oF-packet.
XILoop: GOTO [XIQuadFull. R=O];
GOTO [XOMal'k 1. T f- XV/Completion t- XWEI'rorZerol3uf;
PFetchl[XVIIOCfl, XVlTempl, XWIndexTranslnt!];
SKIP [R)~Ol, XWTempl'- (LSII[XIHolllpl,l])+l; • R(O
GOTO [XOMarkJ, T ~ XWCompletion ~ XWErrorCountOV;
I'Sto l'ellXWIOCl3, XWTcmpl, XWllldoxTrilnsInt!];

"fluffer empty
=)

overflow

'" Compute cOUlltdown interval
" Use memory refresh address for random number.
XOCoulltdown:
T ,- Stkp;
., Save St kp
XWTemp3 ,- pXHRandomRefj; "point to "random" register
Stkp t- XWTcmp3. XWTemp3 ,- T; "",,' Expect 'interlock warning
Form new transmission interval mask, chcck if old has overflowed
T ,- CTIISK;
'" XOR with Task IItlllluer to add I'=0),
EQT'imorDone:
XWTempl ~ 177C, liT [EOTimerDoneLoc]; * Set up maximum timer value
GOTO [XOLoadTimer, R>=O]. XWTemp3 ~ (XWTemp3)-1;
Countdown interval is over
Start to output words to the hardware.
The hardware will start
the transmiss-ion to the Wire as soon as the buffer has
> 10 words in the hal'dware buffer, 01' the OutputEOP b"it
is set (for a packet of less than 12 words)
XWTemp ... XWEnableOutput, CALL[XWOutState];
XOGO:
IFE@[XWire, 0, COMCIIAR@["], COMCIIIIR@[']];
---- This code for Ethernet boards.
XWIndex ~ (XWIndex)-(4C);
• Initialize displacement to -4
---- End of code for Ethernet boards.

3-Nov-70 10:16:63

XWTask,mc

---- This code for Xerox Wlro boards, Sand Preaillble,
T (. XHTemp t· XWProam;
XWfemp (- (LSH(XWTnmp,lO]) on (T);
OUTPUT[XWTemp, XODataJ;
X\Hndox (- (XWlndex)-(4C);
• Let XWTclIlp be written
nJTIJIllp ... (XIHomp) + 1;
OUfrUT[XWfemp, XODatal, CALL[XWDally];
---- End of codo for Xorox Wire boards.
COMCIIAR@[-];
*ReseL back to ~
CALL[XOLoop], XWCount (- (XWCount)-(4C);
Main loop -checks for ell;] of buner, thell checks ATTEN fOI' entl-of-pkt,
XOL.oop: GOTO [XOQuadEITIpty, IlJNext] ;
• Got Ilnxt IOCR set up, and fall into collision,
, COI.LISION, restal't same packet,
XOClear:
XWTemp ... XWDisableOlitput;
OUTPUT [XWTemp, XWWriteStateJ;
XWlemp <- XWEnableOutpllt, CALL[XWOutState];
'" Now check if there is a bufFer,
r <- XWNextIOCB, GOTO[XOCheck];

Page

5

j-Nov-79 19:15:53

XWTask.mc

Pago

SUBHOU1INES

'" Get buFFer descl'iptol' pointed to in T,
.lnd f"ix pointel' (in X~lrtr, XWPtrH"i) XWPtrHi goes Froll1 (0,
• Clears XWlndex
XIoIdSetup:

"

xl

to

(x, x+l)

PFetch4 [XWIQCD, XWlndex, XWIndcxBuffer!];
XWIndox .- OC;
r
(XWPtrHi)"rt;
* Fix lip high pointe.• MIJMULE
RLTURN,

XWPtrll"i <- (LSII[XWPtrHi, 10J) OR (T);

'" Various simple L.oad/Slol'C routinos tll,lt aro handy for TASKill!J
T points to dcst lnat"ioll \'lord
XWStoreStotlls:
XI15to re I II dex :

GOTO[XWReturn], PStofel[XWIOCn, XWColl1plction, XWIndcxCompletion!];
GOTOr XWRe t UI'n:l, PSto rc 1 [XWIOCll, XWI 11 do x. X~lIl1d0x!l:Jf Fe I'! 1;

XWSLoroTcmps:

RETURN,

rStore4[XWPtr, XWTcmpl];

"Chain to ncxt IOcrl and update pointer in csn
" This could be lIlurgcd with XWNotify,
but that would be too long between TASKs
XWNexL:
Pfetch4[XvlCSB, XWCSBI. XIHlldexllcadcr!l;

I.U ,- XWCSfll;
PFetclll[XWIOCIl, X~IN()xtIOCfl. X\HlldexHext!];
L.U ~ XWNextIOCB;
RETURN,

*

~Iotiry

PSture4[XWCSB, XWCSB1. XWIndcxllauder!l:

the driver.

XWNo t i Fy:

XWTemp, XWllldexWake!]:
* Fetch wakeup hilmask
'100000c IllEJan:i tasking rotul'll
(lOOOOOc). GOTOP[Dolnt];

PFetchl [XWCSB,

1.0adPayc[0"j;

r.

(XWTolllp)

01'

XWOutStato:

OUTPUT [XWTernp, XUWriteState];
X\lJDally:

NOP;" Need at least 2 instruct"iolls aftol' OUTPUT before task switch

X~mellll"n:

Hl.TLJRN;

END[XWTask];



Source Exif Data:
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
PDF Version                     : 1.3
Linearized                      : No
XMP Toolkit                     : Adobe XMP Core 4.2.1-c041 52.342996, 2008/05/07-21:37:19
Create Date                     : 2004:09:29 11:06:42-07:00
Modify Date                     : 2018:06:23 10:57:15-07:00
Metadata Date                   : 2018:06:23 10:57:15-07:00
Producer                        : Adobe Acrobat 9.0 Paper Capture Plug-in
Format                          : application/pdf
Document ID                     : uuid:a2efadae-a362-b24a-be54-a55ef952f3f4
Instance ID                     : uuid:a4933a12-14ea-5549-8ce5-3466e8ff0e12
Page Layout                     : SinglePage
Page Mode                       : UseOutlines
Page Count                      : 282
EXIF Metadata provided by EXIF.tools

Navigation menu