IOP.SWDF - what does A1 point at please?

Anything QL Software or Programming Related.
User avatar
NormanDunbar
Forum Moderator
Posts: 2273
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: IOP.SWDF - what does A1 point at please?

Post by NormanDunbar »

Thanks Marcel.

Right then, after a bit of experimentation, I've come to the conclusion that it's pretty impossible to use IOP.SWDF for anything useful This, coincidentally is what Gerge Gwilt wrote about it on my QDOSMSQ web site!

If I open a console and OUTLN it then call SWDF with A1 pointing a zero long word, followed by 8 words and a long to define the main subwindow sizes and attributes, then as long as the main window sizes match the OUTLN size, then the sprite will be used, but none of the attributes will be used, no paper or border, only the sprite. Like this:

Code: Select all

   lea swdfPntr,a1
   moveq #-1,d3
   moveq #iop.swdf,d0
   ; A0 is the channel id
   trap #3
   ...
   
swdfPntr
   dc.l 0
   dc.w x,y,xorg,yorg
   dc.w spare,bordw,bordc,paprc
   dc.l $0A ; Use SLEEP pointer sprite.
If I change the code to have an actual list of subwindow definitions, with relative pointers, nothing works correctly. The main window shows the default arrosw sprite, and there's o sign of any of the subwindows. Noting uses any of the attributes Ive set. :(

Code: Select all

   lea swdfPntr,a1
   moveq #-1,d3
   moveq #iop.swdf,d0
   ; A0 is the channel id
   trap #3
   ...
   
swdfPntr
   dc.l swdfList-*
   dc.w x,y,xorg,yorg
   dc.w spare,bordw,bordc,paprc
   dc.l 0 ; Use default arrow pointer sprite.
   
swdfList
  dc.l swdf_1-*
  dc.l 0
  
swdf_1
   ; These are different from the main window!
   dc.w x,y,xorg,yorg
   dc.w spare,bordw,bordc,paprc
   dc.l 0 ; Use default arrow pointer sprite.

If I replace the relative pointers with absolute pointers, I get the correct main window pointer sprite back again, but nothing changes regarding attributes for the main or the sub window. Plus, the subwindow doesn't use the defined pointer sprite either.

Code: Select all

   lea swdfPntr,a1
   move.l a1,a5
   lea swdfList,a4
   move.l a4,(a1)
   lea swdf_1,a1
    move.l a1,(a4)
    move.l a5,a1
    
   moveq #-1,d3
   moveq #iop.swdf,d0
   ; A0 is the channel id
   trap #3
   ...
   
swdfPntr
   dc.l 0
   dc.w x,y,xorg,yorg
   dc.w spare,bordw,bordc,paprc
   dc.l 0 ; Use default arrow pointer sprite.
   
swdfList
  dc.l 0
  dc.l 0
  
swdf_1
   ; These are different from the main window!
   dc.w x,y,xorg,yorg
   dc.w spare,bordw,bordc,paprc
   dc.l 0 ; Use default arrow pointer sprite.
