annotate doc/general/ede.lyx~ @ 30:c0c2e99b6bb0

fixed negative rel8 address bug in assembler
author james <jb302@eecs.qmul.ac.uk>
date Tue, 15 Apr 2014 12:21:22 +0100
parents a542cd390efd
children
rev   line source
jb302@26 1 #LyX 2.0 created this file. For more info see http://www.lyx.org/
jb302@26 2 \lyxformat 413
jb302@26 3 \begin_document
jb302@26 4 \begin_header
jb302@26 5 \textclass article
jb302@26 6 \use_default_options true
jb302@26 7 \maintain_unincluded_children false
jb302@26 8 \language english
jb302@26 9 \language_package default
jb302@26 10 \inputencoding auto
jb302@26 11 \fontencoding global
jb302@26 12 \font_roman lmodern
jb302@26 13 \font_sans lmss
jb302@27 14 \font_typewriter lmtt
jb302@27 15 \font_default_family sfdefault
jb302@26 16 \use_non_tex_fonts false
jb302@26 17 \font_sc false
jb302@26 18 \font_osf false
jb302@26 19 \font_sf_scale 100
jb302@26 20 \font_tt_scale 100
jb302@26 21
jb302@26 22 \graphics default
jb302@26 23 \default_output_format default
jb302@26 24 \output_sync 0
jb302@26 25 \bibtex_command default
jb302@26 26 \index_command default
jb302@26 27 \paperfontsize default
jb302@26 28 \spacing single
jb302@26 29 \use_hyperref false
jb302@26 30 \papersize default
jb302@26 31 \use_geometry false
jb302@26 32 \use_amsmath 1
jb302@26 33 \use_esint 1
jb302@26 34 \use_mhchem 1
jb302@26 35 \use_mathdots 1
jb302@26 36 \cite_engine basic
jb302@26 37 \use_bibtopic false
jb302@26 38 \use_indices false
jb302@26 39 \paperorientation portrait
jb302@26 40 \suppress_date false
jb302@26 41 \use_refstyle 1
jb302@26 42 \index Index
jb302@26 43 \shortcut idx
jb302@26 44 \color #008000
jb302@26 45 \end_index
jb302@26 46 \secnumdepth 3
jb302@26 47 \tocdepth 3
jb302@26 48 \paragraph_separation indent
jb302@26 49 \paragraph_indentation default
jb302@26 50 \quotes_language english
jb302@26 51 \papercolumns 1
jb302@26 52 \papersides 1
jb302@26 53 \paperpagestyle default
jb302@26 54 \tracking_changes false
jb302@26 55 \output_changes false
jb302@26 56 \html_math_output 0
jb302@26 57 \html_css_as_file 0
jb302@26 58 \html_be_strict false
jb302@26 59 \end_header
jb302@26 60
jb302@26 61 \begin_body
jb302@26 62
jb302@26 63 \begin_layout Title
jb302@26 64 EDE: ELB816 Development Environment
jb302@26 65 \end_layout
jb302@26 66
jb302@26 67 \begin_layout Author
jb302@26 68 James Bowden (110104485)
jb302@26 69 \end_layout
jb302@26 70
jb302@26 71 \begin_layout Abstract
jb302@26 72 The ELB816 Development Environment consists of an assembler, emulator and
jb302@26 73 debugger for the ELB816 microprocessor system.
jb302@27 74 This report details the design and usage of each of its elements.
jb302@26 75 \end_layout
jb302@26 76
jb302@26 77 \begin_layout Standard
jb302@26 78 \begin_inset Newpage newpage
jb302@26 79 \end_inset
jb302@26 80
jb302@26 81
jb302@26 82 \end_layout
jb302@26 83
jb302@26 84 \begin_layout Standard
jb302@27 85 \begin_inset CommandInset toc
jb302@27 86 LatexCommand tableofcontents
jb302@27 87
jb302@27 88 \end_inset
jb302@27 89
jb302@27 90
jb302@27 91 \end_layout
jb302@27 92
jb302@27 93 \begin_layout Standard
jb302@27 94 \begin_inset Newpage newpage
jb302@27 95 \end_inset
jb302@27 96
jb302@27 97
jb302@27 98 \end_layout
jb302@27 99
jb302@27 100 \begin_layout Part
jb302@27 101 Introduction and Specification
jb302@27 102 \end_layout
jb302@27 103
jb302@27 104 \begin_layout Standard
jb302@27 105 \begin_inset ERT
jb302@26 106 status open
jb302@26 107
jb302@26 108 \begin_layout Plain Layout
jb302@27 109
jb302@27 110
jb302@27 111 \backslash
jb302@27 112 bigskip
jb302@27 113 \end_layout
jb302@27 114
jb302@27 115 \end_inset
jb302@27 116
jb302@27 117
jb302@27 118 \end_layout
jb302@27 119
jb302@27 120 \begin_layout Section
jb302@27 121 Motivations
jb302@27 122 \end_layout
jb302@27 123
jb302@27 124 \begin_layout Standard
jb302@27 125 The ELB816 architecture is designed to be a
jb302@27 126 \begin_inset Quotes eld
jb302@27 127 \end_inset
jb302@27 128
jb302@27 129 simple to understand 8-bit microprocessor system to help learn about microproces
jb302@27 130 sor electronics.
jb302@27 131 \begin_inset Quotes erd
jb302@27 132 \end_inset
jb302@27 133
jb302@27 134
jb302@27 135 \end_layout
jb302@27 136
jb302@27 137 \begin_layout Standard
jb302@27 138 \begin_inset ERT
jb302@27 139 status open
jb302@27 140
jb302@27 141 \begin_layout Plain Layout
jb302@27 142
jb302@27 143
jb302@27 144 \backslash
jb302@27 145 bigskip
jb302@27 146 \end_layout
jb302@27 147
jb302@27 148 \end_inset
jb302@27 149
jb302@27 150
jb302@27 151 \end_layout
jb302@27 152
jb302@27 153 \begin_layout Standard
jb302@27 154 The combination of an ELB816 emulator, debugger and assembler could be used
jb302@27 155 as a set of tools for learning or teaching microprocessor programming without
jb302@27 156 the intricacies of real-world commercial microprocessors getting in the
jb302@27 157 way of a fundamental understanding of the subject.
jb302@27 158 \end_layout
jb302@27 159
jb302@27 160 \begin_layout Standard
jb302@27 161 \begin_inset ERT
jb302@27 162 status open
jb302@27 163
jb302@27 164 \begin_layout Plain Layout
jb302@27 165
jb302@27 166
jb302@27 167 \backslash
jb302@27 168 bigskip
jb302@27 169 \end_layout
jb302@27 170
jb302@27 171 \end_inset
jb302@27 172
jb302@27 173
jb302@27 174 \end_layout
jb302@27 175
jb302@27 176 \begin_layout Standard
jb302@27 177 A PC based emulator would allow students to quickly develop and debug programs
jb302@27 178 written in a simple assembly language on any modern desktop or laptop and
jb302@27 179 an MCS-51 port running on an 8052 would allow students to test programs
jb302@27 180 in an actual circuit.
jb302@27 181 \end_layout
jb302@27 182
jb302@27 183 \begin_layout Section
jb302@27 184 Project Aims
jb302@27 185 \end_layout
jb302@27 186
jb302@27 187 \begin_layout Itemize
jb302@27 188 Develop an assembler for the ELB816 assembly language.
jb302@27 189 \end_layout
jb302@27 190
jb302@27 191 \begin_layout Itemize
jb302@27 192 Develop an emulated programmable microprocessor system based on the ELB816
jb302@27 193 architecture.
jb302@27 194 \end_layout
jb302@27 195
jb302@27 196 \begin_layout Itemize
jb302@27 197 Develop a debugger that allows interactive debugging of programs running
jb302@27 198 on the emulator.
jb302@27 199 \end_layout
jb302@27 200
jb302@27 201 \begin_layout Section
jb302@27 202 Methodology
jb302@27 203 \end_layout
jb302@27 204
jb302@27 205 \begin_layout Subsection
jb302@26 206 Assembler
jb302@26 207 \end_layout
jb302@26 208
jb302@27 209 \begin_layout Description
jb302@27 210 Language: Python
jb302@27 211 \end_layout
jb302@27 212
jb302@27 213 \begin_layout Description
jb302@27 214 Priority: First
jb302@27 215 \end_layout
jb302@27 216
jb302@27 217 \begin_layout Standard
jb302@27 218 The assembler will be developed before anything else so that it can subsequently
jb302@27 219 be used to assemble test programs during development of the emulator.
jb302@27 220
jb302@27 221 \end_layout
jb302@27 222
jb302@27 223 \begin_layout Standard
jb302@27 224 \begin_inset Newpage newpage
jb302@26 225 \end_inset
jb302@26 226
jb302@26 227
jb302@26 228 \end_layout
jb302@26 229
jb302@27 230 \begin_layout Subsection
jb302@26 231 Emulator
jb302@26 232 \end_layout
jb302@26 233
jb302@27 234 \begin_layout Description
jb302@27 235 Language: C
jb302@26 236 \end_layout
jb302@26 237
jb302@27 238 \begin_layout Description
jb302@27 239 Priority: Second
jb302@27 240 \end_layout
jb302@27 241
jb302@26 242 \begin_layout Standard
jb302@27 243 The emulator will use only standard libraries in order to ensure it is portable
jb302@27 244 between compilers and platforms.
jb302@27 245 Specifically GCC for x86 and Keil C51 for Intel MCS-51.
jb302@27 246 The emulator will first be developed on Linux to facilitated rapid development.
jb302@27 247 It will be ported to MCS-51 once it is complete
jb302@27 248 \end_layout
jb302@27 249
jb302@27 250 \begin_layout Subsection
jb302@26 251 Debugger
jb302@26 252 \end_layout
jb302@26 253
jb302@27 254 \begin_layout Description
jb302@27 255 Language: C/Python
jb302@27 256 \end_layout
jb302@27 257
jb302@27 258 \begin_layout Description
jb302@27 259 Priority: Second
jb302@27 260 \end_layout
jb302@27 261
jb302@27 262 \begin_layout Standard
jb302@27 263 The debug interface will be developed along side the emulator.
jb302@27 264 It will consist of a simple text based interface built into the emulator
jb302@27 265 that will read commands using C's
jb302@27 266 \begin_inset listings
jb302@27 267 lstparams "basicstyle={\ttfamily}"
jb302@27 268 inline true
jb302@27 269 status open
jb302@27 270
jb302@27 271 \begin_layout Plain Layout
jb302@27 272
jb302@27 273 stdio.h
jb302@27 274 \end_layout
jb302@27 275
jb302@26 276 \end_inset
jb302@26 277
jb302@27 278 library.
jb302@27 279 This means that on Linux the commands will be issued using
jb302@27 280 \begin_inset listings
jb302@27 281 lstparams "basicstyle={\ttfamily}"
jb302@27 282 inline true
jb302@27 283 status open
jb302@27 284
jb302@27 285 \begin_layout Plain Layout
jb302@27 286
jb302@27 287 STDIN
jb302@27 288 \end_layout
jb302@27 289
jb302@27 290 \end_inset
jb302@27 291
jb302@27 292 and on the MCS-51 version they will be issued over a serial interface.
jb302@27 293 Python will be used to provide a cleaner interface for common debug procedures
jb302@27 294 such as writing programs to memory and setting break-points.
jb302@27 295
jb302@27 296 \end_layout
jb302@27 297
jb302@27 298 \begin_layout Standard
jb302@27 299 \begin_inset ERT
jb302@27 300 status open
jb302@27 301
jb302@27 302 \begin_layout Plain Layout
jb302@27 303
jb302@27 304
jb302@27 305 \backslash
jb302@27 306 bigskip
jb302@27 307 \end_layout
jb302@27 308
jb302@27 309 \end_inset
jb302@27 310
jb302@27 311
jb302@27 312 \end_layout
jb302@27 313
jb302@27 314 \begin_layout Standard
jb302@27 315 The remainder of this report is split into three parts, one for each component
jb302@27 316 of the project, and will attempt to demonstrate the design and usage of
jb302@27 317 each of these components.
jb302@27 318
jb302@26 319 \end_layout
jb302@26 320
jb302@26 321 \begin_layout Standard
jb302@26 322 \begin_inset Newpage newpage
jb302@26 323 \end_inset
jb302@26 324
jb302@26 325
jb302@26 326 \end_layout
jb302@26 327
jb302@26 328 \begin_layout Part
jb302@26 329 Assembler
jb302@26 330 \end_layout
jb302@26 331
jb302@26 332 \begin_layout Standard
jb302@26 333 The assembler is written in pure Python 2 using only the standard library.
jb302@26 334 It assembles the assembly the language described in the ELB816 specification
jb302@26 335 with a few minor differences.
jb302@26 336 These differences are:
jb302@26 337 \end_layout
jb302@26 338
jb302@26 339 \begin_layout Itemize
jb302@26 340 In-line arithmetic must be wrapped in curved brackets eg.
jb302@26 341 start with '(' and end with ')'.
jb302@26 342 This is a limitation of the design of the program and to change it would
jb302@26 343 require a large amount of code to be re-written.
jb302@26 344 \end_layout
jb302@26 345
jb302@26 346 \begin_layout Itemize
jb302@26 347 The only directives that have been implemented are
jb302@26 348 \begin_inset listings
jb302@26 349 lstparams "basicstyle={\ttfamily}"
jb302@26 350 inline true
jb302@26 351 status open
jb302@26 352
jb302@26 353 \begin_layout Plain Layout
jb302@26 354
jb302@26 355 ORG
jb302@26 356 \end_layout
jb302@26 357
jb302@26 358 \end_inset
jb302@26 359
jb302@26 360 ,
jb302@26 361 \begin_inset listings
jb302@26 362 lstparams "basicstyle={\ttfamily}"
jb302@26 363 inline true
jb302@26 364 status open
jb302@26 365
jb302@26 366 \begin_layout Plain Layout
jb302@26 367
jb302@26 368 EQU
jb302@26 369 \end_layout
jb302@26 370
jb302@26 371 \end_inset
jb302@26 372
jb302@26 373 ,
jb302@26 374 \begin_inset listings
jb302@26 375 lstparams "basicstyle={\ttfamily}"
jb302@26 376 inline true
jb302@26 377 status open
jb302@26 378
jb302@26 379 \begin_layout Plain Layout
jb302@26 380
jb302@26 381 DB
jb302@26 382 \end_layout
jb302@26 383
jb302@26 384 \end_inset
jb302@26 385
jb302@26 386 and
jb302@26 387 \begin_inset listings
jb302@26 388 lstparams "basicstyle={\ttfamily}"
jb302@26 389 inline true
jb302@26 390 status open
jb302@26 391
jb302@26 392 \begin_layout Plain Layout
jb302@26 393
jb302@26 394 DS
jb302@26 395 \end_layout
jb302@26 396
jb302@26 397 \end_inset
jb302@26 398
jb302@26 399 .
jb302@26 400 The other directives listed in the specification have not been implemented,
jb302@26 401 but there omission is only due to time constraints and they could easily
jb302@26 402 be implemented in a later version.
jb302@26 403 \end_layout
jb302@26 404
jb302@26 405 \begin_layout Itemize
jb302@26 406 Macros have not been implemented also due to time constraints.
jb302@26 407 \end_layout
jb302@26 408
jb302@26 409 \begin_layout Standard
jb302@26 410 The assembler consists of two files:
jb302@26 411 \end_layout
jb302@26 412
jb302@26 413 \begin_layout Itemize
jb302@26 414 \begin_inset listings
jb302@26 415 lstparams "basicstyle={\ttfamily}"
jb302@26 416 inline true
jb302@26 417 status open
jb302@26 418
jb302@26 419 \begin_layout Plain Layout
jb302@26 420
jb302@26 421 language.py
jb302@26 422 \end_layout
jb302@26 423
jb302@26 424 \end_inset
jb302@26 425
jb302@26 426 which contains the language definition in an index and some functions to
jb302@26 427 help encode instructions.
jb302@26 428 \end_layout
jb302@26 429
jb302@26 430 \begin_layout Itemize
jb302@26 431 \begin_inset listings
jb302@26 432 lstparams "basicstyle={\ttfamily}"
jb302@26 433 inline true
jb302@26 434 status open
jb302@26 435
jb302@26 436 \begin_layout Plain Layout
jb302@26 437
jb302@26 438 assembler.py
jb302@26 439 \end_layout
jb302@26 440
jb302@26 441 \end_inset
jb302@26 442
jb302@26 443 which contains the first and second pass functions and handles opening
jb302@26 444 source files and writing binary files.
jb302@26 445 \end_layout
jb302@26 446
jb302@26 447 \begin_layout Standard
jb302@27 448 The following sections details the design and behavior of the assembler.
jb302@26 449 However it must be noted that these are abstract and high level descriptions
jb302@26 450 that do not fully explain minor routines, but give an overview of the entire
jb302@26 451 process.
jb302@26 452 The full source code is attached in the Appendix and should be referenced
jb302@26 453 for a deeper understanding of the program's operation.
jb302@27 454 The final section is a short programmers manual demonstrating the assembler's
jb302@27 455 features.
jb302@26 456 \end_layout
jb302@26 457
jb302@26 458 \begin_layout Standard
jb302@26 459 \begin_inset Newpage newpage
jb302@26 460 \end_inset
jb302@26 461
jb302@26 462
jb302@26 463 \end_layout
jb302@26 464
jb302@26 465 \begin_layout Section
jb302@26 466 Data Structures
jb302@26 467 \end_layout
jb302@26 468
jb302@26 469 \begin_layout Itemize
jb302@26 470 \begin_inset listings
jb302@26 471 lstparams "basicstyle={\ttfamily}"
jb302@26 472 inline true
jb302@26 473 status open
jb302@26 474
jb302@26 475 \begin_layout Plain Layout
jb302@26 476
jb302@26 477 reserved arguments
jb302@26 478 \end_layout
jb302@26 479
jb302@26 480 \end_inset
jb302@26 481
jb302@26 482
jb302@26 483 \end_layout
jb302@26 484
jb302@26 485 \begin_layout Standard
jb302@26 486 This structure contains a list of string representations of the reserved
jb302@26 487 word arguments for the instruction set.
jb302@26 488 These all equate to registers or register pointers.
jb302@26 489 The full list is as follows:
jb302@26 490 \end_layout
jb302@26 491
jb302@26 492 \begin_layout Standard
jb302@26 493 \begin_inset listings
jb302@26 494 lstparams "basicstyle={\ttfamily},captionpos=b,frame=tb,framexbottommargin=1em,framextopmargin=1em,keywordstyle={\color{blue}},tabsize=4"
jb302@26 495 inline false
jb302@26 496 status open
jb302@26 497
jb302@26 498 \begin_layout Plain Layout
jb302@26 499
jb302@26 500 a, c, bs, ie, flags,
jb302@26 501 \end_layout
jb302@26 502
jb302@26 503 \begin_layout Plain Layout
jb302@26 504
jb302@26 505 r0, r1, r2, r3,
jb302@26 506 \end_layout
jb302@26 507
jb302@26 508 \begin_layout Plain Layout
jb302@26 509
jb302@26 510 dptr, dpl, dph,
jb302@26 511 \end_layout
jb302@26 512
jb302@26 513 \begin_layout Plain Layout
jb302@26 514
jb302@26 515 sp, sph, spl,
jb302@26 516 \end_layout
jb302@26 517
jb302@26 518 \begin_layout Plain Layout
jb302@26 519
jb302@26 520 @a+pc, @a+dptr, @dptr
jb302@26 521 \end_layout
jb302@26 522
jb302@26 523 \end_inset
jb302@26 524
jb302@26 525
jb302@26 526 \end_layout
jb302@26 527
jb302@26 528 \begin_layout Itemize
jb302@26 529 \begin_inset listings
jb302@26 530 lstparams "basicstyle={\ttfamily}"
jb302@26 531 inline true
jb302@26 532 status open
jb302@26 533
jb302@26 534 \begin_layout Plain Layout
jb302@26 535
jb302@26 536 relative instructions
jb302@26 537 \end_layout
jb302@26 538
jb302@26 539 \end_inset
jb302@26 540
jb302@26 541
jb302@26 542 \end_layout
jb302@26 543
jb302@26 544 \begin_layout Standard
jb302@26 545 This structure contains a list of string representations of the mnemonics
jb302@26 546 of instructions that use relative addressing.
jb302@26 547 The full list is as follows:
jb302@26 548 \end_layout
jb302@26 549
jb302@26 550 \begin_layout Standard
jb302@26 551 \begin_inset listings
jb302@26 552 lstparams "basicstyle={\ttfamily},captionpos=b,frame=tb,framexbottommargin=1em,framextopmargin=1em,keywordstyle={\color{blue}},tabsize=4"
jb302@26 553 inline false
jb302@26 554 status open
jb302@26 555
jb302@26 556 \begin_layout Plain Layout
jb302@26 557
jb302@26 558 djnz, cjne, sjmp, jz,
jb302@26 559 \end_layout
jb302@26 560
jb302@26 561 \begin_layout Plain Layout
jb302@26 562
jb302@26 563 jnz, jc, jnc, jpo,
jb302@26 564 \end_layout
jb302@26 565
jb302@26 566 \begin_layout Plain Layout
jb302@26 567
jb302@26 568 jpe, js, jns
jb302@26 569 \end_layout
jb302@26 570
jb302@26 571 \end_inset
jb302@26 572
jb302@26 573
jb302@26 574 \end_layout
jb302@26 575
jb302@26 576 \begin_layout Itemize
jb302@26 577 \begin_inset listings
jb302@26 578 lstparams "basicstyle={\ttfamily}"
jb302@26 579 inline true
jb302@26 580 status open
jb302@26 581
jb302@26 582 \begin_layout Plain Layout
jb302@26 583
jb302@26 584 instruction index
jb302@26 585 \end_layout
jb302@26 586
jb302@26 587 \end_inset
jb302@26 588
jb302@26 589
jb302@26 590 \end_layout
jb302@26 591
jb302@26 592 \begin_layout Standard
jb302@26 593 This structure contains an index of all possible instructions in the instruction
jb302@26 594 set, along with the the corresponding opcode and instruction width.
jb302@26 595 This is implemented using a combination of Python's dictionary, tuple and
jb302@26 596 list objects.
jb302@26 597 Its structure is demonstrated below:
jb302@26 598 \end_layout
jb302@26 599
jb302@26 600 \begin_layout Standard
jb302@26 601 \begin_inset listings
jb302@26 602 lstparams "basicstyle={\ttfamily},captionpos=b,frame=tb,framexbottommargin=1em,framextopmargin=1em,keywordstyle={\color{blue}},tabsize=4"
jb302@26 603 inline false
jb302@26 604 status open
jb302@26 605
jb302@26 606 \begin_layout Plain Layout
jb302@26 607
jb302@30 608 mnemonic: (arg type, arg type, ...): [opcode, width]
jb302@26 609 \end_layout
jb302@26 610
jb302@26 611 \end_inset
jb302@26 612
jb302@26 613
jb302@26 614 \end_layout
jb302@26 615
jb302@26 616 \begin_layout Standard
jb302@26 617 Each mnemonic has an entry in the parent index which returns another index
jb302@26 618 of possible argument formats for that mnemonic with their corresponding
jb302@26 619 opcode and length.
jb302@26 620 Argument types can be either be one of the reserved arguments or one of
jb302@26 621 the following values:
jb302@26 622 \begin_inset listings
jb302@26 623 lstparams "basicstyle={\ttfamily}"
jb302@26 624 inline true
jb302@26 625 status open
jb302@26 626
jb302@26 627 \begin_layout Plain Layout
jb302@26 628
jb302@26 629 address
jb302@26 630 \end_layout
jb302@26 631
jb302@26 632 \end_inset
jb302@26 633
jb302@26 634 ,
jb302@26 635 \begin_inset listings
jb302@26 636 lstparams "basicstyle={\ttfamily}"
jb302@26 637 inline true
jb302@26 638 status open
jb302@26 639
jb302@26 640 \begin_layout Plain Layout
jb302@26 641
jb302@26 642 pointer
jb302@26 643 \end_layout
jb302@26 644
jb302@26 645 \end_inset
jb302@26 646
jb302@26 647 ,
jb302@26 648 \begin_inset listings
jb302@26 649 lstparams "basicstyle={\ttfamily}"
jb302@26 650 inline true
jb302@26 651 status open
jb302@26 652
jb302@26 653 \begin_layout Plain Layout
jb302@26 654
jb302@26 655 data
jb302@26 656 \end_layout
jb302@26 657
jb302@26 658 \end_inset
jb302@26 659
jb302@26 660 or
jb302@26 661 \begin_inset listings
jb302@26 662 lstparams "basicstyle={\ttfamily}"
jb302@26 663 inline true
jb302@26 664 status open
jb302@26 665
jb302@26 666 \begin_layout Plain Layout
jb302@26 667
jb302@26 668 label
jb302@26 669 \end_layout
jb302@26 670
jb302@26 671 \end_inset
jb302@26 672
jb302@26 673 .
jb302@26 674 Width is represented in number of bytes, ie.
jb302@26 675
jb302@26 676 \begin_inset listings
jb302@26 677 lstparams "basicstyle={\ttfamily}"
jb302@26 678 inline true
jb302@26 679 status open
jb302@26 680
jb302@26 681 \begin_layout Plain Layout
jb302@26 682
jb302@26 683 width = 3
jb302@26 684 \end_layout
jb302@26 685
jb302@26 686 \end_inset
jb302@26 687
jb302@26 688 means 1 byte of opcode and 2 bytes of arguments.
jb302@26 689 \end_layout
jb302@26 690
jb302@26 691 \begin_layout Itemize
jb302@26 692 \begin_inset listings
jb302@26 693 lstparams "basicstyle={\ttfamily}"
jb302@26 694 inline true
jb302@26 695 status open
jb302@26 696
jb302@26 697 \begin_layout Plain Layout
jb302@26 698
jb302@26 699 label index
jb302@26 700 \end_layout
jb302@26 701
jb302@26 702 \end_inset
jb302@26 703
jb302@26 704
jb302@26 705 \end_layout
jb302@26 706
jb302@26 707 \begin_layout Standard
jb302@26 708 This structure is used to store an index of label definitions.
jb302@26 709 \end_layout
jb302@26 710
jb302@26 711 \begin_layout Itemize
jb302@26 712 \begin_inset listings
jb302@26 713 lstparams "basicstyle={\ttfamily}"
jb302@26 714 inline true
jb302@26 715 status open
jb302@26 716
jb302@26 717 \begin_layout Plain Layout
jb302@26 718
jb302@26 719 equate index
jb302@26 720 \end_layout
jb302@26 721
jb302@26 722 \end_inset
jb302@26 723
jb302@26 724
jb302@26 725 \end_layout
jb302@26 726
jb302@26 727 \begin_layout Standard
jb302@26 728 This structure is used to store an index of equated strings.
jb302@26 729 \end_layout
jb302@26 730
jb302@26 731 \begin_layout Standard
jb302@26 732 \begin_inset Newpage newpage
jb302@26 733 \end_inset
jb302@26 734
jb302@26 735
jb302@26 736 \end_layout
jb302@26 737
jb302@26 738 \begin_layout Section
jb302@26 739 Functions
jb302@26 740 \end_layout
jb302@26 741
jb302@26 742 \begin_layout Itemize
jb302@26 743 \begin_inset listings
jb302@26 744 lstparams "basicstyle={\ttfamily}"
jb302@26 745 inline true
jb302@26 746 status open
jb302@26 747
jb302@26 748 \begin_layout Plain Layout
jb302@26 749
jb302@26 750 first_pass(source file)
jb302@26 751 \end_layout
jb302@26 752
jb302@26 753 \end_inset
jb302@26 754
jb302@26 755
jb302@26 756 \end_layout
jb302@26 757
jb302@26 758 \begin_layout Standard
jb302@26 759 This function pre-processes a source file and stores it in a format containing
jb302@26 760 the necessary data for the
jb302@26 761 \begin_inset listings
jb302@26 762 lstparams "basicstyle={\ttfamily}"
jb302@26 763 inline true
jb302@26 764 status open
jb302@26 765
jb302@26 766 \begin_layout Plain Layout
jb302@26 767
jb302@26 768 second_pass()
jb302@26 769 \end_layout
jb302@26 770
jb302@26 771 \end_inset
jb302@26 772
jb302@26 773 function to assemble it.
jb302@26 774 It processes labels and
jb302@26 775 \begin_inset listings
jb302@26 776 lstparams "basicstyle={\ttfamily}"
jb302@26 777 inline true
jb302@26 778 status open
jb302@26 779
jb302@26 780 \begin_layout Plain Layout
jb302@26 781
jb302@26 782 EQU
jb302@26 783 \end_layout
jb302@26 784
jb302@26 785 \end_inset
jb302@26 786
jb302@26 787 directives by storing strings and their corresponding values in indexes
jb302@26 788 and replacing any subsequent appearances of the string with the value.
jb302@26 789 It prepares
jb302@26 790 \begin_inset listings
jb302@26 791 lstparams "basicstyle={\ttfamily}"
jb302@26 792 inline true
jb302@26 793 status open
jb302@26 794
jb302@26 795 \begin_layout Plain Layout
jb302@26 796
jb302@26 797 ORG
jb302@26 798 \end_layout
jb302@26 799
jb302@26 800 \end_inset
jb302@26 801
jb302@26 802 and
jb302@26 803 \begin_inset listings
jb302@26 804 lstparams "basicstyle={\ttfamily}"
jb302@26 805 inline true
jb302@26 806 status open
jb302@26 807
jb302@26 808 \begin_layout Plain Layout
jb302@26 809
jb302@26 810 DB
jb302@26 811 \end_layout
jb302@26 812
jb302@26 813 \end_inset
jb302@26 814
jb302@26 815 statements for the
jb302@26 816 \begin_inset listings
jb302@26 817 lstparams "basicstyle={\ttfamily}"
jb302@26 818 inline true
jb302@26 819 status open
jb302@26 820
jb302@26 821 \begin_layout Plain Layout
jb302@26 822
jb302@26 823 second_pass()
jb302@26 824 \end_layout
jb302@26 825
jb302@26 826 \end_inset
jb302@26 827
jb302@26 828 .
jb302@26 829 It uses the
jb302@26 830 \begin_inset listings
jb302@26 831 lstparams "basicstyle={\ttfamily}"
jb302@26 832 inline true
jb302@26 833 status open
jb302@26 834
jb302@26 835 \begin_layout Plain Layout
jb302@26 836
jb302@26 837 tokenize()
jb302@26 838 \end_layout
jb302@26 839
jb302@26 840 \end_inset
jb302@26 841
jb302@26 842 function to determine the argument symbols and operand bit string.
jb302@26 843 Finally it uses the
jb302@26 844 \begin_inset listings
jb302@26 845 lstparams "basicstyle={\ttfamily}"
jb302@26 846 inline true
jb302@26 847 status open
jb302@26 848
jb302@26 849 \begin_layout Plain Layout
jb302@26 850
jb302@26 851 instruction index
jb302@26 852 \end_layout
jb302@26 853
jb302@26 854 \end_inset
jb302@26 855
jb302@26 856 to determine the instruction width.
jb302@26 857 \end_layout
jb302@26 858
jb302@26 859 \begin_layout Itemize
jb302@26 860 \begin_inset listings
jb302@26 861 lstparams "basicstyle={\ttfamily}"
jb302@26 862 inline true
jb302@26 863 status open
jb302@26 864
jb302@26 865 \begin_layout Plain Layout
jb302@26 866
jb302@26 867 second_pass(asm, label index)
jb302@26 868 \end_layout
jb302@26 869
jb302@26 870 \end_inset
jb302@26 871
jb302@26 872
jb302@26 873 \end_layout
jb302@26 874
jb302@26 875 \begin_layout Standard
jb302@26 876 This function takes the pre-processed assembly code and
jb302@26 877 \begin_inset listings
jb302@26 878 lstparams "basicstyle={\ttfamily}"
jb302@26 879 inline true
jb302@26 880 status open
jb302@26 881
jb302@26 882 \begin_layout Plain Layout
jb302@26 883
jb302@26 884 label index
jb302@26 885 \end_layout
jb302@26 886
jb302@26 887 \end_inset
jb302@26 888
jb302@26 889 output by
jb302@26 890 \begin_inset listings
jb302@26 891 lstparams "basicstyle={\ttfamily}"
jb302@26 892 inline true
jb302@26 893 status open
jb302@26 894
jb302@26 895 \begin_layout Plain Layout
jb302@26 896
jb302@26 897 first_pass()
jb302@26 898 \end_layout
jb302@26 899
jb302@26 900 \end_inset
jb302@26 901
jb302@26 902 as input.
jb302@26 903 First it checks for
jb302@26 904 \begin_inset listings
jb302@26 905 lstparams "basicstyle={\ttfamily}"
jb302@26 906 inline true
jb302@26 907 status open
jb302@26 908
jb302@26 909 \begin_layout Plain Layout
jb302@26 910
jb302@26 911 ORG
jb302@26 912 \end_layout
jb302@26 913
jb302@26 914 \end_inset
jb302@26 915
jb302@26 916 and
jb302@26 917 \begin_inset listings
jb302@26 918 lstparams "basicstyle={\ttfamily}"
jb302@26 919 inline true
jb302@26 920 status open
jb302@26 921
jb302@26 922 \begin_layout Plain Layout
jb302@26 923
jb302@26 924 DB
jb302@26 925 \end_layout
jb302@26 926
jb302@26 927 \end_inset
jb302@26 928
jb302@26 929 statements and handles them if necessary.
jb302@26 930 Then it replaces any labels that were used before they were defined and
jb302@26 931 therefore not replaced on by
jb302@26 932 \begin_inset listings
jb302@26 933 lstparams "basicstyle={\ttfamily}"
jb302@26 934 inline true
jb302@26 935 status open
jb302@26 936
jb302@26 937 \begin_layout Plain Layout
jb302@26 938
jb302@26 939 first_pass()
jb302@26 940 \end_layout
jb302@26 941
jb302@26 942 \end_inset
jb302@26 943
jb302@26 944 .
jb302@26 945 It uses the
jb302@26 946 \begin_inset listings
jb302@26 947 lstparams "basicstyle={\ttfamily}"
jb302@26 948 inline true
jb302@26 949 status open
jb302@26 950
jb302@26 951 \begin_layout Plain Layout
jb302@26 952
jb302@26 953 instruction index
jb302@26 954 \end_layout
jb302@26 955
jb302@26 956 \end_inset
jb302@26 957
jb302@26 958 to determine the opcode and the width of the instruction, then it writes
jb302@26 959 the opcode and operand to the file.
jb302@26 960 If the combined width of the opcode and operand is greater than the instruction
jb302@26 961 width the function raises an error.
jb302@26 962
jb302@26 963 \end_layout
jb302@26 964
jb302@26 965 \begin_layout Itemize
jb302@26 966 \begin_inset listings
jb302@26 967 lstparams "basicstyle={\ttfamily}"
jb302@26 968 inline true
jb302@26 969 status open
jb302@26 970
jb302@26 971 \begin_layout Plain Layout
jb302@26 972
jb302@26 973 tokenize(mnemonic, arguments)
jb302@26 974 \end_layout
jb302@26 975
jb302@26 976 \end_inset
jb302@26 977
jb302@26 978
jb302@26 979 \end_layout
jb302@26 980
jb302@26 981 \begin_layout Standard
jb302@26 982 This function processes an instruction in order to produce a hashable symbol
jb302@26 983 that represents the format of its arguments.
jb302@26 984 This symbol is used to look up opcodes in the
jb302@26 985 \begin_inset listings
jb302@26 986 lstparams "basicstyle={\ttfamily}"
jb302@26 987 inline true
jb302@26 988 status open
jb302@26 989
jb302@26 990 \begin_layout Plain Layout
jb302@26 991
jb302@26 992 instruction index
jb302@26 993 \end_layout
jb302@26 994
jb302@26 995 \end_inset
jb302@26 996
jb302@26 997 .
jb302@26 998 It also detects string representations of numbers in the arguments and
jb302@26 999 stores a C type struct representation of the operands to be returned along
jb302@26 1000 with the symbol.
jb302@26 1001 It does this with the help of the
jb302@26 1002 \begin_inset listings
jb302@26 1003 lstparams "basicstyle={\ttfamily}"
jb302@26 1004 inline true
jb302@26 1005 status open
jb302@26 1006
jb302@26 1007 \begin_layout Plain Layout
jb302@26 1008
jb302@26 1009 stoi()
jb302@26 1010 \end_layout
jb302@26 1011
jb302@26 1012 \end_inset
jb302@26 1013
jb302@27 1014 function and Python's
jb302@26 1015 \begin_inset listings
jb302@26 1016 lstparams "basicstyle={\ttfamily}"
jb302@26 1017 inline true
jb302@26 1018 status open
jb302@26 1019
jb302@26 1020 \begin_layout Plain Layout
jb302@26 1021
jb302@26 1022 struct
jb302@26 1023 \end_layout
jb302@26 1024
jb302@26 1025 \end_inset
jb302@26 1026
jb302@26 1027 module .
jb302@26 1028 \end_layout
jb302@26 1029
jb302@26 1030 \begin_layout Itemize
jb302@26 1031 \begin_inset listings
jb302@26 1032 lstparams "basicstyle={\ttfamily}"
jb302@26 1033 inline true
jb302@26 1034 status open
jb302@26 1035
jb302@26 1036 \begin_layout Plain Layout
jb302@26 1037
jb302@26 1038 stoi(string)
jb302@26 1039 \end_layout
jb302@26 1040
jb302@26 1041 \end_inset
jb302@26 1042
jb302@26 1043
jb302@26 1044 \end_layout
jb302@26 1045
jb302@26 1046 \begin_layout Standard
jb302@26 1047 This function is a general purpose function that is actually used throughout
jb302@26 1048 the code, although mainly in the
jb302@26 1049 \begin_inset listings
jb302@26 1050 lstparams "basicstyle={\ttfamily}"
jb302@26 1051 inline true
jb302@26 1052 status open
jb302@26 1053
jb302@26 1054 \begin_layout Plain Layout
jb302@26 1055
jb302@26 1056 tokenize()
jb302@26 1057 \end_layout
jb302@26 1058
jb302@26 1059 \end_inset
jb302@26 1060
jb302@26 1061 function.
jb302@26 1062 It takes a string as an input and tries to convert it to an integer using
jb302@26 1063 Pythons integer representation syntax.
jb302@26 1064 It can recognize decimal, octal, hexadecimal and binary numbers which are
jb302@26 1065 denoted with different prefixes.
jb302@26 1066 If it receives a string it can not represent as an integer it returns the
jb302@26 1067 string 'NaN', (Not a Number)
jb302@26 1068 \end_layout
jb302@26 1069
jb302@26 1070 \begin_layout Standard
jb302@26 1071 \begin_inset ERT
jb302@26 1072 status open
jb302@26 1073
jb302@26 1074 \begin_layout Plain Layout
jb302@26 1075
jb302@26 1076
jb302@26 1077 \backslash
jb302@26 1078 bigskip
jb302@26 1079 \end_layout
jb302@26 1080
jb302@26 1081 \end_inset
jb302@26 1082
jb302@26 1083
jb302@26 1084 \end_layout
jb302@26 1085
jb302@26 1086 \begin_layout Standard
jb302@26 1087 Below is an abstract representation of each functions logical process.
jb302@26 1088 The
jb302@26 1089 \begin_inset listings
jb302@26 1090 lstparams "basicstyle={\ttfamily}"
jb302@26 1091 inline true
jb302@26 1092 status open
jb302@26 1093
jb302@26 1094 \begin_layout Plain Layout
jb302@26 1095
jb302@26 1096 first_pass()
jb302@26 1097 \end_layout
jb302@26 1098
jb302@26 1099 \end_inset
jb302@26 1100
jb302@26 1101 and
jb302@26 1102 \begin_inset listings
jb302@26 1103 lstparams "basicstyle={\ttfamily}"
jb302@26 1104 inline true
jb302@26 1105 status open
jb302@26 1106
jb302@26 1107 \begin_layout Plain Layout
jb302@26 1108
jb302@26 1109 second_pass()
jb302@26 1110 \end_layout
jb302@26 1111
jb302@26 1112 \end_inset
jb302@26 1113
jb302@26 1114 are represented in pseudo-code, however
jb302@26 1115 \begin_inset listings
jb302@26 1116 lstparams "basicstyle={\ttfamily}"
jb302@26 1117 inline true
jb302@26 1118 status open
jb302@26 1119
jb302@26 1120 \begin_layout Plain Layout
jb302@26 1121
jb302@26 1122 stoi()
jb302@26 1123 \end_layout
jb302@26 1124
jb302@26 1125 \end_inset
jb302@26 1126
jb302@26 1127 and
jb302@26 1128 \begin_inset listings
jb302@26 1129 lstparams "basicstyle={\ttfamily}"
jb302@26 1130 inline true
jb302@26 1131 status open
jb302@26 1132
jb302@26 1133 \begin_layout Plain Layout
jb302@26 1134
jb302@26 1135 tokenize()
jb302@26 1136 \end_layout
jb302@26 1137
jb302@26 1138 \end_inset
jb302@26 1139
jb302@26 1140 are more easily understood when represented as flowcharts.
jb302@26 1141
jb302@26 1142 \end_layout
jb302@26 1143
jb302@26 1144 \begin_layout Standard
jb302@26 1145 \begin_inset Newpage newpage
jb302@26 1146 \end_inset
jb302@26 1147
jb302@26 1148
jb302@26 1149 \end_layout
jb302@26 1150
jb302@26 1151 \begin_layout Subsection
jb302@27 1152 \begin_inset listings
jb302@27 1153 lstparams "basicstyle={\ttfamily}"
jb302@27 1154 inline true
jb302@27 1155 status open
jb302@27 1156
jb302@27 1157 \begin_layout Plain Layout
jb302@27 1158
jb302@27 1159 first_pass
jb302@27 1160 \end_layout
jb302@27 1161
jb302@27 1162 \end_inset
jb302@27 1163
jb302@27 1164
jb302@26 1165 \end_layout
jb302@26 1166
jb302@26 1167 \begin_layout Standard
jb302@26 1168 \begin_inset listings
jb302@26 1169 lstparams "basicstyle={\small\ttfamily},captionpos=b,frame=tb,framexbottommargin=3em,framextopmargin=3em,keywordstyle={\color{blue}},language=Python,showstringspaces=false,tabsize=4"
jb302@26 1170 inline false
jb302@26 1171 status open
jb302@26 1172
jb302@26 1173 \begin_layout Plain Layout
jb302@26 1174
jb302@26 1175 first_pass(source file):
jb302@26 1176 \end_layout
jb302@26 1177
jb302@26 1178 \begin_layout Plain Layout
jb302@26 1179
jb302@26 1180 \end_layout
jb302@26 1181
jb302@26 1182 \begin_layout Plain Layout
jb302@26 1183
jb302@26 1184 address = 0
jb302@26 1185 \end_layout
jb302@26 1186
jb302@26 1187 \begin_layout Plain Layout
jb302@26 1188
jb302@26 1189 \end_layout
jb302@26 1190
jb302@26 1191 \begin_layout Plain Layout
jb302@26 1192
jb302@26 1193 for statement in source file:
jb302@26 1194 \end_layout
jb302@26 1195
jb302@26 1196 \begin_layout Plain Layout
jb302@26 1197
jb302@26 1198 \end_layout
jb302@26 1199
jb302@26 1200 \begin_layout Plain Layout
jb302@26 1201
jb302@26 1202 remove comments
jb302@26 1203 \end_layout
jb302@26 1204
jb302@26 1205 \begin_layout Plain Layout
jb302@26 1206
jb302@26 1207
jb302@26 1208 \end_layout
jb302@26 1209
jb302@26 1210 \begin_layout Plain Layout
jb302@26 1211
jb302@26 1212 for word in statement:
jb302@26 1213 \end_layout
jb302@26 1214
jb302@26 1215 \begin_layout Plain Layout
jb302@26 1216
jb302@26 1217
jb302@26 1218 \end_layout
jb302@26 1219
jb302@26 1220 \begin_layout Plain Layout
jb302@26 1221
jb302@26 1222 if word is in equate index:
jb302@26 1223 \end_layout
jb302@26 1224
jb302@26 1225 \begin_layout Plain Layout
jb302@26 1226
jb302@26 1227 replace word with equated value
jb302@26 1228 \end_layout
jb302@26 1229
jb302@26 1230 \begin_layout Plain Layout
jb302@26 1231
jb302@26 1232 else if word is in label index:
jb302@26 1233 \end_layout
jb302@26 1234
jb302@26 1235 \begin_layout Plain Layout
jb302@26 1236
jb302@26 1237 replace word with address at label
jb302@26 1238 \end_layout
jb302@26 1239
jb302@26 1240 \begin_layout Plain Layout
jb302@26 1241
jb302@26 1242
jb302@26 1243 \end_layout
jb302@26 1244
jb302@26 1245 \begin_layout Plain Layout
jb302@26 1246
jb302@26 1247 if first word == 'org'
jb302@26 1248 \end_layout
jb302@26 1249
jb302@26 1250 \begin_layout Plain Layout
jb302@26 1251
jb302@26 1252 address = second word
jb302@26 1253 \end_layout
jb302@26 1254
jb302@26 1255 \begin_layout Plain Layout
jb302@26 1256
jb302@26 1257 else if last character of first word == ':':
jb302@26 1258 \end_layout
jb302@26 1259
jb302@26 1260 \begin_layout Plain Layout
jb302@26 1261
jb302@26 1262 remove ':'
jb302@26 1263 \end_layout
jb302@26 1264
jb302@26 1265 \begin_layout Plain Layout
jb302@26 1266
jb302@26 1267 add word = address to label index
jb302@26 1268 \end_layout
jb302@26 1269
jb302@26 1270 \begin_layout Plain Layout
jb302@26 1271
jb302@26 1272 next statement
jb302@26 1273 \end_layout
jb302@26 1274
jb302@26 1275 \begin_layout Plain Layout
jb302@26 1276
jb302@26 1277 else if second word == 'equ'
jb302@26 1278 \end_layout
jb302@26 1279
jb302@26 1280 \begin_layout Plain Layout
jb302@26 1281
jb302@26 1282 add first word = third word to equate index
jb302@26 1283 \end_layout
jb302@26 1284
jb302@26 1285 \begin_layout Plain Layout
jb302@26 1286
jb302@26 1287 next statement
jb302@26 1288 \end_layout
jb302@26 1289
jb302@26 1290 \begin_layout Plain Layout
jb302@26 1291
jb302@26 1292
jb302@26 1293 \end_layout
jb302@26 1294
jb302@26 1295 \begin_layout Plain Layout
jb302@26 1296
jb302@26 1297 mnemonic = first word
jb302@26 1298 \end_layout
jb302@26 1299
jb302@26 1300 \begin_layout Plain Layout
jb302@26 1301
jb302@26 1302 arguments = [second word ...
jb302@26 1303 last word]
jb302@26 1304 \end_layout
jb302@26 1305
jb302@26 1306 \begin_layout Plain Layout
jb302@26 1307
jb302@26 1308
jb302@26 1309 \end_layout
jb302@26 1310
jb302@26 1311 \begin_layout Plain Layout
jb302@26 1312
jb302@26 1313 symbol, constant = tokenize(arguments)
jb302@26 1314 \end_layout
jb302@26 1315
jb302@26 1316 \begin_layout Plain Layout
jb302@26 1317
jb302@26 1318 if mnemonic == 'db':
jb302@26 1319 \end_layout
jb302@26 1320
jb302@26 1321 \begin_layout Plain Layout
jb302@26 1322
jb302@26 1323 address = address + width of constant
jb302@26 1324 \end_layout
jb302@26 1325
jb302@26 1326 \begin_layout Plain Layout
jb302@26 1327
jb302@26 1328 next statement
jb302@26 1329 \end_layout
jb302@26 1330
jb302@26 1331 \begin_layout Plain Layout
jb302@26 1332
jb302@26 1333
jb302@26 1334 \end_layout
jb302@26 1335
jb302@26 1336 \begin_layout Plain Layout
jb302@26 1337
jb302@26 1338 width = instruction index[mnemonic][symbol][width]
jb302@26 1339 \end_layout
jb302@26 1340
jb302@26 1341 \begin_layout Plain Layout
jb302@26 1342
jb302@26 1343 address = address + width
jb302@26 1344 \end_layout
jb302@26 1345
jb302@26 1346 \begin_layout Plain Layout
jb302@26 1347
jb302@26 1348
jb302@26 1349 \end_layout
jb302@26 1350
jb302@26 1351 \begin_layout Plain Layout
jb302@26 1352
jb302@26 1353 append [mnemonic, argument, symbol, constant] to asm
jb302@26 1354 \end_layout
jb302@26 1355
jb302@26 1356 \begin_layout Plain Layout
jb302@26 1357
jb302@26 1358 \end_layout
jb302@26 1359
jb302@26 1360 \begin_layout Plain Layout
jb302@26 1361
jb302@26 1362 return asm, label index
jb302@26 1363 \end_layout
jb302@26 1364
jb302@26 1365 \end_inset
jb302@26 1366
jb302@26 1367
jb302@26 1368 \begin_inset Newpage newpage
jb302@26 1369 \end_inset
jb302@26 1370
jb302@26 1371
jb302@26 1372 \end_layout
jb302@26 1373
jb302@26 1374 \begin_layout Subsection
jb302@27 1375 \begin_inset listings
jb302@27 1376 lstparams "basicstyle={\ttfamily}"
jb302@27 1377 inline true
jb302@27 1378 status open
jb302@27 1379
jb302@27 1380 \begin_layout Plain Layout
jb302@27 1381
jb302@27 1382 second_pass
jb302@27 1383 \end_layout
jb302@27 1384
jb302@27 1385 \end_inset
jb302@27 1386
jb302@27 1387
jb302@26 1388 \end_layout
jb302@26 1389
jb302@26 1390 \begin_layout Standard
jb302@26 1391 \begin_inset listings
jb302@26 1392 lstparams "basicstyle={\small\ttfamily},breaklines=true,captionpos=b,frame=tb,framexbottommargin=3em,framextopmargin=3em,keywordstyle={\color{blue}},language=Python,tabsize=4"
jb302@26 1393 inline false
jb302@26 1394 status open
jb302@26 1395
jb302@26 1396 \begin_layout Plain Layout
jb302@26 1397
jb302@26 1398 second_pass(file, asm, label index):
jb302@26 1399 \end_layout
jb302@26 1400
jb302@26 1401 \begin_layout Plain Layout
jb302@26 1402
jb302@26 1403 \end_layout
jb302@26 1404
jb302@26 1405 \begin_layout Plain Layout
jb302@26 1406
jb302@26 1407 address = 0
jb302@26 1408 \end_layout
jb302@26 1409
jb302@26 1410 \begin_layout Plain Layout
jb302@26 1411
jb302@26 1412 \end_layout
jb302@26 1413
jb302@26 1414 \begin_layout Plain Layout
jb302@26 1415
jb302@26 1416 for line in asm:
jb302@26 1417 \end_layout
jb302@26 1418
jb302@26 1419 \begin_layout Plain Layout
jb302@26 1420
jb302@26 1421 \end_layout
jb302@26 1422
jb302@26 1423 \begin_layout Plain Layout
jb302@26 1424
jb302@26 1425 file offset = address
jb302@26 1426 \end_layout
jb302@26 1427
jb302@26 1428 \begin_layout Plain Layout
jb302@26 1429
jb302@26 1430
jb302@26 1431 \end_layout
jb302@26 1432
jb302@26 1433 \begin_layout Plain Layout
jb302@26 1434
jb302@26 1435 mnemonic, arguments, symbol, constant = line
jb302@26 1436 \end_layout
jb302@26 1437
jb302@26 1438 \begin_layout Plain Layout
jb302@26 1439
jb302@26 1440
jb302@26 1441 \end_layout
jb302@26 1442
jb302@26 1443 \begin_layout Plain Layout
jb302@26 1444
jb302@26 1445 if mnemonic == 'org':
jb302@26 1446 \end_layout
jb302@26 1447
jb302@26 1448 \begin_layout Plain Layout
jb302@26 1449
jb302@26 1450 address = first argument
jb302@26 1451 \end_layout
jb302@26 1452
jb302@26 1453 \begin_layout Plain Layout
jb302@26 1454
jb302@26 1455 next line
jb302@26 1456 \end_layout
jb302@26 1457
jb302@26 1458 \begin_layout Plain Layout
jb302@26 1459
jb302@26 1460 else if mnemonic == 'db':
jb302@26 1461 \end_layout
jb302@26 1462
jb302@26 1463 \begin_layout Plain Layout
jb302@26 1464
jb302@26 1465 write constant to file
jb302@26 1466 \end_layout
jb302@26 1467
jb302@26 1468 \begin_layout Plain Layout
jb302@26 1469
jb302@26 1470 address = address + width of constant
jb302@26 1471 \end_layout
jb302@26 1472
jb302@26 1473 \begin_layout Plain Layout
jb302@26 1474
jb302@26 1475 next line
jb302@26 1476 \end_layout
jb302@26 1477
jb302@26 1478 \begin_layout Plain Layout
jb302@26 1479
jb302@26 1480
jb302@26 1481 \end_layout
jb302@26 1482
jb302@26 1483 \begin_layout Plain Layout
jb302@26 1484
jb302@26 1485 for argument in arguments:
jb302@26 1486 \end_layout
jb302@26 1487
jb302@26 1488 \begin_layout Plain Layout
jb302@26 1489
jb302@26 1490 if argument is a label:
jb302@26 1491 \end_layout
jb302@26 1492
jb302@26 1493 \begin_layout Plain Layout
jb302@26 1494
jb302@26 1495 replace argument with address at label
jb302@26 1496 \end_layout
jb302@26 1497
jb302@26 1498 \begin_layout Plain Layout
jb302@26 1499
jb302@26 1500 symbol, data = tokenize(argument)
jb302@26 1501 \end_layout
jb302@26 1502
jb302@26 1503 \begin_layout Plain Layout
jb302@26 1504
jb302@26 1505 append data to constant
jb302@26 1506 \end_layout
jb302@26 1507
jb302@26 1508 \begin_layout Plain Layout
jb302@26 1509
jb302@26 1510
jb302@26 1511 \end_layout
jb302@26 1512
jb302@26 1513 \begin_layout Plain Layout
jb302@26 1514
jb302@26 1515 op, width = instruction index[mnemonic][symbol]
jb302@26 1516 \end_layout
jb302@26 1517
jb302@26 1518 \begin_layout Plain Layout
jb302@26 1519
jb302@26 1520
jb302@26 1521 \end_layout
jb302@26 1522
jb302@26 1523 \begin_layout Plain Layout
jb302@26 1524
jb302@26 1525 write op to file
jb302@26 1526 \end_layout
jb302@26 1527
jb302@26 1528 \begin_layout Plain Layout
jb302@26 1529
jb302@26 1530 \end_layout
jb302@26 1531
jb302@26 1532 \begin_layout Plain Layout
jb302@26 1533
jb302@26 1534 if width of constant - width + 1 > 0:
jb302@26 1535 \end_layout
jb302@26 1536
jb302@26 1537 \begin_layout Plain Layout
jb302@26 1538
jb302@26 1539 raise error
jb302@26 1540 \end_layout
jb302@26 1541
jb302@26 1542 \begin_layout Plain Layout
jb302@26 1543
jb302@26 1544 else if:
jb302@26 1545 \end_layout
jb302@26 1546
jb302@26 1547 \begin_layout Plain Layout
jb302@26 1548
jb302@26 1549 write constant to file
jb302@26 1550 \end_layout
jb302@26 1551
jb302@26 1552 \begin_layout Plain Layout
jb302@26 1553
jb302@26 1554 address = address.+ width
jb302@26 1555 \end_layout
jb302@26 1556
jb302@26 1557 \begin_layout Plain Layout
jb302@26 1558
jb302@26 1559
jb302@26 1560 \end_layout
jb302@26 1561
jb302@26 1562 \begin_layout Plain Layout
jb302@26 1563
jb302@26 1564 return file
jb302@26 1565 \end_layout
jb302@26 1566
jb302@26 1567 \end_inset
jb302@26 1568
jb302@26 1569
jb302@26 1570 \begin_inset Newpage newpage
jb302@26 1571 \end_inset
jb302@26 1572
jb302@26 1573
jb302@26 1574 \end_layout
jb302@26 1575
jb302@26 1576 \begin_layout Subsection
jb302@27 1577 \begin_inset listings
jb302@27 1578 lstparams "basicstyle={\ttfamily}"
jb302@27 1579 inline true
jb302@27 1580 status open
jb302@27 1581
jb302@27 1582 \begin_layout Plain Layout
jb302@27 1583
jb302@27 1584 tokenize
jb302@27 1585 \end_layout
jb302@27 1586
jb302@27 1587 \end_inset
jb302@27 1588
jb302@27 1589
jb302@26 1590 \end_layout
jb302@26 1591
jb302@26 1592 \begin_layout Standard
jb302@26 1593 \begin_inset ERT
jb302@26 1594 status open
jb302@26 1595
jb302@26 1596 \begin_layout Plain Layout
jb302@26 1597
jb302@26 1598
jb302@26 1599 \backslash
jb302@26 1600 bigskip
jb302@26 1601 \end_layout
jb302@26 1602
jb302@26 1603 \end_inset
jb302@26 1604
jb302@26 1605
jb302@26 1606 \end_layout
jb302@26 1607
jb302@26 1608 \begin_layout Standard
jb302@26 1609 \begin_inset Graphics
jb302@26 1610 filename /home/jmz/qm/ede/doc/images/assembler/tokenize.svg
jb302@27 1611 scale 57
jb302@26 1612
jb302@26 1613 \end_inset
jb302@26 1614
jb302@26 1615
jb302@26 1616 \end_layout
jb302@26 1617
jb302@26 1618 \begin_layout Standard
jb302@26 1619 \begin_inset Newpage newpage
jb302@26 1620 \end_inset
jb302@26 1621
jb302@26 1622
jb302@26 1623 \end_layout
jb302@26 1624
jb302@26 1625 \begin_layout Subsection
jb302@27 1626 \begin_inset listings
jb302@27 1627 lstparams "basicstyle={\ttfamily}"
jb302@27 1628 inline true
jb302@27 1629 status open
jb302@27 1630
jb302@27 1631 \begin_layout Plain Layout
jb302@27 1632
jb302@27 1633 stoi
jb302@27 1634 \end_layout
jb302@27 1635
jb302@27 1636 \end_inset
jb302@27 1637
jb302@27 1638
jb302@26 1639 \end_layout
jb302@26 1640
jb302@26 1641 \begin_layout Standard
jb302@26 1642 \begin_inset ERT
jb302@26 1643 status open
jb302@26 1644
jb302@26 1645 \begin_layout Plain Layout
jb302@26 1646
jb302@26 1647
jb302@26 1648 \backslash
jb302@26 1649 bigskip
jb302@26 1650 \end_layout
jb302@26 1651
jb302@26 1652 \end_inset
jb302@26 1653
jb302@26 1654
jb302@26 1655 \end_layout
jb302@26 1656
jb302@26 1657 \begin_layout Description
jb302@26 1658 \begin_inset Graphics
jb302@26 1659 filename /home/jmz/qm/ede/doc/images/assembler/stoi.svg
jb302@26 1660 scale 70
jb302@26 1661
jb302@26 1662 \end_inset
jb302@26 1663
jb302@26 1664
jb302@26 1665 \end_layout
jb302@26 1666
jb302@26 1667 \begin_layout Standard
jb302@26 1668 \begin_inset Newpage newpage
jb302@26 1669 \end_inset
jb302@26 1670
jb302@26 1671
jb302@26 1672 \end_layout
jb302@26 1673
jb302@26 1674 \begin_layout Section
jb302@27 1675 Assembly language manual
jb302@27 1676 \end_layout
jb302@27 1677
jb302@27 1678 \begin_layout Standard
jb302@27 1679 \begin_inset Newpage newpage
jb302@27 1680 \end_inset
jb302@27 1681
jb302@27 1682
jb302@27 1683 \end_layout
jb302@27 1684
jb302@27 1685 \begin_layout Part
jb302@27 1686 Emulator
jb302@27 1687 \end_layout
jb302@27 1688
jb302@27 1689 \begin_layout Section
jb302@27 1690 Core microprocessor emulation
jb302@27 1691 \end_layout
jb302@27 1692
jb302@27 1693 \begin_layout Standard
jb302@27 1694 The core of the emulator is written in C using only standard libraries.
jb302@27 1695 It executes the machine code output by the assembler according to the ELB816
jb302@27 1696 specification.
jb302@27 1697 It consists of the following files:
jb302@27 1698 \end_layout
jb302@27 1699
jb302@27 1700 \begin_layout Itemize
jb302@27 1701 \begin_inset listings
jb302@27 1702 lstparams "basicstyle={\ttfamily}"
jb302@27 1703 inline true
jb302@27 1704 status open
jb302@27 1705
jb302@27 1706 \begin_layout Plain Layout
jb302@27 1707
jb302@27 1708 iset.c
jb302@27 1709 \end_layout
jb302@27 1710
jb302@27 1711 \end_inset
jb302@27 1712
jb302@27 1713 and
jb302@27 1714 \begin_inset listings
jb302@27 1715 lstparams "basicstyle={\ttfamily}"
jb302@27 1716 inline true
jb302@27 1717 status open
jb302@27 1718
jb302@27 1719 \begin_layout Plain Layout
jb302@27 1720
jb302@27 1721 iset.h
jb302@27 1722 \end_layout
jb302@27 1723
jb302@27 1724 \end_inset
jb302@27 1725
jb302@27 1726
jb302@27 1727 \end_layout
jb302@27 1728
jb302@27 1729 \begin_layout Standard
jb302@27 1730 These files contain the emulator instruction functions and function look-up
jb302@27 1731 table.
jb302@27 1732 \end_layout
jb302@27 1733
jb302@27 1734 \begin_layout Itemize
jb302@27 1735 \begin_inset listings
jb302@27 1736 lstparams "basicstyle={\ttfamily}"
jb302@27 1737 inline true
jb302@27 1738 status open
jb302@27 1739
jb302@27 1740 \begin_layout Plain Layout
jb302@27 1741
jb302@27 1742 mem.c
jb302@27 1743 \end_layout
jb302@27 1744
jb302@27 1745 \end_inset
jb302@27 1746
jb302@27 1747 and
jb302@27 1748 \begin_inset listings
jb302@27 1749 lstparams "basicstyle={\ttfamily}"
jb302@27 1750 inline true
jb302@27 1751 status open
jb302@27 1752
jb302@27 1753 \begin_layout Plain Layout
jb302@27 1754
jb302@27 1755 mem.h
jb302@27 1756 \end_layout
jb302@27 1757
jb302@27 1758 \end_inset
jb302@27 1759
jb302@27 1760
jb302@27 1761 \end_layout
jb302@27 1762
jb302@27 1763 \begin_layout Standard
jb302@27 1764 These files contain the emulators memory structure and memory access functions.
jb302@27 1765 \end_layout
jb302@27 1766
jb302@27 1767 \begin_layout Itemize
jb302@27 1768 \begin_inset listings
jb302@27 1769 lstparams "basicstyle={\ttfamily}"
jb302@27 1770 inline true
jb302@27 1771 status open
jb302@27 1772
jb302@27 1773 \begin_layout Plain Layout
jb302@27 1774
jb302@27 1775 emu.c
jb302@27 1776 \end_layout
jb302@27 1777
jb302@27 1778 \end_inset
jb302@27 1779
jb302@27 1780
jb302@27 1781 \end_layout
jb302@27 1782
jb302@27 1783 \begin_layout Standard
jb302@27 1784 This file contains the program's
jb302@27 1785 \begin_inset listings
jb302@27 1786 lstparams "basicstyle={\ttfamily}"
jb302@27 1787 inline true
jb302@27 1788 status open
jb302@27 1789
jb302@27 1790 \begin_layout Plain Layout
jb302@27 1791
jb302@27 1792 main()
jb302@27 1793 \end_layout
jb302@27 1794
jb302@27 1795 \end_inset
jb302@27 1796
jb302@27 1797 function.
jb302@27 1798 It initializes the emulator and executes the programs fetch/decode/execute
jb302@27 1799 cycle.
jb302@27 1800
jb302@27 1801 \end_layout
jb302@27 1802
jb302@27 1803 \begin_layout Standard
jb302@27 1804 \begin_inset ERT
jb302@27 1805 status open
jb302@27 1806
jb302@27 1807 \begin_layout Plain Layout
jb302@27 1808
jb302@27 1809
jb302@27 1810 \backslash
jb302@27 1811 bigskip
jb302@27 1812 \end_layout
jb302@27 1813
jb302@27 1814 \end_inset
jb302@27 1815
jb302@27 1816
jb302@27 1817 \end_layout
jb302@27 1818
jb302@27 1819 \begin_layout Standard
jb302@27 1820 Below is a high level description of the content of each of these files
jb302@27 1821 which should demonstrate how the emulator works.
jb302@27 1822 There is also a large amount of material relevant to the emulator's design
jb302@27 1823 in the appendix, which will be referenced when applicable.
jb302@27 1824 \end_layout
jb302@27 1825
jb302@27 1826 \begin_layout Subsection
jb302@27 1827 \begin_inset listings
jb302@27 1828 lstparams "basicstyle={\ttfamily}"
jb302@27 1829 inline true
jb302@27 1830 status open
jb302@27 1831
jb302@27 1832 \begin_layout Plain Layout
jb302@27 1833
jb302@27 1834 iset.c
jb302@27 1835 \end_layout
jb302@27 1836
jb302@27 1837 \end_inset
jb302@27 1838
jb302@27 1839 and
jb302@27 1840 \begin_inset listings
jb302@27 1841 lstparams "basicstyle={\ttfamily}"
jb302@27 1842 inline true
jb302@27 1843 status open
jb302@27 1844
jb302@27 1845 \begin_layout Plain Layout
jb302@27 1846
jb302@27 1847 iset.h
jb302@27 1848 \end_layout
jb302@27 1849
jb302@27 1850 \end_inset
jb302@27 1851
jb302@27 1852
jb302@27 1853 \end_layout
jb302@27 1854
jb302@27 1855 \begin_layout Standard
jb302@27 1856 Each mnemonic in the ELB816 instruction set has a function defined in these
jb302@27 1857 files.
jb302@27 1858 Each function is responsible for execution of all the instructions that
jb302@27 1859 use its corresponding mnemonic.
jb302@27 1860 The function look-up table is an array of pointers to these functions,
jb302@27 1861 where a pointer's position in the list corresponds to the opcode of the
jb302@27 1862 instruction to be executed.
jb302@27 1863 \end_layout
jb302@27 1864
jb302@27 1865 \begin_layout Standard
jb302@27 1866 \begin_inset ERT
jb302@27 1867 status open
jb302@27 1868
jb302@27 1869 \begin_layout Plain Layout
jb302@27 1870
jb302@27 1871
jb302@27 1872 \backslash
jb302@27 1873 bigskip
jb302@27 1874 \end_layout
jb302@27 1875
jb302@27 1876 \end_inset
jb302@27 1877
jb302@27 1878
jb302@27 1879 \end_layout
jb302@27 1880
jb302@27 1881 \begin_layout Standard
jb302@27 1882 \begin_inset Newpage newpage
jb302@27 1883 \end_inset
jb302@27 1884
jb302@27 1885
jb302@27 1886 \end_layout
jb302@27 1887
jb302@27 1888 \begin_layout Subsection
jb302@27 1889 \begin_inset listings
jb302@27 1890 lstparams "basicstyle={\ttfamily}"
jb302@27 1891 inline true
jb302@27 1892 status open
jb302@27 1893
jb302@27 1894 \begin_layout Plain Layout
jb302@27 1895
jb302@27 1896 mem.c
jb302@27 1897 \end_layout
jb302@27 1898
jb302@27 1899 \end_inset
jb302@27 1900
jb302@27 1901 and
jb302@27 1902 \begin_inset listings
jb302@27 1903 lstparams "basicstyle={\ttfamily}"
jb302@27 1904 inline true
jb302@27 1905 status open
jb302@27 1906
jb302@27 1907 \begin_layout Plain Layout
jb302@27 1908
jb302@27 1909 mem.h
jb302@27 1910 \end_layout
jb302@27 1911
jb302@27 1912 \end_inset
jb302@27 1913
jb302@27 1914
jb302@27 1915 \end_layout
jb302@27 1916
jb302@27 1917 \begin_layout Standard
jb302@27 1918 The figures bellow illustrate the emulator's memory layout as defined in
jb302@27 1919 the
jb302@27 1920 \begin_inset listings
jb302@27 1921 lstparams "basicstyle={\ttfamily}"
jb302@27 1922 inline true
jb302@27 1923 status open
jb302@27 1924
jb302@27 1925 \begin_layout Plain Layout
jb302@27 1926
jb302@27 1927 mem.h
jb302@27 1928 \end_layout
jb302@27 1929
jb302@27 1930 \end_inset
jb302@27 1931
jb302@27 1932 header file.
jb302@27 1933 \end_layout
jb302@27 1934
jb302@27 1935 \begin_layout Standard
jb302@27 1936 \begin_inset ERT
jb302@27 1937 status open
jb302@27 1938
jb302@27 1939 \begin_layout Plain Layout
jb302@27 1940
jb302@27 1941
jb302@27 1942 \backslash
jb302@27 1943 bigskip
jb302@27 1944 \end_layout
jb302@27 1945
jb302@27 1946 \end_inset
jb302@27 1947
jb302@27 1948
jb302@27 1949 \end_layout
jb302@27 1950
jb302@27 1951 \begin_layout Standard
jb302@27 1952 \begin_inset listings
jb302@27 1953 lstparams "basicstyle={\ttfamily}"
jb302@27 1954 inline true
jb302@27 1955 status open
jb302@27 1956
jb302@27 1957 \begin_layout Plain Layout
jb302@27 1958
jb302@27 1959 mem.c
jb302@27 1960 \end_layout
jb302@27 1961
jb302@27 1962 \end_inset
jb302@27 1963
jb302@27 1964 contains functions that can be used to access this memory from the rest
jb302@27 1965 of the code.
jb302@27 1966 \end_layout
jb302@27 1967
jb302@27 1968 \begin_layout Standard
jb302@27 1969 \begin_inset Newpage newpage
jb302@27 1970 \end_inset
jb302@27 1971
jb302@27 1972
jb302@27 1973 \end_layout
jb302@27 1974
jb302@27 1975 \begin_layout Subsection
jb302@27 1976 \begin_inset listings
jb302@27 1977 lstparams "basicstyle={\ttfamily}"
jb302@27 1978 inline true
jb302@27 1979 status open
jb302@27 1980
jb302@27 1981 \begin_layout Plain Layout
jb302@27 1982
jb302@27 1983 emu.c
jb302@27 1984 \end_layout
jb302@27 1985
jb302@27 1986 \end_inset
jb302@27 1987
jb302@27 1988
jb302@27 1989 \end_layout
jb302@27 1990
jb302@27 1991 \begin_layout Standard
jb302@27 1992 This file contains the emulator's set-up and control procedures.
jb302@27 1993 It includes all of the projects header files and controls the execution
jb302@27 1994 of the functions contained in them.
jb302@27 1995 \end_layout
jb302@27 1996
jb302@27 1997 \begin_layout Standard
jb302@27 1998 \begin_inset ERT
jb302@27 1999 status open
jb302@27 2000
jb302@27 2001 \begin_layout Plain Layout
jb302@27 2002
jb302@27 2003
jb302@27 2004 \backslash
jb302@27 2005 bigskip
jb302@27 2006 \end_layout
jb302@27 2007
jb302@27 2008 \end_inset
jb302@27 2009
jb302@27 2010
jb302@27 2011 \end_layout
jb302@27 2012
jb302@27 2013 \begin_layout Standard
jb302@27 2014 It first executes a number of initialization procedures and then passes
jb302@27 2015 control over to the main fetch/decode/execute cycle.
jb302@27 2016 This procedure is shown below as a flowchart.
jb302@27 2017 To understand this it you must be familiar with C's function pointer syntax.
jb302@27 2018 \end_layout
jb302@27 2019
jb302@27 2020 \begin_layout Standard
jb302@27 2021 \begin_inset ERT
jb302@27 2022 status open
jb302@27 2023
jb302@27 2024 \begin_layout Plain Layout
jb302@27 2025
jb302@27 2026
jb302@27 2027 \backslash
jb302@27 2028 bigskip
jb302@27 2029 \end_layout
jb302@27 2030
jb302@27 2031 \end_inset
jb302@27 2032
jb302@27 2033
jb302@27 2034 \end_layout
jb302@27 2035
jb302@27 2036 \begin_layout Standard
jb302@27 2037 \begin_inset ERT
jb302@27 2038 status open
jb302@27 2039
jb302@27 2040 \begin_layout Plain Layout
jb302@27 2041
jb302@27 2042
jb302@27 2043 \backslash
jb302@27 2044 centerline{
jb302@27 2045 \end_layout
jb302@27 2046
jb302@27 2047 \end_inset
jb302@27 2048
jb302@27 2049
jb302@27 2050 \begin_inset Graphics
jb302@27 2051 filename /home/jmz/qm/ede/doc/images/emulator/fetch_decode_exe.svg
jb302@27 2052 scale 70
jb302@27 2053
jb302@27 2054 \end_inset
jb302@27 2055
jb302@27 2056
jb302@27 2057 \begin_inset ERT
jb302@27 2058 status open
jb302@27 2059
jb302@27 2060 \begin_layout Plain Layout
jb302@27 2061
jb302@27 2062 }
jb302@27 2063 \end_layout
jb302@27 2064
jb302@27 2065 \end_inset
jb302@27 2066
jb302@27 2067
jb302@27 2068 \end_layout
jb302@27 2069
jb302@27 2070 \begin_layout Standard
jb302@27 2071 \begin_inset Newpage newpage
jb302@27 2072 \end_inset
jb302@27 2073
jb302@27 2074
jb302@27 2075 \end_layout
jb302@27 2076
jb302@27 2077 \begin_layout Section
jb302@27 2078 Peripherals
jb302@27 2079 \end_layout
jb302@27 2080
jb302@27 2081 \begin_layout Standard
jb302@27 2082 \begin_inset Newpage newpage
jb302@27 2083 \end_inset
jb302@27 2084
jb302@27 2085
jb302@26 2086 \end_layout
jb302@26 2087
jb302@26 2088 \end_body
jb302@26 2089 \end_document