User guide

CONTENTS iii
4.4 cli.b and cli
init.b . . . . . . . . . . . . . . . . . . . . . . . . 128
5 Console Input and Output 131
5.1 Cintsys console streams . . . . . . . . . . . . . . . . . . . . . . . . 131
5.2 Cintpos console streams . . . . . . . . . . . . . . . . . . . . . . . 132
5.2.1 Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
5.2.2 Exclusive Input . . . . . . . . . . . . . . . . . . . . . . . . 134
5.2.3 Direct access to the screen and keyboard . . . . . . . . . . 134
6 Cintpos Devices 135
6.0.4 The Clock Device . . . . . . . . . . . . . . . . . . . . . . . 135
6.0.5 The Keyboard Device . . . . . . . . . . . . . . . . . . . . 136
6.0.6 The Screen Device . . . . . . . . . . . . . . . . . . . . . . 136
6.0.7 TCP/IP Devices . . . . . . . . . . . . . . . . . . . . . . . 136
7 The De bugge r 139
7.1 The Cintsys Debugger . . . . . . . . . . . . . . . . . . . . . . . . 139
7.2 The Cintpos Debugger . . . . . . . . . . . . . . . . . . . . . . . . 143
8 The De si gn of OCODE 145
8.1 Representation of OCODE . . . . . . . . . . . . . . . . . . . . . . 145
8.2 The OCODE Abstract Machine . . . . . . . . . . . . . . . . . . . 146
8.3 Loading and Storing values . . . . . . . . . . . . . . . . . . . . . . 147
8.4 Field Selection Operators . . . . . . . . . . . . . . . . . . . . . . . 148
8.5 Expression Operators . . . . . . . . . . . . . . . . . . . . . . . . . 149
8.6 Functions and Routines . . . . . . . . . . . . . . . . . . . . . . . . 150
8.7 Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
8.8 Directives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
8.9 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
9 The De si gn of Cintcode 155
9.1 Designing for Compactness . . . . . . . . . . . . . . . . . . . . . . 156
9.1.1 Global Variabl es . . . . . . . . . . . . . . . . . . . . . . . 157
9.1.2 Composite Instructions . . . . . . . . . . . . . . . . . . . . 158
9.1.3 Relative Addressing . . . . . . . . . . . . . . . . . . . . . . 158
9.2 The Cintcode Instruction Set . . . . . . . . . . . . . . . . . . . . 159
9.2.1 Byte Ordering and Alignment . . . . . . . . . . . . . . . . 15 9
9.2.2 Loading Values . . . . . . . . . . . . . . . . . . . . . . . . 161
9.2.3 Indirect Load . . . . . . . . . . . . . . . . . . . . . . . . . 162
9.2.4 Expression Operators . . . . . . . . . . . . . . . . . . . . . 162
9.2.5 Simple Assign m ent . . . . . . . . . . . . . . . . . . . . . . 163
9.2.6 Indirect Assignm ent . . . . . . . . . . . . . . . . . . . . . 164
9.2.7 Function and Routine Calls . . . . . . . . . . . . . . . . . 164