Memory Banks

In this section I will describe the SVI-328 memory banks, but this also goes for an expanded SVI-318.

The microprocessor that's in the SVI-328 is the Zilog Z80, that microprocessor can only address 64KB. Sometimes 64KB isn't enough, that's why you can switch memory banks in and out. There are 8 banks devided into 32KB each in the SV-328. Here is a description of the banks:

FFFFH

8000H
BANK
02
RAM
BANK
12
CARTRIDGE ROM
BANK
22
RAM
BANK
32
RAM
7FFFH

0000H
BANK
01
BASIC ROM
BANK
11
CARTRIDGE ROM
BANK
21
RAM
BANK
31
RAM

 

Bank No Description
01 ROM with Microsoft Extended Basic
02 RAM wich is standard in a SV-328. This bank is used for your Basic programs and System variabels, approx. 29KB is free when you have started your computer.
11 ROM space for cartridges. There's nothing here until you insert an cartridge wich uses this space.
12 ROM same as bank 11
21 RAM wich is standard in SV-328.
22 RAM space for expansion with a SV-807
31 RAM space for expansion with a SV-807
32 RAM space for expansion with a SV-807 (intended for use with CP/M v3.0)

The switching of memory banks is done with the sound chip (AY-3-8910). There are two 8 bit I/O ports in the sound chip (port A and B). This has nothing to do with the production of sound, it's just an extra feature.

Register R7 is a multifunction /ENABLE register wich controls three Noise/Tone mixers and the two general purpose I/O ports directions. The direction (input or output) of the two general purpose I/O ports is determined by the state of bits B7 (port B) and B6 (port A) of R7.

Port A is used for input, so bit 6 should be set to 0.
Port B is used for output, so bit 7 should be set to 1.

Read or writing data to port A or B is done the same way a register is accessed in the PSG. The register values for the ports are:

Port A = register 14
Port B = register 15

The memory bank switching is connected to port B, as below:

Bit Description
0 ROM Cartridge
1 RAM Bank 21
2 RAM Bank 22
3 RAM Bank 31
4 RAM Bank 32
5 Caps Lock LED on/off?
6 ROMEN0?
7 ROMEN1?

 

Sample source

Setting the correct Input/Output of Port A and B

; Sample - Set Port A and B I/O
latch	EQU	88H
write	EQU	8CH
psgreg	EQU	07H

	LD	A,psgreg
	OUT	(latch)		;select PSG register 7
	LD	A,$BF		;Port A (in), Port B(out)
	OUT	(write),A

Switching Bank 31 in/out:

; Sample - bank 31 switch program
latch	EQU 	88H
write	EQU 	8CH
read	EQU 	90H
portb	EQU	0FH

	LD	A,portb
	OUT	(latch), A	; select PSG register 15 (Port B)
	IN	A,(read)	; read current value
	XOR	00000010B	; xor bit for bank 31
	OUT	(write),A	; switch bank

Detecting a cartridge in Bank 11:

; Sample - cartridge (bank 11) test program
latch	EQU 	88H
write	EQU 	8CH
read	EQU 	90H
portb	EQU	15

	LD	A,portb
	OUT	(latch), A	; select PSG register 15 (Port B)
	IN	A,(read)	; read current value
	LD	C,A		; store value
	AND	11111110B	; bank 11
	OUT	(write),A	; switch

	LD	HL,(0)		; address 0 into HL
	LD	A,L
	CP	F3		; is the first byte F3H?
	JR	NZ,exit
	LD	A,H
	CP	31		; is the second byte 31H?
	JP	Z,0		; yes, jump to the start address

exit	LD	A,C		; restore value
	OUT	(write),A	; switch back
	RET

Source: Tomas Karlsson

 

 
Webmaster: