; Sys-Intf Interface to the Mac System ; File: QuickEqu.Txt (15 Dec 84) ; Transfer modes srcCopy EQU 0 srcOr EQU 1 srcXor EQU 2 srcBic EQU 3 notSrcCopy EQU 4 notSrcOr EQU 5 notSrcXor EQU 6 notSrcBic EQU 7 patCopy EQU 8 patOr EQU 9 patXor EQU 10 patBic EQU 11 notPatCopy EQU 12 notPatOr EQU 13 notPatXor EQU 14 notPatBic EQU 15 ; Definitions for Font Style Bits (right to left) boldBit EQU 0 italicBit EQU 1 ulineBit EQU 2 outlineBit EQU 3 shadowBit EQU 4 condenseBit EQU 5 extendBit EQU 6 ; Point structure v EQU 0 ; vertical coordinate [word] h EQU 2 ; horizontal coordinate [word] ; Rectangle structure topLeft EQU 0 ; upper left corner [point] botRight EQU 4 ; lower right corner [point] top EQU 0 ; top coordinate [word] left EQU 2 ; left coordinate [word] bottom EQU 4 ; bottom coordinate [word] right EQU 6 ; right coordinate [word] ; Bitmap Structure baseAddr EQU 0 ; bitmap base address [pointer] rowBytes EQU 4 ; row bytes (must be even) [word] bounds EQU 6 ; bounding box [rectangle] bitmapRec EQU 14 ; size of a bitmap ; GrafPort Structure device EQU $0 ; device code [word] portBits EQU $2 ; port's bitmap [bitmap] portBounds EQU $8 ; bounding box of bitmap [rect] portRect EQU $10 ; port's rectangle [rect] visRgn EQU $18 ; visible region [handle] clipRgn EQU $1C ; clipping region [handle] bkPat EQU $20 ; background [pattern] fillPat EQU $28 ; fill [pattern] pnLoc EQU $30 ; pen location [point] pnSize EQU $34 ; pen size [point] pnMode EQU $38 ; pen mode [word] pnPat EQU $3A ; pen [pattern] pnVis EQU $42 ; pen visible [word] txFont EQU $44 ; text font [word] txFace EQU $46 ; text face [word] txMode EQU $48 ; text mode [word] txSize EQU $4A ; text size [word] spExtra EQU $4C ; space extra [fixed] fgColor EQU $50 ; foreground color mask [long] bkColor EQU $54 ; background color mask [long] colrBit EQU $58 ; color bit [word] patStretch EQU $5A ; pattern stretch [word] picSave EQU $5C ; picture being saved [handle] rgnSave EQU $60 ; region being saved [handle] polySave EQU $64 ; polygon being saved [handle] grafProcs EQU $68 ; QDProcs array [pointer] portRec EQU $6C ; size of grafport ; QuickDraw Global Variables GrafGlobals EQU 0 ; A5 offset to globptr ; Offsets to globptr for Quickdraw variables. thePort EQU $0 ; [GrafPtr] white EQU $FFFFFFF8 ; [Pattern] black EQU $FFFFFFF0 ; [Pattern] gray EQU $FFFFFFE8 ; [Pattern] ltGray EQU $FFFFFFE0 ; [Pattern] dkGray EQU $FFFFFFD8 ; [Pattern] arrow EQU $FFFFFF94 ; [Cursor] screenBits EQU $FFFFFF86 ; [BitMap] randSeed EQU $FFFFFF82 ; [long] macro QdSaveRegs = movem.l a0-a1/d0-d2,-(sp) | macro QdRestoreRegs = movem.l (sp)+,a0-a1/d0-d2 | ; File QuickTraps.Txt (15 Dec 84) .TRAP _InitCursor $A850 .TRAP _SetCursor $A851 .TRAP _HideCursor $A852 .TRAP _ShowCursor $A853 .TRAP _StuffHex $A866 .TRAP _InitGraf $A86E .TRAP _OpenPort $A86F .TRAP _SetPort $A873 .TRAP _GetPort $A874 .TRAP _SetPBits $A875 .TRAP _ClipRect $A87B .TRAP _GetPen $A89A .TRAP _GetPenState $A898 .TRAP _SetPenState $A899 .TRAP _FramePoly $A8C6 .TRAP _PaintPoly $A8C7 .TRAP _ErasePoly $A8C8 .TRAP _InvertPoly $A8C9 .TRAP _FillPoly $A8CA .TRAP _OpenPoly $A8CB .TRAP _ClosePgon $A8CC .TRAP _KillPoly $A8CD .TRAP _OffSetPoly $A8CE .TRAP _NewRgn $A8D8 .TRAP _CopyBits $A8EC .TRAP _ScrollRect $A8EF .TRAP _OpenPicture $A8F3 .TRAP _ClosePicture $A8F4 .TRAP _KillPicture $A8F5 .TRAP _DrawPicture $A8F6 ; File: ToolTraps.Txt (15 Dec 84) .TRAP _InitFonts $A8FE .TRAP _InitWindows $A912 .TRAP _NewWindow $A913 .TRAP _SelectWindow $A91F .TRAP _SendBehind $A921 .TRAP _BeginUpDate $A922 .TRAP _EndUpDate $A923 .TRAP _FrontWindow $A924 .TRAP _FindWindow $A92C .TRAP _InitMenus $A930 .TRAP _InsertMenu $A935 .TRAP _HiliteMenu $A938 .TRAP _EnableItem $A939 .TRAP _DisableItem $A93A .TRAP _MenuSelect $A93D .TRAP _MenuKey $A93E .TRAP _SetItmMark $A944 .TRAP _GetItem $A946 .TRAP _AddResMenu $A94D .TRAP _HiliteControl $A95D .TRAP _EventAvail $A971 .TRAP _GetMouse $A972 .TRAP _InitDialogs $A97B .TRAP _GetNewDialog $A97C .TRAP _SelIText $A97E .TRAP _CloseDialog $A982 .TRAP _DisposDialog $A983 .TRAP _GetDItem $A98D .TRAP _SetIText $A98F .TRAP _GetIText $A990 .TRAP _ModalDialog $A991 .TRAP _OpenResFile $A997 .TRAP _SystemClick $A9B3 .TRAP _SystemTask $A9B4 .TRAP _OpenDeskAcc $A9B6 .TRAP _GetRMenu $A9BF .TRAP _TEInit $A9CC .TRAP _InitAllPacks $A9E6 .TRAP _Pack2 $A9E9 .TRAP _FP68K $A9EB .TRAP _Elems68K $A9EC .TRAP _ZeroScrap $A9FC .TRAP _PutScrap $A9FE .TRAP _Debugger $A9FF macro InitGraf theQdPtr = pea {theQdPtr} _InitGraf | macro OpenPort thePtr = move.l {thePtr},-(sp) _OpenPort | macro SetPort theport = move.l {theport},-(sp) _SetPort | macro InitCursor = _InitCursor | macro SetPortBits thebmap = pea {thebmap} _SetPBits | macro ClipRect therect = pea {therect} _ClipRect | macro SetCursor curs_ptr = move.l {curs_ptr},-(sp) _SetCursor | macro HideCursor = _HideCursor | macro ShowCursor = _ShowCursor | macro GetPen pt = pea {pt} _GetPen | macro GetPenState penstate = pea {penstate} _GetPenState | macro SetPenState penstate = pea {penstate} _SetPenState | macro PenSize width,height = move.w {width},-(sp) move.w {height},-(sp) dc.w $a89b | macro PenMode themode = move.w {themode},-(sp) dc.w $a89c | macro _PenPat = dc.w $a89d | macro PenPat thepat = pea {thepat} _PenPat | macro _MoveTo = dc.w $a893 | macro MoveTo h,v = move.w {h},-(sp) move.w {v},-(sp) _MoveTo | macro QdMove dh,dv = move.w {dh},-(sp) move.w {dv},-(sp) dc.w $a894 | macro _LineTo = dc.w $a891 | macro LineTo h,v = move.w {h},-(sp) move.w {v},-(sp) _LineTo | macro _Line = dc.w $a892 | macro Line dh,dv = move.w {dh},-(sp) move.w {dv},-(sp) _Line | macro TextFont thefont = move.w {thefont},-(sp) dc.w $a887 | macro TextFace thestyle = move.w {thestyle},-(sp) dc.w $a888 | macro TextMode themode = move.w {themode},-(sp) dc.w $a889 | macro TextSize thesize = move.w {thesize},-(sp) dc.w $a88a | macro _DrawChar = dc.w $a883 | macro DrawChar thechar = move.w {thechar},-(sp) _DrawChar | macro _DrawString = dc.w $a884 | macro DrawString thestring = pea {thestring} _DrawString | macro _CharWidth = dc.w $a88d | macro _StringWidth = dc.w $a88c | macro SetRect rect,l,t,r,b = pea {rect} move {l},-(sp) move {t},-(sp) move {r},-(sp) move {b},-(sp) dc.w $a8a7 | macro _OffsetRect = dc.w $a8a8 | macro OffsetRect therect,dh,dv = pea {therect} move.w {dh},-(sp) move.w {dv},-(sp) _OffsetRect | macro _InsetRect = dc.w $a8a9 | macro InsetRect therect,dh,dv = pea {therect} move.w {dh},-(sp) move.w {dv},-(sp) _InsetRect | macro SectRect srca,srcb,dest = clr.w -(sp) pea {srca} pea {srcb} pea {dest} dc.w $a8aa | macro UnionRect srca,srcb,dest = pea {srca} pea {srcb} pea {dest} dc.w $a8ab | macro PtInRect thepoint,therect = clr.w -(sp) move.l {thepoint},-(sp) pea {therect} dc.w $a8ad | macro FrameRect therect = pea {therect} dc.w $a8a1 | macro PaintRect therect = pea {therect} dc.w $a8a2 | macro EraseRect therect = pea {therect} dc.w $a8a3 | macro InvertRect therect = pea {therect} dc.w $a8a4 | macro FillRect therect,thepat = pea {therect} pea {thepat} dc.w $a8a5 | macro FrameOval theoval = pea {theoval} dc.w $a8b7 | macro PaintOval theoval = pea {theoval} dc.w $a8b8 | macro EraseOval theoval = pea {theoval} dc.w $a8b9 | macro FrameRoundRect therect,ovalwidth,ovalheight = pea {therect} move {ovalwidth},-(sp) move {ovalheight},-(sp) dc.w $a8b0 | macro NewRgn = clr.l -(sp) dc.w $a8d8 | macro DisposeRgn thergn = move.l {thergn},-(sp) dc.w $a8d9 | macro OpenRgn = dc.w $a8da | macro CloseRgn thergn = move.l {thergn},-(sp) dc.w $a8db | macro PtInRgn thept,thergn = clr -(sp) move.l {thept},-(sp) move.l {thergn},-(sp) dc.w $a8e8 | macro CopyBits srcbits,dstbits,srcrect,dstrect,mode,maskrgn = pea {srcbits} pea {dstbits} pea {srcrect} pea {dstrect} move {mode},-(sp) move.l {maskrgn},-(sp) _CopyBits | macro OpenPoly thehdl = clr.l -(sp) _OpenPoly move.l (sp)+,{thehdl} | macro ClosePoly = _ClosePgon | macro KillPoly thehdl = move.l {thehdl},-(sp) _KillPoly | macro OffsetPoly thehdl,dh,dv = move.l {thehdl},-(sp) move {dh},-(sp) move {dv},-(sp) _OffsetPoly | macro PaintPoly thehdl = move.l {thehdl},-(sp) _PaintPoly | macro FillPoly thehdl,thepat = move.l {thehdl},-(sp) pea {thepat} _FillPoly | macro Random = dc.w $a861 | macro StuffHex theptr,thestring = move.l {theptr},-(sp) pea {thestring} _StuffHex | macro ColorBit thebit = move.w {thebit},-(sp) dc.w $a864 | macro _LongMul = dc.w $a867 | macro _GetString = dc.w $a9ba | macro _GetIcon = dc.w $a9bb | macro _PlotIcon = dc.w $a94b | macro _GetCursor = dc.w $a9b9 | macro _GetPicture = dc.w $a9bc | ; Macros for Resource Manager routines. ; macro OpenResFile name = clr -(sp) pea {name} _OpenResFile | ; Macros for Event Manager routines. ; nullEvt equ 0 mouseDown equ 1 mouseUp equ 2 keyDown equ 3 keyUp equ 4 autoKey equ 5 updateEvt equ 6 diskEvt equ 7 activateEvt equ 8 networkEvt equ 10 driverEvt equ 11 mouseDownMask equ $2 mouseUpMask equ $4 keyDownMask equ $8 keyUpMask equ $10 autoKeyMask equ $20 updateMask equ $40 diskMask equ $80 activateMask equ $100 networkMask equ $400 driverMask equ $800 everyEventMask equ $ffff macro _GetNextEvent = dc.w $a970 | macro GetNextEvent the_mask,evt_record = clr.w -(sp) move.w {the_mask},-(sp) pea {evt_record} _GetNextEvent | macro EventAvail the_mask,evt_record = clr.w -(sp) move.w {the_mask},-(sp) pea {evt_record} _EventAvail | macro GetMouse thepoint = pea {thepoint} _GetMouse | macro TickCount = dc.w $a975 | macro Button = dc.w $a974 | macro StillDown = dc.w $a973 | ; Macros for Window Manager routines. ; inDesk equ 0 inMenuBar equ 1 inSysWindow equ 2 inContent equ 3 inDrag equ 4 inGrow equ 5 inGoAway equ 6 macro SelectWindow the_window = move.l {the_window},-(sp) _SelectWindow | macro SendBehind window_1,window_2 = move.l {window_1},-(sp) move.l {window_2},-(sp) _SendBehind | macro FindWindow the_pt,which_window = clr -(sp) move.l {the_pt},-(sp) pea {which_window} _FindWindow | ; Macros for Desk Manager routines. ; macro SystemClick the_event,the_window = pea {the_event} move.l {the_window},-(sp) _SystemClick | macro SystemEdit the_item = clr.w -(sp) move.w {the_item},-(sp) dc.w $a9c2 | macro OpenDeskAcc thename = clr.w -(sp) pea {thename} _OpenDeskAcc | ; Macros for Menu Manager routines. ; macro _GetMenu = dc.w $a9bf | macro GetMenu the_id,my_handle = clr.l -(sp) move {the_id},-(sp) _GetRMenu lea {my_handle},a0 move.l (sp)+,(a0) | macro InsertMenu my_handle,before_id = move.l {my_handle},-(sp) move {before_id},-(sp) _InsertMenu | macro DrawMenuBar = dc.w $a937 | macro HiliteMenu id = move {id},-(sp) _HiliteMenu | macro EnableItem menu_hdl,item_number = move.l {menu_hdl},-(sp) move.w {item_number},-(sp) _EnableItem | macro DisableItem menu_hdl,item_number = move.l {menu_hdl},-(sp) move.w {item_number},-(sp) _DisableItem | macro SetItemMark menu_hdl,item_number,mark = move.l {menu_hdl},-(sp) move.w {item_number},-(sp) move {mark},-(sp) _SetItmMark | macro GetItem menu_hdl,item_number,dst_text = move.l {menu_hdl},-(sp) move.w {item_number},-(sp) pea {dst_text} dc.w $a946 | macro AddResMenu my_handle,res_type = move.l {my_handle},-(sp) move.l {res_type},-(sp) _AddResMenu | ; File: SysTraps.Txt (17 Dec 84) ; Equates for setting trap option bits immed EQU $200 ; execute immediately, bypass I/O queue clear EQU $200 ; async EQU $400 ; asynchronous, don't wait for completion sys EQU $400 ; .TRAP _Read $A000+02 .TRAP _Write $A000+03 .TRAP _Control $A000+04 .TRAP _GetVolInfo $A000+07 .TRAP _UnMountVol $A000+14 .TRAP _Eject $A000+23 .TRAP _SetZone $A000+27 .TRAP _FreeMem $A000+28 .TRAP _NewPtr $A100+30 .TRAP _DisposPtr $A000+31 .TRAP _SetPtrSize $A000+32 .TRAP _NewHandle $A100+34 .TRAP _DisposHandle $A000+35 .TRAP _SetHandleSize $A000+36 .TRAP _GetHandleSize $A000+37 .TRAP _HLock $A000+41 .TRAP _HUnLock $A000+42 .TRAP _SetApplLimit $A000+45 .TRAP _FlushEvents $A000+50 .TRAP _MoreMasters $A000+54 .TRAP _GetTrapAddress $A100+70 ; File: SysEqu.Txt (17 Dec 84) Ticks EQU $16A ; Tick count, time since boot [long] ApplLimit EQU $130 ; application limit [pointer] SysZone EQU $2A6 ; system heap zone [pointer] ApplZone EQU $2AA ; application heap zone [pointer] HeapEnd EQU $114 ; end of heap [pointer] ;+ Drivers dskRfN EQU $FFFB ; 3.5" disk reference number ; I/O record (general fields with trap-specific ones listed below) ioQElSize EQU $32 ; length of I/O parameter block [50 bytes] ioLink EQU $0 ; queue link in header [pointer] ioType EQU $4 ; type for safety check [byte] ioTrap EQU $6 ; the trap [word] ioCmdAddr EQU $8 ; address to dispatch to [pointer] ioCompletion EQU $C ; completion routine [pointer] ioResult EQU $10 ; I/O result code [word] ioFileName EQU $12 ; file name pointer [pointer] ioNamePtr EQU $12 ioVRefNum EQU $16 ; volume refnum [word] ioDrvNum EQU $16 ; drive number [word] ioRefNum EQU $18 ; file reference number [word] ioFileType EQU $1A ; specified along with FileName [byte] ; specific fields for _Read, _Write ioBuffer EQU $20 ; data buffer [pointer] ioByteCount EQU $24 ; requested byte count [long] ioNumDone EQU $28 ; actual byte count completed [long] ioPosMode EQU $2C ; initial file positioning mode/eol char [word] ioPosOffset EQU $2E ; file position offset [long] ; Specific fields for _Control, _Status csCode EQU $1A ; control/status code [word] csParam EQU $1C ; operation-defined parameters [20 bytes] ; Specific fields for _GetVolInfo, _GetVolume, _SetVolume, _MountVol, ; _UnmountVol, _Eject. Note that these traps have a bigger record size. ioVQElSize EQU $40 ; Volume command parameter length [64 bytes] ioVDrvNum EQU $16 ; drive or volume number [word] ioVNPtr EQU $12 ; name buffer (or zero) [pointer] ioVolIndex EQU $1C ; volume index number [word] ioVCrDate EQU $1E ; creation date & time [long] ioVLsBkUp EQU $22 ; last backup date & time [long] ioVAtrb EQU $26 ; Volume attributes [word] ioVNmFls EQU $28 ; # files in directory [word] ioVDirSt EQU $2A ; start block of file dir [word] ioVBlLn EQU $2C ; length of dir in blocks [word] ioVNmAlBlks EQU $2E ; num blks (of alloc size) this dev [word] ioVAlBlkSiz EQU $30 ; alloc blk byte size [long] ioVClpSiz EQU $34 ; bytes to try to allocate at a time [long] ioAlBlSt EQU $38 ; starting block in block map [word] ioVNxtFNum EQU $3A ; next free file number [long] ioVFrBlk EQU $3E ; # free alloc blks for this vol [word] ; File: PackMacs.Txt (15 Dec 84) dskInit EQU 2 ; Disk Initialization ; Equates for DISK INITIALIZATION PACKAGE ; Routine selectors diLoad_ EQU 2 diUnload_ EQU 4 diBadMount_ EQU 0 diFormat_ EQU 6 diVerify_ EQU 8 diZero_ EQU 10 sfPutFile_ EQU 1 sfGetFile_ EQU 2 ; PackMacs QQ macros for the packages ; ; Macro for package invocation ; First arg is routine selector, second is the trap .MACRO _PackCall MOVE.W %1_,-(SP) %2 .ENDM ; Disk Initialization macros .MACRO _DILoad _PackCall #DILoad,_Pack2 .ENDM .MACRO _DIUnLoad _PackCall #DIUnLoad,_Pack2 .ENDM .MACRO _DIBadMount _PackCall #DIBadMount,_Pack2 .ENDM .MACRO _DIFormat _PackCall #DIFormat,_Pack2 .ENDM .MACRO _DIVerify _PackCall #DIVerify,_Pack2 .ENDM .MACRO _DIZero _PackCall #DIZero,_Pack2 .ENDM ; Standard file macros .MACRO _SFPutFile _PackCall #SFPutFile,_Pack3 .ENDM macro SFPutFile where,prompt,origname,dlghook,reply = move.l {where},-(sp) pea {prompt} pea {origname} move.l {dlghook},-(sp) pea {reply} _SFPutFile | .MACRO _SFGetFile _PackCall #SFGetFile,_Pack3 .ENDM macro SFGetFile where,prompt,filefilter,numtypes,typelist,dlghook,reply = move.l {where},-(sp) pea {prompt} move.l {filefilter},-(sp) move {numtypes},-(sp) pea {typelist} move.l {dlghook},-(sp) pea {reply} _SFGetFile | ; File: SANEMacs.Txt (18 Dec 84) ; Macro to declare a variable of type Extended. macro float = dc.w 0,0,0,0,0 | ;----------------------------------------------------------- ; Operation code masks. ;----------------------------------------------------------- FOADD EQU $0000 ; add FOSUB EQU $0002 ; subtract FOMUL EQU $0004 ; multiply FODIV EQU $0006 ; divide FOZ2X EQU $000E ; convert to extended FOX2Z EQU $0010 ; convert from extended FOSQRT EQU $0012 ; square root ;----------------------------------------------------------- ; Operand format masks. ;----------------------------------------------------------- FFEXT EQU $0000 ; extended -- 80-bit float FFDBL EQU $0800 ; double -- 64-bit float FFSGL EQU $1000 ; single -- 32-bit float FFINT EQU $2000 ; integer -- 16-bit integer FFLNG EQU $2800 ; long int -- 32-bit integer FFCOMP EQU $3000 ; comp -- 64-bit integer ;----------------------------------------------------------- ; Operation macros: operand addresses should already be on ; the stack, with the destination address on top. The ; suffix X, D, S, C, I, or L determines the format of the ; source operand -- extended, double, single, comp, ; integer, or long integer, respectively; the destination ; operand is always extended. ;----------------------------------------------------------- macro sane_addx src,dst = ; Add src:Extended to dst:Extended pea {src} pea {dst} move #FFEXT+FOADD,-(sp) _fp68k | macro sane_subx src,dst = ; Subtract src:Extended from dst:Extended pea {src} pea {dst} move #FFEXT+FOSUB,-(sp) _fp68k | macro sane_mulx src,dst = ; Multiply dst:Extended by src:Extended pea {src} pea {dst} move #FFEXT+FOMUL,-(sp) _fp68k | macro sane_divx src,dst = ; Divide dst:Extended by src:Extended pea {src} pea {dst} move #FFEXT+FODIV,-(sp) _fp68k | macro sane_i2x src,dst = ; Set dst:Extended equal to src:INTEGER pea {src} pea {dst} move #FFINT+FOZ2X,-(sp) _fp68k | macro sane_l2x src,dst = ; Set dst:Extended equal to src:LONGINT pea {src} pea {dst} move #FFLNG+FOZ2X,-(sp) _fp68k | macro sane_x2i src,dst = ; Set dst:INTEGER equal to src:Extended pea {src} pea {dst} move #FFINT+FOX2Z,-(sp) _fp68k | macro sane_x2l src,dst = ; Set dst:LONGINT equal to src:Extended pea {src} pea {dst} move #FFLNG+FOX2Z,-(sp) _fp68k | macro sane_x2x src,dst = ; Set dst:Extended equal to src:Extended pea {src} pea {dst} move #FFEXT+FOZ2X,-(sp) _fp68k | macro sane_sqrtx dst = ; Set dst:Extended to square root of its old value. pea {dst} move #FOSQRT,-(sp) _fp68k |