home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
594a.lha
/
IOPack_v1.04
/
IOPack.doc.pp
/
IOPack.doc
Wrap
Text File
|
1991-11-07
|
9KB
|
318 lines
The IOPack Library for the Amiga
Copyright © 1991 by Mark Thomas
Written by Mark Thomas
I can be reached by e-mail addresses:
Internet - amigamat@ccwf.cc.utexas.edu
GEnie - M.THOMAS24
or snail mail:
2005 Willow Creek Dr. #2117
Austin, TX 78741
IOPack for the Amiga is Public Domain software, but the Copyright on the
library code is retained by me. I do not ask for money for the library.
The IOPack library of routines are a set of routines to be used by
the person first starting out programming in 68000 Assembly Language. The
routines simplify input and output for this programmer. This Amiga version
was written for the Amiga Assembler DevPac. Other versions for CAPE and
ADAPT and maybe even A68k will follow shortly.
In order to use the library there are a few steps one must take:
1. Add the line:
include "IOPackDefs.txt"
to your source code at the top. IOPackDefs.txt turns off listing so
you may want to turn it back on after the line if it was on before.
2. Put the label "main" at the start of your code. With the Mac version
you have to XDEF main, but the Amiga version does not require this.
3. When you assemble your program with DevPac use the -l command line
option. This makes sure you get object code and not executable code.
4. When you link as with blink just add "iopack.o" or "iopack.o.strip" as
the last object input file.
Example: blink from sample.o iopack.o to sample
There are a few labels that are reserved when using IOPack on the
Amiga. They are:
_IntuitionBase
IOPackWindow
Start
startup_ok
exit_iopack
end_exit
IOExit
These labels are used in IOPackDefs.txt for startup and exit. The label
"_IntuitionBase" refers to the library base of Intuition. Use can use this
to access Intuition functions. And, for some of the functions you may need
access to the window structure that IOPack opens. That window pointer is
accessed through the "IOPackWindow" label.
IOPack strings on the Amiga are null terminated strings.
A sample IOPack application which just opens the window and waits for a
keypress is supplied. See the file "sample.s"
In the file "IOPackDefs.txt" there are some comments on how to open your own
Amiga libraries and how to add extra routines to IOPack. Also, the complete
and commented source for IOPack is supplied as a tool for learning as well.
It should be noted that while normally the first thing you must do in an
IOPack program is to open the window so that input and output has a place to
go, on the Amiga version of IOPack if the window is not open and a routine
that requires the window is called, that routine will open the window for
you will a default title of "Default Window" and then the routine will finish
it's action. The Mac version does not have this feature.
**WARNING**
Upon opening the window you may receive an error. This error condition is
returned in D0.L. A non-zero D0.L means there is no error. If D0.L is 0
then there is and error. If this error condition is found then your program
should do it's necessary cleanup and then JSR Exit. Because of the feature
described in the above paragraph, auto-window-opening, library routines that
detect they need to open a window and subsequently find an error in trying
this, will not do their intended action, but will just exit safely. There is
no warning to you of this and no for your program to detect this. This is
why I must discourage you from using the auto-window-open feature. Open the
window yourself and check to see if there is an error. None of this was
apparently an issue on the Mac version of the IOPack.
-----------------------------------------------------------------------------
Below are the routines for IOPack for the Amiga:
Operations on the window:
* MakeWindow.......Make the window.
input:
A0: ptr to title string
output:
D0: 0L if error, non-zero if no error
NOTE: This routine will open a window the full size of the screen minus
the screens top border (so that you can drag). The window can be
resized, depth arranged, and dragged. There is no close button
since there is no way of handling it in the IOPack way of doing
things.
* ClearWindow......Home cursor and clear window.
* GetWindowSize....Return the size of the window.
output:
D0.L: upper word - width of the window
lower word - height of the window
* WindowTitle......Change the title of the window.
input:
A0: ptr to new title string
* SetFont..........Change the style of the font.
input:
D2.W: font style (-1-Plain, 0-Bold, 1-Italic, 2-Underline)
NOTE: Mac version allows for Font and Size change. For compatibility
reasons, the Amiga version does not do this. In other words, the
Amiga does not have Chicago, Geneva, or Monaco for standard fonts.
Likewise, Mac styles 3-6 (Outline, Shadow, Condense, and Extend)
do nothing and are not implemented. This routine will just ignore
what it cannot do.
Character and String I/O Routines:
* GetC.............Get a character from the keyboard.
output:
D0.B: character read in
* CharOut..........Output a character to the window.
input:
D0.B: character to output
* BackSpace........Delete the character to the left of the cursor.
* CStrin...........Input a CR delimited string.
input:
A0.L: address of buffer to store string
D0.W: size of the buffer
output:
A0.L: address of string (same as input)
D0.W: Number of characters actually read in, 0 <= D0.W.out <= D0.W.in-1
NOTE: The string will be null terminated and will not have a CR in it.
The Mac version uses strings where string[0] = len(string).
* CStrout..........Output a C string.
input:
A0: address of string to output, must be null terminated
NOTE: Mac strings in IOPack have string[0] = len(string). Amiga
strings are C or Unix style null terminated strings.
* Strin............Input a counted string
input:
A0.L: address of buffer to store string
D0.W: Maximum number of characters to read in
output:
A0.L: address of string buffer (same as input)
D0.W: number of characters actually read in
* Strout...........Output a counted string.
input:
A0.L: address of string to output
D0.W: length of the string
* NewLine..........Move cursor to beginning of next line.
* Spaces...........Output given number of spaces
input:
D0.W: number of spaces
Numeric I/O Routines:
* DecIn............Input a decimal number (word size).
output:
D0.W: binary equivalent of decimal number
* DecIn_Long.......Input a decimal number (long size)
output:
D0.L: binary equivalent of decimal number
* DecOut...........Output a decimal number (word size).
input:
D0.W: binary equivalent of decimal number
* DecOut_Long......Output a decimal number (long size).
input:
D0.L: binary equivalent of decimal number
* HexIn............Input a hex number (word size).
output:
D0.W: binary equivalent of hex number
* HexIn_Long.......Input a hex number (long size).
output:
D0.L: binary equivalent of hex number
* HexOut...........Output a hex number (word size).
input:
D0.W: binary equivalent of number
* HexOut_Long......Output a hex number (long size).
input:
D0.W: binary equivalent of number
Math Routines:
* DivuLW...........Divide unsigned longword by word
and return quotient and remainder.
input:
D0.L: dividend
D1.W: divisor
output:
D0.L: quotient
D1.W: remainder
NOTE: Mac version does not return remainder
* Rand.............Make a 16 bit random number.
output:
D0.W: random number
* ResetRand........Restart the random number generator.
* Seed.............Randomize the random number generator.
Miscellaneous Routines:
* IOExit...........Cleanup and terminate program.
NOTE: You must JSR to this routine in order to stay compatible with the
Mac version. I think it's unnecessary and is kinda weird looking.
It makes you think IOExit comes back!
* WaitForEvent.....Wait for a key press.
NOTE: The Mac version also let you hit the mouse button to continue.
Mine does not. I will add this later.
* AskYesNo.........Autorequest a Yes/No question.
input:
A0: ptr to question string
output:
Z bit set if Yes, clear if No
NOTE: I never saw what the Mac version did, but I decided to make mine
an Amiga standard requester.
* WrtIOInfo........Write copyright and ordering info.