Modified TOS to remove resolutions limitation

General Discussion, STOS.

Moderator: troed

User avatar
Smonson
Posts: 364
Joined: Sat Oct 28, 2017 10:21 am

Re: Modified TOS to remove resolutions limitation

Post by Smonson » Tue Mar 17, 2020 10:12 am

I learned another interesting fact which has probably been altering my conclusions a bit.

Under emulation in Hatari, the virtual shifter in RGB mode can be set to 0, 1, or 2 (and if it's 2, the screen is disabled so you can't see what's going on) but when it's set to use a mono monitor, it's read-only and set to 2 permanently, ignoring all writes.

Similar in Steem, except that in RGB mode the register is also only limited to values 0 and 1. 2 is not possible. Same as Hatari when emulating a monochrome screen: mode 2 only.

It's possible that it might work fine on a real machine, I'll attach the ROM file here in case a volunteer with the HDMI mod would like to test it.

I really want to make some progress on my H4 - especially since I'm isolated in my house to protect my immune-compromised fiancee from catching any random viruses that happen to be floating around - but I shipped all the hardware that I've bought to my work address, and the office has been shuttered until at least the end of the month! :headbang:
Attachments
tos14uk-resmod2.zip
(105.85 KiB) Downloaded 3 times

User avatar
Icky
Moderator
Moderator
Posts: 1867
Joined: Sun Sep 03, 2017 10:57 am
Location: UK

Re: Modified TOS to remove resolutions limitation

Post by Icky » Tue Mar 17, 2020 6:57 pm

Great work @Smonson it works. Unfortunately I had a wobble on the video (not sure why - need to take a look) but you can see the effect here, all three resolutions without changing a cable.

EDIT: Flashy Clock is very handy to quickly put a TOS image on and boot.



User avatar
PhilC
Moderator
Moderator
Posts: 2503
Joined: Fri Mar 23, 2018 8:22 pm

Re: Modified TOS to remove resolutions limitation

Post by PhilC » Tue Mar 17, 2020 7:32 pm

Nice work.
If it ain't broke, test it to Destruction.

User avatar
Smonson
Posts: 364
Joined: Sat Oct 28, 2017 10:21 am

Re: Modified TOS to remove resolutions limitation

Post by Smonson » Tue Mar 17, 2020 9:11 pm

Icky wrote:
Tue Mar 17, 2020 6:57 pm
Great work @Smonson it works. Unfortunately I had a wobble on the video (not sure why - need to take a look) but you can see the effect here, all three resolutions without changing a cable.
Awesome! :yay2: Thanks heaps for testing it!
I'll go back over it tonight and relay my exact changes as I promised to do earlier.

I don't know what the sync wobble is but it's probably my fault :lol:

User avatar
exxos
Site Admin
Site Admin
Posts: 9597
Joined: Wed Aug 16, 2017 11:19 pm
Location: UK
Contact:

Re: Modified TOS to remove resolutions limitation

Post by exxos » Tue Mar 17, 2020 11:34 pm

great stuff!

Wasn't the wobble down to that clock issue from wayyyyy back ? I'm not at home for a couple of days so can't test mine out :(
4MB STFM 1.44 FD- VELOCE+ 020 STE - 4MB STE 32MHz - STFM 16MHz - STM - MEGA ST - Falcon 030 CT60 - Atari 2600 - Atari 7800 - Gigafile - SD Floppy Emulator - PeST - HxC - CosmosEx - Ultrasatan - various clutter

https://www.exxoshost.co.uk/atari/ All my hardware guides - mods - games - STOS
https://www.exxoshost.co.uk/atari/last/storenew/ - All my hardware mods for sale - Please help support by making a purchase.

User avatar
Smonson
Posts: 364
Joined: Sat Oct 28, 2017 10:21 am

Re: Modified TOS to remove resolutions limitation

Post by Smonson » Wed Mar 18, 2020 3:32 am

exxos wrote:
Tue Mar 17, 2020 11:34 pm
great stuff!

Wasn't the wobble down to that clock issue from wayyyyy back ? I'm not at home for a couple of days so can't test mine out :(
Thanks Exxos! Yeah, I hope the wobble is just clock noise, at least we have a solution to that :D

User avatar
Smonson
Posts: 364
Joined: Sat Oct 28, 2017 10:21 am

Re: Modified TOS to remove resolutions limitation

Post by Smonson » Wed Mar 18, 2020 8:21 am

Changes (offsets given are for TOS1.4 UK, MD5 036c5ae4f885cbf62c9bed651c6c58a8):

At 0xfc06e, in the level 4 autovector (VBL handler), bypass the mono monitor check:

Code: Select all

     /* In colour modes: */
     btst #7,%d1                             /* Check mono detect */
-    bnes lvl4_vec_nochange                  /* No mono monitor --> skip */
+    bras lvl4_vec_nochange                  /* Always skip */
     movew #2000,%d0                         /* Delay loop */
     
lvl4_vec_delay:                          
    dbf %d0,lvl4_vec_delay
    moveb #2,%d0                             /* Set resolution to mono */
    bras lvl4_vec_chmode

addr_0702:
     /* In mono: */
     btst #7,%d1                             /* Check mono detect */
-    beqs lvl4_vec_nochange                  /* Monitor is present */
+    bras lvl4_vec_nochange                  /* Always skip */
     moveb %a5@(defshiftmod),%d0             /* Get default shifter mode */
     .short 0xb03c,0x0002                    /* cmpb #2,%d0 */
     blts lvl4_vec_chmode                    /* Default shifter mode compatible with colour monitor --> jump over */
At 0xfcb2b6, at the beginning of FindDevice(), redirect to a replacement implementation:

Code: Select all

 _FindDevice:
-    movew #4,%sp@-
-    trap #14                                /* Getrez() - get current video mode */
+    jmp _FindDevice2

     addql #2,%sp
     moveb %d0,%d2                           /* Save the original resolution value */
     .short 0xb43c,0x0002                    /* cmpb #2,%d2 - current rez = mono? */
At 0xfd86ba, in desk_pref(), stop disabling the mode buttons:

Code: Select all

-    movew #8,%a0@                           /* HIGH res button .ob_state */
+    movew #0,%a0@                           /* HIGH res button .ob_state */
      bras addr_186be
 addr_186a6:
     moveal %d7,%a0
     addal #346,%a0
-    movew #8,%a0@                           /* LOW res button .ob_state */
+    movew #0,%a0@                           /* LOW res button .ob_state */
     moveal %d7,%a0
     addal #370,%a0
-    movew #8,%a0@                           /* MED res button .ob_state */
+    movew #0,%a0@                           /* MED res button .ob_state */
 addr_186be:
     movew _gl_restype,%d4
     subqw #2,%d4
At 0xfefc00, in place of a bunch of extraneous ffffs, insert the new FindDevice() implementation

Code: Select all

_FindDevice2:
    movew #4,%sp@-
    trap #14                                /* Getrez() - get current video mode */
    addql #2,%sp

    moveb %d0,%d2                           /* Save the original resolution value */
    extw %d2

    moveal INTIN,%a0
    movew %a0@,%d0                          /* Get the requested res from INTIN[0] */
    
    cmpw #1,%d0
    bnes fd3_not_1                          /* Mode 1 (no change) not requested, continue here */

    tstb %d2                                
    beq fd3_low_pal                         /* Originally low, mode "1" now selected - go here */
    cmpb #2,%d2
    beq fd3_high_pal                        /* Originally high, mode "1" now selected - go here */
    bra fd3_med_pal                         /* Originally medium, mode "1" now selected - go here */

fd3_not_1:
    tstb %d2                                
    beq fd3_orig_low                        /* Originally low */
    cmpb #2,%d2
    beq fd3_orig_high                       /* Originally high */

fd3_orig_med:
    cmpw #4,%d0
    beq fd3_goto_high                       /* 4 = Switch to high res */
    cmpw #3,%d0
    beq fd3_med_pal                         /* 3 = Stay in medium */

fd3_goto_low:
    clrw %sp@-
    moveq #-1,%d0
    movel %d0,%sp@-
    movel %d0,%sp@-
    movew #5,%sp@-
    trap #14                                /* Setscreen(-1, -1, 0) - change to low res */
    lea %sp@(12),%sp

/* Set up 16-colour palette */
fd3_low_pal:
    pea paltab16
    movew #6,%sp@-
    trap #14                                /* Setpalette(void *pallptr) */
    addql #6,%sp
    moveq #1,%d0                            /* return 1 */
    rts

fd3_orig_low:
    cmpw #3,%d0
    beqs fd3_goto_med                       /* 3 = Switch to medium */
    cmpw #4,%d0
    beqs fd3_goto_high                      /* 4 = Switch to high */

    bra fd3_low_pal                         /* Stay in low */

fd3_goto_med:    
    movew #1,%sp@-
    moveq #-1,%d0
    movel %d0,%sp@-
    movel %d0,%sp@-
    movew #5,%sp@-
    trap #14                                /* Setscreen(-1, -1, 1) - change to medium res */
    lea %sp@(12),%sp

/* Set up 4-colour palette */
fd3_med_pal:
    pea paltab4
    movew #6,%sp@-
    trap #14                                /* Setpalette(void *pallptr) */
    addql #6,%sp
    moveq #2,%d0                            /* return 2 */
    rts

fd3_orig_high:
    cmpb #3,%d0
    beq fd3_goto_med                        /* 3 = Switch to medium */
    cmpb #4,%d0
    beq fd3_high_pal                        /* 4 = Stay in high */
    bra fd3_goto_low                        /* Switch to low */

fd3_goto_high:
    movew #2,%sp@-
    moveq #-1,%d0
    movel %d0,%sp@-
    movel %d0,%sp@-
    movew #5,%sp@-
    trap #14                                /* Setscreen(-1, -1, 2) - change to high res */
    lea %sp@(12),%sp

fd3_high_pal:
    movew #1,palette
    moveq #3,%d0                            /* return 3 (high) */
    rts

User avatar
Icky
Moderator
Moderator
Posts: 1867
Joined: Sun Sep 03, 2017 10:57 am
Location: UK

Re: Modified TOS to remove resolutions limitation

Post by Icky » Wed Mar 18, 2020 6:03 pm

Smonson wrote:
Tue Mar 17, 2020 9:11 pm
I don't know what the sync wobble is but it's probably my fault :lol:
Not your fault @Smonson. Turns out its the stack sockets I have on the DEV motherboard to help with FPGA GLUE and MMU testing are causing the issue.

Post Reply

Return to “SOFTWARE”