Inferno #07
31 мая 2005

For Coderz - Programming disc changer / drive in Scorpio.

<b>For Coderz</b> - Programming disc changer / drive in Scorpio.
  Programming disc changer / drive



   To flash Scorpio could
execute your program from your hard drive
correctly (with the possibility of changing the images on
fly), you need the disc is changed to perform no
Only # 3d13 C = # 1 (drive select), but
then # 3d13 C = # 18 (setting a floppy disk).
However, the latter function opens a gap
an interim buffer length of 257 bytes to read
the service sector, floppy disks, ie need the following
dit for memory allocation. Remake
ACE, ZXRar and ZXUnRar could only last
autumn, with Amonik'a (Nicholas Amos
 Islands).

   Here is a fragment of dialogue, when we discuss
waiting for the question: why, after a blunt (t.e.idem
ahead, more than anything in the program is not
me) add "LD C, # 1918: CALL # 3d13"
ZXRar not working?


   First guess was wrong ...

AmoNik>

   After petlyaniya protsedurke by the end of
nabredaem ends on such a piece, which
checks for buffer allocation:
 # 19FD RST # 32

         DEFW # 1F05

        RET

   This appeal to the ROM BASIC. Exercising
is the transition to address # 1F05.

   In the BASIC ROM at this address is
protsedurka check:
# 1F05 LD HL, (# 5C65) address of the stack

                               Calculator

        ADD HL, BC in BC buffer length:

                              257 bytes # 101

        JR C, # 1F15 if you got out of the ROM



         EX DE, HL

        LD HL, # 0050 do not know why yet

                          80 bytes is required

        ADD HL, DE

                  but as a result of HL = SP!!!

Alone Coder>

   Perhaps coincidentally "There just is not
