<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://oldwiki.cpcwiki.eu/index.php?action=history&amp;feed=atom&amp;title=NV-DIR</id>
		<title>NV-DIR - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://oldwiki.cpcwiki.eu/index.php?action=history&amp;feed=atom&amp;title=NV-DIR"/>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=NV-DIR&amp;action=history"/>
		<updated>2026-08-30T08:30:38Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.25.1</generator>

	<entry>
		<id>https://oldwiki.cpcwiki.eu/index.php?title=NV-DIR&amp;diff=32170&amp;oldid=prev</id>
		<title>TFM: Created page with 'This source deals with the non volatile memory of the SYMBiFACE II and the CPC Booster. Compatible with the MAXAM assembler.  &lt;pre&gt; org &amp;9000 ; File ----&gt; NV-DIR.MAX …'</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.cpcwiki.eu/index.php?title=NV-DIR&amp;diff=32170&amp;oldid=prev"/>
				<updated>2009-09-27T21:32:30Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;#039;This source deals with the non volatile memory of the &lt;a href=&quot;/index.php/SYMBiFACE_II&quot; title=&quot;SYMBiFACE II&quot;&gt;SYMBiFACE II&lt;/a&gt; and the &lt;a href=&quot;/index.php/CPC_Booster&quot; title=&quot;CPC Booster&quot;&gt;CPC Booster&lt;/a&gt;. Compatible with the &lt;a href=&quot;/index.php/MAXAM&quot; title=&quot;MAXAM&quot;&gt;MAXAM&lt;/a&gt; assembler.  &amp;lt;pre&amp;gt; org &amp;amp;9000 ; File ----&amp;gt; NV-DIR.MAX …&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;This source deals with the non volatile memory of the [[SYMBiFACE II]] and the [[CPC Booster]]. Compatible with the [[MAXAM]] assembler.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
org &amp;amp;9000 ; File ----&amp;gt; NV-DIR.MAX&lt;br /&gt;
nolist    ; Version -&amp;gt; 1.0 (30.12.2006) english!&lt;br /&gt;
          ; Lines ---&amp;gt; 477&lt;br /&gt;
&lt;br /&gt;
;Part of the FutureView IV release, please look there for further informations.&lt;br /&gt;
&lt;br /&gt;
;This file containt the source code to calculate a checksum over the DIRectory&lt;br /&gt;
;of the nvRAM of the Symbiface and/or the EEPROM of the CPC-Booster Plus.&lt;br /&gt;
;This source code is a part of the FutureView IV.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;-----------------;&lt;br /&gt;
; All code by TFM ;&lt;br /&gt;
; of  Future-Soft ;&lt;br /&gt;
;-----------------;&lt;br /&gt;
; This  code  was ;&lt;br /&gt;
; tested.  Please ;&lt;br /&gt;
; copy  this file ;&lt;br /&gt;
; as it is!!! TFM ;&lt;br /&gt;
;-----------------;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;--- --- --- Example how to work with the EEPROM o.t. CPC Booster+ --- --- ---;&lt;br /&gt;
&lt;br /&gt;
 LD   HL,EE_BUFFER ;Space for the &amp;amp;200 Bytes EEPROM of the CPC Booster+&lt;br /&gt;
 CALL READ_EE      ;Read &amp;amp;200 Bytes EEPROM from CB (CPC Booster+)&lt;br /&gt;
&lt;br /&gt;
 LD   HL,EE_BUFFER ;Pointer to &amp;amp;200 Bytes of EEPROM buffer&lt;br /&gt;
 CALL TST_CHCK_EE  ;Test if Checksum of the EEPROM is correct&lt;br /&gt;
&lt;br /&gt;
 JP   Z,EE_DIR_OK  ;Go there if Checksum is correct!&lt;br /&gt;
&lt;br /&gt;
;Checksum is NOT correct!&lt;br /&gt;
&lt;br /&gt;
 LD   HL,EE_BUFFER ;Pointer to &amp;amp;200 Bytes EEPROM buffer&lt;br /&gt;
 CALL INIT_DIR_EE  ;Initialize DIRectory of the EEPROM&lt;br /&gt;
&lt;br /&gt;
;There is NO need to create/install a NEW checksum,&lt;br /&gt;
;because the checksum and DIR are all zero bytes.&lt;br /&gt;
&lt;br /&gt;
 JP   EE_EXIT      ;Write new DIR and DATA into the CP EEPROM, then Exit!&lt;br /&gt;
