Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.apple2.programmer > #3472 > unrolled thread

Merlin16+ and Quickdraw II

Started byluigi30@gmail.com
First post2017-05-14 21:47 -0700
Last post2017-05-31 00:16 -0700
Articles 13 — 5 participants

Back to article view | Back to comp.sys.apple2.programmer


Contents

  Merlin16+ and Quickdraw II luigi30@gmail.com - 2017-05-14 21:47 -0700
    Re: Merlin16+ and Quickdraw II Luigi Thirty <luigi30@gmail.com> - 2017-05-15 12:04 -0700
      Re: Merlin16+ and Quickdraw II Kelvin Sherlock <email@domain.com> - 2017-05-15 16:14 -0400
        Re: Merlin16+ and Quickdraw II Luigi Thirty <luigi30@gmail.com> - 2017-05-15 13:26 -0700
    Re: Merlin16+ and Quickdraw II Luigi Thirty <luigi30@gmail.com> - 2017-05-15 14:37 -0700
      Re: Merlin16+ and Quickdraw II John Brooks <jbrooks@blueshiftinc.com> - 2017-05-16 09:11 -0700
      Re: Merlin16+ and Quickdraw II Kelvin Sherlock <email@domain.com> - 2017-05-16 19:18 -0400
    Re: Merlin16+ and Quickdraw II Luigi Thirty <luigi30@gmail.com> - 2017-05-15 19:33 -0700
      Re: Merlin16+ and Quickdraw II Kelvin Sherlock <email@domain.com> - 2017-05-16 00:47 -0400
        Re: Merlin16+ and Quickdraw II Luigi Thirty <luigi30@gmail.com> - 2017-05-15 23:32 -0700
    Re: Merlin16+ and Quickdraw II Luigi Thirty <luigi30@gmail.com> - 2017-05-16 11:38 -0700
      Re: Merlin16+ and Quickdraw II Antoine Vignau <antoine.vignau@laposte.net> - 2017-05-16 12:43 -0700
    Re: Merlin16+ and Quickdraw II Antoine Vignau <antoine.vignau@laposte.net> - 2017-05-31 00:16 -0700

#3472 — Merlin16+ and Quickdraw II

Fromluigi30@gmail.com
Date2017-05-14 21:47 -0700
SubjectMerlin16+ and Quickdraw II
Message-ID<f4def9e4-52aa-4283-a965-f04925833567@googlegroups.com>
I'm trying to do some assembly programming on the GS with Merlin16+. I'm reading through chapter 7 of the Programming the IIGS in C and Assembly book right now, trying to get the Event Manager running so I can read keystroke events. According to the book, Event Manager requires Quickdraw II and the Miscellaneous Tool Set enabled. 

I already have the Memory Manager going and requested the direct page memory the tools need. I've got MT started and I'm trying to get Quickdraw II up and running. The problem I'm having is when I call QDStartup, it fails with error code $0410 which indicates that something else has a lock on screen memory. Is Merlin locking down screen memory even when I try to launch the program from its disk command prompt or am I configuring something wrong?

[toc] | [next] | [standalone]


#3473

FromLuigi Thirty <luigi30@gmail.com>
Date2017-05-15 12:04 -0700
Message-ID<3c552708-7829-4dd8-9737-d801b9a79d02@googlegroups.com>
In reply to#3472
Okay, it does the same thing when launched from Finder. I'm stuck - it matches the example code I have and it doesn't work. I've uploaded my source code here: https://pastebin.com/ev3AcmBt Can someone take a look at it for me?

[toc] | [prev] | [next] | [standalone]


#3474

FromKelvin Sherlock <email@domain.com>
Date2017-05-15 16:14 -0400
Message-ID<ofd20k$e54$1@dont-email.me>
In reply to#3473
On 2017-05-15 19:04:41 +0000, Luigi Thirty said:

> Okay, it does the same thing when launched from Finder. I'm stuck - it 
> matches the example code I have and it doesn't work. I've uploaded my 
> source code here: https://pastebin.com/ev3AcmBt Can someone take a look 
> at it for me?

You should probably also use attrPage ($0004) when allocating the QD 
Direct Page.  Even better would be to delete all that tool start up 
code and use the _StartUpTools call which starts up all your tools at 
once and handles DP allocation.

[toc] | [prev] | [next] | [standalone]


#3475

FromLuigi Thirty <luigi30@gmail.com>
Date2017-05-15 13:26 -0700
Message-ID<7e2c8a8e-ab01-4187-ad6b-a050d9b85a82@googlegroups.com>
In reply to#3474
On Monday, May 15, 2017 at 4:14:22 PM UTC-4, Kelvin Sherlock wrote:
> On 2017-05-15 19:04:41 +0000, Luigi Thirty said:
> 
> > Okay, it does the same thing when launched from Finder. I'm stuck - it 
> > matches the example code I have and it doesn't work. I've uploaded my 
> > source code here: https://pastebin.com/ev3AcmBt Can someone take a look 
> > at it for me?
> 
> You should probably also use attrPage ($0004) when allocating the QD 
> Direct Page.  Even better would be to delete all that tool start up 
> code and use the _StartUpTools call which starts up all your tools at 
> once and handles DP allocation.

