ZX Review #7-8-9-10
08 ноября 1997

Studies - Address to the drive mode IM 2. Working with non-standard disc format.

<b>Studies</b> - Address to the drive mode IM 2. Working with non-standard disc format.
(C) Labutin D., Nizhny Novgorod
region, Dzerzhinsk


   You have already written to the ZX-95 REVIEW N5
on page 53 that you can work with the regime interrupt IM 2
and at the same address to the disk.
This way I have not approached,
since, working in the mode of 128 kb,
interrupt handler with
addresses of 65,129 or 65,524 have not, because pages there
constantly changing, and the other
appropriate register values ​​I
I have not picked it up. Then I thought
another way. All appeals to the
disk (CALL # 3D13, or similar)
is replaced by CALL DOS. Sub-DOS is as follows:
140.
DOS PUSH AF

        LD A, 1

        LD (FLAG), A

        POP AF

        CALL # 3D13

        PUSH AF

        XOR A

        LD (FLAG), A

        POP AF

        RET
FLAG DEFB 0


   A routine interrupts looks like this:

IM2 PUSH AF

        LD A, (FLAG)

        OR A

        JR Z, IM21

        POP AF

        PUSH HL

        LD HL, # 3D2F

        EX (SP), HL

        PUSH AF

        PUSH BC
IM21 ............... ; Preservation registers

        CALL PROG; treatment interruption

     ............... ; Restore registers

        POP BC

        POP AF

        RET
2

   Ed.: Good idea, only you do not
take into account the fact that the TR-DOS ROM is ROM
BASIC even when performing such simple
operations, such as reading groups of sectors. For
This routine is used at
# 5CC2, consisting of only one team
RET. Placed on the stack address of the subroutine, the 
registers are loaded options, and done JP # 5CC2. Return of the 
subroutine is at # 3D2F. To have your method to work, should be 
at # 5CC2 put JP on the following subroutine: 140.


        POP HL; take the address of the called subroutine

        PUSH AF; keep AF

        SUB A; working ROM BASIC

        LD (FLAG), A

        POP AF; recovery AF

        PUSH HL; store address of the calling subroutine

        LD HL, L1; put on a stack of new return address

                       ; From subroutine

        EX (SP), HL; and restore the address of the subroutine

        PUSH HL; pushed onto the stack address of subroutine

        LD HL, (23810); restore HL

        RET; move on to the subroutine
L1 PUSH AF; keep AF

        LD A, # 01; working ROM TR-DOS

        LD (FLAG), A

        POP AF; recovery AF

        RET; return to the TR-DOS ROM
2

   A few words about the restoration of HL.
Subroutine call ROM BASIC uses
variables 23810 and 23812 to save
HL and DE, respectively, therefore, for
call # 5CC2 in these variables will be copies of these 
registers. This fact and used the above routine. 


   Corr.: I'm writing a graphic adventyuru (certainly not me
one, but I program), and
one point realized that the floppy disk in
640 KB enough for graphics.
Then I decided to switch to non-standard format. In one lane 5 
sectors of 1024 bytes. Obtained disk size of 800 KB. I do not 
remember what program I've formatted floppy disk giving the 
sector number 1, 2, 3, 4, 5.


   It seemed that the deed is done,
but there it was - the fifth sector
unreadable. You can do the following:
140.

        LD E, 0, or 1,2,3

        LD C, 5

        LD B, 1

        LD D, 5, or any

                      ; Track

        LD HL, 40000

        CALL # 3D13

But if you try:


        LD BC, # 0105

        LD HL, 40000

        LD DE, # 0504

        CALL # 3D13
2
that sector is unreadable. Here I
remembered that in the IS DOS 5 sectors per track for the 
kilobyte. After analyzing the contents of a track floppy disk, 
formatted IS DOS, I was very surprised. There

sector have the numbers 1, 2, 3, 4,
9. Why 9, not 5? Reformatting the disk in this way,
I was no more similar
problems. I wrote the following
uploader:
140.
DOSLOAD PUSH BC

        PUSH DE

        PUSH HL

        LD A, E

        CP 4

        JR NZ, DOSLD1

        LD E, 8
DOSLD1 LD B, 1

        CALL # 3D13

        POP HL

        INC H

        INC H

        INC H

        INC H

        POP DE

        INC E

        LD A, E

        CP 5

        JR NZ, DOSLD2

        INC D

        LD E, 0
