<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://7800.8bitdev.org/index.php?action=history&amp;feed=atom&amp;title=XBoard_Memory_Init</id>
		<title>XBoard Memory Init - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://7800.8bitdev.org/index.php?action=history&amp;feed=atom&amp;title=XBoard_Memory_Init"/>
		<link rel="alternate" type="text/html" href="https://7800.8bitdev.org/index.php?title=XBoard_Memory_Init&amp;action=history"/>
		<updated>2026-05-17T02:08:21Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.28.0</generator>

	<entry>
		<id>https://7800.8bitdev.org/index.php?title=XBoard_Memory_Init&amp;diff=90&amp;oldid=prev</id>
		<title>MSaarna: Created page with &quot;&lt;pre&gt; ; X-Board Description ; The X-board (iet7830) is an internal expansion board for the ATARI 7800 which ; gives the system 128 Kbyte of SRAM and one POKEY chip. ; ; The ex...&quot;</title>
		<link rel="alternate" type="text/html" href="https://7800.8bitdev.org/index.php?title=XBoard_Memory_Init&amp;diff=90&amp;oldid=prev"/>
				<updated>2015-11-07T23:44:35Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;lt;pre&amp;gt; ; X-Board Description ; The X-board (iet7830) is an internal expansion board for the ATARI 7800 which ; gives the system 128 Kbyte of SRAM and one POKEY chip. ; ; The ex...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
; X-Board Description&lt;br /&gt;
; The X-board (iet7830) is an internal expansion board for the ATARI 7800 which&lt;br /&gt;
; gives the system 128 Kbyte of SRAM and one POKEY chip.&lt;br /&gt;
;&lt;br /&gt;
; The expansion SRAM is located from $4000 up to $7fff and is divided into 8 banks&lt;br /&gt;
; of 16Kbyte each. The SRAM is by default disabled when the system starts up and&lt;br /&gt;
; has to be enabled by the application. This is so that existing games and software&lt;br /&gt;
; will function properly. To enable the SRAM write a &amp;quot;1&amp;quot; to Bit 3 of the XCTRL&lt;br /&gt;
; register.&lt;br /&gt;
;&lt;br /&gt;
; The POKEY is located in the high section of the available memory area at $0400&lt;br /&gt;
; of the 7800. It is selected from $0460 - $046f when Bit 4 of the XCTRL register&lt;br /&gt;
; is set to &amp;quot;1&amp;quot; if Bit 4 = &amp;quot;0&amp;quot; the POKEY is disabled.&lt;br /&gt;
;&lt;br /&gt;
XCTRL           =       $0470  ; Note Write only&lt;br /&gt;
; Bit 4 = Enable POKEY chip&lt;br /&gt;
; Bit 3 = Enable Banked 128Kbyte SRAM&lt;br /&gt;
; Bit 2 = Bit 2 of SRAM bank select&lt;br /&gt;
; Bit 1 = Bit 1 of SRAM bank select&lt;br /&gt;
; Bit 0 = Bit 0 of SRAM bank select&lt;br /&gt;
&lt;br /&gt;
;&lt;br /&gt;
; Bit patterns for enabling/disabling XBoard features.&lt;br /&gt;
XENABLEMEM      =       %00001000&lt;br /&gt;
XENABLEPOKEY    =       %00010000&lt;br /&gt;
&lt;br /&gt;
XPOKEYBASE1     =       $0450&lt;br /&gt;
XPOKEYBASE2  =       $0460&lt;br /&gt;
&lt;br /&gt;
MEMTESTCOUNT    =       10     ; Number of iterations when testing the XBoard Memory&lt;br /&gt;
XMEMORYSTART    =       $4000  ; This is where the memory of the XBoard starts&lt;br /&gt;
&lt;br /&gt;
;************************************************************************&lt;br /&gt;
;*&lt;br /&gt;
;* Function:    SetXCtrl&lt;br /&gt;
;*&lt;br /&gt;
;* Description: This function sets the XCTRL register to the value in&lt;br /&gt;
;*              acc and updates the shadow&lt;br /&gt;
;*&lt;br /&gt;
;************************************************************************&lt;br /&gt;
SetXCtrl:      sta     XCTRL&lt;br /&gt;
               sta     XCTRL_SHDW&lt;br /&gt;
   &lt;br /&gt;
               rts&lt;br /&gt;
;************************************************************************&lt;br /&gt;
;*&lt;br /&gt;
;* Here's the code for checking and enabling the XBoard SRAM&lt;br /&gt;
;*&lt;br /&gt;
;* This test fills the entire 16K memory bank with a known pattern&lt;br /&gt;
;* and then compares it with the same pattern. If any byte is unequal&lt;br /&gt;
;* the memory test aborts and reports no memory.&lt;br /&gt;
;*&lt;br /&gt;
;* For this test to be effective the length of the test pattern must&lt;br /&gt;
;* not be equal to a power of 2 base. So it has been chosen to just&lt;br /&gt;
;* repeat all strings used into memory.&lt;br /&gt;
;*&lt;br /&gt;
;************************************************************************&lt;br /&gt;
; First we load the memory with a known test string......&lt;br /&gt;
               lda     #XENABLEMEM&lt;br /&gt;
               jsr     SetXCtrl        ; Enable XBOARD SRAM and set to bank zero&lt;br /&gt;
