****************************************************************
*                         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)
*

	Section Code,Code

start:
        clr.l   -(sp)
        move.w  #32,-(sp)       Switch to super mode
        trap    #1

	move.b	$424,d1
	cmp.b	#9,d1		test mmu configuration
	bne	already

        cmp.l   #$280000,$42E   RAM <= 2.5 megs?
        ble     already         If so, nothing to do

        move.l  #$280000,$42E   Set phystop

already: 
        move.l  d0,2(sp)        Returned stack
        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    '   STe 2.5M SIMM Fix  V1.0.2   ',27,"q",13,10
        dc.b    'Original program : David Hoggan',13,10
        dc.b    'Mathew Lodge + Peter A. Ritchie',13,10,0

        END
