Skip to content

Commit e35a13f

Browse files
author
Mike Stirling
committed
Swapped DFS ROM to original Acorn version and added two composite ROM images, one with real DFS and one with MMBEEB ROM. Re-registered a few signals to help meet timing (still not quite there).
1 parent f35c061 commit e35a13f

File tree

3 files changed

+48
-63
lines changed

3 files changed

+48
-63
lines changed

bbc_micro_de1.vhd

+2-2
Original file line numberDiff line numberDiff line change
@@ -1114,8 +1114,8 @@ begin
11141114
FL_ADDR(15 downto 14) <=
11151115
"00" when mos_enable = '1' else
11161116
"01" when rom_enable = '1' and romsel(1 downto 0) = "11" else -- BASIC
1117-
"10" when rom_enable = '1' and romsel(1 downto 0) = "00" else -- DFS
1118-
"11"; -- MMC ROM
1117+
"10" when rom_enable = '1' and romsel(1 downto 0) = "00" else -- DFS/MMC
1118+
"11"; -- Spare
11191119

11201120
-- SRAM bus
11211121
SRAM_UB_N <= '1';

saa5050.vhd

+36-59
Original file line numberDiff line numberDiff line change
@@ -60,20 +60,22 @@ component saa5050_rom IS
6060
);
6161
end component;
6262

63-
-- Data input registered in the bus clock domain
63+
-- Register inputs in the bus clock domain
6464
signal di_r : std_logic_vector(6 downto 0);
65+
signal dew_r : std_logic;
66+
signal lose_r : std_logic;
6567
-- Data input registered in the pixel clock domain
6668
signal code : std_logic_vector(6 downto 0);
6769
signal line_addr : unsigned(3 downto 0);
6870
signal rom_address : std_logic_vector(11 downto 0);
6971
signal rom_data : std_logic_vector(7 downto 0);
7072

71-
-- Latched timing signals for detection of falling edges
72-
signal dew_r : std_logic;
73-
signal lose_r : std_logic;
7473
-- Delayed display enable derived from LOSE by delaying for one character
7574
signal disp_enable : std_logic;
76-
signal disp_enable_r : std_logic;
75+
-- Latched timing signals for detection of falling edges
76+
signal dew_latch : std_logic;
77+
signal lose_latch : std_logic;
78+
signal disp_enable_latch : std_logic;
7779

7880
-- Row and column addressing is handled externally. We just need to
7981
-- keep track of which of the 10 lines we are on within the character...
@@ -116,13 +118,17 @@ begin
116118
-- Generate flash signal for 3:1 ratio
117119
flash <= flash_counter(5) and flash_counter(4);
118120

119-
-- Sync data input
121+
-- Sync inputs
120122
process(DI_CLOCK,nRESET)
121123
begin
122124
if nRESET = '0' then
123125
di_r <= (others => '0');
126+
dew_r <= '0';
127+
lose_r <= '0';
124128
elsif rising_edge(DI_CLOCK) and DI_CLKEN = '1' then
125129
di_r <= DI;
130+
dew_r <= DEW;
131+
lose_r <= LOSE;
126132
end if;
127133
end process;
128134

@@ -145,88 +151,59 @@ begin
145151
rom_address <= (others => '0') when (double_high = '0' and double_high2 = '1') else
146152
gfx & code & std_logic_vector(line_addr);
147153

