ZX Review #7-8-9-10
08 ноября 1997 |
|
TR-DOS for beginners - The end.
TR-DOS FOR BEGINNERS Music by ZET (C) VA Sirotkin END. Start see the ZX REVIEW 1996 NN 1-2, 4-5, 6, 7-8; ZX REVIEW 1997 NN 1-2, 3-4, 5-6. RECOVERY failed disk Failure in the disk is 3 types: 1. Logical - to change or disappearance of these sectors. 2. System - the destruction or change marking system tags. 3. Physics - a result of mechanical damage. The first type of failure is often a result of damage or erase part of the directory of the drive system of the eighth sector or sectors where the recorded program. It may also be intentional change of directory in a protected disk. If the broken directory, then collapsing all the information about where what file is on disk. Restore the directory and the program You can, if patience and a piece of paper, as well as a program like Disc Doctor, which you can edit the information in the sectors. You will need to find sectors BASIC files each program (and the majority of program must have a BASIC file). Enter into the sector Catalog data - in what sector on which track it is and what is its length. Part of the BASIC to learn what files, where and how long the load. And here are two options: 1. If all the program files recorded continuously, and you will become familiar with all the data loading follow-up files, then you're in luck! Will only arithmetic - adding file length, number of sectors and tracks, and record all this in the form of headings in directory. 2. The second option - this is when files are scattered across the disk, interspersed with files from other programs, or when it is not known no load address in RAM, not length. Then you can only sympathize. Try to restore the program in this case You can, but it is only at random (search files on-screen, text messages, and so on and so etc.) If you have found the failed eight sectors, then it is easier ... You copy all programs from this disk to another, and this disc can resubmit. If there comes a complete collapse sector (as it happens, if change byte at offset # E7 from the beginning of the sector), and the disc does not read either the system or copiers, then upload sector in terms of TRDOS in the memory and restore the damn bytes and bytes "disk type" on shift # E3, overwriting the sector from the memory into place, and then acts the same way as described above. Get rid of headaches Accidental destruction of 0 will help you track the following programm. This program has two points Launch: START_S - SAVE zero disk tracks on 164 track (164 track is marked automatically when you save) START_L - Recovering data from 164 tracks on the zero track (with a preliminary formatting, 0 tracks). First, you handle your drive conservation, and in the case The failure of zero track or accidental erasure of the directory start recovery - and all that that was at the time of preservation drive to recover to 164 tracks (82 cylinder). Track, where information is stored, the system is unavailable and software is not available or copyist, or "DISK DOCTOR." So do not worry that a copy of the system will ever overwritten. The only thing that can happen, so it is a conflict with a similar system program that uses the same track number. If you have disc was originally marked up by 86 cylinders (at 172 tracks), then changing the constant in the Listing program from 164 to 174, you'll keep track on a zero- 88th hat (albeit a "Far" track is already considered unreliable. 140. ; Program rescue - restoration of "systemic ; Disk tracks ; In angle brackets addresses for version 3.5 TRDOS ; Buffer for reads from the disk starts C 40000 And preferably before running the program to give ; CLEAR 39999 ORG 50000; you can choose a different address ; Work START_S JP SAVING; to save START_L JP RESTOR; to restore - Call DOS routines DOS PUSH IX JP # 3D2F ;-TR0_UP LD C, 02; function of DOS - the transition ; To 0 track LD A, 0 CALL # 3D13 LD A, # 3C; willingness to drive 'A', , The upper side LD IX, # 2EC2 <# 2F0C> CALL DOS; execute RET - Read sectors from the track READ_S LD E, 0; LD B, 16 LD HL, 40000 LD C, 05; function DOS - to consider ; 16 sectors in CALL # 3D13; address RAM 40000 RET TR82 LD C, 164; physical movement ; Heads LD IX, # 2EFB <# 2F45> 3, the cylinder 82 3 (164 track) CALL DOS; execute RET - Formatting track FORM LD A, 82 LD (# 5CD8), A; there should not be zero! LD IX, # 1FC1 <# 1FFD> CALL DOS; format track ; On which we stand RET; write the number of ; Register 'E' - Recording sectors SAV_S LD C, 06; function 'write sector ; Information from RAM ' LD B, 16 LD HL, 40000 LD E, 0 CALL # 3D13 RET - PROGRAMME FOR CONSERVATION SAVING CALL TR0_UP; go to the track 0 LD D, 0 CALL READ_S; read all sectors , 0 tracks CALL TR82 3, go to 82 cylinder LD E, 82; cylinder number format CALL FORM 3; format 164 track LD D, 164; write to formatted ; Nuyu track CALL SAV_S; 0 copy a track from memory EI; just in case solvable ; Interrupt RET; output - RECOVERY PROGRAMME , (164 on the track must have a copy of the track 0 ; Disk) RESTOR CALL TR0_UP; go to 0 lane, as ; Origin CALL TR82 3, go to 82 cylinder LD D, 164; will read all sectors of ; Reserve CALL READ_S; to clipboard CALL TR0_UP; go to 0 track LD E, 0, and format it CALL FORM LD D, 0; write it all sectors ; From the buffer CALL SAV_S EI RET; output 2 * If you have failed in the sectors of software, then try to rewrite the program on another drive and run it. Maybe that part of the sector came not on the working of the program codes, and the data sprites or bytes image. If not, it is possible (of course, digging in program) to establish that this a piece of code did, and bypass him. But in my opinion, easier to just search the program at buddies. The second and third type of failure - similar to each other so that the system is broken markup disk: sync byte, control codes, area index labels, etc. Systemic failure format happens for many reasons: there are A power failure during operation disk, and the fault of the controller or drive, and much more (and sometimes drive, read on one drive, refusing to operate on a different drive of the same type). Such a violation can drive try to recover. If, however, failed the physical (it and scratches, and the shedding layer disk), then restore those disk space is no longer possible. But in any case, the copy the failed disk to another (you can team TRDOS 'COPY'), ignoring the message of 'SECTOR nn ERROR ', and then try to restore those places on the disk that were failing. Already written a lot of good disk repair utility: it 'DCU', and 'ADS', and 'FUCK'. Recovery program usually consists of three elements: - Sector reading a certain number of times throughout the failed path to the RAM, and then another time and again and again: as long until the entire track will not read correctly (or the user program will not stop the process). - Partitioning (formatting) track, if a failure occurs in the system of labels. - Process all sectors recording the read information (complete or incomplete) of RAM on the track, followed by a test of readability. If you wish, you can write your recovery program, but nothing much better than you already have on Currently the programs of reducing, in my opinion, no longer come up with. And finally, let's talk about how to read or burn discs of other formats from other machines. The first thing to know exactly what this disc, from a machine. As this machine partition that disk, how long sector and how many of them on the track. For example, IBM-ROM standard marked into sectors of 512 bytes and the number of sectors per track, 9 (18 discs at a high-density they do not even try to read on your drive). In CP-M and IS-DOS disk size sector is 1024 and the number of 5 of them. To read disk sectors in another format, special ingenuity do not have to: define a buffer of suitable size in memory and in terms of TRDOS "Read sectors" - are the contents of the memory. Naturally, to run IBMfayly Sinclair you can not, but rewritten to use text files - please. Or vice versa, copy text, "stuffed" in Specchia in IBM format and edit them there. The hardest thing - is to understand the file structure of these discs. How to open directories, and subdirectories IBM and IS-DOS disks how to trace the disk file which is fragmented, and the file headers in these systems not like TRDOSovskie. For those who want to do this area of programming, I suggest to collect books IBM-compatible computers and carefully examine the file organization of these machines. APPENDIX TO CHAPTER 5 All those who subsequently will program the controller ports (file commands Port # 1F and the port # FF) it must be remembered that not every direct command controller VG93 will be performed entirely with the discs working in TRDOS. Case that the disc format TRDOS is simplified, and the simplicity of the format compensates for the software ROM TRDOS. Recommended codes for filing to port # 1F: Port Teams (these codes operates TRDOS). Record format - # F4 Search Cylinder - # 1B or # 18 Restoration - # 08 or # 0B Interrupt - # D0 or # D8 Reading addresses - # C0 Reading Sector - # 80 sectors - # 90 Recording sector - # A0 sectors - # B0 Step - # 38 Step Up - # 58 Step back - # 78 Examples of control codes for Port # FF. Drive 'A', double density, the two sides. Readiness, the upper Party - # 3C Availability, lower Party - # 2C Reset, the upper side - # 38 For those who emerge a strong desire to disassemble their own ROM TRDOS below A map of approximate space allocation TRDOS ROM (addresses in decimal terms). 140. from 0 to 101 - the initialization of the system from 102 to 105 - go to the address 10838, where are placed sub 'Magik FILE' from 864 to 939 - the name and version TRDOS from 2048 to 4095 - code # FF (Free) from 4099 to 4119 - the text "Interface 1" from 4261 to 4432 - the text of system information tion for LIST from 4445 to 4519 - subroutine print from 8121 to 8131 - Data Table from 10,086 to 10,299 - the texts of messages from 10,380 to 10,455 - a table of addresses for subroutine call functions TRDOS to re Giustra 'C' from 10,673 to 10,804 - the texts of messages from 10,838 to 12,038 - sub - 'MIGA Cesky FILE ' from 12,275 to 12,337 - a data table from 12,541 to 12,786 - the key word commands TRDOS from 12,797 to 15,360 - code # FF (Free) from 15,610 to finish - the entry point in TRDOS and basic routines 2 In addition, a ROM using the command processor TRDOS RST to call some procedure is halted, namely: TEAM RST # 20 - call subroutine from ROM SOS (after RST # 20 team is always followed by two byte address of the calling routines SOS). TEAM RST # 18 - print on-screen message from the address M (HL), at the end of message byte 0 or> # 7F TEAM RST # 10 - print symbol from the register of 'A' Listing Tables some routines ROM TRDOS Icon '=>' marked the addresses entering the subroutine, which were mentioned in the chapter. Taken as a basis addresses TRDOS 5.01, in angle brackets (<xxxx>) will be given an address for TRDOS 5.03. 140. ENTRY INTO PORT # FF (switching sides of the disc) # 1FAF LD A, (# 5D16) # 1FB2 OR # 3C; UP, READY # 1FB4 LD (# 5D16), A => # 1FB7 <# 1FF3> OUT (# FF), A # 1FB9 RET # 1FBA LD A, (# 5D16) # 1FBD AND # 6F; NIH PREPAREDNESS # 1FBF JR # 1FB4 ________________________ ENTRY INTO PORT # FF # 2EC0 OR # 3C; top ; Side, ready => # 2EC2 <# 2F0C> OUT (# FF), A; send byte # 2EC4 RET ________________________ ENTRY IN PORT (C) => # 2A09 <# 2A53> OUT (C), A # 2A0B RET ________________________ CONSIDER cylinder number from the disk and / or write to PORT # 3F => # 1DFA <# 1E36> CALL "N_TRACK"; read from disk ; Cylinder number under ; Heads # 1DFD LD A, H; number of 'H' ; Move => # 1DFE <# 1E3A> OUT (# 3F), A; written ; R.DOROZhKI # 1E00 RET ________________________ TRACK RECORD to the port, the port # 3F (Followed by a delay) => # 3E8B <# 3E95> OUT (# 3F), A; write to port # 3E8D LD A, (# 5CCD); drive READY? # 3E90 OR A # 3E91 RET Z; yes - go # 3E92 XOR A; not ready, so ; Wait # 3E93 LD (# 5CCD), A # 3E96 LD B, # 03; cycle expectations # 3E98 LD A, # FF; number of delays # 3E9A CALL # 3DF5; p.programma ; Expectations # 3E9D DJNZ # 3E98 # 3E9F RET; exit _________________________ ENTRY into port with the port # 1F; (a well sist.peremennyh initialization and / or delivery team "break") # 2F46 <# 2F90> LD HL, # FFFF; initialize LD (# 5CFA), HL; systemic change ; Nye LD (# 5CFC), HL LD (# 5CC8), HL LD (# 5CCA), HL XOR A LD (# 5D17), A LD (# 5D19), A LD (# 5D18), A LD (# 5D0F), A LD (# 5D1F), A LD A, # FF OUT (# FF), A LD (# 5C3A), A LD (# 5D16), A LD (# 5D0C), A LD A, # C9 LD (# 5CC2), A # 2F77 <# 2FC1> LD A, # D0; team ; 'Interrupt' => # 2F79 <# 2FC3> OUT (# 1F), A; record team RET ___________________________ POLL port # 1F (port status) with the possibility interception of the Second interrupt on HALT => # 2D3D <# 2D87> IN A, (# 1F); read state # 2D3F AND # 7F; allocate bits ; Error # 2D41 RET Z; no errors # 2D42 DEC D; 'D'-1 # 2D43 PUSH HL; stack # 2D44 PUSH DE; stack # 2D45 JR NZ, # 2D31; if the 'D' <> 0 - And the transition # 2D47 HALT; wait for the arrival of ; Pulse ; Interrupt __________________________ POLL port # 1F (state) to display a message (In ROM TRDOS this part is called after the execution commands "read-write sector) => # 3F28 <# 3F32> EI; Rares interrupt IN A, (# 1F); read state LD B, A; save for AND # 7F; highlight errors RET Z; no mistake - to leave LD HL, # 298E AND # 40; by a plastic disc? JR NZ, # 3F41; yes - go LD A, B AND # 04; data loss? JR Z, # 3F96; yes - go DEC D; 'D'-1 JR NZ, # 3F0B; go higher And if 'D' <> 0 LD HL, # 2998 # 3F41 LD A, # D0; abort the operation OUT (# 1F), A LD A, B AND # 01; data request? JP NZ, # 3EDD; yes - go __________________________ Track search. SEARCH CYLINDER. WRITE Command of type 1. RECOVERY ETC ;--------- Track Search ----=> # 2EF0 <# 2F3A> LD A, # 3C; upper side, ; Readiness # 2EFA OUT (# FF), A # 2EF4 LD A, (# 5C00); if a track , Then A = 0 # 2EF7 AND # 08; it will be the number ; CYLINDER ; Or track? # 2EF JR NZ, # 2F05; transition if the number ; CYLINDER # 2EFB LD A, C; track number # 2EFC OR A # 2EFD RRA; transferred to room ; CYLINDER # 2EFE LD C, A; and the side of the disc # 2EFF JR NC, # 2F05; jump if ; Even CYLINDER # 2F01 LD A, # 2C; it odd Chi ; A cylinder - NIH ;----------- Search CYLINDER -------=> # 2F03 <# 2F4D> OUT (# FF), A; choose a side ; Drive # 2F05 LD A, C; cylinder number ; To search # 2F06 OUT (# 7F), A; in the data register # 2F08 CALL # 3DF3; p.programma ; Delay # 2F0B LD A, # 1B; search with the omitted ; Head - Execute a command of type 1 (disk is spinning, - Head pressed against the disk. ---=> # 2F0D <# 2F57> OUT (# 1F), A; for execution ; TEAM # 2F0F IN A, (# FF); readiness. # 2F11 AND # 80; team ; Done? # 2F13 JR Z, # 2F0F; no - wait # 2F15 PUSH BC; save # 2F16 CALL # 3DF3; p.programma ; Delay # 2F19 POP BC; extract # 2F1A RET; return ;---------- Issue the command RECOVERY ---=> # 2F1B <# 2F65> LD A, # 0B; output to 0 ; Track # 2F1D JR # 2F0D; execute ______________________________________________ Writes the array in PORT (C). (Here refers routine 'write sector') - A preliminary survey of willingness and / or data strobe - # 3FB0 <# 3FBA> LD B, # 04; cycle expectations # 3FB2 <# 3FBC> IN A, (# FF); interview at the ready ; Sequence # 3FB4 AND # C0; is Ready ; Or gate? # 3FB6 JR NZ, # 3FC7; there - go to ; Record # 3FB8 INC DE; not, then the main ; Cycle expectations # 3FB9 LD A, E; in 'E' and 'D' number ; Repeat # 3FBA OR D # 3FBB JR NZ, # 3FB2; cycle end? # 3FBD DJNZ # 3FB2; expectation of the end? # 3FBF RET; out the operation ; Not go! - Writes the array to the port (C) - => # 3FC0 <# 3FCA> IN A, (# FF); interview on ; Readiness # 3FC2 AND # C0; is Ready ; Or gate? # 3FC4 JR Z, # 3FC0; no - wait # 3FC6 RET M; Complete all - QUIT # 3FC7 OUTI; a gate - ; Send byte ; To the port of M (HL) # 3FC9 JR # 3FC0; return to the ; Next byte ____________________________ READING ARRAY OF AUTHORITY (C) (Here refers routine 'Reading sectors') - A preliminary survey of willingness and / or data strobe - # 3FCB <# 3FD5> LD B, # 04; cycle expectations 140. # 3FCD <# 3FD7> IN A, (# FF); interview at the ready ; Sequence # 3FCF AND # C0; READY? GATE? # 3FD1 JR NZ, # 3FE2; yes - go # 3FD3 INC DE; waiting for a certain # 3FD4 LD A, E; time # 3FD5 OR D # 3FD6 JR NZ, # 3FCD; waiting time ; Happened? # 3FD8 DJNZ # 3FCD; cycle end? # 3FDA RET; team did not go ; Go - Read an array of ports (C) - => # 3FDB <# 3FE5> IN A, (# FF); interview ; On the willingness # 3FDD AND # C0; GATE? ; READY? # 3FDF JR Z, # 3FDB; no - wait # 3FE1 RET M; Complete all - Exit # 3FE2 INI; assume bytes ; From the port And in M (HL) # 3FE4 JR # 3FDB; return , For the following , Byte __________________________ Sub-READ-WRITE SECTOR (first) => # 3F00 <# 3F0A> LD A, # A0; Record code ; 'Record' # 3F02 JR # 3F06; transition to A continuation => # 3F04 <# 3F0E> LD A, # 80; Record code 'READING' # 3F06 LD (# 5CFE), A; SAVE # 3F09 LD D, # 0A; number of attempts # 3F0B PUSH DE; hide # 3F0C DI; ban ; Interrupt # 3F0D LD A, (# 5CFF); LOGIC ; Sector number # 3F10 INC A; transferred to ; Physical # 3F11 OUT (# 5F), A; listed in the ; REG.SEKTORA # 3F13 LD HL, (# 5D00); buffer address # 3F16 LD C, # 7F; data port # 3F18 LD A, (# 5CFE); get COMMAND # 3F1B OUT (# 1F), A; file a port # 3F1D CP # A0; this entry? # 3F1F PUSH AF; hide flag ; Operation # 3F20 CALL Z, # 3FB0; ENTRY - then , Write # 3F23 POP AF;'ll get the flag ; Operation # 3F24 CALL NZ, # 3FCB; That READING - Read and so on ... ____________________________________ Sub-READ SECTOR (second). => # 2ED1 <# 2F1B> LD A, E; logical ; Sector number # 2ED2 INC A; transferred to ; Physical # 2ED3 OUT (# 5F), A; entered in the port ; SECTOR # 2ED5 PUSH HL; buffer address - ; Save # 2ED6 LD D, # 14, the number of times - # 2ED8 PUSH DE; save # 2ED9 DI; # 2EDA LD C, # 7F; data port # 2EDC LD A, # 80; team ; READ SECTOR # 2EDE OUT (# 1F), A; will submit a team # 2EE0 CALL # 3FDB; believe SECTOR # 2EE3 POP DE; correct number ; Attempts # 2EE4 POP HL; buffer address # 2EE5 IN A, (# 1F); all right? # 2EE7 AND # 7F; no errors? # 2EE9 RET Z; out if there is no ; Error # 2EEA DEC D; number of attempts ; Cancel # 2EEB PUSH HL; again hide # 2EEC PUSH DE # 2EED JR NZ, # 2ED9; attempts are not con ; Chilis ... ; Read again # 2EEF HALT; all. ; Attempts to come to an end ____________________________________ Sub-write sectors (second) => # 2D29 <# 2D73> LD A, E; logical ; Sector number # 2D2A INC A; transferred to ; Physical # 2D2B OUT (# 5F), A; entered in the port ; SECTOR # 2D2D PUSH HL; buffer address - ; Save # 2D2E LD D, # 14, the number of attempts # 2D30 PUSH DE; save # 2D31 DI; # 2D32 LD C, # 7F; data port # 2D34 LD A, # A0; team ; ENTRY SECTOR # 2D36 OUT (# 1F), A; will submit a team # 2D38 CALL # 3FC0; write SECTOR # 2D3B POP DE; return the number of ; Torture # 2D3C POP HL; buffer address # 2D3D IN A, (# 1F); all right? # 2D3F AND # 7F; no errors? # 2D41 RET Z; out - if , No errors # 2D42 DEC D; Chilo attempts ; Cancel # 2D43 PUSH HL; again hide # 2D44 PUSH DE # 2D45 JR NZ, # 2D31; attempts have not ; Ran out ... , We write more # 2D47 HALT; all. Attempts ; Ended ___________________________________ Formatting a single track => # 1FC1 <# 1FFD> DI; disable the interrupt # 1FC2 LD A, # F4; team RECORD ; The entire track # 1FC4 OUT (# 1F), A; give the command # 1FC6 LD HL, # 1F7D; address data , Where the ; Number of sectors - Start recording the specified format -=> # 1FC9 <# 2005> LD C, # 7F; data port # 1FCB LD B, # 0A; the number of recordable ; Bytes # 1FCD LD D, 4E; bytes to write # 1FCF CALL 2075; write bytes to ; Track ... and so on, until we write the entire array ... __________________________________ Cyclic ENTRY to the port (C) the number of bytes from 'B'. (Using the subroutine FORMAT) => # 2075 <# 20B1> IN A, (# FF); reading readiness # 2077 AND # C0; END?, ; GATE bytes? # 2079 JR Z, # 2075, no - wait # 207B RET M; yes, the team ; Executed - the output # 207C OUT (C), D; if the gate, then ; Bytes per port # 207E DJNZ # 2075; all the bytes? ; Not - return # 2080 RET; emerge if all _____________________________ SUMMARY TABLE OF CORRESPONDENCE ADDRESSES SUBPROGRAMME TRDOS 1.5 TRDOS 5.3 PURPOSE # 1DFE # 1E3A OUT (# 3F), and # 1FB7 # 1FF3 OUT (# FF), and # 1DFA # 1E36 to determine the cylinder under the head # 1FC1 # 1FFD formatting # 1FC9 # 2005 Format # 2EC2 # 2F0C OUT (# FF), and # 2A09 # 2A53 OUT (C), and # 2D3D # 2D87 IN a, (# 1F), and # 7F # 2F1B # 2F65 recovery # 2F03 # 2F4D search CYLINDER # 2EF0 # 2F3A Track Search # 2ED1 # 2F1B reading sector # 2F0D # 2F57 supply teams of type 1 # 2075 # 20B1 cyclic record OUT (C), D # 28A5 # 2FEB LDIR, RET # 2EFB # 2F45 Track Search # 2F46 # 2F90 initialize SYS TRDOS # 2D29 # 2D73 record sector # 3ED5 # 3EDF OUT (# 1F), and # 3E8B # 3E95 OUT (# 3F), and # 3FDB # 3FE5 reading unit (INI) # 3FC0 # 3FCA recording unit (OUTI) # 3F28 # 3F32 IN A, (# 1F) + message # 3DAB # 3DB5 IN A, (# 1F); AND 02 # 3E30 # 3E3A IN A, (# 1F); AND 04 # 3E59 # 3E63 Track Search # 3F00 # 3F0A record sector # 3F04 # 3F0E reading sector # 3DF3 # 3DFE delay # 3E96 # 3EA0 delay # 3FB0 # 3FBA recording unit (OUTI) # 3FCB # 3FD5 reading unit (INI) 2 * CHAPTER 6 'Magic' files or interruption of NMI In the corporate board model TRDOS (BETA-ROM) provided a button, the so-called 'MAGIC BUTTON ', intended (which was conceived by the author) to copy of the tape programs that can not be adapted to drive the usual methods TRDOS, ie programs involved all the space the computer's RAM, overwritten by the system area of RAM or are powerfully protected loader (the program is introduced tape recorder running, and pressed at any time of the button, the entire region of the computer's RAM is reset to a single file disc. After that, chopped program starts again as if nothing had happened. On the drive are formed as a file named "@" And type, which can run a team TRDOS GOTO "Filename" CODE. The program loads and runs from the right where it is braked by pressing Magika). What is this magico-buttons? Y Z-80 processor has a special entrance, so-called 'Non-maskable INTERRUPT, or NMI ', when applied to that logic zero processor throws its work and moves to address # 0066, as subroutine. In contrast to the first and second interrupts, interrupt NMI could not be prohibited, and the processor in any case when an NMI signal will perform routine at # 0066. That this is the input and involved is the same 'magic button' TRDOS. When you click on it to enter NMI processor fed ZERO. In this same time, this same impulse to switch banks and RPZU includes the address space ROM TRDOS. Circuitry sample MAGIC BUTTON constructed so that the formation of the pulse NMI is working in a range of addresses from the processor # 4000 to # FFFF (this was done specifically to the work of sub-ROMs, as SOS, and TRDOS, it was impossible to stop). Much has been written about this button ... Too many abused her how much in vain, called hurtful nicknames like "monkey", etc. .. But if you still consider that part of good programs that have reached us from behind a hill, opened precisely in this way, then perhaps do not scold her so it is worth To its credit? Yes, the shortcomings of this method to adapt a lot of programs. That and the fact that in the stack area program recorded a huge array of data, and that violated some of the cells of RAM in the system and deteriorates TRDOS screen, etc., etc. But remember that when I was released Controller TRDOS not yet have such programs, which until last byte would occupy the entire region of the RAM on your computer. This is now the program for SINCLAIR write on a powerful 16-or 32-bit machines, and then ... If the modern program dump to disk button, in half of the cases it is hopeless port, and if the program is protection from Magika, then drive may have to re- format. But all the same button is sometimes helpful, and even helps a lot! This opening strongly defended the tape loader, and analysis of complex programs during their work, and much more. And in general, not in the button business, and in the software, oblsuzhivayuschem button. As it was said, pressing the CPU goes to the address # 0066 ROM TRDOS. At this point, there is a command processor 'JP address'. To address this TRDOS 05.01 # 2A0C, and to 5.03 and others - # 2A56. The concept of sub Magika simple: 1. Save the values of all results Giustra processor. 2. Clear the file named '@' RAM area from # 4000 to # FFFF. 3. Reset all registers and return to the prog Rummy. Below is a listing of primary piece routines 'MAGIC SAVE'. 140. ; Start for TRDOS 5.01 = # 2A0C, for 5.03 = # 2A56 PUSH AF; retain a core set of ; Register PUSH BC PUSH DE PUSH HL PUSH IX; as well as index registers PUSH IY EXX; keep a second set ; Register PUSH BC PUSH DE PUSH HL EX AF, AF ' PUSH AF LD A, I; interrupt register PUSH AF LD A, R; register update PUSH AF LD HL, # 0000 ADD HL, SP; keep the last one in the stack ; 'Stack pointer' , And the last value of the decree ; Telja stack ; Then exhibited at the title ; File, as PUSH HL; STARTING ADDRESS LD A, # 3C; further initialization is ; Controller OUT (# FF), A ............ 2 Next the program saves part of the screen at 9, 10, 11 and 12th (!) sectors of the zero track (so that's where you want to empty sector on the system track) and rewrites the screen service information (and thence lines on the screen during recording Magika). Screen-saving information can then be rewritten in the Magik file. Thus, the actual program screen does not spoil. After writing the file routine returns the interrupted program, tentatively returning from the stack all the register values microprocessor and screen pieces. On the drive remains the same file name '@', type 'CODE' and with a volume equal to # C0 (192) sector. Start address of the file indicates the address of the bottom of the STACK program, and the length of the program bytes can be arbitrary, and this case does not play any role. The name of the file can then be given by any, but with one proviso. If the program is discharged worked in the SECOND interruption processor, the program name should begin with '$'. By this symbol during startup magico-file TRDOS recognizes what kind of interrupt set in a downloadable program. Starting magico-file produced from TRDOS team GOTO "filename" CODE By the way, komanda 'GOTO' is not distinguishes the executable file belonging to the 'Magik' type. You can give the command 'GOTO' and ordinary file and see what will ... So if you have File 'Magik' a lot, it's probably worth for them to have a separate disk that prevents misunderstandings (program 'Crackers' recognize Magik file Directory largest # C0, <volume occupied sectors>, and only Such files are run as Magik). Starting magico-file is in the following order: first loaded 27 sectors of the screen, and then all the rest, using RAM screen to boot. Once the entire file read, the routine takes the ROM file header number 'STARTING ADDRESS', enters it into case 'SP' and teams POP begins to fill in all registers Data from the stack in the order in which they persisted in creating Magik file. At that same moment, analyzed the file name to a symbol '$', And if it is present on First place the name, program exposes IM2. And in the end all, the team 'RET' launches. Some interest is the way in which routine TRDOS determines whether you are PROHIBITED interruption at the time of stopping the program. Here's how: , The definition of allowed or disallowed interrupts POP AF; return value of the register ; Interrupt ; And flags register value ; Trigger IFF2 processor LD I, A DI; to start the ban interrupt JP PO, addr; check trigger IFF2 and if ; IFF2 = 1 (parity flag) , Then give the command INTERRUPTION ; Allow. ; And if IFF2 = 0 (odd), then ; INTERRUPTION BANNED. . . . . . . (Who has no idea that such a trigger and IFF2 IFF1 microprocessor that can read about it in a book A. Larchenko and Rodionova "ZX SPECTRUM for programmers and users "). One could go further and analyzing the contents of the register "I" microprocessor, to determine what kind of interruption was program at the time of pressing Magika (initially register 'I' is # 3F, and if not, then 90% of cases at this point in program established interrupt two). But this method is not 100% reliability, and the final decision about the type of interruption is for magico-punchers BUTTON. Most of the modern game programs IRQ two, and if after the launch 'Freshly baked' magico-file (Without the symbol '$' in the name) something goes wrong, or does not - therefore, put in front of the name file icon '$' and run again. If after this program to want to work, then your Magico-button zaportila stack of program or a cell RAM Address # 5C00, and more. Try to reset the program to another time her work or when the program is in the menu. In its work program Magik irreversibly damages several cells in the RAM area system variables TRDOS, for example cell with address # 5C00, # 5C01, etc. So that protection from Magico-relief program may are built on a survey of values of these cells. There is already a lot of programs, utilities, which are easier to work with MAGIKfaylami. This software package "@-CRACKER", which allows MAGIKfayl not only view, but also show the value all saved registers and stack trace on the screen, edit, magico-file and divide it into 3 files with automatic recording to disk BEYSIKzagruzchika, which loads and runs separated parts. This and the program "MFC v1.4", which magico-compresses the file and writes it as a single block with a BASIC loader to disk. And much, much more. You can argue long and tedious and talk about the dangers of Magik button. Ator the book leans toward the fact that in most cases Magik - is harmful. Harm not only program but also to the user who clicks this button ... But, as the saying goes: "If you can not, and really want - then we can." Could be in this place and close this topic, but some readers have a question: "Is it possible to make Magik did not spoil the program? "Yes. To do this you will need to reprogram the ROM TRDOS another sub, which should take into account all the shortcomings of the existing one. Namely: - The native stack discharged program should remain one or two values - it registers 'SP' and 'PC'. - Working the stack to preserve all other registers must be overridden on a screen (to the detriment of the image), or (Preferably) in Shadow RAM. - Do not be affected by any cell of RAM, except for screen or in the shadow RAM. Although it is also not an option! You can go the other way and programmed ROM for SOS save Magika on tape three or four pieces (for this objective fit and shadow RAM, the who it is). The only thing necessary do for this - cut off wire coming from circuit Magik Button to the node that switches ROM chips, so when you press the button you have remained active ROM SOS. And, of course, write a program loader, which is then downloaded to the pieces and run the program (by the way, Owned like this' tape Magik 'were opened and initially highly secure' branded ' program on tape. In some modern (nashenskih) controller model magico-button tied up to the challenge of Option ROM program 'Monitor-debugger', which allows you to quickly change something in the program and stopped burn it to disk. That's really truly: "Necessity is the mother of invention!". And on some models, controllers, magico-button non-existent. Well, too "wise" decision. Do not like it Some developers and all here. *
Other articles:
Similar articles:
В этот день... 21 November