&lt;br /&gt;
;Delete last line of code, if you want to manage newly installed DIR/DATA.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;EEPROM Checksum was tested correct!&lt;br /&gt;
&lt;br /&gt;
EE_DIR_OK&lt;br /&gt;
&lt;br /&gt;
;NOW you can MANAGE your CB EEPROM in different ways...&lt;br /&gt;
&lt;br /&gt;
;1. - READ an Entry (of 16 Bytes)&lt;br /&gt;
;(remove semicolons of the following 5 lines to use this function)&lt;br /&gt;
;&lt;br /&gt;
; LD   A,&amp;amp;09        ;A contains the Product-ID (range between &amp;amp;01 and &amp;amp;FE).&lt;br /&gt;
; LD   HL,EE_BUFFER ;Pointer to &amp;amp;200 Bytes EEPROM buffer (source)&lt;br /&gt;
; LD   DE,ENTRY_BUF ;16 Byte buffer for ONE 16 Byte Entry of the CB EEPROM&lt;br /&gt;
; CALL RED_ENT_EE   ;Read 16 Byte Entry from CB EEPROM with the ID stored in A&lt;br /&gt;
&lt;br /&gt;
;... or ...&lt;br /&gt;
&lt;br /&gt;
;2. - WRITE an Entry (of 16 Bytes)&lt;br /&gt;
;(remove semicolons of the following 8 lines to use this function)&lt;br /&gt;
;&lt;br /&gt;
; LD   A,&amp;amp;12        ;A contains YOUR Product-ID (range between &amp;amp;01 and &amp;amp;FE).&lt;br /&gt;
; LD   HL,EE_BUFFER ;Pointer to &amp;amp;200 Bytes EEPROM target buffer&lt;br /&gt;
; LD   DE,ENTRY_BUF ;source buffer of ONE 16 Byte Entry for the CB EEPROM&lt;br /&gt;
; CALL WRT_ENT_EE   ;Write 16 Byte Entry to CB EEPROM (ID prev. stored in A)&lt;br /&gt;
;&lt;br /&gt;
; LD   HL,EE_BUFFER ;Pointer to &amp;amp;200 Bytes EEPROM buffer&lt;br /&gt;
; CALL MAKE_CHK_EE  ;Create and install NEW checksum after WRITE&lt;br /&gt;
&lt;br /&gt;
;... or ...&lt;br /&gt;
&lt;br /&gt;
;3. - ERASE an Entry (of 16 Bytes)&lt;br /&gt;
;(remove semicolons of the following 7 lines to use this function)&lt;br /&gt;
;&lt;br /&gt;
; LD   A,&amp;amp;02        ;A contains YOUR Product-ID (range between &amp;amp;01 and &amp;amp;FE).&lt;br /&gt;
; LD   HL,EE_BUFFER ;Pointer to &amp;amp;200 Bytes EEPROM buffer&lt;br /&gt;
; CALL ERA_ENT_EE   ;Erase ONE Entry (16 Bytes) in the DIR of the CB EEPROM&lt;br /&gt;
;&lt;br /&gt;
; LD   HL,EE_BUFFER ;Pointer to &amp;amp;200 Bytes EEPROM buffer&lt;br /&gt;
; CALL MAKE_CHK_EE  ;Create and install NEW checksum after ERASE&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;Finally you have to write back Checksum and Data from RAM to the CB EEPROM.&lt;br /&gt;
&lt;br /&gt;
EE_EXIT LD HL,EE_BUFFER ;Pointer to &amp;amp;200 Bytes EEPROM buffer&lt;br /&gt;
&lt;br /&gt;
 CALL WRITE_EE ;Write RAM to EEPROM of CB&lt;br /&gt;
 RET&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;--- --- --- Example how to work with the nvRAM of the Symbiface --- --- --- ;&lt;br /&gt;
&lt;br /&gt;
 LD   HL,NV_BUFFER ;Space for &amp;amp;72 Bytes of the &amp;amp;80 Bytes nvRAM of the Symbiface&lt;br /&gt;
 CALL READ_NV      ;Read &amp;amp;72 Bytes nvRAM from SF (without clock data)&lt;br /&gt;
&lt;br /&gt;
 LD   HL,NV_BUFFER ;Pointer to &amp;amp;72 Bytes of nvRAM buffer&lt;br /&gt;
 CALL TST_CHCK_NV  ;Test if Checksum of the nvRAM is correct&lt;br /&gt;
