Index wersja polskawersja polska

Elektronika MK-90 cartridge memory map (BASIC V1.0)

UPDATE: The data structures appear to be compatible with the RT-11 file system.

Address range Contents
0x0000-0x03FF Loader area
0x0400-0x07FF Directory area
0x0800-0x27FF Data area

Loader

The MK-90 start menu gives you three options: BASIC, SMP0, SMP1. Selecting SMP0 (or SMP1) causes the calculator to read the loader code from the cartridge 0 (or cartridge 1) and execute it. Cartridges formatted with INIT contain code displaying message which means "cartridge without loader":

000000: nop
000002: jsr     r7, @#153700
000006: jsr     r7, @#120536
000012: mov     @#034022, @#164000
000020: mov     #104306, @#164002
000026: jsr     r0, 000062
000032: .asciz  "\016\r\n smp BEZ ZAGRUZ^IKA"
000061: .even
000062: movb    (r0)+, r2
000064: beq     000064
000066: jsr     r7, @#116542
000072: br      000062

Directory organisation

Hex dump of an example directory (file MK90.BIN in the mk90prog.zip archive):

0400: 01 00 00 00 01 00 00 00 04 00
040A: 00 02 EA 27 00 00 BB 0C 01 00 00 00 36 89  ;1st directory entry
0418: 00 04 3A 14 A5 14 BB 0C 01 00 00 00 36 89  ;2nd directory entry
0426: 00 04 9B 54 B8 38 BB 0C 01 00 00 00 36 89  ;3rd directory entry
0434: 00 02 20 20 20 20 20 20 0D 00 20 20 20 20  ;4th directory entry
0442: 00 08

Each directory entry occupies 7 words (=14 bytes). Bytes in a word are arranged in "little-endian" order (the least significant byte first).

Directory entry layout

Offset Size Contents
01 Attribute
12 File name (2 groups of 3 characters), padded with blanks
31 File name extension (group of 3 characters), default is BAS
41 Number of blocks (sectors) assigned to the directory entry. The sum of these words for all directory entries must be equal 16.
0x0001 + 0x0001 + 0x0001 + 0x000D = 16
51 Unknown
61 Unknown

Directory entry attribute

Code Meaning
0x0200 Deleted or free directory entry
0x0400 Occupied directory entry
0x0800 End of the directory

File name encoding

The file names and extensions are stored in compressed form - 3 characters in 2 bytes.

Character codes (decimal)
Code Char.
0
1
2
3
4
5
6
7
8
9
blank
A
B
C
D
E
F
G
H
I
Code Char.
10
11
12
13
14
15
16
17
18
19
J
K
L
M
N
O
P
Q
R
S
Code Char.
20
21
22
23
24
25
26
27
28
29
T
U
V
W
X
Y
Z
$
.
/
Code Char.
30
31
32
33
34
35
36
37
38
39
0
1
2
3
4
5
6
7
8
9

For example, the second directory entry at address 0x0418 contains the file name CIRCLE.BAS. Each group of three characters is encoded following way:

  1. CIR - character codes: 3, 9, 18
    40*40*3 + 40*9 + 18 = 5178 = 0x143A
  2. CLE - character codes: 3, 12, 5
    40*40*3 + 40*12 + 5 = 5285 = 0x14A5
  3. BAS - character codes: 2, 1, 19
    40*40*2 + 40*1 + 19 = 3259 = 0x0CBB

These words can be found at address 0x041A to 0x041F.
This encoding scheme can be considered as numbers in base 40. It's also known as Radix-50 (thanks to Alec Voropay for spotting this).


Data area

The data area consists of 16 blocks (sectors) of 512 bytes each. Programs are stored in plain ASCII (the keywords aren't tokenised). They begin with an empty line (CR,LF sequence) and are terminated with an end marker 0x00.

The system doesn't support fragmented files, i.e. requires a contiguous group of free memory blocks of sufficient size to store the file.