Text preview for : 09845-91083_asmDevRom_Mar80.pdf part of HP 09845-91083 asmDevRom Mar80 HP 98xx 09845-91083_asmDevRom_Mar80.pdf



Back to : 09845-91083_asmDevRom_Mar | Home

Series 9800 Desktop Computers




Assembly Development
ROM Manual
For the HP 9845




rhO- HEWLETT
a.:~ PACKARD
FliiW HEWLETT
.:~ PACKARD

Warranty Statement

Hewlett-Packard products are warranted against defects in
materials and workmanship. For Hewlett-Packard Desktop
Computer Division products sold in the U.S.A. and Canada, this
warranty applies for ninety (90) days from date of delivery.*
Hewlett-Packard will, at its option, repair or replace equipment
which proves to be defective during the warranty period. This
warranty includes labor, parts, and surface travel costs, if any.
Equipment returned to Hewlett-Packard for repair must be
shipped freight prepaid. Repairs necessitated by misuse of the
equipment, or by hardware, software, or interfacing not provided
by Hewlett-Packard are not covered by this warranty.

NO OTHER WARRANTY IS EXPRESSED OR IMPLIED,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. HEWLETT-PACKARD SHALL NOT BE LIABLE FOR
CONSEQUENTIAL DAMAGES.

* For other countries, contact your local Sales and Service Office
to determine warranty terms.
r 1

Assembly Development ROM




Hewlett-Packard Desktop Computer Division
3404 East Harmony Road, Fort Co!!ins, Colorado 80525

CopYright by Hewlett-Packard Company 1980
ii




Printing History
Periodically, this manual is updated. Each new edition of this manual incorporates all material
updated since the previous edition. Each new or revised page is indicated by a revision date.


The date on the back cover changes only when each new edition is published.


First Printing ... March 1, 1980
iii




Tabie of Contents

Chapter 1: General Information
Equipment Supplied ............................................................ 1-2
Structure of the Manual ......................................................... 1-2
Purpose of the ROMs ........................................................... 1-3
ROM Installation ............................................................... 1-3
Buzzwords ..................................................................... 1-5
Fundamental Syntax ............................................................ 1-7

Chapter 2: Getting Started
Developing Routines for Later Use ............................................... 2-1
Overview ...................................................................... 2-3
Program Creation ........................................................... 2-3
Program Entry .............................................................. 2-8
Other Extensions .......................................................... 2-10
Modules and Routines ......................................................... 2-11
Names .................................................................... 2-11
Survey of Modules and Routines ............................................ 2-12
Setting Aside Memory ...................................................... 2-13
Retrieving and Storing Modules ................................................ 2-16

Chapter 3: The Processor and the Operating System
Machine Architecture ........................................................... 3-1
Registers ................................................................... 3-2
General Memory Organization ............................................... 3-4
Protected Memory .......................................................... 3-6
Base and Current Page ...................................................... 3-6
Nesting of Subroutine Calls .................................................. 3-6
Data Structures ................................................................ 3-8
Integers .................................................................... 3-8
Strings ..................................................................... 3-8
Full-Precision Numbers ...................................................... 3-9
Short-Precision Numbers .................................................... 3-9
Machine Instructions .......................................................... 3-10
Operands ................................................................. 3-10
Indirect Addressing ........................................................ 3-12
Load/Store Group ........................................................ 3-12
Integer Math Group ........................................................ 3-13
Branch Group ............................................................. 3-14
Test/Branch Group .................................................. " ... 3-15
Test/ Alter /Branch Group ................................................. 3-16
Shift/Rotate Group ....................................................... 3-18
Logical Group .................................................... " ....... 3-19
Stack Group .............................................................. 3-20
BCD Math Group .......................................................... 3-23
I/O Group ................................................................ 3-26
Miscellaneous ............................................................. 3-27
iv




Chapter 4: Assembly Language Fundamentals
Program Entry ................................................................. 4-1
Assembly Language Source .................................................. 4-3
Actions ................................................................. 4-3
Labels .................................................................. 4-3
Comments .............................................................. 4-5
Syntaxing the Source ....................................................... 4-5
Creating Modules .............................................................. 4-7
Storage ........................................................................ 4-8
Modules ................................................................... 4-8
Variables ................................................................... 4-8
Data Generators ............................................................ 4-9
Repeating Instructions ......................................................... 4-12
Assembling ................................................................... 4-13
Effect of BASIC Environments .............................................. 4-14
Source Listing Control ..................................................... 4-14
Page Format ........................................................... 4-16
Page Length ........................................................... 4-16
End-of-Page Control ................................................... 4-17
Page Headings ......................................................... 4-18
Blank Line Generation ................................................. 4-18
Non-Listable Pseudo-Instructions ........................................ 4-19
Conditional Assembly ...................................................... 4-19
Control of Indirection ...................................................... 4-22
Relocation ................................................................ 4-22
Module Reassembly .................................................... 4-23
Symbolic Operations .......................................................... 4-24
Predefined Symbols ....................................................... 4-24
Defining Your Own ........................................................ 4-26
Literals ................................................................... 4-27
Evaluation of Literals ................................................... 4-27
Nesting Literals ........................................................ 4-28
Nonsensical Uses of Literals ............................................. 4-29
Literal Pools ........................................................... 4-30
Expressions ............................................................... 4-31
External Symbols and Elements ............................................. 4-33
Other Absolute Elements ................................................... 4-34
Utilities ....................................................................... 4-36

