← High Level Programmers Guide to the 68000 1992

High Level Programmers Guide to the 68000 1992

From the originals

13 scans

Machine-transcribed text and image descriptions. Check the linked original for uncertain words or fine print.

These are transcribed pages from the documents, not the full publications. Open the original for the remaining pages.

Image 1

Francis G. McCabe High-Level Programmer's Guide to the 68000 PRENTICE HALL INTERNATIONAL SERIES IN COMPUTER SCIENCE C. A. R. HOARE SERIES EDITOR

A book cover with a vertical red band on the left edge and a white field on the right, carrying bold black sans-serif title text and series branding at the bottom.

Reading notes: Author name and title are set in large bold type; the headline is treated as the title block, with the author name placed above it in the transcript. Series text in the lower left is set in red-band area and reads top to bottom as printed; no further fine print is visible.

Languages
English
PDF page 1

High-Level Programmer's Guide to the 68000

Francis G. McCabe High-Level Programmer's Guide to the 68000 PRENTICE HALL INTERNATIONAL SERIES IN COMPUTER SCIENCE C. A. R. HOARE SERIES EDITOR

A book cover with a vertical red band on the left edge and a white field on the right, showing large black bold sans-serif title text and author name stacked at upper right, with a publisher series label in the lower left on the red band and the series editor credit at the bottom right.

Reading notes: Headline is split across several lines; reading order follows the visual stacking of author name then title. Series label in lower left is set in stacked lines on the red band and read top to bottom.

Printed product names
68000
Languages
English
PDF page 2

The image is a entirely blank white portrait-format page with no visible artwork, layout, or text.

Reading notes: No visible text found; the page appears blank.

PDF page 3

Prentice Hall International Series in Computer Science C. A. R. Hoare, Series Editor BACKHOUSE, R. C., Program Construction and Verification DEBAKKER, J. W., Mathematical Theory of Program Correctness BARR, M. and WELLS, C., Category Theory for Computing Science BEN-ARI, M., Principles of Concurrent and Distributed Programming BIRD,'R. and WADLER, P., Introduction to Functional Programming BORNAT, R., Programmingfrom First Principles BUSTARD, D., ELDER, J. and WELSH, J., Concurrent Program Structures CLARK, K. L. and McCABE, F. G., Micro-Prolog: Programming in logic CROOKES, D., Introduction to Programming in Prolog DROMEY, R. G., How to Solve it by Computer DUNCAN, E., Microprocessor Programming and Software Development ELDER, J., Construction of Data Processing Software ELLIOTT, R. J. and HOARE, C. A. R., (eds.), Scientific Applications of Multiprocessors GOLDSCHLAGER, L. and LISTER, A., Computer Science: A modern introduction (2nd edn). GORDON, M. J. C., Programming Language Theory and its Implementation HA YES, I, (ed), Specification Case Studies HEBNER, E. C. R., The Logic of Programming HENDERSON, P., Functional Programming: Application and implementation HOARE, C. A. R., Communicating Sequential Processes HOARE, C. A. R., and JONES, C. B. (eds), Essays in Computing Science HOARE, C. A. R., and SHEPHERDSON, J.C. (eds), Mathematica/ Logic and Programming Languages HUGHES, J. G., Database Technology: A software engineering approach HUGHES, J. G., Object-oriented Databases INMOS LTD, Occam2 Reference Manual JACKSON, M.A., System Development JOHNSTON, H., Learning to Program JONES, C. B., Systematic Software Development using VDM (2nd edn) JONES, C. B. and SHAW, R. C. F. (eds), Case Studies in Systematic Software Development JONES, G., Programming in occam JONES, G, and GOLDSMITH, M., Programming in occam 2 JOSEPH, M., PRASAD, V. R. andNATARAJAN, N.,A Multiprocessor Operating System KALDEWAIJ, A., Programming: The Derivation of Algorithms KING, P. J.B. Computer and Communication Systems Performance Modelling LEW, A., Computer Science: A mathematical introduction MARTIN, J. J., Data Types and Data Structures McCABE, F. G., High-Level Programmer's Guide to the 68000 MEYER, B., Introduction to the Theory of Programming Languages MEYER, B., Object-oriented Software Construction MILNER, R., Communication and Concurrency MORGAN, C., Programming from Specifications PEYTON JONES, S. L., The Implementation of Functional Programming Languages POMBERGER, G., Software Engineering and Modula-2 POTTER, B., SINCLAIR, J., TILL, D., An Introduction to Formal Specification and Z REYNOLDS, J. C., The Craft of Programming RYDEHEARD, D. E. and BURST ALL, R. M., Computational Category Theory SLOMAN, M. and KRAMER, J., Distributed Systems and Computer Networks SPIVEY, J.M., The Z Notation: A reference manual TENNENT, R. D., Principles of Programming Languages TENNENT, R. D., Semannnntics of Programming Languages WATT, D, A., Programming Language Concepts and Paradigms WATT, D. A., WICHMANN, B. A., and FINDLAY, W.,)\f>A: Language and methodology WELSH, J. and ELDER, J., Introduction to Modula 2 · WELSH, J. and ELDER, J., Introduction to Pascal (3rd edn) WELSH, J. ELDER, J. and BUST ARD, D., Sequential Program Structures WELSH, J. and HAY, A., A Model Implementation of Standard Pascal WELSH, J. and McKEAG, M., Structured System Programming WIKSTROM, A., Functional Programming using Standard ML

