1 ; Configuration, hardware definition, ...
3 ; Copyright (C) 2010 Sprite_tm
4 ; Copyright (C) 2010 Leo C.
6 ; This file is part of avrcpm.
8 ; avrcpm is free software: you can redistribute it and/or modify it
9 ; under the terms of the GNU General Public License as published by
10 ; the Free Software Foundation, either version 3 of the License, or
11 ; (at your option) any later version.
13 ; avrcpm is distributed in the hope that it will be useful,
14 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ; GNU General Public License for more details.
18 ; You should have received a copy of the GNU General Public License
19 ; along with avrcpm. If not, see <http://www.gnu.org/licenses/>.
25 #define VMAJOR 3 /* Version number */
29 #define DRAM_8BIT 1 /* 1 = 8bit wide data bus to DRAM (ie two 4-bit Chips)*/
30 #endif /* 0 = only one 4 bit wide DRAM chip */
32 #define F_CPU 20000000 /* system clock in Hz; defaults to 20MHz */
35 #define BAUD 38400 /* console baud rate */
38 #define I2C 0 /* I2C requires 8 bit DRAM */
41 #error "I2C requires 8 bit DRAM (DRAM_8BIT=1)!"
44 #define EM_Z80 1 /* Emulate Z80 if true, else 8080 */
47 #define FAT16_SUPPORT 1 /* Include Support for FAT16 Partitions */
48 #endif /* which may contain CP/M image files. */
49 #define RAMDISKCNT 4 /* Number of RAM disks */
50 #define RAMDISKNR 'I'-'A' /* Drive "letter" for first RAM disk */
52 #define PARTID 0x52 /* Partition table id */
53 /* http://www.win.tue.nl/~aeb/partitions/partition_types-1.html */
54 #define IPLADDR 0x2000 /* Bootloader load address */
56 #define DRAM_WAITSTATES 1 /* Number of additional clock cycles for dram read access */
57 #define REFR_RATE 64000 /* dram refresh rate in cycles/s. */
58 /* Most drams need 1/15.6µs. */
59 #define RXBUFSIZE 128 /* USART recieve buffer size. Must be power of 2 */
60 #define TXBUFSIZE 128 /* USART transmit buffer size. Must be power of 2 */
62 #define I2C_CLOCK 100000 /* 100kHz */
63 #define I2C_BUFSIZE 17 /* largest message size including address byte (SLA) */
69 .equ MMC_DEBUG = 0 /* Increase for more debugging */
71 .equ FAT16_RWDEBUG = 0
72 .equ FAT16_DBG_FAT = 0
73 .equ DISK_DEBUG = 0 /* Increase for more debugging */
82 #define MMC_SPI2X 1 /* 0 = SPI CLK/4, 1 = SPI CLK/2 */
84 #define MEMFILL_VAL 0x76 /* Fill ram with HALT opcode. */
85 #define DBG_TRACE_BOTTOM 0x01 /* Page boundaries for INS_DEBUG and PRINT_PC */
86 #define DBG_TRACE_TOP 0xdc /* Trace is off, below bottom page and above top page. */
88 ;-----------------------------------------------------------------------
91 #if DRAM_8BIT /* Implies software uart */
123 .equ P_MMC_CS = PORTB
140 #else /* 4 bit RAM, hardware uart */
155 .equ P_MMC_CS = PORTD
158 .equ RAM_AH_MASK = (1<<RAM_A8)|(1<<RAM_A7)|(1<<RAM_A6)|(1<<RAM_A5)
159 .equ PD_OUTPUT_MASK = (1<<MMC_CS) | (1<<RAM_OE) | RAM_AH_MASK
176 .equ RAM_AL_MASK = (1<<RAM_A4)|(1<<RAM_A3)|(1<<RAM_A2)|(1<<RAM_A1)|(1<<RAM_A0)
177 .equ PB_OUTPUT_MASK = (1<<RAM_ras) | RAM_AL_MASK
191 .equ RAM_DQ_MASK = (1<<RAM_D3)|(1<<RAM_D2)|(1<<RAM_D1)|(1<<RAM_D0)
192 .equ PC_OUTPUT_MASK = (1<<RAM_CAS)|(1<<RAM_W)
194 #endif /* DRAM_8BIT */
197 ;-----------------------------------------------------------------------
198 ;Register definitions
210 ;.def stx_bitcount = r9
213 .def srx_lastedgel = r10
214 .def srx_lastedgeh = r11
227 .def intstat = r21 ; interpreter status / interrupt status
240 .equ i_break = 0 ;break detected flag
241 .equ i_trace = 1 ;cpu interpreter trace flag
242 .equ i_halt = 2 ;executing halt instruction
244 #if defined __ATmega8__
253 .equ hostact = 7 ;host active flag
254 .equ hostwrt = 6 ;host written flag
255 .equ rsflag = 5 ;read sector flag
256 .equ readop = 4 ;1 if read operation
258 .equ prefixfd = 1 ;Opcode prefix DD=0, FD=1
261 ; This is the base z80 port address for clock access
262 #define TIMERPORT 0x40
263 #define TIMER_CTL TIMERPORT
264 #define TIMER_MSECS TIMERPORT+1
265 #define TIMER_SECS TIMER_MSECS+2
266 #define CLOCKPORT TIMERPORT+7
268 #define starttimercmd 1
269 #define quitTimerCmd 2
270 #define printTimerCmd 15
273 #define DEBUGPORT 0x4F
275 #define startTraceCmd 1
276 #define stopTraceCmd 0
278 ; Virtual I2C Interface
286 ; Port-Expander PCF8574
301 #define CPUSTR "8080"
304 #if defined __ATmega8__
319 .equ OC2Aaddr= OC2addr
331 ; vim:set ts=8 noet nowrap