MT.DMODE alternative (i.e. how else to change display mode)

Anything QL Software or Programming Related.
User avatar
bwinkel67
Aurora
Posts: 815
Joined: Thu Oct 03, 2019 2:09 am

MT.DMODE alternative (i.e. how else to change display mode)

Postby bwinkel67 » Thu Oct 07, 2021 8:04 pm

So I've been looking through the SUPERCHARGE codebase to try and figure out when it forces a MONITOR mode and I cannot find the combination needed that calls TRAP 1 with D0=$10 for MT.DMODE. i.e.: I can't find this sequence:

Code: Select all

moveq    #$10,d0
...
trap     #1


...in hex:

Code: Select all

70 10
...
4e 41


...anywhere in the codebase (not in PARSER_TASK, CODEGEN_TASK, XTRAS) except for EXTENSIONS_CODE but there it sets D2 to -1 meaning it is going to read the screen mode, not set it:

Code: Select all

moveq    #$10,d0
moveq    #$0,d1
moveq    #$ff,d2
trap    #1


...in hex:

Code: Select all

70 10
72 00
74 ff
4e 41


The only tasks remaining don't seem to be pertinent: DATASPACE_TASK (used to up the dataspace), ZAPNAMES_TASK (not sure what that does but it doesn't have it in any case).

So, how else could SUPERCHARGE be forcing monitor mode on me? I did this back in the early 90's, when I stepped through Tank Busters to undo the screen change so I could play it on a US TV -- didn't have a monitor back then and the CRT's would just endlessly scroll when in the wrong mode so I was forced to fix it. I want to do the same here...


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

Re: MT.DMODE alternative (i.e. how else to change display mode)

Postby mk79 » Thu Oct 07, 2021 10:54 pm

bwinkel67 wrote:...anywhere in the codebase (not in PARSER_TASK, CODEGEN_TASK, XTRAS) except for EXTENSIONS_CODE but there it sets D2 to -1 meaning it is going to read the screen mode, not set it:

Code: Select all

moveq    #$10,d0
moveq    #$0,d1
moveq    #$ff,d2
trap    #1
Wrong assumption, D2 is irrelevant here, D1 is set to request 4-colour mode, which must be monitor mode on a QL.

Marcel


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

Re: MT.DMODE alternative (i.e. how else to change display mode)

Postby mk79 » Fri Oct 08, 2021 12:27 am

Oh, and it also blanks the screen by writing to the hardware register 18063 directly, also enforcing mode 4 as a side effect.


User avatar
bwinkel67
Aurora
Posts: 815
Joined: Thu Oct 03, 2019 2:09 am

Re: MT.DMODE alternative (i.e. how else to change display mode)

Postby bwinkel67 » Fri Oct 08, 2021 12:28 am

mk79 wrote:Wrong assumption, D2 is irrelevant here, D1 is set to request 4-colour mode, which must be monitor mode on a QL.

Marcel


That's good to know. In Tony Teby's dev guide it just listed both flags there so I made that assumption.

I did play with it and in the end I replaced the Trap call with just a repeated MOVE call figuring if I set D0, D1, and D2 but never do the trap call, then no harm. I really wanted to add NOP's but couldn't figure out what they are for MC68K.

Code: Select all

moveq    #$10,d0
moveq    #$0,d1
moveq    #$ff,d2
moveq    #$ff,d2  ; formerly trap #1


...and it still switched to monitor mode. So that trap didn't do the trick and in all the SUPERCHARGE task excusables that is the only place where D0 is set to 16 (hex 10). So what else could be switching the screen to monitor? Is there another way of doing it without a trap 1 call?
Last edited by bwinkel67 on Fri Oct 08, 2021 12:45 am, edited 2 times in total.


User avatar
bwinkel67
Aurora
Posts: 815
Joined: Thu Oct 03, 2019 2:09 am

Re: MT.DMODE alternative (i.e. how else to change display mode)

Postby bwinkel67 » Fri Oct 08, 2021 12:30 am

mk79 wrote:Oh, and it also blanks the screen by writing to the hardware register 18063 directly, also enforcing mode 4 as a side effect.


So you are saying that by writing to register at 18063 you can also impact mode? Or that is what the TRAP 1 call does? Sorry, haven't done much in those therms with the QL.


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

Re: MT.DMODE alternative (i.e. how else to change display mode)

Postby mk79 » Fri Oct 08, 2021 6:43 am

bwinkel67 wrote:I really wanted to add NOP's but couldn't figure out what they are for MC68K.
That is no huge secret: $4E71.
bwinkel67 wrote:
mk79 wrote:Oh, and it also blanks the screen by writing to the hardware register 18063 directly, also enforcing mode 4 as a side effect.

So you are saying that by writing to register at 18063 you can also impact mode? Or that is what the TRAP 1 call does?
18063 is the hardware register, so all mode changes go through it, including the TRAP.


User avatar
bwinkel67
Aurora
Posts: 815
Joined: Thu Oct 03, 2019 2:09 am

Re: MT.DMODE alternative (i.e. how else to change display mode)

Postby bwinkel67 » Fri Oct 08, 2021 10:46 am

mk79 wrote:18063 is the hardware register, so all mode changes go through it, including the TRAP.


Can you modify it without the TRAP? If so, could you show a machine code example so I can try and find it in the SUPERCHARGE codebase.


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

Re: MT.DMODE alternative (i.e. how else to change display mode)

Postby mk79 » Fri Oct 08, 2021 11:30 am

bwinkel67 wrote:Can you modify it without the TRAP?
This is a computer of the 80s, you can do anything you like.
If so, could you show a machine code example so I can try and find it in the SUPERCHARGE codebase.
Offset $11C and $15C... (extensions_code)

extension1.png
extension2.png
extension2.png (10.72 KiB) Viewed 208 times


User avatar
bwinkel67
Aurora
Posts: 815
Joined: Thu Oct 03, 2019 2:09 am

Re: MT.DMODE alternative (i.e. how else to change display mode)

Postby bwinkel67 » Fri Oct 08, 2021 8:16 pm

Thank you. I assume the full value to search for in hex would be 00 01 80 63 within code (since the QL is Big Endian).


Martin_Head
Super Gold Card
Posts: 647
Joined: Tue Dec 17, 2013 1:17 pm

Re: MT.DMODE alternative (i.e. how else to change display mode)

Postby Martin_Head » Sat Oct 09, 2021 10:50 am

I'm in the process of trying to decompile SuperCharge's Parser_task, and that p_1112 routine of Marcel's that changes the screen mode, is called from Parser_task

Code: Select all

23270 DEFine PROCedure procFun23270
23275  LOCal var8ED8$,var8EDC$,var8EE0%(11),var8EE4%(11),var8EE8%(11)
23320  ???? 4
23332  CSIZE #1,1,0
23352  WINDOW #1,512,256,0,0
23380  CLS
23388  POKE_W 140416,1
23404  procFun23410
23406 END DEFine procFun23270
Those four question marks in line 23320 are the characters 1,1,1,2 which upsets SuperBASIC which flags the line with MISTake

That line must be MODE 4, but the 4 is not read by the procedure in extensions_code.
I don't know off hand, but is MODE an allowed keyword in a SuperCharged program?

There's quite a few more lines with unprintable keywords that upset SuperBASIC.



Who is online

Users browsing this forum: No registered users and 3 guests