Reading notes: Source is a publisher's book list with OCR-style spacing and some character errors (e.g., 'Semannnntics', 'Mathematica/ Logic', 'Programmingfrom').

Languages
English
PDF page 4

High-Level Programmer's Guide tothe68000 Francis G. McCabe Prentice Hall New York London Toronto Sydney Tokyo Singapore

Languages
English
PDF page 5

First published 1992 by Prentice Hall International (UK) Ltd 66 Wood Lane End, Heme! Hempstead Hertfordshire HP2 4RG A division of Simon & Schuster International Group ©Francis G. McCabe, 1992 All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form, or by any means, electronic, mechanical, photocopying, recording or otherwise, without prior permission in writing, from the publisher. For permission within the United States of America contact Prentice Hall Inc., Englewood Cliffs, NJ 07632. Printed and bound in Great Britain at Dotesios, Trowbridge, Wiltshire Library of Congress Cataloguing-in-Publication Data A CIP catalogue record for this book is available from the Library of Congress British Library Cataloguing in Publication Data McCabe, Francis G. High-level programmer's guide to the 68000. I. Title 005.13 ISBN 0-13-388034-6 1 2 3 4 5 96 95 94 93 92

Reading notes: OCR-like artifact 'Heme! Hempstead' may be a misreading of 'Hemel Hempstead' Primary heading absent; title 'High-level programmer's guide to the 68000' appears only in the cataloguing block

Printed dates
1992
Languages
English
PDF page 6

Contents List of figures ............................................................................................................. xi Aims and objectives ............................................................................................... xv lntroduction ................................................................................................................1 1.1 Approach ........................................................................................................4 1.1. l Structure of the book. ...................................................................... 5 1.1.2 Exercise ............................................................................................... 7 Bits, bytes and numbers ............................................................................................8 2.1 Representing numbers in a machine ...................................................... 9 2.2 Arithmetic in fixed length bit strings .................................................... 11 2.2.1 Negative numbers ......................................................................... 12 2.2.2 Multiplication of binary numbers .............................................. 15 General purpose multiplication ................................................. 16 2.2.3 Division of binary numbers ........................................................ 18 2.2.4 Exercises ........................................................................................... 23 2.3 Other kinds of numerals .......................................................................... 25 2.3.1 Fixed point numbers ..................................................................... 25 Binary fractions .............................................................................. 25 Fixed point arithmetic ..................................................................26 2.3.2 Floating point numbers ................................................................ 28 Floating point arithmetic ............................................................. 31 IEEE Floating point numbers ...................................................... 33 2.3.3 Hexadecimal notation ................................................................... 33 2.3.4 Exercises ........................................................................................... 34 The 680x0 programmer's model ...........................................................................35 3.1 The 680x0 registers ..................................................................................... 36 3.1.1 The condition codes register ........................................................38 3.2 The 680x0 memory architecture .............................................................39 v

