ZX80 развертка изображения
Ради интереса захотелось посмотреть как работал предшественник спектрума - ZX80. Нашел пзу (тут дизасм), загрузил в эмулятор, стал разбираться как формируется изображение. Оказалось в ZX80 используется какой-то весьма нетривиальный хитрый хак с формированием изображения.
Ктото разбирался как это работает? Где можно найти описание?
Из того что понял - изображение формируется Z80 на лету, прерывание как понял срабатывает в начале каждой строки развертки, в регистр I загружается 0x0e - это как я понял начало знакогенератора, далее происходит чтото хитрое, фрагмент кода из дизасма:
Код:
; --------------------------------
; THE 'MASKABLE INTERRUPT' ROUTINE
; --------------------------------
; Note. the maskable interrupt is concerned with generating the TV picture,
; one of the main tasks in the ZX80. This requires some understanding of
; how the video hardware interacts with the system and part of the process
; is to present to the Z80 chip a phantom display file in the upper
; unpopulated 32K of memory. This topsy-turvy display file
; executes characters like "HELLO WORLD" as NOP instructions but recognizes
; a newline ($76) as a true HALT instruction.
; The video hardware sniffs the databus and grabs the data as it flies by
; sending it on to the shifting circuits. The I register permanently holds
; $0E. The video circuitry uses this register and the lower six bits of the
; character to index into the character set bitmaps at the end of this ROM,
; at $0E00, and so cobble together a scan-line.
; If bit 7 of the character latch is set, then the serial video data is
; inverted so that any character in the range 127-191 appears as the inverse
; of normal characters 0 - 63.
; For a proper explanation of this system, I recommend Wilf Rigter's
; online documentation, available from several indexed sites.
; I have borrowed a few comments from that file to remind myself of what
; is happening. I have indicated where the Z80 instructions should be
; read in conjunction with Wilf's file by using a double semi-colon.
; On entry, B holds the line number and C the number of the scanline.
; JP (HL)
; ¦
; INT HSync ¦HALT INT HSync
; ¦ ¦ ¦¦ ¦ ¦
; _¦________¦ ________________________________________________________________¦________¦
; ¦ |____| ¦ |__
; ¦ ¦ ¦ ¦
; ¦ 13 ¦ 4 ¦ 20 ¦ 34 ¦ 136 = 34 * 4 ¦ 13 ¦ 4 ¦
; ¦\__/ \__¦__________/ \_______________________________________________________/¦\__/ \__¦__
; INT INT Routine 34 columns ¦
; Response ¦ ¦
; ¦ ¦
; ¦\____________________________________________________________________________/¦
; 207
;; MASK-INT
L0038: DEC C ;; decrement the scan line counter in register C.
JP NZ,L0045 ;; JUMP to SCAN-LINE : repeats 8 times for each
;; row of characters in DFILE.
POP HL ;; point to the start of next DFILE row
DEC B ;; decrement ROW counter
RET Z ;; return if zero to
SET 3,C ;; load scan line counter with 08 was 00.
;; WAIT-INT
L0041: LD R,A ;; load refresh register with value $DD.
EI ;; enable interrupts.
JP (HL) ;; jump to execute the NOPs in DFILE
;; terminated by a NEWLINE/HALT instruction.
; ---
;; SCAN-LINE
L0045: POP DE ;; discard return address.
RET Z ;; delay (Zero never set)
JR L0041 ;; back to WAIT-INT above
В hl обычно 0x7848, при джампе на этот адрес, как я понял должен читаться NOP и загружаться сдвиговый регистр значением из знакогенератора, правда откуда не совсем ясно - вроде бы адрес както получается с шин Z80. По окончании строки процессору как я понял выдается опкод 0x76 (HALT) и таким образом он ожидает следующую строку.
Ктото может подсказать как это работало? :v2_dizzy_stupid:
А именно - правильно ли я понял вышесказанное и как происходит формирование адреса для чтения значения в сдвиговый регистр для формирования сканлайна?
Вот тут нашел схему ZX80 - удивительно небольшая: https://github.com/TankedThomas/ZX80
Правда как работает видеоразвертка из неё мне пока не понятно.