&lt;br /&gt;
 JP   Z,NV_DIR_OK  ;Go there if Checksum is correct!&lt;br /&gt;
&lt;br /&gt;
;Checksum is NOT correct!&lt;br /&gt;
&lt;br /&gt;
 LD   HL,NV_BUFFER ;Pointer to &amp;amp;72 Bytes nvRAM buffer&lt;br /&gt;
 CALL INIT_DIR_NV  ;Initialize DIRectory of the nvRAM&lt;br /&gt;
&lt;br /&gt;
 LD   HL,NV_BUFFER ;Pointer to &amp;amp;72 Bytes nvRAM buffer&lt;br /&gt;
 CALL MAKE_CHK_NV  ;Create and install NEW checksum&lt;br /&gt;
&lt;br /&gt;
 JP   NV_EXIT      ;Write new DIR and DATA into the SF nvRAM, then Exit!&lt;br /&gt;
&lt;br /&gt;
;Delete last line of code, if you want to manage newly installed DIR/DATA.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;nvRAM Checksum was tested correct!&lt;br /&gt;
&lt;br /&gt;
NV_DIR_OK&lt;br /&gt;
&lt;br /&gt;
;NOW you can MANAGE your SF nvRAM in different ways...&lt;br /&gt;
&lt;br /&gt;
;1. - READ an Entry (of 16 Bytes)&lt;br /&gt;
;(remove semicolons of the following 5 lines to use this function)&lt;br /&gt;
;&lt;br /&gt;
; LD   A,&amp;amp;09        ;A contains the Product-ID (range between &amp;amp;01 and &amp;amp;FE).&lt;br /&gt;
; LD   HL,NV_BUFFER ;Pointer to &amp;amp;72 Bytes nvRAM buffer (source)&lt;br /&gt;
; LD   DE,ENTRY_BUF ;16 Byte buffer for ONE 16 Byte Entry of the SF nvRAM&lt;br /&gt;
; CALL RED_ENT_NV   ;Read 16 Byte Entry from SF nvRAM with the ID stored in A&lt;br /&gt;
&lt;br /&gt;
;... or ...&lt;br /&gt;
&lt;br /&gt;
;2. - WRITE an Entry (of 16 Bytes)&lt;br /&gt;
;(remove semicolons of the following 8 lines to use this function)&lt;br /&gt;
;&lt;br /&gt;
; LD   A,&amp;amp;12        ;A contains YOUR Product-ID (range between &amp;amp;01 and &amp;amp;FE).&lt;br /&gt;
; LD   HL,NV_BUFFER ;Pointer to &amp;amp;72 Bytes nvRAM target buffer&lt;br /&gt;
; LD   DE,ENTRY_BUF ;source buffer of ONE 16 Byte Entry for the SF nvRAM&lt;br /&gt;
; CALL WRT_ENT_NV   ;Write 16 Byte Entry to SF nvRAM (ID prev. stored in A)&lt;br /&gt;
;&lt;br /&gt;
; LD   HL,NV_BUFFER ;Pointer to &amp;amp;72 Bytes nvRAM buffer&lt;br /&gt;
; CALL MAKE_CHK_NV  ;Create and install NEW checksum after WRITE&lt;br /&gt;
&lt;br /&gt;
;... or ...&lt;br /&gt;
&lt;br /&gt;
;3. - ERASE an Entry (of 16 Bytes)&lt;br /&gt;
;(remove semicolons of the following 7 lines to use this function)&lt;br /&gt;
;&lt;br /&gt;
; LD   A,&amp;amp;02        ;A contains YOUR Product-ID (range between &amp;amp;01 and &amp;amp;FE).&lt;br /&gt;
; LD   HL,NV_BUFFER ;Pointer to &amp;amp;72 Bytes nvRAM buffer&lt;br /&gt;
; CALL ERA_ENT_NV   ;Erase ONE Entry (16 Bytes) in the DIR of the SF nvRAM&lt;br /&gt;
;&lt;br /&gt;
; LD   HL,NV_BUFFER ;Pointer to &amp;amp;72 Bytes nvRAM buffer&lt;br /&gt;
; CALL MAKE_CHK_NV  ;Create and install NEW checksum after ERASE&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;Finally you have to write back Checksum and Data from RAM to the SF nvRAM.&lt;br /&gt;
&lt;br /&gt;
NV_EXIT LD HL,NV_BUFFER ;Pointer to &amp;amp;72 Bytes nvRAM buffer&lt;br /&gt;
&lt;br /&gt;
 CALL WRITE_NV ;Write RAM to nvRAM of SF (without clock)&lt;br /&gt;
 RET&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; --- --- --- Subroutines for EEPROM management / CPC Booster+ --- --- --- ;&lt;br /&gt;