Reading notes: Some characters in the table of contents appear as 'lntroduction' and 'l' in place of 'I', possibly OCR artifacts.

Languages
English
PDF page 7

vi Contents 3.3 Simple assembler programming ........................................................... .42 3.3.1 The 680x0 instruction set.. ............................................................44 The 680x0 addressing modes ...................................................... .46 3.3.2 Assembling and running programs ..........................................46 Symbols, names and assembler directives .............................. .49 Executing assembler programs ................................................... .51 3.3.3 Exercises ........................................................................................... 52 3.4 Input and output in assembler .............................................................. .53 Representing Pascal expressions........................................................................... 55 4.1 Scalar values and variables ...................................................................... 55 4.1.1 Ordinals ............................................................................................56 Characters ....................................................................................... .57 4.1.2 Pointers ........................................................................................... .58 4.2 Scalar expressions ..................................................................................... .58 4.2.1 Evaluating complex expressions ................................................ 59 Reverse polish notation ............................................................... 60 Evaluating reverse polish form expressions ........................... 62 Expression stacks on the 680x0 .................................................... 65 Evaluating an expression using registers ................................. 70 4.2.2 Error checking ................................................................................. 71 4.2.3 Exercises ........................................................................................... 74 Pascal compound structures .................................................................................. 75 5.1 Records ......................................................................................................... 75 5.1.l Assignment of a record variable ................................................. 78 5.1.2 Pointers and pointer manipulation ........................................... 79 5.1.3 The with statement ..................................................................... 81 5.1.4 Exercises ........................................................................................... 84 5.2 Representing arrays ...................................................................................85 5.2.1 Arrays of records ............................................................................ 89 5.2.2 Arrays of arrays ............................................................................... 90 5.2.3 Exercises ........................................................................................... 93 Advanced Pascal data structures ........................................................................... 95 6.1 Packed data structures ............................................................................... 95 6.2 Representing sets ..................................................................................... 102 6.2.l Set membership and element insertion ................................. 103 6.2.2 Set intersection, union and difference .................................... 106 6.2.3 Exercises ......................................................................................... 108 Representing Pascal control ................................................................................. 109 7.1 Simple Pascal control structures ........................................................... 110 7.1.1 Conditional if then el.se .................................................. 110 Conjunctions and disjunctions ................................................ 113

Reading notes: Source is a table of contents with OCR-style artifacts such as 'l' for '1' in '5.1.l' and 'el.se' for 'else'. Some section numbers and titles may be spacing-distorted in extraction.

Languages
English
PDF page 8

