Inferno #05
30 апреля 2004 |
|
For Coderz - autobuild program. Optimize the assembly process.
Automobile assembly program A lot of prejudices and poor decisions in such a seemingly natural and long mastered the problem of how assembly programs. By itself, the assembly phase cases not even for every program (Eg, for such I may say, software, on what learning to program, and he does not need one), but the need to release versions of the series, he becomes one of the questions most waste of time. A single assembly is traditionally carried out by discharging stored after compilation (chunks or sploshnyakom), and then received blocks packed by hand in arbitrary compressors, and then sutured to a packed program of any known BASIC loader. Way so traditional, that appeared relevant function (unloading blocks and gluing) in the Many assemblers - the first - and Commander - for the second. However, even such seemingly, automation does not prevent time-consuming. In practice method is comparable with manual discharge STS'om and manual correction of the same directory in it - at least, the various programs rarely want to download. Detailed explanation (of the traditional assembly). Builds the project was originally expected to being in a form suitable for zapuska.Delaem debug it the following Added: addresses beginning and the length of the terminal block assembly directive DISPLAY; if possible, it is best to collect all the blocks in one block, and the program during startup should flip their LDIR'om (LDDR'om) on the right places, and the address is supposed to be running too directive DISPLAY. That is so that after all the necessary addresses ASSEMBLE light on the screen, where they can sleep write down on paper. ASSEMBLE after all these blocks need to save through STS (click S), or through DOS (SAVE "..." CODE ...,...). Next computer must be reset to load kompressor.Etim compressor need to pack blocks (all - with the unpacker, if we are talking about the traditional way). It remains to form a BASIC loader, which has two main options - one-piece and made pofaylovyy.Pofaylovy entirely in BASIC: CLEAR: LOAD, LOAD, LOAD, then USR + USR + USR ... here and there, perhaps, OUT 32765 ... Just keep in mind that between OUT 32765 and relating to this page LOAD'om (or USR'om) should not attend any other operators - or 128 BASIC can switch the page but the reverse. Monoblock loader contains only (Optional) CLEAR, USR, and (again optionally) REM, with plenty of gaps. In these gaps STS'om fits loader code type LD DE, (23796) ... CALL # 3D13. Recruit a boot rather tedious. Unpleasant as the fact that after keeping the boot disk must copy after all the related it zipped files. Then the program Global Commander (or any other in which you may have to copy them) files are glued to the candy bar. To a large failure, Perfect Commander 1.52 from the Gluk Reset Service v5.4R glues files wrong. In Gluk v5.5RR it fixed. The positive side of monoblock loader and that he is shorter. And restrictions on the inclusion of pages already No, especially if the reinsured team LD (IY +1), # CC (in any case, it is established that this team does not give IM 1 port # 5bxx). Incidentally, it was in it, so the loader can provide a general unpacking of all code blocks. Convenient, for example, the classic DEHRUST for Hrust 1.3 - This depaker weighs exactly one sector. Monoblock program with a total depakerom You can reduce and even stronger if all compressed blocks glued byte to byte. This de barks already in assembly language: LD HL, pack1 LD DE, depackto1 CALL DEHR LD HL, pack2 LD DE, depackto2 ... DEHR INCBIN "DEHRUST pack1 INCBIN ... pack2 INCBIN ... ... Do not forget! Memory at startup is not necessarily clean, not included necessarily page # 10, and more! End of explanation. What is this said assembly STS'om? Originally it was unloading code blocks without packaging (with the address to peek into assembly label) after the first copy BASIC-unit - for example, over the old building of the same programmy.Beysik block would have to download as a sector change in it that has changed (such as your start-up program) and keep on top again, as a sector. This Release inconvenient for distribution, but is going very quickly - for example, for testing. Detailed explanation (of the assembly STS 'th). After assembly and write addresses at the paper exit in STS; load through Menu BASIC loader old release project (Note: make sure your old and new releases coincided total size blocks!). If the starting address of program or anything else has changed, perform the following sequence: Download Sector BASIC loader again, by substituting numbers with ssL sector 1 (boot size) less than the current, correct the necessary bytes in it, save through ssS surface, again reducing the number of sector 1, as it was (because it increased again after load operation). In any case, the "current sector" in STS'e now will point to the sector after BASIC. Further through ssS from memory one by one unloaded all code blocks. Non sector-track update is no longer necessary. Release is ready. Variation: Sticking in the memory of all the blocks and beysiksektor including thereafter.This program as CODE. Next ship directory through ssL, correct extension to B, and Start and Length the length of the BASIC loader then unload the revised directory (STS as a disc doctor). Variation with packing: Forming a ALASM loader with INCBIN'om compressed files, navrode that specified In the first "detailed explanation". The same bootloader is entered all BASIC-block rewriting it byte-per-byte, even # 80, # AA, X, X at the end; compile this BASIC We are not in his usual address # 5D3B, and for the sector over the other blokami.Snabdiv loader DISPLAY'ami and saving, we convenient, but not perfect, the way the multiple bonding through the STS (in the very variations), in packaged form. End of explanation. Such an understandable way is often used and ya.Odnako it smoothly I'm tired. For a long time I spent on the simplification of the problem by parts. 1. Set when the program starts from assembler (without assembly) under the same conditions that and running compiled program. 2. Save blocks without manual Barge lstva. 3. Packer run without manual instead Invasive. 4. Configure Basic-block automatic ki. 5. Pasting blocks of the program without exiting in the Commander. 6. Automatically run the collected program. Automation, I began only in 1999. First decided to task 4 of the BASIC-bloke.Poskolku ALASM allowed him to compile along with the main program, all the right numbers can be configured at compile time through the substitution of the tags. The resulting loader was unloaded as sector. A complete set of variables operating systems that had to adjust to save BASIC conventional means, I found later. This proved to be variable 23649, 23651, 23653, 23641 and 23627. Yes, BASIC as a sector can unload without these intricacies. However, wisdom needs while maintaining a DOS window or appropriate subroutine of the DOS (function point # C # 3D13). And, unfortunately, these actions are necessary to restore operating system state at the time of starting the program, the problem number one. And this not all. Remains to be done CLEAR. For this serves as a subroutine with a parameter in 7863 BC. By the way, she moves the stack that important to consider and should not be forgotten. And then You can debug, and look for a mistake for life :) All the questions start BASIC files decided maaalenkaya subroutine, found BASIL'om and published in the ZX-Guide #, it seems, 3, or in the AlCoNews, where he wrote on the command line. This can autostart insert and to download Hrust (Rip), and Launch collected their program. However, second if not first:) Avtosborschik of itself is organized in source file for tak.Adres RUN (Last ORG programs) rather than address the very start the program is installed, for example, # 5B00, where garbage is placed. The collector is activated when the program starts, say, with Caps Shift'om. (You can use conditional compilation, but it is, I think, not better.) Without the Caps Shift just a debug program is launched. However, if convenient, It can be done specially for the debug run any changes navrode Released in ALASM instead of output in DOS, to taste. In the same branch autobuild program, of course, should not be changed - it must remain exactly in the form conceived. The trouble is that in Hrust'e (which Rip) buttons to push, however, it is necessary. The first major packer, officially published in the sources, was how we remember, Hrust 2.x. It is this algorithm I started to use instead of bulky compressors with an interface. Benefits Tamed compressor avtosborschike obvious. Tamed compressor can be stored and in the form of a code block, not compiling each times. After all, the problem was only in the presence of interface, which is absolutely not necessary, to pack the unit with the address N of length L in e M, where L, M and N are known and entered into in the label. Automatically save blocks (wrapped) and glue the project when compared with all passed is quite prosto.Blago even DOS functions are provided for all correct, except for gluing monoblokom.Monoblok, alas, have to create Directory iskusstvenno.Ili change in the number of files, or changing the length of Basic and free diska/1-go free sector - while retaining the blocks are not files. At this decision I am, so to speak, and it remains novilsya. Here, for example, looks like avtosborschik ACEdit: ORG # 7000 mk IFN usePG4; if part of the editor LD HL, lDIRME + LDIRLN-1 page LD DE, DDD-1, then transfer this LD B, 'LDIRLN +1; part to the Editor LDDR; but when you start it will transfer ENDIF LD B, # 6F; BC = # 6Fxx CALL 7863; CLEAR BASIC IFN? Make; if not defined label make CALL 8026; survey of CS (CS = assembly) JR NC, maker; CS pressed JP SUDA; just debug launch ENDIF maker; actually here and collect , The assembly is used by more powerful ; Packer that already exists in the editor: LD HL, HR24; there was a packer LD DE, # 4000; here it should be LD B, 6; its size LDIR; toss it back into place LD HL, END-1 LD DE, -1 LD BC, END-DDD + LDIRLN PUSH BC LDDR; toss code at the end of RAM POP HL CALL # 4000; call wrapper LD HL, (KUDA +6); length upak.fayla PUSH HL DEC HL; seek length in sectors INC H; (see sketches in ZG # 3) LD A, H IFN prn; if your printer is supported, INC A; loader loads at 1 s more ENDIF LD (secsz), A; substitute in the loader ADD A, # C1 LD (drvphysH), A; but here loader ; Find the printer driver LD C, # 12; del - delete CALL # 3D13; old eponymous ACE LD HL, 1 LD (# 5CD1), HL; autostart with LINE 1 LD C, # C; savB CALL # 3D13; store BASIC LD HL, # 7100 LD D, L, E, L LD BC, # 905 CALL # 3D13; ship the system track POP BC LD HL, KUDA +8; address upak.bloka DEC BC; recalculate the length of a size INC B; (sectors) LD DE, (# 79E1); first free tr / sec LD C, 6 PUSH BC CALL # 3D13; keep upak.blok POP BC LD HL, (23796) LD (# 79E1), HL; first free tr / sec LD HL, (# 79E5) PUSH BC XOR A LD C, B, B, A SBC HL, BC LD (# 79E5), HL; adjust free LD C, # A; find CALL # 3D13; looking № file on disk LD L, C; here is the file number of our ACE INC L LD H, 7 DB "))))"; multiplied by 16 INC H; added 1: # 7100 + (C +1) * 16 DEC HL, HL, HL; HL = # 7100 + C * 16 13 POP BC INC B, B; +2 sector under BASIC LD (HL), B; sector size BASIC ; Record amended directory LD HL, # 7100 LD D, L, E, L LD BC, # 906 CALL # 3D13 ; Such as initializing the interpreter , 48 BASIC, if you have enabled 128 BASIC LD HL, 4867 PUSH HL LD (23613), SP; ERR_SP LD HL, (23631) LD BC, 15 ADD HL, BC LD DE, 5566 EX DE, HL LD C, 4 LDIR ; These semiconductors such as cargo BASIC LD HL, RNBAS2 PUSH HL LD HL, # 2970 PUSH HL LD L, # 20 PUSH HL LD L, # 4A PUSH HL JP 15663 RNBAS2 LD HL, # 6E01; was there ", acn # # p" LD DE, (23641); E_LINE LD B, L LDIR; form the command line JP EEE; launch the ACE com. string ORG # 6200; preinitsializatsiya assembly LD HL, WASBAS LD DE, # 5D3B LD BC, 512 LDIR; basic flips into place LD (IY +83), B; set black LD (IY +14), 7; screen (for beauty) CALL ROTFONT; convert fonts JP mk; the transition to self avtosborschik Please note that the final its version avtosborschik includes only part of the startup procedure BASIC (ZX-Guide # 3). The full procedure was not needed because memory is allocated (7863 = CLEAR), and address of the start code (EEE) is known. The very BASIC: ORG # 6000; for mkace WASBAS DISP # 5D3B , 1 RANDOMIZE USR EEE DW 256, BASIC-4, # C0F9, # E30, 0, EEE ... DS IMER-$; IMER = # 5D5D ; Hook - also in BASIC RST 1956 ... ; Depaker Hrust2.x without transferring the block , Because without a title packed with code (8 bytes) Hpush PUSH DE LD DE, 6 ADD HL, DE PUSH HL EXX POP HL, DE ... , Hence the run loader: EEE LD (IY +1), # CC; not zaportit # 5B88 .. LD SP, # 7000 ... LD HL, # C000; ACE weighs <64 sectors PUSH HL secsz = $ +2; number of sectors, sector + driver LD BC, # 3805 LD DE, (23796) CALL # 3D13; download ACE + driver XOR A ; HALT; will be a place - insert:) OUT (-2), A drvphysH = $ +2; address of the driver in memory LD HL, # F801 LD DE, # 5C01 LD B, L, C, L LDDR; transfer printer driver LD H, 87; address in the screen (chistom!) LD B, 4 LDDR; reset attributes POP HL; # C000 (pack-of the screen the ACE) WasAdr = $ +1; depends usePG4 LD DE, DDD-LDIRLN CALL Hpush; decompress ACE SUDA IFN usePG4; if not the 48k version CALL OUT4; page with a piece of ACE ENDIF LD HL, ONERR; set the address LD (23747), HL; Rec-ki errors DOS CALL DEPK64; Expand font JP ini; start ... ENDLOAD ENT Behold the variables indicating the length of the BASIC ORG 23649 DW ENDLOAD +3 DW ENDLOAD +15 DW ENDLOAD +15 ORG 23641 DW ENDLOAD +1 ORG 23627 DW ENDLOAD ; Here should be based on the name of the BASIC ORG # 5CDD ; V1, v2 - version number DB "ACE0.", V1, v2, "B When I first showed this avtosborschik the people, I had to make the program "mkace", which itself loads the assembly and presses the button for the user. Hence the availability control tags make. Please note that BASIC-block is formed not by working at # 5D3B. This also provided for mkace, as her routine to intercept the key, too, is in BASIC. Font flipped during assembly and takes place when you start the editor - solely because he is a twisted a packed better. But Hrust2.x, being a relatively good packer (fast, for example, and short), is packed between relatively weak. Based on just then write RAR'a engine and parts unpacker RIP Petrov's novel, I realized its wrapper specifically for the automobile assembly, called mRIP. His depaker butt occupies the region BASIC, which eliminates the need to think a head like that BASIC should look like. However, Georgia and unpacks this BASIC loader only one blok.Dlya toys mRIP use, so it is difficult - Except that to load additional components of the intro (the very intro download loader mRIP). But for the software programs that fit into low memory, mRIP good. Have in mind, Pro Tracker them to pack more You can, but BGE is no longer possible. However, through "Intro" - is also possible. A ACE simply must quick run! Similarly mRIP'u I did and universal avtosborschik m2hrust. It is shorter and faster, but loses in the amount of collected Program 3.1 sector. Sometimes it is not clear why the program is collected mRIP'om, hang? In all cases, it turns out I forgot to install the stack:) A. Encoder
Other articles:
Similar articles:
В этот день... 21 November