&lt;br /&gt;
;Read &amp;amp;0200 Bytes CPC Booster+ EEPROM (DIR and Data)&lt;br /&gt;
;&lt;br /&gt;
;In;&lt;br /&gt;
;HL = Buffer for &amp;amp;200 Bytes&lt;br /&gt;
;&lt;br /&gt;
;Out;&lt;br /&gt;
;&amp;amp;200 Bytes (Checksum, Data) have been read to old HL&lt;br /&gt;
;&lt;br /&gt;
;(Changed Registers AF, BC, HL)&lt;br /&gt;
&lt;br /&gt;
READ_EE XOR A,A:LD BC,&amp;amp;FF0C:OUT (C),A:INC C:OUT (C),A&lt;br /&gt;
READ_E1 INC C:INI:INC B:DEC C:INC A:OUT (C),A:JR NZ,READ_E1&lt;br /&gt;
&lt;br /&gt;
 INC A:DEC C:OUT (C),A:INC C:DEC A&lt;br /&gt;
&lt;br /&gt;
READ_E2 INC C:INI:INC B:DEC C:INC A:OUT (C),A:JR NZ,READ_E2:RET&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;Test Checksum of EEPROM (CPC Booster+)&lt;br /&gt;
;&lt;br /&gt;
;In;&lt;br /&gt;
;HL = Buffer-Start of &amp;amp;200 Bytes EEPROM (previously read with READ_EE)&lt;br /&gt;
;&lt;br /&gt;
;Out;&lt;br /&gt;
;Zero-Flag is SET if Checksum is correct, else Zero is cleared.&lt;br /&gt;
;&lt;br /&gt;
;(Changed Registers AF, BC, DE, HL)&lt;br /&gt;
&lt;br /&gt;
TST_CHCK_EE LD E,(HL):INC HL:LD D,(HL):INC HL:PUSH DE ;old checksum&lt;br /&gt;
&lt;br /&gt;
 LD A,&amp;amp;0F:LD DE,&amp;amp;0000&lt;br /&gt;
&lt;br /&gt;
TST_CHCK_EL LD C,(HL):INC HL:LD B,(HL):INC HL:EX DE,HL:ADD HL,BC:EX DE,HL&lt;br /&gt;
&lt;br /&gt;
 DEC A:JR NZ,TST_CHCK_EL:POP HL:XOR A,A:SBC HL,DE:RET&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;Initialize DIRectory of the EEPROM&lt;br /&gt;
;&lt;br /&gt;
;In;&lt;br /&gt;
;HL = Buffer for &amp;amp;200 Bytes EEPROM (previously read with READ_EE)&lt;br /&gt;
;&lt;br /&gt;
;(Changed Registers AF, BC, DE, HL)&lt;br /&gt;
&lt;br /&gt;
INIT_DIR_EE XOR A,A:LD (HL),A:LD D,H:LD E,L:INC DE:LD BC,&amp;amp;001F:LDIR:RET&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;Calculate and Install new Checksum for CB EEPROM buffer&lt;br /&gt;
;&lt;br /&gt;
;In;&lt;br /&gt;
;HL = Start of buffer of &amp;amp;200 Bytes EEPROM (previously read with READ_EE)&lt;br /&gt;
;&lt;br /&gt;
;(Changed Registers AF, BC, DE, HL)&lt;br /&gt;
&lt;br /&gt;
MAKE_CHK_EE PUSH HL:INC HL:INC HL:LD A,&amp;amp;0F:LD DE,&amp;amp;0000&lt;br /&gt;
&lt;br /&gt;
MAKE_CHK_EL LD C,(HL):INC HL:LD B,(HL):INC HL:EX DE,HL:ADD HL,BC:EX DE,HL&lt;br /&gt;
&lt;br /&gt;
 DEC A:JR NZ,MAKE_CHK_EL:POP HL:LD (HL),E:INC HL:LD (HL),D:RET&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;Read 16 Byte Entry from CB EEPROM with given Product-ID&lt;br /&gt;
