﻿---------------------------------------------
Specialist Home PC general info (basic configuration)
---------------------------------------------
1.Hardware info

CPU - i8080A
RAM - 48kB 
RAM area: 0000 - BFFFh
ROM - 4kB (2..14kB)
ROM area: C000 - EFFFh (F7FFh)
IO: one or two i8255A
IO area: F000 - FFFFh (F800 - FFFFh)*
* usually i8255A is selected with same decoder used
for ROM, thus, it maps on 2kb space. many optimized
modifications has additional decoder to reduce IO
area to 256 bytes, where space per IO is 32 bytes
only.
---------------------------------------------
2.Video info

video: 384x256x1
video memory: 9000 - BFFFh

byte video memory organisation:

9000 - 9100 - .. - BE00 - BF00
9001 - 9101 - .. - BE01 - BF01
 ..  -  ..  - .. -  ..  -  ..
90FE - 91FE - .. - BEFE - BFFE
90FF - 91FF - .. - BEFF - BFFF

each byte is represent on the screen in this direction:

bits: |7|6|5|4|3|2|1|0|

scanning video memory provides transparent refresh
of the DRAM and does not depend on CPU status or program
execution.

Text output provided in 6x8 modes (64 chars per line) and
in 8x8 modes (48 chars per line). 64 chars per line is fairly
slow because 3 of 4 chars in every line are splitted between two
columns of bytes, but gives more info on the screen.

some modifiations had additional write-only ram to set colour
for each byte (4 or 8 colours for "white" dots)
---------------------------------------------
3.Computer boot 

After reset rom/io area (C000 - FFFF) is accesible at
any 16kB area due to boot mapping by boot selector. Boot
selector is turning off when keyboard IO i8255A is initialized.
Thus before init i8255A a jump provided to set proper current address
(C...h), usually, it is "JMP C003h" in the begin of the boot rom.

Putting "1" into PC4 of i8255 enables boot selector again, to
avoid this somebody set there additional RS flip-flop with SN7400 -
this also is making PC4 free for custom usage.
---------------------------------------------
4.ROM data

Usually ROM consists of two 2kb ROMs - "Loader" and "Monitor"
Original PC had only "Loader" ROM, "Monitor" was added later.
"Loader" and "Monitor" often have slight modifications, differ
them from the versions printed in the magazine.

"Loader" provides computer init and after boot waits for the signal
from the tape, if met - loads and executes program. It can be 
aborted with pressing any key of the top keyboard row, pressing
"Enter" then provides jump to C800h. "Loader" has 5x7 KOI-7 font
for the 20h - 7Fh range, and has some usefull procedures:
- clear the screen
- print char to screen (6x8 - 64 lines per char)
- get key
- beep
- save byte to the tape
- load byte from the tape
Most usual modification of the loader - immediate jump to C800h
after PC init (skipping booting from the tape).

"Monitor" provides simple user interface with commandline and has
a jump table at the start, partially compatible with Radio-86RK PC
(shifted from F8XXh to C8XXh area). Jump table has jumps into the
"Loader" functions as well as jumps into additional functions in
the "Monitor".
---------------------------------------------
5.IO pins description (main i8255A)

PA0 - PA7,PC0 - PC3: keyboard columns
PB2 - PB7: keyboard rows
PB0 - tape in
PB1 - shift key
PC4 - boot selector control
PC5 - sound out
PC6 - free
PC7 - tape out
---------------------------------------------
6.Keyboard

   F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC
   ;+ 1! 2" 3# 4$ 5% 6& 7' 8( 9) 0  -=
   ЙJ ЦC УU КK ЕE НN ГG Ш[ Щ] ЗZ ХH :*
   ФF ЫY ВW АA ПP РR ОO ЛL ДD ЖV Э\ .>
   ЯQ Ч^ СS МM ИI ТT ЬX БB Ю@ ,< /? ЗБ
НР НФ HM UP DN       SP LF ПВ RT ПС ВК

F1..F9 - various meaning
FA - white background
FB - black background
FC (СТР) - clear screen *
ЗБ - delete **
НР - "shift"
НФ (НРФ) - "rus/lat" ("fixed shift")
HM - home arrow
UP - up arrow
DN - down arrow
SP - space
LF - left arrow
ПВ - repeat ***
RT - right arrow
ПС - line feed
ВК - carriage return ("enter")

* СТР (clear screen) is often used as "escape" key
to exit program etc.
** Most keyboard input procedures uses left arrow
to delete last character.
*** Basic keyboard input routine had no autorepeat
after delay if key is not released. Instead of this
ПВ (repeat) key been used to provide repeating key
enter.
---------------------------------------------
7.Basic commands of the Monitor

Important: all numbers are hex, no spaces allowed,
    wrong char may be deleted with left arrow key,
    omited values will be set to zero.

D[start][,end] - dump (hex)
L[start][,end] - dump (chars)

- it is possible to pause it with СТР key, and then
or stop with pressing СТР again, either continue
with any other key. 
-----------
G[start] - run program

- if program is not altering stack it can return to Monitor
with simple ret, otherwise jump to C800h is recomended.
-----------
K[start][,end] - checksum of the block
T[start][,end][,new start] - copy block from start to new
	        start (do not do it if "new start" < "end")
F[start][,end][,const] - fill memory with constant
N[start][,end][,const] - compare memory with constant
M[addr] - modify memory (press down arrow to jump to the next byte)
H[value1][,value2] - hex add and subtract
C[start][,end][,start1] - compares two memory locations
S[start][,end][,byte1][,byte2][,byte3][,byte4]
	- searches memory for the sequence of 1-4 bytes
---------------------------------------------
8.General API and software memory map

C010 - clear screen (colour - word at 8FFA)
C170 - beep (8FF1 - tone, 8FF2 - length)
C803 - wait for the keypress (A - key code)
C809 - put char to the screen (C - char, 8FE7 - (word)font_adr/8)
C80C - send byte to tape
C80F - input string from the keyboard (HL - start, DE - end of buffer)
C812 - get preesed key without wait (A: code, or FF - not pressed)
C815 - print A to the screen in hex format
C818 - output zero terminated string (HL - pstr)
C81E - get current cursor position (H - hor., L - vert.)

RAM from 0000 till 8FFFh is using for programs. Usualy Loader and Monitor
set top of the stack at 7FFFh, thus, program has to be slightly less then
32kb to not be damaged while return to Monitor, or possible to be loaded 
from the tape (somebody used stack overwriting for tricks). Memory starting
from 8000h is also freely available, but at the end of 8...h block variables
of the Loader and Monitor are situated, thus, usage of the memory 8A00h and
up is not recomended. Some of these issues can be fixed with using different
Loader and Monitor etc.
---------------------------------------------





