Optron #21
27 ноября 1998

Coding - The test of memory available. Manage memory banks. Adapting programs for Miko.

<b>Coding</b> - The test of memory available. Manage memory banks. Adapting programs for Miko.

       Miko-Best: a STS'om in the hands of

Ivan Buhay, 1998


  In this article we have with you, dear readers "OPTRON", 
inspired by Joan Scalp, try to find out more

with pathogenic phenomenon known as "Miko-Best 256kB". 
(Immediately, I note that "-Best" - this is probably a 
terminological error. It would be "Miko-Suxx". How else to 
explain the relationship manufacturers to the child: no 
information to support or programs.) 

  Although this phenomenon has already been covered (see
Rooms 7 and 8 "Optron"), the question requires
further study.



     For a start - a small clarification


  I have a Miko-Best 256kB v1.5 with
two modifications:

  - OUT (# FD), A - works fine (treated pereshivaniem ROM, 
performed on RT4, these things were doing at the firm Miko);


  - Switch Miko-Pentagon (these things did
Rasp, he was inordinately blagodaren).



       And now - the smallness of demagogy

         (Or my assumptions)


  ROM 64Kb, it:


              1 Manager

              2 TR-DOS 5.03

              3 Basic 128

              4 Basic 1948


  At startup or reset, control passes to the Manager, is blocked
Magic, interviewed key "R" and "T".

  "R" - run a full memory test.

  "T" - teletest: test content
# DB00 in the bank # 0D. If it is not equal
# AA55, it is a test AY, Printer, Memory, and
with his success, exits the menu.

  Otherwise, check that you have pressed
gap. If yes, Miko Basic (48-th and
128-s) runs from ROM. If not pressed, the
Miko Basic reloaded into RAM - the bank # 0C
The 128 th and # 0E to 48 th. These banks
forbidden to write, and they are projected to
address # 0000.



          Let us get to the point


  Management of computer resources through the port # DC:

  - BIT 0-3 - number of the projected page
to address # 8000;

  - BIT 4 - Room "ruler" of the eight banks that are projected 
from the address # C000; 

  - BIT 5 - if "0", instead of the projected ROM RAM - Bank # 
0C or 0E #, depending on the condition of the fourth discharge 
port # FD ("1" - # 0E, "0" - # 0C); 

  - BIT 6 - if "0", the entry in the segment 0 is allowed 
(provided that the reset BIT 5);


  - BIT 7 - If the "1", starting at address
# 4000, the bank projected # 0D, screen 0, and with
Address # C000 - screen 1, Bank # 0F.

  Port # FD (it is believed that this port
not to speak of, its track is
hardware, and he emulated portom # FC) -
as in a standard SPECCY 128.

  Port # FC - # FD emulates, with the difference
that BIT 5 (latch 48K) can switch
48/128 modes.

  All three of these ports are available as