;&lt;br /&gt;
;In;&lt;br /&gt;
; A = contains the Product-ID (in the range between &amp;amp;01 and &amp;amp;FE).&lt;br /&gt;
;HL = Pointer to &amp;amp;200 Bytes EEPROM source buffer (must have been read before!)&lt;br /&gt;
;DE = Pointer to 16 Byte target buffer for ONE 16 Byte entry of the CB EEPROM&lt;br /&gt;
;&lt;br /&gt;
;Out;&lt;br /&gt;
;Zero-Flag set ------&amp;gt; Entry was found and copied to DE (16 Bytes)&lt;br /&gt;
;Zero-Flag cleared --&amp;gt; An Entry with that Product-ID was NOT found!&lt;br /&gt;
;&lt;br /&gt;
;(Changed Registers AF, BC, DE, HL)&lt;br /&gt;
&lt;br /&gt;
RED_ENT_EE PUSH HL:INC HL:INC HL:LD B,&amp;amp;1E&lt;br /&gt;
GLP_ENT_EE CP A,(HL):JR Z,GEX_ENT_EE:INC HL:DJNZ GLP_ENT_EE:POP HL:RET&lt;br /&gt;
GEX_ENT_EE LD A,&amp;amp;20:SUB A,B:ADD A,A:ADD A,A:ADD A,A ;(DIR Nr. 2..31)*8&lt;br /&gt;
&lt;br /&gt;
 LD B,&amp;amp;00:LD C,A:POP HL:ADD HL,BC:ADD HL,BC:LD BC,&amp;amp;0010:LDIR:XOR A,A:RET&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;Write 16 Byte Entry to CB EEPROM buffer (identified through given Product-ID)&lt;br /&gt;
;(Routine OVERWRITES old entry with the SAME Product-ID)&lt;br /&gt;
;&lt;br /&gt;
;In;&lt;br /&gt;
; A = YOUR Product-ID (range between &amp;amp;01 and &amp;amp;FE).&lt;br /&gt;
;HL = Pointer to &amp;amp;200 Bytes EEPROM target buffer (must have been read before!)&lt;br /&gt;
;DE = Pointer to source buffer of ONE 16 Byte Entry of the CB EEPROM&lt;br /&gt;
;&lt;br /&gt;
;Out;&lt;br /&gt;
;Zero-Flag set ------&amp;gt; Entry was written to CB EEPROM buffer (16 Bytes)&lt;br /&gt;
;Zero-Flag cleared --&amp;gt; NO free Entry anymore!&lt;br /&gt;
;&lt;br /&gt;
;(Changed Registers AF, BC, DE, HL)&lt;br /&gt;
&lt;br /&gt;
WRT_ENT_EE PUSH HL:INC HL:INC HL:LD B,&amp;amp;1E&lt;br /&gt;
WLP_ENT_EE CP A,(HL):JR Z,WEX_ENT_EE:INC HL:DJNZ WLP_ENT_EE&lt;br /&gt;
&lt;br /&gt;
 LD BC,&amp;amp;FFE2:ADD HL,BC:LD B,&amp;amp;1E:LD C,A:XOR A,A&lt;br /&gt;
&lt;br /&gt;
WL2_ENT_EE CP A,(HL):JR Z,WEY_ENT_EE:INC HL:DJNZ WL2_ENT_EE:POP HL:RET&lt;br /&gt;
WEY_ENT_EE LD (HL),C&lt;br /&gt;
WEX_ENT_EE LD A,&amp;amp;20:SUB A,B:ADD A,A:ADD A,A:ADD A,A ;(DIR Nr. 2..31)*8&lt;br /&gt;
&lt;br /&gt;
 LD B,&amp;amp;00:LD C,A:POP HL:ADD HL,BC:ADD HL,BC&lt;br /&gt;
 EX DE,HL:LD BC,&amp;amp;0010:LDIR:XOR A,A:RET&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;Erase ONE Entry in the DIR of the CB EEPROM (named by given Product-ID)&lt;br /&gt;
