mirror of
https://github.com/marketideas/qasm.git
synced 2026-10-24 22:02:28 +00:00
Move the assembler to src/qasm. qlink links OMF 1.0 and 2.0 from a script. makeBin flattens a load file, qomf dumps OMF, and qpro builds ProDOS volumes. APW and MPW assemble through the ORCA front end. Relocatable modules emit OMF objects. Listings stay off unless -l is set. make boot assembles the GS/OS 6.0.1 ProDOS 8 kernel and BASIC.SYSTEM into an 800K volume. BASIC.SYSTEM accepts ls and pfx, and its splash reports PRODOS BASIC 2.0, copyright 1983-2026. IIGS.601.SRC is the source and the BASIC.SYSTEM oracle that image is built from.
1 line
13 KiB
NASM
1 line
13 KiB
NASM
**************************************************************
|
|
***
|
|
*** Copyright Apple Computer Inc 198?-1991
|
|
*** All Rights Reserved
|
|
***
|
|
**************************************************************
|
|
***
|
|
*** 19-Sep-90 DAL
|
|
*** Added G_INITCURSOR bit for MenuGlobal.
|
|
*** 7-Jan-91 DAL
|
|
*** Added MinMenuBlinkTime.
|
|
*** 15-May-91 DAL
|
|
*** Added new error dupMenuID, $0F04.
|
|
***
|
|
**************************************************************
|
|
|
|
MinMenuBlinkTime equ $0030 ;2 ticks between inverts
|
|
;
|
|
; --- Stack offsets after startup called --------------------------
|
|
;
|
|
saveDbank equ 1
|
|
saveDpage equ saveDbank+1
|
|
returnAddr equ saveDpage+2
|
|
input equ returnAddr+6
|
|
|
|
;
|
|
; --- Direct Page offsets --------------------------------------------------
|
|
;
|
|
data equ 0 0 Pointer to RAM data area.
|
|
globalFlag equ data+4 4 Global Menu Manager flag.
|
|
MyID equ globalFlag+2 6 Memory ID to use when allocating.
|
|
sysmenu equ MyID+2 8 Pointer to system menu bar.
|
|
rect equ sysmenu+4 12 General RECT.
|
|
barptr equ rect+8 20 Pointer to current menu bar.
|
|
barhand equ barptr+4 24 Handle of menu bar.
|
|
menuptr equ barhand+4 28 Pointer to current menu.
|
|
menuhand equ menuptr+4 32 Handle of menu.
|
|
itemptr equ menuhand+4 36 Pointer to current item.
|
|
temptr equ itemptr+4 40 Work pointer.
|
|
temptr2 equ temptr+4 44 Work pointer.
|
|
norcolor equ temptr2+4 48 Normal text and background color.
|
|
hiliteclr equ norcolor+2 50 Selected text and background color.
|
|
outlineclr equ hiliteclr+2 52 Color of outline.
|
|
menu_cnt equ outlineclr+2 54 Menu counter for 'next_menu'.
|
|
blink equ menu_cnt+2 56 Blink rate when items are selected.
|
|
yrat equ blink+2 58 Cursor y position.
|
|
xrat equ yrat+2 60 Cursor x position.
|
|
creamed equ xrat+2 62 Address of routine to redraw under menu.
|
|
sav_buff equ creamed+4 66 Handle of buffer to save under a menu.
|
|
screenmode equ sav_buff+4 70 Current screen mode, 0=320, 1=640.
|
|
menurect equ screenmode+2 72 Current menu's RECT.
|
|
count equ menurect+8 80
|
|
titlenum equ count+2 82 ID number of currently selected menu.
|
|
curselect equ titlenum+2 84 Index of currently selected item.
|
|
param equ curselect+2 86 Parameter pass to menu defProc.
|
|
temp equ param+2 88
|
|
vert_pen equ temp+2 90 Width of vertical lines.
|
|
Titlex1 equ vert_pen+2 92 Left side of selected menu title.
|
|
Titlex2 equ Titlex1+2 94 Right side of selected menu title.
|
|
startbutt equ Titlex2+2 96 0 = button down, 2 = button up.
|
|
text_width equ startbutt+2 98 text_width, width of widest char.
|
|
strg_ptr equ text_width+2 100 String pointer.
|
|
old_port equ strg_ptr+4 104 Save caller's port when I draw.
|
|
port_nest equ old_port+4 108 Nest counter.
|
|
inactItem equ port_nest+2 110 Inactive item ID that was selected.
|
|
tomemory equ inactItem+2 112 Paint pixels parameter block.
|
|
toscreen equ tomemory+22 134 Paint pixels parameter block.
|
|
scInfo1 equ toscreen+22 156 Place to save a return address.
|
|
event equ scInfo1+16 172 Event record.
|
|
des_y equ event+16 188
|
|
des_0 equ des_y+4 192
|
|
scrnRect equ des_0+4 196
|
|
lineTable equ scrnRect+8 204
|
|
firstVisItem equ lineTable+4 208 Item number of first visible item in a menu
|
|
lastVisItem equ firstVisItem+2 210 Item number of last visible item in a menu
|
|
currentSel equ lastVisItem+2 212
|
|
uparrow equ currentSel+2 214 Flag that tells me if there is an up arrow in menu
|
|
dwnarrow equ uparrow+2 216 Flag that tells me if there is a down arrow in menu
|
|
inUpArrow equ dwnarrow+2 218 Flag that tells me if mouse is in up arrow
|
|
inDwnArrow equ inUpArrow+2 220 Flag that tells me if mouse is in down arrow
|
|
specialFlag equ inDwnArrow+2 222 my all purpose flag
|
|
scrollCount equ specialFlag+2 224 keeps track of when to scroll next item
|
|
saveY1 equ scrollCount+2 226
|
|
saveY2 equ saveY1+2 228
|
|
;
|
|
;(((((((((((((((((((Keep these together
|
|
;
|
|
font_h equ saveY2+2 230 System font height plus leading.
|
|
descent equ font_h+2 232 System font descent plus bottom leading.
|
|
work equ descent+2 234 Work must be at least 20 bytes.
|
|
DIRECTSIZE equ work+22 256
|
|
; )))))))))))))))))))))))))))))))))))))))
|
|
|
|
;
|
|
; --- QuickDraw equates ----------------------------------------
|
|
;
|
|
PortRect equ work+4 228
|
|
|
|
PortSCB equ 0 0
|
|
PixelImage equ PortSCB+2 2
|
|
Width equ PixelImage+4 6
|
|
BoundsRect equ Width+2 8
|
|
LOCINFO equ BoundsRect+8 16
|
|
;
|
|
BOLDTEXT equ $0001
|
|
ULINETEXT equ $0002
|
|
;
|
|
BLACK equ $0000
|
|
RED equ $1111
|
|
GREEN equ $2222
|
|
WHITE equ $ffff
|
|
;
|
|
P_SOLID equ $0000
|
|
P_DITHER equ $0100
|
|
P_DOTTED equ $0200
|
|
P_LINED equ $0300
|
|
|
|
;
|
|
; --- RECT offsets ----------------------------------------------------------
|
|
;
|
|
y1 equ 0
|
|
x1 equ y1+2
|
|
y2 equ x1+2
|
|
x2 equ y2+2
|
|
|
|
;
|
|
; --- Event Record Offsets -------------------------------------------------
|
|
;
|
|
what equ 0
|
|
message equ what+2
|
|
when equ message+4
|
|
where equ when+4
|
|
modif equ where+4
|
|
TaskData equ modif+2
|
|
;
|
|
MOUSEDOWN equ 1 Event codes.
|
|
MOUSEUP equ 2
|
|
|
|
|
|
;
|
|
; --- Menu Res Flag -----------------------------------------------------------
|
|
;
|
|
M_RESOURCEID equ $8000 first two bits of menures now being used to determine if
|
|
M_HANDLE equ $4000 the menu title is a ptr, handle or resource ID
|
|
|
|
ALWAYSCALLMCHOOSE equ $0100 for custom menus that always wants their mChoose routine
|
|
; to be called regardless of whether mouse is in menurect
|
|
; or not, (for Andy Stadler's custom tear off menus)
|
|
; if first two bits are zero then its a ptr to the string
|
|
CLEAR_TWO_BITS equ $3FFF
|
|
|
|
;
|
|
; --- Menu Flags -----------------------------------------------------------
|
|
;
|
|
M_ENABLED equ $0080 0 = menu enabled, 1 = menu disabled.
|
|
M_NO_XOR equ $0020 0 = don't XOR to highlight title, 1 = do.
|
|
M_STANDARD equ $0010 0 = standard menu, 1 = custom menu.
|
|
M_CACHE equ $0008 0 = no cache buffer, 1 = cache buffer.
|
|
M_INVIS equ $0004 0 = visible, 1 = invisible.
|
|
M_SCROLL equ $0002 0 = not scrollable, 1 = scrollable
|
|
M_POPUP equ $0001 0 = regular menu, 1 = pop-up menu
|
|
|
|
_M_CACHE equ $FFF7
|
|
_M_SCROLL equ $FFFD
|
|
_M_POPUP equ $FFFE
|
|
;
|
|
; --- Menu item flags -----------------------------------------------------
|
|
;
|
|
;
|
|
I_RESOURCEID equ $8000 first two bits of item flag now used to determine if
|
|
I_HANDLE equ $4000 item name is ptr, handle or resource ID
|
|
; if first two bits are zero then its just a ptr to the string
|
|
I_NOSHADOW equ $1000 0 = don't shadow text, 1 = do.
|
|
I_NOOUTLINE equ $0800 0 = don't outline text, 1 = do.
|
|
I_NEWSTRUCTURE equ $0400 0 = no addit'l structure, 1 = itemname pts to this struct.
|
|
I_STRUCTisRESOURCE equ $0200 bits 8 and 9 determine how the structure will be referenced
|
|
I_STRUCTisHANDLE equ $0100
|
|
I_ENABLED equ $0080 0 = item enabled, 1 = item disabled.
|
|
I_NOUNDER equ $0040 0 = no underline, 1 = underline.
|
|
I_NO_XOR equ $0020 0 = don't XOR to highlight item, 1 = do.
|
|
I_RESERVED equ $0010 Reserved.
|
|
I_INVIS equ $0008 0 = visible, 1 = invisible.
|
|
I_NOSCORE equ $0004 0 = don't underline text, 1 = do.
|
|
I_NOITALIC equ $0002 0 = don't italize text, 1 = do.
|
|
I_NOBOLD equ $0001 0 = don't bold text, 1 = do.
|
|
|
|
FIRST_TWO_BITS equ $C000 mask off last 14 bits
|
|
RESOURCE_REF equ $8000
|
|
HANDLE_REF equ $4000
|
|
|
|
iRESOURCE_REF equ $2000 only used in menu flag of resource menu record
|
|
iHANDLE_REF equ $1000
|
|
|
|
T_LEADING equ 2 Top leading.
|
|
B_LEADING equ 2 Bottom leading.
|
|
|
|
;
|
|
; ------ MENUBAR record --------------------------------------------
|
|
;
|
|
CtlNext equ 0
|
|
CtlOwner equ CtlNext+4
|
|
CtlRect equ CtlOwner+4
|
|
CtlFlag equ CtlRect+8
|
|
CtlHilite equ CtlFlag+1
|
|
CtlValue equ CtlHilite+1
|
|
CtlProc equ CtlValue+2
|
|
CtlData equ CtlProc+4
|
|
CtlAction equ CtlData+4
|
|
CtlrefCon equ CtlAction+4
|
|
CtlColor equ CtlrefCon+4
|
|
MenuList equ CtlColor+4 Array of menu handle, zero = last.
|
|
BARSIZE equ MenuList
|
|
|
|
;
|
|
; ------ MENU record -----------------------------------------
|
|
;
|
|
MenuID equ 0 Menu's ID number.
|
|
MenuWidth equ MenuID+2 Width of menu.
|
|
MenuHeight equ MenuWidth+2 Height of menu.
|
|
MenuProc equ MenuHeight+2 Menu's definition procedure.
|
|
MenuFlag equ MenuProc+4 Bit flags.
|
|
MenuRes equ MenuFlag+1 Future expansion (makes record even).
|
|
NumOfItems equ MenuRes+1 Number of items in the menu
|
|
TitleWidth equ NumOfItems+2 Width of menu's title.
|
|
TitleName equ TitleWidth+2 Pointer to menu's title text.
|
|
|
|
MenuCache equ TitleName+4 Handle of menu's cache.
|
|
ItemList equ MenuCache+4 Array of items in menu.
|
|
MENUSIZE equ ItemList Size of menu record with no items.
|
|
|
|
;
|
|
; ------ ITEM record -----------------------------------------
|
|
;
|
|
ItemID equ 0 Item's ID number, zero = last item.
|
|
ItemChar equ ItemID+2 Keyboard equvalent, display in item.
|
|
ItemAltChar equ ItemChar+1 Alternate keyboard equvalent, not shown.
|
|
ItemCheck equ ItemAltChar+1 Item's mark.
|
|
ItemFlag equ ItemCheck+2 Bit flags.
|
|
ItemName equ ItemFlag+2 Pointer to item's text.
|
|
ITEMSIZE equ ItemName+4 Size of ITEM record.
|
|
|
|
;
|
|
; ------ ITEM record2 ----------------------------------------
|
|
;
|
|
ItemFlag2 equ 0 Bit flags that determine how big structure is.
|
|
ItemName2 equ ItemFlag2+2 Reference to name of item.
|
|
ItemIcon equ ItemName2+4 Reference to item's icon.
|
|
ITEMSIZE2 equ ItemIcon+4
|
|
|
|
;
|
|
; ------ Menu Item2 flags -----------------------------------
|
|
;
|
|
I_NOICON equ $8000 0 = no icon, 1 = there is an icon associated with item
|
|
I_ICONisRESOURCE equ $0002 1 = reference to icon is a resource ID
|
|
I_ICONisHANDLE equ $0001 1 = reference to icon is a handle
|
|
|
|
;
|
|
; ------ Menu defProc messages ---------------------------------
|
|
;
|
|
mDrawMenu equ 0
|
|
mChoose equ 1
|
|
mSize equ 2
|
|
mDrawTitle equ 3
|
|
mDrawItem equ 4
|
|
mGetItemID equ 5
|
|
|
|
;
|
|
; ------ Menu Manager error codes -------------------------------
|
|
;
|
|
MENU_STARTED equ $0F01 Menu Manager already started.
|
|
ITEM_NOT_FOUND equ $0F02 Item not found for item ID passed
|
|
NoStruct equ $0F03 Invalid access to new item structure
|
|
dupMenuID equ $0F04 ;duplicate menu id (added 15-May-91 DAL)
|
|
;
|
|
; ------ Global menu flags --------------------------------------
|
|
;
|
|
G_HELP equ $0001 Set for selecting inactive menu items.
|
|
G_INITCURSOR equ $0002 Forces MenuSelect to call InitCursor
|
|
;
|
|
; ------ Miscellaneous menu equates ------------------------------
|
|
;
|
|
AppleLogo equ $FF
|
|
MenuToolNum equ 15
|
|
ScreenWidth equ 200 Width of screen in pixels
|
|
|
|
;
|
|
; ------ Cache equates -------------------------------------------
|
|
;
|
|
cacheFlag equ 0 WORD TRUE if menu image is OK, FALSE if BAD.
|
|
cachey1x1 equ 2 WORD Address of first word in upper left corner of menu.
|
|
cacheWidth equ 4 WORD Number of words per line where 0 = one word.
|
|
cacheHeight equ 6 WORD Number of lines in menu where 1 = one line.
|
|
cacheCache equ 8 CACHE First line, stored from screen right to left.
|
|
|
|
; masks for control flag
|
|
;
|
|
FType2PopUp equ $0040 ; 0 = normal popup, 1 = popup w/white space
|
|
FDontHiliteTitle equ $0020 ; 0 = hilite title, 1 = don't hilite title
|
|
FDontDrawTitle equ $0010 ; 0 = draw title, 1 = don't draw title
|
|
FDontDrawResult equ $0008 ; 0 = selection in pop-up rect, 1 = no selection drawn
|
|
FInWindowOnly equ $0004 ; 0 = use menumgr port, 1 = use current port
|
|
FRightJustifyTitle equ $0002 ; 0 = left justify title, 1 = right justify title
|
|
FRightJustifyResult equ $0001 ; 0 = left justify result, 1 = right justify result
|
|
|
|
;
|
|
; ------ Menu resource definitions ------------------------------
|
|
;
|
|
;==================================================
|
|
;
|
|
; Format of a menu bar (rMenuBar) resource
|
|
;
|
|
DSect 0
|
|
resMenuBarVersion word ; for future use
|
|
resMenuBarFlag word ; currently only first two bits defined
|
|
MenuRef1 long ; first menu in the menu bar
|
|
; last menu is terminated by a 0
|
|
|
|
;==================================================
|
|
;
|
|
; Format for a menu (rMenu) resource
|
|
;
|
|
DSect 0
|
|
resMenuVersion word ; for future use
|
|
resMenuID word
|
|
resMenuFlag word ; menures determines if name is: ptr, handle, res ID
|
|
resTitleName long ; string resource ID for menu title
|
|
itemResourceID long ; this is the ID for the first item resource in the menu
|
|
; last item terminated by an ID of 0
|
|
|
|
;==================================================
|
|
;
|
|
; Format of a menu item (rMenuItem) resource
|
|
;
|
|
DSect 0
|
|
resItemVersion word ; for future use
|
|
resItemID word
|
|
resItemChar byte
|
|
resItemAltChar byte
|
|
resItemCheck word
|
|
resItemFlag word ; item flag determines if name is: ptr, handle, res ID
|
|
resItemName long ; this is the ID for a string resource
|
|
|
|
ItemRecSize equ resItemName+4
|
|
|
|
;==================================================
|
|
;
|
|
; menu descriptors (verbs)
|
|
|
|
RefIsPointer equ $0000
|
|
RefIsHandle equ $0001
|
|
RefIsResource equ $0002
|
|
|
|
;=======================================================================
|
|
;
|
|
; This is the control record for a popup control
|
|
;
|
|
|
|
PopUpCtlRecord RECORD 0
|
|
|
|
ctlNext DS.L 1
|
|
ctlOwner DS.L 1 ; port containing the pop-up control
|
|
ctlRect DS.W 4 ; total rectangle, title + pop-up box
|
|
ctlFlag DS.B 1
|
|
ctlHilite DS.B 1
|
|
ctlValue DS.W 1 ; current selection for pop-up
|
|
ctlProc DS.L 1 ; control type
|
|
ctlAction DS.L 1
|
|
ctlData DS.L 1
|
|
ctlRefCon DS.L 1
|
|
ctlColor DS.L 1 ; ptr to color table
|
|
MenuRef DS.L 1 ; make this record look like a menu record
|
|
MenuEnd DS.L 1 ; signifies end of menu list, must be zero
|
|
PopUpRect DS.W 4 ; "hot spot" for popping up pop-up
|
|
ctlID DS.L 1
|
|
ctlMoreFlags DS.W 1
|
|
ctlVersion DS.W 1
|
|
TitleWidth DS.W 1 ; width of title
|
|
|
|
Size DS.B 1
|
|
|
|
ENDR
|
|
|
|
;
|
|
;-------------------------------------------------
|
|
; Offsets into RAM data area.
|
|
;-------------------------------------------------
|
|
;
|
|
; --- RAM that must be initialized ----------------
|
|
;
|
|
mark equ 0 3
|
|
com_key equ mark+3 4
|
|
scrnInfo equ com_key+4 16
|
|
memInfo equ scrnInfo+16 16
|
|
des_y1 equ memInfo+16 2
|
|
des_x1 equ des_y1+2 2
|
|
clip100 equ des_x1+2 8 Size of destination.
|
|
imageInfo equ clip100+8 16
|
|
defmenu equ imageInfo+16 44 Menu bar record template.
|
|
menuColor equ defMenu+44 6 Default menu color table.
|
|
|
|
;
|
|
; --- RAM that starts as zero ----------------------
|
|
;
|
|
port equ menuColor+6 262 Menu Manager's port.
|
|
ColorTable equ port+262 32
|
|
image equ ColorTable+32 64
|
|
|
|
RAMSIZE equ image+64 Size of RAM data area.
|
|
|
|
;
|
|
; --- Operating system equates ---------------------
|
|
;
|
|
IncBusyFlg equ $E10064
|
|
DecBusyFlg equ $E10068
|
|
|
|
|
|
;
|
|
; --- Icon structure equates -----------------------
|
|
;
|
|
IconType equ 0
|
|
IconImage equ IconType+2
|
|
IconWidth equ IconImage+4
|
|
IconRect equ IconWidth+2
|
|
|
|
rMyItemStruct equ $8028 |