****************************************************************
*                         STE SIMM MIXER                       *
****************************************************************
* Author       : David Hoggan                                  *
* Version      : 1.0.1                                         *
* Additions    : Mathew Lodge                                  *
* Release date : 5/5/90                                        *
****************************************************************
*
* This program was submitted to the "Programmer's Clinic" section
* of ST World (the premier UK ST magazine).
*
* Additions made for USENET release by Mathew Lodge
*
* This program is public domain. Please give it to anybody who
* asks for it.
*
* This program fixes a bug in TOS 1.6 and properly configures the 
* MMU for 2.5 Megabytes of memory.
*
*****************************************************************
* Important! : MUST BE FIRST IN AUTO FOLDER!
*
* You can't run any other program before this one - it will crash
*
*****************************************************************
*
* Note:
*
* This program asssumes 2M in bank0 and 0.5M in bank 1
* It has been found that the other way around doesn't work
* - the MMU configures to a 1MB machine.
*
* Install your SIMMs as follows:
*
* (back of STE)
*
* |--  1meg SIMM  --|
* |--  256K SIMM  --|
* |--  1meg SIMM  --|
* |--  256K SIMM  --|
*
* (front of STE)
*

start:
        clr.l   -(sp)
        move.w  #32,-(sp)       Switch to super mode
        trap    #1
        addq.l  #6,sp

        cmp.l   #$280000,$42E   RAM <= 2.5 megs?
        ble     already         If so, nothing to do
        cmp.b   #9,$424         Is it installed properly?
        bne     already         If so, nothing to do

        move.l  #$280000,$42E   Set phystop
ST_reset:
        move.l  $4F2,a0         Find reset address
        jmp     (a0)            Reset system

already: 
        move.l  d0,-(sp)        Returned stack
        move.w  #32,-(sp)       Switch back to user mode
        trap    #1
        addq.l  #6,sp

        lea     fixmsg(PC),a0   Print startup message
        bsr     print
        
quit
        clr.w   -(sp)           Back to TOS
        trap    #1

print:
        move.l  a0,-(sp)        Addr of message
        move.w  #9,-(sp)        Cconws
        trap    #1
        addq.l  #6,sp           tidy
        rts                     return

fixmsg:
        dc.b    13,10,27,"p"
        dc.b    '    The 2.5MB STE SIMM mixer   ',27,"q",13,10
        dc.b    '         Version 1.0.1         ',13,10
        dc.b    'Original program : David Hoggan',13,10
        dc.b    'Additions        : Mathew Lodge',13,10,0

        END