Chapter 5: Arithemetic
Integer Arithmetic .............................................................. 5-2
Representation of Integers ................................................... 5-2
Integer Arithmetic ........................................................... 5-2
Multi-Word Integer Arithmetic ............................................... 5-5
Binary Coded Decimal .......................................................... 5-7
Arithmetic Machine Instructions .................................................. 5-7
BCD Registers ................................................................. 5-8
BCD Arithmetic ................................................................ 5-8
Addition ................................................................... 5-9
Ten's Complement for BCD ................................................. 5-9
Floating Point Summations ................................................. 5-11
v




Normalization ............................................................. 5-12
Rounding ................................................................. 5-12
Floating Point Multiplication ................................................ 5-13
Floating Point Division ..................................................... 5-15
The FDV Instruction .................................................... 5-1 7
Thirteen-Digit Dividends ................................................ 5-18
Floating-Point Division Example ........................... , ........ " ... 5-19
Arithmetic Utilities ............................................................. 5-21
Utility: ReI_math ......................................................... 5-21
Utility: ReI to int ........................................................ 5-24
Utility: ReI-to-sho ........................................................ 5-25
Utility: Int to reI ......................................................... 5-26
Utility: Sho to reI ........................................................ 5-27

Chapter 6: Communication Beiween BASiC and Assembly Language
The ICALL Statement .......................................................... 6-1
Corresponding Assembly Language Statements ............................... 6-2
Arguments ................................................................. 6-3
"Blind" Parameters ......................................................... 6-6
Getting Information on Arguments ........................................... 6-7
Utility: Get_info ........................................................ 6-8
Retrieving the Value of an Argument ........................................ 6-12
Utility: Get value ..................................................... 6-12
Utility: Get element ................................................... 6-14
Utility: Get bytes ...................................................... 6-15
Utility: Get elem bytes ............................................... 6-16
Changing the Value of Argument ......................................... 6-18
an
Utility: Put value ..................................................... 6-18
Utility: Put-element ................................................... 6-19
Utility: Put-bytes ...................................................... 6-20
Utility: Put-elem bytes ................................................ 6-22
Using Common .. ~ .... ~ ..................................................... 6-23
Busy Bits ................................................................. 6-26
Utility: Busy ........................................................... 6-27
Utility: To_system ..................................................... 6-28

Chapter 7: 110 Handling
Peripheral-Processor Communication ............................................ 7-1
Interfaces .................................................................. 7-2
Registers ................................................................... 7-2
Select Codes ............................................................... 7-3
Status and Control Registers ................................................. 7-4
Status and Flag Lines ....................................................... 7-4
Programmed I I 0 .............................................................. 7-6
Interrupt 1/0 .................................................................. 7-7
Priorities ................................................................... 7-8
Interrupt Service Routines and Linkage ....................................... 7-9
Breaking Interrupt Service Routine Linkage ................................... 7-9
Access .................................................................... 7-10
Utility: Isr_access ..................................................... 7-13
Disabling Interrupts ........................................................ 7-15
State Preservation and Restoration .... , ....................... , ............. 7-17
vi