Ah. That's what I get for not reading through Volume 3 of the Toolbox Reference book.

[toc] | [prev] | [next] | [standalone]


#3476

FromLuigi Thirty <luigi30@gmail.com>
Date2017-05-15 14:37 -0700
Message-ID<c6f36173-c02f-488b-8804-80d68c9eb9e3@googlegroups.com>
In reply to#3472
Thanks for pointing that out. I wish there were more example code online like there is with Amiga. Here's what I have so far trying to construct the records according to the toolbox book. It fails with an error $1E12 (resource manager already running) for some reason? If there's an example of a working _StartUpTools online that would be pretty helpful.

https://pastebin.com/xWB4FhZP

[toc] | [prev] | [next] | [standalone]


#3480

FromJohn Brooks <jbrooks@blueshiftinc.com>
Date2017-05-16 09:11 -0700
Message-ID<becc3c38-aa3c-4897-889f-1080a3336212@googlegroups.com>
In reply to#3476
On Monday, May 15, 2017 at 2:37:57 PM UTC-7, Luigi Thirty wrote:
> Thanks for pointing that out. I wish there were more example code online like there is with Amiga. Here's what I have so far trying to construct the records according to the toolbox book. It fails with an error $1E12 (resource manager already running) for some reason? If there's an example of a working _StartUpTools online that would be pretty helpful.
> 
> https://pastebin.com/xWB4FhZP

I don't have the source handy, but here's a little program I wrote in 1988 which initializes the toolbox, shows the mouse cursor, and draws two colored rectangles using quickdraw. Esc closes the tools and exits to basic.

It runs under ProDOS8.

*8000.811d
8000:20 58 FC 18 FB C2 30 F4 00 00 F4 00 00 F4 E1 00
8010:F4 00 20 A2 02 1A 22 00 00 E1 68 85 06 85 9D 68
8020:85 08 85 9F A0 00 00 A9 00 00 97 9D C8 C8 97 9D
8030:A2 01 02 22 00 00 E1 A2 03 02 22 00 00 E1 F4 00
8040:00 F4 00 10 A2 03 20 22 00 00 E1 68 8D 80 02 F4
8050:00 00 A2 02 02 22 00 00 E1 68 F4 00 86 F4 00 00
8060:F4 00 00 F4 40 01 F4 00 00 F4 C8 00 AD 80 02 48
8070:A2 06 02 22 00 00 E1 F4 00 87 F4 00 00 F4 00 00
8080:AD 80 02 48 A2 04 02 22 00 00 E1 A2 04 91 22 00
8090:00 E1 F4 05 00 A2 04 37 22 00 00 E1 F4 05 00 F4
80A0:05 00 A2 04 2C 22 00 00 E1 F4 77 77 A2 04 15 22
80B0:00 00 E1 F4 64 00 F4 00 00 A2 04 3C 22 00 00 E1
80C0:F4 0B 00 A2 04 37 22 00 00 E1 F4 0A 00 F4 0A 00
80D0:A2 04 2C 22 00 00 E1 F4 64 00 F4 80 00 A2 04 3C
80E0:22 00 00 E1 38 FB 20 0C FD 18 FB C2 30 A2 04 03
80F0:22 00 00 E1 F4 00 00 A2 03 21 22 00 00 E1 A2 06
8100:03 22 00 00 E1 A2 03 03 22 00 00 E1 A2 02 03 22
8110:00 00 E1 A2 01 03 22 00 00 E1 38 FB 4C 00 BE

-JB
@JBrooksBSI

[toc] | [prev] | [next] | [standalone]


#3483

FromKelvin Sherlock <email@domain.com>
Date2017-05-16 19:18 -0400
Message-ID<ofg15v$322$1@dont-email.me>
In reply to#3476
On 2017-05-15 21:37:57 +0000, Luigi Thirty said:

> If there's an example of a working _StartUpTools online that would be 
> pretty helpful.


Merlin includes Apple's HodgePodge sample program which has tool 
startup code (which predates _StartUpTools so it was more akin to your 
original code).

[toc] | [prev] | [next] | [standalone]


#3477

FromLuigi Thirty <luigi30@gmail.com>
Date2017-05-15 19:33 -0700
Message-ID<187be27a-92ca-4725-9cc5-7a9ace131649@googlegroups.com>
In reply to#3472
And I just noticed I pasted the wrong file. Here's the correct file straight from my GS.

https://pastebin.com/9dueFqSd

[toc] | [prev] | [next] | [standalone]


#3478