Contents vii 7.1.2 Loop control statements ............................................................. 115 The repeat loop ........................................................................ 115 The while loop ........................................................................... 116 7.1.3 The for loop ................................................................................ 118 7.1.4 Case statements .......................................................................... 122 7.1.5 Exercises ......................................................................................... 126 7.2 Coding for performance ......................................................................... 126 The Pascal procedure ............................................................................................. 130 8.1 Parameters and local variables .............................................................. 132 Accessing parameters in a procedure body ............................. 134 8.1.1 Local variables .............................................................................. 136 8.1.2 The procedure epilogue .............................................................. 139 8.1.3 A complete Pascal procedure ..................................................... 141 8.2 Nested, scoped and global ...................................................................... 142 8.2.1 Registers and register allocation ............................................... 144 8.2.2 Exercises ......................................................................................... 146 8.3 Functions ................................................................................................... 148 8.4 The qoto statement ............................................................................... 150 Symbolic programming languages ....................................................................154 9.1 Recursive data structures ....................................................................... 154 9.2 LISP data structures ................................................................................. 156 9.2.1 Representing S-expressions ....................................................... 158 9.2.2 Representing LISP atoms ........................................................... 160 Symbol dictionary ........................................................................ 161 9.2.3 Numeric atoms ............................................................................ 162 Big nums in LISP ......................................................................... 163 9.2.4 CONS pairs, heaps and collecting garbage .............................. 166 Garbage collection ........................................................................168 9.3 Executing LISP programs ........................................................................ 170 9.3.l Evaluating and accessing S-expressions .................................. 171 9.3.2 Function application ................................................................... 173 Evaluating a function body ........................................................ 176 9.3.3 Program sequences ...................................................................... 180 9.3.4 LISP conditional expressions ..................................................... 180 Prolog ........................................................................................................................184 10.1 Prolog data structures ................... ; ........................................................ 185 10.1.1 Unification in Prolog .................................................................. 190 Compiling unification ................................................................ 191 10.2 Controlling a Prolog execution ........................................................... 193 10.2.1 The Prolog evaluation stack ...................................................... 196 10.2.2 A sample evaluation ................................................................... 199

Reading notes: OCR damage in table of contents entries (e.g., 'qoto' for 'goto', 'l' for 'I' in 'l.') Several section lines contain OCR noise and irregular spacing that may affect reading order

Languages
English
PDF page 9

viii Contents 10.3 Using a virtual machine ...................................................................... 204 Addressing modes for the 680x0 ......................................................................... 208 A. l Register direct addressing ....................................................................... 208 A.2 Immediate addressing ............................................................................. 209 A.3 Absolute addressing ................................................................................ 210 A.4 Address register indirect... ...................................................................... 211 A.5 Address register indirect with displacement ..................................... 212 A.6 Address register indirect with post-increment... ............................... 213 A.7 Address register indirect with pre-decrement... ................................ 214 A.8 Address register indirect with index .................................................... 215 A.9 Program counter with displacement.. ................................................. 216 A.10 Program counter with index ............................................................... 217 A.11 Memory indirect post-indexed ............................................................218 A.12 Memory indirect pre-indexed ............................................................. 219 A.13 Program counter memory indirect with post-indexing ................ 220 A.14 Program counter memory indirect with pre-indexing .................. 221 The 680x0 instructions used in the text................. : ........................................... 222 add Add source to destination ............................................................ 223 adda Add to address register .................................................................. 223 addi Add immediate data ...................................................................... 224 addq Add quick immediate data ........................................................... 224 addx Add binary extended .................................................................... 225 and AND logical. .................................................................................... 225 andi AND immediate data .................................................................... 226 andi AND immediate to ccr .................................................................. 226 as 1 Arithmetic shift left.. ..................................................................... 227 as r Arithmetic shift right.. .................................................................. 228 be c Branch conditionally ..................................................................... 229 bchg Test a bit and change ..................................................................... 230 bc1r Test a bit and clear .......................................................................... 230 bf chg Test bit field and change ............................................................... 231 bf c 1 r Clear bit field ................................................................................... 232 bfexts Signed extraction of a bit field .................................................... .233 bfextu Unsigned extraction of a bit field ................................................ 234 bf ff o Find first one in a bit field ............................................................ 235 bf ins Insert a bit field ............................................................................... 236 bf set Set bit field ....................................................................................... 237 bftst Test bit field ..................................................................................... 238 bra Branch always .................................................................................238 bset Test a bit and set .............................................................................239 b s r Branch to subroutine .................................................................... 239 bt st Test a bit ........................................................................................... 240

