# HG changeset patch # User Paul Boddie # Date 1391274246 -3600 # Node ID 83648f6e7be702447b702cd0c776efd909574c6d # Parent c267a20fd61edc3101f00bd9aa2b1649fac3564c# Parent 6363b9a428654043a5936362bb0d9d685c1aca83 Merged general changes. diff -r c267a20fd61e -r 83648f6e7be7 Electron.txt --- a/Electron.txt Sat Feb 01 18:01:55 2014 +0100 +++ b/Electron.txt Sat Feb 01 18:04:06 2014 +0100 @@ -59,11 +59,20 @@ possible to just "borrow" one of the chips in order to isolate 8K of RAM for direct access by the CPU. +Being able to disable the ULA's access to RAM for a period of time while also +disabling the video signal, effectively achieving the same as blanking the +palette, would be a very simple but useful enhancement that would speed up +programs needing to render large amounts of non-real-time content to the +screen. + Improving Display Capabilities ------------------------------ Perhaps the simplest improvement to the display capabilities would be to -permit the RGB output levels to "float" between the current TTL high and low -states, presumably enforced by various circuits. This would permit the choice -of colours beyond the primary and secondary colour selection at a cost of some -extra palette bits in the ULA and an adjustment to the board circuitry. +permit the RGB output levels to hold intermediate values between the current +high and low states, presumably enforced by various circuits. This would +permit the choice of colours beyond the primary and secondary colour selection +at a cost of some extra palette bits in the ULA and an adjustment to the board +circuitry and would only benefit UHF and colour composite video displays, but +the latter limitation might not be a significant issue for the majority of the +intended audience. diff -r c267a20fd61e -r 83648f6e7be7 ULA.txt --- a/ULA.txt Sat Feb 01 18:01:55 2014 +0100 +++ b/ULA.txt Sat Feb 01 18:04:06 2014 +0100 @@ -45,16 +45,21 @@ 16 MHz cycle: 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 ... ~RAS: 0 1 0 1 ... ~CAS: 0 1 0 1 0 1 0 1 ... - A B B A B B ... + A B C A B C ... F S F S ... - a b b a b b ... + a b c a b c ... -Here, "A" indicates the row and column addresses being latched into the RAM -(on a negative edge for ~RAS and ~CAS respectively), and "B" indicates the -second column address being latched into the RAM. Presumably, the first and -second half-bytes can be read at "F" and "S" respectively, and the row and -column addresses must be made available at "a" and "b" respectively at the -latest. +Here, "A" and "B" respectively indicate the row and first column addresses +being latched into the RAM (on a negative edge for ~RAS and ~CAS +respectively), and "C" indicates the second column address being latched into +the RAM. Presumably, the first and second half-bytes can be read at "F" and +"S" respectively, and the row and column addresses must be made available at +"a" and "b" (and "c") respectively at the latest. + +The TM4164EC4-15 has a row address access time of 150ns (maximum) and a column +address access time of 90ns (maximum), which appears to mean that +approximately two 16MHz cycles after the row address is latched, and one and a +half cycles after the column address is latched, the data becomes available. Note that the Service Manual refers to the negative edge of RAS and CAS, but the datasheet for the similar TM4164EC4 product shows latching on the negative @@ -143,8 +148,13 @@ RAM Integrated Circuits ----------------------- +Unicorn Electronics appears to offer 4164 RAM chips (as well as 6502 series +CPUs such as the 6502, 6502A, 6502B and 65C02). These 4164 devices are +available in 100ns (4164-100), 120ns (4164-120) and 150ns (4164-150) variants, +have 16 pins and address 65536 bits through a 1-bit wide channel. + The documentation for the Electron mentions 4164-15 RAM chips for IC4-7, and -the Samsung-produced KM4164 series is apparently equivalent to the Texas +the Samsung-produced KM41464 series is apparently equivalent to the Texas Instruments 4164 chips presumably used in the Electron. The TM4164EC4 series combines 4 64K x 1b units into a single package and @@ -172,8 +182,18 @@ the Samsung KM41464A-15 and NEC µPD41464 employ 18 pins, eliminating 4 pins by employing 4 pins for both input and output. + Pins I/O pins Row access Column access + ---- -------- ---------- ------------- +TM4164EC4 22 4 + 4 150ns (15) 90ns (15) +KM41464AP 18 4 150ns (15) 75ns (15) +NTE21256 16 1 + 1 150ns 75ns +HYB 4164-2 16 1 + 1 150ns 100ns +µPD41464 18 4 120ns (12) 60ns (12) + See: TM4164EC4 65,536 by 4-Bit Dynamic RAM Module http://www.datasheetarchive.com/dl/Datasheets-112/DSAP0051030.pdf +See: Dynamic RAMS + http://www.unicornelectronics.com/IC/DYNAMIC.html See: KM4164B 64K x 1 Bit Dynamic RAM with Page Mode http://images.ihscontent.net/vipimages/VipMasterIC/IC/SAMS/SAMSD020/SAMSD020-45.pdf See: NTE2164 Integrated Circuit 65,536 X 1 Bit Dynamic Random Access Memory @@ -370,7 +390,10 @@ blue outputs or a combined intensity output), another approach might involve some kind of modulation where an output value might be encoded in multiple pulses at a higher frequency than the pixel frequency. However, this would -demand additional circuitry outside the ULA. +demand additional circuitry outside the ULA, and component RGB monitors would +probably not be able to take advantage of this feature; only UHF and composite +video devices (the latter with the composite video colour support enabled on +the Electron's circuit board) would potentially benefit. Flashing Colours ---------------- @@ -484,7 +507,27 @@ This function is reminiscent of a capability of the ZX81, albeit necessary on that hardware to reduce the load on the system CPU which was responsible for -producing the video output. +producing the video output. By allowing display suspend on the Electron, the +performance benefit would be derived from giving the CPU full access to the +memory bandwidth. + +Enhancement: Memory Filling +--------------------------- + +A capability that could be given to an enhanced ULA is that of permitting the +ULA to write to screen memory as well being able to read from it. Although +such a capability would probably not be useful in conjunction with the +existing read operations when producing a screen display, and insufficient +bandwidth would exist to do so in high-bandwidth screen modes anyway, the +capability could be offered during a display suspend period (as described +above), permitting a more efficient mechanism to rapidly fill memory with a +predetermined value. + +This capability could also support block filling, where the limits of the +filled memory would be defined by the position and size of a screen area, +although this would demand the provision of additional registers in the ULA to +retain the details of such areas and additional logic to control the fill +operation. Enhancement: Hardware Sprites ----------------------------- diff -r c267a20fd61e -r 83648f6e7be7 ula.py --- a/ula.py Sat Feb 01 18:01:55 2014 +0100 +++ b/ula.py Sat Feb 01 18:04:06 2014 +0100 @@ -126,6 +126,33 @@ self.memory[i << 1] = value >> 4 self.memory[i << 1 | 0x1] = value & 0xf +class ShiftRegister: + + """ + A class representing a shift register, used for the internal state of the + ULA within each 2MHz period. + """ + + def __init__(self): + self.state = [0] * 8 + self.input = 0 + + def set_input(self, input): + self.input = input + + def shift(self): + + # NOTE: This is not meant to be "nice" Python, but instead models the + # NOTE: propagation of state through the latches. + + self.state[0], self.state[1], self.state[2], self.state[3], \ + self.state[4], self.state[5], self.state[6], self.state[7] = \ + self.input, self.state[0], self.state[1], self.state[2], \ + self.state[3], self.state[4], self.state[5], self.state[6] + + def __getitem__(self, i): + return self.state[i] + class ULA: """ @@ -173,13 +200,16 @@ # Internal state. - self.cycle = [0]*8 # counter within each 2MHz period represented by 8 latches self.access = 0 # counter used to determine whether a byte needs reading self.have_pixels = 0 # whether pixel data has been read self.writing_pixels = 0 # whether pixel data can be written self.buffer = [BLANK]*8 # pixel buffer for decoded RAM data - self.cycle[7] = 1 # assert the final latch (asserting the first on update) + self.cycle = ShiftRegister() # 8-state counter within each 2MHz period + + self.cycle.set_input(1) # assert the input to set the first state output + self.cycle.shift() + self.cycle.set_input(0) # reset the input since only one state output will be active self.reset_vertical() @@ -323,15 +353,6 @@ access_ram = not self.nmi and self.access == 0 and self.read_pixels() and not self.ssub - # Update the state of the device. - # NOTE: This is not meant to be "nice" Python, but instead models the - # NOTE: propagation of state through the latches. - - self.cycle[0], self.cycle[1], self.cycle[2], self.cycle[3], \ - self.cycle[4], self.cycle[5], self.cycle[6], self.cycle[7] = \ - self.cycle[7], self.cycle[0], self.cycle[1], self.cycle[2], \ - self.cycle[3], self.cycle[4], self.cycle[5], self.cycle[6] - # Set row address (for ULA access only). if self.cycle[0]: @@ -434,6 +455,11 @@ self.access = (self.access + 1) % self.access_frequency + # Update the state of the device. + + self.cycle.set_input(self.cycle[7]) + self.cycle.shift() + # Video signalling.