mirror of
https://github.com/marketideas/qasm.git
synced 2026-10-25 13:02:45 +00:00
Move the assembler to src/qasm. qlink links OMF 1.0 and 2.0 from a script. makeBin flattens a load file, qomf dumps OMF, and qpro builds ProDOS volumes. APW and MPW assemble through the ORCA front end. Relocatable modules emit OMF objects. Listings stay off unless -l is set. make boot assembles the GS/OS 6.0.1 ProDOS 8 kernel and BASIC.SYSTEM into an 800K volume. BASIC.SYSTEM accepts ls and pfx, and its splash reports PRODOS BASIC 2.0, copyright 1983-2026. IIGS.601.SRC is the source and the BASIC.SYSTEM oracle that image is built from.
1 line
19 KiB
NASM
1 line
19 KiB
NASM
title 'StatTextProc'
|
|
**********************************************************************
|
|
*
|
|
* Static Text Control Def Proc
|
|
*
|
|
*
|
|
* Copyright (C)
|
|
* Apple Computer, Inc. 1986-1989
|
|
* All Rights Reserved
|
|
*
|
|
* 23 Sep 88 Steven Glass
|
|
*
|
|
* Coding began from modified version of Tech Support's custom
|
|
* control (by Keith Rollin).
|
|
*
|
|
* 10 Oct 88 Steven Glass
|
|
*
|
|
* Made memory allocation work correctly for the four cases: ptr, handle
|
|
* resource and offset. Got drawing to work correctly for offset.
|
|
* Removed code that looked for errors from resource loads. Locked
|
|
* and unlocked control handle around calls to LETextBox2 when text
|
|
* is in the control record.
|
|
*
|
|
* 23 Nov 88 Steven Glass
|
|
*
|
|
* Removed code that supports offsets.
|
|
*
|
|
* 06 Feb 89 Steven Glass
|
|
*
|
|
* Added support for initial justification being other than 0.
|
|
* Changed drawing routine to deref the control handle after
|
|
* compiling text and drawing text.
|
|
*
|
|
* 22 Mar 89 Harry Yee
|
|
*
|
|
* Control handle was not being derefed enough times possibly allowing memory to move
|
|
* and making pointer no longer valid. In routine ConvertRefToPtr added additional deref
|
|
* after GetHandleSize call.
|
|
*
|
|
* 28 Mar 89 Steven Glass
|
|
*
|
|
* Added support for the ctlWinStateChange message. Message is ignored
|
|
* since this control does not look any different if it is in an active vs
|
|
* inactive window.
|
|
*
|
|
* 09 Apr 89 Harry Yee
|
|
*
|
|
* The 22 Mar 89 fix above didn't fix the bug. Problem was LETextBox2 moves memory!
|
|
* Since the control handle is unlocked, the ptr to the control rect passed to
|
|
* LETextBox2 could possibly become invalid after the first NewHandle call in
|
|
* LETextBox2. We now make sure we lock the control's handle. BRC #46453.
|
|
*
|
|
* 4/13/89 Mensch
|
|
*
|
|
* The apr 09 fix caused a strange bug when the defproc is called for the rec size,
|
|
* it tries to unlock the control handle, but fails since the control handle
|
|
* does not exist, here. Now we will branch around the unlock if the ctrlcode
|
|
* is 6
|
|
*
|
|
* 8/31/89 Yee
|
|
*
|
|
* Changed the name of routine do_init to do_StatInit. This is to avoid conflict
|
|
* between other defprocs using this same name.
|
|
* Fix bug in INIT routine where the justification field from the template
|
|
* is not being copied over to the control record. BRC #51450.
|
|
*
|
|
* 5-Apr-91 Dave Lyons
|
|
*
|
|
* Added a flag bit to just call DrawText instead of LETextBox2.
|
|
* It's ctlFlag bit 2 ($0004). If you set this bit, you must not
|
|
* include any LETextBox2 formatting commands, and you must not
|
|
* be doing any substitutions. They won't be happen.
|
|
*
|
|
* 27-Oct-91 Dave Lyons
|
|
*
|
|
* Added new ctlFlag bit for static text controls--fTextCanDim,
|
|
* $0008, makes text dim when it goes inactive. This is only
|
|
* useful for small controls, since the text draws first and then
|
|
* gets wiped over with gray.
|
|
*
|
|
* 1-Dec-91 Dave Lyons
|
|
*
|
|
* When a Stat Text control with fTextCanDim gets a ctlChangeWinState
|
|
* message, it must invalidate itself.
|
|
*
|
|
* 24-Mar-93 Jim Murphy
|
|
*
|
|
* Defined a new ctlFlag bit - fSquishText. If both fBlastText and this
|
|
* new bit are set, we use DrawStringWidth instead of DrawString.
|
|
*
|
|
**********************************************************************
|
|
|
|
blanks off
|
|
string asis
|
|
|
|
print push
|
|
print off
|
|
|
|
include 'all.macros'
|
|
|
|
include 'CtlCustomEqus.asm'
|
|
include 'e16.quickdraw'
|
|
include 'e16.resources'
|
|
|
|
;
|
|
; new ctlFlag bits for Static Text controls in 6.0 (DAL)
|
|
;
|
|
fBlastText equ $0004
|
|
fTextCanDim equ $0008
|
|
|
|
; For 6.0.1 - 23-Mar-93 JCM
|
|
|
|
fSquishText equ $0010 ;24-Mar-93 JCM
|
|
|
|
;-----------------------------------------------------------
|
|
;
|
|
; Stack Fram Equates for control
|
|
;
|
|
DefineStack
|
|
OrigD WORD ; caller's saved direct page register
|
|
OrigB byte ; caller's saved data bank register
|
|
CtlPtr LONG ; pointer to control record
|
|
RtnAddr block 3 ; RTL address back to Control Manager
|
|
theCtlHandle LONG ; handle to control record
|
|
CtlParam LONG ; add'l parameter passed to DefProc
|
|
CtlCode WORD ; operation to perform
|
|
ReturnValue LONG ; space for return value to Ctl Mgr.
|
|
|
|
|
|
print pop
|
|
|
|
|
|
title 'StatTextProc -- Main Entry'
|
|
****************************************************************
|
|
*
|
|
StatTextProc PROC EXPORT
|
|
*
|
|
* This is the def_proc for static text. When this
|
|
* routine gets control, the stack looks as described below.
|
|
*
|
|
*
|
|
*
|
|
* Inputs: On entry, the parameters are passed to us on the stack.
|
|
*
|
|
* | | Previous Contents
|
|
* |-------------------|
|
|
* | ReturnValue | LONG - Space for return value
|
|
* |-------------------|
|
|
* | CtlCode | WORD - operation to perform
|
|
* |-------------------|
|
|
* | CtlParam | LONG - add'l parameter
|
|
* |-------------------|
|
|
* | theCtlHandle | LONG - Handle to control record
|
|
* |-------------------|
|
|
* | RtnAddr | 3 BYTES - RTL address
|
|
* |-------------------|
|
|
* | | <-- Stack pointer
|
|
*
|
|
* Outputs: Put something into ReturnValue, pull off the parameters,
|
|
* and return to the Control Manager.
|
|
*
|
|
* | | Previous Contents
|
|
* |-------------------|
|
|
* | ReturnValue | LONG - Space for return value
|
|
* |-------------------|
|
|
* | RtnAddr | 3 BYTES - RTL address
|
|
* |-------------------|
|
|
* | | <-- Stack pointer
|
|
*
|
|
* External Refs:
|
|
import do_draw
|
|
import do_nothing
|
|
import do_test
|
|
import do_dispose
|
|
import do_StatInit
|
|
import do_recsize
|
|
import do_ChangeState
|
|
*
|
|
* Entry Points:
|
|
* none
|
|
*
|
|
longa on ; mode
|
|
longi on
|
|
*
|
|
****************************************************************
|
|
|
|
pha ; push on some room for 'CtlPtr'
|
|
pha
|
|
|
|
phb ; save the Data Bank register
|
|
phd ; save the Direct Page register
|
|
|
|
phk ; switch data bank to program bank
|
|
plb
|
|
tsc ; switch Direct Page into stack
|
|
tcd
|
|
|
|
lda <CtlCode
|
|
cmp #recSize
|
|
beq SkipDeref
|
|
|
|
ldy #4 ; first lock down the control handle
|
|
lda [<theCtlHandle],y
|
|
ora #$8000
|
|
sta [<theCtlHandle],y
|
|
|
|
lda [<theCtlHandle] ; now deref the control handle
|
|
sta <CtlPtr
|
|
ldy #2
|
|
lda [<theCtlHandle],y
|
|
sta <CtlPtr+2
|
|
|
|
SkipDeref
|
|
lda <CtlCode ; get routine # to call
|
|
cmp #ctlWinStateChange+1 ; make sure the msg is in range.
|
|
blt ShiftIt
|
|
lda #6 ; force unknown codes to null events
|
|
ShiftIt
|
|
asl a
|
|
tax
|
|
jsr (ActionTable,x)
|
|
|
|
sta <ReturnValue ; save the return value
|
|
stx <ReturnValue+2
|
|
|
|
;
|
|
; 4/13/89 fixed this to only unlock if the handle was locked!
|
|
lda <CtlCode
|
|
cmp #recSize
|
|
beq SkipUnLock
|
|
|
|
ldy #4 ; unlock the control handle
|
|
lda [<theCtlHandle],y
|
|
and #$7FFF
|
|
sta [<theCtlHandle],y
|
|
SkipUnLock
|
|
; ENDOFFIX
|
|
|
|
;
|
|
; The Return Value has been stored on the stack, and it is time for us to
|
|
; return back to the Control Manager. Before we do so, however, we must
|
|
; remove the parameters that were passed to us on the stack. We do this
|
|
; by moving the RTL address up just below the Return Value, getting the
|
|
; stack pointer, and adding an amount to it so that we point to where
|
|
; the RTL address has been moved to. We can then simply RTL back to the
|
|
; Control Manager, and it will pick up the Return Value right off of the
|
|
; stack!
|
|
;
|
|
lda <RtnAddr ; move the return address up
|
|
sta <ReturnValue-3
|
|
lda <RtnAddr+1
|
|
sta <ReturnValue-2
|
|
|
|
tsc ; Get the stack pointer
|
|
|
|
pld ; restore caller's Data Bank and
|
|
plb ; Direct Page registers
|
|
|
|
clc ; Adjust the stack pointer to point to
|
|
adc #ReturnValue-4 ; the new location of the RTL address.
|
|
tcs ; Put the stack pointer back.
|
|
|
|
rtl ; back to the caller
|
|
|
|
|
|
;
|
|
ActionTable DC.W do_draw 0 Draw simple button.
|
|
DC.W do_nothing 1 Compute drag RECT.
|
|
DC.W do_test 2 Common hit test routine.
|
|
DC.W do_StatInit 3 Initialize the control.
|
|
DC.W do_dispose 4 Dispose.
|
|
DC.W do_draw 5 New value.
|
|
DC.W do_nothing 6 Compute Thumber constrains.
|
|
DC.W do_nothing 7 Drag the indicator.
|
|
DC.W do_nothing 8 Auto action.
|
|
DC.W do_draw 9 New value.
|
|
DC.W do_nothing 10 Set min max.
|
|
DC.W do_nothing 11 Move button.
|
|
DC.W do_recsize 12 Return size of standard record.
|
|
dc.W do_nothing 13 take key or menu event
|
|
dc.W do_nothing 14 ctlChangeTarget
|
|
dc.W do_nothing 15 ctlChagneBounds
|
|
dc.W do_nothing 16 ctlWindChagneSize
|
|
dc.W do_nothing 17 ctlHandleTab
|
|
dc.W do_nothing 18 ctlNotifyMultiPart
|
|
dc.W do_ChangeState 19 ctlWinStateChange (1-Dec-91 DAL)
|
|
|
|
ENDP
|
|
|
|
title 'StatTextProc -- do_recsize'
|
|
****************************************************************
|
|
*
|
|
do_recsize PROC
|
|
*
|
|
* Returns the size of the control record. This is the
|
|
* normal size of a new control record.
|
|
*
|
|
* Note that the high word will always be 0.
|
|
*
|
|
*
|
|
* Inputs:
|
|
* none
|
|
*
|
|
* Outputs:
|
|
* a-reg & x-reg hold result for def proc
|
|
*
|
|
* External Refs:
|
|
* none
|
|
*
|
|
* Entry Points:
|
|
* none
|
|
*
|
|
longa on ; mode
|
|
longi on
|
|
*
|
|
****************************************************************
|
|
|
|
lda #superCtlSize
|
|
ldx #0 High word of size.
|
|
|
|
rts
|
|
|
|
ENDP
|
|
|
|
title 'StatTextProc -- do_nothing'
|
|
****************************************************************
|
|
*
|
|
do_nothing PROC
|
|
*
|
|
* This is the routine we use when there is nothing to do.
|
|
* It just returns zeros in the a and x registers.
|
|
*
|
|
*
|
|
* Inputs:
|
|
* ctlHandle
|
|
* ctlPtr
|
|
*
|
|
* Outputs:
|
|
* a-reg & x-reg hold result for def proc
|
|
*
|
|
* External Refs:
|
|
* none
|
|
*
|
|
* Entry Points:
|
|
* none
|
|
*
|
|
longa on ; mode
|
|
longi on
|
|
*
|
|
****************************************************************
|
|
|
|
;
|
|
lda #0 Nothing flag.
|
|
tax
|
|
|
|
rts
|
|
|
|
ENDP
|
|
|
|
title 'StatTextProc -- do_dispose'
|
|
****************************************************************
|
|
*
|
|
do_dispose PROC
|
|
*
|
|
* This is the routine we use when the control is disposed.
|
|
* The only thing this routine has to do is to release the
|
|
* resource if the text is referenced by resource.
|
|
*
|
|
*
|
|
* Inputs:
|
|
* ctlHandle
|
|
* ctlPtr
|
|
*
|
|
* Outputs:
|
|
* a-reg & x-reg hold result for def proc
|
|
*
|
|
* External Refs:
|
|
import CtlDataToAX
|
|
import GetRefType
|
|
*
|
|
* Entry Points:
|
|
* none
|
|
*
|
|
longa on ; mode
|
|
longi on
|
|
*
|
|
****************************************************************
|
|
|
|
jsr GetRefType
|
|
|
|
cmp #$0002
|
|
bne NotResource
|
|
|
|
PushWord #rTextForLETextBox2 ; type
|
|
jsr CtlDataToAX
|
|
phx
|
|
pha
|
|
_CMReleaseResource
|
|
|
|
NotResource
|
|
;
|
|
lda #0 Nothing flag.
|
|
tax
|
|
|
|
rts
|
|
|
|
ENDP
|
|
|
|
title 'StatTextProc -- do_StatInit'
|
|
****************************************************************
|
|
*
|
|
do_StatInit PROC EXPORT
|
|
*
|
|
* Inits the data and value fields in the control record
|
|
* using values in the template.
|
|
*
|
|
* Also looks for the ctlJust field if the pCount is at least 9.
|
|
*
|
|
* The ctlData field is set to be a reference to the static text
|
|
* and the ctlValue field is set to be the size of the static
|
|
* text field (if the ref is a pointer).
|
|
*
|
|
*
|
|
* Inputs:
|
|
* ctlHandle
|
|
* ctlPtr
|
|
* ctlParam = ptr to template
|
|
*
|
|
* Outputs:
|
|
* a-reg and x-reg are zero.
|
|
*
|
|
* External Refs:
|
|
import GetRefType
|
|
*
|
|
* Entry Points:
|
|
* none
|
|
*
|
|
longa on ; mode
|
|
longi on
|
|
*
|
|
* Change History
|
|
*
|
|
* 06 Feb 89 Steven Glass
|
|
*
|
|
* Added support for the optional justification field in the
|
|
* template.
|
|
*
|
|
****************************************************************
|
|
|
|
jsr GetRefType ; low 2 bits of flag in a-reg
|
|
cmp #0
|
|
bne NotAPtr
|
|
|
|
ldy #StatTextTemplate.TextSize
|
|
lda [<ctlParam],y
|
|
ldy #NewCtlRecord.ctlValue
|
|
sta [<ctlPtr],y
|
|
|
|
NotAPtr
|
|
ldy #StatTextTemplate.TextRef
|
|
lda [<ctlParam],y
|
|
tax
|
|
iny
|
|
iny
|
|
lda [<ctlParam],y
|
|
|
|
ldy #NewCtlRecord.ctlData+2
|
|
sta [<ctlPtr],y
|
|
dey
|
|
dey
|
|
txa
|
|
sta [<ctlPtr],y
|
|
|
|
|
|
ldy #NewCtlRecord.CtlJust ; init the just word
|
|
lda #0
|
|
sta [<ctlPtr],y
|
|
tyx ; save offset in x
|
|
|
|
ldy #StatTextTemplate.pCount ; check the p count
|
|
lda [<ctlParam],y
|
|
cmp #9
|
|
bcc Fini
|
|
|
|
ldy #StatTextTemplate.Just ; move the real value
|
|
lda [<ctlParam],y ; into place
|
|
txy ; using saved offset.
|
|
sta [<ctlPtr],y
|
|
|
|
Fini
|
|
lda #0
|
|
tax
|
|
rts
|
|
|
|
|
|
|
|
ENDP
|
|
|
|
title 'StatTextProc -- do_test'
|
|
****************************************************************
|
|
*
|
|
do_test PROC
|
|
*
|
|
* Test if the mouse is down in the control. We always
|
|
* return no, since it does not make sense to "click" on
|
|
* static text.
|
|
*
|
|
*
|
|
* Inputs:
|
|
* ctlParam = point to check
|
|
*
|
|
*
|
|
* Outputs:
|
|
* a-reg and x-reg are always zero
|
|
*
|
|
* External Refs:
|
|
* none
|
|
*
|
|
* Entry Points:
|
|
* none
|
|
*
|
|
longa on ; mode
|
|
longi on
|
|
*
|
|
****************************************************************
|
|
|
|
ldy #NewCtlRecord.ctlHilite
|
|
lda [ctlPtr],y
|
|
and #$00FF
|
|
cmp #$00FF
|
|
beq Inactive
|
|
|
|
lda #1
|
|
ldx #0
|
|
rts
|
|
|
|
|
|
Inactive
|
|
lda #0
|
|
ldx #0
|
|
|
|
rts
|
|
|
|
ENDP
|
|
|
|
*** added 1-Dec-91 DAL
|
|
title 'StatTextProc -- do_ChangeState'
|
|
****************************************************************
|
|
*
|
|
do_ChangeState PROC
|
|
*
|
|
* Called when our window gets activated or inactivated. If
|
|
* the fTextCanDim bit is set, then invalidate the control
|
|
* rectangle so it will redraw.
|
|
*
|
|
* Inputs:
|
|
* ctlPtr
|
|
*
|
|
* Outputs:
|
|
* a-reg and x-reg are zero.
|
|
*
|
|
****************************************************************
|
|
|
|
ldy #NewCtlRecord.ctlFlag
|
|
lda [<CtlPtr],y
|
|
and #fTextCanDim
|
|
beq @exit
|
|
|
|
lda <ctlPtr
|
|
clc
|
|
adc #NewCtlRecord.ctlRect
|
|
tax
|
|
lda <ctlPtr+2
|
|
adc #0
|
|
pha
|
|
phx
|
|
_InvalRect
|
|
|
|
@exit lda #0
|
|
tax
|
|
rts
|
|
|
|
EndP
|
|
*** end 1-Dec-91 DAL
|
|
|
|
title 'StatTextProc -- do_draw'
|
|
****************************************************************
|
|
*
|
|
do_draw PROC
|
|
*
|
|
* Draws the control using LETextBox2. The control is only
|
|
* drawn if the part code being passed is 0, indicating the
|
|
* whole control.
|
|
*
|
|
*
|
|
* Inputs:
|
|
* ctlHandle
|
|
* ctlPtr
|
|
*
|
|
* Outputs:
|
|
* a-reg and x-reg are zero.
|
|
*
|
|
* External Refs:
|
|
import CtlDataToAX
|
|
import GetRefType
|
|
*
|
|
* Entry Points:
|
|
* none
|
|
*
|
|
longa on ; mode
|
|
longi on
|
|
*
|
|
*
|
|
* Change History
|
|
*
|
|
* 06 Feb 89 Steven Glass
|
|
*
|
|
* The control handle was not being re-derefed twice where
|
|
* memory could have moved: once after compiling text and
|
|
* once after drawing the text.
|
|
*
|
|
* Added new feature to drawing: the programmer can set
|
|
* a value for the initial justification. This value is
|
|
* kept in the ctlJust field of the control record.
|
|
*
|
|
****************************************************************
|
|
|
|
;-----------------------------------------------------------
|
|
;
|
|
; Look at the part code. If it is not 0, this is a request
|
|
; to hilite the control (which we ignore).
|
|
;
|
|
lda ctlParam
|
|
beq @cont
|
|
brl Fini
|
|
|
|
@cont
|
|
|
|
*
|
|
* 5-Apr-91 DAL
|
|
*
|
|
* See if we should just do a DrawString to draw this control
|
|
* really fast
|
|
*
|
|
ldy #NewCtlRecord.ctlFlag
|
|
lda [ctlPtr],y
|
|
and #fBlastText
|
|
|
|
*** Added - 23-Mar-93 JCM - Use DrawStringWidth if both fBlastText and fSquishText
|
|
*** bits are set.
|
|
|
|
;;; beq @notFast
|
|
bne @tryJimsWay
|
|
|
|
brl @notFast
|
|
|
|
@tryJimsWay ldy #NewCtlRecord.ctlRect+2 ;left edge
|
|
lda [<ctlPtr],y
|
|
pha
|
|
dey
|
|
dey ;offset to rect top
|
|
lda [ctlPtr],y
|
|
clc
|
|
adc #8
|
|
pha
|
|
_MoveTo
|
|
|
|
ldy #NewCtlRecord.ctlFlag
|
|
lda [ctlPtr],y
|
|
and #fSquishText ;should we call DrawStringWidth?
|
|
bne @doItJimsWay
|
|
|
|
brl @blastDavesWay ; nope, be boring
|
|
|
|
@doItJimsWay pha
|
|
pha ;space for ConvertRefToPtr result
|
|
jsr GetRefType
|
|
pha
|
|
jsr CtlDataToAX
|
|
phx
|
|
pha
|
|
jsr ConvertRefToPtr ;source ptr
|
|
pea @tempStringBuf>>16
|
|
pea @tempStringBuf+1 ;dest ptr
|
|
PushWord #0
|
|
ldy #NewCtlRecord.ctlValue
|
|
lda [<CtlPtr],y
|
|
sta @tempStringBuf ;save length byte
|
|
and #$00FF ;force to be a pstring
|
|
pha ;length
|
|
_BlockMove
|
|
|
|
jsr GetRefType
|
|
ora #$6000 ;flags - truncate left/pstring
|
|
pha
|
|
pea @tempStringBuf>>16
|
|
pea @tempStringBuf ;stringRef
|
|
ldy #NewCtlRecord.ctlRect+6 ;right edge
|
|
lda [<ctlPtr],y
|
|
sec
|
|
ldy #NewCtlRecord.ctlRect+2 ;left edge
|
|
sbc [<ctlPtr],y
|
|
pha ;width
|
|
ldx #$1512
|
|
jsl $E10000
|
|
; _DrawStringWidth
|
|
|
|
brl CleanUp
|
|
|
|
@tempStringBuf ds.b 256
|
|
|
|
@blastDavesWay ;the old, the boring, the Dave
|
|
|
|
; ldy #NewCtlRecord.ctlRect+2 ;left edge
|
|
; lda [<ctlPtr],y
|
|
; pha
|
|
; dey
|
|
; dey ;offset to rect top
|
|
; lda [ctlPtr],y
|
|
; clc
|
|
; adc #8
|
|
; pha
|
|
; _MoveTo
|
|
|
|
*** End - 23-Mar-93 JCM
|
|
|
|
pha
|
|
pha ;space for ConvertRefToPtr result
|
|
jsr GetRefType
|
|
pha
|
|
jsr CtlDataToAX
|
|
phx
|
|
pha
|
|
jsr ConvertRefToPtr
|
|
ldy #NewCtlRecord.ctlValue ; text length
|
|
lda [<CtlPtr],y
|
|
pha
|
|
_DrawText
|
|
brl CleanUp
|
|
|
|
@notFast
|
|
*** end of 5-Apr-91 DAL
|
|
|
|
;-----------------------------------------------------------
|
|
;
|
|
; See if we need to do substitution on the text.
|
|
;
|
|
|
|
ldy #NewCtlRecord.ctlFlag
|
|
lda [ctlPtr],y
|
|
and #FSubstituteText
|
|
bne MakeSubs
|
|
|
|
brl NoSubs
|
|
|
|
MakeSubs
|
|
|
|
; TextHandle := CompileText (SubType, SubArrayPtr, OrigTextPtr, OrigTextSize)
|
|
|
|
pha ; space for handle
|
|
pha
|
|
lda [ctlPtr],y ; type of text
|
|
and #FSubTextType
|
|
pha
|
|
pha ; pointer to sub array
|
|
pha
|
|
_GetCtlParamPtr
|
|
pha ; pointer to text
|
|
pha
|
|
|
|
jsr GetRefType
|
|
pha
|
|
jsr CtlDataToAX
|
|
phx
|
|
pha
|
|
jsr ConvertRefToPtr
|
|
ldy #NewCtlRecord.ctlValue ; text length
|
|
lda [<CtlPtr],y
|
|
pha
|
|
_CompileText
|
|
PullLong CtlParam ; Put resulting handle into CtlParam
|
|
|
|
pha ; Get handle's size.
|
|
pha
|
|
pei CtlParam+2
|
|
pei Ctlparam
|
|
_GetHandleSize
|
|
|
|
pla ; get size of handle off the stack
|
|
plx
|
|
pha ; put it on the stack 3 times
|
|
pha
|
|
pha
|
|
|
|
; Three copies of text size now on stack. First two will be over written by
|
|
; Pointer to text.
|
|
|
|
ldy #4 ; lock compiled text
|
|
lda [ctlParam],y
|
|
ora #$8000
|
|
sta [ctlParam],y
|
|
dey
|
|
dey
|
|
lda [ctlParam],y
|
|
tax
|
|
lda [ctlParam]
|
|
sta 3,s ; Handle^ goes on stack above size word
|
|
txa
|
|
sta 5,s
|
|
|
|
lda <CtlPtr ; rect pointer
|
|
clc
|
|
adc #NewCtlRecord.ctlRect
|
|
tax
|
|
lda <CtlPtr+2
|
|
adc #0
|
|
pha
|
|
phx
|
|
|
|
ldy #NewCtlRecord.CtlJust
|
|
lda [<CtlPtr],y
|
|
pha
|
|
_LETextBox2
|
|
|
|
pei CtlParam+2
|
|
pei CtlParam
|
|
_DisposeHandle
|
|
|
|
bra CleanUp
|
|
|
|
NoSubs
|
|
;-----------------------------------------------------------
|
|
;
|
|
; LeTextBox2 (TextPtr,TextSize,RectPtr,LeftJust)
|
|
;
|
|
pha
|
|
pha ; space for result
|
|
|
|
jsr GetRefType
|
|
pha
|
|
jsr CtlDataToAX
|
|
phx
|
|
pha
|
|
jsr ConvertRefToPtr
|
|
|
|
ldy #NewCtlRecord.ctlValue ; text length
|
|
lda [<CtlPtr],y
|
|
pha
|
|
|
|
lda <CtlPtr ; rect pointer
|
|
clc
|
|
adc #NewCtlRecord.ctlRect
|
|
tax
|
|
lda <CtlPtr+2
|
|
adc #0
|
|
pha
|
|
phx
|
|
|
|
ldy #NewCtlRecord.CtlJust
|
|
lda [<CtlPtr],y
|
|
pha
|
|
_LETextBox2
|
|
|
|
;
|
|
; CleanUp -- common exit point for both BlastText and normal
|
|
;
|
|
CleanUp
|
|
*** added 27-Oct-91 DAL -- dim out the text if needed
|
|
lda <ctlParam+2 ;high word = $FFFF to dim
|
|
bpl @noDim
|
|
|
|
ldy #NewCtlRecord.ctlFlag
|
|
lda [<ctlPtr],y
|
|
and #fTextCanDim
|
|
beq @noDim
|
|
|
|
pea @dimmedMask>>16
|
|
pea @dimmedMask
|
|
_SetPenMask
|
|
|
|
lda <CtlPtr ; rect pointer
|
|
clc
|
|
adc #NewCtlRecord.ctlRect
|
|
tax
|
|
lda <CtlPtr+2
|
|
adc #0
|
|
pha
|
|
phx ;pushed control rectangle
|
|
pea @whitePatt>>16
|
|
pea @whitePatt
|
|
_FillRect
|
|
bra @done
|
|
|
|
@dimmedMask dc.b $55,$aa,$55,$aa,$55,$aa,$55,$aa
|
|
@whitePatt dc.b $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff
|
|
dc.b $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff
|
|
dc.b $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff
|
|
dc.b $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff
|
|
|
|
@done
|
|
@noDim
|
|
*** end 27-Oct-91
|
|
|
|
;-----------------------------------------------------------
|
|
;
|
|
; Unlock anything we locked coming in.
|
|
;
|
|
jsr GetRefType
|
|
tax
|
|
beq Fini
|
|
|
|
cmp #$0001
|
|
beq @UnlockHandle
|
|
|
|
jsr CtlDataToAX
|
|
jsr GetResourceHandle
|
|
bra @UnlockIt
|
|
|
|
@UnlockHandle jsr CtlDataToAX
|
|
@UnlockIt phx
|
|
pha
|
|
phd
|
|
tsc
|
|
tcd
|
|
ldy #4
|
|
lda [3],y
|
|
and #$7FFF
|
|
sta [3],y
|
|
pld
|
|
pla
|
|
pla
|
|
|
|
oops
|
|
;-----------------------------------------------------------
|
|
;
|
|
; Return nothing
|
|
;
|
|
Fini lda #0
|
|
tax
|
|
rts
|
|
|
|
|
|
|
|
|
|
ConvertRefToPtr
|
|
DefineStack
|
|
RTS word
|
|
TheRef long
|
|
TheVerb word
|
|
ThePtr long
|
|
|
|
lda TheVerb,s
|
|
and #$0003
|
|
beq @AlreadyPtr
|
|
|
|
cmp #1
|
|
beq @ItsHandle
|
|
|
|
@ItsResource
|
|
lda TheRef+2,s
|
|
tax
|
|
lda TheRef,s
|
|
jsr GetResourceHandle
|
|
sta TheRef,s
|
|
txa
|
|
sta TheRef+2,s
|
|
|
|
@ItsHandle tsc
|
|
phd
|
|
tcd
|
|
ldy #4
|
|
lda [TheRef],y
|
|
ora #$8000
|
|
sta [TheRef],y
|
|
lda [TheRef]
|
|
sta ThePtr
|
|
dey
|
|
dey
|
|
lda [TheRef],y
|
|
sta ThePtr+2
|
|
|
|
pha
|
|
pha
|
|
pei TheRef+2
|
|
pei TheRef
|
|
_GetHandleSize
|
|
plx
|
|
pla
|
|
|
|
pld
|
|
|
|
ldy #NewCtlRecord.ctlValue
|
|
txa
|
|
sta [<ctlPtr],y
|
|
|
|
@Strip plx
|
|
pla
|
|
pla
|
|
pla
|
|
phx
|
|
rts
|
|
|
|
|
|
|
|
@AlreadyPtr
|
|
lda TheRef,s
|
|
sta ThePtr,s
|
|
lda TheRef+2,s
|
|
sta ThePtr+2,s
|
|
bra @Strip
|
|
|
|
|
|
GetResourceHandle
|
|
pha
|
|
pha
|
|
PushWord #rTextForLETextBox2 ; type
|
|
phx
|
|
pha
|
|
_CMLoadResource
|
|
|
|
pla
|
|
plx
|
|
rts
|
|
|
|
|
|
ENDP
|
|
|
|
title 'StatTextProc -- Utils'
|
|
****************************************************************
|
|
*
|
|
UsefulUtils PROC
|
|
*
|
|
* Description
|
|
*
|
|
*
|
|
* Inputs:
|
|
* none
|
|
*
|
|
* Outputs:
|
|
* none
|
|
*
|
|
* External Refs:
|
|
* none
|
|
*
|
|
* Entry Points:
|
|
*
|
|
longa on ; mode
|
|
longi on
|
|
*
|
|
****************************************************************
|
|
|
|
|
|
|
|
;-----------------------------------------------------------
|
|
;
|
|
; Returns the value in ctlData in A and X registers.
|
|
;
|
|
ENTRY CtlDataToAX
|
|
CtlDataToAX
|
|
ldy #NewCtlRecord.ctlData+2
|
|
lda [ctlPtr],y
|
|
tax
|
|
dey
|
|
dey
|
|
lda [ctlPtr],y
|
|
rts
|
|
|
|
|
|
;-----------------------------------------------------------
|
|
;
|
|
; Returns the text Ref verb in a-reg.
|
|
;
|
|
Import GetRefType
|
|
GetRefType PROC EXPORT
|
|
ldy #NewCtlRecord.ctlMoreFlags
|
|
lda [ctlPtr],y
|
|
and #$0003
|
|
rts
|
|
|
|
ENDP
|
|
|
|
END
|