;&lt;br /&gt;
;In;&lt;br /&gt;
; A = contains the Product-ID (in the range between &amp;amp;01 and &amp;amp;FE).&lt;br /&gt;
;HL = Pointer to &amp;amp;200 Bytes EEPROM buffer (must have been read before!)&lt;br /&gt;
;&lt;br /&gt;
;Out;&lt;br /&gt;
;Zero-Flag set ------&amp;gt; Entry was found and ERASED in DIR&lt;br /&gt;
;Zero-Flag cleared --&amp;gt; An Entry with the given Product-ID was NOT found!&lt;br /&gt;
;&lt;br /&gt;
;(Changed Registers AF, BC, HL)&lt;br /&gt;
&lt;br /&gt;
ERA_ENT_EE INC HL:INC HL:LD B,&amp;amp;1E&lt;br /&gt;
ELP_ENT_EE CP A,(HL):JR Z,EEX_ENT_EE:INC HL:DJNZ ELP_ENT_EE:RET&lt;br /&gt;
EEX_ENT_EE XOR A,A:LD (HL),A:RET&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;Write RAM buffer back to CPC Booster+ EEPROM (DIR and Data)&lt;br /&gt;
;&lt;br /&gt;
;In;&lt;br /&gt;
;HL = Pointer to Buffer of &amp;amp;200 Bytes in RAM&lt;br /&gt;
;&lt;br /&gt;
;Out;&lt;br /&gt;
;&amp;amp;200 Bytes (Checksum, Data) have been written from RAM to EEPROM(CPC Booster+)&lt;br /&gt;
;&lt;br /&gt;
;(Changed Registers AF, BC, DE, HL)&lt;br /&gt;
&lt;br /&gt;
WRITE_EE LD DE,&amp;amp;0001:LD BC,&amp;amp;FF0C:OUT (C),D:INC C:OUT (C),D&lt;br /&gt;
WRITE_E1 INC C:LD A,(HL):OUT (C),A:INC HL:DEC C&lt;br /&gt;
&lt;br /&gt;
 INC D:OUT (C),D:JR NZ,WRITE_E1&lt;br /&gt;
 DEC C:OUT (C),E:INC C&lt;br /&gt;
&lt;br /&gt;
WRITE_E2 INC C:LD A,(HL):OUT (C),A:INC HL:DEC C&lt;br /&gt;
&lt;br /&gt;
 INC D:OUT (C),D:JR NZ,WRITE_E2:RET&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; --- --- --- Subroutines for the nvRAM management / Symbiface --- --- --- ;&lt;br /&gt;
&lt;br /&gt;
;Read Symbiface nvRAM (DIR and Data)&lt;br /&gt;
;(read nvRAM-Bytes &amp;amp;000E-&amp;amp;007F, no clock data)&lt;br /&gt;
;&lt;br /&gt;
;In;&lt;br /&gt;
;HL = Buffer for &amp;amp;72 Bytes&lt;br /&gt;
;&lt;br /&gt;
;Out;&lt;br /&gt;
;&amp;amp;72 Bytes (Checksum, Data) have been read to old HL&lt;br /&gt;
;&lt;br /&gt;
;(Changed Registers AF, BC, HL)&lt;br /&gt;
&lt;br /&gt;
READ_NV LD BC,&amp;amp;FD15:LD A,&amp;amp;0E&lt;br /&gt;
READ_NL OUT (C),A:DEC C:INI:INC B:INC C:INC A:OR A,A:JP P,READ_NL:RET&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;Test Checksum of nvRAM (Symbiface)&lt;br /&gt;
;&lt;br /&gt;
;In;&lt;br /&gt;
;HL = Buffer-Start of &amp;amp;72 Bytes nvRAM (previously read with READ_NV)&lt;br /&gt;
;&lt;br /&gt;
;Out;&lt;br /&gt;
;Zero-Flag is SET if Checksum is correct, else Zero is cleared.&lt;br /&gt;
;&lt;br /&gt;
;(Changed Registers AF, BC, DE, HL)&lt;br /&gt;
&lt;br /&gt;
TST_CHCK_NV LD E,(HL):INC HL:LD D,(HL):LD BC,&amp;amp;0061:ADD HL,BC:PUSH DE ;old checksum&lt;br /&gt;
&lt;br /&gt;
 LD A,&amp;amp;08:LD DE,&amp;amp;0000&lt;br /&gt;
&lt;br /&gt;
TST_CHCK_NL LD C,(HL):INC HL:LD B,(HL):INC HL:EX DE,HL:ADD HL,BC:EX DE,HL&lt;br /&gt;
&lt;br /&gt;
 DEC A:JR NZ,TST_CHCK_NL:POP HL:XOR A,A:SBC HL,DE:RET&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;Initialize DIRectory of the nvRAM&lt;br /&gt;
