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
22 KiB
NASM

title 'Super Controls'
**********************************************************************
*
* Copyright Apple Computer, Inc. 1986-89
* All rights reserved
*
*
* New Calls Supporting Super Controls
*
* Change History
*
* 23 Nov 88 Steven Glass
*
* Changed GetCtlHandleFromID to take a window pointer as input
* so this call could be used for controls outside the active window.
*
* 15 Feb 89 Harry Yee
*
* Changed MakeNextControlActive and MakeThisCtlActive to first check
* if the control is visible or not before making it active.
* BRC #41247, 41246 (caused problems with invisible Line Edit controls)
*
* 16-Apr-91 Dave Lyons
*
* Changed SendEventToCtl to never send stuff to an invisible control.
*
* 22-Aug-91 Dave Lyons
*
* Made MakeNextCtlTarget (MakeNextControlActive) check for the Command
* key, and cycle through the controls backwards if it's pressed.
*
**********************************************************************
Blanks off
String asis
;-----------------------------------------------------------
;
; Include Equate and macro files
;
; All.macros
; equates.asm
; superequates.asm
;
print push
print off
INCLUDE 'all.macros'
include 'equates.asm'
include 'SuperEquates.asm'
;-----------------------------------------------------------
;
; Global Imports
;
import CMpop0bytes
import CMpop4bytes
import CMpop6bytes
import CMpop8bytes
import CMpop10bytes
import CMpop12bytes
print pop
title 'FindActiveControl'
****************************************************************
*
FindActiveControl PROC EXPORT
*
* This routine returns the handle to the active
* super control. A number of errors can be returned:
*
* NOWIND_Err
* NoCtlError
* NoSuperCtlError
* NoCtlActiveError
*
* Note: This call only works with the front window.
*
*
* Inputs:
* none
*
* Outputs:
* ControlHandle
*
* External Refs:
import CMStartup
import FindActiveGuts2
*
* Entry Points:
* none
*
longa on ; mode
longi on
*
****************************************************************
ResultH equ Inputs
jsr CMStartup ; link things in and start things up.
stz ResultH
stz ResultH+2
jsr FindActiveGuts2
bcs Done
lda ctlHand ; move result into place
sta ResultH
lda ctlHand+2
sta ResultH+2
Done brl CMpop0Bytes
ENDP
title 'MakeNextControlActive'
****************************************************************
*
MakeNextControlActive PROC EXPORT
*
* This routine returns the handle to the newly activated
* super control. A number of errors can be returned:
*
* NOWIND_Err
* NoCtlError
* NoSuperCtlError
* NoCtlToBeActiveError
*
* The newly activated control and the newly deactivated
* control are both sent activation messages so that
* they can change their display.
*
* This routine has the strange ability to return the
* same control as was originally active. When this
* happens, no activation messages are sent.
*
* Note: This call only works on the front window.
*
* Inputs:
* none
*
* Outputs:
* ControlHandle
*
* External Refs:
import CMStartup
import FindActiveGuts2
import GetFirstSuperControl
import GetNextSuperControl
import CallIt
import CMDispatch
*
* Entry Points:
* none
*
longa on ; mode
longi on
*
****************************************************************
ResultH equ Inputs
import dereference
jsr CMStartup ; link things in and start things up.
stz work ; indicate that this is the first time in
stz ResultH
stz ResultH+2
jsr FindActiveGuts2 ; get first active control in
bcc GotActive ; front window.
PushLong #0 ; nothing active, put 0 on stack
brl TryFirst
GotActive pei CtlHand+2 ; this is the control that needs to
pei CtlHand ; be made inactive
ldy #NewCtlRecord.CtlMoreFlags ; Clear current active bit
lda [<CtlPtr],y
and #($FFFF-FCtlActive)
sta [<CtlPtr],y
*** added 22-Aug-91 DAL -- check for Command key to cycle backwards
lda >$E0C025
and #$0080
beq @cycleForward
; Find previous super control.
; <Work is the starting point. If we get back there we're done.
; <Work+4 is the control we visited last, the one we want to make active.
lda <ctlHand+2
ldx <ctlHand
sta <work+2
stx <work
@keepAndSearch lda <ctlHand+2 ;this one would be okay, so remember it
ldx <ctlHand
sta <work+6
stx <work+4
@search jsr GetNextSuperControl
bcc @gotOne
jsr GetFirstSuperControl
@gotOne
ldy #NewCtlRecord.CtlMoreFlags ; can this be active?
lda [<CtlPtr],y
and #FCtlCanBeActive
beq @search ; no, go on
ldy #NewCtlRecord.CtlFlag ; check if its visible or not
lda [<CtlPtr],y
bit #$0080
bne @search ; no, go on
lda <ctlHand+2 ;are we back where we started yet?
ldx <ctlHand
cmp <work+2
bne @keepAndSearch
cpx <work
bne @keepAndSearch
lda <work+6
ldx <work+4
sta <ctlHand+2
stx <ctlHand
jsr dereference
bra useThisControl
@cycleForward
*** end 22-Aug-91 DAL
Again jsr GetNextSuperControl ; find next control that can be made active
bcs TryFirst ; no more, so start back
;
; --- Got next super control -----------------------------------------------------------------------
;
TryThis
ldy #NewCtlRecord.CtlMoreFlags ; can this be active?
lda [<CtlPtr],y
and #FCtlCanBeActive
beq Again ; no, go on
ldy #NewCtlRecord.CtlFlag ; check if its visible or not
lda [<CtlPtr],y
bit #$0080
bne Again ; no, go on
useThisControl ldy #NewCtlRecord.CtlMoreFlags ; make it active
lda [<CtlPtr],y
ora #FCtlActive
sta [<CtlPtr],y
lda ctlHand ; return result
sta ResultH
lda ctlHand+2
sta ResultH+2
jsr Notify2 ; notify control that is being deact. and
; ; the one being made active,
; ; deact. control is on stack, active
; ; control is in ctlhand
NoError ldy #0
exit pla ; clear the stack
pla
brl CMpop0Bytes
TryFirst lda <Work ; see if we've been here before
bne Oops
dec <Work ; mark that we are here
jsr GetFirstSuperControl
bcc TryThis
bra exit
Oops ldy #NoCtlToBeActiveError
bra exit
;-----------------------------------------------------------
;
; This is the entry point for notifying two controls
; that their status changed.
;
; The control that was deactivated is on the stack.
; The control that was activated is in ctlHand
;
; This routine does not alter the stack.
;
ENTRY Notify2
Notify2
DefineStack
RTSAddr word
OldHandle long
lda ctlHand
cmp OldHandle,s
bne NotSame
lda ctlHand+2
cmp OldHandle+2,s
beq Same
;-----------------------------------------------------------
;
; The active control changed, so we have to notify
; the old one and the new one.
NotSame lda OldHandle+2,s ; first the old one
tax
lda OldHandle,s
bne OK ; if there was one
cpx #0
beq NoOld
OK jsr Notify
NoOld ldx CtlHand+2
lda CtlHand
jsr Notify
Same rts
Notify
pei CtlHand+2 ; save old ctlhand
pei CtlHand
stx CtlHand+2 ; put this one in ctlHand
sta CtlHand
lda #0
tay
ldx #ctlChangeActivity
jsr CMDispatch
pla ; restore CtlHand
sta CtlHand
pla
sta CtlHand+2
rts
ENDP
title 'MakeThisCtlActive'
****************************************************************
*
MakeThisCtlActive PROC EXPORT
*
* This routine makes the specified control active
*
* NotSuperCtlError
* CannotBeActiveError
*
*
*
*
* Inputs:
* TheControl
*
* Outputs:
* none
*
* External Refs:
import CMStartup
import Dereference
import IsItSuper
import Notify2
import FindActiveGuts
import UseThisWindPtr
*
* Entry Points:
* none
*
longa on ; mode
longi on
*
*
* Change History
*
* 17 Nov 88 Steven Glass
*
* This routine did not work if the control's window was not
* active. We fix this by getting the control's window pointer
* from the control record instead of the window manager.
*
* Bug was found by opening a window (invisible), calling
* NewControl2 for a number lineedit items. Each item is
* made active with this call, but since we could not find
* the window, we could not clear any of the others.
*
* 15 Feb 89 Harry Yee
*
* Before making a control active we were not checking to
* see whether it was visible first.
*
****************************************************************
TheControl equ Inputs
jsr CMStartup ; link things in and start things up.
lda TheControl ; setup pointer to this control's window.
sta ctlHand
lda TheControl+2
sta ctlHand+2
jsr Dereference
ldy #NewCtlRecord.CtlOwner+2
lda [ctlPtr],y
tax
dey
dey
lda [ctlPtr],y
jsr UseThisWindPtr
jsr FindActiveGuts ; look for old active
bcc FoundActive
PushLong #0 ; there was no old active
bra FixThisOne ; so put 0 on stack
FoundActive pei ctlHand+2 ; put old active on stack
pei ctlHand
jsr Dereference ; clear the active bit
ldy #NewCtlRecord.CtlMoreFlags
lda [CtlPtr],y
and #($FFFF-FCtlActive)
sta [CtlPtr],y
FixThisOne
lda TheControl ; move control handle in and deref it
sta ctlHand ; this is the control that we want to
lda TheControl+2 ; make active
sta ctlHand+2
jsr Dereference
jsr IsItSuper ; if it is not super, return error
bcs NotSuper
ldy #NewCtlRecord.CtlFlag ; check if the control is visible
lda [<CtlPtr],y
bit #$0080 ; check the invisible bit
bne NotPossible ; if set then control is invisible
ldy #NewCtlRecord.CtlMoreFlags ; control is visible, now check if it
lda [<CtlPtr],y ; can be made active
and #FCtlCanBeActive
beq NotPossible
lda [<CtlPtr],y ; make it active
ora #FCtlActive
sta [<CtlPtr],y
jsr Notify2 ; let control know that its being made
; ; active
ldy #0 ; no error
exit pla ; clean stack
pla
brl CMpop4Bytes
NotSuper ldy #NotSuperCtlError ; error is this is not rt type of control
bra Exit
NotPossible ldy #CanNotBeActiveError ; error is this cannot be made active
bra Exit ; caused by ctlMoreFlags FCtlCanBeActive
; ; bit not set or control is invisible
ENDP
title 'SendEventToControl'
****************************************************************
*
SendEventToControl PROC EXPORT
*
* This call is used to send events to the active control and to
* any *visible* control including the active control.
*
* If the ActiveOnly flag is TRUE, then only the active control
* gets the event.
*
* If the Active flag is FALSE, then the following takes place.
* We perform a two part search for a control to take this event.
* First, we look for controls that want key strokes that are
* not edit fields. Each control is asked to take the event.
* If none of these controls wants hte event, the active
* edit field is asked to accept the event.
*
* If no control accepts the event, the output is FALSE. If
* one of the controls accepts the event, the output is TRUE.
* The handle of the accepting control is put into TaskDATA2 and
* the ItemID is put in TaskDATA3.
*
*
* Inputs:
* ActiveOnlyFlag
* WindowPtr
* TaskRecPtr
*
* Outputs:
* BooleanWord
*
* External Refs:
import CMStartup
import UseThisWindPtr
import GetFirstSuperControl
import GetNextSuperControl
import FindActiveGuts
import CMDispatch
*
* Entry Points:
* none
*
longa on ; mode
longi on
*
* Change History
*
* 04 Nov 88 Steven Glass
*
* The control ID was returned in the wrong place and the
* result from the DefPRoc was not returned at all.
*
* 17 Nov 88 Steven Glass
*
* Now use the specified window pointer instead of FrontWindow.
*
****************************************************************
TaskRecPtr equ Inputs
WindowPtr equ TaskRecPtr+4
ActiveOnlyFlag equ WindowPtr+4
BooleanResult equ ActiveOnlyFlag+2
jsr CMStartup
stz BooleanResult ; assume the worst
lda WindowPtr
ldx WindowPtr+2
jsr UseThisWindPtr
bcs exit
lda ActiveOnlyFlag
bne TryActive
jsr GetFirstSuperControl
bcs exit
Loop
ldy #NewCtlRecord.CtlMoreFlags ; if this one can be active, skip it for now
lda [<CtlPtr],y
and #FCtlCanBeActive
bne SkipThisOne
lda [<CtlPtr],y ; if the control does not want events, then
and #FCtlWantEvents ; we skip it.
beq SkipThisOne
*** 16-Apr-91 DAL -- if the control is invisible, ignore it
ldy #NewCtlRecord.ctlFlag
lda [<CtlPtr],y
and #$0080
bne SkipThisOne
*** end of 16-Apr-91 DAL
jsr SendIt
lda BooleanResult
bne FinishUp
SkipThisOne
jsr GetNextSuperControl
bcc Loop
TryActive
jsr FindActiveGuts
bcs Done
jsr SendIt
lda BooleanResult
beq Done
FinishUp
;
; Return the handle to the control in TaskDATA2
;
ldy #NewTaskRecord.TaskData2
lda ctlHand
sta [TaskRecPtr],y
iny
iny
lda ctlHand+2
sta [TaskRecPtr],y
;
; Return the result passed by defProc in TaskData3
;
lda BooleanResult
ldy #NewTaskRecord.TaskData3
sta [<TaskRecPtr],y
;
; Return the control ID in taskdata4.
;
ldy #NewCtlRecord.CtlID
lda [CtlPtr],y
ldy #NewTaskRecord.TaskData4
sta [<TaskRecPtr],y
ldy #NewCtlRecord.CtlID+2
lda [CtlPtr],y
ldy #NewTaskRecord.TaskData4+2
sta [<TaskRecPtr],y
Done ldy #0
exit brl CMpop10Bytes
;-----------------------------------------------------------
;
; Local routine to actually call the defproc
;
SendIt
lda TaskRecPtr
ldy TaskRecPtr+2
ldx #ctlHandleEvent
jsr CMDispatch
sta BooleanResult
rts
ENDP
title 'GetHandleFromID'
****************************************************************
*
getHandleFromID PROC EXPORT
*
* Returns the handle of the control with the specified ID.
* This routine only searches the specified window.
*
*
* Inputs:
* HandleSpace LONG
* WindowPtr LONG
* ID LONG
*
* Outputs:
* ControlHandle
*
* External Refs:
import CMStartup
import UseThisWindPtr
import GetFirstSuperControl
import GetNextSuperControl
*
* Entry Points:
* none
*
longa on ; mode
longi on
*
* Change History
*
* 23 Nov 88 Steven Glass
*
* Added WindowPtr input so this call can be made for any window.
*
****************************************************************
TheID equ Inputs
TheWindow equ TheID+4
TheHandle equ TheWindow+4
jsr CMStartup Do tool function setup.
stz <TheHandle Assume it won't be found
stz <TheHandle+2
lda TheWindow
ldx TheWindow+2
jsr UseThisWindPtr
bcs exit
jsr GetFirstSuperControl
bcs exit
Loop ldy #NewCtlRecord.CtlID
lda [<ctlPtr],y
cmp <TheID
bne Nope
iny
iny
lda [<ctlPtr],y
cmp <TheID+2
bne Nope
lda <ctlHand
sta <TheHandle
lda <ctlHand+2
sta <TheHandle+2
ldy #0
exit brl CMpop8bytes
nope jsr GetNextSuperControl
bcc Loop
ldy #NoSuchIDError
bra exit
ENDP
title 'Set and Get CtlID'
****************************************************************
*
setCtlID PROC EXPORT
*
* Sets CtlID field in control.
*
*
* Inputs:
* TheID LONG
* TheControl LONG
*
* Outputs:
* none
*
* External Refs:
import CMStartup
import getCtlHand
import isItSuper
import set_long
*
* Entry Points:
* none
*
longa on ; mode
longi on
*
****************************************************************
jsr CMStartup Do tool function setup.
;
jsr getCtlHand ctlHand = passed control handle.
; ctlPtr = (ctlHand).
ldy #NoCtlError
bcs pop8 Null handle passed?
;
jsr IsItSuper
bcs pop8
ldy #NewCtlRecord.CtlID
brl Set_LONG
ldy #0
pop8
brl CMpop8bytes
ENDP
****************************************************************
*
GetCtlID PROC EXPORT
*
* Returns CtlID field in control.
*
*
* Inputs:
* space for result LONG
* TheControl LONG
*
* Outputs:
* TheID LONG
*
* External Refs:
import CMStartup
import getCtlHand
import isItSuper
import get_long
import pop4
*
* Entry Points:
* none
*
longa on ; mode
longi on
*
****************************************************************
jsr CMStartup Do tool function setup.
;
jsr getCtlHand ctlHand = passed control handle.
; ctlPtr = (ctlHand).
ldy #NoCtlError
bcs pop4 Null handle passed?
;
jsr IsItSuper
bcs pop4
ldy #NewCtlRecord.CtlID
brl get_long
ENDP
title 'Get and Set MoreFlags'
****************************************************************
*
GetCtlMoreFlags PROC EXPORT
*
* Returns the moreflags field of the control record.
*
*
* Inputs:
* WordSpace
* ControlHandle
*
* Outputs:
* MoreFlags WORD
*
* External Refs:
import CMStartup
import isItSuper
import getCtlHand
*
* Entry Points:
entry pop4
*
longa on ; mode
longi on
*
****************************************************************
TheControl equ Inputs
ResultFlags equ TheControl+4
jsr CMStartup Do tool function setup.
;
jsr getCtlHand ctlHand = passed control handle.
; ctlPtr = (ctlHand).
ldy #NoCtlError
bcs pop4 Null handle passed?
;
jsr IsItSuper
bcs pop4
;
ldy #NewCtlRecord.CtlMoreFlags
lda [<Ctlptr],y
sta <ResultFlags
;
ldy #0 No error flag.
entry pop4
pop4
brl CMpop4bytes
;
ENDP
****************************************************************
*
SetCtlMoreFlags PROC EXPORT
*
* Sets the moreFlags field of the control record.
*
*
* Inputs:
* NewControlType WORD
* ControlHandle LONG
*
* Outputs:
* none
*
* External Refs:
import CMStartup
import getCtlHand
import get_long
import isItSuper
*
* Entry Points:
* none
*
longa on ; mode
longi on
*
****************************************************************
TheControl equ Inputs
NewFlags equ TheControl+4
jsr CMStartup Do tool function setup.
;
jsr getCtlHand ctlHand = passed control handle.
; ctlPtr = (ctlHand).
ldy #NoCtlError
bcs pop6 Null handle passed?
;
jsr IsItSuper
bcs pop6
;
ldy #NewCtlRecord.CtlMoreFlags
;
lda <NewFlags
sta [<Ctlptr],y
;
ldy #0 No error flag.
;
pop6
brl CMpop6bytes
ENDP
title 'NotifyControls'
****************************************************************
*
NotifyControls PROC EXPORT
*
* For every super control in the control list whose
* MoreFlags field ANDs with mask and is not zero, we
* send the indicated message with the indicated param.
*
*
; IN: PUSH:WORD - MASK
; PUSH:WORD - Message to Send
; PUSH:LONG - Value for Param
; PUSH:LONG - Pointer to Window
;
; OUT: Nothing.
;
*
* External Refs:
import CMStartup
import UseThisWindPtr
import GetFirstSuperControl
import GetNextSuperControl
import Set2Draw
import PushPort
import Set2DrawCtl
import ReadMoreFlags
import CMDispatch
import PopPort
*
* Entry Points:
* none
*
longa on ; mode
longi on
*
* Change History
*
* 04 Nov 88 Steven Glass
*
* Added input to this routine so can notify controls that
* are not in the front window.
*
* 17 Nov 88 Steven Glass
*
* Now use the specified window pointer instead of FrontWindow.
*
****************************************************************
DSect Inputs
TheWindow long
TheParam long
TheMessage word
TheMask word
;
;
jsr CMStartup Do tool function setup.
lda TheWindow
ldx TheWindow+2
jsr UseThisWindPtr
bcs exit
jsr GetFirstSuperControl
bcs exit
;
jsr set2draw Setup to draw standard controls.
jsr pushPort Save the current port.
jsr set2drawCtl Setup to draw the control.
Loop
jsr ReadMoreFlags
and TheMask
beq SkipThisOne
lda <TheParam Pass new view and data sizes.
ldy <TheParam+2
ldx <TheMessage Task number.
jsr CMDispatch
SkipThisOne
jsr GetNextSuperControl
bcc Loop
jsr popPort Restore the current port.
;
exit ldy #0 No error flag.
brl CMpop12bytes
ENDP
title 'IsItSuper'
****************************************************************
*
IsItSuper PROC
*
* This short routine returns whether or not the
* control in ctlHand/ctlPtr is a super control.
*
* If it is a super control, then y is zeroed and carry is
* clear. If it is not, y is set to the NotSuperCtlError
* and carry is set.
*
*
*
* Inputs:
* CtlPtr
*
* Outputs:
* carry
* y-reg
*
* External Refs:
* none
*
* Entry Points:
* none
*
longa on ; mode
longi on
*
****************************************************************
ldy #NewCtlRecord.CtlProc+2
lda [<CtlPtr],y
bpl Nope
ldy #0
Out cpy #1
rts
Nope ldy #NotSuperCtlError
bra Out
ENDP
title 'GetFirstSuperControl'
****************************************************************
*
GetFirstSuperControl PROC
*
* Sets ctlHand and CtlPtr up with the first super control
* in the control list.
*
* Two errors can be returned:
*
* NoCtlError
* NoSuperCtlError
*
*
* Inputs:
* GetFirstCtl relys on Windptr being right
*
* Outputs:
* ctlHand & CtlPtr
* Carry clear if there is one
* set if there is not
* y-reg 0 if no error
* error code otherwise
*
* External Refs:
import GetFirstCtl
import IsItSuper
import next_Ctl
*
* Entry Points:
ENTRY GetNextSuperControl
*
longa on ; mode
longi on
*
****************************************************************
jsr GetFirstCtl
beq NoControl
jsr IsItSuper
bcc Done
;-----------------------------------------------------------
;
; Secondary Entry for GetNextSuperControl
;
GetNextSuperControl
Loop jsr Next_Ctl
beq Nope
jsr IsItSuper
bcs Loop
Done ldy #0
rts
Nope ldy #NoSuperCtlError
sec
rts
NoControl ldy #NoCtlError
sec
rts
ENDP
title 'UseThisWindPtr'
****************************************************************
*
UseThisWindPtr PROC
*
* This routine sets up the indicated window pointer for use.
* If the specified pointer is zero, we use the front window
* instead.
*
* Secondary entry point (UseFrontWindow works the same but
* does not check input registers, just calls frontwindow).
*
*
* Inputs:
* a-reg low word of window ptr
* x-reg high word of window ptr
*
* Outputs:
* carry indicates error
* y-reg has error if any
* windPtr (direct page) set for use
*
* External Refs:
import makeWPtr
*
* Entry Points:
entry UseFrontWindow
*
longa on ; mode
longi on
*
* Change History
*
* 21 Nov 88 Steven Glass
*
* Had a bne instead of beq to iszero on last test after
* front window call.
*
****************************************************************
txy
bne NotZero
tay
bne NotZero
UseFrontWindow
pha
pha
_FrontWindow
pla
plx
bne NotZero
tay
beq IsZero
NotZero
jsr makeWptr ;windptr = pointer to window.
clc
rts
IsZero
ldy #NOWIND_Err
sec
rts
ENDP
title 'ActiveGuts'
****************************************************************
*
ActiveGuts PROC
*
* This routine finds the active super control in the window
* specified by WindowPtr. The result is returned in ctlHand
* on direct page.
*
* If the control is not found, an error is returned in
* the y-reg. The y-reg is zero if all is ok.
*
* Possible errors are.
*
* NOWIND_Err
* NoCtlError
* NoSuperCtlError
* NoCtlActiveError
*
*
*
*
* Inputs:
* none
*
* Outputs:
* ControlHandle
*
* External Refs:
import CMStartup
import GetFirstSuperControl
import GetNextSuperControl
import UseFrontWindow
*
* Entry Points:
ENTRY FindActiveGuts ; (uses indicated window)
ENTRY FindActiveGuts2 ; (uses frontwindow)
*
longa on ; mode
longi on
*
****************************************************************
ResultH equ Inputs
FindActiveGuts2
jsr UseFrontWindow
bcs exit
FindActiveGuts
jsr GetFirstSuperControl
bcs exit
Loop ldy #NewCtlRecord.CtlMoreFlags
lda [<CtlPtr],y
and #FCtlActive
beq NotThisOne
ldy #0 ; no error
exit cpy #1 ; set carry correctly for error condition
rts
NotThisOne jsr GetNextSuperControl
bcc Loop
ldy #noCtlActiveError
bra Exit
ENDP
END