lacked a single byte, as I found out after
Pile of experiments by the method of dichotomy. But one
- Is recording the whole file. When recording
on the stack below and lacked a
many bytes ...


        JR C, # 1F15



         SBC HL, SP Got 0

        RET C and are unaffected by the protsedurki
 # 1F15 LD L, 3 Message Out of memory

        JP # 55

 # 0055 LD (IY), L Error Code

         LD SP, (# 5C3D)

        JP # 16C5

# 16C5 LD HL, (# 5C63) address of the beginning of the stack

                               Calculator

        LD (# 5C65), HL address stack

                               Calculator

         PUSH HL

         LD HL, # 5C92

        LD (# 5C68), HL memory address

                 used calculator

         POP HL

        RET went to TR-DOS


   In general, I managed to fix the glitch, with
forcibly zanesya # 5C65 in the same as in
# 5C63.
 Alone Coder>

   So you kill Old Village on long files
le 64-th marked at the first change
diska.Na # 5c63 IMHO generally can not give a damn
(We do not need a calculator).
Amonik>

   Figure it out, please, why are you hell
res stack calculator shifts.
 Alone Coder>

   So that when you delete a file (# 12) did not ubi
valsya end of the buffer length of the file (512 bytes
from the address # 5d3b)


     And then, finally, an error is found:

 Alone Coder>

   In the end, I did so: even more moved
SP up to a minimum, below which
tsya glitches; # 5c65 down for a couple of bytes - for
minimum below which zaparyva
of, then I thought and picked up another 16 SP
 bytes for buggy Dosov (you never know what there).

   IMHO people in other prog no
check how much memory is left between
STKEND and SP. And apparently, it is necessary, and very much 
so. 


    AmoNik proposed an alternative

       way to switch discs:

AmoNik>

   I was wondering why the tr-dos not
works with the disk without initialization. Com
Neil variables tr-dos before and after initialize
tion drive and found that for a corresponding
 denotes "drive mode".

   Prior to initiating After ini-and B: and C:
# 5CC8 # 83 # 83
# 5CC9 # 82 # 83!
# 5CCA # 00 # 03!
# 5CCB # 00 # 00

   Here drive A - virtual, B - re
exponentially, C, D - virtual.

   Explanation: A disk with I booted, which is why
that he had to проинициализирован.Обращался
floppy drive B and C. At Scorpion assumed
It is assumed that the maximum can only be two
drives and disks C and D can only be
virtual. Hence, perhaps, such a difference
in the values ​​after initialization.

   Thus, if we assume that all
double-sided disk drives vosmidesyatidoro
zhechnye, then you can before switching to disco
water by hand to make the appropriate
cell # 83 and to dispense with the function # 18.

   If I change the virtual disk, and prog
Ramm turn to him without a # 1, # 18, then those
Newick will continue to work with the disk, which
been connected before. On a real disk
general plugging after reading zero track
as the # 82 means to use the drive
80 tracks as a drive on 40 tracks
ie through the track jumps and did not
finds the desired number treka.Nachinaet chase
head to the top of the disk and back.
 Alone Coder>

   When changing Wirth. diskette to the cell again
# 82 written? or # 00?
AmoNik>

   After changing the virtual disk values
of cells does not change, ie, that it was up to
switch drive, then drive ostalos.Esli
before it is initialized, it will
# 03 for drives C and D.
 Alone Coder>

   So initialization must still register
any change of address of the image on the
drive (strange that menu selection image
it does not). Do not even believe that # 83 for
 can of glitches when changing ...

   Better not to touch these cells. I
they are no longer trogayu.V some programs
zanoshu just type in the drive A, B (it would be necessary
only in B, because you have too many A
virtual). Not to - swear Paul
transducer TR-DOS5.03/5.04em (not T) / 6.08 (not
6.05) - these unfortunates still there! Alterna
Tiwa - # 3d13 # 1, then # 18.



   PS: It turns out that when the operator
radios # 3d13 unacceptable that ERR_SP was
is # AAxx! And # 0a # 3d13 spoils commands
dnuyu line ...

A. Coder




Other articles:

Classics - Almanashnik. Alexander Pushkin.

For Coderz - Recognition and computation of arithmetic expressions on their character record.

Inferno - The authors of the magazine.

For Coderz - the discipline to create large projects.

Interview - Questions Konstantin Sviridov (Conan) on the site zxnext.narod.ru.

Likbez - The principles of converting graphics PC-ZX.

For Coderz - Programming disc changer / drive in Scorpio.

Softinka - DNA_OS v0.431 - package of utilities for working with hard drives, RAM-drives and floppy disks.

For Coderz - Programming under DNA_OS ZET-9, a package of tools to work with storage devices.

Softinka - The problems and shortcomings package of tools to work with storage devices DNA_OS.

Likbez - details about disk formats that are FAT.

Inferno - Entered from the editor.

Inferno - Errors in the previous numbers.

For Coderz - Small programmers' tricks.

Gameland - On the new games: Oneyroid, Dizzy forever, Dridlock.

For Coderz - Writing archive. Practical principles LZ packaging.

Gameland - Passage of new shipments for the game "Black Crow".

For Coderz - Programming for the video mode 384x304.

Inferno - Letters to the Editor.

Sound - Eden Megus'a about the tracker for the AY / YM.

Inferno - On the shell.

For Coderz - Fundamentals of optimization for the processor Z80.

Likbez - The location of partitions on your hard drive.

Gamedev - 3D projection of the floor / road in the games.

Sound - Wild ideas for AY trackers.

Advertising - Ads by Roman Chuunin.

Advertising - Ads by V. Bogdanovich

For Coderz - How a large Flexible Program.

Repair - Faults Pentagon 128 + and their repair.

Inferno - Content.

Miscellaneous - Thoughts on the contest for the best software.

Others - Transfer software on ZX Spectrum with a PC.

Video - On packaging for a video ZX Spectrum.


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

Similar articles:
Musicians - How to make music at Channel 4 and more.

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