;(protect Clock Data [nvRAM-Bytes &amp;amp;00-&amp;amp;0D])&lt;br /&gt;
;(protect DIRectory [nvRAM-Bytes &amp;amp;70-&amp;amp;77])&lt;br /&gt;
;(set Millenium [nvRAM-Byte &amp;amp;32] to &amp;amp;14)&lt;br /&gt;
;&lt;br /&gt;
;In;&lt;br /&gt;
;HL = Buffer for &amp;amp;72 Bytes nvRAM (previously read with READ_NV)&lt;br /&gt;
;&lt;br /&gt;
;(Changed Registers AF, BC, DE, HL)&lt;br /&gt;
&lt;br /&gt;
INIT_DIR_NV XOR A,A:LD (HL),A:LD D,H:LD E,L:INC DE:LD BC,&amp;amp;0071:LDIR&lt;br /&gt;
&lt;br /&gt;
 LD DE,&amp;amp;FFF8:ADD HL,DE:LD (HL),D:LD E,&amp;amp;F9:ADD HL,DE:LD (HL),D&lt;br /&gt;
 LD DE,&amp;amp;FFC2:ADD HL,DE:LD A,&amp;amp;14:LD (HL),A:RET&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;Calculate and Install new Checksum for SF nvRAM buffer&lt;br /&gt;
;&lt;br /&gt;
;In;&lt;br /&gt;
;HL = Start of buffer of &amp;amp;72 Bytes nvRAM (previously read with READ_NV)&lt;br /&gt;
;&lt;br /&gt;
;(Changed Registers AF, BC, DE, HL)&lt;br /&gt;
&lt;br /&gt;
MAKE_CHK_NV PUSH HL:LD BC,&amp;amp;0062:ADD HL,BC&lt;br /&gt;
&lt;br /&gt;
 LD A,&amp;amp;08:LD DE,&amp;amp;0000&lt;br /&gt;
&lt;br /&gt;
MAKE_CHCK_NL LD C,(HL):INC HL:LD B,(HL):INC HL:EX DE,HL:ADD HL,BC:EX DE,HL&lt;br /&gt;
&lt;br /&gt;
 DEC A:JR NZ,MAKE_CHCK_NL:POP HL:LD (HL),E:INC HL:LD (HL),D:RET&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;Read 16 Byte Entry from SF nvRAM with given Product-ID&lt;br /&gt;
;&lt;br /&gt;
;In;&lt;br /&gt;
; A = contains the Product-ID (in the range between &amp;amp;01 and &amp;amp;FE).&lt;br /&gt;
;HL = Pointer to &amp;amp;72 Bytes nvRAM source buffer (must have been read before!)&lt;br /&gt;
;DE = Pointer to 16 Byte target buffer for ONE 16 Byte entry of the SF nvRAM&lt;br /&gt;
;&lt;br /&gt;
;Out;&lt;br /&gt;
;Zero-Flag set ------&amp;gt; Entry was found and copied to DE (16 Bytes)&lt;br /&gt;
;Zero-Flag cleared --&amp;gt; An Entry with that Product-ID was NOT found!&lt;br /&gt;
;&lt;br /&gt;
;(Changed Registers AF, BC, DE, HL)&lt;br /&gt;
&lt;br /&gt;
RED_ENT_NV LD BC,&amp;amp;0063:PUSH HL:ADD HL,BC:LD B,&amp;amp;06&lt;br /&gt;
GLP_ENT_NV CP A,(HL):JR Z,GEX_ENT_NV:INC HL:DJNZ GLP_ENT_NV:POP HL:RET&lt;br /&gt;
GEX_ENT_NV LD A,&amp;amp;06:SUB A,B:ADD A,A:ADD A,A:ADD A,A:ADD A,A ;(DIR Nr.0-5)*16&lt;br /&gt;
&lt;br /&gt;
 INC A:INC A:LD B,&amp;amp;00:LD C,A:POP HL:ADD HL,BC:LD BC,&amp;amp;0010:LDIR:XOR A,A:RET&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;Write 16 Byte Entry to SF nvRAM buffer (identified through given Product-ID)&lt;br /&gt;