FromKelvin Sherlock <email@domain.com>
Date2017-05-16 00:47 -0400
Message-ID<ofe01t$5mm$1@dont-email.me>
In reply to#3477
On 2017-05-16 02:33:16 +0000, Luigi Thirty said:

> And I just noticed I pasted the wrong file. Here's the correct file 
> straight from my GS.
> 
> https://pastebin.com/9dueFqSd

Are you using standard tool macros?  I ask because normally, you would 
do something like:

  ~MMStartUp
  pla
  sta mmID

So if you're using the standard macros, the return parameter isn't 
pulled from the stack and mmID isn't set so I would expect errors 
elsewhere.  You don't seem to pull the return value after 
_StartupTools, either.

[toc] | [prev] | [next] | [standalone]


#3479

FromLuigi Thirty <luigi30@gmail.com>
Date2017-05-15 23:32 -0700
Message-ID<3bb8bf71-a4bb-4aeb-811c-e7fdfc095f14@googlegroups.com>
In reply to#3478
On Tuesday, May 16, 2017 at 12:47:03 AM UTC-4, Kelvin Sherlock wrote:
> On 2017-05-16 02:33:16 +0000, Luigi Thirty said:
> 
> > And I just noticed I pasted the wrong file. Here's the correct file 
> > straight from my GS.
> > 
> > https://pastebin.com/9dueFqSd
> 
> Are you using standard tool macros?  I ask because normally, you would 
> do something like:
> 
>   ~MMStartUp
>   pla
>   sta mmID
> 
> So if you're using the standard macros, the return parameter isn't 
> pulled from the stack and mmID isn't set so I would expect errors 
> elsewhere.  You don't seem to pull the return value after 
> _StartupTools, either.

Yeah, I'm using the standard tool macros included with the Merlin disk. I thought the super-macros pulled the result from the stack and stuffed it in the provided variable, guess not.

[toc] | [prev] | [next] | [standalone]


#3481

FromLuigi Thirty <luigi30@gmail.com>
Date2017-05-16 11:38 -0700
Message-ID<b7b0656b-e69d-4eeb-bb98-9b113fe76680@googlegroups.com>
In reply to#3472
It turns out in addition to not pulling mmID I was pulling StartStopRef from the stack and *then* checking for the returned error code from _StartUpTools... which would make C = half of a pointer. Whoops. Fixed those issues and my program is getting events now. Thanks!

[toc] | [prev] | [next] | [standalone]


#3482

FromAntoine Vignau <antoine.vignau@laposte.net>
Date2017-05-16 12:43 -0700
Message-ID<be2397b0-88ed-4f3c-b9da-ba898c5c7b64@googlegroups.com>
In reply to#3481
Kelvin is right. Use _StartUpTools, that's easier and better!

Even if you do not need windows, _TaskMaster is one of the most powerful tool call of the IIgs toolbox. It is your friend, use it!!!

Antoine

[toc] | [prev] | [next] | [standalone]


#3514

FromAntoine Vignau <antoine.vignau@laposte.net>
Date2017-05-31 00:16 -0700
Message-ID<7fcca1e7-14f2-4fa4-9f24-4a940c8d5023@googlegroups.com>
In reply to#3472
I'm sure the text will not be visible due to the font used, at least on my browser. Change it to a non prop one.

pha
pha
PushWord myID
PushWord #refIsByPointer
PushLong #startStopRef
_StartUpTools
PullLong startStopRefRet

To shutdown:
PushWord #refIsByPointer ; can also be handle, not resource ID
PushLong startStopRefRet
_ShutDownTools

startStopRefRet ds 4

===
Structure of the startStopRef

startStopRef
ds 2 ; flags - word - set to 0
dw $0080 ; video mode - word - 640 mode here, described later
ds 2 ; resFileID - word - set by StartUpTools
ds 4 ; dPageHandle - long - set by StartUpTools
dw 3 ; numTools - word - number of entries in toolArray
The tool array that follows contain (here) 3 entries, each being:
dw $0003 ; toolNumber - word - tool set identifier (misc tool here)
dw $0100 ; minVersion - word - minimum acceptable tool set version
dw $0004 ; tool
dw $0101
dw $0005 ; tool
dw $0200

===

My advice: use Genesys, the resource editor, and create a tool table entry. See what the data looks like when playing with the parameters!

===

Move about the videoMode
default320 = $0000 ; bit 7
default640 = $0080 ; bit 7
fastport aware = $4000 ; bit 14
hardwareShadowing = $8000 ; bit 15

videoMode is the sum of the above values:
app in 640-mode with fastport + shadowing = $C080

===

refIsByPointer can be:
refIsByPointer = 0
refIsByHandle = 1
refIsByResourceID = 2

===

Enjoy,
Antoine

[toc] | [prev] | [standalone]


Back to top | Article view | comp.sys.apple2.programmer


csiph-web