Reading notes: Source is a table of contents with OCR-damaged entries (e.g., 'as 1' and 'as r' for asl/asr, 'be c' for bcc, 'bc1r' for bclr, 'bf c 1 r' for bfclr, 'bt st' for btst) Some lines contain stray spacing and possible dropped characters from extraction

Languages
English
PDF page 10

chk chk2 clr cmp cmpa cmpi cm pm cmp2 dbcc dbra divs di vu eor eori eori exg ext jmp jsr lea link lsl lsr move move a move move movem moveq mu ls mulu neg negx not or ori ori pea rol ror roxl roxr rtd rts Contents ix Check register against bounds ..................................................... 240 Check register against two bounds ............................................. 241 Clear an operand ............................................................................ 241 Compare ........................................................................................... 242 Compare addresses ........................................................................ 242 Compare immediate ..................................................................... 243 Compare memory .......................................................................... 243 Compare register against bounds ............................................... 244 Test condition, decrement and branch ...................................... 245 Decrement and branch .................................................................. 245 Signed division .............................................................................. 246 Unsigned division ......................................................................... 247 Exclusive OR ................................................................................... 248 Exclusive OR immediate data ..................................................... 248 Exclusive OR to condition codes register .................................. 249 Exchange registers .......................................................................... 249 Sign extend data register ............................................................... 250 Jump ................................................................................................. 250 Jump to sub-routine ...................................................................... 251 Load effective address ................................................................... 251 Link and allocate ............................................................................ 251 Logical shift left .............................................................................. 252 Logical shift right ........................................................................... 253 Move data ........................................................................................ 254 Move data to address register ...................................................... 254 Move from ccr ................................................................................ 254 Move to ccr ...................................................................................... 255 Move multiple registers to/from memory .............................. 255 Move quick immediate data ........................................................ 255 Signed multiply .............................................................................. 256 Unsigned multiply ........................................................................ 257 Negate operand .............................................................................. 257 Negate operand with eXtend ....................................................... 258 Complement operand .................................................................. 258 Inclusive OR ................................................................................... 259 Inclusive OR with immediate data ............................................ 259 Inclusive OR immediate to ccr ................................................... 260 Push effective address ................................................................... 260 Rotate left. ........................................................................................ 261 Rotate right. ..................................................................................... 262 Rotate left with eXtend ................................................................. 263 Rotate right with eXtend ..............................................................264 Return and deallocate parameters ............................................. 264 Return from sub-routine ............................................................. 265

Reading notes: Source appears to be a table of contents listing 68000 assembly instructions; the leading list lacks a clear heading. Several entries contain OCR spacing errors (e.g., 'di vu', 'mu ls', 'cm pm').

Languages
English
PDF page 11

x Contents Sec Set according to condition ............................................................ 265 sub Subtract source from destination ............................................... 266 sub a Subtract from address register ..................................................... 266 subi Subtract immediate data ............................................................... 267 subq Subtract quick immediate data .................................................... 267 subx Subtract with extend ......................................................................268 swap Swap register halves ......................................................................268 tst Test an operand .............................................................................. 268 unl.k Deallocate......................................................................................... 269 Answers to selected exercises .............................................................................. 270 Exercises 2.2.4 .................................................................................................... 270 Exercises 2.3.4 .................................................................................................... 273 Exercises 3.3.3 .................................................................................................... 275 Exercises 4.2.3 .................................................................................................... 276 Exercises 5.1.4 .................................................................................................... 279 Exercises 5.2.3 .................................................. , ................................................. 280 Exercises 6.2.3 .................................................................................................... 283 Exercises 7.1.5 .................................................................................................... 285 Index ......................................................................................................................... 287 •

Reading notes: Source appears to be a table of contents with instruction names and page numbers rather than advertising copy; no headline or advertised products identified. Some dot leaders and characters near 'Exercises 5.2.3' are garbled and uncertain. Bullet and leading characters at the start and end of the copy are unclear.

Languages
English