Newer
Older
uBix-Retro / dump / oa-2.0.9 / arch / gecko / boot / inig3.a65
/****************************************************************************
   
    OS/A65 Version 2.0.0
    Multitasking Operating System for 6502 Computers

    Copyright (C) 1989-1998 Andre Fachat 

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

****************************************************************************/

/* 
 * this little program starts the gecko when it is plugged in 
 * the CSA computer itself, setup for external CPU and I/O 
 * from the CPU
 * The ROM is mapped from pages 4-c. The RAM is mapped from the 
 * Gecko card itself. 
 */

#ifndef XCSA
#define	GSEGMENT	$40	/* where the gecko lives in CS/A memory */
				/* i.e. $40000-$4ffff */
#else
#define	GSEGMENT	0
#endif

#include  "kdefs.i65"
#include  "kernel.i65"
#include  "../../csa65/csa65.i65"	; we boot from a csa system

;          .word $400
          *=$400
          
l1        =$0
			 	; exit all devices
          lda #0
          sta l1
l2        ldx l1
          lda #DC_EXIT
          jsr DEVCMD
          inc l1
          lda l1
          cmp #16
          bcc l2
				; disable timer interrupt
          lda SYSPORT
          and #$ff-SYS_IRQEN
          sta SYSPORT

          sei			; remap MMU pages 8-15 with values from 
.byt 2
          ldx #8		; 4 to c
#ifdef XCSA
l3        lda $eff1,x
#else
l3        lda $eff4,x
#endif
          sta $eff8,x
          dex
          bpl l3

          ldx #1		; set MMU pages 1-7 to 1-7
l4        txa
	  ora #GSEGMENT
          sta $eff0,x
          inx
          cpx #$8
          bcc l4

	  ldx #8
l3a	  lda $eff0,x		; copy to write-protect-MMU if available
	  sta $ef70,x
	  inx
	  cpx #16
	  bcc l3a

          ldx #0		; copy program to valid RAM
l5        lda data,x
          sta $1000,x
          inx
          bne l5
          
          jmp $1000		; and jump there
          
data      
	  lda #GSEGMENT		; remap page 0
          sta $eff0

;	  lda #$0b
;	  sta $eff7		; map $0e000 to $07000 for ext. I/O
;	  lda #$2e
;	  sta $effe
;	  lda SYSPORT
;	  ora #%00100000	; ioinh
;	  and #%11101111	; extio
;	  sta SYSPORT

	lda SYSPORT	;$7fe0
	eor #%00001000
	sta SYSPORT	;$7fe0

	ldx #0
	ldy #0
x0	dey
	bne x0
	dex
	bne x0
	
	lda SYSPORT	;$7fe0
	eor #%00001000
	sta SYSPORT	;$7fe0

	ldx #0
	ldy #0
x1	dey
	bne x1
	dex
	bne x1

;lda #$0f
;sta $7fff
;lda #%00100000
;sta $7fe0

          jmp RESET