I might have to admit defeat here which is a bit of a shame as I was hoping to be able to divide a main window into multiple subwindows, and use the returned pointer record, offset $04, from IOP.RPTR to determine the subwindow and act accordingly. I don't need the full WMAN stuff for this game, just the PE, but it's not looking hopeful. :(

All of this experimenting is on QPC 5.01, with high colour mode (32) selected, if this makes any difference?


Cheers,
Norm.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
User avatar
RalfR
Aurora
Posts: 872
Joined: Fri Jun 15, 2018 8:58 pm

Re: IOP.SWDF - what does A1 point at please?

Post by RalfR »

Hmm, I always thought that "SWDEF" from QPTR uses IOP.SWDF. Or am I wrong?


4E75 7000
User avatar
mk79
QL Wafer Drive
Posts: 1349
Joined: Sun Feb 02, 2014 10:54 am
Location: Esslingen/Germany
Contact:

Re: IOP.SWDF - what does A1 point at please?

Post by mk79 »

NormanDunbar wrote:If I change the code to have an actual list of subwindow definitions, with relative pointers, nothing works correctly. The main window shows the default arrosw sprite, and there's o sign of any of the subwindows. Noting uses any of the attributes Ive set. :(
Sure, I said it's the working definition and thus absolute pointers.
If I replace the relative pointers with absolute pointers, I get the correct main window pointer sprite back again, but nothing changes regarding attributes for the main or the sub window. Plus, the subwindow doesn't use the defined pointer sprite either.
Again, the manual pretty clearly states "A sub-window record specifies the area and, if desired, a pointer to a sprite to be used as pointer when the pointer is in that sub-window.". Only size, position and mouse cursor are used. The rest is just there because it's part of the WMAN data structure anyway.
The position is relative to the main window, did you take that into account? Your example code is unfortunately useless as clearly swdfList only consists of two NULL-pointers instead of an absolute pointer and the x/y stuff is not given.
I might have to admit defeat here which is a bit of a shame as I was hoping to be able to divide a main window into multiple subwindows, and use the returned pointer record, offset $04, from IOP.RPTR to determine the subwindow and act accordingly. I don't need the full WMAN stuff for this game, just the PE, but it's not looking hopeful. :(
Do it correctly and I'm sure it will work. Works for WMAN, too ;)

Marcel


User avatar
NormanDunbar
Forum Moderator
Posts: 2273
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: IOP.SWDF - what does A1 point at please?

Post by NormanDunbar »

Hmm. Looks like my post has gotten mangled somehow.
mk79 wrote:Your example code is unfortunately useless as clearly swdfList only consists of two NULL-pointers instead of an absolute pointer and the x/y stuff is not given.
I was two nulls, but filled in with the absolute addresses in the code, which appears somewhat bolloxed now for some reason.

Sorry about that. I'll post a properversion later on. Going out to visit mother in law in a care home.

Cheers,
Norm.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
User avatar
NormanDunbar
Forum Moderator
Posts: 2273
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: IOP.SWDF - what does A1 point at please?

Post by NormanDunbar »

EDITED

Sorry about the delay.

Here's the code I was playing with which uses absolute addresses for the pointers to the sub window definitions, etc.


Interestingly, when tracing with QMON2, no errors are detected anywhere (makes a change for my code!) but when IOP.RPTR returns, no matter where in the window I press a key or click a button, I always get the pointer record telling me I was in the main window (-1 at offset 4 in the pointer record) and the chosen SLEEP pointers never appear no matter where I move the pointer.

Cheers,
Norm.
iop.swdef.asm.zip
(1.14 KiB) Downloaded 43 times


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
User avatar
mk79
QL Wafer Drive
Posts: 1349
Joined: Sun Feb 02, 2014 10:54 am
Location: Esslingen/Germany
Contact:

Re: IOP.SWDF - what does A1 point at please?

Post by mk79 »

Code: Select all

sub1       dc.l    0               Pointer to sub windows pointer table
           dc.w    196,20,2,2      w,h,x,y  (x,y relative to main window)
...       
sub2       dc.l    0               Pointer to sub windows pointer table
           dc.w    196,20,2,78     w,h,x,y  (x,y relative to main window) 
What are these null pointers about? If you remove them your code will magically work. At least I see the mouse cursor changing shape on the top and bottom of the window.


User avatar
mk79
QL Wafer Drive
Posts: 1349
Joined: Sun Feb 02, 2014 10:54 am
Location: Esslingen/Germany
Contact:

Re: IOP.SWDF - what does A1 point at please?

Post by mk79 »

As expected the pointer record returned is also correct (clicked on the lower area and it returns 1 in __D4) :-)
Attachments
iop.swdef.png


User avatar
NormanDunbar
Forum Moderator
Posts: 2273
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: IOP.SWDF - what does A1 point at please?

Post by NormanDunbar »

mk79 wrote:What are these null pointers about? If you remove them your code will magically work. At least I see the mouse cursor changing shape on the top and bottom of the window.
I knew it was all my fault! :(

Those nulls are a result of copying and pasting the main subwindow definition but including the pointer to the other sub windows immediately above it. I truly am a dork!

When you mentioned NULLs before, I thought you were on about the actual subwindow list table, which I set up with dummy null pointers to be filled in later. My mistake.

Thank you very much for spotting my non-deliberate error and sorting me out. Much appreciated, thanks.


Cheers,
Norm.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
User avatar
mk79
QL Wafer Drive
Posts: 1349
Joined: Sun Feb 02, 2014 10:54 am
Location: Esslingen/Germany
Contact:

Re: IOP.SWDF - what does A1 point at please?

Post by mk79 »

NormanDunbar wrote:When you mentioned NULLs before, I thought you were on about the actual subwindow list table, which I set up with dummy null pointers to be filled in later. My mistake.
I was. As far as I can see you never posted any code for the sub-definitions, so I couldn't spot that problem ;)
Thank you very much for spotting my non-deliberate error and sorting me out. Much appreciated, thanks.
You're welcome as always. Cheers


Post Reply