Files
Shawn Quick dfcaae62dd Add qlink, the disk tools, and a bootable ProDOS 8 image.
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.
2026-10-16 14:41:55 -07:00

1 line
138 KiB
NASM

title 'Control Manager Version 3.2'
**********************************************************************
*
* Control Manager version 3.2
*
* Copyright Apple Computer, Inc. 1986-90
* All rights reserved
* Written by Dan Oliver
*
* 08/27/87 Dan - start ROMing.
*
*
* Change History:
*
* 22 June 88 Harry Yee
*
* The following APW files were combined into this one file.
*
* CMAIN.ASM
* CTRACK.ASM
* CDEFPROC.ASM
* CSCROLL.ASM
* CUTIL.ASM
* CSTATIC.ASM
* CDATA.ASM
*
* Converted over to MAX development system.
* (Version 2.5 of control mgr (System Disk 3.2))
*
* 29 June 88 Steven Glass
*
* Changed call table so that DragRect call would link to the window manager
* when in ROM and link to a dummy file when in RAM. Changed version
* number from 0205 to 8206.
*
* 24 Jul 88 Steven Glass
*
* Changes made to the scroll bar def proc so that the control value
* is validated before it is used. We could make this an application
* problem (as it was in the past) or fix it once and for all here.
*
* I want to fix it once and for all. Changes were made to scroll_init
* newview and move_thumb. In each case the control value is validated
* against the values for maxsize and viewsize. In scroll_init and move_thumb,
* the value was considered correct and the MaxSize adjusted if necessary.
* In newview, we assume the view and maxsize are correct and adjust the
* value.
*
* If the scrollvalue is greater than MaxSize-ViewSize something is wrong.
* When we assume that the Value is correct, we reset MaxSize to be
* ScrollValue+ViewSize. When we assume the view and make an adjustment,
* we set the value to MaxSize-ViewSize or 0, whichever is greater.
*
* 16 Aug 88 Steven Glass
*
* The routine that installs the icon font, does not save, clear and
* restore the text face. This allowed an application to have itallic
* bold, outlined and shadowed scroll bars.
*
* 14 Sep 88 Steven Glass
*
* Started changes for Super Controls...
*
* 28 Sep 88 Steven Glass
*
* Change in the way that the recsize routines can use the param
* field. If the routines are called by NewControl, param is zero.
* If the routines are called by NewControl2, param is pointer to
* template.
*
* Added in utilities section:
*
* PushStringPtr
* ReadMoreFlags
* GetColorTableRefFromTemplate
* CalcColorTableRefForCtl
*
*
* 02 Oct 88 Steven Glass
*
* Changed a bunch of names to avoid conflicts with the window and menu
* managers. This was necessary because in the past nothing was exported
* Now that the CtlMgr is in several files a number of routine names are
* public.
*
* The names that changed are
*
* Startup --> CMStartup
* popXbytes --> CMpopXbytes
* allocate2 --> CMallocate2
* allocate3 --> CMallocate3
* setrect --> CMsetrect
* setrect2 --> CMsetrect2
*
* 02 Oct 88 Steven Glass
*
* Changed kill controls to see if the control manager is active before
* calling startup. This way applications that used the
* window mangager without the control manager will still work.
*
* The problem occured when the window manager closes a window, it calls
* KillControls. When running from a system disk, this was not a problem
* The control manager was not loaded if the app did not want to use it.
* So a dispatch error occured and the window manager knows how to recover
* from this.
*
* KillControls now mimicks the dispatcher error.
*
* 05 Oct 88 Steven Glass
*
* Major changes to the dispatcher code to handle defProcs in resources
* as well as new control 2.
*
*
* 06 Oct 88 Steven Glass
*
* The active flag used by built in defProcs is in the global data
* area rather passed to the defproc. This made it hard for
* custom defProcs to do the right thing when they draw. So we also put
* the flag in the hi-word of the param sent with the draw message.
* This is done in Set2DrawCtl
*
* 07 Oct 88 Steven Glass
*
* ReleaseResource grew another paramter.
*
* 12 Oct 88 Steven Glass
*
* Add support for the list manager to the dispatch routine.
*
* 23 Oct 88 Steven Glass
*
* Zeroed ParamPtr in startup.
*
* 24 Oct 88 Steven Glass
*
* Modified some of the dispatcher code. Added calls to TextEdit and
* MenuMgr to find addr of defPRocs. Simplified and shortened other
* dispatching code.
*
* 09 Nov 88 Steven Glass
*
* Added a converter routine for code resources. This routine is
* installed at control startup time for rCtlDefProc types. The
* routine can also be used by other code to convert code resources.
* A new control manager call GetCodeResConverter returns the
* address of this routine.
*
* Removed all references ReleaseCodeResource in the code. Code
* resources are just regular resources.
*
* Changed LoadCodeResource to call LoadResource and deref the
* resulting handle.
*
* 21 Nov 88 Steven Glass
*
* Change to TrackControl. The ctlDrag message is different when control has
* part code > $80. If the control is a super control, the high
* word of the result from defProc call is the part code to return
* to caller. This allows us to return no part code if the
* user pulls his mouse out of the control before releasing
* the button.
*
* 01 Dec 88 Steven Glass
*
* Added call to InvalCtls.
*
* 10 Feb 89 Steven Glass
*
* Minor change to routines that dispatch to defProcs in resources.
* These resources now need not have the high bit of their ID's set
* (invalid for current resource manager).
*
* 10 Feb 89 Harry Yee
*
* New control message ctlHideCntl, message #18. HideControl now checks if the
* control being hidden is a supercontrol, if it is then we check to see
* if the FctlIsMultiPart bit is set in the moreflags field. If it is we let the
* control's ctlHideCntl defproc take care of hiding the control. This is necesary
* for controls that have more than one control associated with them (i.e. List Controls)
*
* 13 Feb 89 Steven Glass
*
* Preserved the y-reg in the new code written on 10 Feb to send
* hide/erase message to multipart controls.
*
*
* 28 Mar 89 Dave Good
*
* made the ctlHideCntl into a generic message: ctlNotifyMultiPart. Now the defproc
* gets passed this message by HideControl, EraseControl, ShowControl, and DrawOneCtl
* the low word of the parameter indicates which call sent the message
*
* 28 Mar 89 Steven Glass
*
* Added FutzCtls call. It uses the new ctlWinStateChange message
* which is now supported by all the built in defProcs.
*
* 09 Apr 89 Steven Glass
*
* Changed CkButton2 (used by TrackControl) so that it does not leave
* mouse up events in the queue. This could happen when button
* was up before trackControl was called or if button came up after
* get next event and before call to button. Now we look at the mod
* word in event instead of calling button.
*
* 20-Nov-90 Dave Lyons
*
* Experimenting with making the background pattern for Scroll Bar
* controls a solid gray, at least in 640 mode.
* Version changed to $8303.
* Fixed off-by-one bug in CMDieHorribly. Wouldn't get the "="
* character in "Error=xxxx". Won't bother fixing for ROM 3.
*
* 20-Nov-90 (pm) Dave Lyons
*
* Fixed the scroll bar color stuff (was failing to set B in one path).
*
* 9-Jan-91 Dave Lyons
*
* Changed HiliteControl(0,prevCtl) to use WaitUntil to wait 4 ticks
* before unhiliting the control.
*
* 19-Jan-91 Dave Lyons
*
* Added 3 new calls: FindRadioButton (returns info about which radio
* button in a given family is selected); SetLETextByID and GetLETextByID,
* setting and getting text in extended Edit Line controls (parameters
* are window pointer, control ID and pString pointer).
*
* 22-Mar-91 Dave Lyons
*
* Added Compute320ScrollColor to search for a good Gray color to use
* (called from NewResGuts).
*
* 8-Aug-91 Dave Lyons
*
* Get/SetLETextByID and FindRadioButton now accept window=NIL, to use
* the front window.
*
* 15-Sep-91 Dave Lyons
*
* Changed CMLoadResource to force SysPrefs to always prompt for a
* disk and never use a cancel button (because if we can't find
* the resource, we're going to do a system death!).
*
* 4-Dec-91 Dave Lyons
*
* CMLoadResource now clears the supress-one-button-dialogs SysPrefs
* bit, so the OS doesn't infinite-loop looking for the disk.
*
* 8-Dec-91 Dave Lyons
*
* Scroll bar--Compute320ScrollColor uses GetSCB instead of peeking
* at SCB #100 directly.
*
* Split some large segments into some smaller PROCs for linking into
* TS3.
*
* Changed LoadCodeResource to force OS preferences to prompt for a
* disk, with no Cancel button.
*
* 9-Dec-91 Dave Lyons
*
* Changed Compute320ScrollColor to just ComputeScrollColor (it now
* checks the MasterSCB itself). CtlNewRes calls ComputeScrollColor.
*
* 15-Jan-92 Dave Lyons
*
* Having CtlNewRes call RefreshDesktop was a truly boneheaded move,
* because really strange and not-goot reentrant things happen.
* Instead when ComputeScrollColor changes the scroll-bar page-area
* pattern/color, it uses AddToRunQ to add refreshDeskTask, which
* calls RefreshDesktop(0) and removes itself from the queue.
* This way we refresh the desktop on the next SystemTask call.
*
* 15-Jan-92pm Dave Lyons
*
* Made CtlShutDown remove the Run Queue task, in case it got left
* hanging.
*
* 5-Feb-92 Dave Lyons
*
* Changed version to $0303 for 6.0.
*
**********************************************************************
*
* 3-Jun-92 Dave Lyons
*
* Changed version to $8304 for 6.0.1d5.
*
* Made CtlStartUp remove the RefreshDesktop run queue routine, to
* avoid redrawing everything once when starting an application in
* a different resolution.
*
* 15-Jul-92 Dave Lyons (6.0.1d7)
*
* Added new calls:
* $3C10 SetCtlValueByID(Value,@Wind,CtlID/4)
* $3D10 GetCtlValueByID(@Wind,CtlID/4):Value
* $3E10 InvalOneCtlByID(@Wind,CtlID/4)
* $3F10 HiliteCtlByID(Hilite,@Wind,CtlID/4)
*
* 22-Mar-93 Dave Lyons (6.0.1d15)
*
* Changed GetAndSetPrefs and SetPrefsToA to use DoSysPrefs instead
* of making GS/OS calls. This speeds up every call to CMLoadResource.
*
* 1-Apr-93 Steve Stephenson
*
* Changed version to $0304 for 6.0.1 (final)
*
**********************************************************************
Blanks off
String asis
print push
print off
INCLUDE 'all.macros'
include 'equates.asm'
include 'SuperEquates.asm'
myScrollPatt640 equ $00c0 ;added 20-Nov-90 DAL
myScrollPatt320 equ $0010 ;added 20-Nov-90 DAL
include '::sys.equs.asm'
include 'e16.event'
print pop
title 'ControlCallTable'
;====================================================================
;
; Control Manager Function Table.
;
;====================================================================
ControlCallTable PROC EXPORT
import WindDragRect
import FindActiveControl
import MakeNextControlActive
import MakeThisCtlActive
import SendEventToControl
import GetCtlID
import SetCtlID
import GetCtlMoreFlags
import SetCtlMoreFlags
import GetHandleFromID
import NewControl2
import CMReleaseResource
import CMLoadResource
import InvalCtls
import FindRadioButton ;19-Jan-91 DAL
import SetLETextByID ;19-Jan-91 DAL
import GetLETextByID ;19-Jan-91 DAL
import SetCtlValueByID ;15-Jul-92 DAL
import GetCtlValueByID ;15-Jul-92 DAL
import InvalOneCtlByID ;15-Jul-92 DAL
import HiliteCtlByID ;15-Jul-92 DAL
ENTRY FPT
FPT DC.L (ENDFPT-FPT)/4
DC.L CtlBootInit-1 1
DC.L CtlStartup-1 2
DC.L CtlShutDown-1 No longer shuts down (see CtlReset).
DC.L CtlVersion-1 4
DC.L CtlReset-1 Shutdown, called from WindShutDown.
DC.L CtlStatus-1 6
DC.L Reserved-1 7
DC.L Reserved-1 8
DC.L NewControl-1 9
DC.L DisposeControl-1 A
DC.L KillControls-1 B
DC.L SetCtlTitle-1 C
DC.L GetCtlTitle-1 D
DC.L HideControl-1 E
DC.L ShowControl-1 F
DC.L DrawControls-1 10
DC.L HiliteControl-1 11
DC.L CtlNewRes-1 12
DC.L FindControl-1 13
DC.L TestControl-1 14
DC.L TrackControl-1 15
DC.L MoveControl-1 16
DC.L DragControl-1 17
DC.L SetCtlIcons-1 18
DC.L SetCtlValue-1 19
DC.L GetCtlValue-1 1A
DC.L SetCtlParam-1 1B
DC.L GetCtlParam-1 1C
ENTRY dragPatch 1D
dragPatch DC.L WindDragRect-1 ;Address may be patched by CtlStartup.
DC.L GrowSize-1 1E
DC.L GetCtlzpage-1 1F
DC.L SetCtlAction-1 20
DC.L GetCtlAction-1 21
DC.L SetCtlRefCon-1 22
DC.L GetCtlRefCon-1 23
DC.L EraseControl-1 24
DC.L DrawOneCtl-1 25
; new calls added 20 Sep 88
DC.L FindActiveControl-1 $26
DC.L MakeNextControlActive-1 $27
DC.L MakeThisCtlActive-1 $28
DC.L SendEventToControl-1 $29
DC.L GetCtlID-1 $2A
DC.L SetCtlID-1 $2B
DC.L CallDefProc-1 $2C (added oct 3 88)
DC.L NotifyControls-1 $2D (added oct 3 88)
DC.L GetCtlMoreFlags-1 $2E
DC.L SetCtlMoreFlags-1 $2F
DC.L GetHandleFromID-1 $30
DC.L NewControl2-1 $31
dc.L CMLoadResource-1 $32 (added Oct 12 88)
dc.L CMReleaseResource-1 $33 (added Oct 12 88)
dc.L SetCtlParamPtr-1 $34 (added Oct 21 88)
dc.L GetCtlParamPtr-1 $35 (added Oct 21 88)
dc.L FutzCtls-1 $36 (added Mar 28 89)
dc.L InvalCtls-1 $37 (added Nov 9 88)
dc.L CMUnloadSegments-1 $38 (added May 15, 1989)
*** 6.0
dc.l FindRadioButton-1 $39 added 19-Jan-91 DAL
dc.l SetLETextByID-1 $3A added 19-Jan-91 DAL
dc.l GetLETextByID-1 $3B added 19-Jan-91 DAL
*** 6.0.1
dc.l SetCtlValueByID-1 ;$3C added 15-Jul-92 DAL
dc.l GetCtlValueByID-1 ;$3D added 15-Jul-92 DAL
dc.l InvalOneCtlByID-1 ;$3E added 15-Jul-92 DAL
dc.l HiliteCtlByID-1 ;$3F added 15-Jul-92 DAL
ENDFPT
ENDP
title 'Standard Calls'
;
;
;====================================================================
;
; CtlStartup
;
; Initialize Control Manager
;
; IN: PUSH:WORD - ID to use.
; PUSH:WORD - direct page to use.
;
; OUT: Nothing.
;
;====================================================================
CtlStartup PROC
rtl2 equ 1 Stack inputs offsets.
rtl1 equ rtl2+3
newZP equ rtl1+3
id equ newZP+2
directPage equ inputs Offset to direct page (when setup).
memoryID equ directPage+2
tax Have I already been initialized?
bne @1
tyx
beq @2
@1 brl exit1
@2
;
lda id,s ID number to use.
tay
lda #RAMSIZE Number of bytes to allocate.
jsr CMAllocate2 Allocate fixed RAM area.
txy Pass data area handle just like Tool Loc.
jsr CMStartup
;
ldy #2 Deference data area handle.
lda [<data],y
tay
lda [<data]
sta <data Replace handle with pointer.
sty <data+2
jsr setWAP Store data area pointer in Tool Locator.
;
;
; --- Remember memory ID number to use ---------------------
;
lda <memoryID
ldy #MyID
sta [<data],y
;
;
; --- Remember direct page passed by caller -----------------
;
lda <directPage
ldy #MyDPage
sta [<data],y
;
;
; --- Clear given direct page for Dialog Manager ------------
;
phd
tcd
ldx #$00FE
clearDpage stz <0,x
dex
dex
bpl clearDpage
pld
;
;
; --- Do resolution dependent initialization ----------------------------
;
jsr newResGuts
jsl RemoveRefreshTask ;3-Jun-92 DAL
;
;
; !!!!!!!!!!!! The following code is not ROMable !!!!!!!!!!!!!!!!!!!!!!!
; !!!!!!!!!!! The patch will be done by linker when ready to ROM !!!!!!!!!
;
;
; --- Patch out DragRect with routine in Window Manager -----------------
;
pha
pha
ldx #14+256*84 ; _GetDragRect
jsl $E10000
pla
plx
ldy #NOWIND_ERR
bcs exit2
;
sta >DragPatch
txa
sta >DragPatch+2
;
;
; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
;
;
;-----------------------------------------------------------
;
; Init the ParamPtr. (Added 23 Oct 88 SEG)
;
lda #0
pha
pha
_SetCtlParamPtr
pha
pha
_GetCodeResConverter
PushWord #rCtlDefProc
PushWord #%00000011 ; loggin in. system list.
_ResourceConverter
bcc exit1
cmp #$0003
bcs @NotDispatchError
pla ; clear the stack
pla
pla
pla
bra exit1
@NotDispatchError
exit1 ldy #0 No error.
exit2 brl CMpop4bytes
ENDP
;====================================================================
;
; CtlStatus
;
; Return status of Control Manager.
;
; IN: None.
;
; OUT: WORD - 1 if active, 0 if not active.
;====================================================================
CtlStatus PROC
rtl2 equ 1 Stack inputs offsets.
rtl1 equ rtl2+3
result equ rtl1+3
tax Has a data area been allocated?
bne ok1
tyx
beq store1
ok1 lda #6 Dan O. version number.
store1 sta result,s
;
;
ENTRY CtlBootInit
CtlBootInit ;
ENTRY Reserved
Reserved ;
ENTRY exit_tool
exit_tool ;
;
lda #0 No error.
clc No error.
rtl
ENDP
;====================================================================
;
; CtlShutDown
;
; Application's call for shutting down the Control Manager.
;
; IN: None.
;
; OUT: None.
;====================================================================
CtlShutDown PROC export
*** added 15-Jan-92 DAL -- remove my RunQueue task
import refreshDeskTask
pushlong #refreshDeskTask
_RemoveFromRunQ
*** end 15-Jan-92
;
; Real shut down in CtlReset call.
;
lda #0 No error code.
clc No error flag.
rtl Do nothing, Window Manager will shutdown.
ENDP
;====================================================================
;
; CtlReset
;
; Shut down Control Manager.
;
; This call is what really shuts down the Control Manager. This call is
; performed by the Window Manager when it is shut down. The reason for this
; is because many applications were shuting down the Control Manager before
; shutting down the Window Manager. An error occurred when the Window Manager
; called the Control Manager, but found it already shutdown.
;
; IN: y/a = pointer to data area, null if Control Manager not initialized.
;
; OUT: None.
;
;====================================================================
CtlReset PROC
tax Is Control Manager already shutdown?
bne ok1
tyx
beq CtlShutDown If already off, just return.
ok1 jsr CMStartup
;
; --- Freed data area ---------------------------------------------------
;
pha Space for result.
pha
pei <data+2 Pass address of data area.
pei <data
_FindHandle Find handle of data area.
_DisposeHandle Free handle of data area.
;
;
; --- Set my work area pointer in Tool Locator to zero ------------------
;
lda #0 Clear my saved value in Tool Locator
tay to show I am not active.
jsr setWAP
; Error code returned from setWAP.
brl CMpop0bytes
ENDP
;====================================================================
;
; CtlVersion
;
; Return Control Manager's Version number.
;
; IN: Nothing.
; OUT: WORD - version number.
;
;====================================================================
CtlVersion PROC
rtl2 equ 1 Stack inputs offsets.
rtl1 equ rtl2+3
result equ rtl1+3
lda #$0304 Version number 1-Apr-93 SS
sta result,s
lda #0 No error.
clc No error.
rtl
ENDP
****************************************************************
*
CMUnloadSegments PROC
*
* Unloads any dynamic segments that have been loaded
* in the course of using the tool
*
*
* Inputs:
* none
*
* Outputs:
* none
*
* External Refs:
import Exit_Tool
*
* Entry Points:
* none
*
longa on ; mode
longi on
*
****************************************************************
PushWord #$4010 ; unload all dynamics with this user id
lda #0 ; file num and seg num are zero
pha
pha
_UnloadSegNum
bra Exit_Tool
ENDP
title 'OtherCalls'
;====================================================================
;
; CtlNewRes
;
; To resolution dependent initialization.
;
; IN: Nothing.
;
; OUT: Nothing.
;====================================================================
CtlNewRes PROC
jsr CMStartup Do setup for tool call.
;
jsr newResGuts Reinitialize resolution dependents.
;
ldy #0 No error.
brl CMpop0bytes
ENDP
;====================================================================
;
; NewControl
;
; Add a control to the control list.
;
; IN: PUSH:LONG - window pointer.
; PUSH:LONG - pointer to enclosing RECT.
; PUSH:LONG - pointer to string for title.
; PUSH:WORD - control flag.
; PUSH:WORD - current value.
; PUSH:WORD - minimum value.
; PUSH:WORD - maximum value.
; PUSH:LONG - address of control definition procedure,
; with variation code in highest byte.
; For standard controls the variation codes are:
; 0 = simple button.
; 2 = check box.
; 4 = radio button.
; 6 = scroll bar.
; PUSH:LONG - control's reference value, reserved for application.
; PUSH:LONG - pointer to control's color table, zero for default.
;
; OUT: LONG - handle of control.
;
;====================================================================
NewControl PROC
colortable equ inputs
refCon equ colortable+4
defProc equ refCon+4
max equ defProc+4
min equ max+2
value equ min+2
cflag equ value+2
title equ cflag+2
boundsRect equ title+4
theWindow equ boundsRect+4
CtlHandle equ theWindow+4
;
;
jsr CMStartup Do setup for tool function.
;
ldx <theWindow+2 Get pointer to control's window.
lda <theWindow
jsr makeWptr windptr = pointer to window.
;
;
; --- Ask control's defProc for the size of the control's record ---------
;
stz <param Zero the Param field to indicate
stz <param+2 that this is a call from NewControl
ldx <defProc+1 Get address of defProc.
lda <defProc
bne custom Is it a custom control?
txy
bne custom
;
lda <defProc+2 Pass standard control number.
ldx #recSize Ask defProc for its required record size.
jsr standardDispatch Call standard control defProc.
bra done1
;
custom ldy #recSize Ask defProc for its required record size.
jsr customDispatch Call custom control defProc.
;
done1 pha Save size.
;
;
; --- Allocate the control --------------------------------------------------
;
pha Space for returned handle.
pha
phx Size of record returned by defProc.
pha
ldy #MyID
lda [<data],y
pha Pass ID for control manager.
lda #0 Attributes, anywhere, anyway, baby.
pha
pha Pass required address, none.
pha
_NewHandle Allocate record.
tay Put possible error code in Y.
pla
sta <Ctlhand
sta <CtlHandle Return handle of control.
pla
sta <Ctlhand+2
sta <CtlHandle+2
;
plx Get size of block.
bcc ok1 Was a block allocated?
brl exit If not, return error.
;
;
; --- Dereference control's handle ----------------------------
;
ok1 phx Save block size.
jsr dereference Ctlptr = (Ctlhand).
ply Get memory block size.
;
sep #$20
LONGA OFF
dey
lda #0 Zero out the block.
lop3 dey
sta [<ctlptr],y
bne lop3
rep #$20
LONGA ON
;
;
; --- Hook control into head of window's control list ------------
;
ldy #owControls
lda [<windptr],y
sta [<Ctlptr]
lda <Ctlhand
sta [<windptr],y New head of list.
iny
iny
lda [<windptr],y
tax Save.
lda <Ctlhand+2
sta [<windptr],y
ldy #2
txa
sta [<Ctlptr],y
;
;
; --- Remember mommy window ---------------------------
;
iny
iny
lda <theWindow
sta [<Ctlptr],y
iny
iny
lda <theWindow+2
sta [<Ctlptr],y
;
;
; --- Set enclosing RECT ------------------------------
;
ldy #x2
ldx #CtlRect+x2
lop1 lda [<boundsRect],y
phy
txy
sta [<Ctlptr],y
ply
dex
dex
dey
dey
bpl lop1
;
;
; --- Set control's flag ---------------------------------
;
lda <cflag
ldy #CtlFlag
sta [<Ctlptr],y Store flags and hilited part.
;
;
; --- Set control's value --------------------------------
;
lda <value
ldy #CtlValue
sta [<Ctlptr],y
;
;
; --- Set control's defProc address ----------------------
;
lda <defProc
ldy #CtlProc
sta [<Ctlptr],y
iny
iny
lda <defProc+2
sta [<Ctlptr],y
;
;
; --- Set control's title -----------------------------
;
lda <title
ldy #CtlData
sta [<Ctlptr],y
iny
iny
lda <title+2
sta [<Ctlptr],y
;
;
; --- Set control's reference value -------------------
;
lda <refCon
ldy #CtlRefCon
sta [<Ctlptr],y
iny
iny
lda <refCon+2
sta [<Ctlptr],y
;
;
; --- Set control's color table -------------------------
;
lda <colortable
ldy #CtlColor
sta [<Ctlptr],y
iny
iny
lda <colortable+2
sta [<Ctlptr],y
;
;
; --- Ask defProc to do any further initialization ----
;
lda <min Pass min and max as Params.
ldy <max
ldx #initCntl
jsr CMDispatch
;
ldy #0 No error.
exit brl CMpop32bytes
ENDP
;====================================================================
;
; DisposeControl
;
; Remove control from control list.
;
; IN: PUSH:LONG - handle of control.
;
; OUT: Nothing.
;
;====================================================================
DisposeControl PROC
theControl equ inputs
jsr CMStartup Do set up for function.
;
jsr getCtlHand ctlHand = passed control handle.
; ctlPtr = (ctlHand).
bcs exit200 Null handle passed?
;
jsr dispose_guts Dispose of control.
; Return error state from dispose_guts.
exit200 brl CMpop4bytes
;====================================================================
; KillControls
; Remove all controls from window.
;
; IN: PUSH:LONG - pointer to window port.
;
; OUT: Nothing.
;====================================================================
ENTRY KillControls
KillControls ;
;
deadWindow equ inputs
;-----------------------------------------------------------
;
; The window manager can call this routine when closing
; a window even when we are not active. In the past this
; happened only when the control manager was not loaded
;
; When it is loaded, we go to system death unless this
; check is made.
;
; We return the old ToolNotfound error because the window
; manager knows how to handle that.
;
cmp #0 ; see if we are active.
bne Yup ; non-zero means yes
cpy #0 ; try y-reg
bne Yup
lda #1 ; not active, so return tool not found error
sec ; with carry set
rtl ; and stack untouched!!!!
Yup
jsr CMStartup Do set up for function.
;
;
; --- Dispose of every control in list ---------------------
;
lop300 jsr getWindptr Get window pointer and first control.
bcs exit200 Any errors? (y = 0 if end of list)
;
ldy #CtlOwner Force control's owner to be passed window.
lda <deadWindow
sta [<Ctlptr],y
iny
iny
lda <deadWindow+2
sta [<Ctlptr],y
;
jsr dispose_guts Kill it.
bcc lop300 If no error, continue to kill list.
bra exit200 Return error.
;
;
; = = = = = = = = = = = = = = = = = = = =
; Dispose control guts.
; = = = = = = = = = = = = = = = = = = = =
;
; IN: <ctlhand = control's handle.
; <ctlptr = pointer to control.
;
; OUT: Carry set if error, y = error code.
; Carry clear if no error, control freed and deleted from list.
;
dispose_guts
;
;
; --- Let defProc perform any disposal actions first -------------------
;
ldx #dispCntl
jsr CMDispatch
clc OK flag, just in case.
tax Abort disposal?
bne exit100 Did defProc abort disposal?
;
;
; --- Take control out of control list ---------------------------------
;
pei <Ctlhand+2 Save control's handle.
pei <Ctlhand It is also passed to _DisposeHandle.
;
jsr dereference
sta <work Save control's pointer.
stx <work+2
;
jsr get_wptr Get window pointer from control.
clc
adc #owControls
bcc ok100
inx
ok100 sta <Ctlptr Pointer to first handle in control list.
stx <Ctlptr+2
;
lop100 ldy #2 Get the handle of the next control.
lda [<Ctlptr],y
tax
lda [<Ctlptr]
tay
;
cmp 1,s Is the next control THEE control?
bne next100
txa
cmp 3,s
beq done100
;
next100 sty <Ctlhand Store handle of next control.
stx <Ctlhand+2
ora <Ctlhand
bne ok101
;
pla Remove handle from stack.
pla
sec Return error flag, control not in list.
ldy #NOT_IN_LIST
rts
;
ok101 jsr dereference Ctlptr = (Ctlhand).
bra lop100
;
;
; work = pointer to control to dispose.
; Ctlptr = address of control previous to control in 'workptr'.
;
done100 lda [<work] Take THEE control out of list.
sta [<Ctlptr]
ldy #2
lda [<work],y
sta [<Ctlptr],y
;
;
; --- Free allocated memory block used for control's record ------------
;
_DisposeHandle Handle already on stack.
;
exit100 ldy #0 No error.
rts
;
ENDP
;
;
;====================================================================
;
; SetCtlIcons
;
; Swap Control Manager Icon Font.
;
; IN: PUSH:LONG - handle of new icon font, negative for none.
;
; OUT: LONG - current (before swap) icon font.
;
;====================================================================
SetCtlIcons PROC
newFont equ inputs
oldFont equ newFont+4
;
;
jsr CMStartup Do tool function setup.
;
;
; --- Return font before change --------------------------------------
;
jsr pushVctl_font Push current font on stack.
pla Return current font.
sta <oldFont
pla
sta <oldFont+2
;
;
; --- Change current font --------------------------------------------
;
ldx <newFont+2 Use new font?
bmi exit2
;
lda <newFont
jsr SetIconFont
;
exit2 ldy #0 No error flag.
brl CMpop4bytes
ENDP
;====================================================================
;
; SetCtlTitle
;
; Set new title in control.
;
; IN: PUSH:LONG - pointer to title string.
; PUSH:LONG - handle of control.
;
; OUT: Nothing.
;
;====================================================================
SetCtlTitle PROC
CtlHandle equ inputs
title equ CtlHandle+4
;
;
jsr CMStartup Do tool function setup.
;
jsr getCtlHand ctlHand = passed control handle.
; ctlPtr = (ctlHand).
bcs exit Null handle passed?
;
ldy #CtlData Replace the control's CtlData field.
lda <title
sta [<Ctlptr],y
iny
iny
lda <title+2
sta [<Ctlptr],y
;
jsr set2draw Setup to draw.
;
jsr pushPort Save the current port.
jsr drawWholeCtl Draw the control.
jsr popPort Restore the current port.
;
exit ldy #0 No error flag.
brl CMpop8bytes
ENDP
;====================================================================
;
; GetCtlTitle
;
; Read title from control.
;
; IN: PUSH:LONG - handle of control.
;
; OUT: LONG - value in CtlData field of control record.
;
;====================================================================
GetCtlTitle PROC
CtlHandle equ inputs
title_des equ CtlHandle+4
;
;
jsr CMStartup Do tool function setup.
;
jsr getCtlHand ctlHand = passed control handle.
; ctlPtr = (ctlHand).
bcs exit Null handle passed?
;
ldy #CtlData Get pointer to control's title.
lda [<Ctlptr],y
sta <title_des
iny
iny
lda [<Ctlptr],y
sta <title_des+2
;
exit ldy #0 No error.
brl CMpop4bytes
ENDP
;====================================================================
;
; SetCtlValue
;
; Set control's value.
;
; IN: PUSH:WORD - control's new value, 1 to select buttons and check boxes.
; PUSH:LONG - handle of control.
;
; OUT: Nothing.
;
;====================================================================
SetCtlValue PROC
CtlHandle equ inputs
NewVal equ CtlHandle+4
;
;
jsr CMStartup Do tool function setup.
;
jsr getCtlHand ctlHand = passed control handle.
; ctlPtr = (ctlHand).
bcs exit Null handle passed?
;
;
; --- Set the value ----------------------------------
;
ldy #CtlValue
lda [<ctlptr],y
cmp <NewVal
beq exit Nothing to do if already set.
sta <work Remember old value.
;
lda <NewVal
sta [<Ctlptr],y Set new value.
;
;
; --- Tell defProc there's a new value (draws control) ------------
;
jsr set2draw Setup to draw standard controls.
jsr pushPort Save the current port.
jsr set2drawCtl Setup to draw the control.
;
ldy <work Pass old value in param+2.
lda <NewVal Pass new value in param.
ldx #newValue Call defProc about new value.
jsr CMDispatch
jsr popPort Restore the current port.
;
exit ldy #0 No error flag.
brl CMpop6bytes
ENDP
;====================================================================
;
; GetCtlValue
;
; Get control's value.
;
; IN: PUSH:LONG - pointer to control.
;
; OUT: WORD - control's current value.
;
;====================================================================
GetCtlValue PROC
CtlHandle equ inputs
RetValue equ CtlHandle+4
;
jsr CMStartup Do tool function setup.
;
jsr getCtlHand ctlHand = passed control handle.
; ctlPtr = (ctlHand).
bcs exit Null handle passed?
;
ldy #CtlValue
lda [<Ctlptr],y
sta <RetValue
;
exit ldy #0 No error flag.
brl CMpop4bytes
ENDP
;====================================================================
;
; SetCtlParam
;
; Set control's minimum and maximum values.
;
; IN: PUSH:WORD - maximum value, $FFFF don't set.
; PUSH:WORD - minimum value, $FFFF don't set.
; PUSH:LONG - handle of control.
;
; For scroll bars: CtlData = minimum.
; CtlData+2 = maximum.
; OUT: Nothing.
;
;====================================================================
SetCtlParam PROC
CtlHandle equ inputs
view equ CtlHandle+4
dataSize equ view+2
;
;
jsr CMStartup Do tool function setup.
;
jsr getCtlHand ctlHand = passed control handle.
; ctlPtr = (ctlHand).
bcs exit Null handle passed?
;
;
; --- Tell defProc there's a new params (may draw control) ------------
;
jsr set2draw Setup to draw standard controls.
jsr pushPort Save the current port.
jsr set2drawCtl Setup to draw the control.
;
lda <view Pass new view and data sizes.
ldy <dataSize
ldx #setParams Task number.
jsr CMDispatch
jsr popPort Restore the current port.
;
exit ldy #0 No error flag.
brl CMpop8bytes
ENDP
;====================================================================
;
; GetCtlParam
;
; Get control's minimum and maximum values.
;
; IN: PUSH:LONG - pointer to control.
;
; OUT: LONG - minimum value in high word, maximum value in low word.
;
; For scroll bars: minimum = ScrollView.
; maximum = ScrollMax.
;
;====================================================================
GetCtlParam PROC
CtlHandle equ inputs
RetMax equ CtlHandle+4
RetMin equ RetMax+2
;
;
jsr CMStartup Do tool function setup.
;
jsr getCtlHand ctlHand = passed control handle.
; ctlPtr = (ctlHand).
bcs exit Null handle passed?
;
ldy #CtlData+2
lda [<Ctlptr],y
sta <RetMax
dey
dey
lda [<Ctlptr],y
sta <RetMin
;
exit ldy #0 No error flag.
brl CMpop4bytes
ENDP
;====================================================================
;
; GetCtlZPage
;
; Return Control Manager's zero page.
;
; IN: None.
;
; OUT: WORD - Control Manager's direct page.
;
;====================================================================
GetCtlzpage PROC
result equ inputs
;
;
jsr CMStartup
;
ldy #MyDPage Return Control Manager's zero page.
lda [<data],y
sta <result
;
ldy #0 No error flag.
brl CMpop0bytes
ENDP
;====================================================================
;
; SetCtlAction
;
; Set CtlAction field in control.
;
; IN: PUSH:LONG - value to place in CtlAction field.
; PUSH:LONG - handle of control.
;
; OUT: Nothing.
;
;====================================================================
SetCtlAction PROC
jsr CMStartup Do tool function setup.
;
jsr getCtlHand ctlHand = passed control handle.
; ctlPtr = (ctlHand).
bcs errorOut8 Null handle passed?
;
ldy #CtlAction
bra set_long
ENDP
;====================================================================
;
; GetCtlAction
;
; Return CtlAction field in control.
;
; IN: PUSH:LONG - handle of control.
;
; OUT: PUSH:LONG - value of CtlAction field.
;
;550=================================================================
GetCtlAction PROC
jsr CMStartup Do tool function setup.
;
jsr getCtlHand ctlHand = passed control handle.
; ctlPtr = (ctlHand).
bcs errorOut4 Null handle passed?
;
ldy #CtlAction
bra get_long
ENDP
;====================================================================
;
; SetCtlRefCon
;
; Set CtlRefCon field in control.
;
; IN: PUSH:LONG - value to place in CtlRefCon field.
; PUSH:LONG - handle of control.
;
; OUT: Nothing.
;
;600=================================================================
SetCtlRefCon PROC
jsr CMStartup Do tool function setup.
;
jsr getCtlHand ctlHand = passed control handle.
; ctlPtr = (ctlHand).
bcs exit Null handle passed?
;
ldy #CtlRefCon
;
; = = = = = = = = = = = = = = = = = = = = = = =
; Set a LONG field in
; a control record.
; = = = = = = = = = = = = = = = = = = = = = = =
;
secondParam equ inputs+4
;
EXPORT set_long
set_long ;
;
lda <secondParam
sta [<Ctlptr],y
iny
iny
lda <secondParam+2
sta [<Ctlptr],y
;
exit ldy #0 No error flag.
ENTRY errorOut8
errorOut8 ;
brl CMpop8bytes
ENDP
;====================================================================
;
; GetCtlRefCon
;
; Return CtlRefCon field in control.
;
; IN: PUSH:LONG - handle of control.
;
; OUT: PUSH:LONG - value of CtlRefCon field.
;
;650=================================================================
GetCtlRefCon PROC
jsr CMStartup Do tool function setup.
;
jsr getCtlHand ctlHand = passed control handle.
; ctlPtr = (ctlHand).
bcs exit Null handle passed?
;
ldy #CtlRefCon
;
;
; = = = = = = = = = = = = = = = = = = = = = = =
; Return a LONG field
; from a control record.
; = = = = = = = = = = = = = = = = = = = = = = =
;
returnParam equ inputs+4
;
EXPORT get_long
get_long ;
;
lda [<Ctlptr],y
sta <returnParam
iny
iny
lda [<Ctlptr],y
sta <returnParam+2
;
exit ldy #0 No error flag.
ENTRY errorOut4
errorOut4 ;
brl CMpop4bytes
ENDP
;====================================================================
;
; HiliteControl
;
; Highlight/Unhighlight a control.
;
; IN: PUSH:WORD - 0 = unhighlight last highlighted part, or draw control.
; 1-253 = part to be highlighted.
; 255 = make control inactive.
; PUSH:LONG - pointer to control.
; Current port must be control's window port.
;
; OUT: Nothing.
;
;====================================================================
HiliteControl PROC
control equ inputs
newstate equ control+4
;
;
jsr CMStartup Do tool function setup.
;
jsr getCtlHand ctlHand = passed control handle.
; ctlPtr = (ctlHand).
bcs exit Null handle passed?
;
*** 9-Jan-91 DAL -- use WaitUntil to max out the blinking speed
ldx #0 ;anticipate using 0 for DelayAmount
lda <control+2
cmp >prevControl+2
bne @different
lda <control
cmp >prevControl
bne @different
lda <newstate
bne @notZero
ldx #$0040 ;delay amount
@notZero
@different lda <control+2
sta >prevControl+2
lda <control
sta >prevControl
pha ;result space
lda >anchorTime
pha
phx ;delay amount
_WaitUntil
pla
sta >anchorTime
*** end of 9-Jan-91 DAL
;
; --- Set new highlight flag ---------------------
;
ldy #CtlHilite
lda [<Ctlptr],y
and #$00FF Get last highlighted part,
sta <param and store as possible part to draw.
cmp <newstate Is old hilite same as new?
beq exit If the same, no need to draw.
;
cmp #C_HILITE Was the control inactive?
bne ok1
stz <param If yes, draw whole control.
;
ok1 lda [<Ctlptr],y
and #$FF00 Mask off present flags.
ora <newstate Set new highlight flag.
sta [<Ctlptr],y Put into control's record.
;
;
; --- Draw new state -----------------------------
;
jsr set2draw Setup to draw control.
jsr pushPort Save the current port.
jsr drawCtl Draw the control.
jsr popPort Restore the current port.
;
exit ldy #0 No error flag.
brl CMpop6bytes
*** added 9-Jan-91 DAL
prevControl dc.l 0
anchorTime dc.w 1
*** end of 9-Jan-91 DAL
ENDP
;====================================================================
;
; HideControl
;
; Make a control invisible.
;
; IN: PUSH:LONG - handle of control to hide.
; Current port must be control's window port.
;
; OUT: Nothing.
;
;
; Change History
;
; 10 Feb 89 Yee
;
; Added code to send erase message to multipart controls
;
; 13 Feb 89 Steven Glass
;
; Fixed y-reg for old style controls
;
;
; 28 Mar 89 Dave Good
;
; cleanedup the code a little and saved a few bytes
;
;====================================================================
Ctrl12Proc PROC
;---------------------------------------------------------------
ENTRY HideControl
ENTRY EraseControl
;---------------------------------------------------------------
;---------------------------------------------------------------
tempEraseFlag equ 1
;---------------------------------------------------------------
;---------------------------------------------------------------
HideControl jsr CMStartup ;call the common startup routine
lda #0 ;add to the update region
bra common
;---------------------------------------------------------------
EraseControl jsr CMStartup ;call the common startup routine
lda #1 ;don't add to the update region
;---------------------------------------------------------------
common pha ;save the eraseFlag on the stack
jsr getCtlHand ;get and deref the passed control handle
bcs exit ;if a NULL handle was passed, then exit
ldy #CtlFlag ;if the control is already invisible, then
lda [<Ctlptr],y ;..exit
and #Ctl_INVIS
bne exit
lda [<Ctlptr],y ;mark the control as invisible
ora #Ctl_INVIS
sta [<Ctlptr],y
;---------------------------------------------------------------
ldy #NewCtlRecord.CtlProc+2 ;is this a super control ? If not, then
lda [<Ctlptr],y ;..we never need to notify this ctrl
bpl skipNotify
ldy #NewCtlRecord.ctlMoreFlags ;does this defProc want this message ?
lda [<Ctlptr],y
and #fCtlIsMultiPart
beq skipNotify
lda tempEraseFlag,s
ldy #0
ldx #ctlNotifyMultiPart
jsr CMDispatch
skipNotify
;---------------------------------------------------------------
jsr to_wport ;switch to control's window port.
jsr CMsetrect ;'rect' = control's enclosing RECT.
ldy #ctlProc ;is the control a simple button ? If not
lda [<ctlptr],y ;..then don't expand the rect
iny
ora [<ctlptr],y
bne @skipButton
ldy #CtlFlag ;does the button need it's rect expanded ?
lda [<ctlptr],y ;..nope = skip expand
and #1
beq @skipButton
jsr expandButt ;expand 'rect' to include bold.
@skipButton
jsr pushrect ;erase the control
_EraseRect
lda tempEraseFlag,s ;do we need to invalidate the control ?
bne @skipInval
jsr pushrect ;invalidate the control
_InvalRect
@skipInval
;---------------------------------------------------------------
exit pla ;pull off the erase flag
ldy #0 ;return no error
brl CMpop4bytes
;---------------------------------------------------------------
ENDP
;====================================================================
;
; ShowControl & DrawOneCtl
;
; Make a control visible.
;
; IN: PUSH:LONG - handle of control to make visible (or draw).
; Current port must be control's window port.
;
; OUT: Nothing.
;
;
; Change History
;
; 28 Mar 89 Dave Good
;
; Combined show and draw one control to save space. Also made both of them
; call the defProc for multi part controls.
;
;====================================================================
Ctrl2Proc PROC
;---------------------------------------------------------------
ENTRY DrawOneCtl
ENTRY ShowControl
;---------------------------------------------------------------
;---------------------------------------------------------------
DrawOneCtl jsr CMStartup ;call the common startup routine
jsr getCtlHand ;get and deref the passed control handle
bcs exit ;if a NULL handle was passed, then exit
ldx #3
bra drawIt
;---------------------------------------------------------------
ShowControl jsr CMStartup ;call the common startup routine
jsr getCtlHand ;get and deref the passed control handle
bcs exit ;if a NULL handle was passed, then exit
ldy #CtlFlag ;if the control is already visible then
lda [<Ctlptr],y ;..exit
and #Ctl_INVIS
beq exit
lda [<Ctlptr],y ;it was not visible before, so make it
and #$FF7F ;..visible
sta [<Ctlptr],y
ldx #2 ;this is what param to send
;---------------------------------------------------------------
drawIt ldy #NewCtlRecord.CtlProc+2 ;is this a super control ? If not, then
lda [<Ctlptr],y ;..we never need to notify this ctrl
bpl skipNotify
ldy #NewCtlRecord.ctlMoreFlags ;does this defProc want this message ?
lda [<Ctlptr],y
and #fCtlIsMultiPart
beq skipNotify
txa ;this tells the defproc to show the
ldy #0 ;..control
ldx #ctlNotifyMultiPart
jsr CMDispatch
skipNotify
;---------------------------------------------------------------
jsr set2draw ;setup to draw control.
jsr pushPort ;save the current port.
jsr drawWholeCtl ;draw the control.
jsr popPort ;restore the current port.
exit ldy #0 ;no error flag.
brl CMpop4bytes
;---------------------------------------------------------------
ENDP
;====================================================================
;
; DrawControls
;
; Draw control list.
;
; IN: PUSH:LONG - pointer to window.
;
; OUT: Nothing.
;
; Will just exit if a null window pointer passed or no controls
; in window's control list.
;
;====================================================================
DrawControls PROC
window equ inputs
count equ window+4
;
yoffset equ work
xoffset equ yoffset+2
;
;
jsr CMStartup Do tool function setup.
;
jsr getWindPtr Get given window pointer.
bcs exit Any errors?
;
ldy #owFrame Is window visible?
lda [<windptr],y
and #F_VIS
beq exit Nothing to draw if invisible.
;
jsr set2draw Switch to CtlOwner port, get visBounds.
jsr pushPort Save the current port.
;
;
; --- Draw all the controls in the list --------------
;
lop1 jsr drawWholeCtl Do standard setups, and draw control.
;
jsr dereference Ctlptr = (Ctlhand).
;
jsr next_Ctl Get pointer to next control.
bne lop1 Any more controls?
;
jsr popPort Restore the current port.
;
exit ldy #0 No error flag.
brl CMpop4bytes
ENDP
;====================================================================
;
; InvalCtls
;
; Invalidates bound rects of the controls in the window
;
; IN: PUSH:LONG - pointer to window.
;
; OUT: Nothing.
;
; Will just exit if a null window pointer passed or no controls
; in window's control list.
;
;====================================================================
InvalCtls PROC
window equ inputs
;
;
jsr CMStartup Do tool function setup.
;
jsr getWindPtr Get given window pointer.
bcs exit Any errors?
;
ldy #owFrame Is window visible?
lda [<windptr],y
and #F_VIS
beq exit Nothing to do if invisible.
pha
pha
_GetPort
pei Window+2
pei Window
_SetPort
pha
pha
pha
pha
tsc
inc a
pea 0
pha
_GetPortRect
pei Window+2
pei Window
_StartDrawing
;
;
; --- Invalidate all the controls in the list --------------
;
lop1 lda ctlPtr
clc
adc #NewCtlRecord.ctlRect
tax
lda ctlPtr+2
adc #0
pha
phx
_InvalRect
;
jsr dereference Ctlptr = (Ctlhand).
;
jsr next_Ctl Get pointer to next control.
bne lop1 Any more controls?
_SetOrigin
pla
pla
;
_SetPort Restore orig port.
;
exit ldy #0 No error flag.
brl CMpop4bytes
ENDP
;====================================================================
;
; FutzCtls
;
; Invalidates bound rects of normal controls in the window and
; sends message to other controls telling that window state has
; changed.
;
; This call is supposed to be made in reponse to a activate event
; so the state of the controls can be tied to the window state.
;
; IN: PUSH:LONG - pointer to window.
; PUSH:WORD - Window State
;
; OUT: Nothing.
;
; Will just exit if a null window pointer passed or no controls
; in window's control list.
;
;====================================================================
FutzCtls PROC
window equ inputs
windowState equ window+4
;
;
jsr CMStartup Do tool function setup.
;
jsr getWindPtr Get given window pointer.
bcs exit Any errors?
;
ldy #owFrame Is window visible?
lda [<windptr],y
and #F_VIS
beq exit Nothing to do if invisible.
pha
pha
_GetPort
pei Window+2
pei Window
_SetPort
pha
pha
pha
pha
tsc
inc a
pea 0
pha
_GetPortRect
pei Window+2
pei Window
_StartDrawing
;
;
; --- Invalidate all the controls in the list --------------
;
lop1
ldy #NewCtlRecord.ctlProc+2
lda [<ctlPtr],y
bmi ItsSuper
lda ctlPtr
clc
adc #NewCtlRecord.ctlRect
tax
lda ctlPtr+2
adc #0
pha
phx
_InvalRect
bra JoinUp
;
ItsSuper
lda WindowState ; notify this def proc.
ldy #0
ldx #ctlWinStateChange
jsr CMDispatch
JoinUp
jsr dereference Ctlptr = (Ctlhand).
;
jsr next_Ctl Get pointer to next control.
bne lop1 Any more controls?
_SetOrigin
pla
pla
;
_SetPort Restore orig port.
;
exit ldy #0 No error flag.
brl CMpop6bytes
ENDP
**********************************************************************
*
* $3910 FindRadioButton -- added 19-Jan-91 DAL
*
* This routine is compatible with the fmdWhichRadio call in the
* DTS FakeModalDialog user toolset (original code by Eric Soldan).
*
* Inputs:
* Space for result (WORD)
* Window Pointer (LONG)
* Family Number (WORD)
*
* Given the family number of a family of extended radio button controls
* in the specified window, we determine which radio button in the family
* is selected, and the return value is the selected button's control ID
* MINUS the control ID of the lowest-ID'ed control in the family.
*
**********************************************************************
FindRadioButton proc export
; offset constants for CtlRec
octlNext equ 0
octlOwner equ 4
octlRect equ 8
octlFlag equ 16
octlHilite equ 17
octlValue equ 18
octlProc equ 20
octlAction equ 24
octlData equ 28
octlRefCon equ 32
octlColor equ 36
octlReserved equ 40
octlID equ 56
octlMoreFlags equ 60
octlVersion equ 62
DefineStack
ctlHndl long ;Must be at 1,s
rbCtlPtr long
ctlID long ;ID of some radio button control.
theRadBut word
notHere word ;Flag for active button not found.
sizeLocals EndLocals
saveDPage word
returnAddr block 6 ;was block 3 (DAL)
BegParms
famNum word
wptr long ;Window that owns the control.
sizeParms EndParms
radioNum word
phd ;Save directPage register.
tsc ;Make space for locals.
sec
sbc #sizeLocals
tcs
tcd ;Set directPage register.
lda #$FFFF ;This is supposed to be a bogus value
sta radioNum ;(0 is legit).
sta notHere ;Assume we won't find active radio
sta ctlID+2 ;button of correct family number.
*** added 8-Aug-91 DAL, to handle window-pointer = NIL --> front window
lda <wptr+1
bne @notNIL
pha
pha
_FrontWindow
pla
sta <wptr
pla
sta <wptr+2
@notNIL
*** end 8-Aug-91 DAL
pei wptr+2
pei wptr
_GetWControls ;Result space already there (ctlHndl).
bcs @exit
@loop lda ctlHndl+1 ;See if we have a NULL handle yet.
beq @endLoop
jsr @derefCtl ;Deref ctlHndl into rbCtlPtr.
ldy #octlProc+2 ;Get hi-word of proc address.
lda [rbCtlPtr],y
cmp #radioControl>>16
bne @nextCtl ;Not a radio button. Skip it.
ldy #octlFlag
lda [rbCtlPtr],y
and #$7F
cmp famNum ;See if it is "our" family.
bne @nextCtl ;Not related.
ldy #octlID+2 ;See if this is the smallest ctlID for
lda [rbCtlPtr],y ;our family yet.
tax
dey
dey
lda [rbCtlPtr],y
cpx ctlID+2
bcc @smaller
bne @a ;It isn't.
cmp ctlID
bcs @a ;It isn't.
@smaller sta ctlID ;It is, so remember it.
stx ctlID+2
@a tax
ldy #octlValue
lda [rbCtlPtr],y
beq @nextCtl ;This isn't the active radio button.
stx theRadBut ;This is the one, so remember enough
stz notHere ;of it. Also, flag we found it.
@nextCtl ldy #2
lda [rbCtlPtr]
sta ctlHndl
lda [rbCtlPtr],y
sta ctlHndl+2
bra @loop
@endLoop lda notHere ;See if we found it. If we didn't,
bmi @b ;return $FFFF to indicate this.
lda theRadBut
sec
sbc ctlID
@b sta radioNum ;This is what the programmer was
;yearning for.
lda #0 ;Return no error.
@exit tax ;save error code in X
tdc ;Get rid of local variables.
clc
adc #sizeLocals
tcs
pld ;Restore directPage register.
ldy #sizeParms ;error already in X
jml $e10184 ;ToStrip
@derefCtl ldy #2
lda [ctlHndl]
sta rbCtlPtr
lda [ctlHndl],y
sta rbCtlPtr+2
rts
ENDP
**********************************************************************
*
* $3A10 SetLETextByID -- added 19-Jan-91 DAL
*
* This routine is compatible with the fmdLESetText call in the
* DTS FakeModalDialog user toolset (original code by Eric Soldan).
*
* Inputs:
* Window Pointer (LONG)
* Edit Line Control ID (LONG)
* Pascal String Pointer (LONG)
*
* Given the control ID of an extended edit line control in the
* specified window, we set its text from the Pascal string, thus
* saving the application programmer having to call GetCtlHandleFromID,
* GetCtlTitle, and LESetText, plus some miscellaneous string
* manipulation and handle dereferencing.
*
* This routine *selects* the text it puts into the Edit Line control.
*
**********************************************************************
SetLETextByID proc export
export GetLETextByID
; offset constants for LERec
oleLineHandle equ 0
oleLength equ 4
oleMaxLength equ 6
oleDestRect equ 8
oleViewRect equ 16
olePort equ 24
oleLineHite equ 28
oleBaseHite equ 30
oleSelStart equ 32
oleSelEnd equ 34
oleActFlg equ 36
oleCarAct equ 38
oleCarOn equ 40
oleCarTime equ 42
oleHiliteHook equ 46
oleCaretHook equ 50
oleJust equ 54
olePWChar equ 56
; from E16.Control
octlData equ 28
DefineStack
ctlHndl long
leCtlPtr long
leHndl long
lePtr long
lineHndl long
linePtr long
cstr long
lineLength word
leRect block 8 ;Must be > oleViewRect ($10)
sizeLocals EndLocals
saveDPage word
returnAddr block 6 ;was block 3 (DAL)
BegParms
pstr long ;Pointer to string space.
lineEditID long ;ID of lineEdit control.
wptr long ;Window that owns the control.
sizeParms EndParms
*
* SetLETextByID
*
jsr lineEditSetup ;Set up everything we need.
bcs exit ;Couldn't dereference for some reason.
pei cstr+2 ;Set text to c-string.
pei cstr
lda [pstr] ;Get length of pascal string.
and #$00FF
pha
pei leHndl+2
pei leHndl
_LESetText
bcs exit
pha ;Invalidate view rect of lineEdit.
pha
_GetPort ;Save the current port.
pei wptr+2
pei wptr
_SetPort ;Make the window the current port
;(for _InvalRect).
jsr lineEditDeref ;Redereference -- slow but small.
ldy #oleSelStart
lda #0
pha ;Hi-word for _InvalRect.
sta [lePtr],y
iny
iny ;Point at leSelEnd.
lda [pstr] ;Get length of pascal string.
and #$00FF
sta [lePtr],y
ldy #oleViewRect+6 ;Copy lineEdit viewRect into rect.
@a lda [lePtr],y
tyx
sta <leRect-oleViewRect,x
dey
dey
cpy #oleViewRect
bcs @a
tdc ;Hi-word alreay on stack. (It's a 0).
adc #leRect ;Carry still clear.
pha
_InvalRect ;Inval that rect.
_SetPort ;Put the port back.
exitNoErr lda #0 ;Return no error.
exit tax ;Save error code.
tdc ;Get rid of local variables.
clc
adc #sizeLocals
tcs
pld ;Restore directPage register.
ldy #sizeParms
jml $e10184 ;ToStrip
**********************************************************************
*
* $3B10 GetLETextByID -- added 19-Jan-91 DAL
*
* This routine is compatible with the fmdLESetText call in the
* DTS FakeModalDialog user toolset (original code by Eric Soldan).
*
* Inputs:
* Window Pointer (LONG)
* Edit Line Control ID (LONG)
* Pascal String Pointer (LONG)
*
* Given the control ID of an extended edit line control in the
* specified window, we fetch its text into the Pascal string, thus
* saving the application programmer having to call GetCtlHandleFromID,
* GetCtlTitle, LEGetTextHand, LEGetTextLen, and doing miscellaneous
* string manipulation and handle dereferencing.
*
**********************************************************************
GetLETextByID
jsr lineEditSetup ;Set up everything we need.
bcs exit ;Couldn't dereference for some reason.
pei linePtr+2 ;Copy the text into the string.
pei linePtr
pei cstr+2
pei cstr
pea 0
pei lineLength
_BlockMove
ldy lineLength ;Store the p-string length and also
tya ;terminate the string for the c dudes.
shortm ;Use 8-bit accumulator.
sta [pstr] ;Save the p-string length byte.
lda #0
sta [cstr],y ;Terminate the c-string.
longm ;Set accumulator back to 16-bit.
bra exitNoErr ;Return no error.
*** Subroutines common to SetLETextByID and GetLETextByID
*
* lineEditSetup -- set up the stack frame, get the control handle from
* its ID, deref control handle into leCtlPtr, get the line edit handle
* from the ctlData field, and set lineHndl and linePtr to the text.
*
lineEditSetup plx ;Save return address so stack frame
;setup works.
phd ;Save directPage register.
tsc ;Make space for locals.
sec
sbc #sizeLocals
tcs
tcd ;Set directPage register.
phx ;Put return address back.
lda pstr ;Also point past p-string length
ldx pstr+2 ;for c-strings.
inc a
bne @a
inx
@a sta cstr
stx cstr+2
*** added 8-Aug-91 DAL, to handle window-pointer = NIL --> front window
lda <wptr+1
bne @notNIL
pha
pha
_FrontWindow
pla
sta <wptr
pla
sta <wptr+2
@notNIL
*** end 8-Aug-91 DAL
pha ;Get the control handle via wptr,id.
pha
pei wptr+2
pei wptr
pei lineEditID+2
pei lineEditID
_GetCtlHandleFromID
plx
stx ctlHndl
plx
stx ctlHndl+2
bcs rts1
ldy #2 ;Dereference ctlHndl.
lda [ctlHndl]
sta leCtlPtr
lda [ctlHndl],y
sta leCtlPtr+2
ldy #octlData ;Get the lineEdit handle from
lda [leCtlPtr],y ;the control's data field.
sta leHndl
iny
iny
lda [leCtlPtr],y
sta leHndl+2
* fall into lineEditDeref
lineEditDeref ldy #2 ;Dereference leHndl.
lda [leHndl]
sta lePtr
lda [leHndl],y
sta lePtr+2
ldy #oleLength
lda [lePtr],y
sta lineLength
ldy #oleLineHandle
lda [lePtr],y
sta lineHndl
iny
iny
lda [lePtr],y
sta lineHndl+2
ldy #2 ;Dereference lineHndl.
lda [lineHndl]
sta linePtr
lda [lineHndl],y
sta linePtr+2
clc ;Everything worked.
rts1 rts
EndP
**********************************************************************
*
* $3C10 SetCtlValueByID -- added 15-Jul-92 DAL
*
* Inputs:
* Value (WORD)
* Window Pointer (LONG)
* Control ID (LONG)
*
**********************************************************************
SetCtlValueByID PROC EXPORT
phd
tsc
tcd
@ctlID equ 9
@windPtr equ @ctlID+4
@value equ @windPtr+4
jsr CtlGetHandle ;into XY
bcs @error
pei <@value
phx
phy
_SetCtlValue
@error tax
pld
export CtlStrip10Bytes
CtlStrip10Bytes ldy #10
jml $e10184 ;ToStrip
export CtlGetHandle
CtlGetHandle
@ctlID equ 9
@windPtr equ @ctlID+4
pha
pha
pei <@windPtr+2
pei <@windPtr
pei <@ctlID+2
pei <@ctlID
_GetCtlHandleFromID
ply
plx
rts
ENDP
**********************************************************************
*
* $3D10 GetCtlValueByID -- added 15-Jul-92 DAL
*
* Inputs:
* Space for result (WORD)
* Window Pointer (LONG)
* Control ID (LONG)
*
**********************************************************************
GetCtlValueByID PROC EXPORT
import CtlGetHandle
phd
tsc
tcd
@ctlID equ 9
@windPtr equ @ctlID+4
@result equ @windPtr+4
stz <@result
jsr CtlGetHandle ;into XY
bcs @error
pha
phx
phy
_GetCtlValue
plx
stx <@result
@error tax
pld
export CtlStrip8Bytes
CtlStrip8Bytes ldy #8
jml $e10184 ;ToStrip
ENDP
**********************************************************************
*
* $3E10 InvalOneCtlByID -- added 15-Jul-92 DAL
*
* Inputs:
* Window Pointer (LONG)
* Control ID (LONG)
*
**********************************************************************
InvalOneCtlByID PROC EXPORT
import CtlStrip8Bytes,CtlGetHandle
phd
tsc
tcd
@ctlID equ 9
@windPtr equ @ctlID+4
jsr CtlGetHandle
bcs @error
@handle equ @ctlID ;re-use our direct page space
@ptr equ @windPtr
stx <@handle+2
sty <@handle
ldy #4
lda [<@handle],y
pha
ora #$8000
sta [<@handle],y
dey
dey
lda [<@handle],y
sta <@ptr+2
lda [<@handle]
sta <@ptr
pha
pha
_GetPort
ldy #6 ;offset to ctlOwner+2
lda [<@ptr],y
pha
dey
dey
lda [<@ptr],y
pha
_SetPort
ldx <@ptr+2
lda <@ptr
adc #8
bcc @1
inx
@1 phx
pha
_InvalRect
_SetPort
ldy #4
pla
sta [<@handle],y ;unlock handle
lda #0 ;no error
@error tax
pld
bra CtlStrip8Bytes
ENDP
**********************************************************************
*
* $3F10 HiliteCtlByID -- added 15-Jul-92 DAL
*
* Inputs:
* Hilite (WORD)
* Window Pointer (LONG)
* Control ID (LONG)
*
**********************************************************************
HiliteCtlByID PROC EXPORT
import CtlStrip10Bytes,CtlGetHandle
phd
tsc
tcd
@ctlID equ 9
@windPtr equ @ctlID+4
@Hilite equ @windPtr+4
jsr CtlGetHandle ;into XY
bcs @error
pei <@Hilite
phx
phy
_HiliteControl
@error tax
pld
brl CtlStrip10Bytes
ENDP
;====================================================================
;
; Set2Draw
;
; Set to draw control.
;
; IN: Ctlhand = handle of control.
; Ctlptr = pointer to control.
;
;====================================================================
set2draw PROC EXPORT
pei <work+2 Save.
pei <work
;
jsr to_wport Switch to window's port.
;
;
; --- Get window's vis RECT to not draw controls that aren't visible -------
;
pha Space for result.
pha
_GetVisHandle Get handle of window's visRgn.
pla
sta <work
pla
sta <work+2
;
ldy #2 Dereference handle,
lda [<work],y
tay
lda [<work]
clc
adc #2 and add offset to bounds RECT.
bcc store1
iny
store1 sta <work
sty <work+2
;
ldy #x2 Clone visRgn's bounds RECT.
ldx #visRect+x2
lop1 lda [<work],y
phy
txy
sta [<data],y
ply
dex
dex
dey
dey
bpl lop1
;
pla Restore.
sta <work
pla
sta <work+2
rts
ENDP
;====================================================================
;
; DrawWholeCtl
;
;====================================================================
drawWholeCtl PROC
stz <param Draw entire control.
;---------------------------------------------------------------
;
; IN: param = 0 to draw entire control, or part code to draw.
;
;---------------------------------------------------------------
ENTRY drawCtl
drawCtl ;
stz <param+2
;
jsr dereference Ctlptr = (Ctlhand).
;
ldy #CtlFlag Is control visible?
lda [<Ctlptr],y
and #Ctl_INVIS
bne exit
;
jsr CMsetrect Put enclosing RECT into 'rect'.
;
ldy #CtlProc+2 Special case simple buttons.
lda [<ctlptr],y
and #$7FFF Mask off high bit just in case this is a super control
dey
dey
ora [<ctlptr],y
bne ok1
;
ldy #CtlFlag
lda [<ctlptr],y
and #SB_BOLD
beq ok1
;
jsr expandButt Expand the enclosing RECT.
;
ok1 lda <rect+y1
bmi skip1
ldy #visRect+y2
cmp [<data],y
bcs exit
;
skip1 lda <rect+x1
bmi skip2
ldy #visRect+x2
cmp [<data],y
bcs exit
;
skip2 ldy #visRect+y1
lda [<data],y
bmi ok2
lda <rect+y2
bmi exit
ldy #visRect+y1
cmp [<data],y
bcc exit
;
ldy #visRect+x1
lda [<data],y
bmi ok2
lda <rect+x2
bmi exit
ldy #visRect+x1
cmp [<data],y
bcs ok2
exit rts
;
ok2 jsr set2drawCtl Setup to draw the control.
;
ldx #drawCntl Draw task number.
brl CMDispatch2 Call definition procedure.
ENDP
;====================================================================
;
; Set2DrawCtl
;
; Setup to draw a control.
;
; IN: <ctlHand = handle of control.
;
; OUT: <param = 0 to draw entire control, state = 0.
; part code to draw just that part of the control.
;
; state = 0 to draw part in 'param' as unhighlighted.
; 2 to draw part in 'param' as highlighted.
;
; active = $0000 if control is active.
; $FFFF if control is inactive, param = 0.
;
;
; Change History
;
; 06 Oct 88 Steven Glass
;
; The active flag used by built in defProcs is in the global data
; area rather passed to the defproc. This made it hard for
; custom defProcs to do the right thing. So we also put
; the flag in the hi-word of the param sent with the draw message
;
;====================================================================
set2drawCtl PROC EXPORT
jsr dereference Ctlptr = (Ctlhand).
;
lda #0
ldy #active Set active flag.
sta [<data],y
ldy #state Set unhighlighted flag.
sta [<data],y
stz <param+2 Zero this to indicate that control not inactive
;
jsr get_wptr Get control's window pointer.
ldy #owFrame
lda [<windptr],y
and #F_HIGHLT+F_Ctl_TIE Is owner window active?
beq inactive If not, control can't be either.
;
ldy #CtlHilite
lda [<Ctlptr],y
and #$00FF
cmp #255 Active?
bne skip
;
inactive ldy #active Set inactive flag.
lda #$FFFF
sta [<data],y
sta <param+2
stz <param Draw entire control as inactive.
bra ready
;
Skip tax Hilite a part?
beq ready
;
sta <param Store part to hilite in 'param'.
;
ldy #state Set highlight flag.
lda #2
sta [<data],y
;
;
; --- Do some more, common setups ----------------------
;
Ready jsr CMsetrect Put enclosing RECT into 'rect'.
;
;
; No longer do we setup the ref to color table! SEG 19 Feb 89
; jsr setupColor
;
_PenNormal ; so call pen normal directly
;
; End 19 Feb change.
;
bra setvertpen Set pen size to vert_pen,1.
; = = = = = = = = = = = = = = = = = = = = = = = = = = =
; Set pen size to:
; width = vert_pen.
; height = 1.
; = = = = = = = = = = = = = = = = = = = = = = = = = = =
; ENTRY SetVertPen
setvertpen proc export
;
jsr pushVvert_pen
pea 1
_SetPenSize
rts
; = = = = = = = = = = = = = = = = = = = = = = = = = = =
; Draw a line from the current
; pen position, to the given point.
;
; IN: y = y coordinate.
; x = x coordinate.
;
; = = = = = = = = = = = = = = = = = = = = = = = = = = =
; ENTRY drawto
drawto proc export
;
phx
phy
_LineTo
rts
; = = = = = = = = = = = = = = = = = = = = = = = = = = =
; Indent 'rect'.
;
; IN: a = number of lines to indent.
;
; = = = = = = = = = = = = = = = = = = = = = = = = = = =
ENTRY indent
indent ;
;
pha
;
clc
adc <rect+y1
sta <rect+y1
;
lda 1,s
clc
adc <rect+x1
sta <rect+x1
;
lda <rect+y2
sec
sbc 1,s
sta <rect+y2
;
lda <rect+x2
sec
sbc 1,s
sta <rect+x2
;
pla
rts
;
ENDP
;====================================================================
;
; GrowSize
;
; Return the size of a standard grow box.
;
; IN: None.
;
; OUT: LONG - low order = height.
; high-order = width.
;
;====================================================================
GrowSize PROC
grow_h equ inputs
grow_w equ grow_h+2
;
;
cmp #0 Special Kludge for people who
bne GoOn open windows before initing ctlmgr.
cpy #0 Instead of dying, we just return.
bne GoOn (Window mgr calls this even when
lda #$1002 window has no controls.)
sec
rtl
GoOn ;
;
jsr CMStartup Do tool function setups.
;
ldx #GROW_ICON
jsr get_csize Get height and width of grow icon.
;
ldy #rect2+y2 Icon height,
lda [<data],y
clc
adc #4 plus leading.
sta <grow_h equals box's height.
;
ldy #rect2+x2 Icon width,
lda [<data],y
clc
adc #8 plus leading,
sta <grow_w equals box's width.
;
exit ldy #0 No error flag.
brl CMpop0bytes
ENDP
;
; APPEND CTRACK.ASM
;
;====================================================================
;
; TrackControl
;
; Track mouse in a control.
;
; IN: PUSH:WORD - x starting position, in global.
; PUSH:WORD - y starting position, in global.
; PUSH:LONG - address of action routine.
; PUSH:LONG - handle of control.
; Current port is control's window port.
;
; OUT: WORD - part code selected, or zero if none.
;
;
; Change History
;
; 21 Nov 88 Steven Glass
;
; Changed the way the ctlDrag message is used when control has
; part code > $80. If the control is a super control, the high
; word of the result from defProc call is the part code to return
; to caller. This allows us to return no part code if the
; user pulls his mouse out of the control before releasing
; the button.
;
;====================================================================
TrackControl PROC
match equ work Place to store part I'll be watching.
control equ inputs
action equ control+4
starty equ action+4
startx equ starty+2
RetCode equ startx+2 Place to store current part
; (either what's in 'match' or zero).
;
;
jsr CMStartup Do setup for tool call.
;
jsr getCtlHand Get passed control handle.
bcc ok1 Null handle passed?
brl CMpop12bytes
;
ok1 stz <RetCode Start with no part found.
stz <match
;
jsr to_wport Save port and switch to window's.
jsr pushPort Save the current port.
;
;
; --- Convert starting point to local -----------------------
;
ldx <startx
lda <starty
jsr to_local
;
jsr testpart We have to start on a part.
sta <match Save starting part.
bne ck_indic Did we start on a part?
brl exit If not, I'm done.
;
ck_indic tax Save part code in x.
and #$0080 Is the part an indicator?
bne indicator If yes, different tracking method.
;
;
; --- Track LOOP -----------------------------------------------------
;
; ------ Find out what part the cursor is currently over -------------
;
track_loop jsr ckhit Check hit on part, save state, draw.
;
lda <RetCode Is the part currently selected?
beq skip1
;
sta <param Pass part code.
stz <param+2
jsr do_action Call action procedure.
;
skip1 jsr getratpos Get current mouse position.
;
jsr ckbutton2 Check if button has been released.
bcs track_loop Continue to track if still down.
;
sta <yrat
stx <xrat
jsr ckhit Perform check at position of up event.
;
;
; --- Selection made, unhighlight part if needed -----------
;
lda <RetCode Not needed if zero.
beq exit1 Tell action proc it's out of part.
;
lda #0 Unhilite flag.
jsr setstate Unhilite the control part.
bra exit All done, exit TrackControl.
;
;
;
;
;
;
; One-Way Code, we pass through here only once per event.
;
; --- Track indicator ----------------------------------------------
;
; ------ Ask control to drag its indicator -------------------------
;
indicator stx <RetCode Return part code.
;
ldy #0 (High word of LONG parameter.)
txa Pass part code to drag routine.
ldx #dragCntl
jsr CMDispatch
pha Save low word of return
cmp #0 If not handled, treat as not super
beq @NotSuper
ldy #ctlProc+2 See if this is a super control
lda [<ctlPtr],y
bpl @NotSuper No, not a super control
stx <RetCode Yes, make this the part code
@NotSuper pla Now, check to see if we do default dragging?
bne exit
;
;
; --------- Perform default indicator drag -------------------------
;
jsr pushlimit_blk
pla Pass pointer to parameter block
ply
ldx #thumbCntl Ask defProc to compute parameters.
jsr CMDispatch Call control.
tax Execute default setup?
bne call_drag
;
jsr setup_drag Perform default setup for dragging.
;
;
; --- Call DragRect ------------------------------------------------
;
call_drag jsr get_dragrect Compute drag RECT.
;
pha Space for return deltas.
pha
lda #0 Address of action procedure, none.
pha
pha
jsr pushVdrag_patt Pass to drag outline pattern.
pei <xrat Pass starting point.
pei <yrat
jsr pushdrag_rect Pass pointer to RECT to drag.
jsr pushbound_rect Pass pointer to bounds RECT.
jsr pushslop_rect Pass pointer to slop RECT.
jsr pushVaxis_param Pass movement axis parameter.
_DragRect
pla Get Y delta.
sta <param
pla Get X delta.
sta <param+2
ora <param Was there any change?
beq exit If not, I'm done.
;
;
; --- Reposition indicator -----------------------------------------
;
ldx #posCntl Ask defProc to compute new value,
jsr CMDispatch2 and redraw control.
tax Perform default reposition?
bne exit1
;
jsr reposition Perform default reposition.
;
exit1 jsr do_action Call action routine about change.
;
exit jsr popPort Restore the current port.
;
exit2 ldy #0 No error flag.
brl CMpop12bytes
;
;
; = = = = = = = = = = = = = = = = = = = = = =
; Check hit on part.
;100= = = = = = = = = = = = = = = = = = = = =
;
ckhit ;
;
lda <yrat Find part under cursor.
ldx <xrat
jsr testpart
beq ck_hilite Over a part?
;
cmp <match Has to be the same as the starting part.
beq ck_hilite
lda #0 Force it to 'out of part'.
;
;
; ------ Highlight/Unhighlight the part as needed --------------------
;
ck_hilite cmp <RetCode As state of part changed?
beq exit100
;
sta <RetCode Save new state.
brl setstate Draw the part in its new state.
;
exit100 rts
;
;
; = = = = = = = = = = = = = = = = = = = = = = = = = = = =
; Push a pointer to inside a record.
;110= = = = = = = = = = = = = = = = = = = = = = = = = = =
;
; IN: Ctlptr = pointer to record.
; a = offset into the record.
;
; OUT: pointer on stack.
;
; export pushrecord
pushrecord proc export
;
ply Get return address.
;
ldx <Ctlptr+2
clc
adc <Ctlptr
bcc ok110
inx
ok110 phx
pha
;
phy Return address back.
rts
;
;
;====================================================================
; Call action procedure.
;
; action = value passed to TrackControl.
; CtlAction = value in control's record.
; autoTrack = control's definition procedure's action command.
;
; If action = 0 then quit, perform no action.
; If action = -1 then
; {
; If CtlAction = 0 then quit, perform no action.
; If CtlAction = -1 then
; Call autoTrack in the control's definition procedure.
; Else
; Call CtlAction.
; }
; Else
; Call action.
;
;120=================================================================
do_action proc export ;made into proc, 8-Dec-91 for TS3
*** duplicate equates, 8-Dec-91 DAL
control equ inputs
action equ control+4
starty equ action+4
startx equ starty+2
RetCode equ startx+2 Place to store current part
; (either what's in 'match' or zero).
*** end 8-Dec-91
lda <action Perform no action?
ora <action+2
beq exit120
;
lda <action+2
bpl use_action If negative, call defProc for autoTrack.
;
; ------------ Check CtlAction for path to take ---------------------
;
jsr dereference Ctlptr = (Ctlhand).
ldy #CtlAction
lda [<Ctlptr],y
iny
iny
ora [<Ctlptr],y Is CtlAction zero?
beq exit120 If yes, perform no action.
;
lda [<Ctlptr],y
bpl use_Ctl
;
; ----------------- Call defProc's action routine -------------------
;
ldx #autoTrack Part code already in param.
brl CMDispatch2
;
;
; ----------------- Call CtlAction ---------------------------------
;
use_Ctl dey
lda [<Ctlptr],y
tax
ldy #CtlAction
lda [<Ctlptr],y
bra makecall
;
;
; ----------------- Use action routine passed to TrackControl --------
;
use_action ldx <action+1
lda <action
;
;
; --------- Call action routine that was passed to _TrackControl -----
;
makecall tay Pass address in X and Y.
;
;
pei <ctlhand+2 Save control's handle.
pei <ctlhand
phd Save my zero page.
;
;
pha Space for dummy return value,
; to make some apps run.
pei <RetCode Pass part code.
pei <Ctlhand+2 Pass handle of control.
pei <Ctlhand
;
lda <saveDirect Restore caller's direct page.
tcd
;
tya Pass low byte in A.
jsl long_call
;
pla Get dummy return value (not used).
;
pld Restore my zero page.
pla Restore control's handle.
sta <ctlhand
pla
sta <ctlhand+2
brl dereference Ctlptr = (Ctlhand).
;
exit120 rts
; = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
; Find part at given point
;
; IN: a = y coordinate.
; x = x coordinate.
; <ctlHand = handle of control.
;
; OUT: Equal flag TRUE if no part found.
; Else
; a = part code found at given point, or zero if none found.
;
;130= = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
ENTRY testpart
testpart ;
sta <param Pass y point.
stx <param+2 Pass x point.
jsr dereference Ctlptr = (Ctlhand).
ldy #CtlFlag Control has to be active and visible.
lda [<Ctlptr],y
and #Ctl_INVIS
bne noPart130 Visible?
;
iny
lda [<Ctlptr],y
and #$00FF
cmp #C_HILITE Active?
bne ok130
noPart130 lda #0 No part
rts
;
ok130 ldy #CtlRect Is point in enclosing RECT?
jsr check_pt
beq exit130 Don't check part if not in control.
;
ldx #testCntl Call defProc to test for part.
jsr CMDispatch2
;
tay Set return flag.
exit130 rts
; = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
;
; Set state of control.
;
; IN: a = part code to highlight, or zero to unhighlight last highlighted.
;
;150= = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
ENTRY setstate
setstate ;
pha Pass part code to highlight.
pei <Ctlhand+2 Pass handle of control.
pei <Ctlhand
_HiliteControl Change control highlight and draw.
;
brl dereference
;
;
; = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
;; Check if button is stil down.
;
; OUT: Carry set if button still down.
; Carry clear if button has been released, a=y pos, x=x pos.
;
;
; Change History
;
; 09 Apr 89 Steven Glass & James P. Mensch
;
; Simplified check for mouse coming up when we think it
; should be down. Prevents leaving a mouse up in queue.
;
;160= = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
ENTRY ckbutton2
ckbutton2 ;
pha
pea 4 Looking only for button up.
jsr pushmyevent Pass pointer to event record.
_GetNextEvent
pla
bne getevent
;
;
; --- Button has not come up yet, but double check ----------------------
;
ldy #MyEvent+modif Read modifiers from event
lda [<Data],y
and #Btn0State Look only at button 0 state (Sense is weird)
bne GetEvent Button is up, treat like got event.
sec Return 'still down flag'.
rts
;
;
; --- Button up event, use position of event -------------------------------
;
getevent jsr pushmyeventpos
_GlobalToLocal
;
exit160 ldy #myevent+where+x1 Return position of button up.
lda [<data],y
tax
dey
dey
lda [<data],y
clc Button up flag.
rts
; = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
;
; Get current mouse position.
;
; OUT: yrat = mouse y position.
; xrat = mouse x position.
;
;170= = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
ENTRY getratpos
getratpos ;
lda #yrat
;
ENTRY getratpos2
getratpos2 ;
jsr pushzpage
_GetMouse
rts
;
ENDP
;====================================================================
; Long call.
;
; IN: x = middle WORD (bits 8-23) of address of destination routine.
; a = low WORD of address of destination routine.
;
; OUT: Calling this routine is the same as:
;
; jsl (ax)
;
; where the low byte in 'a' is the low byte of the destination
; address, and x = the next 2 bytes of the destination address.
;
;====================================================================
long_call PROC EXPORT
phx High and middle byte on stack
phb extra byte on stack
dec a low and middle := xxx -1
sta 1,s overstore on stack
rtl hello
;
; When the routine called returns, it
; will return to the routine that called 'longCall', not here.
;
ENDP
;====================================================================
;
; Move a control to a new position.
;
; IN: PUSH:WORD - new x origin of control.
; PUSH:WORD - new y origin of control.
; PUSH:LONG - handle of control to move.
;
; OUT: Nothing.
;
;====================================================================
MoveControl PROC
CtlHandle equ inputs
new_y equ CtlHandle+4
new_x equ new_y+2
;
;
jsr CMStartup Do setup for tool call.
;
jsr getCtlHand Get passed control handle.
bcs exit Null handle passed?
;
ldy #4 Lock the control.
lda [<ctlHand],y
ora #$8000
sta [<ctlHand],y
;
;
; --- Erase the control if visible ---------------------------
;
ldy #CtlFlag Is control visible?
lda [<Ctlptr],y
and #Ctl_INVIS
pha Save starting state.
bne skip1
;
pei <Ctlhand+2
pei <Ctlhand
_HideControl Erase the control.
;
;
; --- Move the control --------------------------------------
;
skip1 lda #CtlRect Pass pointer to enclosing RECT.
jsr pushrecord
lda <new_x
ldy #CtlRect+x1
sec
sbc [<Ctlptr],y
sta <new_x Save delta x.
pha
lda <new_y
dey
dey
sec
sbc [<Ctlptr],y
sta <new_y Save delta y.
pha
_OffsetRect Move the enclosing RECT.
;
ldy <new_x Pass X delta.
lda <new_y Pass Y delta.
ldx #moveCntl Tell defProc that the control has moved.
jsr CMDispatch and redraw control.
;
;
; --- Draw the control at its new position if it was visible -----------
;
pla Was the control visible?
bne exit
;
pei <Ctlhand+2
pei <Ctlhand
_ShowControl
;
exit ldy #4 Unlock control.
lda [<ctlHand],y
and #$7FFF
sta [<ctlHand],y
;
ldy #0 No error flag.
brl CMpop8bytes
ENDP
;====================================================================
;
; Find a control at a given point.
;
; IN: PUSH:LONG - address of where to store handle of found control.
; PUSH:WORD - x point to check.
; PUSH:WORD - y point to check.
; PUSH:LONG - pointer to window.
; Current port is window's port.
;
; OUT: WORD - part code found at given point, zero if none found.
;
;====================================================================
FindControl PROC
window equ inputs
ypoint equ window+4
xpoint equ ypoint+2
storehand equ xpoint+2
RetPart equ storehand+4
;
;
jsr CMStartup Do setup for tool call.
;
stz <RetPart Start with no part found.
;
jsr getWindPtr Get given window pointer.
bcs exit2 Any errors?
;
;
; --- Switch to control's window port --------------------------
;
jsr to_wport
;
;
; --- Convert given point to local ------------------------------
;
ldx <xpoint
lda <ypoint
jsr to_local
sta <ypoint
stx <xpoint
;
;
; --- Check all controls in list -----------------------------
;
stz <ctlhand Start with last control in list.
stz <ctlhand+2
jsr findPrivCtl ctlhand = last control in list.
; ctlptr = (ctlhand)
;
lop1 ldx <xpoint
lda <ypoint
jsr testpart Ask control's DefProc to find part.
sta <RetPart
tax
bne exit Found a part?
jsr dereference Ctlptr = (Ctlhand).
;
next1 jsr findPrivCtl ctlhand, ctlptr = previous control.
bcc lop1 At top of list?
;
;
;
; --- Return to caller ----------------------------------
;
exit lda <Ctlhand Return pointer to control.
sta [<storehand]
ldy #2
lda <Ctlhand+2
sta [<storehand],y
;
exit2 ldy #0 No error flag.
brl CMpop12bytes
;
;
; = = = = = = = = = = = = = = = = = = = = = = = = = = =
; Find previsous control in list.
; = = = = = = = = = = = = = = = = = = = = = = = = = = =
;
; IN: windPtr = pointer to window that has control list.
; ctlhand = current control, zero for last in list.
;
; OUT: Carry clear if good control found.
; ctlhand = control previous to given control in control list.
; ctlptr = (ctlhand)
;
findPrivCtl ;
;
lda <ctlhand Save control to match.
sta <work
lda <ctlhand+2
sta <work+2
;
jsr getFirstCtl ctlhand = first control in window's list.
; ctlptr = (ctlhand).
;
lda <ctlhand Check if at top of list.
cmp <work
bne lop100
lda <ctlHand+2
cmp <work+2
beq exit100 Carry set, at top of list.
;
lop100 lda [<ctlptr] Handle of next control.
cmp <work Is the next control the given handle?
bne next100
ldy #CtlNext+2
lda [<ctlptr],y
cmp <work+2
clc
beq exit100 If yes, then previous control found.
;
next100 jsr next_ctl Check next control in list.
bne lop100 Any more controls in list?
sec !!!Should never happen!!!!
;
exit100 rts
;
ENDP
;
;
;====================================================================
;
; Convert a point to
; local coordinates.
;
; IN: a = y point.
; x = x point.
;
; OUT: a = y point in local.
; x = x point in local.
;
;====================================================================
to_local PROC
sta <yrat Save point.
stx <xrat
;
jsr pushyrat Pass pointer to point.
_GlobalToLocal
;
lda <yrat Return converted point.
ldx <xrat
rts
ENDP
;====================================================================
;
; Find a control part at a given point.
;
; IN: PUSH:WORD - x point, in local coordinates, to check.
; PUSH:WORD - y point, in local coordinates, to check.
; PUSH:LONG - pointer to control (control list).
;
; OUT: WORD - part code found at given point, zero if none found.
;
; Parts are searched from bottom of list to top, as they appear on screen.
;
;====================================================================
TestControl PROC
control equ inputs
ypoint equ control+4
xpoint equ ypoint+2
RetPart equ xpoint+2
;
;
jsr CMStartup Do setup for tool call.
;
jsr getCtlHand Get passed control handle.
bcs exit Null handle passed?
;
ldx <xpoint Pass point to check.
lda <ypoint
jsr testpart
sta <RetPart
;
exit ldy #0 No error flag.
brl CMpop8bytes
ENDP
;====================================================================
;
; Drag a control.
;
; IN: PUSH:WORD - starting x coordinate, in local.
; PUSH:WORD - starting y coordinate, in local.
; PUSH:LONG - pointer to RECT that is bounds of movement, in local.
; PUSH:LONG - pointer to RECT that is cusor limit, in local.
; PUSH:WORD - movement constraint.
; PUSH:LONG - handle of control.
;
; OUT: None.
;
;====================================================================
DragControl PROC
theControl equ inputs
axis equ theControl+4
slop equ axis+2
limit equ slop+4
starty equ limit+4
startx equ starty+2
;
;
jsr CMStartup Do setup for tool call.
;
jsr getCtlHand Get passed control handle.
bcs exit Null handle passed?
;
;
; --- Ask control to drag control ---------------------------
;
ldy #0 Drag whole control flag.
tya
ldx #dragCntl
jsr CMDispatch
tax Do default dragging?
bne exit
;
;
; ------ Perform default drag --------------------------------
;
stz <param Drag whole control flag.
jsr get_dragrect Ask control to compute drag RECT.
;
;
; --------- Call drag RECT -----------------------------------------
;
pha Space for result.
pha
lda #0 No action routine.
pha
pha
ldy #$00F0 Solid drag pattern.
jsr set_patt
phx
phy
pei <startx Pass starting point.
pei <starty
jsr pushdrag_rect Pass address of RECT to drag.
pei <limit+2
pei <limit
pei <slop+2
pei <slop
pei <axis
_DragRect
pla Get delta y.
sta <work
pla Get delta x.
sta <work+2
ora <work Was there any movement?
beq exit
;
;
; --- Now move control to it's new spot ---------------------
;
jsr dereference Ctlptr = (Ctlhand).
;
ldy #CtlRect+x1 Compute new origin and pass it.
lda [<Ctlptr],y
clc
adc <work+2
pha
dey
dey
lda [<Ctlptr],y
clc
adc <work
pha
pei <Ctlhand+2 Pass handle of control.
pei <Ctlhand
_MoveControl
;
;
exit ldy #0 No error flag.
brl CMpop18bytes
ENDP
;====================================================================
;
; Ask control to compute drag RECT.
;
; IN: param = zero for whole control, nonzero for part.
;
; OUT: drag_rect = RECT to drag, in local coordinates.
;
;====================================================================
get_dragrect PROC
jsr pushdrag_rect
;
lda <param Whole control?
beq ok1
;
lda 3,s Get high word of address,
ora #$8000 Set 'just the part' flag.
sta 3,s
;
ok1 pla Get pointer to drag_rect with high bit
ply set correctly.
;
;
; a = low word of where to store RECT.
; y = high word of where to store RECT,
; high bit clear for whole control,
; high bit set for control part.
;
ldx #calcCRect
jsr CMDispatch Call control.
tax
bne exit Default?
;
;
; ------ Use default drag RECT -------------------------------------
;
jsr dereference Ctlptr = (Ctlhand).
ldy #CtlRect Whole control.
lda <param+2 Indicator or whole control?
bpl ok2
ldy #Thumb Just the indicator.
ok2 ldx #drag_rect
lop1 lda [<Ctlptr],y
phy
txy
sta [<data],y
ply
iny
iny
inx
inx
cpx #drag_rect+8
bne lop1
;
exit rts
ENDP
;====================================================================
;
; CallDefProc
;
; Calls a controls defproc with the specified inputs.
;
; IN: PUSH:LONG - Space for result
; PUSH:LONG - Control Handle
; PUSH:WORD - Message to Send
; PUSH:LONG - Value for Param
;
; OUT: PULL:LONG- Result from DefProc.
;
; Change History
;
; 03 Oct 88 Steven Glass
;
; New today
;
; 06 Oct 88 Steven Glass
;
; Cannot use GetCtlHandle because it expects the handle
; at Inputs on zero page.
;
;====================================================================
CallDefProc PROC
TheParam equ inputs
TheMessage equ TheParam+4
TheControl equ TheMessage+2
TheResult equ TheControl+4
;
;
jsr CMStartup Do tool function setup.
;
lda TheControl,s
sta ctlHand
lda TheControl+2,s
sta ctlHand+2
jsr Dereference
;
jsr set2draw Setup to draw standard controls.
jsr pushPort Save the current port.
jsr set2drawCtl Setup to draw the control.
;
lda <TheParam Pass new view and data sizes.
ldy <TheParam+2
ldx <TheMessage Task number.
jsr CMDispatch
sta TheResult
stx TheResult+2
jsr popPort Restore the current port.
;
exit ldy #0 No error flag.
brl CMpop10bytes
ENDP
title 'Param Text Routines'
;====================================================================
;
; SetCtlParamPtr
;
; Puts the indicated pointer into the global data area.
;
; IN: PUSH:LONG - Pointer to sub array
;
; OUT: none.
;
; Change History
;
; 21 Oct 88 Steven Glass
;
; New today
;
;====================================================================
SetCtlParamPtr PROC
ThePtr equ inputs
jsr CMStartup Do tool function setup.
lda ThePtr
ldy #ParamTextPtr
sta [<data],y
iny
iny
lda ThePtr+2
sta [<data],y
ldy #0 No error flag.
brl CMpop4bytes
ENDP
;====================================================================
;
; GetCtlParamPtr
;
; Returns the paramtext pointer from the global data area.
;
; IN: PUSH:LONG - space for pointer
;
; OUT: PULL:LONG - pointer to current substitution array.
;
; Change History
;
; 21 Oct 88 Steven Glass
;
; New today
;
;====================================================================
GetCtlParamPtr PROC
ThePtr equ inputs
jsr CMStartup Do tool function setup.
ldy #ParamTextPtr
lda [<data],y
sta ThePtr
iny
iny
lda [<data],y
sta ThePtr+2
ldy #0 No error flag.
brl CMpop0bytes
ENDP
title 'Dispatching Code'
;====================================================================
;
; CMDispatch task.
;
; IN: x = task.
; Ctlptr = pointer to control.
; a = param.
; y = param+2.
;
; OUT: a = low word of returned value.
; x = high word of returned value.
;
;
; Change History
;
; 05 Oct 88 Steven Glass
;
; Major changes to support super controls.
;
; 11 Oct 88 Steven Glass
;
; Make this routine patchable.
;
; 24 Oct 88 Steven Glass
;
; Added calls to TextEdit and Menu Manager. Simplified code for
; new builtin procs.
;
; 10 Feb 89 Steven Glass
;
; Changed code that calls load resource so that it will load
; not use an id with the high bit set (not valid for the resource
; manager.)
;
;====================================================================
CMDispatch PROC EXPORT
sta <param
sty <param+2
;
;
ENTRY CMDispatch2
CMDispatch2 ;
;
; IN: param = additional parameter.
;
phx Save.
ldx #oCMDispatcher
jml ToolboxPatcher
EXPORT RealCMDispatcher
RealCMDispatcher
jsr dereference Ctlptr = (Ctlhand).
;-----------------------------------------------------------
;
; See if this is a super control. If it is, there can
; be more work to do. Otherwise, go the old way.
;
ldy #NewCtlRecord.CtlProc+2
lda [ctlPtr],y
bpl DoOldWay
;-----------------------------------------------------------
;
; It is a super control. Must see if we have pointer to
; defproc or an ID.
;
clc Assume that it is a pointer
ldy #NewCtlRecord.ctlMoreFlags Now, look and see what it really is
lda [ctlPtr],y
and #FctlProcRefNotPtr
beq ItsAPtr
sec its a resource
ItsAPtr ldy #NewCtlRecord.CtlProc+2 Get reference into a & y
lda [ctlPtr],y with message in x.
tax
dey
dey
lda [ctlPtr],y
txy
plx
bcs CallByThisID
bra CallByThisPtr
DoOldWay
plx Restore.
ldy #CtlProc Is this a custom control?
lda [<Ctlptr],y
bne do_custom
iny
lda [<Ctlptr],y
bne do_custom
;
;
; --- Call a standard control definition procedure --------------
;
iny
lda [<Ctlptr],y Get control number.
;
EXPORT standardDispatch
standardDispatch ;
;
phx Save task number.
and #$7FFF ; Clear off super control bit.
xba Get standard defProc number into low byte.
tax Put index into X.
pla Put task number into A.
jmp (my_procs,x) Get address of standard procedure.
;
my_procs DC.W simp_proc Simple button procedure.
DC.W check_proc Check box procedure.
DC.W radio_proc Radio button procedure.
DC.W scroll_proc Scroll bar procedure.
DC.W grow_proc Grow box procedure.
;
;
; --- Call a custom control definition procedure ----------------
;
do_custom phx Save task number.
ldy #CtlProc+1 Get address of defProc.
lda [<Ctlptr],y
tax
dey
lda [<Ctlptr],y
ply Get task number.
;
;
; IN: y = task number.
; a = bytes 0 and 1 of defProc address.
; x = bytes 1 and 2 of defProc address.
; param = additional parameters.
;
ENTRY customDispatch
customDispatch ;
;
pei <Ctlhand+2 Save current handle of control.
pei <Ctlhand
;
pha Space for return value.
pha
;
phy Pass task number.
;
pei <param+2 Pass additional parameters.
pei <param
;
pei <Ctlhand+2 Pass control's handle.
pei <Ctlhand
;
jsl long_call Call custom defProc.
pla Get return values.
plx
;
ply Restore Ctlhand.
sty <Ctlhand
ply
sty <Ctlhand+2
;
rts
;-----------------------------------------------------------
;
; CallByThisPtr
;
; Inputs:
; a-reg low word of procPtr
; y-reg high word of procPtr
; x-reg message to send
;
Export CallByThisPtr
CallByThisPtr
phx Put message on stack
phy put high word on stack
pha put low word on stack
lda 2,s get middle and high bytes into x
tax
pla get low back into a
ply ignore high word
ply message into y
bra CustomDispatch
;-----------------------------------------------------------
;
; CallByThisID
;
; Inputs:
; a-reg low word of ID
; y-reg high word of ID
; x-reg message to send
;
; this routine has to see if the ID is one of our special
; ID's or if it is a normal resource ID.
;
; The special IDs have the low three bytes set to zero.
; These include the original defprocs as well as
; new built in defprocs and some new standard non
; build in defprocs.
;
Export CallByThisID
CallByThisID
phx Save message
phy save ID
pha
lda 1,s Is low word 0
bne NotSpecial no
lda 2,s Is middle word 0
bne NotSpecial no
lda 4,s Yes
and #$007F Clear super ctl bit
cmp #LastSpecial+1 Is it in range?
bcs NotSpecial no
asl a Use as index into table
tax
jmp (WhereTable,x)
WhereTable dc.w OldBuiltIn simpleButtonControl equ $80000000
dc.w DoStatText statTextControl equ $81000000
dc.w OldBuiltIn checkControl equ $82000000
dc.w ItsALineEdit LineEditControl equ $83000000
dc.w OldBuiltIn radioControl equ $84000000
dc.w ItsATextEdit TextEditControl equ $85000000
dc.w OldBuiltIn scrollBarControl equ $86000000
dc.w ItsAPopUp popUpControl equ $87000000
dc.w OldBuiltIn growControl equ $88000000
dc.w ItsAList listControl equ $89000000
dc.w NotSpecial not used???
dc.w NotSpecial iconButtonControl equ $8B000000
dc.w NotSpecial not used
dc.w DoPicture pictureControl equ $8D000000
LastSpecial equ (*-WhereTable)>>1
;-----------------------------------------------------------
;
; NotSpecial
;
; Inputs: (on stack)
; Msg : WORD
; ID : LONG
;
; We get here if we have to load the defProc's code resource
;
NotSpecial
plx Get ID into a & X
pla
and #$7FFF Ignore super control bit
ply Get message into y
pha Put four bytes on stack for use below
pha
PushWord #rCtlDefProc Push rType and ID for
pha later
phx
phy Save Message
pha Space for result
pha
PushWord #rCtlDefProc
pha
phx
jsr LoadCodeResource
lda 2,s put middle word into x
tax
pla low word into a
ply ignore high word
ply message
jsr CustomDispatch
sta 7,s put result back into
txa space on stack reserved above
sta 9,s
jsr ReleaseResource (inputs on stack above)
pla return result in a & x
plx
rts
;-----------------------------------------------------------
;
; We get here if the Proc is an old style build in
; defproc. We set up the reg and xfer to Standard Dispatch
;
OldBuiltIn
pla low word of ProcRef
pla high word of ProcRef
plx Message
brl StandardDispatch
;-----------------------------------------------------------
;
; We get here if the control is a static text control.
;
; Stack is Msg
; id high
; id low
;
; So we setup the regs and branch to CustomDispatch.
;
DoStatText
ldx #>StatTextProc
lda #<StatTextProc
bra FinishUp
;-----------------------------------------------------------
;
; We get here if the control is a picture control
;
; Stack is Msg
; id high
; id low
;
; So we setup the regs and branch to CustomDispatch.
;
DoPicture ldx #>PicProc
lda #<PicProc
FinishUp ply
ply
ply
brl CustomDispatch
;-----------------------------------------------------------
;
; ItsAList
;
; We get here if the Proc supposed to be in the list manager.
;
; Inputs: (on stack)
; Msg : WORD
; ID : LONG
;
;
ItsAList
pha
pha
_GetListDefProc
bra JoinExternal
;-----------------------------------------------------------
;
; ItsAPopUp
;
; We get here if the Proc supposed to be in the menu manager.
;
; Inputs: (on stack)
; Msg : WORD
; ID : LONG
;
;
ItsAPopUp
pha
pha
_GetPopUpDefProc
bra JoinExternal
;-----------------------------------------------------------
;
; ItsATextEdit
;
; We get here if the Proc supposed to be in text edit.
;
; Inputs: (on stack)
; Msg : WORD
; ID : LONG
;
;
ItsATextEdit
pha
pha
_TEGetDefProc
bra JoinExternal
;-----------------------------------------------------------
;
; ItsALineEdit
;
; We get here if the Proc supposed to be the line edit
;
; Inputs: (on stack)
; Msg : WORD
; ID : LONG
;
;
ItsALineEdit
pha
pha
_GetLEDefProc
JoinExternal lda 2,s
tax
lda 1,s
ply
ply
ply low word of ProcRef
ply high word of ProcRef
ply Message
brl CustomDispatch
ENDP
**********************************************************************
*
CMLoadResource PROC EXPORT
*
* This is an external entry to the LoadResource call below.
*
* Inputs:
* HandleSpace : LONG
* Type : WORD
* ID : ID
*
* Outputs:
* ResourceHandle
*
*
**********************************************************************
DefineStack
OrigD word
RTL1 block 3
RTL2 block 3
TheID long
TheType word
TheHandle word
import GetAndSetPrefs
phd
tsc
tcd
*** added 15-Sep-91 DAL
jsr GetAndSetPrefs
pha
*** end 15-Sep-91
pha
pha
pei TheType
pei TheID+2
pei TheID
jsr LoadResource
pla
sta TheHandle
pla
sta TheHandle+2
*** added 15-Sep-91 DAL
pla
jsr SetPrefsToA
*** end 15-Sep-91
pld
ldx #0
ldy #6
jml ToStrip
EndP
;GetAndSetPrefs proc export
; pea $0000 ;space for old prefs
; pea $0001 ;pcount
; tsc
; inc a
; pea 0
; pha
; pea $200F ;GetSysPrefs
; jsl $e100b0
;
; lda 3,s ;old prefs
; ora #$C000 ;force vol-mount w/ no cancel
; and #$DFFF ;don't supress the dialog! (4-Dec-91 DAL)
; jsr SetPrefsToA
;
; pla
; pla ;A=old prefs value
; rts
;
; export SetPrefsToA
;SetPrefsToA pha ;new prefs value
; pea $0001 ;pcount
; tsc
; inc a
; pea 0
; pha
; pea $200C ;SetSysPrefs
; jsl $e100b0
; pla
; pla
; rts
*** changed 22-Mar-93 DAL
GetAndSetPrefs proc export
pha ;space for result
pea $2000 ;bits to clear (don't suppress dialog)
pea $C000 ;bits to set (force vol-mount, no cancel)
; _DoSysPrefs
ldx #$3f03
jsl $e10000
pla ;old preferences
rts
export SetPrefsToA
SetPrefsToA pha ;space for result
pea $FFFF ;bits to clear (all)
pha ;bits to set (input)
; _DoSysPrefs
ldx #$3f03
jsl $e10000
pla ;discard result
rts
*** end 22-Mar-93
ENDP
**********************************************************************
*
CMReleaseResource PROC
*
* This is an external entry to the ReleaseResource call below.
*
* Inputs:
* Type : WORD
* ID : ID
*
* Outputs:
* none
*
*
**********************************************************************
DefineStack
OrigD word
RTL1 block 3
RTL2 block 3
TheID long
TheType word
phd
tsc
tcd
pei TheType
pei TheID+2
pei TheID
jsr ReleaseResource
pld
ldx #0
ldy #6
jml ToStrip
ENDP
****************************************************************
*
LoadResource PROC EXPORT
*
* This is the single place we call LoadResource in the control
* manager. We use a single entry point to simplify error
* handling.
*
* The routine that needs LoadResource, pushes space for the result
* the type and id on the stack (just like making the tool call)
* and JSR's here.
*
* Any error results in a system death.
*
* Inputs:
* HandleSpace : LONG
* Type : WORD
* ID : ID
*
* Outputs:
* ResourceHandle
*
* External Refs:
* none
*
* Entry Points:
EXPORT LoadCodeResource
ENTRY CMDieHorribly
*
longa on ; mode
longi on
*
****************************************************************
DefineStack
TheOrigD WORD
TheRTS WORD
TheID LONG
TheType WORD
TheHandle LONG
phd
tsc
tcd
pha
pha
pei TheType
pei TheID+2
pei TheID
_LoadResource
bcs CMDieHorribly
pla
sta TheHandle
pla
sta TheHandle+2
GoodJob
pld
plx
pla
pla
pla
phx
rts
LoadCodeResource phd
tsc
tcd
*** added 8-Dec-91 DAL -- force prompt, no Cancel button
jsr GetAndSetPrefs
pha
*** end 8-Dec-91
pha
pha
pei TheType
pei TheID+2
pei TheID
_LoadResource
bcs CMDieHorribly
pla ; deref the handle and return the pointer
sta TheHandle
pla
sta TheHandle+2
*** added 8-Dec-91 DAL -- restore system preferences
pla
jsr SetPrefsToA
*** end 8-Dec-91 DAL
ldy #2
lda [TheHandle],y
tax
lda [TheHandle]
sta TheHandle
stx TheHandle+2
bra GoodJob
;-----------------------------------------------------------
;
; The load failed, so bring us all down!
;
RamToTrash equ $0002A0
CMDieHorribly
sta TheHandle
PushLong #DeathMsg
PushLong #RamToTrash
lda >DeathMsg
and #$00FF
inc a ;added 20-Nov-90 DAL
pea $0000
pha
_BlockMove
lda TheID
jsr HexIt
sta >RamToTrash+IDStart-DeathMsg+4
txa
sta >RamToTrash+IDStart-DeathMsg+6
lda TheID+2
jsr HexIt
sta >RamToTrash+IDStart-DeathMsg
txa
sta >RamToTrash+IDStart-DeathMsg+2
lda TheType
jsr HexIt
sta >RamToTrash+TypeStart-DeathMsg
txa
sta >RamToTrash+TypeStart-DeathMsg+2
pei TheHandle
PushLong #RamToTrash
_SysFailMgr
DeathMsg dc.b EndMsg-StartMsg
StartMsg dc.b 'Could not load/unload resource.',13
dc.b ' Type='
TypeStart dc.b ' .',13
dc.b ' ID='
IDStart dc.b ' .',13
dc.b ' Error='
EndMsg
HexIt pha
pha
pha
_HexIt
pla
plx
rts
ENDP
****************************************************************
*
ReleaseResource PROC EXPORT
*
* This is the single place we call LoadResource in the control
* manager. We use a single entry point to simplify error
* handling.
*
* The routine that needs LoadResource, pushes space for the result
* the type and id on the stack (just like making the tool call)
* and JSR's here.
*
* Any error results in a system death.
*
* Inputs:
* Type : WORD
* ID : ID
*
* Outputs:
* none
*
* External Refs:
import CMDieHorribly
*
* Entry Points:
*
longa on ; mode
longi on
*
****************************************************************
DefineStack
TheOrigD WORD
TheRTS WORD
TheID LONG
TheType WORD
phd
tsc
tcd
PushWord #$0003 ; purge level
pei TheType
pei TheID+2
pei TheID
_ReleaseResource
bcc GoodJob
jmp CMDieHorribly
GoodJob
pld
plx
pla
pla
pla
phx
rts
ENDP
TITLE 'Control Manager Utilities'
;====================================================================
;
; Push the contents of the current port.
;
;====================================================================
pushPort proc EXPORT
plx Get return address.
tsc Allocate space for port info.
sec
sbc #112
tcs
phx Put return address back.
;
jsr getSavePtr
;
ldy #110
lop1 lda [<work],y
sta [<work+4],y
dey
dey
bpl lop1
;
jsr popSave
rts
; = = = = = = = = = = = = = = = = = = = = = = = = =
; Put content of port off stack.
;100= = = = = = = = = = = = = = = = = = = = = = = =
;
EXPORT popPort
popPort ;
;
jsr getSavePtr
;
ldy #110
lop100 lda [<work+4],y
sta [<work],y
dey
dey
bpl lop100
;
jsr popSave
;
plx Get return address.
tsc
clc
adc #112
tcs
phx Put return address back.
;
rts
; = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
; Compute pointer to part of port to save.
;110= = = = = = = = = = = = = = = = = = = = = = = = = = = = =
;
getSavePtr plx
pei <work+6 Save.
pei <work+4
pei <work+2
pei <work
phx
;
pha Get pointer to current port.
pha
_GetPort
pla
plx
clc
adc #$0020
bcc store110
inx
store110 sta <work
stx <work+2
;
tsc Compute pointer into stack.
clc
adc #13
sta <work+4
stz <work+6
rts
;
;
; = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
;
; = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
;
popSave plx
pla Restore.
sta <work
pla
sta <work+2
pla
sta <work+4
pla
sta <work+6
phx
rts
;
ENDP
;====================================================================
;
; Set text color and writing mode.
;
; IN: a = normal color index into color table.
; colorptr = pointer to color table.
; state = 0 for normal, 2 for hilited.
;
;====================================================================
set_textmode proc EXPORT
ldy #state
clc
adc [<data],y
tay
lda [<colorptr],y
pha Save color.
and #$000F Just text color.
jsr smear Duplicate color in all 4 nibbles.
pha Pass color of title.
_SetForeColor Set text color.
;
pla Restore saved color.
and #$00F0
pha
lsr a Get background color.
lsr a
lsr a
lsr a
ora 1,s
sta 1,s
xba
ora 1,s
sta 1,s
_SetBackColor
;
pea 0 Copy mode.
_SetTextMode
;
rts
ENDP
;====================================================================
;
; Smear color into all 4 nibbles.
;
; IN: a = low nibble is color.
;
; OUT: a = low nibble duplicated into all 4 nibbles.
; x = trash.
;
;====================================================================
smear proc EXPORT
;
and #$000F
pha
asl a
asl a
asl a
asl a
ora 1,s
sta 1,s
xba
ora 1,s
plx
rts
ENDP
;====================================================================
;
; New icon font.
;
; IN: a,x = handle of new icon font.
;
;====================================================================
SetIconFont proc EXPORT
ldy #ctl_font Store new handle in global variable.
sta [<data],y
iny
iny
txa
sta [<data],y
;
; --- Get parameters of new icon font -----------------------------------
;
ldx #UP_ARROW Get size of up arrow icon.
lop110 phx
jsr get_csize
plx
;
ldy #rect2+y2 Save height.
lda [<data],y
pha
lda >arrowMap-UP_ARROW,x
tay
pla
sta [<data],y
iny
iny
phy
ldy #rect2+x2 Save width.
lda [<data],y
ply
sta [<data],y
;
inx
inx
cpx #RITE_ARROW+2
bne lop110
;
rts
ENDP
;====================================================================
;
; Perform initialization for
; resolution specific values.
;
;====================================================================
newResGuts proc EXPORT
import ComputeScrollColor
pha Space for result.
_GetMasterSCB
pla
ldy #GraphicsMode
and #$0080 Mask off mode bit.
sta [<data],y Remember mode.
beq mode320
;
;
; --- Initialize for 640 mode ------------------------------
;
jsr ComputeScrollColor
;;; lda #myScrollPatt640 ;added 20-Nov-90 DAL
;;; sta >scroll_color+12 ;added 20-Nov-90 DAL
ldy #2 640 mode vertical line width = 2.
lda #Ctl640 640 icon font.
ldx #16 Minimum horizontal thumb size in 640.
bra enter1
;
;
; --- Initialize for 320 mode ------------------------------
;
mode320 jsr ComputeScrollColor
ldy #1 320 mode vertical line width = 1.
ldx #8 Minimum horizontal thumb size in 320.
lda #Ctl320 320 icon font.
;
enter1 pha
tya
ldy #vert_pen Store vertical line width to use.
sta [<data],y
pla
;
ldy #fontHandle Store font pointer in fake handle.
sta [<data],y
iny
iny
lda #Ctl320>>16
sta [<data],y
;
ldy #min_thumb Store minimum thumb size.
txa
sta [<data],y
;
jsr pushfontHandle
pla
plx
jsr SetIconFont Save icon font handle, set parameters.
;
rts
EndP
**********************************************************************
*
* ComputeScrollColor
*
* Look for a good gray in a likely-looking color palette. If we can't
* find one, then use $010F (the old checkerboard pattern). If we find one,
* use $00x0.
*
* We store the new pattern into scroll_color+12, the page color for
* the default scroll bar color table. If we change the value, we
* call RefreshDesktop(0) to redraw any scroll bars that happen to be
* using the default color table.
*
**********************************************************************
*** 9-Dec-91 DAL -- made this into a proc. Made it store the new value itself,
*** and also refresh the screen if needed.
ComputeScrollColor proc export
pha
_GetMasterSCB
pla
and #$0080
beq @320
lda #myScrollPatt640
bra @storeNewValue
@320
pha
pea 100
_GetSCB
pla
and #$000f
asl a
asl a
asl a
asl a
asl a ;*32 = index into color stuff
tax
ldy #16
@search lda $e19e00,x
pha
cmp #$0555 ;compare against 4 acceptable gray levels
beq @found
cmp #$0666
beq @found
cmp #$0777
beq @found
cmp #$0888
beq @found
@noGood pla
inx
inx
dey
bne @search
lda #$010f
bra @storeNewValue
@found pla
txa
asl a
asl a
asl a
and #$00f0
@storeNewValue cmp >scroll_color+12
sta >scroll_color+12
beq @noChange
*** added 14-Jan-92 DAL -- cause a RefreshDesktop to happen later
pushlong #refreshDeskTask
_AddToRunQ
*** end 14-Jan-92
@noChange rts
*** end 9-Dec-91 DAL
*** added 14-Jan-92 DAL
*
* refreshDeskTask -- redraws the desktop once, when it's safe
* (this task removes itself from the queue)
*
export refreshDeskTask
refreshDeskTask dc.l 0 ;reserved
dc.w 0 ;call as often as possible
dc.w $a55a ;signature
dc.l 0 ;reserved for system
entry lda #0
pha
pha
_RefreshDesktop
bcc @fine
cmp #$10
bcs @fine
pla
pla ;clean up after dispatcher error (paranoia)
@fine
export RemoveRefreshTask
RemoveRefreshTask pushlong #refreshDeskTask
_RemoveFromRunQ
rtl
*** end 14-Jan-92
ENDP
;====================================================================
;
; Call SetWAP.
;
; IN: a,y = value to set.
;
;====================================================================
setWAP proc EXPORT
pea 0 Pass system flag.
pea CtlToolNum Pass Window Manager tool number.
phy Pass value.
pha
_SetWAP
rts Return error code from SetWAP.
ENDP
;====================================================================
;
; Allocate a block of memory.
;
; IN: a = number of bytes to allocate.
; MyID = ID to use.
;
; OUT: Carry clear if handle allocated, a+x = handle.
; Carry set if error, y = error returned by Memory Manager.
;
;====================================================================
allocate proc EXPORT
pha Save number of bytes.
ldy #MyID Get ID number.
lda [<data],y
tay y = ID number to use to allocate.
pla a = number of bytes to allocate.
; = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
;
; Allocate a block of memory.
;
; IN: y = ID number.
; a = number of bytes.
;
; OUT: Carry clear if handle allocated, a+x = handle.
; Carry set if error, y = error returned by Memory Manager.
;
; = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
EXPORT CMAllocate2
CMAllocate2 ;
ldx #%0100000000010000 Fixed, May not cross bank boundary.
; = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
;
; Allocate a block of memory.
;
; IN: y = ID number.
; x = attributes.
; a = number of bytes.
;
; OUT: Carry clear if handle allocated, a+x = handle.
; Carry set if error, y = error returned by Memory Manager.
;
; = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
EXPORT CMAllocate3
CMAllocate3 ;
;
pha Space for returned handle.
pha
pea 0 High word of size.
pha Pass low word of size.
phy Pass ID number.
phx Pass attributes.
pha Address doesn't matter.
pha
_NewHandle
pla Return handle.
plx
rts
ENDP
;====================================================================
; Do setup for tool call.
;
; IN: a+y = handle to data area.
;
; OUT: Carry clear if no error.
; Carry set if null data pointer, y = error code.
;
;150=================================================================
CMstartup proc EXPORT
plx Get return address.
;
phd Save caller's direct page.
phb Save caller's data page.
;
phy Save pointer to data area.
pha
;
phx
;
pha Space for result.
pha
_GetPort
pla
ply
plx Get return addess.
phy Save caller's port on stack.
pha
;
tsc Allocate direct page on stack.
sec
sbc #DIRECTSIZE
tcs
tcd
;
phx Put return address back on stack.
;
lda <data Valid data area pointer passed.
ora <data+2
clc Clear error flag.
bne exit
;
pea $1002 Control Manager not started.
pea notInit>>16 Pass message.
pea notInit
_SysFailMgr
;
notInit DC.B 40
DC.B 'Control Manager not initialized, error $'
;
exit rts
;
;
; = = = = = = = = = = = = = = = = = = = = = = = = = = =
; Entry points for function exits.
;200= = = = = = = = = = = = = = = = = = = = = = = = = =
;
EXPORT CMpop0bytes
CMpop0bytes ;
ldx #0
bra shutdown
;
EXPORT CMpop4bytes
CMpop4bytes ;
ldx #4
bra shutdown
;
EXPORT CMpop6bytes
CMpop6bytes ;
ldx #6
bra shutdown
;
EXPORT CMpop8bytes
CMpop8bytes ;
ldx #8
bra shutdown
;
EXPORT CMpop10bytes
CMpop10bytes ;
ldx #10
bra shutdown
;
EXPORT CMpop12bytes
CMpop12bytes ;
ldx #12
bra shutdown
;
EXPORT CMpop18bytes
CMpop18bytes ;
ldx #18
bra shutdown
;
EXPORT CMpop26bytes
CMpop26bytes ;
ldx #26
bra shutdown
;
EXPORT CMpop32bytes
CMpop32bytes ;
ldx #32
bra shutdown
;
; = = = = = = = = = = = = = = = = = = = = = = = = = = = =
;
; Undo setup for tool call.
;
; IN: y = error code, zero if no error.
; x = number of bytes to pop.
; Startup must have been called.
;
;250= = = = = = = = = = = = = = = = = = = = = = = = = = =
shutdown ;
;
phy Save error code.
phx Save number of byte to pop.
pei <savePort+2 Restore caller's port.
pei <savePort
_SetPort
plx Restore number of bytes to pop.
ply Restore error code.
;
;
; --- Restore saved parameters from startupCall --------------------------
;
tsc Free direct page allocated on stack.
clc
adc #DIRECTSIZE+8 (Get rid of data area pointer and port).
tcs
;
plb Restore original data bank.
;
;
; --- Move return addresses over top of input parameters -----------------
;
tsc
tcd
lda 7,s
sta 7,x
lda 5,s
sta 5,x
lda 3,s
sta 3,x
;
;
; --- Adjust stact for popped parameters ---
;
pld Get original direct page pointer.
;
tsc Current stack,
phx
clc
adc 1,s plus number of bytes popped,
tcs equals new stack.
;
tya Return error code in Y.
cmp #1 Set carry if error.
rtl
;
;
;====================================================================
; ( op1 * op2 ) / op3
;
; IN: x = op1.
; y = op2.
; a = op3.
;
; OUT: x = result.
;300=================================================================
; EXPORT fraction
fraction proc export
;
pha Save op3.
;
pha Space for LongDivide remainder high.
pha Space for LongDivide remainder low.
;
pha Space for LongDivide quotient high.
pha Space for LongDivide quotient low.
;
;
; --- ( op1 * op2 ) ------------------------------
;
pha Space for Multiply result.
pha Space for Multiply result.
;
phx Pass op1.
phy Pass op2.
_Multiply
;
;
; --- ( Result ) / op3 ---------------------------
;
; Space for result already on stack.
; Numerator is multiply result on stack.
pea 0 Pass high word of op3 as denominator.
lda 11,s
pha Pass low word of op3 as denominator.
_LongDivide
;
;
; --- Round off quotient --------------------------
;
plx Quotient.
lda 7,s Get op3.
lsr a Halve of that.
cmp 3,s Is it greater that the remainder?
bcs skip300
inx Round up.
;
;
; --- Fix up stack and exit ------------------------
;
skip300 pla Pull quotient high word.
pla Pull remainder low word.
pla Pull remainder high word.
;
pla Pull op3.
rts x = result.
;
;
;====================================================================
;
; Set pen color.
;
; IN: <colorptr = pointer to a color table.
; y = offset into the color table.
;
;350=================================================================
; EXPORT pen_color
pen_color proc export
;
jsr pushcolor
_SetPenPat
rts
;====================================================================
;
; Push a pointer to a color patteren.
;
; IN: colorptr = pointer to a color table.
; y = offset into the color table.
;
;400=================================================================
EXPORT pushcolor
pushcolor
lda [<colorptr],y
and #$00F0
tay
jsr set_patt
;
pla Get return address.
;
phx Push pointer to pattern on stack.
phy
;
pha Restore return address.
rts
;====================================================================
;
; Push long value in data area.
;
;460=================================================================
EXPORT pushVdrag_patt
pushVdrag_patt ;
ldy #drag_patt+2
bra enter460
;
; EXPORT pushVctl_font
pushVctl_font proc export
ldy #ctl_font+2
;
export enter460
enter460 plx
lda [<data],y
pha
dey
dey
lda [<data],y
pha
phx
rts
;====================================================================
;
; Push address of variable in data area.
;
;470=================================================================
; EXPORT pushrect2
pushrect2 proc export
lda #rect2
bra enter470
;
; EXPORT pushfontHandle
pushfontHandle proc export
lda #fontHandle
bra enter470
;
EXPORT pushfontInfo
pushfontInfo ;
lda #fontInfo
bra enter470
;
EXPORT pushmyevent
pushmyevent ;
lda #myevent
bra enter470
EXPORT pushmyeventpos
pushmyeventpos ;
lda #myevent+where
bra enter470
;
EXPORT pushdrag_rect
pushdrag_rect ;
lda #drag_rect
bra enter470
;
EXPORT pushbound_rect
pushbound_rect ;
lda #bound_rect
bra enter470
;
EXPORT pushslop_rect
pushslop_rect ;
lda #slop_rect
bra enter470
;
EXPORT pushlimit_blk
pushlimit_blk ;
lda #limit_blk
;
enter470 proc export
plx
;
clc
adc <data
tay
lda #0
adc <data+2
pha
phy
;
phx
rts
;====================================================================
;
; Push word value from data area.
;
;480=================================================================
; EXPORT pushVaxis_param
pushVaxis_param proc export
ldy #axis_param
bra enter480
;
; EXPORT pushVvert_pen
pushVvert_pen proc export ;added PROC 8-Dec-91 DAL
ldy #vert_pen
;
export enter480
enter480 plx
lda [<data],y
pha
phx
rts
;====================================================================
;
; Push zero page addresses.
;
; OUT: Y = same as in.
;
;500=================================================================
EXPORT pushyrat
pushyrat
;
lda #yrat
bra pushzpage
;
EXPORT pushrect
pushrect ;
;
lda #rect
;
EXPORT pushzpage
pushzpage ;
;
plx Get return address.
;
pea 0
pha
tdc
clc
adc 1,s
sta 1,s
;
phx Put return address back.
rts
;====================================================================
;
; Get given window pointer.
;
; IN: Window pointer must be last parameter passed to tool function.
;
; OUT: windptr = pointer to given window.
; ctlhand = handle of first control in window.
; ctlptr = (ctlptr)
; Carry set if error, y = 0.
;
;550=================================================================
; EXPORT getWindPtr
getWindPtr proc export ;added PROC 8-Dec-91 DAL
;
ldx <inputs+2 Get last input parameter.
lda <inputs
bne ok550
txy
bne ok550
;
ldy #0 Don't return an error.
sec
rts
;
ok550 jsr makeWptr windptr = window pointer.
;
; = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
;
; Get first control in window.
;
; IN: windptr = pointer to window record.
;
; OUT: ctlhand = handle of first control in window.
; ctlptr = (ctlptr)
; Carry set if no first control found, y = 0.
;
; = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
EXPORT getFirstCtl
getFirstCtl ;
;
ldy #owControls+2 Get pointer to first control.
lda [<windptr],y
tax
dey
dey
lda [<windptr],y
bra store550
;
;
; = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
;
; Get given control handle.
;
; IN: Control handle must be last parameter passed to tool function.
;
; OUT: ctlhand = handle of first control in window.
; ctlptr = (ctlptr)
; Carry set if null handle passed, y = 0.
;
;550= = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
EXPORT getCtlHand
getCtlHand ;
;
lda <inputs
ldx <inputs+2
;
store550 sta <Ctlhand
stx <Ctlhand+2
;
ldy #0 No first control found flag, just in case.
sec
ora <Ctlhand+2 Is there a first control?
beq exit550
;
jsr dereference Ctlptr = (Ctlhand).
clc OK flag.
;
exit550 rts
;====================================================================
;
; Get window pointer from control.
;
; IN: Ctlptr = pointer to control.
;
; OUT: windptr = pointer to control's window.
; a = low word of window pointer.
; x = high word of window pointer.
;
;600=================================================================
ENTRY get_wptr
get_wptr ;
;
jsr dereference Ctlptr = (Ctlhand).
ldy #CtlOwner+2
lda [<Ctlptr],y
tax
dey
dey
lda [<Ctlptr],y
;
; = = = = = = = = = = = = = = = = = = = = = = = = = = = =
;
; Compute window pointer
; from grafPort pointer.
;
; IN: a,x = pointer to grafPort.
;
; OUT: a,x = pointer to window record.
; windptr = pointer to window record.
;
;650= = = = = = = = = = = = = = = = = = = = = = = = = = =
EXPORT makeWptr
makeWptr ;
sec
sbc #oport
bcs store650
dex
store650 sta <windptr
stx <windptr+2
rts
;====================================================================
;
; Switch to window's port.
;
; IN: Ctlptr = pointer to control.
;
; OUT: current port = Ctlptr's owner (window).
; global_y = window's Y offset.
; global_x = window's X offset.
;
;700=================================================================
EXPORT to_wport
to_wport ;
;
; --- Move relevant data from window port to Control Mgr's port -------------
;
jsr dereference Ctlptr = (Ctlhand).
ldy #CtlOwner+2 Get pointer to window's port.
lda [<Ctlptr],y
pha
dey
dey
lda [<Ctlptr],y
pha
_SetPort
;
; Fall through to dereference.
;
; = = = = = = = = = = = = = = = = = = = = = = = = = = =
;
; Dereference Ctlhand.
;
; IN: Ctlhand = handle.
;
; OUT: a,x = (Ctlhand)
; Ctlptr = (Ctlhand)
;
;750= = = = = = = = = = = = = = = = = = = = = = = = = =
;;; EXPORT dereference
dereference proc export
;
ldy #2
lda [<Ctlhand],y
sta <Ctlptr+2
tax
lda [<Ctlhand]
sta <Ctlptr
rts
; = = = = = = = = = = = = = = = = = = = = = = = = = = =
;
; Push pointer to string.
;
; IN: Ctlhand = handle
; CtlPtr = ptr
;
; OUT: pointer on stack
;
;750= = = = = = = = = = = = = = = = = = = = = = = = = =
;;; EXPORT PushStringPtr
PushStringPtr proc export
jsr CtlDataToAX ; start by putting value in Ctldata on stack
ply
phx
pha
phy
;
; If the control is not a super control, we are done.
;
ldy #NewCtlRecord.ctlProc+2
lda [ctlPtr],y
bpl @Done
;
; It is a super control. See what the verb is.
;
jsr ReadMoreFlags
and #TitleVerbMask
beq @Done 0 is pointer so all done
cmp #TitleIsHandle
beq @IsHandle
@IsResource
pha
pha
PushWord #rString
jsr CtlDataToAX
phx
pha
jsr LoadResource
pla
plx
sta 3,s
txa
sta 5,s
; memory may have moved, so reset ctlPtr
;
jsr Dereference
@IsHandle
phd
tsc
tcd
ldy #2
lda [5],y
tax
lda [5]
sta 5
stx 7
pld
@Done
rts
; = = = = = = = = = = = = = = = = = = = = = = = = = = =
;
; ReadMoreFlags
;
; IN: Ctlhand = handle
; CtlPtr = ptr
;
; OUT: a-reg = MoreFlags
;
;750= = = = = = = = = = = = = = = = = = = = = = = = = =
; EXPORT ReadMoreFlags
ReadMoreFlags proc export
ldy #NewCtlRecord.ctlMoreFlags
lda [<Ctlptr],y
rts
; = = = = = = = = = = = = = = = = = = = = = = = = = = =
;
; GetColorTableRefFromTemplate
;
; IN: param = ptrToTemplate
;
; OUT: a-reg = offset in template of color table
;
;750= = = = = = = = = = = = = = = = = = = = = = = = = =
; EXPORT GetColorTableRefFromTemplate
GetColorTableRefFromTemplate proc export
ldy #simpleButtonTemplate.ProcRef+3
lda [param],y
and #$007F
beq @IsButton
; is check or radio
ldy #checkTemplate.ColorTableRef+2
bra @join
@IsButton ldy #simpleButtonTemplate.ColorTableRef+2
@join lda [param],y
tax
dey
dey
lda [param],y
rts
; = = = = = = = = = = = = = = = = = = = = = = = = = = =
;
; CtlDataToAX
;
; IN: Ctlhand = handle
; CtlPtr = ptr
;
; OUT: a-reg & x-reg get value in ctlData
;
;750= = = = = = = = = = = = = = = = = = = = = = = = = =
EXPORT CtlDataToAX
CtlDataToAX
ldy #NewCtlRecord.ctlData+2
lda [ctlPtr],y
tax
dey
dey
lda [ctlPtr],y
rts
;====================================================================
;
; Smear a mono bit image into color.
;
; IN: y = pattern type in high byte,
; pattern color number in high nybble of low byte,
; background color in low nibble of low byte.
;
; OUT: x = high word address of pattern.
; y = low word address of pattern.
;
;800=================================================================
set_patt proc EXPORT
tya Special case, solid pattern.
and #$FF00
bne begin800
;
; --- Special case black and white --------------------------------
;
tya
and #$00F0
beq @black
cmp #$00F0
bne begin800
;
ldy #clrWhite
bra exit801
;
@black ldy #clrBlack
exit801 ldx #clrBlack>>16
rts
;
; --- Fill pattern buffer with pattern color ----------
;
; y = color/pattern
;
begin800 pei <work+2 Save work.
pei <work
;
ldx <data+2
lda <data
clc
adc #pattern
bcc store800
inx
store800 sta <work
stx <work+2
;
;
tya Get pattern color.
lsr a
lsr a
lsr a
lsr a
jsr getcolor Smear color into all four nibbles.
;
sta [<work]
cpy #$0100
bcs dither800
;
ldy #30
lop800 sta [<work],y
dey
dey
bne lop800
bra exit800
;
;
; --- Special dither pattern -------------------------------------------
;
dither800 tya
jsr getcolor
tay
and #$F0F0
pha
lda [<work]
and #$0F0F
ora 1,s
sta 1,s
;
tya
and #$0F0F
pha
lda [<work]
and #$F0F0
ora 1,s
sta 1,s
;
ldy #GraphicsMode-1
lda [<data],y
tax Keep mode in X.
bpl mode320 What's the mode, 320 or 640?
;
*** 8-Dec-91 DAL -- use 32-byte patt in 640 mode if ArcRot bit 15 is set!
pha
_GetArcRot
ldx #0 ;anticipate arcrot640, handle like 320
pla
bmi mode320
ldx #$8000 ;plain 640 mode
*** end 8-Dec-91
ldy #14 640 mode index.
bra lop801
;
mode320 ldy #30 320 mode index.
;
lop801 jsr set1
txa
bmi skip800
jsr set1
;
skip800 jsr set2
bmi done800
txa
bmi lop801
jsr set2
bpl lop801
;
;
done800 pla
pla
;
;
exit800 ldy <work Return pointer to pattern.
ldx <work+2
;
pla Restore work.
sta <work
pla
sta <work+2
rts
;
;
set1 lda 5,s
bra enter2
;
;
set2 lda 3,s
enter2 sta [<work],y
dey
dey
rts
;====================================================================
;
; IN: a = color in low nibble.
;
; OUT: a = color in all four nibbles.
;
;====================================================================
getcolor and #$000F
pha
asl a
asl a
asl a
asl a
ora 1,s
sta 1,s
xba
ora 1,s
plx
rts
;
ENDP
;====================================================================
;
; Draw a solid rectangle with border.
;
; IN: <rect = RECT to draw.
; <colorptr = pointer to color table.
; y = color of fill in bits 4-7.
; a = color of outline in bits 4-7.
;
;====================================================================
drawrect proc EXPORT
fillColor equ 1
frameColor equ fillColor+2
;
; --- Use special fill & frame RECT call ---------------------
;
pha Save outline color.
phy Save fill color.
;
jsr pushrect Pass pointer to RECT to draw.
lda frameColor+4,s Get color of frame,
jsr pushSmear smear into 4 nibbles and push.
lda fillColor+6,s Get fill color,
jsr pushSmear smear into 4 nibbles and push.
_SpecialRect
bcc exit No error?
;
tsc Fix stack from SpecialRect call.
clc
adc #8
tcs
;
;
; --- Use slower separate fill & frame calls -----------------
;
_PenNormal
;
jsr setvertpen Set line size.
;
lda frameColor,s Set pen color.
beq skip1 Color already set?
jsr pushSmear
_SetSolidPenPat
;
skip1 jsr pushrect Pass RECT to fill.
lda fillColor+4,s
tay
jsr set_patt
phx Push pointer to pattern.
phy
_FillRect
;
jsr pushrect Pass RECT to frame.
_FrameRect
;
exit ply Get rid of fill color.
pla Get rid of outline color.
rts
; = = = = = = = = = = = = = = = = = = = = = = = = = = = =
;
; Smear color and push.
;
; IN: a = color to smear in bits 4-7.
;
; OUT: Color smeared into all 4 nibbles and left on stack.
;
;100= = = = = = = = = = = = = = = = = = = = = = = = = = =
pushSmear plx Get return address.
;
pha
lsr a
lsr a
lsr a
lsr a
ora 1,s
sta 1,s
xba
ora 1,s
sta 1,s
;
phx
rts
; = = = = = = = = = = = = = = = = = = = = = = = = = = = =
;
; Get pointer to next control.
;
; IN: Ctlptr = pointer to a control.
;
; OUT: Equal flag = FALSE if ok, else no more controls.
;
;860= = = = = = = = = = = = = = = = = = = = = = = = = = =
EXPORT next_Ctl
next_Ctl ;
;
lda [<Ctlptr]
tax
ldy #2
lda [<Ctlptr],y
bne store860
txy
beq exit860
;
store860 sta <Ctlhand+2
stx <Ctlhand
jsr dereference Ctlptr = (Ctlhand).
lda <ctlptr+1 Set not equal flag.
exit860 rts
; = = = = = = = = = = = = = = = = = = = = = = = = = = = =
;
; Get bounds RECT of icon.
;
; IN: x = icon number.
;
; OUT: rect2+y2 = height of character.
; rect2+x2 = width of character.
;
;870= = = = = = = = = = = = = = = = = = = = = = = = = = =
EXPORT get_csize
get_csize ;
;
stx <work Pass character to test.
; = = = = = = = = = = = = = = = = = = = = = = = = = = = =
;
; IN: work = character to get bounds of.
;
; = = = = = = = = = = = = = = = = = = = = = = = = = = = =
EXPORT get_csize2
get_csize2
lda #getCharBounds
; Fall through to doIconFunc.
;
; = = = = = = = = = = = = = = = = = = = = = = = = = = = =
;
; Perform a task that needs the
; icon font as the current font.
;
; IN: a = address of function to perform.
;
;880= = = = = = = = = = = = = = = = = = = = = = = = = = =
EXPORT doIconFunc
doIconFunc ;
pha Save function to call.
;
;
; --- Save state of grafPort ---------------------------------
;
pha Save original text face.
_GetTextFace
;
pha Save original font flags.
_GetFontFlags
;
pha Save original font ID.
pha
_GetFontID
;
pha Save original font
pha
_GetFont
;
;
; --- Clear text face, switch to icon font and call function ------------------
;
pea 0000
_SetTextFace
;
jsr pushVctl_font Swicth to icon font.
_SetFont
;
pea 4 Use word of color.
_SetFontFlags
pea returnAddr-1 Put return address on stack.
;
; The stack at this point is
;
DefineStack
TheRetAddr word ; 1
OrigFont long ; 3
OrigFontID long ; 7
OrigFontFlags word ; 11
OrigTextFace word ; 13
FuncToCall word ; 15
lda FuncToCall,s Put address of function on stack,
dec a
pha
rts and dispatch to it.
returnAddr ;
;
; --- Restore state of grafPort ------------------------------
;
_SetFont Restore original font.
_SetFontID Restore original font ID.
_SetFontFlags Restore original font flags.
_SetTextFace Restore original text face.
;
pla Address of function.
rts
;
;
; = = = = = = = = = = = = = = = = = = = = = = = = = = = =
;
; Get size of character.
;
; IN: work = character to get size of.
;
; OUT: rect2+y2 = height of character.
; rect2+x2 = width of character.
;
;890= = = = = = = = = = = = = = = = = = = = = = = = = = =
getCharBounds ;
;
pei <work Pass character to get bounds of.
jsr pushrect2 Store the bounds in 'rect2'.
_CharBounds
;
ldy #rect2+y2 Compute icon's heigth.
lda [<data],y
sec
ldy #rect2+y1
sbc [<data],y
ldy #rect2+y2
sta [<data],y
;
ldy #rect2+x2 Compute icon's width.
lda [<data],y
sec
ldy #rect2+x1
sbc [<data],y
ldy #rect2+x2
sta [<data],y
rts
; = = = = = = = = = = = = = = = = = = = = = = = = = = = =
;
; Move control's CtlRect into 'rect'.
;
; IN: Ctlptr = control pointer.
;
; OUT: rect = CtlRect of part.
;
;900= = = = = = = = = = = = = = = = = = = = = = = = = = =
EXPORT CMsetrect
CMsetrect ;
ldy #CtlRect+x2 Put CtlRect into rect.
EXPORT CMsetrect2
CMsetrect2 ;
ldx #x2
lop900 lda [<Ctlptr],y
sta <rect,x
dey
dey
dex
dex
bpl lop900
rts
;
ENDP
; APPEND CSTATIC.ASM
;
;====================================================================
;
; Static data area.
;
;====================================================================
staticRAM PROC
;
;
EXPORT arrowMap
arrowMap DC.W uArrowH,dArrowH,lArrowH,rArrowH
;
EXPORT Dimmed
dimmed DC.B $55,$AA,$55,$AA,$55,$AA,$55,$AA Dithered mask for pen.
EXPORT Nor_Mask
nor_mask DC.B $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF Normal mask for pen.
;
EXPORT clrBlack
clrBlack DC.W $0000 Solid black pattern.
DC.W $0000
DC.W $0000
DC.W $0000
DC.W $0000
DC.W $0000
DC.W $0000
DC.W $0000
DC.W $0000
DC.W $0000
DC.W $0000
DC.W $0000
DC.W $0000
DC.W $0000
DC.W $0000
DC.W $0000
EXPORT clrWhite
clrWhite DC.W $FFFF Solid white pattern.
DC.W $FFFF
DC.W $FFFF
DC.W $FFFF
DC.W $FFFF
DC.W $FFFF
DC.W $FFFF
DC.W $FFFF
DC.W $FFFF
DC.W $FFFF
DC.W $FFFF
DC.W $FFFF
DC.W $FFFF
DC.W $FFFF
DC.W $FFFF
DC.W $FFFF
;
;
; --- Default color table for simple buttons -----------------
;
EXPORT butt_color
butt_color DC.W $0000 Outline.
DC.W $00F0 Interior when normal.
DC.W $0000 Interior when selected.
DC.W $00F0 Text when normal.
DC.W $000F Text when selected.
;
;
; --- Default color table for check boxes and radio buttons --
;
EXPORT check_color
check_color DC.W $0000 Outline.
DC.W $00F0 Icon when unhilited.
DC.W $00F0 Icon when hilited.
DC.W $00F0 Title color.
;
;
; --- Default color table for scroll bars --------------------
;
EXPORT scroll_color
scroll_color DC.W $0000 Outline.
DC.W $00F0 Arrow when normal.
DC.W $00F0 Arrow when selected.
DC.W $00F0 Arrow's box interior.
DC.W $00F0 Thumber when normal.
DC.W $0000 Not used and should never be used.
***** DC.W $010F Page region interior.
dc.w $00C0 Page region interior. Experimental 20-Nov-90 DAL (This gets stored over by newresguts)
DC.W $00F0 Interior color of inactive bar.
;
;
; --- Default color table for grow box -----------------------
;
EXPORT grow_color
grow_color DC.W $0000 Outline.
DC.W $00F0 Interior when normal.
DC.W $000F Interior when selected.
;
;
; --- Control Manager icon font -------------------------------
;
EXPORT ctl320
ctl320 ;
;
DC.W $0006 {offset word}
DC.W $00D1 {FontID}
DC.W $0000 {style}
DC.W $000A {size}
DC.W $0100 {version}
DC.W $000D {FBRext}
;
DC.W $9001 {FontType}
DC.W $0000 {FirstChar}
DC.W $0010 {LastChar}
DC.W $000D {WidMax}
DC.W $0000 {KernMax}
DC.W $FFF7 {nDescent}
DC.W $000D {fRectWidth}
DC.W $0009 {FrectHeight}
DC.W 132 {owTLoc}
DC.W $0000 {ascent}
DC.W $0009 {descent}
DC.W $0000 {leading}
DC.W 12 {RowWords}
;
; BitImage:
DC.B $FF,$FF,$FF,$FF,$FF,$FF,$F0,$F0,$0F,$00,$F0,$0F,$00,$80,$40,$F8,$7C,$08,$04,$02,$01,$0F,$80,$00
DC.B $80,$0F,$FF,$F0,$07,$FF,$F3,$0C,$39,$C3,$0C,$39,$C1,$40,$E0,$88,$7C,$18,$0C,$03,$01,$88,$80,$00
DC.B $80,$0F,$01,$EC,$1B,$E0,$F4,$02,$60,$64,$F2,$6F,$62,$21,$F0,$88,$7C,$2F,$9F,$FE,$9F,$C8,$F8,$00
DC.B $80,$0F,$01,$E3,$63,$DB,$78,$01,$C0,$39,$F9,$DF,$B4,$13,$F8,$88,$7C,$40,$BF,$E0,$5F,$E8,$88,$00
DC.B $80,$0F,$01,$E0,$83,$C4,$78,$01,$C0,$3B,$FD,$DF,$BE,$3F,$FF,$8F,$FF,$80,$FF,$E0,$3F,$FF,$88,$00
DC.B $80,$0F,$01,$E3,$63,$DB,$78,$01,$C0,$39,$F9,$DF,$B2,$21,$F1,$04,$FE,$40,$BF,$E0,$5F,$E2,$08,$00
DC.B $80,$0F,$01,$EC,$1B,$E0,$F4,$02,$60,$64,$F2,$6F,$62,$21,$F0,$88,$7C,$2F,$9F,$FE,$9F,$C2,$08,$00
DC.B $80,$0F,$FF,$F0,$07,$FF,$F3,$0C,$39,$C3,$0C,$39,$C2,$21,$F0,$50,$38,$18,$0C,$03,$01,$82,$08,$00
DC.B $FF,$FF,$FF,$FF,$FF,$FF,$F0,$F0,$0F,$00,$F0,$0F,$03,$E1,$F0,$20,$10,$08,$04,$02,$01,$03,$F8,$00
;
; LocTable:
DC.W 0 0 Unchecked box normal.
DC.W 13 1 Unchecked box hilited.
DC.W 26 2 Checked box normal.
DC.W 39 3 Checked box hilited.
DC.W 52 4 Off radio button normal.
DC.W 64 5 Off radio button hilited.
DC.W 76 6 On radio button normal.
DC.W 88 7 On radio button hilited.
DC.W 100 8 Up arrow normal.
DC.W 109 9 Up arrow hilited.
DC.W 118 10 Down arrow normal.
DC.W 127 11 Down arrow hilited.
DC.W 136 12 Left arrow normal.
DC.W 145 13 Left arrow hilited.
DC.W 154 14 Right arrow normal.
DC.W 163 15 Right arrow hilited.
DC.W 172 16 Grow icon.
DC.W 181 17 End of table.
DC.W 181 18
;
; OWTable:
DC.W 13 0 Unchecked box normal.
DC.W 13 1 Unchecked box hilited.
DC.W 13 2 Checked box normal.
DC.W 13 3 Checked box hilited.
DC.W 11 4 Off radio button normal.
DC.W 11 5 Off radio button hilited.
DC.W 11 6 On radio button normal.
DC.W 11 7 On radio button hilited.
DC.W 9 8 Up arrow normal.
DC.W 9 9 Up arrow hilited.
DC.W 9 10 Down arrow normal.
DC.W 9 11 Down arrow hilited.
DC.W 9 12 Left arrow normal.
DC.W 9 13 Left arrow hilited.
DC.W 9 14 Right arrow normal.
DC.W 9 15 Right arrow hilited.
DC.W 9 16 Grow icon.
DC.W $0404 17 End of table.
DC.W 0 18
;
;
;
;
EXPORT ctl640
ctl640 ;
;
DC.W $0006 ; {offset word}
DC.W $00D2 ; {FontID}
DC.W $0000 ; {style}
DC.W $000A ; {size}
DC.W $0100 ; {version}
DC.W $0017 ; {FBRext}
DC.W $9001 ; {FontType}
DC.W $0000 ; {FirstChar}
DC.W $0010 ; {LastChar}
DC.W $0017 ; {WidMax}
DC.W $0000 ; {KernMax}
DC.W $FFF7 ; {nDescent}
DC.W $0017 ; {fRectWidth}
DC.W $0009 ; {FrectHeight}
DC.W $00DE ; {owTLoc}
DC.W $0000 ; {ascent}
DC.W $0009 ; {descent}
DC.W $0000 ; {leading}
DC.W $0016 ; {RowWords}
;
; BitImage:
DC.B $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$F0,$3F,$E0,$01,$FF
DC.B $00,$0F,$F8,$00,$7F,$C0,$00,$C0,$00,$30,$00,$FF,$C0,$3F,$F0,$00
DC.B $E0,$00,$38,$00,$1C,$00,$07,$00,$FF,$C0,$00,$00,$C0,$00,$07,$FF
DC.B $FF,$FF,$C0,$00,$7F,$FF,$FF,$F1,$C0,$1C,$0F,$FF,$E0,$70,$07,$03
DC.B $FF,$F8,$03,$30,$00,$FC,$00,$C0,$C0,$3F,$F0,$03,$60,$00,$F8,$00
DC.B $1B,$00,$07,$C0,$C0,$C0,$07,$F0,$C0,$00,$07,$F0,$00,$7F,$38,$03
DC.B $9F,$F0,$07,$F6,$00,$03,$3F,$01,$F9,$87,$F0,$CF,$C0,$7E,$0C,$0C
DC.B $03,$FF,$00,$C0,$C0,$3F,$F0,$0C,$7F,$C3,$FF,$FF,$F8,$C3,$FF,$F0
DC.B $C0,$FF,$C0,$7F,$C0,$00,$07,$F0,$00,$7F,$07,$1C,$1F,$CE,$39,$FC
DC.B $00,$01,$FC,$00,$7F,$1F,$FC,$7F,$1F,$1F,$30,$03,$0F,$FF,$C0,$C0
DC.B $C0,$3F,$F0,$30,$00,$CF,$FF,$FC,$00,$33,$FF,$FC,$C0,$C0,$C3,$03
DC.B $C0,$00,$07,$F0,$00,$7F,$00,$E0,$1F,$C1,$C1,$FC,$00,$01,$F8,$00
DC.B $3F,$3F,$FE,$7E,$3F,$8F,$FC,$0F,$FF,$FF,$FF,$C0,$FF,$FF,$FF,$C0
DC.B $00,$FF,$FF,$FC,$00,$0F,$FF,$FF,$FF,$C0,$C7,$0C,$C0,$00,$07,$F0
DC.B $00,$7F,$07,$1C,$1F,$CE,$39,$FC,$00,$01,$FC,$00,$7F,$1F,$FC,$7F
DC.B $1F,$1F,$0C,$0C,$03,$FF,$03,$00,$30,$FF,$FC,$30,$00,$CF,$FF,$FC
DC.B $00,$33,$FF,$FC,$18,$00,$C3,$D8,$C0,$00,$07,$F0,$00,$7F,$38,$03
DC.B $9F,$F0,$07,$F6,$00,$03,$3F,$01,$F9,$87,$F0,$CF,$C0,$7E,$0C,$0C
DC.B $03,$FF,$00,$C0,$C0,$3F,$F0,$0C,$7F,$C3,$FF,$FF,$F8,$C3,$FF,$F0
DC.B $18,$00,$C0,$C0,$C0,$00,$07,$FF,$FF,$FF,$C0,$00,$7F,$FF,$FF,$F1
DC.B $C0,$1C,$0F,$FF,$E0,$70,$07,$03,$FF,$F8,$0C,$0C,$03,$FF,$00,$33
DC.B $00,$0F,$C0,$03,$60,$00,$F8,$00,$1B,$00,$07,$C0,$18,$00,$C7,$FE
DC.B $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$F0,$3F,$E0,$01,$FF
DC.B $00,$0F,$F8,$00,$7F,$C0,$0F,$FC,$03,$FF,$00,$0C,$00,$03,$00,$00
DC.B $E0,$00,$38,$00,$1C,$00,$07,$00,$1F,$FF,$C0,$AF
;
; LocTable:
DC.W $0000 ; Char (00)
DC.W $0017 ; Char (01)
DC.W $002E ; Char (02)
DC.W $0045 ; Char (03)
DC.W $005C ; Char (04)
DC.W $0071 ; Char (05)
DC.W $0086 ; Char (06)
DC.W $009B ; Char (07)
DC.W $00B0 ; Char (08)
DC.W $00C2 ; Char (09)
DC.W $00D4 ; Char (0A)
DC.W $00E6 ; Char (0B)
DC.W $00F8 ; Char (0C)
DC.W $010A ; Char (0D)
DC.W $011C ; Char (0E)
DC.W $012E ; Char (0F)
DC.W $0140 ; Char (10)
DC.W $0152 ; Char (11)
DC.W $0152 ; Char (12)
;
; OWTable:
DC.W $0017 ; Char (00)
DC.W $0017 ; Char (01)
DC.W $0017 ; Char (02)
DC.W $0017 ; Char (03)
DC.W $0015 ; Char (04)
DC.W $0015 ; Char (05)
DC.W $0015 ; Char (06)
DC.W $0015 ; Char (07)
DC.W $0012 ; Char (08)
DC.W $0012 ; Char (09)
DC.W $0012 ; Char (0A)
DC.W $0012 ; Char (0B)
DC.W $0012 ; Char (0C)
DC.W $0012 ; Char (0D)
DC.W $0012 ; Char (0E)
DC.W $0012 ; Char (0F)
DC.W $0012 ; Char (10)
DC.W $0404 ; Char 'H'
DC.W $0000 ; Char 'I'
;
ENDP
END