mirror of
https://github.com/codebur/a2-chemi-gs-1993.git
synced 2025-03-20 05:29:22 +00:00
1 line
8.7 KiB
NASM
1 line
8.7 KiB
NASM
keep GLOBALS
|
|
|
|
****************************************************************
|
|
* ChemiGS *
|
|
****************************************************************
|
|
* A Drawing Program for Chemical Structures *
|
|
* (c) 1992-93 by Urs Hochstrasser *
|
|
* Buendtenweg 6 *
|
|
* 5105 AUENSTEIN (SWITZERLAND) *
|
|
****************************************************************
|
|
|
|
* Module GLOBALS
|
|
|
|
|
|
****************************************************************
|
|
*
|
|
* USES ...
|
|
*
|
|
mcopy Globals.macros
|
|
copy equates.asm
|
|
|
|
****************************************************************
|
|
*
|
|
* VAR
|
|
*
|
|
|
|
Globals data
|
|
|
|
gMemID ds 2
|
|
gMyID ds 2
|
|
|
|
gToolRef ds 4
|
|
|
|
fDoAbout ds 2
|
|
fWaitForKey ds 2
|
|
fTextFlag ds 2
|
|
|
|
gMainEvt ds 16 Task Record: Event+Task (Fields by Offs)
|
|
gTaskDta ds 4
|
|
gTaskMsk dc i4'$001FFB7F' @@@@ was $001FFF7F
|
|
ds 4 wmLastClickTick
|
|
ds 2 wmClickCount
|
|
gTaskDa2 ds 4
|
|
gTaskDa3 ds 4
|
|
gTaskDa4 ds 4
|
|
ds 4 wmLastClickPt
|
|
ds 2 dummy (rest of Task record ?)
|
|
|
|
gDone dc i2'0' Quit flag
|
|
gToolID ds 2 active tool from toolbar
|
|
oldToolID ds 2
|
|
gToolErr ds 2
|
|
gDataWNum ds 2
|
|
gDefaultTool dc i2'2' Single bond tool
|
|
gAboutWin ds 4
|
|
gLastWindow ds 4
|
|
gVersion dc i2'2'
|
|
TBOffset dc i2'6'
|
|
RulerH dc i2'18' ruler heigth
|
|
|
|
SGRecord ds 14 generic Set/GetField Record
|
|
|
|
gNewLink ds 4
|
|
gNewText ds 4
|
|
gNewObj ds 4
|
|
|
|
gToolWin ds 4
|
|
gEasterWin ds 4
|
|
gPrefWin ds 4
|
|
gHelpWin ds 4
|
|
|
|
gEditCursor ds 4 Pointer to Edit Cursor (1 of the following)
|
|
gCrossCur ds 4 Handle
|
|
gMarqueeCur ds 4 Handle
|
|
gHandCur ds 4 Handle
|
|
gTextCur ds 4 Handle
|
|
gEraseCur ds 4 Handle
|
|
gArrowCur ds 4
|
|
|
|
ChFont ds 4
|
|
SysFont ds 4
|
|
LErecH ds 4
|
|
|
|
masterSCB ds 2
|
|
|
|
fFirstFile ds 2
|
|
fCacheWins dc i2'0' Set Cache Windows to FALSE
|
|
fSys5 dc i2'0' 1 -> TRUE; $8001 -> DON'T CHANGE
|
|
|
|
gPenSize dc i2'1'
|
|
dc i2'2'
|
|
|
|
FInfoHndl ds 4 Handle to window's File Info Record
|
|
|
|
*+++++++++++++++++++++ FILE INFO RECORD +++++++++++++++++++++++++++++++++++++++
|
|
FileInfo anop (100 Bytes for each file)
|
|
gTheData ds 4 Handle to linked segment list
|
|
gTheText ds 4 Handle to linked AtomText list
|
|
gTheObj ds 4 Handle to linked object list
|
|
hScrollH ds 4 handle to hor. scroll bar (ID 5)
|
|
vScrollH ds 4 handle to vert. scroll bar (ID 6)
|
|
MountnH ds 4 handle to display size control (ID 8)
|
|
SizeBoxH ds 4 handle to size box control (ID 9)
|
|
gContentRect dc i2'18,0,156,531' Window's Content Rect (own terminology)
|
|
gOffPort ds 4 Pointer to Window's offscreen GrafPort!
|
|
gXoffset ds 2
|
|
gYoffset ds 2
|
|
gDocW ds 2
|
|
gDocH ds 2
|
|
LEditH ds 4 handle to window's Line Edit Cntl (ID 4)
|
|
TBarH ds 4 Handle to inactive ToolBar Ctrl (ID 7)
|
|
*\----------------This part moved on every update---56 Bytes-------------------/
|
|
|
|
gLink ds 4 Handle to next free segment
|
|
gTXLink ds 4 Handle to next free AtomText string
|
|
gObjLink ds 4 Handle to next free object space
|
|
gDataWin ds 4 Pointer to current Window's GrafPort
|
|
wKind ds 2 Kind of Window -- unused yet
|
|
fSaved dc i2'1' set to TRUE, so no 'Save' of empty Win
|
|
fNamed ds 2 Is set to TRUE after a PutFile Dialog
|
|
fFullAccess ds 2 TRUE if R/W access to file
|
|
fOpened ds 2 TRUE if file associated to Window is open
|
|
gTitleH ds 4 Handle to Title memory Block (for resizing, etc.)
|
|
gTitlePtr ds 4 Pointer to title string
|
|
gPrintHndl ds 4 Handle to Window's Print Record
|
|
gPathPtr ds 4 Pointer to Window's file path
|
|
gRefNum ds 2 File Reference Number of Window's associated File
|
|
gInfoRect ds 8 Window's Info Bar Rectangle
|
|
|
|
picHandle ds 4 Handle to offscreen picture!
|
|
ds 4 dummy
|
|
*++++++++++++++++++ END of FileInfo RECORD ++++++++++++++++++++++++++++++++++++
|
|
dumdum ds 10 nothin'
|
|
FileHeader anop *----------H-E-A-D-E-R----------------*
|
|
hdrLength dc i4'256'
|
|
hdrVersion dc h'0001'
|
|
fileKind ds 2
|
|
gPrintRec ds 140
|
|
*** Insert additional header data here ***
|
|
hdrDummy ds 120 *-------E-N-D---O-F---H-E-A-D-E-R-----*
|
|
|
|
locInfo anop
|
|
portSCB ds 2 SCB Byte
|
|
ptrToPixImage ds 4 pointer to pixel image
|
|
width dc i2'160' width
|
|
boundsRect dc i2'0,0,400,640' boundary rectangle
|
|
|
|
NewSegment anop empty segment data for newLink
|
|
ds 32
|
|
TheSegment anop
|
|
sLink ds 4 actual data segment
|
|
sType ds 2
|
|
sRgnHndl ds 4
|
|
sSize ds 2
|
|
sNamePtr ds 4
|
|
sColor ds 2
|
|
sPenSize ds 4
|
|
sCMD ds 2
|
|
yy ds 2 point 1 ('grided' coordinates)
|
|
xx ds 2
|
|
yy2 ds 2 point 2 ('grided' coordinates)
|
|
xx2 ds 2
|
|
|
|
NewText ds 8 New empty text element
|
|
TheText anop Actual Text element
|
|
txLink ds 4 Link to the next text element
|
|
txPoint ds 4 Coordinates, where text appears
|
|
txLen ds 1 Length of following text string
|
|
txString ds 256 Actual text string
|
|
|
|
NewObj ds 8 New empty object
|
|
TheObj anop Actual object
|
|
objLink ds 4 Link to next object
|
|
objPoint ds 4 Coordinates, where object appears
|
|
objData ds 256 Actual object data
|
|
|
|
gForePat ds 32
|
|
gBackPat ds 32
|
|
|
|
teRec ds $107
|
|
outH ds 4 Handle to Key Filter Output
|
|
|
|
*************** TEMPORARY SPACE FOR WINDOW DRAW ROUTINES ****************
|
|
gViewW ds 2
|
|
gViewH ds 2
|
|
end
|
|
|
|
*********************** INITIALIZE GLOBALS ******************************
|
|
InitGlobals start
|
|
using Globals
|
|
jsr SetTheFont
|
|
ph4 #0
|
|
~NewWindow2 #0,#0,#0,#0,#RefIsResource,#kAboutWID,#rWindParam1
|
|
pl4 gAboutWin
|
|
lda #1
|
|
sta fWaitForKey fWaitForKey:=TRUE (About Box)
|
|
|
|
stz gDone QuitFlag:=FALSE
|
|
stz fSys5 System 5:=FALSE
|
|
ph2 #0
|
|
~GetMasterSCB
|
|
pl2 masterSCB
|
|
pha test Sys version via QD version
|
|
~QDVersion
|
|
pla
|
|
and #$0FFF mask off special flags
|
|
cmp #$0307 Sys6's QD version
|
|
bcs sys6 it IS Sys 6!!!
|
|
lda #$8001 set sys5 flag (pre-sys6)
|
|
sta fSys5 ('don't change')
|
|
sys6 anop
|
|
|
|
ph4 #0 Load Cursors into memory
|
|
~LoadResource #rCursor,#1 .. Cross tool
|
|
pla
|
|
plx
|
|
jsr Deref
|
|
sta gCrossCur
|
|
stx gCrossCur+2
|
|
ph4 #0
|
|
~LoadResource #rCursor,#2 .. Marquee cursor
|
|
pla
|
|
plx
|
|
jsr Deref
|
|
sta gMarqueeCur
|
|
stx gMarqueeCur+2
|
|
ph4 #0
|
|
~LoadResource #rCursor,#3 .. Hand cursor
|
|
pla
|
|
plx
|
|
jsr Deref
|
|
sta gHandCur
|
|
stx ghandCur+2
|
|
ph4 #0
|
|
~LoadResource #rCursor,#4 .. Text Cursor
|
|
pla
|
|
plx
|
|
jsr Deref
|
|
sta gTextCur
|
|
stx gTextCur+2
|
|
ph4 #0
|
|
~LoadResource #rCursor,#5 .. Cut cursor
|
|
pla
|
|
plx
|
|
jsr Deref
|
|
sta gEraseCur
|
|
stx gEraseCur+2
|
|
ph4 #0
|
|
~LoadResource #rCursor,#6 .. Arrow cursor
|
|
pla
|
|
plx
|
|
jsr Deref
|
|
sta gArrowCur
|
|
stx gArrowCur+2
|
|
|
|
lda gDefaultTool initialize Tool on startup
|
|
sta gToolID
|
|
jsr doTheTool
|
|
rts
|
|
|
|
ph4 #0 create keyfilter I/O Handle
|
|
~NewHandle #2,gMyID,#0,#0
|
|
pl4 outH
|
|
end
|
|
|
|
SetTheFont start
|
|
using Globals
|
|
ph4 #0
|
|
~LoadResource #rFont,#kChFontID
|
|
sta gToolErr
|
|
pl4 ChFont
|
|
jsr Error
|
|
~AddFamily FontID,#FontName
|
|
sta gToolErr
|
|
jsr Error
|
|
~AddFontVar ChFont,#$002D
|
|
sta gToolErr
|
|
jsr Error
|
|
~FMSetsysFont FontID
|
|
sta gToolErr
|
|
jsr Error
|
|
rts
|
|
FontName dw 'Chemix'
|
|
FontID dc i2'$FFFD' ** vielleicht zu verbessern...
|
|
dc i1'0' style
|
|
dc i1'8' size
|
|
end
|
|
|
|
Version data
|
|
gCopyLoc dc i2'20,89'
|
|
dc i2'75,98'
|
|
CopyRight dw '(c) 1992 Bright Software, Switzerland'
|
|
VersionStr dw ' Internal release 0.2.1 ' ;' Demo Release 0.03b'
|
|
end
|
|
|
|
|
|
****************************************************************************
|
|
* Data Format *
|
|
* *
|
|
****************************************************************************
|
|
* Single Segment *
|
|
* *
|
|
* 4 6 10 12 16 18 22 24 28 32
|
|
* +---------+----+---------+----+---------+----+--------+----+--------+--------+
|
|
* | link |type| rgnHndl |size| namePtr |col | psize |cmd | p1 | p2 |
|
|
* +---------+----+---------+----+---------+----+--------+----+--------+--------+
|
|
* *
|
|
****************************************************************************
|
|
* Object *
|
|
* *
|
|
* 4 6 10 12 16 *
|
|
* +---------+----+---------+----+---------+ *
|
|
* | link |type| rgnHndl |size| namePtr | *
|
|
* +---------+----+---------+----+---------+ *
|
|
* *
|
|
* 2 6 8 12 16
|
|
* +----+--------+----+--------+--------+
|
|
* Line 1 |col | pSize |cmd | p1 | p2 |
|
|
* +----+--------+----+--------+--------+
|
|
* Line 2 |col | pSize |cmd | p1 | p2 |
|
|
* +----+--------+----+--------+--------+
|
|
* etc... *
|
|
****************************************************************************
|