148-
-- process(CLOCK,nRESET)
149-
-- variable line_addr : unsigned(3 downto 0);
150-
-- variable c : std_logic_vector(6 downto 0);
151-
-- begin
152-
-- -- Derive line address taking double height into account
153-
-- if double_high = '1' then
154-
-- line_addr := "0" & line_counter(3 downto 1);
155-
-- if double_high2 = '1' then
156-
-- line_addr := line_addr + 5;
157-
-- end if;
158-
-- else
159-
-- line_addr := line_counter;
160-
-- end if;
161-
--
162-
-- -- If this is the second row of a double height pair and double_high
163-
-- -- is not asserted then we fetch a blank instead (0)
164-
-- if double_high = '0' and double_high2 = '1' then
165-
-- c := (others => '0');
166-
-- else
167-
-- c := di_r;
168-
-- end if;
169-
--
170-
-- if nRESET = '0' then
171-
-- rom_address <= (others => '0');
172-
-- elsif rising_edge(CLOCK) and CLKEN = '1' then
173-
-- rom_address <= gfx & c & std_logic_vector(line_addr);
174-
-- end if;
175-
-- end process;
176-
177154
-- Character row and pixel counters
178155
process(CLOCK,nRESET)
179156
begin
180157
if nRESET = '0' then
181-
dew_r <= '0';
182-
lose_r <= '0';
158+
dew_latch <= '0';
159+
lose_latch <= '0';
183160
disp_enable <= '0';
184-
disp_enable_r <= '0';
161+
disp_enable_latch <= '0';
185162
double_high1 <= '0';
186163
double_high2 <= '0';
187164
line_counter <= (others => '0');
188165
pixel_counter <= (others => '0');
189166
flash_counter <= (others => '0');
190167
elsif rising_edge(CLOCK) and CLKEN = '1' then
191168
-- Register syncs for edge detection
192-
dew_r <= DEW;
193-
lose_r <= LOSE;
194-
disp_enable_r <= disp_enable;
169+
dew_latch <= dew_r;
170+
lose_latch <= lose_r;
171+
disp_enable_latch <= disp_enable;
195172

196173
-- When first entering double-height mode start on top row
197174
if double_high = '1' and double_high1 = '0' and double_high2 = '0' then
198175
double_high1 <= '1';
199176
end if;
200177

178+
-- Count pixels between 0 and 5
179+
if pixel_counter = 5 then
180+
-- Start of next character and delayed display enable
181+
pixel_counter <= (others => '0');
182+
disp_enable <= lose_latch;
183+
else
184+
pixel_counter <= pixel_counter + 1;
185+
end if;
186+
201187
-- Rising edge of LOSE is the start of the active line
202-
if LOSE = '1' and lose_r = '0' then
188+
if lose_r = '1' and lose_latch = '0' then
203189
-- Reset pixel counter - small offset to make the output
204190
-- line up with the cursor from the video ULA
205-
pixel_counter <= "010";
206-
else
207-
-- Count pixels between 0 and 5
208-
if pixel_counter = 5 then
209-
-- Start of next character and delayed display enable
210-
pixel_counter <= (others => '0');
211-
disp_enable <= lose_r;
212-
else
213-
pixel_counter <= pixel_counter + 1;
214-
end if;
191+
pixel_counter <= "011";
192+
end if;
193+
194+
-- Count frames on end of VSYNC (falling edge of DEW)
195+
if dew_r = '0' and dew_latch = '1' then
196+
flash_counter <= flash_counter + 1;
215197
end if;
216198

217-
if DEW = '1' then
199+
if dew_r = '1' then
218200
-- Reset line counter and double height state during VSYNC
219201
line_counter <= (others => '0');
220202
double_high1 <= '0';
221203
double_high2 <= '0';
222204
else
223-
-- Count frames on end of VSYNC (falling edge of DEW)
224-
if DEW = '0' and dew_r = '1' then
225-
flash_counter <= flash_counter + 1;
226-
end if;
227-
228205
-- Count lines on end of active video (falling edge of disp_enable)
229-
if disp_enable = '0' and disp_enable_r = '1' then
206+
if disp_enable = '0' and disp_enable_latch = '1' then
230207
if line_counter = 9 then
231208
line_counter <= (others => '0');
232209

sn76489-1.0/sn76489_top.vhd

+10-2
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,15 @@ begin
196196
noise_o => noise_s
197197
);
198198

199-
200-
aout_o <= tone1_s + tone2_s + tone3_s + noise_s;
199+
200+
-- Register output
201+
process(clock_i)
202+
begin
203+
if res_n_i = '0' then
204+
aout_o <= (others => '0');
205+
elsif rising_edge(clock_i) then
206+
aout_o <= tone1_s + tone2_s + tone3_s + noise_s;
207+
end if;
208+
end process;
201209

202210
end struct;

0 commit comments

Comments
 (0)