Elektronika MK-90 cartridge memory map (BASIC V1.0)
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
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 |
| 0 | 1 |
Attribute |
| 1 | 2 |
File name (2 groups of 3 characters), padded with blanks |
| 3 | 1 |
File name extension (group of 3 characters), default is BAS |
| 4 | 1 |
Count 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 |
| 5 | 1 |
Unknown |
| 6 | 1 |
Unknown |
| Code |
Meaning |
| 0x0200 |
Deleted or free directory entry |
| 0x0400 |
Occupied directory entry |
| 0x0800 |
End of the directory |
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:
- CIR - character codes: 3, 9, 18
40*40*3 + 40*9 + 18 = 5178 = 0x143A
- CLE - character codes: 3, 12, 5
40*40*3 + 40*12 + 5 = 5285 = 0x14A5
- 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).
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.