Adventurer #05
30 ноября 1996 |
|
Obmen experience - Some features XAS'a. Passing parameters to the program from the command line.
ATTENTION: ADVENTURER N4 article "Sharing experiences" made a mistake! Correctly should be as follows: ROM routines to work properly in the 128-meter mode, you must reset the 4-th bit peremennoy FLAGS (23611 / # 5C3B). The editors apologize to readers for inaccuracies. (C) Cav inc. Some features XAS'a Attention! It's about XAS'e in which is not listed version, but just given the copyright of the author showing in 1996 The first feature XAS'a, noticed me - that after-JEMMINI COMMANDER and, say, sealing drive startup XAS'a loaded text, which was the last to edit. (But not always). The second feature is that when you run your program, you can both want to "spoil" 3,4,5,6 and 0 memory page, and you can even 7 (if you STS is not needed) - your text is not "die" when output back to the XAS, it is to load a disc. (Tip: Save before you start text on disk). The third feature is that the instruction LD (adr) Assemblée is interpreted as LD (adr), BC. The fourth feature is not related to XAS'u and to STS 3.2, which came to me with XAS'om on the disk, it has a name: "Xsts.C". Feature is the button [C] - it causes a directory of the drive. AND more: in this version is made to trace desired address, and not by the number of commands. From the Editor: Another, unfortunately, unpleasant feature is that no control - whether to keep the working file before starting or loading a new disc (there are, of course, color display, but after assembling it shows incorrect information). On the question of transfer options in the program from the command line What is the usual way to run programs from a disk in the TR-DOS? Correctly, using boot'a. In any case, 90% of all launches. Parameters of the same program requests after launch. But I would like to specify the parameters or data for the program during the run as this is done in MS DOS or RT-11. Long time, I did not know how to implement it (or rather, it was not necessary), and that once decided to solve this. What came out of it - read below ... The first idea kotoraya comes to mind - is to use the clipboard editor line (pointed to by the E_LINE). Topics more, a set of command line TR-DOS'e it is used. The idea was good, but impossible, since this buffer overwritten when loading BASIC'om. About two days, I racked my brains and pestered to all coders familiar with the issues .. Scratch INSULT, but what I'm there nakovyryal I was not needed. It was found that the presence of anything after the file name was determined by last character. That is, the string should be long enough. Deliberation this question, I found a solution, but it turned out not very handy thing (in terms of length). To get everything working, had to write the shortest possible downloaders, with this text: 10 RANDOMIZE USR VAL "23883": REM ... After REM came the following code: LD HL, ADDR LD DE, (# 5CF4) LD BC, # nn05 PUSH HL CALL # 3D13 RET here ADDR - address code boot Block, nn - number of sectors. Even with such a short BASIC-file had the command line to fill fifteen (!) extra characters (unnecessary) and only after they have already let the information you need (in my case it was the name of the file). Here's a story came out. In light of the foregoing, we conclude that running a program with parameters from command line will not receive wide distribution. Do you know what RST 16 (# 10)? Of course - to answer beginner coder, it is routine printing character whose code is placed in register A. And he will not right! Or imagine the reaction of the same novice hacker when he climbs in, say, the program LIST III (by GDC) and with trepidation discovers that a RST 1916 to print fonts, wide four pixels with the distance between the letters one pixel! What will be discussed below, is ordered materials, so that all who consider themselves cool hackers and coders, it can not read. The use of channels in the programs Generally, information on the question can be found in the publications "Inforkom" 'Yes. But not all of them there, and says there is not always clear. So, after turn the machine defined by the four standard channels. The number of channels is limited only the size of RAM. Scope of channels located in front of the domain, and BASIC on it (The region of channels) indicates that the variable CHANS (# 5C4F). The concept of channels is an important role in Spectrum'e. The whole character I / O going through the RST # 10 on the most case goes through the channels. Therefore, if you picking someone else's program, we saw that let's print a 64 character goes through RST # 10, or alternatively through the restart is done at all, almost all, then do not panic and do not dig frantically PZU'shku! Just in this program of overriden feed. Overriding the channels of their discretion sometimes gives a significant advantage in the job. We now turn to a deeper consideration. Standard channels are sufficiently simple structure: Length (bytes) Name Comment 2 proc_out - address of the procedure O 2 proc_in - address of the procedure I A name chanel - channel name Addresses procedures for entry (proc_in) y all the standard channels, except channel "K" installed on the # 15C4 (RST # 8), ie Printing error message "Invalid I / O device ". The channel" K "(the bottom of the screen) proc_in pointer points to the # 10A8 (Key-INPUT). If you are going to change the address and proc_out proc_in of standard channels, keep in mind that some Team BASIC'a in its implementation of the standard channels are initialized to the value of the ROM. Therefore it is desirable to create Your channel and do with it whatever your soul. The literature says that Only the standard channels have a length of 5 bytes, and if the user has decided to pervert, then he needs to take a block information about the channel not less than 11 bytes. Been audited and found that quite enough, and five (if the device I / O does not block). Its own channel, you can create the following way: LD HL, (PROG); sist.perem. # 5C53 ; (Early BASIC) DEC HL; LD BC, len; length of the reserves ; Fix area CALL # 1655, s / n MAKE_ROOM INC HL; channel address LD DE, adr_data; address your data ; GOVERNMENTAL Channel EX DE, HL; LD BC, len_data; length of the data , Should be equal ; On len LDIR; ... adr_data DEFW print_my; address proc_out DEFW input_my; address proc_in DEFB "E"; channel name This way you get your channel, but it should still connect to the stream. Flows of 19 and can not be greater. K stream must-subscribe if you are going to use the RST # 10. Region information flow takes memory Address # 5C10 to address # 5C34. Under each flow allocated two bytes. If the data stream contains # 0000, this means that this flux is not plugged. To to connect the channel to the desired flow you need to stream data to the beginning offset of the description of your channel from the beginning of the field channels. It does not sound very clear, but in reality everything is simple and is calculated by the formula: adr_my_chanel-adr_begin_chanel +1 Here adr_my_chanel - your starting address channel; adr_begin_chanel - the start address of region of the channels. Open channel can easily be much more difficult close it. No, if the last channel, then no problems, but if you are going to remove channel description, for example, the penultimate, then you have to tinker. That is: turn off the flow, move the end of the field of channels in the lower side, move BASIC and everything above it to RAMTOP'a, Calculate the offset in flux for the remaining channels. But do not be afraid, do not is really a complicated matter. By the way, due to the fact that the region of channels is after the system variables (such as SOS, and DOS), you can create self-running disks (ie, the commands CAT, LIST, etc.). A occurs this way: when processing komadny CAT, LIST and others to address # 5D25 formed a temporary buffer to read the eighth sector for product configuration to disk. Standard sector TR-DOS'a have 256 bytes, so it is a number assigned by the buffer. But VG93 can read any sector (128, 256, 512 and 1024 bytes) and if the time sector more standard measures, the remainder of the sector runs into the domain of the channels. After this, TR-DOS, suspecting nothing, trying to type "OK", as well as in our data on the channel is not what should (or rather, if the disc auto), then there is a transition or being in this sector is also considered the procedure of loading or "Ahun" (a concept "Ahun" explained the works of F. Karsak / ca. Editor /). In light of all above, it becomes clear the behavior of TR-DOS when you try to look directory MS-DOS disk (512 bytes per sector). And so same as running a start-iS-DOS. In fact, using the concept of overriding feeds, you can do pretty entertaining stuff. So, I'm up to the appearance of my STS 4.1, received text disassembler programs (others) with the following way: I opened a file sequential read access: (OPEN # 4, "NAME", W), Overriding printer n of m on to (Stream # 3) on the newly opened stream in file (POKE 23580, PEEK 23582: POKE 23581, PEEK 23583) sinkers MONS, then block codes entered into MONS, and gave the command "output disassembler unit to the printer "out of MONS'a, closes the file (CLOSE # 4) and got ready to use text in ASCII format. That's, like, and all I wanted to say. Whoever does not understand, you can write a letter with specific questions it's not clear. Used Books: Yu Pomortsev "TR-DOS for professional channels and fans " "Inforkom" Three Volumes of the chart. Volume Two of "Applied Graphics "Inforkom" ZX-Revue 1991 (C) RAY
Other articles:
Similar articles:
В этот день... 21 November