&lt;br /&gt;
               lda     #&amp;lt;XMEMORYSTART&lt;br /&gt;
               sta     MemTest&lt;br /&gt;
               lda     #&amp;gt;XMEMORYSTART&lt;br /&gt;
               sta     MemTest+1      ; Loads the memory address&lt;br /&gt;
&lt;br /&gt;
               lda     #MEMTESTCOUNT  ; Number of iterations to test in memory (&amp;lt;256)&lt;br /&gt;
               sta     Iterate&lt;br /&gt;
&lt;br /&gt;
               ldy     #0&lt;br /&gt;
XCheck0:        &lt;br /&gt;
               ldx     #&amp;lt;MEMTESTLEN   ; Load memory test string length (&amp;lt;256)&lt;br /&gt;
XCheck1:        &lt;br /&gt;
               lda     Text1,X&lt;br /&gt;
               sta     (MemTest),Y    ; Store test character&lt;br /&gt;
&lt;br /&gt;
               inc     MemTest&lt;br /&gt;
               bne     XCheck15&lt;br /&gt;
               inc     MemTest + 1    ; Increment the XBoard memory pointer&lt;br /&gt;
               &lt;br /&gt;
XCheck15:&lt;br /&gt;
               lda     MemTest        ; Check low target adress for zero&lt;br /&gt;
               bne     XCheck2        ; Skip if not zero&lt;br /&gt;
               &lt;br /&gt;
               lda     MemTest + 1    ; Check high target address&lt;br /&gt;
               cmp     #$80           ; If it's hex 80 we have a wrap = done&lt;br /&gt;
               bne     XCheck2        ; Loop again if not zero&lt;br /&gt;
               jmp     XCheck25       ; Break out of this loop&lt;br /&gt;
&lt;br /&gt;
XCheck2:        dex&lt;br /&gt;
               bne     XCheck1        ; Store the entire test data set&lt;br /&gt;
               beq     XCheck0        ; Reload test string counter&lt;br /&gt;
&lt;br /&gt;
; Second phase of the memory test&lt;br /&gt;
; Now we compare the stored data in memory with the reference content....&lt;br /&gt;
XCheck25:                &lt;br /&gt;
               lda     #&amp;lt;XMEMORYSTART&lt;br /&gt;
               sta     MemTest&lt;br /&gt;
               lda     #&amp;gt;XMEMORYSTART&lt;br /&gt;
               sta     MemTest+1      ; Loads the memory address&lt;br /&gt;
&lt;br /&gt;
               lda     #MEMTESTCOUNT  ; Number of iterations to test in memory (&amp;lt;256)&lt;br /&gt;
               sta     Iterate&lt;br /&gt;
&lt;br /&gt;
               ldy     #0&lt;br /&gt;
XCheck3:        &lt;br /&gt;
               ldx     #&amp;lt;MEMTESTLEN   ; Load memory test string length (&amp;lt;256)&lt;br /&gt;
XCheck4:        &lt;br /&gt;
               lda     Text1,X        ; Load the known data to compare memory contents with&lt;br /&gt;
               cmp     (MemTest),Y    ; And do the comparison.&lt;br /&gt;
               bne     XCheck6        ; Skip further checking if not equal, ie. memory error&lt;br /&gt;
&lt;br /&gt;
XCheck7:        inc     MemTest        ; ... otherwise continue to compare.&lt;br /&gt;
               bne     XCheck5&lt;br /&gt;
               inc     MemTest + 1    ; Increment the XBoard memory pointer&lt;br /&gt;
XCheck5:        &lt;br /&gt;
               lda     MemTest        ; Check low target adress for zero&lt;br /&gt;
               bne     XCheck55       ; Skip if not zero&lt;br /&gt;
               &lt;br /&gt;
               lda     MemTest + 1    ; Check high target address&lt;br /&gt;
               cmp     #$80           ; If it's hex 80 we have a wrap = done&lt;br /&gt;
               bne     XCheck55       ; Loop again if not zero&lt;br /&gt;
               jmp     TA1            ; Break out of this loop&lt;br /&gt;
XCheck55:&lt;br /&gt;
               dex&lt;br /&gt;
               bne     XCheck4        ; Store the entire test data set&lt;br /&gt;
               beq     XCheck3        ; And reload the test length counter&lt;br /&gt;
&lt;br /&gt;
TA1:            jsr     XMemOK         ; Go show memory indicator&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>MSaarna</name></author>	</entry>

	</feed>