recording and for reading.



        Practical application


  Here is a small excerpt from Miko comander:


   LD BC, # FFFC; port analog # FD

   IN H, (C); kept current

   LD A, # 55; value

   OUT (C), A

   IN L, (C); checks available

   CP L; whether the record?

   JR NZ, NO_MIKO

   OUT (C), H; restored

   LD DE, 768; available memory

   IN A, (# DC); ROM instead of RAM?

   BIT 5, A

   JR NZ, STANDART

   LD DE, 704, and if so,

   LD A, # FF; removed from the list

   LD (TBANK +13), A; available to banks # 0D

   BIT 5, H; included Basic 128?

   JR NZ, MODE_128

   LD DE, 640; if yes - throw

   LD A, # FF; Bank # 0C

   LD (TBANK +12), A


  Here is the test of memory available, and
management of banks is as follows:


   LD HL, TBANK

   LD E, A; in a virtual

   LD D, 0; page number

   ADD HL, DE

   LD A, (HL)

   CP # FF; if not available -

   RET Z; output

   LD L, A

   AND # 08; identified the third bit

   RLCA; and transformed it into

   LD H, A; room "rule",

   IN A, (# DC); which departs

   AND% 11101111; the fourth digit

   OR H; port # DC

   OUT (# DC), A

   LD A, L

   AND # 07

   LD L, A

   IN A, (# FC)

   AND% 11111000; three junior level in the

   OR L; room of the bank - to

   OUT (# FC), A; port # FC (# FD)

   SCF

   RET

   ...

TBANK

   DB 0,1,3,4,6,7,8,9

   DB # 0A, # 0B, # 0F, # 0C, # 0E, # FF


  Bank # 0D is not used, since there
Manager stores 4-byte identifier start, because of what is lost 
16K (in my opinion, do not advisable).


  "And what do with all that?" - You ask.

  Well, if you want a program adaptiravat Miko, then all the 
simple (for example, HC_3.08 - best Commanderie on Speccy, even

to date):


             ORG # 6F0F

             PUSH BC

             LD B, A

             LD A, (# 5B75)

             EX AF, AF '

             LD A, (# 5B90)

             ADD A, A

             JR C, PENT

             LD A, B

             AND # 08

             RLCA

             OR # 62

             OUT (# DC), A
PENT

             LD A, B

             LD (# 5B75), A

             AND # 08

             RRCA

             RRCA

             RRCA

             LD C, A

             LD A, B

             AND # 07

             ADD A, C

             OR # 10

             LD BC, # 7FFD

             OUT (C), A

             EX AF, AF '

             POP BC

             RET


  Option B should ask User page, and
Autoload Overlays - remove (for 256K). Now you have a 160Kb 
without RAM-Disk. At some discrepancy information on Memory 
(program made for how at least, 512K) do not pay attention.


  If the program is made under the Port
Scorpion, then do it even simpler.

  And what to do with four screens?

  For example, we look tricolor
Pictures:


             ORG # 7800

             LCODE "PICT"

             ORG # 6000
BEGIN

             DI

             LD A, # 17

             LD HL, # 7800

             LD BC, # 7FFD

             LD DE, # C000

             OUT (C), A

             PUSH DE, BC

             LD BC, 6144

             LDIR

             PUSH HL

             LD HL, # D800

             INC DE

             LD BC, 767

             LD A, (COLOR2)

             LD (HL), A

             LDIR

             POP HL

             POP BC, DE

             PUSH DE, BC

             LD A, # 15

             OUT (C), A

             LD BC, 6144

             LDIR

             PUSH HL

             LD HL, # D800

             INC DE

             LD BC, 767

             LD A, (COLOR4)

             LD (HL), A

             LDIR

             POP HL

             POP BC, DE

             LD A, # 72

             OUT (# DC), A

             LD A, # 17

             OUT (C), A

             LD BC, 6144

             LDIR

             LD HL, # D800

             INC DE

             LD BC, 767

             LD A, (COLOR1)

             LD (HL), A

             LDIR

             LD A, # 62

             OUT (C), A

             LD HL, # BE00

             LD DE, # BE01

             LD A, H

             LD (HL), # BF

             LD I, A

             LD BC, 257

             LDIR

             LD A, # C3

             LD (# BFBF), A

             LD HL, # 8000

             LD (# BFC0), HL

             EX DE, HL

             LD HL, INT

             LD BC, COLOR1-INT

             LDIR

             IM 2

             EI

             LD A, # 15

             OUT (# FD), A
MAIN HALT

             CALL 8020

             JR C, MAIN
EXIT DI

             LD A, # 62

             OUT (# DC), A

             LD BC, # 7FFD

             LD A, 60

             LD I, A

             IM 1

             LD A, # 10

             OUT (C), A

             EI

             RET
INT DI

             PUSH AF, BC, DE, HL, IX, IY

             EXX

             EX AF, AF '

             PUSH AF, BC, DE, HL

             LD BC, # 7FFD

             LD HL, # 151D

             LD A, # 62

             OUT (# DC), A

             LD A, 0
WHO EQU # 8000 + $ 1-INT

             OR A

             JR NZ, SK0

             INC A
SK0 DEC A

             JR NZ, SK7

             OUT (C), H

             INC A

             JR QEX
SK7 DEC A

             JR NZ, SK5F

             OUT (C), L

             INC A

             INC A

             JR QEX
SK5F LD A, # E2

             OUT (# DC), A

             LD A, # 11
P1 DJNZ $

             DEC A

             JR NZ, P1

             XOR A

             DEC A
QEX INC A

             LD (WHO), A

             LD A, # 62

             OUT (# DC), A

             POP HL, DE, BC, AF

             EX AF, AF '

             EXX

             POP IY, IX, HL, DE, BC, AF

             EI

             RET
COLOR2 DEFB # 42
COLOR4 DEFB # 44
COLOR1 DEFB # 41


  Here and do not need to be considered: almost all the time
computer - in vashey power. This passage
is taken from the 3C-studio, I wrote a year ago (full-screen 
editor tricolor images). In principle, It is already possible 
to paint any picture. If someone expresses the desire, then I 
Finish it. 

  By the way, this editor you can write and
for the Speccy 128 (using one-third of the screen to edit), the 
problems here no.




               Prospect


  It would be nice to make the interception Magic'a
or Reset'a: it's real. When a signal instead of NMI TR ROM-DOS
substitute page of RAM, and then choose
Magic, Debuger etc.

  Another good thing would be in ROM instead of the Manager's 
sew up their program. 

  In general, you need a programmer. And there -
try that out.



             P.S. by rasp


  Of course, little use to replace Manager
something more "other" is tempting, but not
Take your time, dear users Miko: "Do not
knowing ford, not poke your nose into the water. "Just because
take and sew up something in the ROM is designed to work in 
Miko Best, will not leave! 

  It turns out that the developers of the computer smart enough 
to confuse the data bus, ROM and the CPU! Here is a plate from 
which it is clear that to this: 


     ROM CPU


     D0 (11) D2 (12)

     D1 (12) D7 (13)

     D2 (13) D0 (14)

     D3 (1915) D1 (15)

     D4 (1916) D5 (9)

     D5 (1917) D3 (8)

     D6 (18) D4 (7)

     D7 (19) D6 (10)


  In parentheses, I have pin numbers of the chips.

  As seen from the plate, visible
some regularity of this arrangement is the tires. Until this is 
likely to hit upon some careless developer who decided to save 
a couple of transition holes, dropping all the tracks in 
parallel. Or maybe it's because "code" information?


  And as a replacement for Manager's, I would suggest to try 
the firmware Gluk Reset Service; it can be ordered on the Tree 
of Life BBS.


  If you do not have the programming, for
flash ROM can contact S. Filimonov. Its coordinates, as well as 
the coordinates of the author of this article can be found at 
Homepage About. 






Other articles:

ZX-waggons - Overview of electronic media: Pilot 1929, CNet Week 17, Born Dead 1-4, Maximum 47, Nicron 104.

Iron - Many functions in one body (about AON'ah).

Iron - Overview of quality floppies.

Coding - The test of memory available. Manage memory banks. Adapting programs for Miko.

Likbez - Assembler: A look from afar (continued).

Advertising - Advertisements and announcements ...

four kilobytes - On the thematic issues Optron: Iron and coding.


Темы: Игры, Программное обеспечение, Пресса, Аппаратное обеспечение, Сеть, Демосцена, Люди, Программирование

Similar articles:
Interview - Interview with editors of the magazine taken from Cobra.
Tusovka - Visiting Us Laser Soft (Obolensk)
Guide - The format of the packed tricolor .888.
UPGRADE - To the question about installing 3.5 'FDD.
Likbez - Little dictionary of the network user.

В этот день...   7 May