DOSLD2 POP BC

        DJNZ DOSLOAD

        LD (# 5CF4), DE

        RET
2

   Before the call: HL = address
loading, B = number of sectors
(1024 bytes), C = 5 - reading,
6 - entry, D = path, E =
sector (from 0 to 4). But downloading
walking very slowly, and I've placed the sector on the track in 
the following order: 1, 4, 2, 9, 3, and rate increased by 2 
times. Maybe this information will prove useful to somebody, 
and someone can explain why need to use nine sectors, rather 
than five. 


   Prim Ed.: Strange story. Ninth
sector, or the fifth, but at least the 130th, all
should work. Perhaps the lack of Dmitri in the format program. 
Dmitry, try to format the drive so how do you like the same 
program, and then look at it with the function Analyse

Track ADS programs or RDS. Likely
You'll find the answer to your question. Now on
why in the IS-DOS used in the ninth
sector. It is necessary for the implementation of
Startup of the system. The principle is. Before any operation 
with TR-DOS disk loads nine sectors zero track in a specially 
allocated for this buffer at # 5D25. The buffer has a length of 
257 bytes. Why not 256 - can only say the creators of TR-DOS. 
During this buffer area will be based on descriptors channels. 
TR-DOS does not can read part of the sector, it loads

the whole thing, no matter how long it was. In
result of sector length of more than 256
byte overwrites a descriptor channels.
But the TR-DOS does not know and tries to
identify the disc. The first thing she
checks in the sector of bytes at offset
231, and if it does not equal 16, it is
immediate interruption of operation with the issuance of
Posts Disc Error. Issue Post
goes through the channel K. Here's the startup mechanism is 
triggered. Enough to cell offset # 0101 and # 0102 to record

address of your boot, which is located in the same sector. The 
loader will start, and there really do whatever you want. 


           *







Other articles:

TR-DOS for beginners - The end.

Computer novella - Prince of Persia.

Computer novella - Laser team (the game Laser Squad).

Crossing Dragon - Game Rapscallion.

Crossing Dragon - Playing The Runes of Zendos.

Crossing Dragon - Playing The Saga.

Crossing Dragon - Game Witch's Cauldron.

Crossing Dragon - Create Adventyuru. Review of the editors.

Crossing Dragon - Create a dictionary to Adventyurnoy game.

Program, which we choose - The possible consequences of using undocumented commands.

Program, which we choose - About noticed irregularities in some programs and suggestions for future versions.

Program, which we choose - A proposal to all the authors of software, printers, memory dump. Programmers protect discs from being copied.

Program, which we choose - A few suggestions to improve the assembly.

Program, which we choose - Suggestions for refining ZX Word v2.5.

Program, which we choose - The "Spectrum emulator" v1.2.

Program, which we choose - What could want in a perfect assembly.

Retro - 40 best procedures: Copying data in memory.

Retro - 40 best procedures: Exchange token.

Retro - 40 best procedures: Determination addresses BASIC string.

Retro - 40 best procedures: Determination of the length of BASIC programs.

Retro - 40 best procedures: Determination of the amount of free memory.

Retro - 40 best procedures for: Search and replace strings.

Retro - 40 best procedure: Find the string.

Retro - 40 best procedures: Search for the string.

Retro - 40 best procedures: the list of variables.

Retro - 40 best procedures: an increase and up the screen.

Retro - 40 best treatments: Removal of REM-strings.

Retro - 40 best procedures: Remove the block of the program.

Expert Tips - Game Fredloader.

Expert Tips - Game Robin of Sherwood: The Touchstones of Rhianon.

Expert Tips - Game Scorpions: Die Machines.

Expert Tips - Game Terropods.

page iS-DOS - Description of system restarts IS DOS.

Forum - An algorithm for recognizing characters.

Forum - Time undocumented command processor Z80.

Forum - The concept of a high-color screen resolution.

Forum - A few Pokes to a game. Program Hacman96.

Forum - As for the new DOS and BIOS settings for the Spectrum.

Forum - Multicolor program on any computer model. Using the 2 nd screen Multicolor'a. Demonstration of the text. Electronic journals.

Forum - Project ZX Config.

Forum - Improve Art Studio. Ideas on file compression.

Forum - ZX Spectrum emulator for IBM. About the hexadecimal system. Program ZX-Stars. Oddities in the Elita

Forum - The effects on the curb and Multicolor.

reader-reader - ZX Spectrum 128 - new opportunities, new challenges.

reader-reader - With 'Light'. Spectrum and expert system.

reader-reader - The printer driver for the Scorpion.

reader-reader - Print numbers in different number systems.

reader-reader - Programming arcade game with scrolling screen.

reader-reader - The procedure for printing labels assembler XAS to monitor debugger STS 4.3.

Studies - attribute scrolling text. "Gasilka" screen. A simplified version of the procedure, "Curtain". Procedure is enriched with pictures. Procedure display images on the points.

Studies - Graphic effect "color bars".

Studies - Driver screen printing 64 characters per line.

Studies - Set of protective boot.

Studies - Address to the drive mode IM 2. Working with non-standard disc format.

Studies - Print the character, magnified by 8 times. The program "pouring" screen. The procedure for screen-saver on the points. Clear screen in Terminator'e. Search strings in memory. System character set conversion.

Studies - Program - cataloger of disks.

Studies - Program the output values of the amplitude channel music. coprocessor on the curb.

Studies - Program the output image.

Studies - The program plugs sprite.

Studies - Cleanup of the specified window screen.

Studies - The program sort the array in ascending order. The procedure for filling the screen specified attribute. Procedure display pictures. The effect of moving towards the stars. "Shower", coming from the upper left corner of the screen. The procedure of "shedding" pictures on the pixel lines. The program of "pulling" the picture at an angle of 45 degrees. Three procedures "Scroll".

Studies - The printing of numbers.

Studies - The procedure for drawing a character with attributes.

Studies - The procedure for display pictures. Fade-OUT effect (picture goes beyond the edge of the screen). Visual effect "Fountain." Fade-OUT effect, mimicking the TV off. Procedure "Ignition" pictures. The program continuously drawing a picture.

Studies - The procedure for drawing a line.

Studies - The procedure for making optimal symbol table.

Studies - scrolling lines of text in the specified window. Attribute scroller. Diagonal scrolling.

Studies - sprite scroller. Procedure display screen.

Studies - Short procedure indicating the amplitude channel music. coprocessor. Way to subtract a constant from a register pair HL.

Studies - The formula for calculating the day of the week.


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

Similar articles:
Studies - Playback software tool from the editors of digitized music.
Sceneexplorer - The results of the survey.
Nemo open letters № 2.3

В этот день...   21 November