]>
Commit | Line | Data |
---|---|---|
9c15f366 L |
1 | ; DRAM interface for 2 RAM chips. Supports up to 4 Mbyte of DRAM. |
2 | ; This is part of the Z80-CP/M emulator written by Sprite_tm. | |
3 | ||
4 | ; Copyright (C) 2010 Leo C. | |
5 | ||
6 | ; This file is part of avrcpm. | |
7 | ; | |
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. | |
12 | ; | |
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. | |
17 | ; | |
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/>. | |
20 | ; | |
21 | ; $Id$ | |
22 | ; | |
23 | ||
24 | .cseg | |
25 | ||
26 | ; ------------------ DRAM routines ------------- | |
27 | ||
28 | ;Loads the byte on address xh:xl into temp. | |
29 | ;must not alter xh:xl | |
30 | ||
31 | dram_read: | |
825ecc9d | 32 | ; cli ; |
9c15f366 L |
33 | out PORTD,xh ;1 |
34 | out PORTC,_RAS0 ;1 | |
35 | out PORTD,xl ;1 | |
36 | out PORTC,_CAS0 ;1 | |
37 | out DDRD,_0 ;1 | |
38 | out PORTC,_OE ;1 | |
39 | rjmp PC+1 ;2 | |
40 | dram_wait DRAM_WAITSTATES ; | |
41 | in temp,PIND ;1 | |
42 | out PORTC,_255 ;1 | |
43 | out DDRD,_255 ;1 | |
825ecc9d | 44 | ; sei ; |
9c15f366 L |
45 | ret |
46 | ||
47 | ||
48 | ||
49 | ;Writes the byte in temp to xh:xl | |
50 | ;must not alter xh:xl | |
51 | ||
52 | dram_write: | |
825ecc9d | 53 | ; cli |
9c15f366 L |
54 | out PORTD,xh ;1 |
55 | out PORTC,_RAS0 ;1 | |
56 | out PORTD,xl ;1 | |
57 | out PORTC,_CAS0 ;1 | |
58 | out PORTD,temp ;1 | |
59 | out PORTC,_WE ;1 | |
60 | out PORTC,_255 ;1 = 7 | |
825ecc9d | 61 | ; sei |
9c15f366 L |
62 | ret |
63 | ||
4675c141 L |
64 | ; ------------------------------------------------------------------- |
65 | ||
66 | dram_readw_pp: | |
67 | rcall dram_read | |
68 | adiw x,1 | |
69 | push temp | |
70 | rcall dram_read | |
71 | adiw x,1 | |
72 | mov temp2,temp | |
73 | pop temp | |
74 | ret | |
75 | ||
76 | dram_read_pp: | |
77 | rcall dram_read | |
78 | adiw x,1 | |
79 | ret | |
80 | ||
81 | ; ------------------------------------------------------------------- | |
82 | ||
83 | dram_writew_pp: | |
84 | rcall dram_write | |
85 | adiw x,1 | |
86 | mov temp,temp2 | |
87 | dram_write_pp: | |
88 | rcall dram_write | |
89 | adiw x,1 | |
90 | ret | |
91 | ||
92 | ||
93 | ; ------------------------------------------------------------------- | |
94 | ; vim:set ts=8 noet nowrap | |
9c15f366 | 95 |