ACNews #02
08 июля 2001 |
|
Programming - the command line TR-DOS.
- - - - On the command line | I do not remember when, but I have already offered to echo this way. More He casually described in the ZX-Guide # 3. He concludes that to facilitate interaction between the programs themselves, they will use to call each other command line type: RUN "prog", parameter Command Line E_LINE - is predetermined by the system a place to store such parameters. Logical, in my opinion, not come up with. A comma as a separator chosen for the community already existing commands with multiple parameters and our challenges. In this case, TR-DOS little interest in the contents of the command line after the comma. In AC Edit 0.5S through a line you can specify the name of a loaded fayla.Poskolku possible extensions of the files are not exhausted by the standard TR-DOS extensions, I decided to do without any kind of points and quotes - just specify the name of 9 bytes with one word written by the extension ... Implemented this way: LD HL, (23641); address kom.stroki E_LINE LD BC, 7; the first 7 bytes kom.stroki known to bungle ADD HL, BC LD A, ", CPIR; looking for a comma (because we do not know how many letters ; User typed in the title of our program? ;))) JR NZ, notFND LD DE, 23773; TR-DOS file descriptor LD C, 9 LDIR LD C, # A; "search catalog item" CALL # 3D13; looking to 9 bytes, because usually (23,814) = 9 LD A, C; obtain the number of directory entry INC C; C = # FF means that the file was not found JR Z, notFND LD C, 8; "reading directory entry" CALL # 3D13 And now the handle at 23773 Old contains about the right file! ; What to do next, now depends on the specific program: LD HL, 23773 CALL PRCDESC +3 CALL EXTLU JR OK notFND ... ... OK ... If you really run the program through the TR-DOS, then (as found) TR-DOS few converts the string in its taste: replaces strings, similar to BASIC tokens, the tokens themselves. Thus, it is impossible to perform through the TR-DOS command such as: RUN "ACEdit5S", AlCoNew2p And so, you can: RUN "ACEdit5S", AlCoNws2p Of course, I am aware that no one program is being in his right mind would not ship another via the command line TR-DOS. Usually all this happens through protsedurku run BASIC file, such as the one that was written BASIL'om (ZX-Guide # 3) LD HL, # YYYY; 16 BYTES INFO LD DE, 23773; ABOUT LD BC, 16; BASIC FILE. LDIR LD A, # C9 LD (23746), A LD HL, RNBASIC PUSH HL LD DE, 23448 LD BC, END_COD-RNBASIC LDIR LD HL, 10072; FOR EXX; OUTPUT LD IY, 23610; In IM 1; BASIC. EI RET RNBASIC DISP 23,448 LD HL, 23867 LD DE, 23868 LD (HL), 0 LD BC, 41668 LDIR; Purification of the 48 th MEMORY LD A, # 38; PAPER 7 LD (23693), A; 'INK 0. LD (23624), A; and two lower line of the screen are the same. LD BC, 65167; CLEAR TO 65167 CALL 7863, and the maximum length of the file. LD HL, 4867; CONNECTION PUSH HL; LD (23613), SP; LD HL, (23631) 48-GO LD DE, 15; ADD HL, DE; LD DE, 5566, BASIC EX DE, HL; LD BC, 4; LDIR; SB 128-TH RES 4, (IY +1); LD HL, 7030; PUSH HL; MEMORY. LD HL, RNBAS2 PUSH HL LD HL, 10608; PUSH HL; LD HL, 10528; PUSH HL; LOADING. LD HL, 10570; PUSH HL; JP 15663; RNBAS2 LD HL, (23649) LD A, (HL) DEC HL LD L, (HL) LD H, A LD (23618), HL; STRING Auto XOR A; Performed LD (23620), A; 1-st TEAM. RET ENT END_COD So, nothing prevents us to launch this form command line, consisting of a comma and the file name, and stick to E_LINE (23,641), its address (or rather, the address of 7 less)! | - - - - ------------------- As a dry text;) If you really want to get the source code from the previous article, we have to remove the control characters. Method # 1 (lamersky): We go to the Find / Replace and type in the "Enter what to look for a" symbol of white (SS / E, 7) Input in the field and what to replace the "symbol probela.Nazhimaem Enter. See: Replaced OK. Continue the same for the yellow, green, etc. flowers:))) Method # 2 (kodersky;)): Maaalenkuyu write a program that does the same thing, perekodiruem through her text, and then erase the program;))) The result can be given at the mercy ALASM 4.42 ... -------------------------------------------------- -------------
Other articles:
Similar articles:
В этот день... 23 November