[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: IIgs - read 40/80 setting at runtime?



On 21 fév, 15:54, lyricalnan...@dosius.ath.cx (Steve Nickolas) wrote:
> Toinet wrote:
> > On 21 f v, 03:43, lyricalnan...@dosius.ath.cx (Steve Nickolas) wrote:
> >> I'm able to do this on the //c, is there a defined way to do this on the
> >> IIgs?
>
> >> I'm writing some code that checks the 40/80 setting on a computer that
> >> supports it, and if it's set to 80, does a PR#3. It's tested and
> working
> >> on
> >> a //c, and on the IIgs I don't need to do it after a reset but would
> >> still
> >> like to do it upon signon (it is initially forced to 40-column mode).
>
> >> -uso.
>
> > * HARDWARE EQUATES
> > RD80VID            EQUDS.B 1       ;Bit 7=1 if 80 column hardware in
> > 00/C01F  byte      r:RD80VID
> > Read the value, if bit 7 is set, then the 80-col mode is active.
>
> > * Display selections (at boot time)
> > USERCOL            EQUDS.B 1       ;Columns: 40
> > That value is located at offset $19 of the battery RAM. If value is 0
> > then the 40-col mode is selected in the control panel. A value of 1
> > indicates a 80-col mode selection.
>
> > A copy of the battery RAM can be found at $E1/02C0, and the Firmware
> > looks
> > there directly.  System software should generally go through
> > ReadBParam and WriteBParam rather than examining or changing the
> > buffer directly.
>
> > antoine
>
> It looks like I will need to enter 65816 mode to get this value?  (I'm good
> enough with 65C02, completely clueless with '816 lul)
>
> -uso.

To get the value of the battery RAM, use the following code:

38 20 1F FE B0 16 18 FB C2 30 48 F4 19 00 A2 03 0C 22 00 00 E1 68 85
FE 38 FB E2 30 60

*-----------

colMODE     =     $fe

* Am I on a IIgs?
            sec
            jsr   $fe1f
            bcs   notIIGS

* Yes, switch to full 16-bit native mode
            clc
            xce
            rep   #$30

* Read the battery RAM value
            pha
            pea   $0019
* _ReadBParam
            ldx   #$0C03
            jsl   $e10000

* Store it in colMODE

            pla
            sta   colMODE

* Switch back to 8-bit emulation mode
            sec
            xce
            sep   #$30

notIIGS     rts

*----------- End of code

antoine