agat-web

СМ6337

The printer as emulated, and where each detail came from. src/sm6337.js runs the factory firmware on an emulated КР580ВМ80А and turns the board’s outputs into a carriage position, a paper position and needles struck.

node tools/check.js sm6337                    # what the manuals say it does, asserted
node tools/sm6337.js --text 'Hello\r\n'       # print it, draw tmp/sm6337.png
node tools/sm6337.js --key ТЕСТ               # the switch report, its own oracle
node tools/cputest8080.js                     # the 8080, against four test programs

check.js sm6337 is the one to run after a change.

Sources

All from oldpc.su/pc/sm/sm6337, and all scans with no text layer: every § and табл. cited here was read off the image, so a disagreement with the code is as likely to be a misreading as a bug.

The models

  paper interfaces firmware
СМ6337 A3 ИРПР-М, Стык С2 D27 D28 D29
СМ6337.06 A3 ИРПР-М 015М, 015-01М, and the same D29
СМ6337.02 A4 ИРПР-М, Стык С2  
СМ6337.03 A4 ИРПР-М  

The D27-D29 set serves both widths: bit 0 of port $80 is a jumper, the firmware takes a line of $0750 steps with it and $03C0 without, and its self-test signs itself СМ6337.02 without.

The control board, БЦУ-1

КР580ВМ80А at 2 MHz from a КР580ГФ24; Ф2ТТЛ clocks the timers too, so a T-state is a timer clock, 0.5 µs.

   
$0000-$5FFF ROM. $3000 is the 9×11 font, 12 bytes a character; D29 is the 18×23 one
$6000-$77FF RAM, three К537РУ10: receive buffer at $6000, line buffer at $7000, variables at $7400, stack from $7800
port    
$40 $41 w КР580ИР82, needles 1-8, D7 the top one, low strikes. The write is СТР.ПЕЧ, the fire strobe. The address bit is needle 9
$48 $49   КР580ВВ51А, Стык С2
$50-$53   КР580ВИ53 D17: 0 counts steps, 1 is the dot clock, 2 the step rate
$58-$5B   КР580ВИ53 D24: 0 baud rate, 1 bell pitch, 2 bell length
$78 $79   КР580ВН59, CALL table at $2E00
$80 r bit 0 the A3 jumper, 1 paper present, 2 left sensor, 3 /STROBE held
$80-$83 w ВМА0 = A0 carriage direction, ВМА1 = A1 paper direction
$84-$87 r DIP switches: A0 reads S6, A1 reads S5
$84 w ШАГ2, one paper step
$88 r / w the ИРПР-М byte, and its acknowledge / clear a head fault
$8C r / w keys ПС ПФ ТЕСТ КР, low when down / “управление длинной строки”
$9C-$9F w “резерв” in the РЭ; $9D as the carriage ramps up, $9C at speed
$AC-$AF w lamps: A0 low lights АВР, A1 low lights КР
$BC-$BF w A0 lets the step rate through to ШАГ1

The groups from $80 up that are write-only latch address lines, not data: D25 is a К155ТМ7 with MA0, MA1 on its inputs. The firmware never loads A before those OUTs.

   
IR0 head fault, АВР.ПГ
IR1 SD1, the left sensor
IR2 D17 OUT0: the step count ran out
IR3 D17 OUT1 inverted (D7.3): the next dot column
IR4 a key
IR5 an ИРПР-М byte
IR6 a serial byte

РЭ §8.1’s prose has IR2 and IR3 the other way round; рис. 8.1 and the firmware agree with each other. The inverter on OUT1 is not decoration: on the other edge every line after the first starts with a stray glyph, because the IR3 handler stops the dot clock itself and the stop has to land between requests.

Inches, in millimetres

Every pitch in the manuals is metric and every one of them is an inch fraction: 2,54 mm is 1/10”, 2,117 mm is 1/12”, the 4,23 mm line is 1/6”, and АР2 A n steps “n x 0,353 mm”, which is n/72”. The mechanism is built to the inch and the documentation converts — the command set is Epson’s, and so is the geometry under it. The step sizes here are named in inches because the ratios are exact that way and ugly in millimetres.

The mechanism

Two four-phase 1.8° steppers, ДШИ-200-1-2. Phase switching is a counter and a PROM per motor on the БУМП-1 (РЭ §8.4.4, §8.4.6), so the firmware sends a direction and pulses and nothing else.

On the Agat’s cable

printer=sm6337 puts this printer on the printer card’s cable (SM6337.Cable), the wide machine with the A3 jumper fitted. It runs on the Agat’s clock: before every access to the card, and once a frame, it is run up to the Agat’s cycle at 2 MHz against CPU_HZ. /STROBE falling is a byte exactly when the capture counts one, and BUSY is the firmware’s D5.1. The cable carries no INIT, so resetting the Agat does not reset the printer. The printer, its paper included, carries over when the machine is rebuilt. A snapshot does not hold the printer’s state: a restored machine finds the printer as it was left.

check.js printer runs the factory’s ТЕСТ ‘ПЕЧАТЬ’ into it: the bytes are the golden ones and the sheet has the test’s five lines on it.

Measured

check.js sm6337 asserts all of this; it is 25 checks and about a minute.

Not settled