;(Routine OVERWRITES old entry with the SAME Product-ID)&lt;br /&gt;
;&lt;br /&gt;
;In;&lt;br /&gt;
; A = YOUR Product-ID (range between &amp;amp;01 and &amp;amp;FE).&lt;br /&gt;
;HL = Pointer to &amp;amp;72 Bytes nvRAM target buffer (must have been read before!)&lt;br /&gt;
;DE = Pointer to source buffer of ONE 16 Byte Entry of the SF nvRAM&lt;br /&gt;
;&lt;br /&gt;
;Out;&lt;br /&gt;
;Zero-Flag set ------&amp;gt; Entry was written to SF nvRAM buffer (16 Bytes)&lt;br /&gt;
;Zero-Flag cleared --&amp;gt; NO free Entry anymore!&lt;br /&gt;
;&lt;br /&gt;
;(Changed Registers AF, BC, DE, HL)&lt;br /&gt;
&lt;br /&gt;
WRT_ENT_NV LD BC,&amp;amp;0063:PUSH HL:ADD HL,BC:LD B,&amp;amp;06&lt;br /&gt;
WLP_ENT_NV CP A,(HL):JR Z,WEX_ENT_NV:INC HL:DJNZ WLP_ENT_NV&lt;br /&gt;
&lt;br /&gt;
 LD BC,&amp;amp;FFFA:ADD HL,BC:LD B,&amp;amp;06:LD C,A:XOR A,A&lt;br /&gt;
&lt;br /&gt;
WL2_ENT_NV CP A,(HL):JR Z,WEY_ENT_NV:INC HL:DJNZ WL2_ENT_NV:POP HL:RET&lt;br /&gt;
WEY_ENT_NV LD (HL),C&lt;br /&gt;
WEX_ENT_NV LD A,&amp;amp;06:SUB A,B:ADD A,A:ADD A,A:ADD A,A:ADD A,A ;(DIR Nr.0-5)*16&lt;br /&gt;
&lt;br /&gt;
 INC A:INC A:LD B,&amp;amp;00:LD C,A:POP HL&lt;br /&gt;
 ADD HL,BC:EX DE,HL:LD BC,&amp;amp;0010:LDIR:XOR A,A:RET&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;Erase ONE Entry in the DIR of the SF nvRAM (named by given Product-ID)&lt;br /&gt;
;&lt;br /&gt;
;In;&lt;br /&gt;
; A = contains the Product-ID (in the range between &amp;amp;01 and &amp;amp;FE).&lt;br /&gt;
;HL = Pointer to &amp;amp;72 Bytes nvRAM buffer (must have been read before!)&lt;br /&gt;
;&lt;br /&gt;
;Out;&lt;br /&gt;
;Zero-Flag set ------&amp;gt; Entry was found and ERASED in DIR&lt;br /&gt;
;Zero-Flag cleared --&amp;gt; An Entry with the given Product-ID was NOT found!&lt;br /&gt;
;&lt;br /&gt;
;(Changed Registers AF, BC, HL)&lt;br /&gt;
&lt;br /&gt;
ERA_ENT_NV LD BC,&amp;amp;0063:ADD HL,BC:LD B,&amp;amp;06&lt;br /&gt;
ELP_ENT_NV CP A,(HL):JR Z,EEX_ENT_NV:INC HL:DJNZ ELP_ENT_NV:RET&lt;br /&gt;
EEX_ENT_NV XOR A,A:LD (HL),A:RET&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;Write RAM buffer back to Symbiface nvRAM (DIR and Data)&lt;br /&gt;
;&lt;br /&gt;
;In;&lt;br /&gt;
;HL = Buffer of &amp;amp;72 Bytes in RAM&lt;br /&gt;
;&lt;br /&gt;
;Out;&lt;br /&gt;
;&amp;amp;72 Bytes (Checksum, Data) have been written from RAM to nvRAM (Symbiface)&lt;br /&gt;
;&lt;br /&gt;
;(Changed Registers AF, BC, HL)&lt;br /&gt;
&lt;br /&gt;
WRITE_NV LD BC,&amp;amp;FD15:LD A,&amp;amp;0E&lt;br /&gt;
WRITE_NL OUT (C),A:DEC C:INC B:OUTI:INC C:INC A:OR A,A:JP P,WRITE_NL:RET&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; --- --- --- Buffers / Space for Data --- --- --- ;&lt;br /&gt;
&lt;br /&gt;
EE_BUFFER DS &amp;amp;0200,&amp;amp;00 ;&amp;amp;200 Byte buffer for CPC Booster+ EEPROM&lt;br /&gt;
&lt;br /&gt;
NV_BUFFER DS &amp;amp;72,&amp;amp;00   ;&amp;amp;72 Byte buffer for Symbiface nvRAM&lt;br /&gt;
&lt;br /&gt;
ENTRY_BUF DS &amp;amp;10,&amp;amp;00   ;16 Byte buffer for ONE 16 Byte Entry (CB or SF)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
LIST&lt;br /&gt;
DUMP&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
[[Category:Source code]]&lt;/div&gt;</summary>
		<author><name>TFM</name></author>	</entry>

	</feed>