Indirect Addressing in ISRs ................................................. 7-18
Enabling the Interface Card ............................................. 7-19
Interrupt Transfer Example ............................................. 7-20
Direct Memory Access (DMA) .................................................. 7-22
DMA Registers ............................................................ 7-22
DMA Transfers ............................................................ 7-23
BASIC Branching on Interrupts ................................................. 7-27
ON INT Statement ......................................................... 7-27
Signalling ................................................................. 7-28
Prioritizing ON INT Branches ............................................... 7-30
Environmental Considerations .............................................. 7-32
Disabling ON INT Branching ................................................ 7-32
Mass Storage Activities ........................................................ 7-33
Reading from Mass Storage ................................................. 7-33
Utility: Mm read start ................................................ 7-35
Utility: Mm -read- xfer ................................................. 7 -35
Writing to Mass Storage .................................................... 7-37
Utility: Mm write start ................................................ 7-37
Utility: Mm - write -test ................................................. 7-38
System File Information .................................................... 7-39
Utility: Get file info .................................................. 7-40
Utility: Put-file -info ................................................... 7-41
Communicati0l1withBASIC Data Files ...................................... 7-42
Interrelation of Record Types ........................................... 7-43
Crossing Record Boundaries ............................................ 7-44
File Marks ............................................................. 7-47
Determining Data Types ................................................ 7-48
Printing ...................................................................... 7-49
Utility: Printer select ...................................................... 7-49
Utility: Print String ........................................................ 7-50
Utility: Print-no If ........................................................ 7-52
The Beep Signal~ .. ~ ......................................................... 7-53
Expediting I/O ............................................................... 7 -53

Chapter 8: Debugging
Symbolic Debugging ............................................................ 8-2
Stepping Through Programs ..................................................... 8-3
Individual Instruction Execution .............................................. 8-3
Setting Break Points ........................................................ 8- 7
Simple Pausing ......................................................... 8-7
Transfers ............................................................... 8-8
Environments ........................................................... 8-9
Data Locations ........................................................ 8-11
IBREAK Everywhere ................................................... 8-12
Number of Break Points ................................................ 8-13
Clearing Break Points .................................................. 8-13
Interrogating Processor Bits ............................................. 8-14
Dumps ....................................................................... 8-14
Value Checking ............................................................... 8-17
Functions ................................................................. 8-17
DECIMAL ............................................................. 8-17
OCTAL ............................................................... 8-18
vii




IADR ................................................................. 8-19
IMEM ................................................................. 8-19
Interrupting Registers and Flags ......................................... 8-20
Patching .............................................................. 8-21
Stepping vs. Running ................................................... 8-22

Chapter 9: Errors and Error Processing
Types of Errors ................................................................. 9-1
Syntax-Time and Assembly-Time Errors ...................................... 9-2
Run-Time Errors ............................................................ 9-2
Utility: Error exit ....................................................... 9-3
Run-Time Messages ~........................................................... 9-5
Assembly-Time Messages ........... '............................................ 9-8

Chapier iO: Graphics
Introduction .................................................................. 10-1
The Graphics Raster ........................................................... 10-2
Displaying the Graphics Raster .............................................. 10-2
The Graphics Memory ......................................................... 10-3
Graphics Operations ........................................................... 10-5
Checking for Graphics Hardware ............................................ 10-5
Overview ................................................................. 10-5
Operation: Writing Individual Pixels ........... " ........................... 10-7
Operation: Writing Full Words ............................................ 10-11
Operation: Clearing Full \Nords ........................................... 10-15
Operation: Reading Full Words ........................................... 10-18
Operation: Cursor Operations ............................................. 10-22
Comprehensive Example ..................................................... 10-25
Line Drawing ................................................................ 10-27

Appendix A: ASCII Character Set
ASCII Character Codes ......................................................... A-I

Appendix B: Machine Instructions
Detailed List ................................................................... B-1
Condensed Numerical List ................................................. B-12
Alphabetical List .......................................................... B-12
Bit Patterns and Timings ....................................................... B-13

Appendix C: Pseudo-Instructions ................................................. C-1

Appendix D: Assembly Language BASIC Language Extensions Formal Syntax ...... D-1

Appendix E: Predefined Assembler Symbols ....................................... E-1

Appendix F: Utilities ............................................................. F-1

Appendix G: Writing Utilities ....................................... . ............ G-1
viii




Appendix H: I/O Sample Programs
Handshake String Output ....................................................... H-l
Handshake String Input ........................................................ H-3
Interrupt String Output ......................................................... H-5
Interrupt String Input ........................................................... H-7
DMA String Output ........................................................... H-I0
DMA String Input ............................................................. H-12
HP-IB Output/Input Drivers ................................................... H-15
Real Time Clock Example ..................................................... H-19

Appendix I: Demonstration Cartridge
Using the Tape ................................................................. 1-1
Typing Aids .................................................................... 1-1

Appendix J: Error Messages
Mainframe Errors ............................................................... J-l
I/O Device Errors ............................................................. J-ll
CSTATUS Element 0 Errors ................................................ J-12
Assembly-Time Errors ......................................................... J-12
IMAGE Status Errors ........................................................... J-13

Appendix K: Maintenance
Maintenance Agreements ....................................................... K-l

Appendix L: 9835/9845 Compatibility ............................................ L-l

Subject Index
1-1




Chapter 1
General Information


Welcome to the world of assembly language programming on the System 45 1