diff --git a/data/common/HD_load/9x2klbr/LDKLBR.VXD b/data/common/HD_load/9x2klbr/LDKLBR.VXD new file mode 100644 index 0000000000..5fba35d0b2 Binary files /dev/null and b/data/common/HD_load/9x2klbr/LDKLBR.VXD differ diff --git a/data/common/HD_load/memdisk b/data/common/HD_load/memdisk new file mode 100644 index 0000000000..62b8f0e1f9 Binary files /dev/null and b/data/common/HD_load/memdisk differ diff --git a/data/common/games/fara b/data/common/games/fara new file mode 100644 index 0000000000..70b3056f2e Binary files /dev/null and b/data/common/games/fara differ diff --git a/data/common/games/fara.gfx b/data/common/games/fara.gfx new file mode 100644 index 0000000000..f0309b5402 Binary files /dev/null and b/data/common/games/fara.gfx differ diff --git a/data/common/games/fceu/ChangeLog.txt b/data/common/games/fceu/ChangeLog.txt new file mode 100644 index 0000000000..37febc734d --- /dev/null +++ b/data/common/games/fceu/ChangeLog.txt @@ -0,0 +1,2183 @@ +0.98.12: + + Win32: Fixed the behavior of the sound logging function. + + Fixed a bug that was causing 2xscale/3xscale to be broken + when clipping the leftmost and rightmost 8 columns. + + Added an iNES header correction entry for JustBreed. + + Modified the MMC5 "ELROM" board emulation to not emulate WRAM. + + Corrected various pieces of code that were causing compiler warnings. + + Win32: Scaling settings(x, y, stretch to fill screen) are now respected while + using a special scaler in full screen mode, though if x or y scale is + less than what is needed for a particular scaler, it will be + adjusted. + + Win32: The window will be reblitted when it becomes invalidated while + a game is loaded(such as when you're resizing the window). + + When the PPU is in a "dead" state after starting up, the graphics + buffer is now cleared. Previously, particularly in the Windows port, when + a game was closed, and a new game was loaded, the last image from + the previous game would be displayed for a short time. + + Win32: Blit skipping will now occur when sound is disabled and FCE Ultra is + running behind the desired frame rate. + + Win32: Blit-skipping behavior can now be configured to some extent in the "Timing" configuration + window. + + Win32: Added a "Recent Directories" submenu to the "File" menu. + + Removed some debugging code that shouldn't have been enabled in 0.98.11. + +0.98.11: + + Win32: Special scalers are now also supported in windowed mode. For Scale2x/Scale3x, + the fastest "desktop" bit depth is 16bpp. For hq2x/hq3x, it is 32bpp. + + The shared video blitting code(drivers/common/vidblit.c) can now blit using Scale2x + and Scale3x to any target bit depth(8bpp, 16bpp, 24bpp, and 32bpp) instead of just + 8bpp, as it was before. + HQ2x and HQ3x can now blit to 16bpp, 24bpp(untested), and 32bpp. The 16bpp and + 24bpp targets are done doing post-processing conversion, after HQ2x/HQ3x, which + really does hurt speed. + + Changed a few names in the credits section of the documentation to their + aliases. Names you didn't get to pick to have are so troublesome. :b + I also made various fixes/updates to the documentation. + + Updated the FAQ with some information regard video mode bit depths and speed. + + SDL: Disabled the fast-forward-key speed-limiting code. I thought I had + done this before... + + Fixed a major bug in the movie recording code, and added some code to automatically detect + and fix playback of broken movies from earlier versions. + + Did a little swapping thing with mapper 90 and 209. I moved back Mortal Kombat 3 + to mapper 90, and moved Shin Samurai Spirits 2 to mapper 209. Sorry for any confusion. + Mapper 90 should be considered as having the fancy nametable select mode disabled, with + mapper 209 having it enabled. + + Added support for mapper 160, which turns out to be the same hardware as mapper + 90. Joy. + + Improved mapper 90 emulation. This mapper really needs low-level + emulation for IRQs to work right, though. :/ + + Win32: Fixed the "hide left/right 8 video columns" feature. + + Since FCE Ultra is ending(or has already exceeded? :b) its actively-updated life, + I've gone ahead and added per-game hacks for "Kick Master" and the PAL version + of "Star Wars". See the documentation for more details. + + Minor optimizations to the high-quality sound emulation code. The FIR filter + code is the bottleneck, though, so these changes won't have much of an effect + on overall speed. + + Altered MMC3 IRQ emulation(and the hooks in ppu.c for it). + + Fixed a rather major typo in the VRC7-emulation code. + +0.98.10: + + Reimplemented network play. It now requires a standalone network play server, which + will be released as a later time. For fun, "starmen.net" is running this server, + which is publicly accessible. + I also made various code fixes/improvements to allow for network play, particularly + with the command handling code. + + Reworked much of the VS Unisystem emulation code, partially based on information from + MAME. The following games are now supported: + + Battle City + Castlevania + Clu Clu Land + Dr. Mario + Duck Hunt + Excitebike + Excitebike (Japanese) + Freedom Force + Goonies, The + Gradius + Gumshoe + Hogan's Alley + Ice Climber + Ladies Golf + Mach Rider + Mach Rider (Japanese) + Mighty Bomb Jack (Japanese) + Ninja Jajamaru Kun (Japanese) + Pinball + Pinball (Japanese) + Platoon + RBI Baseball + Slalom + Soccer + Star Luster + Stroke and Match Golf + Stroke and Match Golf - Ladies + Stroke and Match Golf (Japanese) + Super Mario Bros. + Super Sky Kid + Super Xevious + Tetris + TKO Boxing + Top Gun + + Win32-native: Fixed a bug in the debugger's breakpoint list that appeared when + one tried to delete a breakpoint(the control accidentally had auto-sort enabled, + causing a discrepancy between what was displayed and what was contained in internal + data structures). + + The current disk image XOR original disk image is now stored in save states. This + should greatly increase compressability(important for network play), and make + it a little more legal to distribute such save states now. + + Modified the save state format to allow for more precise and larger version numbers. + + Various minor code changes. + + Fixed initialization of the FCEUGameInfo structure, which previously led + to problems with sound output on the SexyAL-using ports(Linux). + + Apparently I added support for mapper 255 a while back. Documentation updated. + + Added iNES header correction information for Armored Scrum Object and Alpha Mission. + + Merged banksw.h into ines.c, fixed some of its prototypes in ines.h. + +0.98.9: + + Win32-native: Fixed the speed throttling used when sound is disabled. In previous + 0.98.x Win32-native releases, emulation was running at 1/2 the speed it should + have been when sound was disabled. + + Win32-native: Moved settings in the "Miscellaneous" configuration window + to where they should have been in the first place, and added "GUI" and "Timing" + configuration windows to accommodate some. + + Win32-native: Fixed the handling of the "Scroll Lock" key used to disable and + enable Family BASIC Keyboard input. + + Updated documentation to handle some slight differences in the Win32-native + port("Win32-native" is what the Win32 port using native APIs, as opposed to something + like GTK+ and SDL, will be referred to in documentation now). I also made + some other minor wording adjustments to the documentation. + + Added an iNES header correction for Dragonball. + +0.98.8: + + Fixed a typo in sound.c that caused only part of the sound registers + to be saved in save states. + + Win32: Switched over to the DirectDraw7 interface, from DirectDraw4's. + The surface Flip() method will now block, which results in somewhat + smoother animation/scrolling, especially when combined with the + auto blit-skip implemented in 0.98.6 when sound is enabled. + + Win32: Undid a change made in the last release that limited the + speed of fast-forwarding when using the tilde key. I really do + need to implement some sort of unified timing/blit skip system... + + Win32: Added an option, disabled by default, to ask for confirmation + before exiting FCE Ultra. + + Win32: Added an option, enabled by default, to disable the system + screen saver while a game is loaded. + + Win32: Added a new video synchronization mode, a "lazy" wait for + vblank/vertical retrace. It calls Sleep(0) in its wait loop. This + still uses all available cpu cycles, but it is much more friendly + to other processes than the old-style wait for vblank. + + Win32: Added support for joystick POV hats. + +0.98.7: + + Fixed a bug in the debugger's disassembler when disassembling + opcode 0xBC. + + Fixed the behavior of the right mouse button with zapper emulation, to + correspond with what it is documented as doing. + + Win32: Added proper support for maximizing the window. + + Win32: Rewrote most of the input and input configuration code. + + Win32: Changed the configurable aspect ratio to something sensical, the current + display's pixel aspect ratio, default of 1:1(square pixels). + + Win32: Made the default full-screen video mode the custom video mode. I should have + done this a long time ago to make custom video mode configuration more straighforward + for users... + + Added some JACK audio code to be used by the SDL build. I'll test it and complete + it later. + +0.98.6: Made several code modifications to work with older versions of gcc. + + Fixed more header file network play #ifdef-age. + + Fixed a typo in cart.h. + + Fixed some funky code in FCEU_memmove(). + + Fixed some source code causing compiler warnings. + + Fixed SexyAL's format conversion code to not rely on deprecated casting semantics. + + Readded the native Win32 code, and made many improvements. The major thing + that needs to be done now with it is to rewrite the input handling code and input + configuration code. + +0.98.5: + Added LL to the 64-bit integer constants in ines.c + + Fixed OpenGL support under Mac OS X. + + Added the ability to hide background and/or sprites with the F4 key. + +0.98.4: + Moved NETWORK #ifdef's to netplay.c to simplify things. + + Fixed gzip file loading code(I think). I'm still a bit unsure about the semantics + of dup() and close(), though. + + Corrected FDS code to try loading the FDS image before loading the BIOS. + + Readded "native" SDL sound code, used for Mac OS X(and maybe BeOS). + +0.98.3: + Removed the wxWindows GUI code. GTK+ 2 code will take its place, + once it is ready. + + Added reset and power commands to the movie format. More commands(such as insert + disk, eject disk, flip dip switch, etc.) will be added simultaneously as work + on network play continues. + + Modified SexyAL OSS code to not adjust the number of fragments to a power of 2. + It works fine on my card, allowing finer-grained buffer size control, + but I'm not sure it will work with all chips. + + Fixed parsing of the "-specialfs" command-line argument. + + Added the hq3x scaler. + + Updated to the latest Scale2x code. I also added the Scale3x scaler. + + Changed the keyboard assignments for toggling full screen to "Alt" + "Enter". + + FCEUI_SaveState() and FCEUI_LoadState() changed. Porters should read + driver.h. + + Miscellaneous changes to accommodate new network play plan. It's not close + to being finished. + + Altered RTI emulation. In Paris Dakar Rally's NMI handler, it does "CLI ; RTI". + Previously, FCE Ultra would generate an interrupt right after RTI occured, due to the + presumed latency that RTI had with the I flag. I changed it so there is no latency, so + no interrupt will occur in this case(interrupts kill this game). The interrupt source + is the "frame IRQ", which it never disables, if anyone cares. + This change does break the "Stars SE" demo, though. Hmm. + + "FCEUGameInfo" is now a pointer, rather than just a statically-allocated structure. + This may cause some null-dereferencing-related crashes, but it should help keep + code a little cleaner(maybe?). + + Played around with the FDS FM code some more. It's still not right. Bah. + + Hacked in support for entering Datach/Barcode World barcodes without a GUI, using the + F8 key and the numeric keys. + + Added code to save/load movies. Movie support will only record/play back the + states of the four emulated gamepads. + + Modified the sound code to use timestamp/timestampbase differently. In addition, + timestampbase is now saved in save states("timestamp" doesn't need to be saved, since + it's reset to 0 at the end of each emulated frame). + +0.98.2: + Fixed a few problems with the SDL command-line build code + for Win32. Also, SDL 1.2.7 seems to have a bug that breaks FCE Ultra's + full-screen/windowed switching capabilities(at least under Win32). + Stupid everything. + + Minor SexyAL changes. + + Updated documentation. + +0.98.1: + + Increased the volume of the FME07 sound channels. + + Fixed a bug in the SexyAL endian conversion code. + + Made the SexyAL chunk conversion loop work. + + Replaced the old OPL2 emulator with a modified version of + Mitsutaka Okazaki's YM2413 emulator for the VRC7 sound emulation. + + Decreased the pitch of the FME 07 expansion sound channels by one octave. + + Decreased volume of output of $5011 in MMC5 emulation code. + + +0.98.0: Some changes I made aren't listed below. Ah well. The magnitude + of the changes was too great... + + + Default sound volume is 100(%), which makes a lot more sense than 75%, but not much. + It's multiplied by 3/4 internally now. + + Added support for the Datach barcode reader(GUI interface only). The emulation code + was adapted from the VirtuaNES source code. + + Reassigned the Datach games to mapper 157, from 16, with CRC32 checks. + + Increased the maximum number of screen snapshots in the snapshots directory + to 99999(from 999). + + Reassigned the following games to mapper 210, using CRC32 checks: + Chibi Maruko Chan + Dream Master + Family Circuit '91 + Famista '92 + Famista '93 + Famista '94 + Heisei Tensai Bakabon + Top Striker + Wagyan Land 2 + Wagyan Land 3 + If you use a hack/translation of one or more of these games, you will of course + need to manually change the mapper number in the header for it to work properly in + FCE Ultra. Family Circuit '91 still may not fit in with the rest of these games, + but it's definitely not a "stock" mapper 19 setup. + + Fixed an OpenGL palette bug when using scanlines(previously, I think it was + setting the palette of the scanlines overlay texture instead of the actual image + texture in some instances). The bug showed up on games that make use of the color + deemphasis bits. + + Rewrote a lot of the PPU background rendering code to be more accurate(and + obfuscated!). This eliminates the X-offset hack I made earlier. + + Removed some of the NSF visualization code, and altered the look of the NSF + display slightly. The NSF waveform visualization code will now take into + account the current volume setting. + + Changed the default key bindings for the standard emulated gamepad + to something more compatible with window managers. I may change it back, but probably + not, since it is easily configurable now. + + Updated the MMC5, VRC6, and FME07 low-quality sound emulation code + with the compatible parts of the high-quality sound emulation code for those chips. + + Adjusted timing of horizontal scroll update(near the beginning of hblank. I made + it occur sooner). I also added a hack to allow X-offset(fine X scroll) changes mid + scanline, however, it is extremely ugly, and may not work correctly for everything + (doing it correctly would probably kill speed). + I mainly did it to fix games like F-1 Race and Mach Rider, and other racing + games that are extremely sensitive to horizontal scrolling timing. + + Some FDS IRQ emulation changes to fix some screen corruption problems + in "Kaettekita Mario Bros". + + Removed zlib(the code, not support). + I also removed support for compiling without zlib(it's small, simple, provides + very useful functions, and may provide critical features for fceu in the future). + + *undone, breaks debugger, FIXME.* Replaced some inline functions with macros in x6502.c. + + Increased the speed of Namco 106 sound emulation in HQ sound mode. + + Many many sound emulation changes and adjustments based on blargg's tests. + The default sound volume is about 150% what it was before, because the sound range + has changed(now -soundvol 100 is like -soundvol 200 on older builds), and the + default "soundvol" setting is 75. 100 clips on some Namco games, and 200 clips + on many games, so I'll probably have the configurable volume range as [0:125]. + What exactly is "%" supposed to mean in this case.... 100% of what?! + + When using low-quality sound emulation mode, total emulation speed is about 10% + less than previous builds. The change in speed for high-quality sound emulation + mode is significantly less. + + Added beginnings of SexyAL to source code tree, removed SDL sound support, and + old OSS code. + + Copied over some autoconf/automake stuff from phamicom. It stills needs a bit + of work... + + Fixed DMC IRQ emulation. Fixes many CodeMasters games. Finally. ^_^ + + Restructured a lot of files, changed the interface between driver and + emulator code slightly. + + * Insert stuff here * + +November 28, 2003 - Snapshot + + Removed the DOS, Linux SVGAlib, and Win32 targets. *GASP* + Win32 support will return(eventually), using SDL + wxWindows. + SDL can use svgalib or GGI anyway, so it shouldn't be a huge loss. + DOS support will only return if someone ports SDL to DOS. ^_^ + It would be nice if SDL could accept modelines. Maybe in SDL 2.0... + + Merged fce.c and svga.c into fceu.c, and fce.h and svga.h into fceu.h. + + Reassigned "Mortal Kombat 3 - Special 56 Peoples" to mapper 209. + + Added emulation of the "Oeka Kids" tablet. + + Added emulation of the Family Trainer. + + Added emulation of the "Ultimate Quiz King" buzzers. + + Added emulation of the Mahjong controller. + + Added emulation of HyperShot controllers. + + Fixed loading of NSFs with load addresses below $8000. + + Cleaned and simplified some of the NES APU code. + + Altered mapper 65 emulation. Fixes Kaiketsu Yanchamaru 3. Does it break anything? + + Wrote a small FAQ file. + + Fixed displaying of garbage and other unpleasantness on the first scanline. I need + to clean up that code, though. + + Fixed color deemphasis emulation when all bits are set. For some + reason, I had commented out the code. Bleh. + + NSF player now writes $C0 to $4017 if the FDS is being used(the FDS + BIOS writes $C0 to $4017). $40 for all other NSFs. + + Added support for iNES mapper 58(nnnesterj). + + Added support for iNES mapper 208. + + Reassigned "Fudou Myouou Den" to mapper 207(CRC32 checks). + + Reassigned "Karnov" to mapper 206(CRC32 checks). + + Fixed the mapper 95 code, which was horribly broken. + + Differentiated between mappers 33 and 48. Added CRC checks to assign + some games to mapper 48. "Flintstones 2" and "Don Doko Don 2" are + the games that need to be assigned to 48. Are there others? + + Replaced usage of TriggerIRQ to X6502_IRQBegin/X6502_IRQEnd combos in + various mapper emulation files. 67, 33/48, 40, 73, 42, 65, 6, 182 + Removed function TriggerIRQ() from x6502.c + + Fixed the sound volume of the VRC7 emulation in high-quality sound mode. + Decreased(slightly) the volume of VRC7 emulation in both high-quality sound modes. + + Decreased the volume of the MMC5 expansion sound channels. + + Decreased the volume of the FME-7/mapper 69 expansion sound channels. + + Added FCEU_gmalloc(), which will call exit() if memory allocation fails, + otherwise it is guaranteed to return a memory block. + This will be used in the mapper code mainly. It should only + be used for small memory chunks. The reasoning is that if 64 some like KB of + RAM or less can't be allocated, for example, it'd probably be best to + exit the emulator ASAP. It also helps to simplify code logic, and + help (me) with modularization. + The behavior of this may change in the future. I still need to think about it. + I should probably save the configuration file regularly(or much better, + use the registry) on the Windows port, though. + + Cleaned up the save-state saving/loading code a bit, and added + support for linked save state structures for better modularity and + less code duplication. + + Merged the iNES and UNIF MMC1, MMC3, and MMC5 code more completely. + I may need to sanify CHR RAM and WRAM allocation for pedanticness, + though. Also worked on Tengen RAMBO-1 emulation, and mapper 90 emulation. + ***THIS MAKES SAVE STATES FOR GAMES THAT USE THESE EXPANSION CHIPS INCOMPATIBLE + WITH PREVIOUS VERSIONS*** + I plan on doing the same thing with other mappers/boards in the future, though. + Always on the quest for 1.0... + +November 12, 2003 - 0.97.5 Release + + Windows: Added limited support for arguments that change configuration + to be passed to FCE Ultra. Example: fceu -pal 1 c:\streetgangs.nes + It may be useful in frontends. + + Fixed filename generation for automatic IPS patching when a file + with no extension is loaded. Before this change, FCEU would + look for "game..ips" with a file named "game". + + Converted and updated the cheat guide in(to) HTML. + + Added support for iNES mappers 202,203,231 from info from cah4e3. + Fixed support for mappers 60, 200. + + Fixed various major bugs in the breakpoint deletion code. + + UN*X: Added support for OSS(/dev/dsp) devices that don't support mono + sound. + + Increased PPU startup idle time to 2 frames. Fixes that + unlicensed "Earthworm Jim 3" game. Does it break anything? + +November 9, 2003 - 0.97.4 Release + + Fixed another obscure PPU emulation screen corruption bug. + + Added support for Game Genie cheats in the cheat interface. + + Windows: Reworked the cheat interface, merging the cheat search + and cheat list windows into one. + + Windows: Greatly improved the CPU debugger. + The code still needs a lot of cleaning, though. + + Readjusted VRC6 IRQ emulation timing. + + Added support for the UNIF MMC3 board TEROM. The maximum PRG/CHR sizes + may not be correct in this implementation, though. + +November 8, 2003 - 0.97.3 Release + + Added a control to set the highest quality sound mode in Windows. + This change requires that any users who previously set + "high quality sound" to set it again. + + Fixed the volume of high-quality sound mode again. The changes + I made earlier didn't affect all the filter coefficients. + +November 8, 2003 - 0.97.2 Release + + Made a minor optimization to writes to palette memory. + + Altered VRC6 IRQ emulation timing slightly. + + Fixed a weirdo PPU emulation bug that could cause garbage on the right + side of the screen in certain situations. Thanks to FrenziedPanda for + bugging me enough to make me look into the problem and fix it. + I should be on the lookout to see if the fix breaks anything, though. + + Fixed the volume of high-quality sound mode(-soundq 1). It was + at 1/4 the volume it should have been. I compensated by increasing + the precision of the filter coefficients, which increased the sound + quality of that mode slightly without hurting performance. + +November 7, 2003 - 0.97.1 Release + + Fixed mapper 105 emulation. I had begun merging it into the + rest of the MMC1 code for 0.97, but I hadn't finished it. + + Changed things like RdMem(_PC++); to RdMem(_PC); _PC++; + Darn evil global variables. I need to fix them. Screw speed. + + Expanded checks for the global variable "fceuindbg"(used in debug + mode to prevent reads in the debugger from altering any registers). + +November 6, 2003 - 0.97 Release + * Note: I still had much more I had wanted to get done for 0.97, + but I lost even more interest. The Windows port still doesn't + have a way to enable the "highest" sound emulation mode, nor the + low pass filter code, not to mention that the lowpass filter code + isn't complete(I would need to design a high-order FIR filter from an IIR + filter to work properly-have the correct rolloff, among other + things-at finite playback rates). + + Fixed a bug in the IPS patcher. The recorded size wasn't being updated + after a successful realloc() was made, which could lead to corrupted patch + data from some patches. + + Added support for mappers 200, 201 from submitted code. + + Rewrote mapper 15 support to make more sense(well, depending + on your point of view...). + + Fixed 256KB CHR select support for mapper 115. + + Added support for mapper 12 from code from cah4e3. + +October 16, 2003 - Snapshot + + Fixed support for mapper 245(for nonencrypted/non-smynes-screwed up + ROM images only. Fixes "Yong Zhe Dou E Long [...] Dragon Quest 7". + + Added support for mappers 60, 62, 230, 244 from submitted code. + + Modified mapper 90 emulation to allow game-select on reset + for "Final Fight 3". + + Modified mapper 45 emulation to allow "Super 8-in-1" to work. + + Added a low-pass filter, and an option to enable it(CLI ports). + + 0x00 is now written to $4011 in the NSF player code instead of 0x40. + Fixed some other similar sound register init problems that I had fixed + in Festalon but forgot to fix in FCEU. Grrr. + + Removed some unnecessary 64-bit integer usage from FIR sound filtering + code. + + Added a new sound quality mode. Higher than high, it's highest(in + FCE Ultra, for now). Still need to fix the interface to allow + enabling it in the Windows port. + + Added some code for lower-level MMC3 IRQ emulation. It isn't completed + , and will not work properly as-is. I'm still playing around with + it occasionally. + + Fixed the sprite overflow flag(I think I fixed it), that was broken in an earlier + pre-0.97 release. + + Fixed support for iNES mapper 193. + + Command line arguments "-pal" and "-gg" now take extra arguments(1/0) + and are remembered in the configuration file. + +September 27, 2003 - Snapshot + + Added support for iNES mapper 50. + + Modified the UNIF board initialization code. Hopefully, this + new interface will eventually be used with the iNES code. + + Miscellaneous code cleanups. + + /dev/dsp is now set to 8(previously 9) buffers of 128 samples in length + in the SDL code. + + Tried to make the save state code more expandable and modular. + + Moved a lot of the PPU code into ppu.c. + + Added more extensive debugging code to the 6502 emulator, to allow + for memory read/write hooks(including zero page addressing modes). + + Readadjusted DMC timings when PAL emulation is enabled. It looks + like it was correct before I had made the August 2 change. Thanks + to Bananmos for the information. I think. :/ + + Added support for iNES mapper 193 from information from virtuanes. + I think my dump of it is "bad", though. PRG and CHR pages look + like they are in the wrong order(logical vs physical? Who's to say + what's physical?). + +September 1, 2003 - Snapshot + + Fixed some minor initialization issues with iNES mappers 7 and 34. + + Added support for UNIF board NES-GNROM. + + Removed support for save states created with versions of FCE Ultra + less than 0.56. + + Replaced SDL sound buffering code with a lock-free FIFO implementation + written by David Olofson, with a few modifications by myself. + + Fixed a VRC7 NSF bug(it showed up under the reworked driver/file + loading order in the cli code). + + The board in "Rolling Thunder" has "RAMBO 1" on it, not "RAMBO-1". + +August 9, 2003 - Snapshot + + Removed the old plain text documentation and replaced it with + a new document in HTML. It is not completed yet, though. + + Rewrote the SDL-native audio code to be less wacky and more + thread-safe(hopefully). I'm still waiting for a new SDL audio + API... + + Altered the MMC5 IRQ timing. Fixes minor graphical glitches + in Castlevania 3. Does it break anything? + + Removed some debugging code that got into the last snapshot. + +August 5, 2003 - Snapshot + + Added some code in the IPS patcher to allow for expanding the size of files. + + Fixed a double free() bug with a mapper 51 game(in ines.c). + + Added support for "Alien Syndrome" (US release) as iNES mapper 158. + It looks like a derivative of the normal RAMBO-1 board(or is that + the name of the chip?), similar to TKSROM/TLSROM(mapper 118). + + Improved the "native" SDL sound code. It will now call SDL_Delay(), + among other nice things. The code could probably be improved more, + though. + + Added support for decimal components in xscale/yscale in the SDL + port. Set the default xscale for windowed mode to 2.40(to get a + more correct aspect ratio, assuming the display is currently at + a 4:3 aspect ratio). + + Modified args.c to handle floating-point numbers. + +August 2, 2003 - Snapshot. + + Disabled texture wrapping with OpenGL(there were problems at the edges + of the screen with linear interpolation). Bah. Now the edges + are too bright... + + Improved the accuracy of the DMC timing when PAL emulation is enabled. + I still don't think it's totally correct, though. + + Changed the default settings for the SDL code. Full screen + is now 640x480x8bpp by default, xscale and yscale are 2 for both full + screen and windowed, opengl support is enabled, linear interpolation + for OpenGL is enabled, and X-axis stretching is + enabled(in full screen). + + "Scanlines" were enabled in 8bpp to 8bpp blits in + drivers/common/vidblit.c when they shouldn't have been. Fixed. + + Fixed OpenGL code under big-endian platforms. + +August 1, 2003 - Snapshot. + + Various code clean-ups. + + Played around with adding a GTK+ GUI to the SDL code. + + Rewrote part of the hq sound rectangle wave code. + + Replaced the high-quality sound inline assembly filter code with + slightly faster C code. + + Hacked around with GP32 support. I don't know if the GP32 would + be fast enough, though. + + Skipped frames will now have D5 of $2002 set at the beginning + of the frame. Fixes "Bee 52". I must see if it breaks anything. + + Added OpenGL support to the SDL code. + + Removed the PPU drawing inline assembly code, replacing it with a faster + algorithm written in C. + + "Disabling" the 8-sprite limitation will no longer cause + "Bee 52" to break. However, the "Solstice" wizard will still + have the weird thing growing out of his face in the introduction, + since it depends on no more sprites to be rendered. + + Added entry for that Black Bass game for header corrections in + ines.c + + Strip color burst bit(D0 of $2001) is only "emulated" if bg or + sprite rendering are turned on, at the end of the scanline. + Doing it with pixel/tile granularity would require modifying + the sprite graphics data copying routine, which I don't + feel like doing. Fixes that crazy Sayoonara demo by Chris Covell. + I also modified the NES RAM initialization code. + + Adjusted VRC7 IRQ emulation for better Lagrange Point goodness. + + Added support for iNES mapper 91. (VirtuaNES) + +0.96: + Improved RAMBO-1(mapper 64) emulation. "Skull and Crossbones" is + now playable. + +0.95: + + timestamp and timestampbase are no longer saved/loaded to/from + save states. They were causing too many problems I didn't + want to fix, and I never intended them to be saved in save states + when I wrote the code that uses them. + I think the reason they were being saved was that I wanted to make it + possible to add movie support and network play save state loading + (distributing the save state over the network). So if someone in + the future wants to add these features, the issues(primarily with + zapper emulation and sound emulation) with saving the time stamp will + need to be resolved. + + Fixed some crashing bugs when save states are loaded when + high-quality sound emulation is enabled. It is like patching + holes in a swiss-cheese boat. All the holes may be patched, but + it looks ugly. At least it tastes good... + TODO: Look into saving more data in the save states, especially + data that is based off of "timestamp" and "timestampbase". Also + look into validating this data. Right now, corrupt save state data + might cause memory corruption in FCE Ultra. + + Fixed some bugs in the NSF player. + + Cleaned up more code. + + Reduced the usage of TriggerIRQ(). + + Split the palette code into a new file, palette.c, from svga.c + + Low-G-Man(NTSC and PAL versions) are now recognized by CRC32 value, + and WRAM will be disabled if they are loaded. A warning/status message + will also be printed regarding this issue. + + Decreased the volume of the DMC/PCM channel in low-quality sound + emulation. + + Low-quality sound emulation now uses 32-bit integers for much + better speed. + + FCEUI_CRC32() wasn't returning anything. D'oh. Fixed. + + Added somewhat crude support for games that switch background CHR data + mid-scanline (this is needed in games such as Mother, Pirates!, + Business Wars, and Marble Madness). + + Altered NMI, IRQ, and BRK emulation again. Fixes some games, + like Bases Loaded 2 and Dynamite Bowling, and maybe some others. + I had to increase the size of the IRQlow variable for delayed + NMI execution... I also had to add a delay between PPU reset + and the PPU actually doing anything, to fix "Knight Rider". + + Fixed a mapper 90 save state bug. + + /dev/dsp code now searches for /dev/dsp before /dev/dspX (where X is + a non-negative integer). + + SDL joystick axes configuration is now done from the joystick. + + Tweaked various Konami mappers' IRQ counter emulation. + + Added custom SDL throttle code that gives up time slices instead of + using 100% cpu. + + Fixed an issue with sprite priorities on MSB-first platforms. + + Modified powerpad.c to avoid a symbol conflict when compiling on the + Power PC architecture. + +0.94r3: + sound.c: + Fixed a divide-by-zero bug that occurred when a virtual + reset(like by pressing F10) occurred when sound emulation was + disabled. + +0.94r2: + drivers/common/vidblit.c: + Fixed code for 32bpp blur effect. + + drivers/cli/sdl-video.c: + Added error message for unsupported bit depths. + + mappers/simple.c, ines.c: + Used this bug fix pseudo-release as an excuse to add + support for mapper 107. Information taken from virtuanes. + +0.94(fixed release) +--- + Fixed call to InitUNIXDSPSound in svgalib.c + + Added man pages. + +0.94 +--- + Added support for rapid fire A/B buttons on physical joysticks + in SDL/svgalib/DOS code. + + Implemented "high-quality" Namco 106 emulation(used for hq sound mode). + In this case, "high-quality" means sounding more like it should, + not necessarily cleaner. I'm not certain that it's totally correct, + but it's in the right direction. + + RAM cheats should no longer affect Game Genie emulation. I still + need to completely verify this. There may be some sort of race + condition. + + Removed various minor speed hacks in the name of style and + correctness(and to make maintaining FCE Ultra easier for those + people who are not me). :) + + Removed NSF cpu hacks, as I changed code to make them unnecessary. + + Fixed another FDS IRQ emulation bug. "Famicom Grand Prix II" works + now. + + Fixed a memory leak and a heap corruption bug in "file.c". + + Added support for on-the-fly IPS patching. + Place the IPS file in the same directory as the file to load, + and name it filename.ips. + + Examples: Boat.nes - Boat.nes.ips + Boat.zip - Boat.zip.ips + Boat.nes.gz - Boat.nes.gz.ips + Boat - Boat.ips + + Some operating systems and environments will hide file extensions. + Keep this in mind if you are having trouble. + + Patching is supported for all supported formats(iNES, FDS, UNIF, and + NSF), but it will probably only be useful for the iNES format. It + can be used with the FDS format, but be warned that it will permanently + patch your disk image, as the disk image is written back to disk + when the game is unloaded(unless the disk image is in a zip file, in + which case it isn't written back to disk). UNIF files can't be + patched well with the IPS format because they are chunk-based with no + fixed offsets. Support for a UNIF patching format may be added + in the future(probably by someone else.). + + Added more games to the list in ines.c for having battery-backed + WRAM, for header corrections. + + Copied over the 96KHz filter coefficients from Festalon that I forgot + to do in 0.92. Oops. + + +0.93 +--- + + Reduced the volume of the FDS sound channel. + + Fixed a bug in the FDS IRQ emulation code that caused "Lutter" to not work. + + Fixed a bug in unif.c that would cause a crash if a unif file were + loaded without a board name being specified(as could happen + with a corrupted nsf). + + Fixed a bug in general.c relating to relative filenames(running + fce ultra like "./fceu ../big.nes" would work, but "./fceu ../big" + would not work- it crashed). + + + +0.92r2 +--- + Fixed dpcm irq bug that broke Cobra Triangle. + +.92 +--- + + Removed NSF player background, and added some special effects goodies. + + Changed the NSF player to use the emulated gamepad as input instead + of having special NSF-player-only keys. + + Added support for mapper 249(using nonencrypted games), thanks to SARO + for info. SMYNES sucks. + + Updated video blitting library-thing(vidblit.c) with more special + effects, and removed 24bpp support. + + SDL cleanupification. + + Added support for mapper 61. + + nnnesterj: Added support for mapper 57. + + Fixed mapper number for "Golden Game 150 in 1". Changed it to 235 + from 43. + + DDraw back buffer surfaces are now created in system memory if the + hardware blitter can't do stretching. + + Restructured file wrapping code. + + Added new cheat search methods. + + Fixed a major cheat unloading memory bug(and memory leak). + + Emulated that funky nonlinear DAC effect for hi-quality sound. + + More fixes/cleanups to FDS emulation code. + + Tweaked PPU timing a bit. + + Improved network play. + + Holding the enter key down will no longer do fun stuff to the nsf + player. + + Improved NSF player. It should support streaming pcm nsfs now... + + Changed FDS keyboard keys around a bit. F6 is the disk select key, + and F8 is the disk insert/eject key. + F8 to insert VS Unisystem coin, F6 to view/toggle dip switches. + Hopefully people won't complain after blindly hitting the save state + buttons. :) + + Many fixes and improvements to the Windows port. No more cpu-consuming + wait loops(specifically, sound). Added a message window. + + FDS sound emulation improvements. + + FDS disks are now auto-inserted on power on(or was it loading a new + game...). + + Changed the default last rendered scanline to 231. + + ines header corrections are now printed as status messages, not errors. + + Rearranged input updating code. + + Fixed a sprite transfer bug. Fixes PAL version of Rainbow Islands. + + Debugger hooks added. + + Small optimizations in Refreshline and FetchSpriteData to hopefully + offset the slight slowdown in the cpu core. + + MapperHBIRQHook is now called differently(depending on hi/low bg/spr + addresses). + + Added support for unif board UNL-8237. + + Added support for mapper 144(death race). + + Added partial support for mapper 74. + + Fixed a cpu emulation bug in GETIYWR. It would sometimes set "target" + to 0x10000, which was a BAD THING(overflow; now it wraps). + + Tried to add support for mapper 241. Needs special keyboard emulation. + I think. + + Internal RAM is now initialized to something other than 0. Fixes + Minna no Taabou no Nakayoshi Dai Sakusen. + + Reassigned "The Money Game" to mapper 155. It doesn't seem to + respect the WRAM enable/disable bits. Silly game. And + Tatakae!! Rahmen Man. + + Added support for mapper 115(still needs 256KB CHR select), 241, 114,88. + + Attempted to add support for mappers 91, 187. + + Modified frame IRQ to not break so many damn games. + + Fixed sprite hit detection loop. + + Improved support for mappers 80, 90,117,154, 189. + nnnester and virtuanes. + + Reassigned "Devil Man" to mapper 154. + + Removed bogus Trojan header fix in ines.c. + + + +.81-post: +---- + Fixed/Worked around(?) compilation problems on gcc 3.2.x. + +.81: +---- + + More SDL goodies. + + Renamed "Makefile.olinuxsdl" to "Makefile.unixsdl" + + More SDL fixes and cleanups. + + BeOS port is now compiled with the "-no-fpic" flag, which allows + me to use my inline assembly. The executable work fine as far as + I can tell. + + Added "Makefile.beos". gcc doesn't like my inline assembly + used in RefreshLine(),so this port will likely be slightly slower than + other x86 ports. + + Added a check to make sure SIGBUS is not equal to SIGSEGV in + drivers/cli/main.c. Needed for compiling under BeOS. + + Renamed the "PI" member of the X6502 structure due to conflicts with + a defined symbol with some math header files. + + Merged fcelineasm.h into fceline.h + + Fixed(possibly) a possible problem in fcelineasm.h with input register + clobbering. + + More SDL changes. + + Added speed throttling code to the CLI code, and added a command + line switch "-nothrottle". + + Lots of restructuring/rewriting/merging of the MMC3 code. + + Updated DOS code to use the generic CLI wrapper. + + Reads from $4090 and $4092 now return the current envelope setting + in FDS sound emulation. I'm not sure if this is correct... Affects + "Ai Senshi Nicole" and "Bio Miracle Bokutte Upa". + + Added native SDL sound support to the SDL code. the "olinuxsdl" + now uses this code by default instead of the unixdsp sound code. + + Modified MMC3 IRQ counter emulation. I'll need to watch out to see + if it breaks any games. Fixes: MegaMan 3, Gun Nac, Klax(Japanese). + + Changed a few memory reads in x6502.c to use RdRAM instead of RdMem, + resulting in a slight speed increase. + + Cleaned up mapper 250 emulation code. + + Added support for iNES mapper 51(thanks to Kevin Horton for the + information). + + Merged some iNES mappers corresponding to bootleg multicarts + based on MMC3s with mbshare/mmc3.c. + + Added support for iNES mapper 52(thanks to Kevin Horton for the + information). + + Made some hacks to the MMC3 emulation code so that I can add support + for pirate MMC3 multicarts more easily. I should clean it up later. + Moved mapper 44 emulation code to mbshare/mmc3.c. + + Saving screen snapshots will no longer corrupt the frame buffer + for one frame(unless memory couldn't be allocated). + + Fixed screen snapshot saving(it was sort of broken due to the + changes made to the driver<->emulator interface code; status + messages were being saved to the image). FCEUI_SaveSnapshot() + no longer returns a value(the request to save a screen snapshot is + serviced before status information would be written in the next frame). + + nosprites is now set to 0 before RefreshSprite() returns, to prevent + problems if a game turns off the bg and sprites when FetchSpriteData() + for the next scanline is called but then turns on sprites when + the actual scanline is drawn. + + PPU_hook() is now called more often if PPU_hook is non-null. + Made changes to mappers 118, 95, 9, and 10 to compensate. + No games seem to be broken, and I added support for mapper 96 + (though the games aren't very playable because the special controller + isn't emulated). + + Romance of the 3 Kingdoms is now recognized to use 16KB ex-WRAM. + + Added support for mapper 185...sort of. I think this is another + instance of incompatible hardware being lumped onto one mapper number. + Sigh. + + Added support for "Famicom Jump 2" as iNES mapper 153. + If a good(as far as I can tell) dump is loaded, FCE Ultra will + automatically fix the mapper number. + I also made some changes to the mapper 16 IRQ emulation code. + + BRK now sets the I flag. + + Reads from $4015 no longer reset DPCM IRQ. + + Changed emulation of RTI instruction slightly. + + X.IRQlow is now set to 0 in PowerNES(). + + The VS Unisystem bit in the iNES header is no longer looked at( + I was having too many problems with this bit being set when it + shouldn't have been). Now, VS Unisystem emulation is enabled + when a known VS Unisystem game is loaded. I also rewrote the VS + Unisystem detection function. + + iNES mapper 1 now supports pageable CHR RAM if no CHR ROM is present. + Fixes "Family School". + + Mapper 70 no longer has a mirroring control emulated, and I extended + the number of 8KB CHR pages supported to 16. + + Cleaned up iNES MMC5 save RAM loading/saving code and added + support for MMC1 games with 16KB of RAM(the second 8KB are saved), + via CRC32s(currently only Genghis Khan(USA) and Nobunaga's Ambition( + USA and Japan) are recognized). + + Added support for the MMC5 Koei game "Ishin no Arashi", in the iNES + format(I added an entry with its CRC32 value and the number of 8KB + WRAM banks it needs). + + Better iNES mapper 33/48 IRQ counter emulation. + + Added the game "Uchuusen - Cosmo Carrier" to this list. I'm + beginning to hate the iNES format more and more...or maybe + just Fanwen. :) + + Added the mapper 32 game "Major League" to the list of games + that usually need iNES header correction...but in this case, the + iNES header cannot specify that this game needs to have one-screen + mirroring. + + iNES header information is now printed before any header corrections + are made based on a database. + + Fixed a bug in mapper 32 emulation. "Ai Sensei no Oshiete" + works now. + + Tried to add support for iNES mappers 245 and 249. + + Fixed the MMC5 read handler to return the data last on the data + bus instead of 0xFF when a read was made to an unmapped address. + This seems to fix the lockup problems in "Bandit Kings of Ancient + China". + + Reversed "Modified the time at which the "y scroll" register is updated + during hblank." The changes broke Klax. + + Added an unsigned 64-bit base timestamp variable "timestampbase". + Adding this to the 32-bit variable "timestamp" will return + the number of cycles executed since emulation started(in the future + I'll probably change it to since reset or power toggle). + This allowed me to replace "lastn" hack in the MMC1 code with + something better. + + Changed my mind and undid the removal of support for old save states. + + Removed support for old save states and in general I won't + try to support save states made with previous versions. + + MMC1: Writes to $8000-$FFFF with D7 set will now cause + the first MMC1 register to be OR'ed with 0x0C. I'm not sure + if this is correct, but it doesn't seem to break anything + and it fixes Robocop 3. I'll see if anyone reports games + not working in .81 that worked in .80. + + Worked on a generic driver interface wrapper very similar + to the driver interface FCE Ultra used to use(I'm getting + tired of all of the duplicated driver code). Eventually, + the DOS, SVGAlib, and SDL ports will use this wrapper. + + Similar change to the argument parsing code. + + Changed configuration file saving-loading routines and the + configuration structure to allow for linking config structures + to each other). + + Small fix to the emulation of the MMC5 split screen mode. + + Made Linux SDL code compilable again. + + Changes to MMC5 EXRAM emulation(read/write). + + Fixes to the emulation of the MMC5's split screen mode, based on + observations while using CastleVania 3 and a Game Genie(on a real + NES). + + Fixed a bug in ines.c that caused any calls to AddExState() from + a mapper initialization function to be effectively "erased"(ResetExState() + was called after the mapper was initialized). Fixes the VRC7 sound + state saving/loading stuff. + + Finished adding support for the MMC5's split screen mode(this does + not mean that the support is complete, but at least the intro in + "Uchuu Keibitai SDF" works correctly now). + + Worked on adding support for the MMC5's split screen mode. Not + completed. + + Reverted to .80's FDS sound code. + + Modified the time at which the "y scroll" register is updated + during hblank. + + NSF playing code will now disable FDS sound output on song init + (fixes some problems with the Zelda no Densetsu NSF rip). + + Increased the emulated clock speed of the FDS sound emulation code + to give better quality output. + + Modified NMI to occur a few cycles later. Fixes BattleToads...but + it may have broken other games. Also modified the way NMI's are + handled in x6502.c. + + Modified ines.c to memset() GameMemBlock to 0 on virtual power toggle. + Also, trainers are now loaded into their own buffer instead of + directly into emulated WRAM and copied into emulated WRAM on + power toggle; I've been meaning to do this for quite some time. + + Changes to the way the zapper cursor is drawn on the screen. + + FCEUD_WriteSoundData(), FCEUD_BlitScreen(), and FCEUD_UpdateInput() + have been combined into one function: FCEUD_Update(). + + More fixes to the network play code, and a fix to the Windows network + play driver code that fixes(hopefully) a rather evil bug that caused + lockups when the remote stopped network play. + + Added code to set the battery-backed bit in RAM if a game needs it, + based on CRC32. + + Added more games to the list of games that commonly have bad iNES + headers, in ines.c + + Updated docs and usage.h for DOS and Linux regarding the new video + mode and the new refresh rates. + + Linux: Fixed a bug with video mode 6(a few upper scanlines were being + cut off). Increased the refresh rate of video mode 3 to 120hz. + + Increased the refresh rate of video mode 2 to 65 hz in the Linux port. + + Screen snapshots can now be taken while playing an NSF. + + Added a new sexy tweaked vga mode that I created to the Linux svgalib + port. It's 256x224 at a refresh rate of 103hz. Hopefully it won't + blow up anyone's monitor. ;) + DOS port will follow eventually. + + Modified Makefile.base to produce an executable named "fceu" instead + of "fce". + + The plans(cycle-accurate ppu emulation) for .90 were a bit ambitious, + and I still need to make other fixes before then. + + Fixed some minor(usually) bugs with setting 256x240 tweaked VGA mode + in DOS and Linux ports. + +.80: +---- + + Cleaned/fixed a few things in the mapper 19 emulation code. + Family Circuit '91 still doesn't work quite right... I wonder if + it's a bad dump. + + Added input override code to Windows port. + + Added code to fix iNES header information in RAM and suggest + changes to the user. + + Added support for iNES mapper 152(to be used with games set to + mapper 70, that use one-screen mirroring instead of h/v mirroring). + + Blits using the DirectX blitting function(method?) to the primary + surface are now done with the asynchronous flag set(if that + fails, a "normal" blit is tried). + + The DirectX blit buffer(secondary surface that FCE Ultra writes to + directly and then uses the DirectDraw blit function on to blit + to the primary buffer) is now created without specifying it + should be in system memory or video memory, except in the case + when no hardware blitting is available, and then DDraw is explicitly + told to create the surface in system memory. + + Added Family Keyboard support to the DOS port. + + Cleaned up the VRC7 sound emulation code. I need to find a way + to save the current sound state in a save state. + + Found out the real name of the "Space Shadow" gun; it's + called the "Hyper Shot". I'm still not sure who made it, though. + Possibly Bandai did. The interesting thing is that Konami + also made a Famicom accessory(dual square boxy things with two buttons + on each) with the same name(though there might not be a space in the + name). + + Only the upper two bits read from $4016/$4017 are undefined. + Bit5 is always 0, though. Fixed the bug in "input.c". + Silly kevtris' old documents. New kevtris' brain is always good. + + Family Keyboard support for the Windows port. + + Added support for the Family Basic Keyboard to the Linux port, other + ports todo. + Might want to add support for the tape recorder at some time. + Also mapped the "Scroll Lock" key to disable/enable command keys + so that the FBK is more useable. It doesn't disable CTRL C, + though... + + Changed a lot of inlined functions in x6502.c to macros so that + I could test out some optimization ideas. + + DOS code updates for game input override support. + + Small optimzation to opcode $4c, and relative jumps. + + Added some code to ines.c to set controller information in + FCEUGameInfo(returned by FCEUI_LoadGame()) based on crc32 values. + + Updated user documentation and usage.h for DOS and SVGAlib input + command-line changes. + + Added an option to disable the four-score(to Windows and Linux ports + so far). + + Updated Windows interface to support the new Famicom expansion + devices. + + (Re)Added support for the Famicom 4-player device. + + Improved Zapper emulation...sort of. It still needs a lot of work. :/ + + Added *partial* support for the "Space Shadow" gun. + + Added support for the Arkanoid controller(both NES and Famicom style). + + Added code to support the extension Famicom input devices. + + Added PAL scanline start/end drawing settings to Windows port. + + Added pause emulation key(F2) to Windows port. + + In the process of rewriting/fixing up input code stuff. + + Minor bug fix to Power Pad emulation code. + + VS Hogan's Alley and VS Duck Hunt automatically select the zapper + now(though it only works on the SVGAlib port). + + Undid some FDS sound code changes introduced in 0.76 that totally + screwed up sound. Oops. + + Added code to allow different settings for first/last scanline + drawn while in PAL emulation mode, to the Linux and DOS ports. + + Added convenience(it's not necessary, but it reduces redundant and + confusing code in the driver code) function + FCEUI_GetCurrentVidSystem(int *slstart, int *slend). + + Updated file "TODO". + + Changed #include to #include "zlib/unzip.h" + in file.c. + + NSF 6502 player now initialized the stack pointer on reset. + + Worked on de-emphasis emulation code quite a bit. + The deemphasized palette calculated at the end of the frame is now + based on what deemphasis bits were set for the longest during + the screen(sampling interval is a scanline) update loop. + Added a "static" deemphasized palette at $40-$7F in the palette table. + This corresponds to the colors when all of the deemphasis bits are set. + I did this to fix the PAL game "Noah's Ark", without breaking + anything else. The only downside is a slight speed loss(~2% on + my system when sound is disabled), but this is acceptable to me, + at least. + Maybe it's time to write hi/true-color ppu drawing code... + + + Fixed an out of bounds array access in svga.c in SetNESDeemph(). + The variable "lastd" in svga.c was being initialized to the wrong value. + Thanks to "Jarod CANAL" for pointing this out. + + Removed FCEUI_SetFirstRenderedLine or whatever it was called and + the function to set the last line. Replaced with: + void FCEUI_SetRenderedLines(int ntscf, int ntscl, int palf, int pall); + + Changed SetVidSys(int w) to ResetVidSys() in fce.c. Reenabled + PAL/NTSC emulation overrides based on game loaded(really only useful + for NSFs and UNIFs now). + + UNIF loading code now recognizes the chunk "CTRL" and tries + to use it. Only the svgalib code supports overriding of input + settings based on game loaded, now, though... + The user is still going to have to configure powerpad settings + on his/her own. + + Fixed return values of FCEU_fseek() and fixed a problem in unif.c + related to it. + + Changed mechanism for how FCE Ultra tells the driver + code what type of system is being emulated. A structure of + type "FCEUGI" is returned from FCEUI_LoadGame(). + + Fixed a major mapper 64 emulation bug introduced in 0.76. + + Modified BlitVidHi() in drivers/win/video.c to speed it up. + + Added support for loading the iNES-format Game Genie ROM image. + + Removed ggrom.h and added code to load the Game Genie ROM + image from a file. + + Added Windows netplay.c. (new: the user exiting the emulator + while stuck in a blocking recv() or send() loop now works.) + + Fixed a vram address register bug in fce.c that I created when I got + rid of the pair/dpair data types. + + Added new mappers/92.c + + Removed mappers/92.c until I can contact LULU or rewrite it. + + drivers/win changes. Removed netplay.c until I can rewrite it. + + Got rid of pair/dpair data types. + + Got rid of silly "TempArray" thing. + + Began adding GPL headers to files. FCE Ultra is going to be in + a state of legal limbo for the next few days... + + Replaced crc32.c and crc32.h, and added some #ifdef's and #defines + to use the crc32 code in zlib instead if zlib is linked with + FCE Ultra. + + More fixes to sb.c. + + Cleaned up drawing.h and ggrom.h(even though ggrom.h will *probably* + be removed before the next release). + + Redid frameskip code. + + Rewrote necessary pieces of sb.c and sb.h and fixed quite a few + bugs. I still need to test it on various other sound cards, though. + + Rewrote(more like "recreated in my own image") DOS keyboard driver. + Removed unused "keyscan.h" from drivers/svgalib + + Rewrote part of(the parts that Marat wrote - the connection and + closing parts) the Linux TCP/IP network play code. I guess it works, + but I haven't tested it very much. In any case, it's still dangerous + to use network play in FCE Ultra with SVGAlib, since recv() or send() + might block and since the keyboard is in raw mode, you have a problem. + Maybe a future SVGAlib will fix the general problem of lockups if + keyboard_update() isn't called, though it is only partly SVGAlib's + problem... + + Fixed FCEU_fseek() when used with a compressed file in the PKZIP + format that has been loaded. Fixes a UNIF loading problem. + Also added a check to the return value of FCEU_fseek() in unif.c. + + Replaced Marat's 6502 emulation core with my own. + It should be fully functional, but as always, I don't know if + I implemented the undocumented instructions correctly. + Several things are correct in this new core that were not in + Marat's(D flag is no longer cleared by interrupts, for example). + + Altered mapper 16 irq counter emulation slightly. + + Fixed the behavior of the SXA, SYA, and XAS opcodes based on the + documentation I have. I'm not sure what happens when page crossing + occurs with those instructions on a real NES, though. + Also CHANGED(not fixed) emulation of opcode $8B("XAA"). + + Changed some of the M* functions(absolute indexed and maybe some others) + to perform dummy reads. + + Changed some of the macros in m6502.c to inlined functions so + that I can modify and examine them more easily. + +.77: +---- + + Fixed a silly network play bug(in the global network play code) + that caused excessive lag. + + Added a "niceness" setting to the sound configuration dialog. + Removed obsolete information from the dialog. + + Fixed speed throttling code in Windows port when PAL emulation is + disabled/enabled and a new game hasn't been loaded yet. + + Commented out a printf() to debug stuff in fds.c(oops). + + Applied PK's joystick patch to the osdl code. It allows the user + to map axes and it fixes a joystick button mapping configuration saving + bug. + + Added two command line options new to Linux port to DOS port. + Just need to test them... + + Added some stuff to unif.c to allow for boards that can support + CHR RAM instead of CHR ROM(darn Sachen boards...). Fixes UNIF + version of "Q-Boy". + + Added command line option "-snapname" to Linux port. I'll add it + to the Windows port as well, but probably not to the DOS port. + + Added clip option to Linux port. + + Fixed sound logging(in Windows port) so that multiple recording + sessions now work. + + Added an option to clip the leftmost and rightmost 8 columns + of graphics in the Windows port. + + Added a submenu that lists recently opened files, in the Windows + port. + +.76: +---- + + Updated porting.txt. + + Added speed throttling code to Windows port that's used when sound is + disabled(and an option in the "Miscellaneous" + configuration window to disable it). + + Added cheat interface to DOS build. + + A few tweaks to the text cheat interface code in the cheat listing code. + Added a command to quickly toggle the status of the cheat(though a + cheat can still be disabled/enabled by (M)odifying the cheat). + + Support for UNIF UNL-TC-U01-1.5M board added. Same credits as below. + + Rewrote mapper 228 code just for the heck of it(actually, I couldn't + figure out why some(about two) of the games in the Action 52 cart + weren't working in .75(and .76). I traced it back to .71, where an apparent bug in + the undocumented 6502 opcode emulation allowed it to work, which + was later fixed for the .72 release(opcode 0x7C)). I'm thinking + that the dump is bad... + + Added a few crc32 checks to ines.c to check for and report when + a known(by me) bad(hacked or bad dump) game is loaded. + + Added support for the following UNIF boards. Thanks to Quietust + and Kevin Horton for the information. Some problems still exist + with a few games that use these boards, though... + + UNL-Sachen-8259B + UNL-Sachen-8259A + UNL-Sachen-74LS374N + UNL-SA-016-1M + UNL-SA-72007 + UNL-SA-72008 + UNL-SA-0036 + UNL-SA-0037 + + Fixes to some stuff in cart.c(for example, calling setprg32() when + only 16kb of prg data is present now works). + + Added support for iNES mapper 189. + + Tried to add support for the UNIF board "UNL-H2288". Failed. + + Updated "cheat.txt" to fix a few typos and added an example of finding + and adding a cheat using the Linux port's text interface. The actual + section on the Linux cheat interface still needs to be written, however. + + Changed network play code in the Windows port and fixed a bug. + Fixed a similar bug in the Linux netplay code....sort of. + + A few cosmetic changes to the dialogs in the Windows port. + + Fixed sound initialization on the Windows port(it was being initialized + when FCE Ultra started even if it was disabled by the user. Oops.). + + Joystick button configuration code in Windows port changed slightly + to be more useable. + + Changed reference to video mode 5 in the linux port to "1 per 4". + It may not be very meaningful, but it is certainly better + than "TV Emulation". I'll change the Windows port reference later. + + Documented video mode 7(320x240) for the Linux port. Also added + a check for the FBDev driver in order to use this mode instead + of a tweaked vga mode if that driver is being used. + + Added/Fixed cheat interface for Linux port. It's still not perfect, + though. The code is ugly... + + Callback function for FCEUI_ListCheats() now receives + status information(enabled/disabled). + + Callback functions for cheat functions now must return 0 to + stop listing cheats or 1 to continue. + + Fixed a problem(the cheat code was reading in cheats + for address $0000 from cheat files if any blank lines were present). + + SDL port zlib changes(linked dynamically to zlib now). + + More changes to envelope decay + looping on code. No longer + depends on value @ $4017. It now sounds correct based on some + tests I did with SMB3 and a GG, but Goonies 2 doesn't sound right( + based on a sound file sent to me by another person). + + Added support for iNES mapper 140. Thanks to Quietust for the + information. + + I need to figure out how to deal with the problem of so many + bad NSFs that most people consider good... + + Changed envelope decays a bit. Their behavior now depends on bit + 7 of $4017. I don't know if this is right... + + Addition of debug.c for some debugging stuff. + + Updated zlib to 1.1.4. + + Modified code in various files to allow UNIF games to override + current selected video system emulation(NTSC or PAL). Need to + make sure this really works. + + Changed sound.c to prevent desynchronization during network play. + This might slow down sound emulation slightly, especially when + sound emulation is disabled. I really don't care... + + Updating network play code. More info later... + + Moved the sound/video/etc output code in EmLoop() to the top of the + for(;;) loop so that initialization prior to calling EmLoop() will + be the same as initialization done during a call to a FCEUD_* function. + + A few very small changes to sound emulation in fds.c. + + Changed unlink() to remove() in cheat.c and removed the including + of the header file unistd.h. + + Split up the cc=... statement in RefreshLine() to make it easier + to read and not ambiguous(to Borland's C compiler). + + Changed a lot of the function declarations in cheat.c. I'll need + to verify that cheat searching still works ok and that cheats still work + ok. I'll also need to update the Windows(and Linux console) cheat code + to prevent compiler warnings. + + Fixed various minor code problems(not minor if you want to use a + compiler besides gcc). This is an ongoing process... + + Removed bit fields after reading about and thinking about possible + portability problems, though I kept some optimizations in fceline.h + + Minor code simplification in drivers/win/joystick.c(replaced + "case 200 ... 207" and "case 208 ... 215". + + Modified some code to use bit-fields in the graphics rendering code + in fce.c and fceline.h. gcc seems to be able to optimize the new + code to run faster. + + Fixed m6502.c and fce.c to initialize variables on virtual power + toggle. This should fix network play on the Windows port. + I'm also in the process of cleaning up fce.c. + +.75: +---- + Fixed directories configuration stuff in Windows port(corresponds + to .75r2). + + More changes to square wave channel envelope/volume emulation... + Changes described in the large paragraph some lines down have been + abandoned. + + Added a command line switch to set the volume in the dos port. + + Changed Windows sound configuration dialog. Now buffer length is + specified in time, not samples. I also added a volume control. + + Reduced the volume on 8-bit sound output on all ports by 1/2. + + Added a function FCEUI_SetSoundVolume(). Added support for setting + the volume via the command line in the Linux port, other ports coming + soon. + + Changed FCEUD_WriteSoundData() again. No longer has a "Check" + argument. All clipping(ugh) is done internally now. + + Added a directories configuration dialog to the Windows port. I worked + on it too long and I became a zombie, so it might have a few bugs. + That's what guine...err...users are for. ;) Don't expect me to do + anything like this for any other port, though. I don't feel like + doing it on the DOS port, and the Linux and other UNIXy ports shouldn't + really need it. + + Made some changes to the rectangle/square wave channel emulation to + fix the pops in SMB. I have no idea if what I did is correct. To + be honest, I'm not sure I know EXACTLY what I did, but it's something + like this: Writes to $4003/$4007 now reset the duty cycle count + and reload the cycle counter with the current wavelength. Writes to + $4003/$4007 now do not update the amplitude output of the channels; they + will be updated after the cycle counter hits 0(or below). + + More information in iNES informational output. + + Minor changes to mappers/16.c. + + Increased the volume of the VRC6's sawtooth wave channel. + + Added more information to the RAM cheat guide. + + Changed the triangle wave generation code slightly. I decided + to remove support for the higher-frequency triangle waves, as they + are too cpu-costly to create and are probably not very audible on a + real NES anyway. + + Major changes to how sound is mixed. This necessitated a high pass + DC-offset removing filter, and a low-pass filter just to make things + sound better. ^_^ + Note: FCEUD_WriteSoundData() no longer needs to clear the waveform + data referenced by the passed pointer; it's done internally now. + + Fixed JMP ($xxxx) - now handles wrapping like it occurs on a real 6502 + (hopefully; I'm assuming that the same holds true for the NES' cpu). + + Added the ability to load a custom global palette in the DOS port. + + Fixed bug in drivers/common/unixdsp.c(wrong return value if sample + rate was out of range). + + Many sound fixes... - Frequency sweeps, length counter stuff,... + + Changed Windows port to use IDirectInput7 and IDirectInputDevice7 + interfaces. + + Fixed a Game Genie bug in the core emulation code. It only appeared + in the Windows port, though. (Enabling gg emulation, loading a game, + and then disabling gg emulation and loading a new game while in the + gg code entry screen would cause the new loaded game to not work + correctly). + + Modified windows port to use the config saving/loading stuff in + drivers/common/config.c + + Mapper 45 cleanups/fixes. + + Added the ability to load a custom global palette in the Linux port. + Yay. + + Fixed a large number of overcomplicated code and silly bugs in + drivers/common/config.c. This changes the format of the configuration + structure, too. Also added support for saving/loading strings with + automatic memory allocation when strings are loaded. + + Minor change in InitNetplay(). + + Fixed bad type conversions for pointers to functions and fixed + some bad declarations of functions. + + Reenabled zlib support for the sdl build. I need to pay attention + to patches that modify lines than don't fit on my screen. + + Fixed vidblit.c to not emit so many warnings when compiling. + +.74: +---- + + Stop sound in Windows port when user clicks l/m/r mouse buttons + in the non-client area of the window. + + Added "Drag and drop" file open support to Windows port. + + Various code cleanups. + + mappers/33.c optimization. + + Rewrote the function "FCEU_MakeFName()". + + Removed crc32.h from mappers directory. + + Modified some of the window resizing code in the Windows port. + + Added support for waiting for vblank/double buffering to the Windows + port. + + Added/Fixed support for iNES mapper 248. + + After an NSF file is loaded, information about its header is now + displayed. + + Fixed a typo in the Namco 106 extra ram handling code. + + Improved the quality of the Namco 106's extra sound channels. + - Thank Mamiya and Applepie(real name?) for info. + + When an NSF file is being played, FCE Ultra will no longer go through + its scanline rendering loop. This speeds up NSF playback considerably. + + Updated "porting.txt". + + Moved some stuff from DriverInterface() to their own functions. + + Fixed some iNES mapper 18 IRQ counter emulation bugs. "Ninja Jajamaru - + Ginga Dai Sakusen" now works. + + Rewrote large pieces of the mapper 64 code. "Skull and Crossbones" + still doesn't work, though. + + Changed format of iNES header information output, added "ROM CRC32" info. + + Modified the way cycle timing is done slightly. No change + for NTSC emulation, but PAL emulation is a little more accurate. + + Changed the behavior of indirect indexed(I hope I got that right ;)) + instructions to behave more like a real 6502(junk reads are now + performed). + + A few optimizations/cleanups in m6502.c. + +0.73 +---- + + * Fixed several bugs with sprite emulation. Several games(such + as "Trojan" and "VS Duck Hunt") that were broken in .71 and .72 now + work ok. + * Added support for iNES mapper 82. Thanks to those who work on + "unofficial nester". + * Added support for iNES mapper 250(used by "Time Diver Avenger"). + * Fixed the documentation to show that iNES mappers 48, 83, and 232 + are supported. + * Removed various pieces of stale code and fixed a few minor bugs. + * Fixed a triangle wave channel bug(the channel was sometimes enabled + when it shouldn't have been). + * Writing to $4010 with the upper bit clear now acknowledges the DPCM + IRQ. This appears to fix "Stunt Buggies". + * Rewrote pieces of the Zapper emulation code to be cleaner and more + accurate. + * Rewrote the VS Unisystem dip switch drawing code. + * Simplified the setting of VS Unisystem dip switches. The "V" key + now toggles viewing AND editing of dip switches. + +0.72 +---- + + * Various minor bug fixes. + * Various code cleanups and size and speed optimizations. + * Removed some (apparently) unused MMC5 sound emulation code. + * Changed the behavior of $2003 and $4014 to better simulate what occurs + in a real NES. + * Fixed a few bugs in the undocumented 6502 opcode emulation code. + The Game Genie code "NUTANT" for SMB 3 works correctly now, at + least(previously it caused the game to lock up at the end of levels). + * Rewrote large pieces of the 6502 memory fetching code, resulting + in a slight slowdown in the speed of emulation. Benefits include: + Game Genie emulation now works(again) and 6502 emulation is more + accurate. + * Added support for iNES mapper 72. Thanks to rinao for the information. + * Fixed support for iNES mapper 77(used by Napoleon Senki). + * Fixed/Added support for iNES mapper 226. Apparently I made a mistake + in the documentation. Thanks to Mark K. for the information. + * Added support for iNES mapper 227. Thanks to Mark K. for the + information. + * Added support for iNES mapper 234(used by the Maxi-15). Thanks + to Mark K. for the information. Note that many of the Maxi-15 + ROM images on the Internet have corrupt CHR data(graphics), or the + mapper number is set incorrectly(usually to 11). Use a utility to + fix the mapper number. + * Added support for the following UNIF boards(prefixes omitted): + - EKROM (and fixed the reference to "Gemfire" in the documentation). + - HKROM + * Added the ability to enable and disable individual RAM cheats. + * Fixed some problems with the cheat search code(the NES' internal + RAM was being searched differently than any external RAM, which + was being search incorrectly). + +0.71 +---- + + * Fixed a 6502 emulation bug that was causing some Koei games + (ex: Nobunaga's Ambition, Genghis Khan) to not work. + * Extensive PPU/CPU timing adjustments. + * Fixed support for iNES mapper 40. + * Added support for the following UNIF boards(prefixes omitted): + - ETROM + - ELROM + - EWROM + * Fixed a few bugs in the UNIF code. + * Added support for loading and saving cheat files and an interface + to search for/add/delete/list cheats(no interface yet on Linux/DOS). + * Fixed a few minor bugs in the Windows DX code. + * Command line options to control the number of sound fragments + and the fragment size have been added(Linux). + +0.70 +---- + + * Adjusted PPU/CPU timing. + * Removed(until I understand the problem) a hack to get one of the + games in the Caltron 6-in-1 to work. + * Fixed an MMC3 IRQ emulation bug("Project Q" works better now). + * Fixed a problem/misunderstanding regarding the upper scanline. + It can now be displayed again. + * More accurate sprite hit emulation(fixes the title screen of + "Ultimate Stuntman"). + * VRAM bank switching for iNES mapper 4 is now possible(and enabled + for all mapper 4 games without CHR ROM). Fixes "Tenchi o Kurau 2". + * Added support for the Famicom's four-player adapter and the ability + to enable it(it is disabled by default to prevent compatibility + problems). + * Added an option(under miscellaneous configuration) to automatically + open the "File Open" dialog box when FCE Ultra is started. + * Sound sampling rate is now configurable. + * Fixed some bugs in the DirectSound code. + * Joystick button configuration is a little more user friendly(and + stable, hopefully) (Linux). + +0.62 +---- + + * Added support for the Famicom Disk System's extra sound channel. + * Updated the version of Tatsuyuki Satoh's OPL2 emulator used in + FCE Ultra from .36f to .37a. The sound quality in "Lagrange Point" + seems to have improved. + * Added support for iNES mapper 242(used by "Wai Xing Zhan Shi"). + * Fixed a network play bug that could cause desynchronizations + if more than one network play session occured since FCE Ultra + was started. This bug only showed up on the Windows port, though. + * Increased the volume of the noise and triangle sound channels. + * Fixed a save state loading bug. + * Fixed a small memory leak that was being caused by the VRC7 + state loading code. + * Fixed a bug that could cause FCE Ultra to crash if a virtual disk + was being read and the user ejected the virtual disk. + * Various minor bug fixes/code cleanups. + * NTSC color "emulation" can now be enabled again(the code to + enable it was broken in the last version). (Linux) + +0.61 +---- + + * Speed optimizations in sprite rendering code. + * Screen snapshots are now saved in the PNG format instead of the PCX + format. + * Fixed Game Genie emulation(it wasn't working in the last release). + Also added support for Game Genie emulation to the UNIF code. + * Rewrote command line option parsing code. + * Fixed a problem(if FCE Ultra was configured to connect to a remote + host and the remote host was given as an IP address, and the IP + address couldn't be reverse resolved, which is commonly the case + on home LANs, the connection attempt would fail) in the network + play code. I had misinterpreted the Winsock API documentation + when I wrote the code. (Windows) + +0.60 +---- + + * Various speed optimizations. + * Sound is no longer messed up when a JAM/KIL opcode is emulated. + * Fixed an overflow bug that occured when $4014 was written to + during certain(rare) conditions. + * Fixed a few save state bugs. + * Fixed a MMC1 CHR bank switching bug. + * Added emulation of the MMC5's WRAM write-enable/disable registers. + * Fixed a sound frame IRQ emulation bug. "Qix" works now. + * Added UNIF support. Some of the board emulation is still a bit + buggy, though. Look at the documentation for a list of supported + boards. + * Updated the "Palette Notes" section of the documentation. Also + fixed a few other problems with the documentation. + * Added support for loading files in the PKZIP and gzip + compressed file formats via zlib. + * Added the ability to configure the first scanline and the last + scanline to draw to the screen. Enabling PAL emulation no longer + will cause all 239 scanlines to be displayed, though an option + to override these settings for when PAL emulation is enabled may + be in the next version. + * Fixed a bug that would cause the emulated D-pad of virtual gamepads + emulated through the keyboard to be duplicated through "higher" + virtual gamepads(gamepad 1 would affect 2,3,4; gamepad 2 would + affect 3,4; etc.). (Windows) + +0.55 +---- + * Rewrote window resizing code. The window will now resize itself + to a multiple of the NES' screen dimensions nearest to the user + selected dimensions. (Windows) + * Added an option to use buttons instead of axes on physical joysticks + for the emulated D-Pad. This is useful for some digital joysticks. (Windows) + * Fixed a bug that would cause FCE Ultra to crash if sound were + disabled during emulation. (Windows) + * Added the ability to "fast forward" emulation. + * Added an option to allow more than 8 sprites per scanline to be + displayed. + * Added an option to save all extra non-volatile game data + (such as battery-backed RAM) in a directory under FCE Ultra's + base directory(as opposed to the directory the game is located in). + * Added an option to allow the emulator to change to a full screen + video mode once a new game is loaded. (Windows) + * Rewrote pieces of DirectInput joystick handling code. Hopefully + it should increase compatibility. (Windows) + * Added the ability to automatically obtain button numbers when + configuring joysticks, by pressing buttons on the joystick. + * Added the ability to close the current game(decreases CPU usage). (windows) + * Increased the speed of various function calls by passing + arguments to functions through registers instead of through the + stack. + * Added emulation of the MMC5's raw PCM register. + * Added the ability to save/load save states while network play + is occuring. + * Having PAL emulation enabled will no longer override the + NTSC/PAL settings in NSF headers. + * Fixed a bug that got into the .54 release. Extraneous data was + being returned on reads from $2002, which caused problems + with some games(such as "Choujin Sentai Jetman"). + +0.54 +---- + * Fixed a bug that would cause a wrong battery-backed WRAM file + name to be produced if FCE Ultra was passed a file name without + any directory component(such as "fceu SuperBlah.nes"). + * Fixed an iNES mapper 118 emulation bug that got into the code + in a recent code cleanup. "Armadillo" is playable again. + * Fixed a typo(and bug) in the MMC5 emulation code. + * Data returned from emulated reads to "unmapped" areas or + memory locations where bits are undefined should now be correct. + * Fixed emulation of the sprite memory transfer register $4014. + It now takes into account the last value written to $2003 and + starts the transfer to that location in sprite memory(like on + a real NES). + * Added a video configuration dialog box. (Windows) + * Added the ability to configure a custom video mode. Aspects + that are configurable include width, height, bits per pixel, + and size transforming(stretching and scaling). (Windows) + +0.53 +---- + + * Fixed a bug with joysticks that occured on systems with multiple + joysticks. (Windows) + * Added support for iNES mappers 77 and 92(thanks to LULU for the code for both). + * Added partial(timer is non-configurable) support for iNES mapper 105. + * Changed save state format again. Save states made with previous + versions should still be compatible, though this may change in + future versions. + * Small optimization to sprite emulation code. + * Rewrote color-deemphasis code to use integer math instead of + floating-point math. + * Rewrote and restructured input code. (Linux) + * Added command line option "-f8bit" to force 8-bit sound. (Linux) + * Rewrote and restructured input code. Among other new features, + keyboard keys are now somewhat configurable. (Windows) + * Writes to $4003/$4007 will now reset the emulated square wave + duty cycle generator. + * Added emulation of the Power Pad. + * Rewrote joystick device reading code to use the event-driven + interface. This should fix various problems regarding support + for joysticks with many buttons. (linux) + +0.52 +---- + + * Fixed a PCM emulation bug(digitized voices in "Ikari Warriors 2" + and "The Immortal", among others, work now). + * Fixed noise channel's LSFR update frequencies(hopefully). + * Various minor bug fixes. + +0.51 +---- + + * Added support for iNES mappers 86 and 89. + * Reduced byte size of the NSF player's background. + * Adjusted CPU/PPU timing. + * Fixed sound channel frequency calculations for when PAL emulation is enabled. + * Rewrote large pieces of the sound code and got rid of the sound queue. Sound quality should be slightly better now. + * Various minor bug fixes. + + Windows: + + * Fixed an FDS side reset bug when a new game is loaded. + * Screen width/depth/height changes while FCE Ultra is in windowed mode are handled now. + * Changed the configuration file format. + * Added a palette configuration dialog. + * Added the ability to load a custom NES palette. + * Added an option to double 16-bit sound volume. + * Added an option to force 8-bit sound. + * Added an option to use a secondary sound buffer(versus the primary). + * Added an option to wait for vertical blank if sound is disabled. + * Added an option to run while focus is lost. + +0.50 +---- + + * Many bug fixes. + * Sound code partially rewritten to improve quality(near-perfect + raw PCM now) and eliminate the need for a separate thread. + This created a small problem with network play, though, so read + the network play notes section. Also, synchronizing to + vertical blank has been removed. + * Rewrote other pieces of sound code. No more "buzzing" in MegaMan 2, + Codemasters games' intros, etc. + * Added support for the NES Zapper and the VS Unisystem's light + gun. Be sure to read "Light Gun Notes". + * Changed save state format. Save states should now be much + smaller for most games. Most(not all) save states created with + an older version should work. + * Added support for VS Duck Hunt and VS Hogan's Alley. + diff --git a/data/common/games/fceu/FCEU ReadMe.txt b/data/common/games/fceu/FCEU ReadMe.txt new file mode 100644 index 0000000000..f8c0518ebd --- /dev/null +++ b/data/common/games/fceu/FCEU ReadMe.txt @@ -0,0 +1,152 @@ + +*******************************RUSSIAN**************************************** + +==О программе FCEU== + FCE Ultra - один из лучших эмуляторов NES на Linux, DOS, Windows, +BeOS, Mac OS X, а теперь и на Kolibri и Menuet! + +Сайт: http://fceultra.sourceforge.net + +Поддерживаемые мапперы: 0-11, 13, 15-19, 21-26, 32-34, 40-49, 51, 52, 57, 61, 64-80, + 82, 83, 85-90, 92-97, 99, 105, 107, 112-119, 140, 144, + 151-156, 180, 182, 184, 189, 225-229, 232, 234, 235, 240, + 242, 246, 248-250 + +После запуска программы нужно прописать полный путь к нужному файлу NES +и нажать Enter (путь отображается в верхней части окна). + +Версия эмулятора: 0.96 +Версия порта: 0.3 + +==Портер== +Asper +Писать сюда: asper.85@mail.ru + +Основные клавиши: + + Для эмулируемого устройства Family BASIC Keyboard: + Включить/Выключить Ввод Клавиатуры Scroll Lock + (включение ввода с эмулируемой клавиатуры отключает + коммандные клавиши) + Все эмулируемые клавиши отображаются на ближайшую доступную клавишу + на клавиатуре ПК за небольшими исключениями. Эмулируемая клавиша "@" + отображается на клавишу "`"(grave), и эмулируемая клавиша "kana" + отображается на клавишу "Insert" (в блоке клавиш размера 3x2 над + курсорными клавишами). + + Для эмулируемых устройств game pads: + A Turbo B + S Turbo A + Left Control or Z or Space B + Left Alt or X A + Enter/Return Старт + Tab or BackSpace Селект + Cursor Down Вниз + Cursor Up Вверх + Cursor Left Влево + Cursor Right Вправо + + Для эмулируемых устройств power pads(клавиши соответствуют расположению + кнопок на стороне "B"): + O P [ ] + K L ; ' + M , . / + + Для FDS игр: + F6 Выбрать диск/сторону диска. + F8 Извлечь/Вставить диск. + + Для VS Unisystem игр: + F8 Вставить монету. + F6 Отобразить/Скрыть dip переключатели. + 1-8 Переключить dip переключатели (когда dip + переключатели отобажаются). + + 0-9 Выбрать слот сохранения. + Caps Lock Выбрать виртуальный джойстик. + + F2 Массштабировать окно. + F3 Открыть файл. + F5/F7 Сохранить/Загрузить сохранение. + F9 Сохранить снимок экрана. + F10 Перезагрузка. + F11 Выключить/Включить. + ESC/F12 Выход. + + +*******************************ENGLISH**************************************** + + +==About program FCEU== + FCE Ultra - is is one of the best emulators of NES on Linux, DOS, Windows, +BeOS, Mac OS X, and now on Kolibri and Menuet! + +Website: http://fceultra.sourceforge.net + +Supported mappers: 0-11, 13, 15-19, 21-26, 32-34, 40-49, 51, 52, 57, 61, 64-80, + 82, 83, 85-90, 92-97, 99, 105, 107, 112-119, 140, 144, + 151-156, 180, 182, 184, 189, 225-229, 232, 234, 235, 240, + 242, 246, 248-250 + +After program executing you have to input full path to the NES file that you want +to be executed and press Enter (the path echo on the upper part of the window). + +Emulator version number: 0.96 +Port version 0.3 + +==Porter== +Asper +mailto: asper.85@mail.ru + + +Main keys: + + For emulated Family BASIC Keyboard: + Enable/Disable Keyboard Input Scroll Lock + (enabling emulated keyboard input will disable + commands keys) + All emulated keys are mapped to the closest open key on the PC + keyboard, with a few exceptions. The emulated "@" key is + mapped to the "`"(grave) key, and the emulated "kana" key + is mapped to the "Insert" key(in the 3x2 key block above the + cursor keys). + + For emulated game pads: + A Turbo B + S Turbo A + Left Control or Z or Space B + Left Alt or X A + Enter/Return Start + Tab or BackSpace Select + Cursor Down Down + Cursor Up Up + Cursor Left Left + Cursor Right Right + + For emulated power pads(keys correspond to button locations on + side "B"): + O P [ ] + K L ; ' + M , . / + + For FDS games: + F6 Select disk/disk side. + F8 Eject/Insert disk. + + For VS Unisystem games: + F8 Insert coin. + F6 Show/Hide dip switches. + 1-8 Toggle dip switches(when dip switches + are shown). + + 0-9 Select save state. + Caps Lock Select virtual joystick. + + F2 Scale window. + F3 Open file. + F5/F7 Save/Load state. + F9 Save screen snapshot. + F10 Reset. + F11 Power off/on. + ESC/F12 Exit. + diff --git a/data/common/games/fceu/History.txt b/data/common/games/fceu/History.txt new file mode 100644 index 0000000000..3a9c6b46be --- /dev/null +++ b/data/common/games/fceu/History.txt @@ -0,0 +1,33 @@ +01.09.08 == Port v0.1 == Emulator v0.42 +- загрузка NES файлов | - load NES files +- исполнение NES файлов | - execute NES files +- массштабирование размера окна | - scale window size +- работает в ОС Kolibri и Menuet | - work in OS Kolibri and Menuet + + +24.10.08 == Port v0.2 == Emulator v0.42 +- работа с сис. функцией 70 | - working with sys. function 70 +- создание сохранений | - make saves +- загрузка сохранений | - load saves +- создание скриншотов | - make screenshots +- добавлены клавиши Турбо A и Турбо B | - Turbo A and Turbo B keys were added +- работает только в ОС Kolibri из-за | - work in OS Kolibri only because of + использования сис. функции 70 | using sys. function 70 + +09.07.09 == Port v0.3 == Emulator v0.96 +- добавлено 33 новых маппера | - 33 new mappers were add + ( 48, 51, 52, 57, 61, 72, 74, 77, 82, 83, 88, 92, 96, 114, 115-117, 140, + 144, 152-156, 189, 227, 232, 234, 235, 242, 248-250 ) + +- добавлены новые эмулируемые | - new emulated devices were add + устройства | + ( power pads, game pads, zapper, arkanoid, shadow, Family BASIC Keyboard ) + +- выбор виртуального джойстика | - select virtual joysticks +- ускоренный вывод графики | - faster graphics output +- вывод fps | - fps output +- сообщения теперь выводятся на доску | - messages now output to the debug board + отладки | +- см. файл "ChangeLog.txt" чтобы | - see file "ChangeLog.txt" for full list of changes + просмотреть весь список изменений | + diff --git a/data/common/games/fceu/fce b/data/common/games/fceu/fce new file mode 100644 index 0000000000..5f19302803 Binary files /dev/null and b/data/common/games/fceu/fce differ diff --git a/data/common/games/lrl b/data/common/games/lrl new file mode 100644 index 0000000000..789d877cc7 Binary files /dev/null and b/data/common/games/lrl differ diff --git a/data/common/games/lrl.hsr b/data/common/games/lrl.hsr new file mode 100644 index 0000000000..4c662e03d1 Binary files /dev/null and b/data/common/games/lrl.hsr differ diff --git a/data/common/games/lrl.lev b/data/common/games/lrl.lev new file mode 100644 index 0000000000..5e1f3ed95f Binary files /dev/null and b/data/common/games/lrl.lev differ diff --git a/data/common/games/pig/evil.png b/data/common/games/pig/evil.png new file mode 100644 index 0000000000..a58776f5ec Binary files /dev/null and b/data/common/games/pig/evil.png differ diff --git a/data/common/games/pig/font.png b/data/common/games/pig/font.png new file mode 100644 index 0000000000..a729f9fd78 Binary files /dev/null and b/data/common/games/pig/font.png differ diff --git a/data/common/games/pig/glasfont.png b/data/common/games/pig/glasfont.png new file mode 100644 index 0000000000..6650824a19 Binary files /dev/null and b/data/common/games/pig/glasfont.png differ diff --git a/data/common/games/pig/icons.png b/data/common/games/pig/icons.png new file mode 100644 index 0000000000..ee1d07b1b2 Binary files /dev/null and b/data/common/games/pig/icons.png differ diff --git a/data/common/games/pig/lifepig.png b/data/common/games/pig/lifepig.png new file mode 100644 index 0000000000..9aa42d72ba Binary files /dev/null and b/data/common/games/pig/lifepig.png differ diff --git a/data/common/games/pig/pig b/data/common/games/pig/pig new file mode 100644 index 0000000000..25d2c40abc Binary files /dev/null and b/data/common/games/pig/pig differ diff --git a/data/common/games/pig/pigframe.png b/data/common/games/pig/pigframe.png new file mode 100644 index 0000000000..d695c831a5 Binary files /dev/null and b/data/common/games/pig/pigframe.png differ diff --git a/data/common/games/pig/slime.png b/data/common/games/pig/slime.png new file mode 100644 index 0000000000..93bfb41edc Binary files /dev/null and b/data/common/games/pig/slime.png differ diff --git a/data/common/games/pig/stars.png b/data/common/games/pig/stars.png new file mode 100644 index 0000000000..c31540afeb Binary files /dev/null and b/data/common/games/pig/stars.png differ diff --git a/data/common/games/pig/tiles.png b/data/common/games/pig/tiles.png new file mode 100644 index 0000000000..a7b62d03ec Binary files /dev/null and b/data/common/games/pig/tiles.png differ diff --git a/data/common/games/soko/lev/100boxes.lev b/data/common/games/soko/lev/100boxes.lev new file mode 100644 index 0000000000..b7836270df Binary files /dev/null and b/data/common/games/soko/lev/100boxes.lev differ diff --git a/data/common/games/soko/lev/990602.lev b/data/common/games/soko/lev/990602.lev new file mode 100644 index 0000000000..541a5c72ff Binary files /dev/null and b/data/common/games/soko/lev/990602.lev differ diff --git a/data/common/games/soko/lev/aenigma.lev b/data/common/games/soko/lev/aenigma.lev new file mode 100644 index 0000000000..5ebb8f6b82 Binary files /dev/null and b/data/common/games/soko/lev/aenigma.lev differ diff --git a/data/common/games/soko/lev/albg-bst.lev b/data/common/games/soko/lev/albg-bst.lev new file mode 100644 index 0000000000..3d7117a684 Binary files /dev/null and b/data/common/games/soko/lev/albg-bst.lev differ diff --git a/data/common/games/soko/lev/albg1-1.lev b/data/common/games/soko/lev/albg1-1.lev new file mode 100644 index 0000000000..d300957a98 Binary files /dev/null and b/data/common/games/soko/lev/albg1-1.lev differ diff --git a/data/common/games/soko/lev/albg1-2.lev b/data/common/games/soko/lev/albg1-2.lev new file mode 100644 index 0000000000..2867ea5c03 Binary files /dev/null and b/data/common/games/soko/lev/albg1-2.lev differ diff --git a/data/common/games/soko/lev/albg1-3.lev b/data/common/games/soko/lev/albg1-3.lev new file mode 100644 index 0000000000..5adc825093 Binary files /dev/null and b/data/common/games/soko/lev/albg1-3.lev differ diff --git a/data/common/games/soko/lev/autogen.lev b/data/common/games/soko/lev/autogen.lev new file mode 100644 index 0000000000..6b75a73a0d Binary files /dev/null and b/data/common/games/soko/lev/autogen.lev differ diff --git a/data/common/games/soko/lev/bagle.lev b/data/common/games/soko/lev/bagle.lev new file mode 100644 index 0000000000..43e063aa43 Binary files /dev/null and b/data/common/games/soko/lev/bagle.lev differ diff --git a/data/common/games/soko/lev/bagle2.lev b/data/common/games/soko/lev/bagle2.lev new file mode 100644 index 0000000000..f012169e90 Binary files /dev/null and b/data/common/games/soko/lev/bagle2.lev differ diff --git a/data/common/games/soko/lev/boxxle1.lev b/data/common/games/soko/lev/boxxle1.lev new file mode 100644 index 0000000000..01231ba101 Binary files /dev/null and b/data/common/games/soko/lev/boxxle1.lev differ diff --git a/data/common/games/soko/lev/boxxle2.lev b/data/common/games/soko/lev/boxxle2.lev new file mode 100644 index 0000000000..9d58ce2da6 Binary files /dev/null and b/data/common/games/soko/lev/boxxle2.lev differ diff --git a/data/common/games/soko/lev/cantrip.lev b/data/common/games/soko/lev/cantrip.lev new file mode 100644 index 0000000000..c01226b50f Binary files /dev/null and b/data/common/games/soko/lev/cantrip.lev differ diff --git a/data/common/games/soko/lev/cantrip2.lev b/data/common/games/soko/lev/cantrip2.lev new file mode 100644 index 0000000000..a6f37f651d Binary files /dev/null and b/data/common/games/soko/lev/cantrip2.lev differ diff --git a/data/common/games/soko/lev/dh1.lev b/data/common/games/soko/lev/dh1.lev new file mode 100644 index 0000000000..dc526c4818 Binary files /dev/null and b/data/common/games/soko/lev/dh1.lev differ diff --git a/data/common/games/soko/lev/dh2.lev b/data/common/games/soko/lev/dh2.lev new file mode 100644 index 0000000000..cbef4b7a14 Binary files /dev/null and b/data/common/games/soko/lev/dh2.lev differ diff --git a/data/common/games/soko/lev/dim-york.lev b/data/common/games/soko/lev/dim-york.lev new file mode 100644 index 0000000000..45d4924208 Binary files /dev/null and b/data/common/games/soko/lev/dim-york.lev differ diff --git a/data/common/games/soko/lev/erim.lev b/data/common/games/soko/lev/erim.lev new file mode 100644 index 0000000000..accd36cfe1 Binary files /dev/null and b/data/common/games/soko/lev/erim.lev differ diff --git a/data/common/games/soko/lev/fpok.lev b/data/common/games/soko/lev/fpok.lev new file mode 100644 index 0000000000..7fa30fbcc6 Binary files /dev/null and b/data/common/games/soko/lev/fpok.lev differ diff --git a/data/common/games/soko/lev/grig2001.lev b/data/common/games/soko/lev/grig2001.lev new file mode 100644 index 0000000000..c931b43074 Binary files /dev/null and b/data/common/games/soko/lev/grig2001.lev differ diff --git a/data/common/games/soko/lev/grig2002.lev b/data/common/games/soko/lev/grig2002.lev new file mode 100644 index 0000000000..084537addb Binary files /dev/null and b/data/common/games/soko/lev/grig2002.lev differ diff --git a/data/common/games/soko/lev/handmade.lev b/data/common/games/soko/lev/handmade.lev new file mode 100644 index 0000000000..258ea3c79c Binary files /dev/null and b/data/common/games/soko/lev/handmade.lev differ diff --git a/data/common/games/soko/lev/heytak.lev b/data/common/games/soko/lev/heytak.lev new file mode 100644 index 0000000000..55702f50c0 Binary files /dev/null and b/data/common/games/soko/lev/heytak.lev differ diff --git a/data/common/games/soko/lev/howard1.lev b/data/common/games/soko/lev/howard1.lev new file mode 100644 index 0000000000..23fbab31ec Binary files /dev/null and b/data/common/games/soko/lev/howard1.lev differ diff --git a/data/common/games/soko/lev/howard2.lev b/data/common/games/soko/lev/howard2.lev new file mode 100644 index 0000000000..a75f803484 Binary files /dev/null and b/data/common/games/soko/lev/howard2.lev differ diff --git a/data/common/games/soko/lev/howard3.lev b/data/common/games/soko/lev/howard3.lev new file mode 100644 index 0000000000..18ceaffbc5 Binary files /dev/null and b/data/common/games/soko/lev/howard3.lev differ diff --git a/data/common/games/soko/lev/howard4.lev b/data/common/games/soko/lev/howard4.lev new file mode 100644 index 0000000000..83d4431b6d Binary files /dev/null and b/data/common/games/soko/lev/howard4.lev differ diff --git a/data/common/games/soko/lev/jcd.lev b/data/common/games/soko/lev/jcd.lev new file mode 100644 index 0000000000..c570dd4e45 Binary files /dev/null and b/data/common/games/soko/lev/jcd.lev differ diff --git a/data/common/games/soko/lev/jct.lev b/data/common/games/soko/lev/jct.lev new file mode 100644 index 0000000000..ae21dfd638 Binary files /dev/null and b/data/common/games/soko/lev/jct.lev differ diff --git a/data/common/games/soko/lev/kokoban.lev b/data/common/games/soko/lev/kokoban.lev new file mode 100644 index 0000000000..4fa1989608 Binary files /dev/null and b/data/common/games/soko/lev/kokoban.lev differ diff --git a/data/common/games/soko/lev/kompact.lev b/data/common/games/soko/lev/kompact.lev new file mode 100644 index 0000000000..7397357ef4 Binary files /dev/null and b/data/common/games/soko/lev/kompact.lev differ diff --git a/data/common/games/soko/lev/loma.lev b/data/common/games/soko/lev/loma.lev new file mode 100644 index 0000000000..2f7e9e5876 Binary files /dev/null and b/data/common/games/soko/lev/loma.lev differ diff --git a/data/common/games/soko/lev/maelstrm.lev b/data/common/games/soko/lev/maelstrm.lev new file mode 100644 index 0000000000..58c14b0e2a Binary files /dev/null and b/data/common/games/soko/lev/maelstrm.lev differ diff --git a/data/common/games/soko/lev/mariob.lev b/data/common/games/soko/lev/mariob.lev new file mode 100644 index 0000000000..62c13c787a Binary files /dev/null and b/data/common/games/soko/lev/mariob.lev differ diff --git a/data/common/games/soko/lev/masmicro.lev b/data/common/games/soko/lev/masmicro.lev new file mode 100644 index 0000000000..64c17eeebf Binary files /dev/null and b/data/common/games/soko/lev/masmicro.lev differ diff --git a/data/common/games/soko/lev/massasq.lev b/data/common/games/soko/lev/massasq.lev new file mode 100644 index 0000000000..22f1df9284 Binary files /dev/null and b/data/common/games/soko/lev/massasq.lev differ diff --git a/data/common/games/soko/lev/micrcosm.lev b/data/common/games/soko/lev/micrcosm.lev new file mode 100644 index 0000000000..b37987b105 Binary files /dev/null and b/data/common/games/soko/lev/micrcosm.lev differ diff --git a/data/common/games/soko/lev/microban.lev b/data/common/games/soko/lev/microban.lev new file mode 100644 index 0000000000..122a1569db Binary files /dev/null and b/data/common/games/soko/lev/microban.lev differ diff --git a/data/common/games/soko/lev/minicosm.lev b/data/common/games/soko/lev/minicosm.lev new file mode 100644 index 0000000000..431a9f7276 Binary files /dev/null and b/data/common/games/soko/lev/minicosm.lev differ diff --git a/data/common/games/soko/lev/nabocosm.lev b/data/common/games/soko/lev/nabocosm.lev new file mode 100644 index 0000000000..ac7c497e91 Binary files /dev/null and b/data/common/games/soko/lev/nabocosm.lev differ diff --git a/data/common/games/soko/lev/novoban.lev b/data/common/games/soko/lev/novoban.lev new file mode 100644 index 0000000000..245ff5b78f Binary files /dev/null and b/data/common/games/soko/lev/novoban.lev differ diff --git a/data/common/games/soko/lev/numbers.lev b/data/common/games/soko/lev/numbers.lev new file mode 100644 index 0000000000..3522aa5004 Binary files /dev/null and b/data/common/games/soko/lev/numbers.lev differ diff --git a/data/common/games/soko/lev/online.lev b/data/common/games/soko/lev/online.lev new file mode 100644 index 0000000000..74e1226970 Binary files /dev/null and b/data/common/games/soko/lev/online.lev differ diff --git a/data/common/games/soko/lev/original.lev b/data/common/games/soko/lev/original.lev new file mode 100644 index 0000000000..24601d5714 Binary files /dev/null and b/data/common/games/soko/lev/original.lev differ diff --git a/data/common/games/soko/lev/picocosm.lev b/data/common/games/soko/lev/picocosm.lev new file mode 100644 index 0000000000..0bb7e29c7e Binary files /dev/null and b/data/common/games/soko/lev/picocosm.lev differ diff --git a/data/common/games/soko/lev/sasq_.lev b/data/common/games/soko/lev/sasq_.lev new file mode 100644 index 0000000000..d0dcbb6443 Binary files /dev/null and b/data/common/games/soko/lev/sasq_.lev differ diff --git a/data/common/games/soko/lev/sasq_iii.lev b/data/common/games/soko/lev/sasq_iii.lev new file mode 100644 index 0000000000..94fd6a8f25 Binary files /dev/null and b/data/common/games/soko/lev/sasq_iii.lev differ diff --git a/data/common/games/soko/lev/sasq_iv.lev b/data/common/games/soko/lev/sasq_iv.lev new file mode 100644 index 0000000000..ae434d8dda Binary files /dev/null and b/data/common/games/soko/lev/sasq_iv.lev differ diff --git a/data/common/games/soko/lev/sasq_v.lev b/data/common/games/soko/lev/sasq_v.lev new file mode 100644 index 0000000000..e940de9cf1 Binary files /dev/null and b/data/common/games/soko/lev/sasq_v.lev differ diff --git a/data/common/games/soko/lev/sasq_vi.lev b/data/common/games/soko/lev/sasq_vi.lev new file mode 100644 index 0000000000..e7d965f49e Binary files /dev/null and b/data/common/games/soko/lev/sasq_vi.lev differ diff --git a/data/common/games/soko/lev/simple.lev b/data/common/games/soko/lev/simple.lev new file mode 100644 index 0000000000..9bd0455095 Binary files /dev/null and b/data/common/games/soko/lev/simple.lev differ diff --git a/data/common/games/soko/lev/sokevo.lev b/data/common/games/soko/lev/sokevo.lev new file mode 100644 index 0000000000..42ca104d97 Binary files /dev/null and b/data/common/games/soko/lev/sokevo.lev differ diff --git a/data/common/games/soko/lev/sokhard.lev b/data/common/games/soko/lev/sokhard.lev new file mode 100644 index 0000000000..d0a77f68e9 Binary files /dev/null and b/data/common/games/soko/lev/sokhard.lev differ diff --git a/data/common/games/soko/lev/sokolate.lev b/data/common/games/soko/lev/sokolate.lev new file mode 100644 index 0000000000..81a7933b6e Binary files /dev/null and b/data/common/games/soko/lev/sokolate.lev differ diff --git a/data/common/games/soko/lev/soloban.lev b/data/common/games/soko/lev/soloban.lev new file mode 100644 index 0000000000..0e67d8ea47 Binary files /dev/null and b/data/common/games/soko/lev/soloban.lev differ diff --git a/data/common/games/soko/lev/stilmore.lev b/data/common/games/soko/lev/stilmore.lev new file mode 100644 index 0000000000..2b3919a6ca Binary files /dev/null and b/data/common/games/soko/lev/stilmore.lev differ diff --git a/data/common/games/soko/lev/sven.lev b/data/common/games/soko/lev/sven.lev new file mode 100644 index 0000000000..a0d7d5745b Binary files /dev/null and b/data/common/games/soko/lev/sven.lev differ diff --git a/data/common/games/soko/lev/takaken.lev b/data/common/games/soko/lev/takaken.lev new file mode 100644 index 0000000000..5668b0bf1c Binary files /dev/null and b/data/common/games/soko/lev/takaken.lev differ diff --git a/data/common/games/soko/lev/titlscrn.lev b/data/common/games/soko/lev/titlscrn.lev new file mode 100644 index 0000000000..0c7acf79a7 Binary files /dev/null and b/data/common/games/soko/lev/titlscrn.lev differ diff --git a/data/common/games/soko/lev/twisty.lev b/data/common/games/soko/lev/twisty.lev new file mode 100644 index 0000000000..26a492dd81 Binary files /dev/null and b/data/common/games/soko/lev/twisty.lev differ diff --git a/data/common/games/soko/rules.txt b/data/common/games/soko/rules.txt new file mode 100644 index 0000000000..3d929d6273 --- /dev/null +++ b/data/common/games/soko/rules.txt @@ -0,0 +1,180 @@ +SOKOBAN FOR MENUET v0.1 July 2, 2004 + Written in pure assembler by Ivushkin Andrey aka Willow + Main idea, art & graphics + Sokofun for Windows 95 by Games 4 Brains + and Sokoban 2.3 by Bjцrn Kдllmark + + Level designers: + + Alberto Garcia, Aymeric du Peloux, Brian Kent, David Holland, + David W Skinner, Erim Sever, Evgeniy Grigoriev, Franзois Marques, + Frantisek Pokorny, Howard Abed,J franklin Mentzer, Jaques Duthen, + John C Davis, John Polhemus, Kobus Theron, Lee Haywood, Mario Bonenfant, + Martin P Holland, Mic (Jan Reineke), Phil Shapiro, Richard Weston, + Sven Egevad, Ken'ichiro Takahashi (takaken), Thinking Rabbit, + Yoshio Murase, ZICO (Zbigniew Kornas) + + Special thanks to Hirohiko Nakamiya + + More credits: + Masato Hiramatsu, Kazuo Fukushima, Klaus Clemens + + Game uses its own format of levelset files *.LEV + with simple run-length compression + +!!!!NB!!!! +It is strongly recommended that you place application files into C:\menuetos +directory. Otherwise you should change CUR_DIR (SOKO.ASM, line 30) to the +appropriate value! + +Interface + +When loaded, application opens skin file SKIN.RAW in the current directory. +It is an image 16x240 pt. Then so-named "standard" levels SOKO-?.LEV are +read in the same dir. ? means a number within 0 and 9. +You can navigate along the level list pressing PgUp and PgDn keys. User +selects the level desired by pressing keys 0-9. Space key moves focus to the +text field below, so you can enter filename there. +Additional levels are in program subfolder LEV. For example, you wish to load +a levelset file /HD/1/MENUETOS/LEV/AENIGMA.LEV. Then you should enter +lev/aenigma.lev +Within the textbox user can press Backspace. There's no cursor yet :-( +Pressing Enter in the text field is equvalent for button "Load file". + +When in game, pressing Esc restarts the level, pressing Home returns back to +the levelset selection mode. + +Game Rules + +You have a little PUSHER. You will guide him using the cursor-keys. + +SOKOBAN (same as SOKOBLUE or SOKOWAHN) + The pink pyramids have to be pushed onto the marked places. + The problem is: You can only push things, but not pull them. + A level is solved when every pyramid stands on a marked place. + +SOKOLOR + Tiles of the same colour need to be pushed together. + +SOKONEX + Push all CONNECTOR-TILES together! + + Game-items of SOKONEX and their properties: + + PLATE: undestructable, movable, covers holes + HOLE: you can push LASERS and BROKEN PLATES into them + BROKEN PLATE: destructable, movable + CONNECTOR: undestructable, movable + FIXED CONNECTOR: undestructable, not movable + LASER: destructable, movable + BEAM: eleminates LASERS and BROKEN PLATES, paralyses PUSHERS + +The objective is always the same: You must push boxes the right way. +Sometimes tasks seem to be impossible. +But, be sure: There is always a solution! + +To-Do list: + +1. Better interface - I saw XTREE and understood that it's really possible to + write wonderful programs for MenuetOS easily. +2. More skins. And lesser file size... +3. Improve user interaction, I think. +4. Level Editor. Having a great wish you may compose levelsets by yourself and + compile them with FASM - see files CNF.ASM and CNF. +5. Correct bugs, make improvements from opinions of you, respective users of + this application ;-) +6. Include support for XTREE dialogs. + +**************************************** +**************************************** + +‘ЋЉЋЃЂЌ „‹џ MENUET v0.1 2 Ёо«п 2004 Ј. + + Ќ ЇЁб ­  ­  зЁб⮬  бᥬЎ«ҐаҐ €ўгиЄЁ­л¬ Ђ­¤аҐҐ¬ (Willow) + ѓ« ў­ п Ё¤Ґп, аЁбг­ЄЁ Ё Ја дЁЄ  + Sokofun for Windows 95 ®в Games 4 Brains + Ё Sokoban 2.3 ®в Bjцrn Kдllmark + + „Ё§ ©­Ґал га®ў­Ґ©: + + Alberto Garcia, Aymeric du Peloux, Brian Kent, David Holland, + David W Skinner, Erim Sever, Evgeniy Grigoriev, Franзois Marques, + Frantisek Pokorny, Howard Abed,J franklin Mentzer, Jaques Duthen, + John C Davis, John Polhemus, Kobus Theron, Lee Haywood, Mario Bonenfant, + Martin P Holland, Mic (Jan Reineke), Phil Shapiro, Richard Weston, + Sven Egevad, Ken'ichiro Takahashi (takaken), Thinking Rabbit, + Yoshio Murase, ZICO (Zbigniew Kornas) + + Ћб®Ў п Ў« Ј®¤ а­®бвм Hirohiko Nakamiya + + …йҐ Ў« Ј®¤ а­®бвЁ: + Masato Hiramatsu, Kazuo Fukushima, Klaus Clemens + + ‚ ЁЈаҐ ЁбЇ®«м§гҐвбп бЇҐжЁ «м­л© д®а¬ в д ©«®ў га®ў­Ґ© *.LEV + б ваЁўЁ «м­л¬ б¦ вЁҐ¬ Ё­д®а¬ жЁЁ + +!!!!NB!!!! +Ќ бв®п⥫쭮 ४®¬Ґ­¤гҐвбп Ї®¬ҐбвЁвм д ©«л Їа®Ја ¬¬л ў Є в «®Ј C:\menuetos. +‚ Їа®вЁў­®¬ б«гз Ґ ‚ ¬ ЇаЁ¤Ґвбп Ё§¬Ґ­Ёвм Є®­бв ­вг CUR_DIR ў д ©«Ґ +SOKO.ASM ­  бва®ЄҐ 30 ᮮ⢥вбўгойЁ¬ §­ зҐ­ЁҐ¬! + +€­вҐа䥩б + +ЏаЁ § ЇгбЄҐ Їа®Ја ¬¬  ®вЄалў Ґв д ©« бЄЁ­®ў ¤«п ЁЈа®ўле ®ЎкҐЄв®ў SKIN.RAW +ў б®Ўб⢥­­®¬ Є в «®ЈҐ. ќв® Є авЁ­Є  а §¬Ґа®¬ 16е240 в®зҐЄ. ‡ вҐ¬ ў н⮬ +¦Ґ Є в «®ЈҐ зЁв овбп в Є ­ §лў Ґ¬лҐ "бв ­¤ ав­лҐ" га®ў­Ё SOKO-?.LEV, Ј¤Ґ +? - зЁб«® ®в 0 ¤® 9. +Џ® бЇЁбЄг га®ў­Ґ© ¬®¦­® ЇҐаҐ¤ўЁЈ вмбп Є« ўЁи ¬Ё PgUp Ё PgDn. †Ґ« Ґ¬л© га®ўҐ­м +ўлЎЁа Ґвбп ­ ¦ вЁҐ¬ Є« ўЁи ®в 0 ¤® 9. +Ќ ¦ вЁҐ Їа®ЎҐ«  ЇҐаҐ­®бЁв д®Єгб ­  ⥪бв®ў®Ґ Ї®«Ґ ўў®¤  Ё¬Ґ­Ё д ©«  га®ў­п. +„®Ї®«­ЁвҐ«м­лҐ га®ў­Ё ­ е®¤пвбп ў Ї®¤Є в «®ЈҐ LEV Їа®Ја ¬¬л. „®ЇгбвЁ¬, ўл +е®вЁвҐ § Јаг§Ёвм д ©« га®ў­Ґ© /HD/1/MENUETOS/LEV/AENIGMA.LEV. ’®Ј¤  б«Ґ¤гҐв +ўўҐбвЁ бва®Єг lev/aenigma.lev +‚ Ї®«Ґ ¤Ґ©бвўгҐв Є« ўЁи  Backspace. Љгаб®а Ї®Є  ­Ґ ॠ«Ё§®ў ­ :-( Ќ ¦ вЁҐ +Enter ў бва®ЄҐ ўў®¤  нЄўЁў «Ґ­в­® Є­®ЇЄҐ '‡ Јаг§Ёвм'. + +‚ ०Ё¬Ґ ЁЈал ­ ¦ вЁҐ Esc Їа®Ё§ў®¤Ёв аҐбв ав га®ў­п, ­ ¦ вЁҐ Home ўлў®¤Ёв +Ё§ ЁЈал ®Ўа в­® Є бЇЁбЄг га®ў­Ґ©. + +Џа ўЁ«  ЁЈал + +‚ нв®© ЁЈаҐ г ў б Ґбвм ’Ћ‹ЉЂ’…‹њ, Є®в®ал¬ ¬®¦­® гЇа ў«пвм Є« ўЁи ¬Ё бв५®Є. + +‘ЋЉЋЃЂЌ (Ё­ зҐ ‘ЋЉЋЃ‹ћ :-) Ё«Ё ‘ЋЉЋ‚ЂЌ) + ђ®§®ўлҐ ЇЁа ¬Ё¤ЄЁ ­г¦­® ЇҐаҐ¤ўЁ­гвм ­  бЇҐжЁ «м­лҐ Є«ҐвЄЁ. + Џа®Ў«Ґ¬  ў ⮬, зв® ¬®¦­® в®«мЄ® в®«Є вм ЇаҐ¤¬Ґвл, ­® ­Ґ в йЁвм Ёе. + “а®ўҐ­м аҐиҐ­, Є®Ј¤  Є ¦¤ п ЇЁа ¬Ё¤Є  ­ е®¤Ёвбп ­  ¬ аЄҐа­®© Є«ҐвЄҐ. + +‘ЋЉЋ‹Ћђ + Ѓ«®ЄЁ ®¤Ё­ Є®ў®Ј® жўҐв  ­г¦­® Ї®¤в®«Є вм ¤агЈ Є ¤агЈг. + +‘ЋЉЋЌ…Љ‘ + ‚ᥠЎ«®ЄЁ-Є®­­ҐЄв®ал ­г¦­® Ї®¤в®«Є вм ¤агЈ Є ¤агЈг. + + ЋЎкҐЄвл ў ЁЈаҐ ‘ЋЉЋЌ…Љ‘ Ё Ёе бў®©бвў : + + Џ‹€’Ђ: ­Ґг­Ёз⮦ Ґ¬ п, Ї®¤ўЁ¦­ п, § Єалў Ґв „›ђ› + „›ђЂ: вг¤  ¬®¦­® бв «ЄЁў вм ‹Ђ‡…ђ› Ё ђЂ‡Ѓ€’›… Џ‹€’› + ђЂ‡Ѓ€’Ђџ Џ‹€’Ђ: г­Ёз⮦ Ґ¬ п, Ї®¤ўЁ¦­ п + ЉЋЌЌ…Љ’Ћђ: ­Ґг­Ёз⮦ Ґ¬л©, Ї®¤ўЁ¦­л© + ”€Љ‘-ЉЋЌЌ…Љ’Ћђ: ­Ґг­Ёз⮦ Ґ¬л©, Ї®¤ўЁ¦­л© + ‹Ђ‡…ђ: г­Ёз⮦ Ґ¬л©, Ї®¤ўЁ¦­л© + ‹Ђ‡…ђЌ›‰ ‹“—: г­Ёз⮦ Ґв ‹Ђ‡…ђ› Ё ђЂ‡Ѓ€’›… Џ‹€’›, Ї а «Ё§гҐв ’Ћ‹ЉЂ’…‹џ (!) + +–Ґ«м ЁЈал ўбҐЈ¤  ®¤Ё­ Є®ў : ‚л ¤®«¦­л Їа ўЁ«м­® ЇҐаҐбв ў«пвм Ў«®ЄЁ. +€­®Ј¤  § ¤ ­ЁҐ Є ¦Ґвбп ­ҐўлЇ®«­Ё¬л¬. +Ќ® Ўг¤м⥠㢥७л: ўбҐЈ¤  Ґбвм аҐиҐ­ЁҐ! + +—в® ҐйҐ ¬®¦­® ᤥ« вм: + +1. Џ®Єа бЁўиҐ Ё­вҐа䥩б - Ї®б«Ґ XTREE п Ї®­п«, зв® ¤«п Menuet ¬®¦­® + ®в­®бЁвҐ«м­® «ҐЈЄ® ЇЁб вм ®зҐ­м Єа бЁўлҐ Їа®Ја ¬¬л. +2. „®Ї®«­ЁвҐ«м­лҐ бЄЁ­л - ¤«п Јга¬ ­®ў. € ¬Ґ­миҐ а §¬Ґа д ©«®ў ᤥ« вм: + 11 ЄЎ Є Є-­ЁЄ Є ­  ¤®а®ЈҐ ­Ґ ў «повбп +3. “«гзиЁвм гЇа ў«Ґ­ЁҐ - ¬­Ґ в Є Є ¦Ґвбп. +4. ђҐ¤ Єв®а га®ў­Ґ©. ЏаЁ ®б®Ў®¬ ¦Ґ« ­ЁЁ д ©«л га®ў­Ґ© ¬®¦­® ЇЁб вм ўагз­го Ё + Є®¬ЇЁ«Ёа®ў вм FASM'®¬ - б¬. д ©«л CNF.ASM Ё CNF. +5. €бЇа ўЁвм Ў ЈЁ, ў­ҐбвЁ г«гз襭Ёп Ё гзҐбвм Ї®¦Ґ« ­Ёп ‚ б, гў ¦ Ґ¬ле + Ї®«м§®ў вҐ«Ґ© ¤ ­­®© Їа®Ја ¬¬л ;-) +6. ‚Є«озЁвм Ї®¤¤Ґа¦Єг ¤Ё «®Ј®ў Ё§ XTREE. + diff --git a/data/common/games/soko/skin.raw b/data/common/games/soko/skin.raw new file mode 100644 index 0000000000..2a57a4501a Binary files /dev/null and b/data/common/games/soko/skin.raw differ diff --git a/data/common/games/soko/soko b/data/common/games/soko/soko new file mode 100644 index 0000000000..ae8e211432 Binary files /dev/null and b/data/common/games/soko/soko differ diff --git a/data/common/games/soko/soko-4.lev b/data/common/games/soko/soko-4.lev new file mode 100644 index 0000000000..54d7c2f8d7 Binary files /dev/null and b/data/common/games/soko/soko-4.lev differ diff --git a/data/common/games/soko/soko-5.lev b/data/common/games/soko/soko-5.lev new file mode 100644 index 0000000000..ab118f8894 Binary files /dev/null and b/data/common/games/soko/soko-5.lev differ diff --git a/data/common/games/soko/soko-6.lev b/data/common/games/soko/soko-6.lev new file mode 100644 index 0000000000..0bec1d44de Binary files /dev/null and b/data/common/games/soko/soko-6.lev differ diff --git a/data/common/games/soko/soko-7.lev b/data/common/games/soko/soko-7.lev new file mode 100644 index 0000000000..47d4dae732 Binary files /dev/null and b/data/common/games/soko/soko-7.lev differ diff --git a/data/common/games/soko/soko-8.lev b/data/common/games/soko/soko-8.lev new file mode 100644 index 0000000000..62a85fe5ab Binary files /dev/null and b/data/common/games/soko/soko-8.lev differ diff --git a/data/common/games/soko/soko-9.lev b/data/common/games/soko/soko-9.lev new file mode 100644 index 0000000000..5c5ddd637e Binary files /dev/null and b/data/common/games/soko/soko-9.lev differ diff --git a/data/rus/Makefile b/data/rus/Makefile index 0a57931226..4b2f05cf65 100644 --- a/data/rus/Makefile +++ b/data/rus/Makefile @@ -196,6 +196,21 @@ FASM_PROGRAMS_CD:=\ drivers/atikms:DRIVERS/ATIKMS:$(REPOSITORY)/drivers/video/drm/radeon/atikms.asm \ # end of list +# The list of all FASM programs which needs to be compiled without KPACKing. +FASM_NOKPACK_PROGRAMS:=\ + distr_data/9x2klbr.exe::$(PROGS)/hd_load/9x2klbr/9x2klbr.asm \ + distr_data/MeOSload.com::$(PROGS)/hd_load/meosload/MeOSload.asm \ + distr_data/mtldr::$(PROGS)/hd_load/mtldr/mtldr.asm \ + mtldr_for_installer::$(PROGS)/hd_load/mtldr_installer/mtldr_code/mtldr.asm \ + distr_data/mtldr_install.exe::$(PROGS)/hd_load/mtldr_installer/mtldr_installer.asm \ + distr_data/MeOSload_for_usb_boot_old.com::$(PROGS)/hd_load/usb_boot_old/MeOSload.asm \ + distr_data/enable_for_usb_boot_old.exe::$(PROGS)/hd_load/usb_boot_old/enable.asm \ + distr_data/BOOT_F32.BIN::$(PROGS)/hd_load/usb_boot/BOOT_F32.ASM \ + distr_data/MTLD_F32::$(PROGS)/hd_load/usb_boot/mtldr.asm \ + distr_data/inst.exe::$(PROGS)/hd_load/usb_boot/inst.asm \ + distr_data/setmbr.exe::$(PROGS)/hd_load/usb_boot/setmbr.asm \ +#end of list + # The list of all NASM programs with one main NASM file. # Format of an item is exactly the same as in the previous list. NASM_PROGRAMS:=\ @@ -306,6 +321,32 @@ MKISOFS_EXTRA:=\ Docs/cp1251/readme.txt=docs/README.WIN.TXT \ Docs/cp1251/stack_ru.txt=docs/STACK_RU.WIN.TXT \ Docs/cp1251/sysfuncr.txt=docs/SYSFUNCR.WIN.TXT \ + HD_Load/9x2klbr/=distr_data/9x2klbr.exe \ + HD_Load/9x2klbr/=../common/hd_load/9x2klbr/LDKLBR.VXD \ + HD_Load/9x2klbr/=$(PROGS)/hd_load/9x2klbr/readme_dos.txt \ + HD_Load/9x2klbr/=$(PROGS)/hd_load/9x2klbr/readme_win.txt \ + HD_Load/MeOSLoad/=distr_data/MeOSLoad.com \ + HD_Load/MeOSLoad/=$(PROGS)/hd_load/meosload/AUTOEXEC.BAT \ + HD_Load/MeOSLoad/=$(PROGS)/hd_load/meosload/CONFIG.SYS \ + HD_Load/MeOSLoad/=$(PROGS)/hd_load/meosload/L_readme.txt \ + HD_Load/MeOSLoad/=$(PROGS)/hd_load/meosload/L_readme_Win.txt \ + HD_Load/mtldr/=distr_data/mtldr \ + HD_Load/mtldr/=$(PROGS)/hd_load/mtldr/install.txt \ + HD_Load/mtldr/=$(PROGS)/hd_load/mtldr/vista_install.bat \ + HD_Load/mtldr/=$(PROGS)/hd_load/mtldr/vista_remove.bat \ + HD_Load/=distr_data/mtldr_install.exe \ + HD_Load/memdisk=../common/hd_load/memdisk \ + HD_Load/USB_Boot/=distr_data/BOOT_F32.BIN \ + HD_Load/USB_Boot/=distr_data/MTLD_F32 \ + HD_Load/USB_Boot/=distr_data/inst.exe \ + HD_Load/USB_Boot/=distr_data/setmbr.exe \ + HD_Load/USB_Boot/=$(PROGS)/hd_load/usb_boot/readme.txt \ + HD_Load/USB_boot_old/=$(PROGS)/hd_load/usb_boot_old/usb_boot.rtf \ + HD_Load/USB_boot_old/=$(PROGS)/hd_load/usb_boot_old/usb_boot_866.txt \ + HD_Load/USB_boot_old/=$(PROGS)/hd_load/usb_boot_old/usb_boot_1251.txt \ + HD_Load/USB_boot_old/MeOSload.com=distr_data/MeOSload_for_usb_boot_old.com \ + HD_Load/USB_boot_old/enable.exe=distr_data/enable_for_usb_boot_old.exe \ + /=../common/games \ #end of list # Text files which need to be recoded to cp1251 from native aka cp866 @@ -418,6 +459,9 @@ File\ Managers/.dir: mkdir -p "File Managers" touch "File Managers/.dir" +# extra dependency for mtldr_install.exe +distr_data/mtldr_install.exe: mtldr_for_installer + # FASM black magic goes to Makefile.fasm. include Makefile.fasm diff --git a/data/rus/Makefile.fasm b/data/rus/Makefile.fasm index acf397fb86..7e81ac5935 100644 --- a/data/rus/Makefile.fasm +++ b/data/rus/Makefile.fasm @@ -37,9 +37,20 @@ $(1): $(2) Makefile.fasm .deps/.dir $$(call respace,$$(addsuffix .dir,$(3))) -include .deps/$(4).Po endef +define fasm_nokpack_meta_rule +$(1): $(2) Makefile.fasm .deps/.dir $$(call respace,$$(addsuffix .dir,$(3))) + fasm -m 65536 "$$<" "$$@" -s .deps/$(4).fas + prepsrc .deps/$(4).fas /dev/null + prepsrc .deps/$(4).fas /dev/stdout | \ + perl -n -e 's|\\|/|g;s| |\\ |g;push @a,$$$$1 if/^;include\\ \x27(.*?)\x27/;' \ + -e 'END{$$$$a=join " \\\n ",@a;print q`$(1): `,"$$$$a\n$$$$a:\n"}' > .deps/$(4).Po +-include .deps/$(4).Po +endef + progname=$(call respace,$(basename $(notdir $(call binarypart,$(f))))) binarydir=$(subst ./,,$(dir $(call binarypart,$(f)))) $(foreach f,$(FASM_PROGRAMS) $(FASM_PROGRAMS_CD) $(SKIN_SOURCES),$(eval $(call fasm_meta_rule,$(fbinary),$(fsource),$(binarydir),$(progname)))) +$(foreach f,$(FASM_NOKPACK_PROGRAMS),$(eval $(call fasm_nokpack_meta_rule,$(fbinary),$(fsource),$(binarydir),$(progname)))) # Rule for the kernel differs: it uses kerpack instead of kpack. kernel.mnt: $(KERNEL)/kernel.asm Makefile.fasm .deps/.dir diff --git a/programs/hd_load/9x2klbr/9x2klbr.asm b/programs/hd_load/9x2klbr/9x2klbr.asm new file mode 100644 index 0000000000..48352be052 --- /dev/null +++ b/programs/hd_load/9x2klbr/9x2klbr.asm @@ -0,0 +1,202 @@ + format PE GUI 4.0 +section '.text' code readable executable +entry start +start: + push ebp + mov ebp, info + xor ebx, ebx +; set current directory to exe dir + push 300 + push ebp + push ebx + call [GetModuleFileNameA] + lea edi, [ebp+eax] + xchg eax, ecx + mov al, '\' + std + repnz scasb + cld + jz @f + pop ebp + ret +@@: + mov byte [edi+1], bl + push ebp + call [SetCurrentDirectoryA] +; parse command line + call [GetCommandLineA] + xchg eax, esi +; skip leading spaces +@@: + lodsb + cmp al, 0 + jz cmdlineend + cmp al, ' ' + jbe @b + cmp al, '"' + jz p +; skip EXE name +@@: + lodsb + cmp al, ' ' + ja @b + dec esi + jmp q +p: + lodsb + cmp al, 0 + jz cmdlineend + cmp al, '"' + jnz p +q: +; skip leading spaces + lodsb + cmp al, 0 + jz cmdlineend + cmp al, ' ' + jbe q + dec esi +; now esi points to 1st argument + jmp @f +cmdlineend: + mov esi, def +@@: + mov al, 'c' + cmp byte [esi+1], ':' + jnz @f + lodsb + inc esi +@@: + mov [ebp], al + lodsb + cmp al, '\' + jz paramsok +usage: + mov esi, usagemsg + jmp failmsg +paramsok: + cmp byte [esi], '\' + jz usage + mov edi, esi + mov al, 0 + xor ecx, ecx + dec ecx + repnz scasb + not ecx + cmp ecx, 290 + jae usage + lea edi, [ebp+1] + cmp ecx, 1 + rep movsb + jz copydefname + cmp byte [edi-2], '\' + jnz namegiven +copydefname: + dec edi + mov ecx, defnamesz + mov esi, defname + rep movsb +namegiven: + push ebx ; hTemplateFile +; push 0x04000000 ; dwFlagsAndAttributes = FILE_FLAG_DELETE_ON_CLOSE + push ebx + push ebx ; dwCreationDisposition + push ebx ; lpSecurityAttributes + push ebx ; dwShareMode + push ebx ; dwDesiredAccess + push name ; lpFileName + call [CreateFileA] + inc eax + mov esi, errmsg + jz failmsg + dec eax + push ebx + push ebx + push ebx + push ebx + sub edi, ebp + push edi + push ebp + push 0Fh + push eax + call [DeviceIoControl] + test eax, eax + mov esi, errmsg2 + jz failmsg + push ebx + push 2 ; EWX_REBOOT + call [ExitWindowsEx] + pop ebp + ret +failmsg: + push ebx + push ebx + push esi + push ebx + call [MessageBoxA] + pop ebp + ret + +align 4 +data import + dd 0,0,0 + dd rva kernel32_name + dd rva kernel32_thunks + dd 0,0,0 + dd rva user32_name + dd rva user32_thunks + dd 0,0,0,0,0 +kernel32_thunks: +CreateFileA dd rva CreateFileA_thunk +CloseHandle dd rva CloseHandle_thunk +DeviceIoControl dd rva DeviceIoControl_thunk +GetCommandLineA dd rva GetCommandLineA_thunk +SetCurrentDirectoryA dd rva SetCurrentDirectoryA_thunk +GetModuleFileNameA dd rva GetModuleFileNameA_thunk + dd 0 +user32_thunks: +MessageBoxA dd rva MessageBoxA_thunk +ExitWindowsEx dd rva ExitWindowsEx_thunk + dw 0 +CreateFileA_thunk: + dw 0 + db 'CreateFileA' +CloseHandle_thunk: + dw 0 + db 'CloseHandle' +DeviceIoControl_thunk: + dw 0 + db 'DeviceIoControl' +GetCommandLineA_thunk: + dw 0 + db 'GetCommandLineA' +SetCurrentDirectoryA_thunk: + dw 0 + db 'SetCurrentDirectoryA' +GetModuleFileNameA_thunk: + dw 0 + db 'GetModuleFileNameA' +MessageBoxA_thunk: + dw 0 + db 'MessageBoxA' +ExitWindowsEx_thunk: + dw 0 + db 'ExitWindowsEx',0 +kernel32_name db 'kernel32.dll',0 +user32_name db 'user32.dll',0 +end data + +section '.data' data readable writable +data resource from 'klbrico.res' +end data + +name db '\\.\' +vxdfilename db 'ldklbr.vxd',0 +errmsg db 'Cannot load driver',0 +errmsg2 db 'Invalid parameter',0 +usagemsg db 'Usage: 9x2klbr [[drive:]\[path\][imagename]]',0 +def db '\' +defname db 'kolibri.img',0 +defnamesz = $ - defname + +info rb 300 diff --git a/programs/hd_load/9x2klbr/DEFFILE.DEF b/programs/hd_load/9x2klbr/DEFFILE.DEF new file mode 100644 index 0000000000..2684f09da2 --- /dev/null +++ b/programs/hd_load/9x2klbr/DEFFILE.DEF @@ -0,0 +1,23 @@ +VXD LDKLBR DYNAMIC + +SEGMENTS + _LPTEXT CLASS 'LCODE' PRELOAD NONDISCARDABLE + _LTEXT CLASS 'LCODE' PRELOAD NONDISCARDABLE + _LDATA CLASS 'LCODE' PRELOAD NONDISCARDABLE + _TEXT CLASS 'LCODE' PRELOAD NONDISCARDABLE + _DATA CLASS 'LCODE' PRELOAD NONDISCARDABLE + CONST CLASS 'LCODE' PRELOAD NONDISCARDABLE + _TLS CLASS 'LCODE' PRELOAD NONDISCARDABLE + _BSS CLASS 'LCODE' PRELOAD NONDISCARDABLE + _ITEXT CLASS 'ICODE' DISCARDABLE + _IDATA CLASS 'ICODE' DISCARDABLE + _PTEXT CLASS 'PCODE' NONDISCARDABLE + _PDATA CLASS 'PDATA' NONDISCARDABLE SHARED + _STEXT CLASS 'SCODE' RESIDENT + _SDATA CLASS 'SCODE' RESIDENT + _16ICODE CLASS '16ICODE' PRELOAD DISCARDABLE + _RCODE CLASS 'RCODE' + +EXPORTS + + LDKLBR_DDB @1 \ No newline at end of file diff --git a/programs/hd_load/9x2klbr/Klbrico.res b/programs/hd_load/9x2klbr/Klbrico.res new file mode 100644 index 0000000000..06b56a3827 Binary files /dev/null and b/programs/hd_load/9x2klbr/Klbrico.res differ diff --git a/programs/hd_load/9x2klbr/V86MMGR.INC b/programs/hd_load/9x2klbr/V86MMGR.INC new file mode 100644 index 0000000000..5c8da95ea6 --- /dev/null +++ b/programs/hd_load/9x2klbr/V86MMGR.INC @@ -0,0 +1,178 @@ +;****************************************************************************** +; +; (C) Copyright MICROSOFT Corp., 1988-1990 +; +; Title: V86MMGR.Inc - Public services for V86MMGR +; +; Version: 2.00 +; +; Date: 29-Nov-88 +; +; Author: ARR +; +;------------------------------------------------------------------------------ +; +; Change log: +; +; DATE REV DESCRIPTION +; ----------- --- ----------------------------------------------------------- +; 29-Nov-1988 ARR Original +; 26-Apr-1989 RAL New mapper services +; +;============================================================================== + +Begin_Service_Table V86MMGR + +V86MMGR_Service V86MMGR_Get_Version, LOCAL +V86MMGR_Service V86MMGR_Allocate_V86_Pages, LOCAL +V86MMGR_Service V86MMGR_Set_EMS_XMS_Limits, LOCAL +V86MMGR_Service V86MMGR_Get_EMS_XMS_Limits, LOCAL +; +; Services used for API mapping. +; +V86MMGR_Service V86MMGR_Set_Mapping_Info, VxD_ICODE +V86MMGR_Service V86MMGR_Get_Mapping_Info +V86MMGR_Service V86MMGR_Xlat_API +V86MMGR_Service V86MMGR_Load_Client_Ptr +V86MMGR_Service V86MMGR_Allocate_Buffer +V86MMGR_Service V86MMGR_Free_Buffer +V86MMGR_Service V86MMGR_Get_Xlat_Buff_State +V86MMGR_Service V86MMGR_Set_Xlat_Buff_State +V86MMGR_Service V86MMGR_Get_VM_Flat_Sel +V86MMGR_Service V86MMGR_Map_Pages +V86MMGR_Service V86MMGR_Free_Page_Map_Region +;*********************************************************** +; END OF 3.00 level services +; +V86MMGR_Service V86MMGR_LocalGlobalReg +V86MMGR_Service V86MMGR_GetPgStatus, LOCAL +V86MMGR_Service V86MMGR_SetLocalA20, VxD_ICODE +V86MMGR_Service V86MMGR_ResetBasePages, LOCAL +V86MMGR_Service V86MMGR_SetAvailMapPgs, VxD_ICODE +V86MMGR_Service V86MMGR_NoUMBInitCalls, VxD_ICODE + +IFNDEF WIN31COMPAT + +; Services added post Win 3.1 +V86MMGR_Service V86MMGR_Get_EMS_XMS_Avail, LOCAL +V86MMGR_Service V86MMGR_Toggle_HMA +V86MMGR_Service V86MMGR_Dev_Init, LOCAL +V86MMGR_Service V86MMGR_Alloc_UM_Page, LOCAL + +ENDIF ; WIN31COMPAT + +ifdef NEC_98 +;;V86MMGR_Service V86MMGR_EMM_B0Bank_CHK +V86MMGR_Service V86MMGR_Check_NHSupport, LOCAL +endif + +End_Service_Table V86MMGR + +; +; BITS of returned EAX flags for V86MMGR_GetPgStatus +; +V86PS_ROM equ 0000000000000001b ; Page contains global ROM +V86PS_RAM equ 0000000000000010b ; Page contains global RAM +V86PS_EMM equ 0000000010000000b ; Page belongs to EMM driver +V86PS_XMS equ 0000000100000000b ; Page belongs to XMS driver +V86PS_MAP equ 0000001000000000b ; Page belongs to mapper +V86PS_UMB equ 0001000000000000b ; Page contains imported UMB + ; (Note that V86PS_XMS is not + ; necessarily set) + +; +; BITS of ECX flags for V86MMGR_Allocate_V86_Pages +; +AV86PLocked EQU 00000000000000000000000000000001B +AV86PLockedBit EQU 0 ; VM memory is to be + ; ALWAYS LOCKED regardless of + ; pager type or whether VM + ; is suspended. +; +; BITS of ECX flags for V86MMGR_Set_EMS_XMS_Limits +; +; NOTE: If neither Limit_DisableHMA or Limit_EnableHMA is set, the HMA +; state is not altered. +; +EMS_XMS_Limit_DisableHMA EQU 00000000000000000000000000000001B +EMS_XMS_Limit_DisableHMABit EQU 0 +EMS_XMS_Limit_EnableHMA EQU 00000000000000000000000000000010B +EMS_XMS_Limit_EnableHMABit EQU 1 +EMS_XMS_Limit_XMS_Is_Locked EQU 00000000000000000000000000000100B +EMS_XMS_Limit_XMS_Is_LockedBit EQU 2 +EMS_XMS_Limit_EMS_Is_Locked EQU 00000000000000000000000000001000B +EMS_XMS_Limit_EMS_Is_LockedBit EQU 3 + + + +; +; API mapper equates and macros +; + +Xlat_Exec_Int EQU 000h +Xlat_Fixed_Len EQU 001h +Xlat_Var_Len EQU 002h +Xlat_Calc_Len EQU 003h +Xlat_ASCIIZ EQU 004h +Xlat_Jmp_To_Proc EQU 005h +Xlat_Return_Ptr EQU 006h +Xlat_Return_Seg EQU 007h +Xlat_ASCIIZ_InOut EQU 008h + + +Xlat_API_Exec_Int MACRO Int_Number + db Xlat_Exec_Int + db Int_Number + ENDM + +Xlat_API_Fixed_Len MACRO Ptr_Seg, Ptr_Off, Length + db Xlat_Fixed_Len + dw Length + dw (Client_&Ptr_Seg*100h)+Client_&Ptr_Off + ENDM + +Xlat_API_Var_Len MACRO Ptr_Seg, Ptr_Off, Len_Reg + db Xlat_Var_Len + db Client_&Len_Reg + dw (Client_&Ptr_Seg*100h)+Client_&Ptr_Off + ENDM + +Xlat_API_Calc_Len MACRO Ptr_Seg, Ptr_Off, Calc_Proc_Addr + db Xlat_Calc_Len + dd OFFSET32 Calc_Proc_Addr + dw (Client_&Ptr_Seg*100h)+Client_&Ptr_Off + ENDM + +Xlat_API_ASCIIZ MACRO Ptr_Seg, Ptr_Off + db Xlat_ASCIIZ + dw (Client_&Ptr_Seg*100h)+Client_&Ptr_Off + ENDM + +Xlat_API_ASCIIZ_InOut MACRO Ptr_Seg, Ptr_Off + db Xlat_ASCIIZ_InOut + dw (Client_&Ptr_Seg*100h)+Client_&Ptr_Off + ENDM + +Xlat_API_Jmp_To_Proc MACRO Proc_Name + db Xlat_Jmp_To_Proc + dd OFFSET32 Proc_Name + ENDM + + +Xlat_API_Return_Ptr MACRO Ptr_Seg, Ptr_Off + db Xlat_Return_Ptr + dw (Client_&Ptr_Seg*100h)+Client_&Ptr_Off + ENDM + +Xlat_API_Return_Seg MACRO Ptr_Seg + db Xlat_Return_Seg + db Client_&Ptr_Seg + ENDM + +; +; The V86MMGR does W386_Device_Broadcast call outs. The 'subfunction' number +; for these call outs is contained in the CX register. These are the equates +; for the subfunction numbers. +; +V86CallOut_LclA20forGlblHMA equ 0 ; Should A20 state be local + ; even if HMA is GLOBAL? diff --git a/programs/hd_load/9x2klbr/VMM.INC b/programs/hd_load/9x2klbr/VMM.INC new file mode 100644 index 0000000000..be531f1caf --- /dev/null +++ b/programs/hd_load/9x2klbr/VMM.INC @@ -0,0 +1,4522 @@ +ifndef _VMM_ +_VMM_ EQU 1 +FALSE EQU 0 +VMM_TRUE EQU (NOT FALSE) +DEBLEVELRETAIL EQU 0 +DEBLEVELNORMAL EQU 1 +DEBLEVELMAX EQU 2 +ifndef DEBLEVEL +ifdef DEBUG +DEBLEVEL EQU DEBLEVELNORMAL +else +DEBLEVEL EQU DEBLEVELRETAIL +endif +endif +ifndef WIN31COMPAT +WIN40SERVICES EQU 1 +WIN403SERVICES EQU 1 +endif +ifndef WIN40COMPAT +WIN41SERVICES EQU 1 +endif +ifdef MASM6 +ifndef NO_MASM6_OPTIONS + + + + option oldmacros +ifndef NEWSTRUCTS + option oldstructs +endif + option noscoped + option segment:flat + option offset:flat + option proc:private +endif +endif + + + + +IFDEF MASM6 +BeginDoc MACRO + ENDM +EndDoc MACRO + ENDM + +BeginMsg MACRO + ENDM +EndMsg MACRO + ENDM +ELSE +BeginDoc EQU <> +EndDoc EQU <> + +BeginMsg EQU <> +EndMsg EQU <> +ENDIF + +UNDEFINED_DEVICE_ID EQU 00000H +VMM_DEVICE_ID EQU 00001H +DEBUG_DEVICE_ID EQU 00002H +VPICD_DEVICE_ID EQU 00003H +VDMAD_DEVICE_ID EQU 00004H +VTD_DEVICE_ID EQU 00005H +V86MMGR_DEVICE_ID EQU 00006H +PAGESWAP_DEVICE_ID EQU 00007H +PARITY_DEVICE_ID EQU 00008H +REBOOT_DEVICE_ID EQU 00009H +VDD_DEVICE_ID EQU 0000AH +VSD_DEVICE_ID EQU 0000BH +VMD_DEVICE_ID EQU 0000CH +VKD_DEVICE_ID EQU 0000DH +VCD_DEVICE_ID EQU 0000EH +VPD_DEVICE_ID EQU 0000FH +BLOCKDEV_DEVICE_ID EQU 00010H +VMCPD_DEVICE_ID EQU 00011H +EBIOS_DEVICE_ID EQU 00012H +BIOSXLAT_DEVICE_ID EQU 00013H +VNETBIOS_DEVICE_ID EQU 00014H +DOSMGR_DEVICE_ID EQU 00015H +WINLOAD_DEVICE_ID EQU 00016H +SHELL_DEVICE_ID EQU 00017H +VMPOLL_DEVICE_ID EQU 00018H +VPROD_DEVICE_ID EQU 00019H +DOSNET_DEVICE_ID EQU 0001AH +VFD_DEVICE_ID EQU 0001BH +VDD2_DEVICE_ID EQU 0001CH +WINDEBUG_DEVICE_ID EQU 0001DH +TSRLOAD_DEVICE_ID EQU 0001EH +BIOSHOOK_DEVICE_ID EQU 0001FH +INT13_DEVICE_ID EQU 00020H +PAGEFILE_DEVICE_ID EQU 00021H +SCSI_DEVICE_ID EQU 00022H +MCA_POS_DEVICE_ID EQU 00023H +SCSIFD_DEVICE_ID EQU 00024H +VPEND_DEVICE_ID EQU 00025H +APM_DEVICE_ID EQU 00026H +VPOWERD_DEVICE_ID EQU APM_DEVICE_ID +VXDLDR_DEVICE_ID EQU 00027H +NDIS_DEVICE_ID EQU 00028H +BIOS_EXT_DEVICE_ID EQU 00029H +VWIN32_DEVICE_ID EQU 0002AH +VCOMM_DEVICE_ID EQU 0002BH +SPOOLER_DEVICE_ID EQU 0002CH +WIN32S_DEVICE_ID EQU 0002DH +DEBUGCMD_DEVICE_ID EQU 0002EH +CONFIGMG_DEVICE_ID EQU 00033H +DWCFGMG_DEVICE_ID EQU 00034H +SCSIPORT_DEVICE_ID EQU 00035H +VFBACKUP_DEVICE_ID EQU 00036H +ENABLE_DEVICE_ID EQU 00037H +VCOND_DEVICE_ID EQU 00038H +ISAPNP_DEVICE_ID EQU 0003CH +BIOS_DEVICE_ID EQU 0003DH +IFSMgr_Device_ID EQU 00040H +VCDFSD_DEVICE_ID EQU 00041H +MRCI2_DEVICE_ID EQU 00042H +PCI_DEVICE_ID EQU 00043H +PELOADER_DEVICE_ID EQU 00044H +EISA_DEVICE_ID EQU 00045H +DRAGCLI_DEVICE_ID EQU 00046H +DRAGSRV_DEVICE_ID EQU 00047H +PERF_DEVICE_ID EQU 00048H +AWREDIR_DEVICE_ID EQU 00049H +DDS_DEVICE_ID EQU 0004AH +NTKERN_DEVICE_ID EQU 0004BH +VDOSKEYD_DEVICE_ID EQU 0004BH +ACPI_DEVICE_ID EQU 0004CH +UDF_DEVICE_ID EQU 0004DH +SMCLIB_DEVICE_ID EQU 0004EH +ETEN_Device_ID EQU 00060H +CHBIOS_Device_ID EQU 00061H +VMSGD_Device_ID EQU 00062H +VPPID_Device_ID EQU 00063H +VIME_Device_ID EQU 00064H +VHBIOSD_Device_ID EQU 00065H +BASEID_FOR_NAMEBASEDVXD EQU 0f000H +BASEID_FOR_NAMEBASEDVXD_MASK EQU 0fffH +VMM_INIT_ORDER EQU 000000000H +DEBUG_INIT_ORDER EQU 000000000H +DEBUGCMD_INIT_ORDER EQU 000000000H +PERF_INIT_ORDER EQU 000900000H +APM_INIT_ORDER EQU 001000000H +VPOWERD_INIT_ORDER EQU APM_INIT_ORDER +BIOSHOOK_INIT_ORDER EQU 006000000H +VPROD_INIT_ORDER EQU 008000000H +VPICD_INIT_ORDER EQU 00C000000H +VTD_INIT_ORDER EQU 014000000H +VWIN32_INIT_ORDER EQU 014100000H +VXDLDR_INIT_ORDER EQU 016000000H +NTKERN_INIT_ORDER EQU 016200000H +CONFIGMG_INIT_ORDER EQU 016400000H +ENUMERATOR_INIT_ORDER EQU 016800000H +ISAPNP_INIT_ORDER EQU ENUMERATOR_INIT_ORDER +EISA_INIT_ORDER EQU ENUMERATOR_INIT_ORDER +PCI_INIT_ORDER EQU ENUMERATOR_INIT_ORDER +BIOS_INIT_ORDER EQU ENUMERATOR_INIT_ORDER+1 +ACPI_INIT_ORDER EQU ENUMERATOR_INIT_ORDER+2 +VCDFSD_INIT_ORDER EQU 016F00000H +IOS_INIT_ORDER EQU 017000000H +PAGEFILE_INIT_ORDER EQU 018000000H +PAGESWAP_INIT_ORDER EQU 01C000000H +PARITY_INIT_ORDER EQU 020000000H +REBOOT_INIT_ORDER EQU 024000000H +EBIOS_INIT_ORDER EQU 026000000H +VDD_INIT_ORDER EQU 028000000H +VSD_INIT_ORDER EQU 02C000000H +VCD_INIT_ORDER EQU 030000000H +COMMDRVR_INIT_ORDER EQU (VCD_INIT_ORDER-1) +PRTCL_INIT_ORDER EQU (COMMDRVR_INIT_ORDER-2) +MODEM_INIT_ORDER EQU (COMMDRVR_INIT_ORDER-3) +PORT_INIT_ORDER EQU (COMMDRVR_INIT_ORDER-4) +VMD_INIT_ORDER EQU 034000000H +VKD_INIT_ORDER EQU 038000000H +VPD_INIT_ORDER EQU 03C000000H +BLOCKDEV_INIT_ORDER EQU 040000000H +MCA_POS_INIT_ORDER EQU 041000000H +SCSIFD_INIT_ORDER EQU 041400000H +SCSIMASTER_INIT_ORDER EQU 041800000H +INT13_INIT_ORDER EQU 042000000H +VMCPD_INIT_ORDER EQU 048000000H +BIOSXLAT_INIT_ORDER EQU 050000000H +VNETBIOS_INIT_ORDER EQU 054000000H +DOSMGR_INIT_ORDER EQU 058000000H +DOSNET_INIT_ORDER EQU 05C000000H +WINLOAD_INIT_ORDER EQU 060000000H +VMPOLL_INIT_ORDER EQU 064000000H +UNDEFINED_INIT_ORDER EQU 080000000H +VCOND_INIT_ORDER EQU UNDEFINED_INIT_ORDER +WINDEBUG_INIT_ORDER EQU 081000000H +VDMAD_INIT_ORDER EQU 090000000H +V86MMGR_INIT_ORDER EQU 0A0000000H +IFSMgr_Init_Order EQU 10000H+V86MMGR_Init_Order +FSD_Init_Order EQU 00100H+IFSMgr_Init_Order +VFD_INIT_ORDER EQU 50000H+IFSMgr_Init_Order +UNDEF_TOUCH_MEM_INIT_ORDER EQU 0A8000000H +SHELL_INIT_ORDER EQU 0B0000000H + + + + + + +IO_Delay macro +jmp $+2 +ENDM + +VXD_FAILURE EQU 0 +VXD_SUCCESS EQU 1 + +Pushad_Struc STRUC +Pushad_EDI DD ? +Pushad_ESI DD ? +Pushad_EBP DD ? +Pushad_ESP DD ? +Pushad_EBX DD ? +Pushad_EDX DD ? +Pushad_ECX DD ? +Pushad_EAX DD ? +Pushad_Struc ENDS +ifndef Not_VxD +??_CUR_CODE_SEG = 0 + +??_LCODE = 1 +??_ICODE = 2 +??_PCODE = 3 +??_SCODE = 4 +??_DBOCODE = 5 +??_16ICODE = 6 +??_RCODE = 7 +??_LOCKABLECODE = 8 + +?_LCODE equ <(??_CUR_CODE_SEG MOD 16) - ??_LCODE> +?_ICODE equ <(??_CUR_CODE_SEG MOD 16) - ??_ICODE> +?_PCODE equ <(??_CUR_CODE_SEG MOD 16) - ??_PCODE> +?_SCODE equ <(??_CUR_CODE_SEG MOD 16) - ??_SCODE> +?_DBOCODE equ <(??_CUR_CODE_SEG MOD 16) - ??_DBOCODE> +?_16ICODE equ <(??_CUR_CODE_SEG MOD 16) - ??_16ICODE> +?_RCODE equ <(??_CUR_CODE_SEG MOD 16) - ??_RCODE> +?_LOCKABLECODE equ <(??_CUR_CODE_SEG MOD 16) - ??_LOCKABLECODE> + +ifndef NO_SEGMENTS + + + + + +IFDEF MASM6 +_FLAT EQU FLAT +ELSE +_FLAT EQU USE32 +ENDIF + + +_LTEXT SEGMENT DWORD PUBLIC _FLAT 'LCODE' +_LTEXT ENDS + +_TEXT SEGMENT DWORD PUBLIC _FLAT 'LCODE' +_TEXT ENDS + + +_PTEXT SEGMENT DWORD PUBLIC _FLAT 'PCODE' +_PTEXT ENDS + + + +MakeCodeSeg MACRO seglist, classname, grpname, iseg + + IRP segname, + +IFNB + segname SEGMENT DWORD PUBLIC _FLAT "&classname&CODE" +ELSE + segname SEGMENT DWORD PUBLIC _FLAT "&segname&CODE" +ENDIF + +IFB +VxD_&&segname&&_CODE_SEG MACRO +segname SEGMENT +??_CUR_CODE_SEG = ??_CUR_CODE_SEG SHL 4 + ??_PCODE + ASSUME cs:FLAT, ds:FLAT, es:FLAT, ss:FLAT + + ENDM +ELSE +VxD_&&segname&&_CODE_SEG MACRO +segname SEGMENT +??_CUR_CODE_SEG = ??_CUR_CODE_SEG SHL 4 + iseg + ASSUME cs:FLAT, ds:FLAT, es:FLAT, ss:FLAT + + ENDM +ENDIF + +VxD_&&segname&&_CODE_ENDS MACRO +??_CUR_CODE_SEG = ??_CUR_CODE_SEG SHR 4 +segname ENDS + ENDM + +segname ENDS + +IFNDEF BLD_COFF +IFNB + _&grpname GROUP segname +ELSE + _&&segname GROUP segname +ENDIF +ENDIF + + ENDM + + ENDM + +MakeCodeSeg , \ + LOCKABLE, LOCKABLE, ??_LOCKABLECODE +MakeCodeSeg INT21 +MakeCodeSeg SYSEXIT +MakeCodeSeg RARE +MakeCodeSeg W16 +MakeCodeSeg W32 +MakeCodeSeg VMCREATE +MakeCodeSeg VMDESTROY +MakeCodeSeg THCREATE +MakeCodeSeg THDESTROY +MakeCodeSeg VMSUSPEND +MakeCodeSeg VMRESUME +MakeCodeSeg PNP +MakeCodeSeg DOSVM + + + + + + + + + + + +DefLockableCodeBegin MACRO name, private +VxD_L0CKABLE_BEGIN_CODE_SEG +IFB + PUBLIC name +ENDIF +name LABEL NEAR +ifdef BLD_COFF + DD ? +endif +VxD_L0CKABLE_BEGIN_CODE_ENDS +ifndef WIN31COMPAT +if DEBLEVEL +VxD_LOCKED_DATA_SEG + PUBLIC name&_Debug_Flags +name&_Debug_Flags DD DFS_TEST_BLOCK +VxD_LOCKED_DATA_ENDS +??_debug_flags equ +endif +endif + ENDM + + + + + + + + + +DefLockableCodeEnd MACRO name, private +VxD_LOCKABLE_END_CODE_SEG +IFB + PUBLIC name +ENDIF +name LABEL NEAR +ifdef BLD_COFF + DD ? +endif +VxD_LOCKABLE_END_CODE_ENDS + ENDM + + + + + +CodeLockFlags MACRO name +ifndef WIN31COMPAT +if DEBLEVEL + ifndef name&_Debug_Flags + VxD_LOCKED_DATA_SEG + extrn name&_Debug_Flags:dword + VxD_LOCKED_DATA_ENDS + ??_debug_flags equ + endif +endif +endif + ENDM + + + + + + +MarkCodeLocked MACRO +ifndef WIN31COMPAT +if DEBLEVEL +ifdef ??_debug_flags + pushfd + and ??_debug_flags,NOT DFS_TEST_BLOCK + popfd +endif +endif +endif + ENDM + + + + + + +MarkCodeUnlocked MACRO +ifndef WIN31COMPAT +if DEBLEVEL +ifdef ??_debug_flags + pushfd + or ??_debug_flags,DFS_TEST_BLOCK + popfd +endif +endif +endif + ENDM + + + +_ITEXT SEGMENT DWORD PUBLIC _FLAT 'ICODE' +_ITEXT ENDS + + +_LDATA SEGMENT DWORD PUBLIC _FLAT 'LCODE' +_LDATA ENDS + +_DATA SEGMENT DWORD PUBLIC _FLAT 'LCODE' +_DATA ENDS + + +_PDATA SEGMENT DWORD PUBLIC _FLAT 'PDATA' +_PDATA ENDS + + +_IDATA SEGMENT DWORD PUBLIC _FLAT 'ICODE' +_IDATA ENDS + + +_BSS SEGMENT DWORD PUBLIC _FLAT 'LCODE' +_BSS ENDS + +CONST SEGMENT DWORD PUBLIC _FLAT 'LCODE' +CONST ENDS + +_TLS SEGMENT DWORD PUBLIC _FLAT 'LCODE' +_TLS ENDS + + +_STEXT SEGMENT DWORD PUBLIC _FLAT 'SCODE' +_STEXT ENDS + + +_SDATA SEGMENT DWORD PUBLIC _FLAT 'SCODE' +_SDATA ENDS + + +_DB0START SEGMENT DWORD PUBLIC _FLAT 'DBOCODE' +_DB0START ENDS + + +_DB1CODE SEGMENT DWORD PUBLIC _FLAT 'DBOCODE' +_DB1CODE ENDS + + +_DB2DATA SEGMENT DWORD PUBLIC _FLAT 'DBOCODE' +_DB2DATA ENDS + +if DEBLEVEL + +_PATHSTART SEGMENT DWORD PUBLIC _FLAT 'LCODE' +_PATHSTART ENDS + + +_PATHDATA SEGMENT DWORD PUBLIC _FLAT 'LCODE' +_PATHDATA ENDS + + +_PATHEND SEGMENT DWORD PUBLIC _FLAT 'LCODE' +_PATHEND ENDS +endif + + +_16ICODE SEGMENT WORD USE16 PUBLIC '16ICODE' +_16ICODE ENDS + + +_RCODE SEGMENT WORD USE16 PUBLIC 'RCODE' +_RCODE ENDS + +IFNDEF BLD_COFF +_LGROUP GROUP _LTEXT, _TEXT, _LDATA, _DATA, _BSS, CONST, _TLS +_IGROUP GROUP _ITEXT, _IDATA +_SGROUP GROUP _STEXT, _SDATA +_DBOGROUP GROUP _DB0START, _DB1CODE, _DB2DATA +IF DEBLEVEL +_PGROUP GROUP _PATHSTART, _PATHDATA, _PATHEND +ENDIF +ENDIF + +endif + + ASSUME CS:FLAT, DS:FLAT, ES:FLAT, SS:FLAT + +OFFSET32 EQU + + +BeginDoc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +EndDoc + +Begin_Service_Table MACRO Device_Name, Def_Segment + +IFDEF Device_Name&_Name_Based + IFNDEF @@NextInternalID + @@NextInternalID = 0 + ENDIF + @@NextInternalID = (@@NextInternalID + 1) + Device_Name&_Internal_ID = @@NextInternalID + BASEID_FOR_NAMEBASEDVXD + DefineVxDName Device_Name, %Device_Name&_Internal_ID +ENDIF + +IFB + BST2 Device_Name, VxD +ELSE + BST2 Device_Name, Def_Segment +ENDIF + ENDM + +DefineVxDName MACRO Device_Name, InternalID + @@VxDName&InternalID EQU <___&Device_Name&STable> +ENDM + + +BST2 MACRO Device_Name, Def_Segment + +Num_&Device_Name&_Services = 0 + +IFDEF Create_&Device_Name&_Service_Table + + +Def_Segment&_LOCKED_DATA_SEG + +Device_Name&_Service_Table LABEL DWORD + +Device_Name&_Service MACRO Procedure, Local_Seg, Condition, StdCallBytes, fastcall +LOCAL $$&Procedure, extrnproc, tableproc + + extrnproc MACRO + IFNB + IFB + .err + ENDIF + EXTRN @&&Procedure&&@&&StdCallBytes:NEAR + ELSE + IFNB + EXTRN _&&Procedure&&@&&StdCallBytes:NEAR + ELSE + EXTRN Procedure:NEAR + ENDIF + ENDIF + ENDM + + tableproc MACRO + IFNB + dd OFFSET32 @&&Procedure&&@&&StdCallBytes + ELSE + IFNB + dd OFFSET32 _&&Procedure&&@&&StdCallBytes + ELSE + dd OFFSET32 Procedure + ENDIF + ENDIF + ENDM + + IFNB + $$&&Procedure MACRO extern + IFDEF &Condition + IFNB + extrnproc + ELSE + tableproc + ENDIF + ELSE + IFB + dd 0 + ENDIF + ENDIF + ENDM + ENDIF + + IFDIFI , + PUBLIC _&&Procedure + IF1 + _&&Procedure LABEL DWORD + IFNB + PUBLIC __&&Procedure + __&&Procedure LABEL DWORD + ENDIF + ENDIF + IFDIFI , + IFNB +Local_Seg&&_SEG + ELSE +Def_Segment&_CODE_SEG + ENDIF + IFNB + $$&&Procedure extern + ELSE + extrnproc + ENDIF + IFNB +Local_Seg&&_ENDS + ELSE +Def_Segment&_CODE_ENDS + ENDIF + ENDIF + IFNB + $$&&Procedure + ELSE + tableproc + ENDIF + + IFDEF Device_Name&_Name_Based + @@&&Procedure = (Device_Name&_Internal_ID SHL 16) + Num_&Device_Name&_Services + ELSE + @@&&Procedure = (Device_Name&_Device_ID SHL 16) + Num_&Device_Name&_Services + ENDIF + ELSE + dd 0 + ENDIF + Num_&Device_Name&_Services = Num_&Device_Name&_Services + 1 + IFNB + Purge $$&&Procedure + ENDIF + Purge extrnproc + Purge tableproc + ENDM + + Device_Name&_StdCall_Service MACRO Procedure, Args, Local_Seg, Condition + Device_Name&_Service Procedure, Local_Seg, Condition, %Args*4 + ??_standardccall&&_Procedure = Args + ENDM + + Device_Name&_FastCall_Service MACRO Procedure, Args, Local_Seg, Condition + Device_Name&_Service Procedure, Local_Seg, Condition, %Args*4, TRUE + ??_fastcall&&_Procedure = Args + ENDM + +ELSE + + + +IFDEF Device_Name&_Name_Based + +Device_Name&_Service MACRO Procedure, Local_Seg, Condition + + + IFDIFI , + @@&&Procedure = (Device_Name&_Internal_ID SHL 16) + Num_&Device_Name&_Services + ENDIF + Num_&Device_Name&_Services = Num_&Device_Name&_Services + 1 + + ENDM +ELSE + +Device_Name&_Service MACRO Procedure, Local_Seg, Condition + + IFDIFI , + @@&&Procedure = (Device_Name&_Device_ID SHL 16) + Num_&Device_Name&_Services + ENDIF + Num_&Device_Name&_Services = Num_&Device_Name&_Services + 1 + + ENDM + +ENDIF + + Device_Name&_StdCall_Service MACRO Procedure, Args, Local_Seg, Condition + Device_Name&_Service Procedure, Local_Seg, Condition + ??_standardccall_&&Procedure = Args + ENDM + + Device_Name&_FastCall_Service MACRO Procedure, Args, Local_Seg, Condition + Device_Name&_Service Procedure, Local_Seg, Condition + ??_fastcall_&&Procedure = Args + ENDM + +ENDIF + + ENDM + + + + +End_Service_Table MACRO Device_Name, Def_Segment + + PURGE Device_Name&_Service + +IFDEF Create_&Device_Name&_Service_Table + +IFB +VxD_LOCKED_DATA_ENDS +ELSE +Def_Segment&_LOCKED_DATA_ENDS +ENDIF + +ENDIF + + ENDM + +GetVxDServiceOrdinal macro reg,service + mov reg,@@&service + endm + +GetVxDServiceAddress macro reg,service + mov reg,OFFSET32 service + endm + + + + + + + + + + + + + + + + + + +Begin_Win32_Services MACRO VxDName +ifndef Create_Win32_Services + Create_Win32_Services = 0 +endif + .errb , + ??w32svcno = 0 +if Create_Win32_Services +VxDName&_Win32_Services label dword + dd csvc&VxDName, 0 +endif + ??inw32svc = 1 + + VxDName&_Win32_Service MACRO Name + .erre ??inw32svc, + if Create_Win32_Services + dd OFFSET32 Name,cparm&&Name + endif + @32&&Name equ ((VxDName&_Device_ID SHL 16) + ??w32svcno) + ??w32svcno = ??w32svcno + 1 + ENDM + ENDM + + + + + + + + + + +End_Win32_Services MACRO VxDName + .errb , +if Create_Win32_Services + csvc&VxDName equ ($ - VxDName&_Win32_Services)/8 - 1 +endif + ??inw32svc = 0 + PURGE VxDName&_Win32_Service + ENDM + + + + + + + + + + + +Declare_Win32_Service MACRO Name, cParms +ifndef Create_Win32_Services + Create_Win32_Services = 0 +endif +if Create_Win32_Services + ?merge ,,,,,<_>,,<@>,%(cParms*4 + 8) + ?merge ,,,,, +VxD_CODE_SEG + ?merge ,,,,,<_>,,<@>,%(cParms*4 + 8),<:NEAR> +VxD_CODE_ENDS +endif + ENDM + + + + + + + + + + + + +Win32call MACRO Service, CallBack +ifndef Create_Win32_Services + Create_Win32_Services = 0 +endif +ife Create_Win32_Services + mov eax,@32&Service +ifdef IS_16 + movzx esp,sp +endif + call fword ptr [CallBack] +ifdef DEBUG + int 3 +endif +endif + ENDM + + + + + + + +Dword_Align MACRO Seg_Name + LOCAL segn +IFDEF MASM6 + align 4 +ELSE +IFNB + segn equ Seg_Name +ELSE +IFE ?_LCODE + segn equ <_LTEXT> +ELSE +IFE ?_ICODE + segn equ <_ITEXT> +ELSE +IFE ?_PCODE + segn equ <_PTEXT> +ELSE +IFE ?_SCODE + segn equ <_STEXT> +ELSE +.err +ENDIF +ENDIF +ENDIF +ENDIF +ENDIF +IF (($-OFFSET segn:0) MOD 4) +db 4 - (($-OFFSET segn:0) MOD 4) DUP (90h) +ENDIF +ENDIF + ENDM + + +BeginDoc + + + + + + + + + + + + + + + + + +EndDoc + +Fatal_Error MACRO Msg_Ptr, Exit_Flags + pushad +IFB + xor esi, esi +ELSE + mov esi, Msg_Ptr +IFB + xor eax, eax +ELSE + mov eax, Exit_Flags +ENDIF +ENDIF + VMMCall Fatal_Error_Handler + ENDM + +EF_Hang_On_Exit EQU 1h + + +cb_s STRUC +CB_VM_Status DD ? +CB_High_Linear DD ? +CB_Client_Pointer DD ? +CB_VMID DD ? +CB_Signature DD ? +cb_s ENDS +VMCB_ID EQU 62634D56H +VMSTAT_EXCLUSIVE_BIT EQU 00H +VMSTAT_EXCLUSIVE EQU (1 SHL VMSTAT_EXCLUSIVE_BIT) +VMSTAT_BACKGROUND_BIT EQU 01H +VMSTAT_BACKGROUND EQU (1 SHL VMSTAT_BACKGROUND_BIT) +VMSTAT_CREATING_BIT EQU 02H +VMSTAT_CREATING EQU (1 SHL VMSTAT_CREATING_BIT) +VMSTAT_SUSPENDED_BIT EQU 03H +VMSTAT_SUSPENDED EQU (1 SHL VMSTAT_SUSPENDED_BIT) +VMSTAT_NOT_EXECUTEABLE_BIT EQU 04H +VMSTAT_NOT_EXECUTEABLE EQU (1 SHL VMSTAT_NOT_EXECUTEABLE_BIT) +VMSTAT_PM_EXEC_BIT EQU 05H +VMSTAT_PM_EXEC EQU (1 SHL VMSTAT_PM_EXEC_BIT) +VMSTAT_PM_APP_BIT EQU 06H +VMSTAT_PM_APP EQU (1 SHL VMSTAT_PM_APP_BIT) +VMSTAT_PM_USE32_BIT EQU 07H +VMSTAT_PM_USE32 EQU (1 SHL VMSTAT_PM_USE32_BIT) +VMSTAT_VXD_EXEC_BIT EQU 08H +VMSTAT_VXD_EXEC EQU (1 SHL VMSTAT_VXD_EXEC_BIT) +VMSTAT_HIGH_PRI_BACK_BIT EQU 09H +VMSTAT_HIGH_PRI_BACK EQU (1 SHL VMSTAT_HIGH_PRI_BACK_BIT) +VMSTAT_BLOCKED_BIT EQU 0AH +VMSTAT_BLOCKED EQU (1 SHL VMSTAT_BLOCKED_BIT) +VMSTAT_AWAKENING_BIT EQU 0BH +VMSTAT_AWAKENING EQU (1 SHL VMSTAT_AWAKENING_BIT) +VMSTAT_PAGEABLEV86BIT EQU 0CH +VMSTAT_PAGEABLEV86_BIT EQU VMSTAT_PAGEABLEV86BIT +VMSTAT_PAGEABLEV86 EQU (1 SHL VMSTAT_PAGEABLEV86BIT) +VMSTAT_V86INTSLOCKEDBIT EQU 0DH +VMSTAT_V86INTSLOCKED_BIT EQU VMSTAT_V86INTSLOCKEDBIT +VMSTAT_V86INTSLOCKED EQU (1 SHL VMSTAT_V86INTSLOCKEDBIT) +VMSTAT_IDLE_TIMEOUT_BIT EQU 0EH +VMSTAT_IDLE_TIMEOUT EQU (1 SHL VMSTAT_IDLE_TIMEOUT_BIT) +VMSTAT_IDLE_BIT EQU 0FH +VMSTAT_IDLE EQU (1 SHL VMSTAT_IDLE_BIT) +VMSTAT_CLOSING_BIT EQU 10H +VMSTAT_CLOSING EQU (1 SHL VMSTAT_CLOSING_BIT) +VMSTAT_TS_SUSPENDED_BIT EQU 11H +VMSTAT_TS_SUSPENDED EQU (1 SHL VMSTAT_TS_SUSPENDED_BIT) +VMSTAT_TS_MAXPRI_BIT EQU 12H +VMSTAT_TS_MAXPRI EQU (1 SHL VMSTAT_TS_MAXPRI_BIT) +VMSTAT_USE32_MASK EQU (VMSTAT_PM_USE32 OR VMSTAT_VXD_EXEC) + +tcb_s STRUC +TCB_Flags DD ? +TCB_Reserved1 DD ? +TCB_Reserved2 DD ? +TCB_Signature DD ? +TCB_ClientPtr DD ? +TCB_VMHandle DD ? +TCB_ThreadId DW ? +TCB_PMLockOrigSS DW ? +TCB_PMLockOrigESP DD ? +TCB_PMLockOrigEIP DD ? +TCB_PMLockStackCount DD ? +TCB_PMLockOrigCS DW ? +TCB_PMPSPSelector DW ? +TCB_ThreadType DD ? +TCB_pad1 DW ? +TCB_pad2 DB ? +TCB_extErrLocus DB ? +TCB_extErr DW ? +TCB_extErrAction DB ? +TCB_extErrClass DB ? +TCB_extErrPtr DD ? +tcb_s ENDS +SCHED_OBJ_ID_THREAD EQU 42434854H +THFLAG_SUSPENDED_BIT EQU 03H +THFLAG_SUSPENDED EQU (1 SHL THFLAG_SUSPENDED_BIT) +THFLAG_NOT_EXECUTEABLE_BIT EQU 04H +THFLAG_NOT_EXECUTEABLE EQU (1 SHL THFLAG_NOT_EXECUTEABLE_BIT) +THFLAG_THREAD_CREATION_BIT EQU 08H +THFLAG_THREAD_CREATION EQU (1 SHL THFLAG_THREAD_CREATION_BIT) +THFLAG_THREAD_BLOCKED_BIT EQU 0AH +THFLAG_THREAD_BLOCKED EQU (1 SHL THFLAG_THREAD_BLOCKED_BIT) +THFLAG_RING0_THREAD_BIT EQU 1CH +THFLAG_RING0_THREAD EQU (1 SHL THFLAG_RING0_THREAD_BIT) +THFLAG_ASYNC_THREAD_BIT EQU 1FH +THFLAG_ASYNC_THREAD EQU (1 SHL THFLAG_ASYNC_THREAD_BIT) +THFLAG_CHARSET_BITS EQU 10H +THFLAG_CHARSET_MASK EQU (3 SHL THFLAG_CHARSET_BITS) +THFLAG_ANSI EQU (0 SHL THFLAG_CHARSET_BITS) +THFLAG_OEM EQU (1 SHL THFLAG_CHARSET_BITS) +THFLAG_UNICODE EQU (2 SHL THFLAG_CHARSET_BITS) +THFLAG_RESERVED EQU (3 SHL THFLAG_CHARSET_BITS) +THFLAG_EXTENDED_HANDLES_BIT EQU 12H +THFLAG_EXTENDED_HANDLES EQU (1 SHL THFLAG_EXTENDED_HANDLES_BIT) +THFLAG_OPEN_AS_IMMOVABLE_FILE_BIT EQU 13H +THFLAG_OPEN_AS_IMMOVABLE_FILE EQU (1 SHL THFLAG_OPEN_AS_IMMOVABLE_FILE_BIT) + +pmcb_s STRUC +PMCB_Flags DD ? +PMCB_Parent DD ? +pmcb_s ENDS + +VMFaultInfo STRUC +VMFI_EIP DD ? +VMFI_CS DW ? +VMFI_Ints DW ? +VMFaultInfo ENDS +Begin_Service_Table VMM, VMM +VMM_Service Get_VMM_Version, LOCAL +VMM_Service Get_Cur_VM_Handle +VMM_Service Test_Cur_VM_Handle +VMM_Service Get_Sys_VM_Handle +VMM_Service Test_Sys_VM_Handle +VMM_Service Validate_VM_Handle +VMM_Service Get_VMM_Reenter_Count +VMM_Service Begin_Reentrant_Execution +VMM_Service End_Reentrant_Execution +VMM_Service Install_V86_Break_Point +VMM_Service Remove_V86_Break_Point +VMM_Service Allocate_V86_Call_Back +VMM_Service Allocate_PM_Call_Back +VMM_Service Call_When_VM_Returns +VMM_Service Schedule_Global_Event +VMM_Service Schedule_VM_Event +VMM_Service Call_Global_Event +VMM_Service Call_VM_Event +VMM_Service Cancel_Global_Event +VMM_Service Cancel_VM_Event +VMM_Service Call_Priority_VM_Event +VMM_Service Cancel_Priority_VM_Event +VMM_Service Get_NMI_Handler_Addr +VMM_Service Set_NMI_Handler_Addr +VMM_Service Hook_NMI_Event +VMM_Service Call_When_VM_Ints_Enabled +VMM_Service Enable_VM_Ints +VMM_Service Disable_VM_Ints +VMM_Service Map_Flat +VMM_Service Map_Lin_To_VM_Addr +VMM_Service Adjust_Exec_Priority +VMM_Service Begin_Critical_Section +VMM_Service End_Critical_Section +VMM_Service End_Crit_And_Suspend +VMM_Service Claim_Critical_Section +VMM_Service Release_Critical_Section +VMM_Service Call_When_Not_Critical +VMM_Service Create_Semaphore +VMM_Service Destroy_Semaphore +VMM_Service Wait_Semaphore +VMM_Service Signal_Semaphore +VMM_Service Get_Crit_Section_Status +VMM_Service Call_When_Task_Switched +VMM_Service Suspend_VM +VMM_Service Resume_VM +VMM_Service No_Fail_Resume_VM +VMM_Service Nuke_VM +VMM_Service Crash_Cur_VM +VMM_Service Get_Execution_Focus +VMM_Service Set_Execution_Focus +VMM_Service Get_Time_Slice_Priority +VMM_Service Set_Time_Slice_Priority +VMM_Service Get_Time_Slice_Granularity +VMM_Service Set_Time_Slice_Granularity +VMM_Service Get_Time_Slice_Info +VMM_Service Adjust_Execution_Time +VMM_Service Release_Time_Slice +VMM_Service Wake_Up_VM +VMM_Service Call_When_Idle +VMM_Service Get_Next_VM_Handle +VMM_Service Set_Global_Time_Out +VMM_Service Set_VM_Time_Out +VMM_Service Cancel_Time_Out +VMM_Service Get_System_Time +VMM_Service Get_VM_Exec_Time +VMM_Service Hook_V86_Int_Chain +VMM_Service Get_V86_Int_Vector +VMM_Service Set_V86_Int_Vector +VMM_Service Get_PM_Int_Vector +VMM_Service Set_PM_Int_Vector +VMM_Service Simulate_Int +VMM_Service Simulate_Iret +VMM_Service Simulate_Far_Call +VMM_Service Simulate_Far_Jmp +VMM_Service Simulate_Far_Ret +VMM_Service Simulate_Far_Ret_N +VMM_Service Build_Int_Stack_Frame +VMM_Service Simulate_Push +VMM_Service Simulate_Pop +VMM_Service _HeapAllocate +VMM_Service _HeapReAllocate +VMM_Service _HeapFree +VMM_Service _HeapGetSize +HEAPZEROINIT EQU 00000001H +HEAPZEROREINIT EQU 00000002H +HEAPNOCOPY EQU 00000004H +HEAPALIGN_SHIFT EQU 16 +HEAPALIGN_MASK EQU 000F0000H +HEAPALIGN_4 EQU 00000000H +HEAPALIGN_8 EQU 00000000H +HEAPALIGN_16 EQU 00000000H +HEAPALIGN_32 EQU 00010000H +HEAPALIGN_64 EQU 00020000H +HEAPALIGN_128 EQU 00030000H +HEAPALIGN_256 EQU 00040000H +HEAPALIGN_512 EQU 00050000H +HEAPALIGN_1K EQU 00060000H +HEAPALIGN_2K EQU 00070000H +HEAPALIGN_4K EQU 00080000H +HEAPALIGN_8K EQU 00090000H +HEAPALIGN_16K EQU 000A0000H +HEAPALIGN_32K EQU 000B0000H +HEAPALIGN_64K EQU 000C0000H +HEAPALIGN_128K EQU 000D0000H +HEAPTYPESHIFT EQU 8 +HEAPTYPEMASK EQU 00000700H +HEAPLOCKEDHIGH EQU 00000000H +HEAPLOCKEDIFDP EQU 00000100H +HEAPSWAP EQU 00000200H +HEAPINIT EQU 00000400H +HEAPCLEAN EQU 00000800H +HEAPCONTIG EQU 00001000H +HEAPFORGET EQU 00002000H +HEAPLOCKEDLOW EQU 00000300H +HEAPSYSVM EQU 00000500H +HEAPPREEMPT EQU 00000600H +VMM_Service _PageAllocate +VMM_Service _PageReAllocate +VMM_Service _PageFree +VMM_Service _PageLock +VMM_Service _PageUnLock +VMM_Service _PageGetSizeAddr +VMM_Service _PageGetAllocInfo +VMM_Service _GetFreePageCount +VMM_Service _GetSysPageCount +VMM_Service _GetVMPgCount +VMM_Service _MapIntoV86 +VMM_Service _PhysIntoV86 +VMM_Service _TestGlobalV86Mem +VMM_Service _ModifyPageBits +VMM_Service _CopyPageTable +VMM_Service _LinMapIntoV86 +VMM_Service _LinPageLock +VMM_Service _LinPageUnLock +VMM_Service _SetResetV86Pageable +VMM_Service _GetV86PageableArray +VMM_Service _PageCheckLinRange +VMM_Service _PageOutDirtyPages +VMM_Service _PageDiscardPages +PAGEZEROINIT EQU 00000001H +PAGEUSEALIGN EQU 00000002H +PAGECONTIG EQU 00000004H +PAGEFIXED EQU 00000008H +PAGEDEBUGNULFAULT EQU 00000010H +PAGEZEROREINIT EQU 00000020H +PAGENOCOPY EQU 00000040H +PAGELOCKED EQU 00000080H +PAGELOCKEDIFDP EQU 00000100H +PAGESETV86PAGEABLE EQU 00000200H +PAGECLEARV86PAGEABLE EQU 00000400H +PAGESETV86INTSLOCKED EQU 00000800H +PAGECLEARV86INTSLOCKED EQU 00001000H +PAGEMARKPAGEOUT EQU 00002000H +PAGEPDPSETBASE EQU 00004000H +PAGEPDPCLEARBASE EQU 00008000H +PAGEDISCARD EQU 00010000H +PAGEPDPQUERYDIRTY EQU 00020000H +PAGEMAPFREEPHYSREG EQU 00040000H +PAGEPHYSONLY EQU 04000000H +PAGENOMOVE EQU 10000000H +PAGEMAPGLOBAL EQU 40000000H +PAGEMARKDIRTY EQU 80000000H +MAPV86_IGNOREWRAP EQU 00000001H +MPL_NonCached EQU 00000000H +MPL_HardwareCoherentCached EQU 00000001H +MPL_FrameBufferCached EQU 00000002H +MPL_Cached EQU 00000004H +VMM_Service _GetNulPageHandle +VMM_Service _GetFirstV86Page +VMM_Service _MapPhysToLinear +VMM_Service _GetAppFlatDSAlias +VMM_Service _SelectorMapFlat +VMM_Service _GetDemandPageInfo +VMM_Service _GetSetPageOutCount +GSPOC_F_GET EQU 00000001H +VMM_Service Hook_V86_Page +VMM_Service _Assign_Device_V86_Pages +VMM_Service _DeAssign_Device_V86_Pages +VMM_Service _Get_Device_V86_Pages_Array +VMM_Service MMGR_SetNULPageAddr +VMM_Service _Allocate_GDT_Selector +VMM_Service _Free_GDT_Selector +VMM_Service _Allocate_LDT_Selector +VMM_Service _Free_LDT_Selector +VMM_Service _BuildDescriptorDWORDs +VMM_Service _GetDescriptor +VMM_Service _SetDescriptor +ALLOCFROMEND EQU 40000000H +BDDEXPLICITDPL EQU 00000001H +ALDTSPECSEL EQU 00000001H +VMM_Service _MMGR_Toggle_HMA +MMGRHMAPHYSICAL EQU 00000001H +MMGRHMAENABLE EQU 00000002H +MMGRHMADISABLE EQU 00000004H +MMGRHMAQUERY EQU 00000008H +VMM_Service Get_Fault_Hook_Addrs +VMM_Service Hook_V86_Fault +VMM_Service Hook_PM_Fault +VMM_Service Hook_VMM_Fault +VMM_Service Begin_Nest_V86_Exec +VMM_Service Begin_Nest_Exec +VMM_Service Exec_Int +VMM_Service Resume_Exec +VMM_Service End_Nest_Exec +VMM_Service Allocate_PM_App_CB_Area, VMM_ICODE +VMM_Service Get_Cur_PM_App_CB +VMM_Service Set_V86_Exec_Mode +VMM_Service Set_PM_Exec_Mode +VMM_Service Begin_Use_Locked_PM_Stack +VMM_Service End_Use_Locked_PM_Stack +VMM_Service Save_Client_State +VMM_Service Restore_Client_State +VMM_Service Exec_VxD_Int +VMM_Service Hook_Device_Service +VMM_Service Hook_Device_V86_API +VMM_Service Hook_Device_PM_API +VMM_Service System_Control +VMM_Service Simulate_IO +VMM_Service Install_Mult_IO_Handlers +VMM_Service Install_IO_Handler +VMM_Service Enable_Global_Trapping +VMM_Service Enable_Local_Trapping +VMM_Service Disable_Global_Trapping +VMM_Service Disable_Local_Trapping +VMM_Service List_Create +VMM_Service List_Destroy +VMM_Service List_Allocate +VMM_Service List_Attach +VMM_Service List_Attach_Tail +VMM_Service List_Insert +VMM_Service List_Remove +VMM_Service List_Deallocate +VMM_Service List_Get_First +VMM_Service List_Get_Next +VMM_Service List_Remove_First +LF_ASYNC_BIT EQU 0 +LF_ASYNC EQU (1 SHL LF_ASYNC_BIT) +LF_USE_HEAP_BIT EQU 1 +LF_USE_HEAP EQU (1 SHL LF_USE_HEAP_BIT) +LF_ALLOC_ERROR_BIT EQU 2 +LF_ALLOC_ERROR EQU (1 SHL LF_ALLOC_ERROR_BIT) +LF_SWAP EQU (LF_USE_HEAP+(1 SHL 3)) +VMM_Service _AddInstanceItem +VMM_Service _Allocate_Device_CB_Area +VMM_Service _Allocate_Global_V86_Data_Area, VMM_ICODE +VMM_Service _Allocate_Temp_V86_Data_Area +VMM_Service _Free_Temp_V86_Data_Area +GVDAWordAlign EQU 00000001H +GVDADWordAlign EQU 00000002H +GVDAParaAlign EQU 00000004H +GVDAPageAlign EQU 00000008H +GVDAInstance EQU 00000100H +GVDAZeroInit EQU 00000200H +GVDAReclaim EQU 00000400H +GVDAInquire EQU 00000800H +GVDAHighSysCritOK EQU 00001000H +GVDAOptInstance EQU 00002000H +GVDAForceLow EQU 00004000H +TVDANeedTilInitComplete EQU 00000001H +VMM_Service Get_Profile_Decimal_Int, VMM_ICODE +VMM_Service Convert_Decimal_String, VMM_ICODE +VMM_Service Get_Profile_Fixed_Point, VMM_ICODE +VMM_Service Convert_Fixed_Point_String, VMM_ICODE +VMM_Service Get_Profile_Hex_Int, VMM_ICODE +VMM_Service Convert_Hex_String, VMM_ICODE +VMM_Service Get_Profile_Boolean, VMM_ICODE +VMM_Service Convert_Boolean_String, VMM_ICODE +VMM_Service Get_Profile_String, VMM_ICODE +VMM_Service Get_Next_Profile_String, VMM_ICODE +VMM_Service Get_Environment_String, VMM_ICODE +VMM_Service Get_Exec_Path, VMM_ICODE +VMM_Service Get_Config_Directory, VMM_ICODE +VMM_Service OpenFile, VMM_ICODE +VMM_OPENFILE_BUF_SIZE EQU 260 +VMM_Service Get_PSP_Segment, VMM_ICODE +VMM_Service GetDOSVectors, VMM_ICODE +VMM_Service Get_Machine_Info +GMIF_80486_BIT EQU 10H +GMIF_80486 EQU (1 SHL GMIF_80486_BIT) +GMIF_PCXT_BIT EQU 11H +GMIF_PCXT EQU (1 SHL GMIF_PCXT_BIT) +GMIF_MCA_BIT EQU 12H +GMIF_MCA EQU (1 SHL GMIF_MCA_BIT) +GMIF_EISA_BIT EQU 13H +GMIF_EISA EQU (1 SHL GMIF_EISA_BIT) +GMIF_CPUID_BIT EQU 14H +GMIF_CPUID EQU (1 SHL GMIF_CPUID_BIT) +GMIF_80586_BIT EQU 15H +GMIF_80586 EQU (1 SHL GMIF_80586_BIT) +GMIF_4MEGPG_BIT EQU 16H +GMIF_4MEGPG EQU (1 SHL GMIF_4MEGPG_BIT) +GMIF_RDTSC_BIT EQU 17H +GMIF_RDTSC EQU (1 SHL GMIF_RDTSC_BIT) +VMM_Service GetSet_HMA_Info +VMM_Service Set_System_Exit_Code +VMM_Service Fatal_Error_Handler +VMM_Service Fatal_Memory_Error +VMM_Service Update_System_Clock +VMM_Service Test_Debug_Installed +VMM_Service Out_Debug_String +VMM_Service Out_Debug_Chr +VMM_Service In_Debug_Chr +VMM_Service Debug_Convert_Hex_Binary +VMM_Service Debug_Convert_Hex_Decimal +VMM_Service Debug_Test_Valid_Handle +VMM_Service Validate_Client_Ptr +VMM_Service Test_Reenter +VMM_Service Queue_Debug_String +VMM_Service Log_Proc_Call +VMM_Service Debug_Test_Cur_VM +VMM_Service Get_PM_Int_Type +VMM_Service Set_PM_Int_Type +VMM_Service Get_Last_Updated_System_Time +VMM_Service Get_Last_Updated_VM_Exec_Time +VMM_Service Test_DBCS_Lead_Byte +.errnz @@Test_DBCS_Lead_Byte - 100D1h + +VMM_Service _AddFreePhysPage, VMM_ICODE +VMM_Service _PageResetHandlePAddr +VMM_Service _SetLastV86Page, VMM_ICODE +VMM_Service _GetLastV86Page +VMM_Service _MapFreePhysReg +VMM_Service _UnmapFreePhysReg +VMM_Service _XchgFreePhysReg +VMM_Service _SetFreePhysRegCalBk, VMM_ICODE +VMM_Service Get_Next_Arena, VMM_ICODE +VMM_Service Get_Name_Of_Ugly_TSR, VMM_ICODE +VMM_Service Get_Debug_Options, VMM_ICODE +AFPP_SWAPOUT EQU 0001H +PCP_CHANGEPAGER EQU 1H +PCP_CHANGEPAGERDATA EQU 2H +PCP_VIRGINONLY EQU 4H +GNA_HIDOSLINKED EQU 0002H +GNA_ISHIGHDOS EQU 0004H +VMM_Service Set_Physical_HMA_Alias, VMM_ICODE +VMM_Service _GetGlblRng0V86IntBase, VMM_ICODE +VMM_Service _Add_Global_V86_Data_Area, VMM_ICODE +VMM_Service GetSetDetailedVMError +GSDVME_PRIVINST EQU 00010001H +GSDVME_INVALINST EQU 00010002H +GSDVME_INVALPGFLT EQU 00010003H +GSDVME_INVALGPFLT EQU 00010004H +GSDVME_INVALFLT EQU 00010005H +GSDVME_USERNUKE EQU 00010006H +GSDVME_DEVNUKE EQU 00010007H +GSDVME_DEVNUKEHDWR EQU 00010008H +GSDVME_NUKENOMSG EQU 00010009H +GSDVME_OKNUKEMASK EQU 80000000H +GSDVME_INSMEMV86 EQU 00020001H +GSDVME_INSV86SPACE EQU 00020002H +GSDVME_INSMEMXMS EQU 00020003H +GSDVME_INSMEMEMS EQU 00020004H +GSDVME_INSMEMV86HI EQU 00020005H +GSDVME_INSMEMVID EQU 00020006H +GSDVME_INSMEMVM EQU 00020007H +GSDVME_INSMEMDEV EQU 00020008H +GSDVME_CRTNOMSG EQU 00020009H +VMM_Service Is_Debug_Chr +VMM_Service Clear_Mono_Screen +VMM_Service Out_Mono_Chr +VMM_Service Out_Mono_String +VMM_Service Set_Mono_Cur_Pos +VMM_Service Get_Mono_Cur_Pos +VMM_Service Get_Mono_Chr +VMM_Service Locate_Byte_In_ROM, VMM_ICODE +VMM_Service Hook_Invalid_Page_Fault +VMM_Service Unhook_Invalid_Page_Fault +IPF_PGDIR EQU 00000001H +IPF_V86PG EQU 00000002H +IPF_V86PGH EQU 00000004H +IPF_INVTYP EQU 00000008H +IPF_PGERR EQU 00000010H +IPF_REFLT EQU 00000020H +IPF_VMM EQU 00000040H +IPF_PM EQU 00000080H +IPF_V86 EQU 00000100H +VMM_Service Set_Delete_On_Exit_File +VMM_Service Close_VM +CVF_CONTINUE_EXEC_BIT EQU 0 +CVF_CONTINUE_EXEC EQU (1 SHL CVF_CONTINUE_EXEC_BIT) +VMM_Service Enable_Touch_1st_Meg +VMM_Service Disable_Touch_1st_Meg +VMM_Service Install_Exception_Handler +VMM_Service Remove_Exception_Handler +VMM_Service Get_Crit_Status_No_Block + +.errnz @@Get_Crit_Status_No_Block - 100F1h + +ifdef WIN40SERVICES +VMM_Service _GetLastUpdatedThreadExecTime +VMM_Service _Trace_Out_Service +VMM_Service _Debug_Out_Service +VMM_Service _Debug_Flags_Service +endif +DFS_LOG_BIT EQU 0 +DFS_LOG EQU (1 SHL DFS_LOG_BIT) +DFS_PROFILE_BIT EQU 1 +DFS_PROFILE EQU (1 SHL DFS_PROFILE_BIT) +DFS_TEST_CLD_BIT EQU 2 +DFS_TEST_CLD EQU (1 SHL DFS_TEST_CLD_BIT) +DFS_NEVER_REENTER_BIT EQU 3 +DFS_NEVER_REENTER EQU (1 SHL DFS_NEVER_REENTER_BIT) +DFS_TEST_REENTER_BIT EQU 4 +DFS_TEST_REENTER EQU (1 SHL DFS_TEST_REENTER_BIT) +DFS_NOT_SWAPPING_BIT EQU 5 +DFS_NOT_SWAPPING EQU (1 SHL DFS_NOT_SWAPPING_BIT) +DFS_TEST_BLOCK_BIT EQU 6 +DFS_TEST_BLOCK EQU (1 SHL DFS_TEST_BLOCK_BIT) +DFS_RARE_SERVICES EQU 0FFFFFF80H +DFS_EXIT_NOBLOCK EQU (DFS_RARE_SERVICES+0) +DFS_ENTER_NOBLOCK EQU (DFS_RARE_SERVICES+DFS_TEST_BLOCK) +DFS_TEST_NEST_EXEC EQU (DFS_RARE_SERVICES+1) +DFS_WIMP_DEBUG EQU (DFS_RARE_SERVICES+2) +ifdef WIN40SERVICES +VMM_Service VMMAddImportModuleName +VMM_Service VMM_Add_DDB +VMM_Service VMM_Remove_DDB +VMM_Service Test_VM_Ints_Enabled +VMM_Service _BlockOnID +VMM_Service Schedule_Thread_Event +VMM_Service Cancel_Thread_Event +VMM_Service Set_Thread_Time_Out +VMM_Service Set_Async_Time_Out +VMM_Service _AllocateThreadDataSlot +VMM_Service _FreeThreadDataSlot +MUTEX_MUST_COMPLETE EQU 1 +MUTEX_NO_CLEANUP_THREAD_STATE EQU 2 +VMM_Service _CreateMutex +VMM_Service _DestroyMutex +VMM_Service _GetMutexOwner +VMM_Service Call_When_Thread_Switched +VMM_Service VMMCreateThread +VMM_Service _GetThreadExecTime +VMM_Service VMMTerminateThread +VMM_Service Get_Cur_Thread_Handle +VMM_Service Test_Cur_Thread_Handle +VMM_Service Get_Sys_Thread_Handle +VMM_Service Test_Sys_Thread_Handle +VMM_Service Validate_Thread_Handle +VMM_Service Get_Initial_Thread_Handle +VMM_Service Test_Initial_Thread_Handle +VMM_Service Debug_Test_Valid_Thread_Handle +VMM_Service Debug_Test_Cur_Thread +VMM_Service VMM_GetSystemInitState +VMM_Service Cancel_Call_When_Thread_Switched +VMM_Service Get_Next_Thread_Handle +VMM_Service Adjust_Thread_Exec_Priority +VMM_Service _Deallocate_Device_CB_Area +VMM_Service Remove_IO_Handler +VMM_Service Remove_Mult_IO_Handlers +VMM_Service Unhook_V86_Int_Chain +VMM_Service Unhook_V86_Fault +VMM_Service Unhook_PM_Fault +VMM_Service Unhook_VMM_Fault +VMM_Service Unhook_Device_Service +VMM_Service _PageReserve +VMM_Service _PageCommit +VMM_Service _PageDecommit +VMM_Service _PagerRegister +VMM_Service _PagerQuery +VMM_Service _PagerDeregister +VMM_Service _ContextCreate +VMM_Service _ContextDestroy +VMM_Service _PageAttach +VMM_Service _PageFlush +VMM_Service _SignalID +VMM_Service _PageCommitPhys +VMM_Service _Register_Win32_Services +VMM_Service Cancel_Call_When_Not_Critical +VMM_Service Cancel_Call_When_Idle +VMM_Service Cancel_Call_When_Task_Switched +VMM_Service _Debug_Printf_Service +VMM_Service _EnterMutex +VMM_Service _LeaveMutex +VMM_Service Simulate_VM_IO +VMM_Service Signal_Semaphore_No_Switch +VMM_Service _ContextSwitch +VMM_Service _PageModifyPermissions +VMM_Service _PageQuery +VMM_Service _EnterMustComplete +VMM_Service _LeaveMustComplete +VMM_Service _ResumeExecMustComplete +THREAD_TERM_STATUS_CRASH_PEND EQU 1 +THREAD_TERM_STATUS_NUKE_PEND EQU 2 +THREAD_TERM_STATUS_SUSPEND_PEND EQU 4 +VMM_Service _GetThreadTerminationStatus +VMM_Service _GetInstanceInfo +INSTINFO_NONE EQU 0 +INSTINFO_SOME EQU 1 +INSTINFO_ALL EQU 2 +VMM_Service _ExecIntMustComplete +VMM_Service _ExecVxDIntMustComplete +VMM_Service Begin_V86_Serialization +VMM_Service Unhook_V86_Page +VMM_Service VMM_GetVxDLocationList +VMM_Service VMM_GetDDBList +VMM_Service Unhook_NMI_Event +VMM_Service Get_Instanced_V86_Int_Vector +VMM_Service Get_Set_Real_DOS_PSP +GSRDP_Set EQU 0001H +VMM_Service Call_Priority_Thread_Event +VMM_Service Get_System_Time_Address +VMM_Service Get_Crit_Status_Thread +VMM_Service Get_DDB +VMM_Service Directed_Sys_Control +VMM_Service _RegOpenKey +VMM_Service _RegCloseKey +VMM_Service _RegCreateKey +VMM_Service _RegDeleteKey +VMM_Service _RegEnumKey +VMM_Service _RegQueryValue +VMM_Service _RegSetValue +VMM_Service _RegDeleteValue +VMM_Service _RegEnumValue +VMM_Service _RegQueryValueEx +VMM_Service _RegSetValueEx +ifndef REG_SZ +REG_SZ EQU 0001H +REG_BINARY EQU 0003H +endif +ifndef HKEY_LOCAL_MACHINE +HKEY_CLASSES_ROOT EQU 80000000H +HKEY_CURRENT_USER EQU 80000001H +HKEY_LOCAL_MACHINE EQU 80000002H +HKEY_USERS EQU 80000003H +HKEY_PERFORMANCE_DATA EQU 80000004H +HKEY_CURRENT_CONFIG EQU 80000005H +HKEY_DYN_DATA EQU 80000006H +endif +VMM_Service _CallRing3 +VMM_Service Exec_PM_Int +VMM_Service _RegFlushKey +VMM_Service _PageCommitContig +VMM_Service _GetCurrentContext +VMM_Service _LocalizeSprintf +VMM_Service _LocalizeStackSprintf +VMM_Service Call_Restricted_Event +VMM_Service Cancel_Restricted_Event +VMM_Service Register_PEF_Provider, VMM_ICODE +VMM_Service _GetPhysPageInfo +VMM_Service _RegQueryInfoKey +VMM_Service MemArb_Reserve_Pages +PHYSINFO_NONE EQU 0 +PHYSINFO_SOME EQU 1 +PHYSINFO_ALL EQU 2 +VMM_Service Time_Slice_Sys_VM_Idle +VMM_Service Time_Slice_Sleep +VMM_Service Boost_With_Decay +VMM_Service Set_Inversion_Pri +VMM_Service Reset_Inversion_Pri +VMM_Service Release_Inversion_Pri +VMM_Service Get_Thread_Win32_Pri +VMM_Service Set_Thread_Win32_Pri +VMM_Service Set_Thread_Static_Boost +VMM_Service Set_VM_Static_Boost +VMM_Service Release_Inversion_Pri_ID +VMM_Service Attach_Thread_To_Group +VMM_Service Detach_Thread_From_Group +VMM_Service Set_Group_Static_Boost +VMM_Service _GetRegistryPath, VMM_ICODE +VMM_Service _GetRegistryKey +REGTYPE_ENUM EQU 0 +REGTYPE_CLASS EQU 1 +REGTYPE_VXD EQU 2 +REGKEY_OPEN EQU 0 +REGKEY_CREATE_IFNOTEXIST EQU 1 +ASSERT_RANGE_NULL_BAD EQU 00000000H +ASSERT_RANGE_NULL_OK EQU 00000001H +ASSERT_RANGE_IS_ASCIIZ EQU 00000002H +ASSERT_RANGE_IS_NOT_ASCIIZ EQU 00000000H +ASSERT_RANGE_NO_DEBUG EQU 80000000H +ASSERT_RANGE_BITS EQU 80000003H +VMM_Service Cleanup_Thread_State +VMM_Service _RegRemapPreDefKey +VMM_Service End_V86_Serialization +VMM_Service _Assert_Range +VMM_Service _Sprintf +VMM_Service _PageChangePager +VMM_Service _RegCreateDynKey +VMM_Service _RegQueryMultipleValues +VMM_Service Boost_Thread_With_VM +BOOT_CLEAN EQU 00000001H +BOOT_DOSCLEAN EQU 00000002H +BOOT_NETCLEAN EQU 00000004H +BOOT_INTERACTIVE EQU 00000008H +VMM_Service Get_Boot_Flags +VMM_Service Set_Boot_Flags +VMM_Service _lstrcpyn +VMM_Service _lstrlen +VMM_Service _lmemcpy +VMM_Service _GetVxDName +VMM_Service Force_Mutexes_Free +VMM_Service Restore_Forced_Mutexes +VMM_Service _AddReclaimableItem +VMM_Service _SetReclaimableItem +VMM_Service _EnumReclaimableItem +VMM_Service Time_Slice_Wake_Sys_VM +VMM_Service VMM_Replace_Global_Environment +VMM_Service Begin_Non_Serial_Nest_V86_Exec +VMM_Service Get_Nest_Exec_Status +VMM_Service Open_Boot_Log +VMM_Service Write_Boot_Log +VMM_Service Close_Boot_Log +VMM_Service EnableDisable_Boot_Log +VMM_Service _Call_On_My_Stack +VMM_Service Get_Inst_V86_Int_Vec_Base +VMM_Service _lstrcmpi +VMM_Service _strupr +VMM_Service Log_Fault_Call_Out +VMM_Service _AtEventTime +endif +ifdef WIN403SERVICES +VMM_Service _PageOutPages +PAGEOUT_PRIVATE EQU 00000001H +PAGEOUT_SHARED EQU 00000002H +PAGEOUT_SYSTEM EQU 00000004H +PAGEOUT_REGION EQU 00000008H +PAGEOUT_ALL EQU (PAGEOUT_PRIVATE OR PAGEOUT_SHARED OR PAGEOUT_SYSTEM) +VMM_Service _Call_On_My_Not_Flat_Stack +VMM_Service _LinRegionLock +VMM_Service _LinRegionUnLock +VMM_Service _AttemptingSomethingDangerous +VMM_Service _Vsprintf +VMM_Service _Vsprintfw +VMM_Service Load_FS_Service +VMM_Service Assert_FS_Service +VMM_StdCall_Service ObsoleteRtlUnwind, 4 +VMM_StdCall_Service ObsoleteRtlRaiseException, 1 +VMM_StdCall_Service ObsoleteRtlRaiseStatus, 1 +VMM_StdCall_Service ObsoleteKeGetCurrentIrql, 0 +VMM_FastCall_Service ObsoleteKfRaiseIrql, 1 +VMM_FastCall_Service ObsoleteKfLowerIrql, 1 +VMM_Service _Begin_Preemptable_Code +VMM_Service _End_Preemptable_Code +VMM_FastCall_Service Set_Preemptable_Count, 1 +VMM_StdCall_Service ObsoleteKeInitializeDpc, 3 +VMM_StdCall_Service ObsoleteKeInsertQueueDpc, 3 +VMM_StdCall_Service ObsoleteKeRemoveQueueDpc, 1 +VMM_StdCall_Service HeapAllocateEx, 4 +VMM_StdCall_Service HeapReAllocateEx, 5 +VMM_StdCall_Service HeapGetSizeEx, 2 +VMM_StdCall_Service HeapFreeEx, 2 +VMM_Service _Get_CPUID_Flags +VMM_StdCall_Service KeCheckDivideByZeroTrap, 1 +endif +ifdef WIN41SERVICES +VMM_Service _RegisterGARTHandler +VMM_Service _GARTReserve +VMM_Service _GARTCommit +VMM_Service _GARTUnCommit +VMM_Service _GARTFree +VMM_Service _GARTMemAttributes +VMM_StdCall_Service KfRaiseIrqlToDpcLevel, 0 +VMM_Service VMMCreateThreadEx +VMM_Service _FlushCaches +PG_UNCACHED EQU 00000001H +PG_WRITECOMBINED EQU 00000002H +FLUSHCACHES_NORMAL EQU 00000000H +FLUSHCACHES_GET_CACHE_LINE_PTR EQU 00000001H +FLUSHCACHES_GET_CACHE_SIZE_PTR EQU 00000002H +FLUSHCACHES_TAKE_OVER EQU 00000003H +FLUSHCACHES_FORCE_PAGES_OUT EQU 00000004H +FLUSHCACHES_LOCK_LOCKABLE EQU 00000005H +FLUSHCACHES_UNLOCK_LOCKABLE EQU 00000006H +VMM_Service Set_Thread_Win32_Pri_NoYield +VMM_Service _FlushMappedCacheBlock +VMM_Service _ReleaseMappedCacheBlock +VMM_Service Run_Preemptable_Events +VMM_Service _MMPreSystemExit +VMM_Service _MMPageFileShutDown +VMM_Service _Set_Global_Time_Out_Ex +VMM_Service Query_Thread_Priority +endif +End_Service_Table VMM, VMM +COMNFS_FLAT EQU 0FFFFFFFFH +RS_RECLAIM EQU 00000001H +RS_RESTORE EQU 00000002H +RS_DOSARENA EQU 00000004H + +ReclaimStruc STRUC +RS_Linear DD ? +RS_Bytes DD ? +RS_CallBack DD ? +RS_RefData DD ? +RS_HookTable DD ? +RS_Flags DD ? +ReclaimStruc ENDS + +frmtx STRUC +frmtx_pfrmtxNext DD ? +frmtx_hmutex DD ? +frmtx_cEnterCount DD ? +frmtx_pthcbOwner DD ? +frmtx_htimeout DD ? +frmtx ENDS + +vmmfrinfo STRUC +vmmfrinfo_frmtxDOS DB SIZE frmtx DUP (?) +vmmfrinfo_frmtxV86 DB SIZE frmtx DUP (?) +vmmfrinfo_frmtxOther DB SIZE frmtx DUP (?) +vmmfrinfo ENDS + +DemandInfoStruc STRUC +DILin_Total_Count DD ? +DIPhys_Count DD ? +DIFree_Count DD ? +DIUnlock_Count DD ? +DILinear_Base_Addr DD ? +DILin_Total_Free DD ? +DIPage_Faults DD ? +DIPage_Ins DD ? +DIPage_Outs DD ? +DIPage_Discards DD ? +DIInstance_Faults DD ? +DIPagingFileMax DD ? +DIPagingFileInUse DD ? +DICommit_Count DD ? +DIReserved DD 2 DUP (?) +DemandInfoStruc ENDS + +InstDataStruc STRUC +InstLinkF DD 0 +InstLinkB DD 0 +InstLinAddr DD ? +InstSize DD ? +InstType DD ? +InstDataStruc ENDS +INDOS_FIELD EQU 100H +ALWAYS_FIELD EQU 200H +OPTIONAL_FIELD EQU 400H + +IPF_Data STRUC +IPF_LinAddr DD ? +IPF_MapPageNum DD ? +IPF_PTEEntry DD ? +IPF_FaultingVM DD ? +IPF_Flags DD ? +IPF_Data ENDS + +Exception_Handler_Struc STRUC +EH_Reserved DD ? +EH_Start_EIP DD ? +EH_End_EIP DD ? +EH_Handler DD ? +Exception_Handler_Struc ENDS +PR_PRIVATE EQU 80000400H +PR_SHARED EQU 80060000H +PR_SYSTEM EQU 80080000H +PR_FIXED EQU 00000008H +PR_4MEG EQU 00000001H +PR_STATIC EQU 00000010H +PD_ZEROINIT EQU 00000001H +PD_NOINIT EQU 00000002H +PD_FIXEDZERO EQU 00000003H +PD_FIXED EQU 00000004H +PC_FIXED EQU 00000008H +PC_LOCKED EQU 00000080H +PC_LOCKEDIFDP EQU 00000100H +PC_WRITEABLE EQU 00020000H +PC_USER EQU 00040000H +PC_INCR EQU 40000000H +PC_PRESENT EQU 80000000H +PC_STATIC EQU 20000000H +PC_DIRTY EQU 08000000H +PC_CACHEDIS EQU 00100000H +PC_CACHEWT EQU 00080000H +PC_PAGEFLUSH EQU 00008000H +ifdef WRITE_WATCH +PC_WRITE_WATCH EQU 00200000H +endif +PCC_ZEROINIT EQU 00000001H +PCC_NOLIN EQU 10000000H +MTRR_UC EQU 0 +MTRR_WC EQU 1 +MTRR_WT EQU 4 +MTRR_WP EQU 5 +MTRR_WB EQU 6 +ifndef _WINNT_ + +_MEMORY_BASIC_INFORMATION STRUC +mbi_BaseAddress DD ? +mbi_AllocationBase DD ? +mbi_AllocationProtect DD ? +mbi_RegionSize DD ? +mbi_State DD ? +mbi_Protect DD ? +mbi_Type DD ? +_MEMORY_BASIC_INFORMATION ENDS +PAGE_NOACCESS EQU 01H +PAGE_READONLY EQU 02H +PAGE_READWRITE EQU 04H +MEM_COMMIT EQU 1000H +MEM_RESERVE EQU 2000H +MEM_FREE EQU 10000H +MEM_PRIVATE EQU 20000H +endif + +pd_s STRUC +pd_virginin DD ? +pd_taintedin DD ? +pd_cleanout DD ? +pd_dirtyout DD ? +pd_virginfree DD ? +pd_taintedfree DD ? +pd_dirty DD ? +pd_type DD ? +pd_s ENDS +PD_SWAPPER EQU 0 +PD_PAGERONLY EQU 1 +PD_NESTEXEC EQU 2 +endif +PAGESHIFT EQU 12 +PAGESIZE EQU (1 SHL PAGESHIFT) +PAGEMASK EQU (PAGESIZE-1) +MAXSYSTEMLADDR EQU (0ffbfffffH) +MINSYSTEMLADDR EQU (0c0000000H) +MAXSHAREDLADDR EQU (0bfffffffH) +MINSHAREDLADDR EQU (80000000H) +MAXPRIVATELADDR EQU (7fffffffH) +MINPRIVATELADDR EQU (00400000H) +MAXDOSLADDR EQU (003fffffH) +MINDOSLADDR EQU (00000000H) +MAXSYSTEMPAGE EQU (MAXSYSTEMLADDR SHR PAGESHIFT) +MINSYSTEMPAGE EQU (MINSYSTEMLADDR SHR PAGESHIFT) +MAXSHAREDPAGE EQU (MAXSHAREDLADDR SHR PAGESHIFT) +MINSHAREDPAGE EQU (MINSHAREDLADDR SHR PAGESHIFT) +MAXPRIVATEPAGE EQU (MAXPRIVATELADDR SHR PAGESHIFT) +MINPRIVATEPAGE EQU (MINPRIVATELADDR SHR PAGESHIFT) +MAXDOSPAGE EQU (MAXDOSLADDR SHR PAGESHIFT) +MINDOSPAGE EQU (MINDOSLADDR SHR PAGESHIFT) +CBPRIVATE EQU (1+MAXPRIVATELADDR-MINPRIVATELADDR) +CBSHARED EQU (1+MAXSHAREDLADDR-MINSHAREDLADDR) +CBSYSTEM EQU (1+MAXSYSTEMLADDR-MINSYSTEMLADDR) +CBDOS EQU (1+MAXDOSLADDR-MINDOSLADDR) +CPGPRIVATE EQU (1+MAXPRIVATEPAGE-MINPRIVATEPAGE) +CPGSHARED EQU (1+MAXSHAREDPAGE-MINSHAREDPAGE) +CPGSYSTEM EQU (1+MAXSYSTEMPAGE-MINSYSTEMPAGE) +CPGDOS EQU (1+MAXDOSPAGE-MINDOSPAGE) +IFDEF DEBUG +DebFar EQU NEAR PTR +ELSE +DebFar EQU SHORT +ENDIF + +ASD_MAX_REF_DATA EQU 256 + +_vmmguid STRUC +Data1 DD ? +Data2 DW ? +Data3 DW ? +Data4 DB 8 DUP (?) +_vmmguid ENDS +ASD_ERROR_NONE EQU 00000000H +ASD_CHECK_FAIL EQU 00000001H +ASD_CHECK_SUCCESS EQU 00000002H +ASD_CHECK_UNKNOWN EQU 00000003H +ASD_ERROR_BAD_TIME EQU 00000004H +ASD_REGISTRY_ERROR EQU 00000005H +ASD_CLEAN_BOOT EQU 00000006H +ASD_OUT_OF_MEMORY EQU 00000007H +ASD_FILE_ERROR EQU 00000008H +ASD_ALREADY_SET EQU 00000009H +ASD_MISSING_CHECK EQU 0000000AH +ASD_BAD_PARAMETER EQU 0000000BH +ASD_OP_CHECK_AND_WRITE_FAIL_IF_UNKNOWN EQU 00000000H +ASD_OP_CHECK_AND_ALWAYS_WRITE_FAIL EQU 00000001H +ASD_OP_CHECK EQU 00000002H +ASD_OP_DONE_AND_SET_SUCCESS EQU 00000003H +ASD_OP_SET_FAIL EQU 00000004H +ASD_OP_SET_SUCCESS EQU 00000005H +ASD_OP_SET_UNKNOWN EQU 00000006H +ASD_OP_DONE EQU 00000007H +ASD_FLAG_STRING EQU 00000001H +ifndef Not_VxD +SYS_CRITICAL_INIT EQU 0000H +DEVICE_INIT EQU 0001H +INIT_COMPLETE EQU 0002H +SYS_VM_INIT EQU 0003H +SYS_VM_TERMINATE EQU 0004H +SYSTEM_EXIT EQU 0005H +SYS_CRITICAL_EXIT EQU 0006H +CREATE_VM EQU 0007H +VM_CRITICAL_INIT EQU 0008H +VM_INIT EQU 0009H +VM_TERMINATE EQU 000AH +VM_NOT_EXECUTEABLE EQU 000BH +DESTROY_VM EQU 000CH +VNE_CRASHED_BIT EQU 00H +VNE_CRASHED EQU (1 SHL VNE_CRASHED_BIT) +VNE_NUKED_BIT EQU 01H +VNE_NUKED EQU (1 SHL VNE_NUKED_BIT) +VNE_CREATEFAIL_BIT EQU 02H +VNE_CREATEFAIL EQU (1 SHL VNE_CREATEFAIL_BIT) +VNE_CRINITFAIL_BIT EQU 03H +VNE_CRINITFAIL EQU (1 SHL VNE_CRINITFAIL_BIT) +VNE_INITFAIL_BIT EQU 04H +VNE_INITFAIL EQU (1 SHL VNE_INITFAIL_BIT) +VNE_CLOSED_BIT EQU 05H +VNE_CLOSED EQU (1 SHL VNE_CLOSED_BIT) +VM_SUSPEND EQU 000DH +VM_RESUME EQU 000EH +SET_DEVICE_FOCUS EQU 000FH +BEGIN_MESSAGE_MODE EQU 0010H +END_MESSAGE_MODE EQU 0011H +REBOOT_PROCESSOR EQU 0012H +QUERY_DESTROY EQU 0013H +DEBUG_QUERY EQU 0014H +BEGIN_PM_APP EQU 0015H +BPA_32_BIT EQU 01H +BPA_32_BIT_FLAG EQU 1 +END_PM_APP EQU 0016H +DEVICE_REBOOT_NOTIFY EQU 0017H +CRIT_REBOOT_NOTIFY EQU 0018H +CLOSE_VM_NOTIFY EQU 0019H +CVNF_CRIT_CLOSE_BIT EQU 0 +CVNF_CRIT_CLOSE EQU (1 SHL CVNF_CRIT_CLOSE_BIT) +POWER_EVENT EQU 001AH +SYS_DYNAMIC_DEVICE_INIT EQU 001BH +SYS_DYNAMIC_DEVICE_EXIT EQU 001CH +CREATE_THREAD EQU 001DH +THREAD_INIT EQU 001EH +TERMINATE_THREAD EQU 001FH +THREAD_Not_Executeable EQU 0020H +DESTROY_THREAD EQU 0021H +PNP_NEW_DEVNODE EQU 0022H +W32_DEVICEIOCONTROL EQU 0023H +DIOC_GETVERSION EQU 0H +DIOC_OPEN EQU DIOC_GETVERSION +DIOC_CLOSEHANDLE EQU -1 +SYS_VM_TERMINATE2 EQU 0024H +SYSTEM_EXIT2 EQU 0025H +SYS_CRITICAL_EXIT2 EQU 0026H +VM_TERMINATE2 EQU 0027H +VM_NOT_EXECUTEABLE2 EQU 0028H +DESTROY_VM2 EQU 0029H +VM_SUSPEND2 EQU 002AH +END_MESSAGE_MODE2 EQU 002BH +END_PM_APP2 EQU 002CH +DEVICE_REBOOT_NOTIFY2 EQU 002DH +CRIT_REBOOT_NOTIFY2 EQU 002EH +CLOSE_VM_NOTIFY2 EQU 002FH +GET_CONTENTION_HANDLER EQU 0030H +KERNEL32_INITIALIZED EQU 0031H +KERNEL32_SHUTDOWN EQU 0032H +CREATE_PROCESS EQU 0033H +DESTROY_PROCESS EQU 0034H +ifndef WIN40COMPAT +SYS_DYNAMIC_DEVICE_REINIT EQU 0035H +endif +SYS_POWER_DOWN EQU 0036H +MAX_SYSTEM_CONTROL EQU 0036H +BEGIN_RESERVED_PRIVATE_SYSTEM_CONTROL EQU 70000000H +END_RESERVED_PRIVATE_SYSTEM_CONTROL EQU 7FFFFFFFH +endif +SYSSTATE_PRESYSCRITINIT EQU 00000000H +SYSSTATE_PREDEVICEINIT EQU 10000000H +SYSSTATE_PREINITCOMPLETE EQU 20000000H +SYSSTATE_VXDINITCOMPLETED EQU 40000000H +SYSSTATE_KERNEL32INITED EQU 50000000H +SYSSTATE_KERNEL32TERMINATED EQU 0A0000000H +SYSSTATE_PRESYSVMTERMINATE EQU 0B0000000H +SYSSTATE_PRESYSTEMEXIT EQU 0E0000000H +SYSSTATE_PRESYSTEMEXIT2 EQU 0E4000000H +SYSSTATE_PRESYSCRITEXIT EQU 0F0000000H +SYSSTATE_PRESYSCRITEXIT2 EQU 0F4000000H +SYSSTATE_POSTSYSCRITEXIT2 EQU 0FFF00000H +SYSSTATE_PREDEVICEREBOOT EQU 0FFFF0000H +SYSSTATE_PRECRITREBOOT EQU 0FFFFF000H +SYSSTATE_PREREBOOTCPU EQU 0FFFFFF00H +BeginDoc + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +EndDoc + + + + + + + + + + + + +??_pf_Check equ 1 +??_pf_ArgsUsed equ 2 +??_pf_Entered equ 4 +??_pf_Left equ 8 +??_pf_Returned equ 16 + +??_pushed = 0 +??_align = 0 +??_ends equ <> + +BeginProc macro Name, P1, P2, P3, P4, P5, P6, P7, LastArg + local Profile_Data, prelabeldata, ??_hookvar + ??_frame = 0 + ??_aframe = 0 + ??_taframe = 0 + ??_initaframe = 0 + ??_numargs = 0 + ??_numlocals = 0 + ??_numlocalsymbols = 0 + ??_procflags = 0 + ??_esp = 0 + ??_pushed = 0 + ??_align = 0 + ??_hook = 0 + ??_hookarg = 0 + ??_service = 0 + ??_async_service = 0 +IF DEBLEVEL GT DEBLEVELNORMAL + ??_log = DFS_LOG + ??_profile = DFS_PROFILE + ??_test_cld = DFS_TEST_CLD +ELSE + ??_log = 0 +IFDEF DEBUG +IFDEF profileall +IF ?_ICODE + ??_profile = DFS_PROFILE +ELSE + ??_profile = 0 +ENDIF +ELSE + ??_profile = 0 +ENDIF +ELSE + ??_profile = 0 +ENDIF + ??_test_cld = 0 +ENDIF + ??_might_block = 0 + ??_test_reenter = 0 + ??_never_reenter = 0 + ??_not_swapping = 0 + ??_prolog_disabled = 0 + ??_public = 1 + ??_cleanoff = 0 + ??_ccall = 0 + ??_pcall = 0 + ??_scall = 0 + ??_fastcall = 0 + ??_w32svc = 0 + ??_fleave = FALSE + + ??_name equ + + .errnb ??_ends, + .errnb , + + + irp arg, + if ??_hookarg + ??_hookarg = 0 + ??_hookvar equ + elseifdef ?&&arg&&_BeginProc + ?&&arg&&_BeginProc + elseifdef VxD_&&arg&&_CODE_SEG + ??_ends textequ + VxD_&&arg&&_CODE_SEG + else + .err + endif + endm + + + ifndef Not_VxD + ife ??_service + ifndef profileall + ??_profile = 0 + endif + ifdef VMMSYS + ??_prolog_disabled = 1 + endif + else + ??_test_cld = DFS_TEST_CLD + endif + + ife ?_16ICODE + ??_prolog_disabled = 1 + else + ife ?_RCODE + ??_prolog_disabled = 1 + else + ife ?_PCODE + ??_might_block = DFS_TEST_BLOCK + endif + if ??_service + ife ??_async_service + ??_test_reenter = DFS_TEST_REENTER + endif + endif + endif + endif + endif + + if ??_esp + + ??_basereg equ + ??_initaframe = 4 + else + + ??_basereg equ + ??_initaframe = 8 + endif + @Caller equ + + ??_cleanoff = ??_pcall or ??_scall or ??_fastcall + + + ??_dfs = ??_never_reenter + ??_test_reenter + ??_not_swapping + \ + ??_log + ??_profile + ??_test_cld + ??_might_block + + if ??_prolog_disabled + ??_dfs = 0 + endif + + + + ifndef Not_VxD + + if ??_hook + if ??_align + Dword_Align + endif + prelabeldata: + ifndef ??_hookvar + .err + endif + jmp short Name + jmp [??_hookvar] + ifdef DEBUG + Profile_Data dd 0 + endif + if ??_align + .errnz ($ - prelabeldata) mod 4 + endif + endif + + ifdef DEBUG + ?prolog_&Name label near + if (??_service OR ??_profile) AND (??_hook EQ 0) + jmp short Name + if ??_align + Dword_Align + endif + + IF ?_ICODE + ifdef profileall + ?ProfileHeader_BeginProc Profile_Data, %@filename + else + Profile_Data dd 0 + endif + ELSE + Profile_Data dd 0 + ENDIF + + endif + endif + + if ??_align + Dword_Align + endif + + endif + + Name proc near + + + + ife ??_pcall or ??_ccall or ??_scall or ??_fastcall + if ??_public + public Name + else + ifdef DEBUG + % ?merge @FileName,$,Name,: + % ?merge public,,,,,@FileName,$,Name + endif + endif + endif + if ??_ccall + if ??_public + _&Name equ Name + ifdef Not_VxD + public C Name + else + public _&Name + endif + endif + endif + if ??_pcall + if ??_public + ?toupper Name + ?merge public,,,,%?upper + endif + endif + + + + ife ??_scall or ??_fastcall + ?_BeginProc_Debug_Prologue + endif + + + +endm + +?_BeginProc_Debug_Prologue MACRO + ifndef Not_VxD + ifdef DEBUG + if ??_dfs EQ DFS_LOG + VMMCall Log_Proc_Call + else + if ??_dfs EQ DFS_TEST_REENTER + VMMCall Test_Reenter + else + if ??_dfs or ?_LOCKABLECODE eq 0 + ifdef WIN31COMPAT + if ??_dfs AND DFS_LOG + VMMCall Log_Proc_Call + endif + if ??_dfs AND DFS_TEST_REENTER + VMMCall Test_Reenter + endif + else + ife ?_LOCKABLECODE + ifdef ??_debug_flags + push ??_debug_flags + if ??_dfs + pushfd + or dword ptr [esp+4],??_dfs + popfd + endif + VMMCall _Debug_Flags_Service + elseif ??_dfs + push ??_dfs + VMMCall _Debug_Flags_Service + endif + else + push ??_dfs + VMMCall _Debug_Flags_Service + endif + endif + else + ifdef profileall + IncProfileCount + endif + endif + endif + endif + endif + endif +ENDM + + + + + + +?_BeginProc macro +endm + +?PUBLIC_BeginProc macro + ??_public = 1 +endm + +?LOCAL_BeginProc macro + ??_public = 0 +endm + +?HIGH_FREQ_BeginProc macro + ??_align = 1 +endm + +?HOOK_PROC_BeginProc macro + ??_hook = 1 + ??_hookarg = 1 +endm + +?SERVICE_BeginProc macro + ??_service = 1 + .erre ?_16ICODE, + .erre ?_RCODE, +endm + +?ASYNC_SERVICE_BeginProc macro + ??_service = 1 + ??_async_service = 1 + .errnz ?_LCODE, +endm + +?NO_LOG_BeginProc macro + ??_log = 0 +endm + +?NO_PROFILE_BeginProc macro + ??_profile = 0 +endm + +?NO_TEST_CLD_BeginProc macro + ??_test_cld = 0 +endm + +?TEST_BLOCK_BeginProc macro + ??_might_block = DFS_TEST_BLOCK +endm + +?TEST_REENTER_BeginProc macro + ??_test_reenter = DFS_TEST_REENTER +endm + +?NEVER_REENTER_BeginProc macro + ??_never_reenter = DFS_NEVER_REENTER +endm + +?NOT_SWAPPING_BeginProc macro + ??_not_swapping = DFS_NOT_SWAPPING +endm + +?NO_PROLOG_BeginProc macro + ??_prolog_disabled = 1 +endm + +?ESP_BeginProc macro + ??_esp = VMM_TRUE + ifndef Not_VxD + .erre ?_16ICODE, + .erre ?_RCODE, + endif +endm + +?CCALL_BeginProc macro + ??_ccall = 1 +endm + +?PCALL_BeginProc macro + ??_pcall = 1 +endm + +?SCALL_BeginProc macro + ??_scall = 1 +endm + +?FASTCALL_BeginProc macro + ??_fastcall = 1 +endm + +?ICALL_BeginProc macro + ??_scall = 1 +endm + +?W32SVC_BeginProc macro + ??_scall = 1 + ??_w32svc = 1 +endm + +ifdef DEBUG +ifdef profileall +?ProfileHeader_BeginProc macro PL, filename +ifndef _&filename&__proc_list + _&filename&__proc_list = 0 + PUBLIC _&filename&__proc_list +endif + dd OFFSET32 _&filename&__proc_list +PL dd 0 +_&filename&__proc_list = PL +endm +endif + +IncProfileCount macro + if ??_service OR ??_profile + inc dword ptr [??_name-4] + else + ifndef profileall + .err + endif + endif +endm +else +IncProfileCount macro +endm +endif + + + + + + + + + + + + + + + + +ArgVar macro name,length,used + ??_numargs = ??_numargs + 1 + if ??_pcall + ?mkarg , , , %??_numargs + else + ?arg , , + endif + ??_procflags = ??_procflags OR ??_pf_Check + endm + +?mkarg macro name, length, used, num + .xcref ?MKA&num + ?deflocal + ?MKA&num ¯o + ?argvar , , + &endm + ??_aframe = ??_aframe + 4 + endm + .xcref ?mkarg + +?argvar macro name,length,used + local a + a = ??_taframe + ??_aframe = ??_aframe + 4 + ??_taframe = ??_taframe + 4 + ifidni , + ?setname , , + elseifidni , + ?setname , , + elseifidni , + ?setname , , + ?setname ,, + ?setname ,, + ?setname ,, + ?setname ,, + ?setname ,, + ?setname ,, + else + ??_aframe = ??_aframe - 4 + ((length + 3)/4)*4 + ??_taframe = ??_taframe - 4 + ((length + 3)/4)*4 + ?setname , <[??_basereg+??_initaframe+a]>, + endif +endm + +?arg macro name,length,used + if ??_fastcall + if ??_numargs le 2 + if length gt 4 + .err + endif + ??_aframe = ??_aframe + 4 + if ??_numargs eq 1 + ?merge ecx_,name,,,equ,ecx + else + ?merge edx_,name,,,equ,edx + endif + else + ?argvar name, length, used + endif + else + ?argvar name, length, used + endif +endm + + + + + + +?setname macro name, value, used + ?deflocal + ifidni , + name equ _inaccessible_NOTUSED_ + else + name equ value + ??_procflags = ??_procflags OR ??_pf_ArgsUsed OR ??_pf_Check + endif +endm + + + + + + + + + + + + + + + + + + + +LocalVar macro name,length,flag + local a + ??_numlocals = ??_numlocals + 1 + ??_pad = 1 + ifidni , + ??_pad = 0 + endif + ifidni , + ??_frame = ??_frame + 1 + 3 * ??_pad + a = ??_frame + ?deflocal + name equ byte ptr [??_basereg-a] + elseifidni , + ??_frame = ??_frame + 2 + 2 * ??_pad + a = ??_frame + ?deflocal + name equ word ptr [??_basereg-a] + elseifidni , + ??_frame = ??_frame + 4 + a = ??_frame + ?deflocal + name equ dword ptr [??_basereg-a] + name&l equ word ptr [??_basereg-a] + name&ll equ byte ptr [??_basereg-a] + name&lh equ byte ptr [??_basereg-a+1] + name&h equ word ptr [??_basereg-a+2] + name&hl equ byte ptr [??_basereg-a+2] + name&hh equ byte ptr [??_basereg-a+3] + else + ??_frame = ??_frame + ((length + 3)/4)*4 + a = ??_frame + ?deflocal + name equ [??_basereg-a] + endif + ??_procflags = ??_procflags OR ??_pf_Check +endm + +?deflocal macro name + irp nm, + ??_numlocalsymbols = ??_numlocalsymbols + 1 + ?dodeflocal , %(??_numlocalsymbols) + endm +endm + .xcref ?deflocal + +?dodeflocal macro name, num + .xcref ?LOC&num + ?LOC&num ¯o + name equ <__inaccessible__NOTINSCOPE__> + &endm + endm + .xcref ?dodeflocal + + + +EnterProc macro + .errnz ??_frame and 3, + if ??_scall + if ??_public + ifdef Not_VxD + ?merge %??_name,@,%(??_aframe),,label,near + ?merge public,,,,C,%??_name,@,%(??_aframe) + else + ?merge _,%??_name,@,%(??_aframe),label,near + ?merge public,,,,,_,%??_name,@,%(??_aframe) + endif + endif + ?_BeginProc_Debug_Prologue + endif + if ??_fastcall + if ??_public + ifdef Not_VxD + ?merge %??_name,@,%(??_aframe),,label,near + ?merge public,,,,C,%??_name,@,%(??_aframe) + else + ?merge @,%??_name,@,%(??_aframe),label,near + ?merge public,,,,,@,%??_name,@,%(??_aframe) + endif + endif + ?_BeginProc_Debug_Prologue + endif + if ??_pcall + ??_aframe = 0 + ?count = ??_numargs + rept ??_numargs + ?invprg ,%?count + ?count = ?count - 1 + endm + endif + ??_fleave = FALSE + if ??_esp + if ??_frame + sub esp, ??_frame + ??_pushed = ??_pushed + ??_frame + ??_fleave = VMM_TRUE + endif + else + if ??_frame eq 0 + if (??_taframe eq 0) OR ((??_procflags AND ??_pf_ArgsUsed) EQ 0) + ifdef DEBUG + push ebp + mov ebp,esp + ??_fleave = VMM_TRUE + endif + else + push ebp + mov ebp,esp + ??_fleave = VMM_TRUE + endif + else + enter ??_frame, 0 + ??_fleave = VMM_TRUE + endif + endif + ??_procflags = ??_procflags OR ??_pf_Entered +endm + + + + + + + + + + + + + + + +LeaveProc macro flags + if ??_fleave + if ??_esp + ifidni , + lea esp,[esp + ??_frame] + else + add esp,??_frame + endif + else + leave + endif + endif + ??_procflags = ??_procflags OR ??_pf_Left +endm + + + + + + + +Return macro + if ??_cleanoff OR ??_w32svc + if ??_w32svc AND (??_taframe LT 8) + ret 8 + else + ret ??_taframe + endif + else + ret + endif + ??_procflags = ??_procflags OR ??_pf_Returned + endm + + + + +EndProc macro Name, Flag + Name endp +if ??_w32svc + if ??_taframe lt 8 + cparm&Name equ 0 + else + cparm&Name equ (??_taframe/4 - 2) + endif +endif +if ??_procflags AND ??_pf_Left +if ??_fleave +if ??_esp + ??_pushed = ??_pushed - ??_frame +endif +endif +endif +ifdifi , + if ??_pushed ne 0 + %out Warning: stack not balanced in Name + endif + if ??_procflags AND ??_pf_Check + ife ??_procflags AND ??_pf_Entered + %out Warning: ArgVar/LocalVar without EnterProc in Name + endif + ife ??_procflags AND ??_pf_Left + %out Warning: ArgVar/LocalVar without LeaveProc in Name + endif + ife ??_procflags AND ??_pf_Returned + %out Warning: ArgVar/LocalVar without Return in Name + endif + endif +endif +ifdifi , + ?count = 0 + rept ??_numlocalsymbols + ?count = ?count + 1 + ?invprg ,%?count + endm +endif + ??_ends + ??_ends equ <> + endm + + + + + + + +cCall macro name, arglst, flags + ife .TYPE name + CondExtern name, near + endif + ifdef ??_nonstandardccall_&name + PushCParams , + else + PushCParams , + endif + call name + ifdef ??_nonstandardccall_&name + ClearCParams PRESERVE_FLAGS + else + ClearCParams + endif + endm + .xcref cCall + + + + + + +pCall macro name, arglst + local ??saved + ife .TYPE name + ?toupper name + else + ?upper equ + endif + CondExtern %?upper, near + ??saved = ??_pushed + irp x, + push x + ??_pushed = ??_pushed + 4 + endm + call ?upper + ??_pushed = ??saved + endm + .xcref pCall + + + + + + + +sCall macro name, arglst + local ??saved + ??saved = ??_pushed + PushCParams + ?scall _, name, %(??_argc * 4) + ??_pushed = ??saved + endm + .xcref sCall + + + + + + + + + + + + + + +fCall macro name, arglst, flags + local ??saved + ??saved = ??_pushed + ife .TYPE name + CondExtern name, near + endif + PushCParams , + ?scall @, name, %(??_argc * 4) + ifdef ??_nonstandardccall_&name + ClearCParams PRESERVE_FLAGS + else + ClearCParams + endif + ??_pushed = ??saved + endm + .xcref fCall + + + + + +iCall equ + + + + + + + + + + + + + + +IFNDEF STANDARD_CCALL +NONSTANDARD_CCALL = 1 +ENDIF + +PushCParams macro arglst, flags + LOCAL ??_pushedargs + + ??_argc = 0 +IFDEF NONSTANDARD_CCALL + ??_popargs = 0 +ELSE + ??_popargs = ??_align EQ 0 +ENDIF + ifidni , + ??_popargs = 1 + elseifidni , + ??_popargs = 0 + elseifidni , + ??_popargs = 0 + endif + + irp x, + ??_argc = ??_argc + 1 + ifidni , + if ??_argc eq 1 + ifdifi , + .err + endif + elseif ??_argc eq 2 + ifdifi , + .err + endif + else + ?marg ,%??_argc + endif + else + ?marg ,%??_argc + endif + endm + ?count = ??_argc + ifidni , + ??_pushedargs = ??_argc-2 + else + ??_pushedargs = ??_argc + endif + if ??_pushedargs GT 0 + rept ??_argc + ?invprg ,%?count + ?count = ?count - 1 + endm + endif + endm + + + + + + + + + + + + + + + + +ClearCParams macro fPreserveFlags + if ??_argc ne 0 + if (??_popargs) AND (??_argc LE 2) + rept ??_argc + pop ecx + endm + elseifidni , + lea esp, [esp][??_argc * 4] + else + add esp,??_argc * 4 + endif + endif + ??_pushed = ??_pushed - (??_argc * 4) + endm + + + +?marg macro name, num + .xcref + .xcref ?AM&num + .cref + ?AM&num ¯o + push name + ??_pushed = ??_pushed + 4 + &endm + endm + .xcref ?marg + + + +?invprg macro name1, name2 + name1&name2 + purge name1&name2 + endm + .xcref ?invprg + + + +?scall macro prefix, name1, name2 + CondExtern prefix&name1&@&name2, near + call prefix&name1&@&name2 + endm + .xcref ?scall + + + +?merge macro l1, l2, l3, l4, op, r1, r2, r3, r4, r5, r6, r7, r8, r9 + l1&l2&l3&l4 op r1&r2&r3&r4&r5&r6&r7&r8&r9 + endm + + + +?toupper macro s + ?upper equ <> + irpc x, + if '&x' GE 'a' + if '&x' LE 'z' + ?t1 substr ,'&x'-'a'+1,1 + ?upper catstr ?upper,?t1 + else + ?upper catstr ?upper,<&x> + endif + else + ?upper catstr ?upper,<&x> + endif + endm + endm + .xcref + + + + + + +CondExtern macro name,dist + ifdef MASM6 + ifndef name + externdef name:dist + endif + else + if2 + ifndef name + extrn name:dist + endif + endif + endif +endm + + + +SaveReg macro reglist + irp reg, + ifidni , + pushfd + ??_pushed = ??_pushed + 4 + else + ifidni , + pushad + ??_pushed = ??_pushed + SIZE Pushad_Struc + else + push reg + ??_pushed = ??_pushed + 4 + endif + endif + endm +endm + + + + + + + +RestoreReg macro reglist + irp reg, + ifidni , + popfd + ??_pushed = ??_pushed - 4 + else + ifidni , + popad + ??_pushed = ??_pushed - SIZE Pushad_Struc + else + pop reg + ??_pushed = ??_pushed - 4 + endif + endif + endm +endm + +ifdef DEBUG +Begin_Profile_List macro devname +ifdef profileall +VxD_DATA_SEG + db 'PROCLIST' +PUBLIC devname&_Proc_Profile_List +devname&_Proc_Profile_List label dword +endif +endm + +Profile_Link macro modname +ifdef profileall +ifdifi ,@filename +EXTRN _&modname&__proc_list:near +endif + dd OFFSET32 _&modname&__proc_list +endif +endm + +End_Profile_List macro +ifdef profileall + dd 0 +VxD_DATA_ENDS +endif +endm + + +endif +ifndef Not_VxD +RESERVED_LOW_BOOST EQU 00000001H +CUR_RUN_VM_BOOST EQU 00000004H +LOW_PRI_DEVICE_BOOST EQU 00000010H +HIGH_PRI_DEVICE_BOOST EQU 00001000H +CRITICAL_SECTION_BOOST EQU 00100000H +TIME_CRITICAL_BOOST EQU 00400000H +RESERVED_HIGH_BOOST EQU 40000000H +PEF_WAIT_FOR_STI_BIT EQU 0 +PEF_WAIT_FOR_STI EQU (1 SHL PEF_WAIT_FOR_STI_BIT) +PEF_WAIT_NOT_CRIT_BIT EQU 1 +PEF_WAIT_NOT_CRIT EQU (1 SHL PEF_WAIT_NOT_CRIT_BIT) +PEF_DONT_UNBOOST_BIT EQU 2 +PEF_DONT_UNBOOST EQU (1 SHL PEF_DONT_UNBOOST_BIT) +PEF_ALWAYS_SCHED_BIT EQU 3 +PEF_ALWAYS_SCHED EQU (1 SHL PEF_ALWAYS_SCHED_BIT) +PEF_TIME_OUT_BIT EQU 4 +PEF_TIME_OUT EQU (1 SHL PEF_TIME_OUT_BIT) +PEF_WAIT_NOT_HW_INT_BIT EQU 5 +PEF_WAIT_NOT_HW_INT EQU (1 SHL PEF_WAIT_NOT_HW_INT_BIT) +PEF_WAIT_NOT_NESTED_EXEC_BIT EQU 6 +PEF_WAIT_NOT_NESTED_EXEC EQU (1 SHL PEF_WAIT_NOT_NESTED_EXEC_BIT) +PEF_WAIT_IN_PM_BIT EQU 7 +PEF_WAIT_IN_PM EQU (1 SHL PEF_WAIT_IN_PM_BIT) +PEF_THREAD_EVENT_BIT EQU 8 +PEF_THREAD_EVENT EQU (1 SHL PEF_THREAD_EVENT_BIT) +PEF_WAIT_FOR_THREAD_STI_BIT EQU 9 +PEF_WAIT_FOR_THREAD_STI EQU (1 SHL PEF_WAIT_FOR_THREAD_STI_BIT) +PEF_RING0_EVENT_BIT EQU 10 +PEF_RING0_EVENT EQU (1 SHL PEF_RING0_EVENT_BIT) +PEF_WAIT_CRIT_BIT EQU 11 +PEF_WAIT_CRIT EQU (1 SHL PEF_WAIT_CRIT_BIT) +PEF_WAIT_CRIT_VM_BIT EQU 12 +PEF_WAIT_CRIT_VM EQU (1 SHL PEF_WAIT_CRIT_VM_BIT) +PEF_PROCESS_LAST_BIT EQU 13 +PEF_PROCESS_LAST EQU (1 SHL PEF_PROCESS_LAST_BIT) +PEF_WAIT_PREEMPTABLE_BIT EQU 14 +PEF_WAIT_PREEMPTABLE EQU (1 SHL PEF_WAIT_PREEMPTABLE_BIT) +PEF_WAIT_FOR_PASSIVE_BIT EQU 15 +PEF_WAIT_FOR_PASSIVE EQU (1 SHL PEF_WAIT_FOR_PASSIVE_BIT) +PEF_WAIT_FOR_APPY_BIT EQU 16 +PEF_WAIT_FOR_APPY EQU (1 SHL PEF_WAIT_FOR_APPY_BIT) +PEF_WAIT_FOR_WORKER_BIT EQU 17 +PEF_WAIT_FOR_WORKER EQU (1 SHL PEF_WAIT_FOR_WORKER_BIT) +PEF_WAIT_NOT_TIME_CRIT_BIT EQU PEF_WAIT_NOT_HW_INT_BIT +PEF_WAIT_NOT_TIME_CRIT EQU PEF_WAIT_NOT_HW_INT +PEF_WAIT_NOT_PM_LOCKED_STACK_BIT EQU PEF_WAIT_NOT_NESTED_EXEC_BIT +PEF_WAIT_NOT_PM_LOCKED_STACK EQU PEF_WAIT_NOT_NESTED_EXEC +PEF_WAIT_FOR_CONFIGMG_CALLABLE EQU PEF_WAIT_FOR_WORKER +PEF_WAIT_FOR_CONFIGMG_QUICK EQU PEF_WAIT_FOR_APPY +BLOCK_SVC_INTS_BIT EQU 0 +BLOCK_SVC_INTS EQU (1 SHL BLOCK_SVC_INTS_BIT) +BLOCK_SVC_IF_INTS_LOCKED_BIT EQU 1 +BLOCK_SVC_IF_INTS_LOCKED EQU (1 SHL BLOCK_SVC_IF_INTS_LOCKED_BIT) +BLOCK_ENABLE_INTS_BIT EQU 2 +BLOCK_ENABLE_INTS EQU (1 SHL BLOCK_ENABLE_INTS_BIT) +BLOCK_POLL_BIT EQU 3 +BLOCK_POLL EQU (1 SHL BLOCK_POLL_BIT) +BLOCK_THREAD_IDLE_BIT EQU 4 +BLOCK_THREAD_IDLE EQU (1 SHL BLOCK_THREAD_IDLE_BIT) +BLOCK_FORCE_SVC_INTS_BIT EQU 5 +BLOCK_FORCE_SVC_INTS EQU (1 SHL BLOCK_FORCE_SVC_INTS_BIT) + +Client_Reg_Struc STRUC +Client_EDI DD ? +Client_ESI DD ? +Client_EBP DD ? +Client_res0 DD ? +Client_EBX DD ? +Client_EDX DD ? +Client_ECX DD ? +Client_EAX DD ? +Client_Error DD ? +Client_EIP DD ? +Client_CS DW ? +Client_res1 DW ? +Client_EFlags DD ? +Client_ESP DD ? +Client_SS DW ? +Client_res2 DW ? +Client_ES DW ? +Client_res3 DW ? +Client_DS DW ? +Client_res4 DW ? +Client_FS DW ? +Client_res5 DW ? +Client_GS DW ? +Client_res6 DW ? +Client_Alt_EIP DD ? +Client_Alt_CS DW ? +Client_res7 DW ? +Client_Alt_EFlags DD ? +Client_Alt_ESP DD ? +Client_Alt_SS DW ? +Client_res8 DW ? +Client_Alt_ES DW ? +Client_res9 DW ? +Client_Alt_DS DW ? +Client_res10 DW ? +Client_Alt_FS DW ? +Client_res11 DW ? +Client_Alt_GS DW ? +Client_res12 DW ? +Client_Reg_Struc ENDS + +Client_Word_Reg_Struc STRUC +Client_DI DW ? +Client_res13 DW ? +Client_SI DW ? +Client_res14 DW ? +Client_BP DW ? +Client_res15 DW ? +Client_res16 DD ? +Client_BX DW ? +Client_res17 DW ? +Client_DX DW ? +Client_res18 DW ? +Client_CX DW ? +Client_res19 DW ? +Client_AX DW ? +Client_res20 DW ? +Client_res21 DD ? +Client_IP DW ? +Client_res22 DW ? +Client_res23 DD ? +Client_Flags DW ? +Client_res24 DW ? +Client_SP DW ? +Client_res25 DW ? +Client_res26 DD 5 DUP (?) +Client_Alt_IP DW ? +Client_res27 DW ? +Client_res28 DD ? +Client_Alt_Flags DW ? +Client_res29 DW ? +Client_Alt_SP DW ? +Client_Word_Reg_Struc ENDS + +Client_Byte_Reg_Struc STRUC +Client_res30 DD 4 DUP (?) +Client_BL DB ? +Client_BH DB ? +Client_res31 DW ? +Client_DL DB ? +Client_DH DB ? +Client_res32 DW ? +Client_CL DB ? +Client_CH DB ? +Client_res33 DW ? +Client_AL DB ? +Client_AH DB ? +Client_Byte_Reg_Struc ENDS +?UnionSize = 0 +if size Client_Reg_Struc gt ?UnionSize + ?UnionSize = size Client_Reg_Struc +endif +CRS equ <(byte ptr 0)> + +if size Client_Word_Reg_Struc gt ?UnionSize + ?UnionSize = size Client_Word_Reg_Struc +endif +CWRS equ <(byte ptr 0)> + +if size Client_Byte_Reg_Struc gt ?UnionSize + ?UnionSize = size Client_Byte_Reg_Struc +endif +CBRS equ <(byte ptr 0)> + + +tagCLIENT_STRUC STRUC + DB ?UnionSize dup(?) +tagCLIENT_STRUC ENDS + +IF 0 +.ERRNZ Client_SP - Client_ESP +.ERRNZ Client_AL - Client_EAX + +endif +DYNA_LINK_INT EQU 20H + + + + + + + + + + + + +DeclareNonstandardCcallService macro arglst + irp x, + ??_nonstandardccall_&&x = 1 + endm +endm + + + + + + +DeclareNonstandardCcallService <_BlockOnID, _LocalizeSprintf> +DeclareNonstandardCcallService <_SetLastV86Page> + +BeginDoc + + + + + + + + + + + + + +EndDoc + + +BeginDoc + + + + + + + + +EndDoc + +DefTable MACRO vt, vn + vt EQU +ENDM + +GenDD2 MACRO vt, sn, jf + dd OFFSET32 vt[sn+jf] +ENDM + +GenDD MACRO P, vid, snum, jflag + LOCAL vtable +IFDEF @@VxDName&vid + Deftable vtable, %@@VxDName&vid + EXTRN vtable:DWORD + GenDD2 %vtable, snum, jflag +ELSE + dd @@&P+jflag +ENDIF + +ENDM + + +VxDCall MACRO P, Param, flags + ??_vxdid = (@@&P SHR 16) + ??_servicenum = (@@&P AND 0FFFFh) + + ifdef ??_standardccall_&P + PushCParams , + .errnz ??_argc ne ??_standardccall_&P, + else + ifdef ??_fastcall_&P + PushCParams , + .errnz ??_argc ne (??_fastcall_&P), + else + ifdef ??_nonstandardccall_&P + PushCParams , + else + PushCParams , + endif + endif + endif + int Dyna_Link_Int + GenDD P, %??_vxdid, %??_servicenum, 0 + ifndef ??_standardccall_&P + ifndef ??_fastcall_&P + ifdef ??_nonstandardccall_&P + ClearCParams PRESERVE_FLAGS + else + ClearCParams + endif + else + if(??_argc gt 2) + ??_pushed = ??_pushed - ((??_argc - 2) * 4) + endif + endif + else + ??_pushed = ??_pushed - (??_argc * 4) + endif + ENDM + +VxDJmp MACRO P, Param + ??_vxdid = (@@&P SHR 16) + ??_servicenum = (@@&P AND 0FFFFh) + ifdef ??_fastcall_&P + PushCParams , + .errnz ??_argc gt 2, + else + .errnb , + endif + int Dyna_Link_Int + GenDD P, %??_vxdid, %??_servicenum, DL_Jmp_Mask + ENDM + +DL_Jmp_Mask EQU 8000h +DL_Jmp_Bit EQU 0Fh + +VMMCall MACRO P, Param + .ERRNZ (@@&P SHR 16) - VMM_DEVICE_ID + VxDCall

, + ENDM + +VMMJmp MACRO P, Param + .ERRNZ (@@&P SHR 16) - VMM_DEVICE_ID + VxDJmp

, + ENDM + +WDMCall MACRO P, Param, flags + ifdef ??_standardccall_&P + PushCParams , + .errnz ??_argc ne ??_standardccall_&P, + else + ifdef ??_fastcall_&P + PushCParams , + .errnz ??_argc ne (??_fastcall_&P), + else + ifdef ??_nonstandardccall_&P + PushCParams , + else + PushCParams , + endif + endif + endif + mov eax,WDM@@&P + int WDM_DynaLink_Int + nop + nop + nop + ifndef ??_standardccall_&P + ifndef ??_fastcall_&P + ifdef ??_nonstandardccall_&P + ClearCParams PRESERVE_FLAGS + else + ClearCParams + endif + else + if(??_argc gt 2) + ??_pushed = ??_pushed - ((??_argc - 2) * 4) + endif + endif + else + ??_pushed = ??_pushed - (??_argc * 4) + endif + ENDM + +WDMJmp MACRO P, Param + ifdef ??_fastcall_&P + PushCParams , + .errnz ??_argc gt 2, + else + .errnb , + endif + mov eax, WDM@@&P+WDM_DL_Jmp_Mask + int WDM_DynaLink_Int + nop + nop + nop + ENDM + +WDM_DL_Jmp_Mask EQU 80000000h +WDM_DL_Jmp_Bit EQU 31 + +BeginDoc + + + + + + + + + + + + + + + + + + + + + + + + + + + + +EndDoc + + + + +VxD_CODE_SEG EQU +VxD_CODE_ENDS EQU + + +VxD_LOCKED_CODE_SEG MACRO +_LTEXT SEGMENT +??_CUR_CODE_SEG = ??_CUR_CODE_SEG SHL 4 + ??_LCODE + ASSUME cs:FLAT, ds:FLAT, es:FLAT, ss:FLAT + + ENDM + +VxD_LOCKED_CODE_ENDS MACRO +??_CUR_CODE_SEG = ??_CUR_CODE_SEG SHR 4 +_LTEXT ENDS + ENDM + + + + +VxD_PAGEABLE_CODE_SEG MACRO +_PTEXT SEGMENT +??_CUR_CODE_SEG = ??_CUR_CODE_SEG SHL 4 + ??_PCODE + ASSUME cs:FLAT, ds:FLAT, es:FLAT, ss:FLAT + + ENDM + +VxD_PAGEABLE_CODE_ENDS MACRO +??_CUR_CODE_SEG = ??_CUR_CODE_SEG SHR 4 +_PTEXT ENDS + ENDM + + + + +VxD_DEBUG_ONLY_CODE_SEG MACRO +_DB1CODE SEGMENT +??_CUR_CODE_SEG = ??_CUR_CODE_SEG SHL 4 + ??_DBOCODE + ASSUME cs:FLAT, ds:FLAT, es:FLAT, ss:FLAT + ENDM + +VxD_DEBUG_ONLY_CODE_ENDS MACRO +??_CUR_CODE_SEG = ??_CUR_CODE_SEG SHR 4 +_DB1CODE ENDS + ENDM + + + + +VxD_INIT_CODE_SEG MACRO +_ITEXT SEGMENT +??_CUR_CODE_SEG = ??_CUR_CODE_SEG SHL 4 + ??_ICODE + ASSUME cs:FLAT, ds:FLAT, es:FLAT, ss:FLAT + ENDM + +VxD_INIT_CODE_ENDS MACRO +??_CUR_CODE_SEG = ??_CUR_CODE_SEG SHR 4 +_ITEXT ENDS + ENDM + +VxD_ICODE_SEG equ VxD_INIT_CODE_SEG +VxD_ICODE_ENDS equ VxD_INIT_CODE_ENDS + + + + +VxD_DATA_SEG EQU +VxD_DATA_ENDS EQU + +VxD_LOCKED_DATA_SEG MACRO NO_ALIGN +_LDATA SEGMENT +IFB + ALIGN 4 +ENDIF + ENDM + +VxD_LOCKED_DATA_ENDS MACRO +_LDATA ENDS + ENDM + + + + +VxD_IDATA_SEG MACRO +_IDATA SEGMENT + ENDM +VxD_IDATA_ENDS MACRO +_IDATA ENDS + ENDM + + + + +VxD_PAGEABLE_DATA_SEG MACRO NO_ALIGN +_PDATA SEGMENT +IFB + ALIGN 4 +ENDIF + ENDM + +VxD_PAGEABLE_DATA_ENDS MACRO +_PDATA ENDS + ENDM + + + + +VxD_STATIC_CODE_SEG MACRO +_STEXT SEGMENT +??_CUR_CODE_SEG = ??_CUR_CODE_SEG SHL 4 + ??_SCODE + ASSUME cs:FLAT, ds:FLAT, es:FLAT, ss:FLAT + + ENDM + +VxD_STATIC_CODE_ENDS MACRO +??_CUR_CODE_SEG = ??_CUR_CODE_SEG SHR 4 +_STEXT ENDS + ENDM + + + + +VxD_STATIC_DATA_SEG MACRO NO_ALIGN +_SDATA SEGMENT +IFB + ALIGN 4 +ENDIF + ENDM + +VxD_STATIC_DATA_ENDS MACRO +_SDATA ENDS + ENDM + + + +VxD_DEBUG_ONLY_DATA_SEG MACRO NO_ALIGN +_DB2DATA SEGMENT +IFB + ALIGN 4 +ENDIF + ENDM + +VxD_DEBUG_ONLY_DATA_ENDS MACRO +_DB2DATA ENDS + ENDM + + + + +VxD_16BIT_INIT_SEG MACRO +_16ICODE SEGMENT +ASSUME CS:_16ICODE, DS:NOTHING, ES:NOTHING, SS:NOTHING +??_CUR_CODE_SEG = ??_CUR_CODE_SEG SHL 4 + ??_16ICODE + ENDM + +VxD_16BIT_INIT_ENDS MACRO +??_CUR_CODE_SEG = ??_CUR_CODE_SEG SHR 4 +_16ICODE ENDS + ENDM + + + +VxD_REAL_INIT_SEG MACRO +_RCODE SEGMENT +ASSUME CS:_RCODE, DS:_RCODE, ES:_RCODE, SS:_RCODE +??_CUR_CODE_SEG = ??_CUR_CODE_SEG SHL 4 + ??_RCODE + ENDM + +VxD_REAL_INIT_ENDS MACRO +??_CUR_CODE_SEG = ??_CUR_CODE_SEG SHR 4 +_RCODE ENDS + ENDM + +endif +ifndef DDK_VERSION +ifdef WIN31COMPAT +DDK_VERSION EQU 30AH +else +ifdef WIN40COMPAT +DDK_VERSION EQU 400H +else +DDK_VERSION EQU 40AH +endif +endif +endif + +VxD_Desc_Block STRUC +DDB_Next DD ? +DDB_SDK_Version DW DDK_VERSION +DDB_Req_Device_Number DW UNDEFINED_DEVICE_ID +DDB_Dev_Major_Version DB 0 +DDB_Dev_Minor_Version DB 0 +DDB_Flags DW 0 +DDB_Name DB " " +DDB_Init_Order DD UNDEFINED_INIT_ORDER +DDB_Control_Proc DD ? +DDB_V86_API_Proc DD 0 +DDB_PM_API_Proc DD 0 +DDB_V86_API_CSIP DD 0 +DDB_PM_API_CSIP DD 0 +DDB_Reference_Data DD ? +DDB_Service_Table_Ptr DD 0 +DDB_Service_Table_Size DD 0 +DDB_Win32_Service_Table DD 0 +DDB_Prev DD 'Prev' +DDB_Size DD SIZE(VxD_Desc_Block) +DDB_Reserved1 DD 'Rsv1' +DDB_Reserved2 DD 'Rsv2' +DDB_Reserved3 DD 'Rsv3' +VxD_Desc_Block ENDS +ifndef Not_VxD +DDB_SYS_CRIT_INIT_DONE_BIT EQU 0 +DDB_SYS_CRIT_INIT_DONE EQU (1 SHL DDB_SYS_CRIT_INIT_DONE_BIT) +DDB_DEVICE_INIT_DONE_BIT EQU 1 +DDB_DEVICE_INIT_DONE EQU (1 SHL DDB_DEVICE_INIT_DONE_BIT) +DDB_HAS_WIN32_SVCS_BIT EQU 14 +DDB_HAS_WIN32_SVCS EQU (1 SHL DDB_HAS_WIN32_SVCS_BIT) +DDB_DYNAMIC_VXD_BIT EQU 15 +DDB_DYNAMIC_VXD EQU (1 SHL DDB_DYNAMIC_VXD_BIT) +DDB_DEVICE_DYNALINKED_BIT EQU 13 +DDB_DEVICE_DYNALINKED EQU (1 SHL DDB_DEVICE_DYNALINKED_BIT) +BeginDoc + + + + + + + +EndDoc +Declare_Virtual_Device MACRO Name, Major_Ver, Minor_Ver, Ctrl_Proc, Device_Num, Init_Order, V86_Proc, PM_Proc, Reference_Data + LOCAL V86_API_Offset, PM_API_Offset, Serv_Tab_Offset, Serv_Tab_Len, Ref_Data_Offset + +dev_id_err MACRO + +IFNDEF Name&_Name_Based +.err +ENDIF + ENDM + +IFB + V86_API_Offset EQU 0 +ELSE + IFB + dev_id_err + ENDIF + V86_API_Offset EQU +ENDIF + +IFB + PM_API_Offset EQU 0 +ELSE + IFB + dev_id_err + ENDIF + PM_API_Offset EQU +ENDIF + +IFDEF Name&_Service_Table + IFB + dev_id_err + ELSE + IFE Device_Num - UNDEFINED_DEVICE_ID + dev_id_err + ENDIF + ENDIF + Serv_Tab_Offset EQU + Serv_Tab_Len EQU Num_&Name&_Services +ELSE + Serv_Tab_Offset EQU 0 + Serv_Tab_Len EQU 0 +ENDIF + +IFNB + .erre (Device_Num LT BASEID_FOR_NAMEBASEDVXD), +ENDIF + +IFB + Ref_Data_Offset EQU 0 +ELSE + Ref_Data_Offset EQU +ENDIF + +IFDEF DEBUG +VxD_IDATA_SEG + db 0dh, 0ah, 'D_E_B_U_G===>' + db "&Name", '<===', 0dh, 0ah +VxD_IDATA_ENDS +ENDIF + +VxD_LOCKED_DATA_SEG + +PUBLIC Name&_DDB +Name&_DDB VxD_Desc_Block <,,Device_Num,Major_Ver,Minor_Ver,,"&Name",Init_Order,\ + OFFSET32 Ctrl_Proc, V86_API_Offset, PM_API_Offset, \ + ,,Ref_Data_Offset,Serv_Tab_Offset, Serv_Tab_Len> + +VxD_LOCKED_DATA_ENDS + + ENDM + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Begin_Control_Dispatch MACRO VxD_Name, p1, p2 +??_cd_low = 0FFFFFFFFh +??_cd_high = 0 + +BeginProc VxD_Name&_Control, p1, p2, LOCKED +ENDM + +End_Control_Dispatch MACRO VxD_Name + LOCAL ignore, table + +procoff MACRO num +IFDEF ??_cd_&&num + dd OFFSET32 ??_cd_&&num +ELSE + dd OFFSET32 ignore +ENDIF +ENDM + +IF ??_cd_low EQ ??_cd_high + cmp eax, ??_cd_low + ?merge ,,,,,, %(??_cd_low) + clc + ret +ELSE +IF ??_cd_low GT 0 + sub eax, ??_cd_low +ENDIF + cmp eax, ??_cd_high - ??_cd_low + 1 + jae short ignore + jmp [eax*4+table] +ignore: + clc + ret + +table label dword + REPT ??_cd_high - ??_cd_low + 1 + procoff %(??_cd_low) + ??_cd_low = ??_cd_low + 1 + ENDM +ENDIF + +EndProc VxD_Name&_Control + +PURGE procoff +PURGE Begin_Control_Dispatch +PURGE Control_Dispatch +PURGE End_Control_Dispatch +ENDM + +BeginDoc + + + + + + + + + + + + + + + + + + + + +EndDoc +Control_Dispatch MACRO Service, Procedure, callc, arglst + LOCAL Skip_Interseg_Jump + +.errnz ?_LCODE, + +IFB + +IFDEF ??_cd_low +Equate_Service MACRO Serv +??_cd_&&Serv equ Procedure +ENDM + +Equate_Service %(Service) + +IF Service LT ??_cd_low +??_cd_low = Service +ENDIF +IF Service GT ??_cd_high +??_cd_high = Service +ENDIF + +PURGE Equate_Service + +ELSE + cmp eax, Service + jz Procedure +ENDIF + +ELSE + + cmp eax, Service + jne SHORT Skip_Interseg_Jump + callc Procedure, +IF Service EQ PNP_NEW_DEVNODE + stc +ELSE + cmp eax,1 +ENDIF + ret +Skip_Interseg_Jump: + +ENDIF + + ENDM + +BYTE_INPUT EQU 000H +BYTE_OUTPUT EQU 004H +WORD_INPUT EQU 008H +WORD_OUTPUT EQU 00CH +DWORD_INPUT EQU 010H +DWORD_OUTPUT EQU 014H +OUTPUT_BIT EQU 2 +OUTPUT EQU (1 SHL OUTPUT_BIT) +WORD_IO_BIT EQU 3 +WORD_IO EQU (1 SHL WORD_IO_BIT) +DWORD_IO_BIT EQU 4 +DWORD_IO EQU (1 SHL DWORD_IO_BIT) +STRING_IO_BIT EQU 5 +STRING_IO EQU (1 SHL STRING_IO_BIT) +REP_IO_BIT EQU 6 +REP_IO EQU (1 SHL REP_IO_BIT) +ADDR_32_IO_BIT EQU 7 +ADDR_32_IO EQU (1 SHL ADDR_32_IO_BIT) +REVERSE_IO_BIT EQU 8 +REVERSE_IO EQU (1 SHL REVERSE_IO_BIT) +IO_SEG_MASK EQU 0FFFF0000H +IO_SEG_SHIFT EQU 10H +BeginDoc + + + + + + +EndDoc +Dispatch_Byte_IO MACRO In_Proc, Out_Proc + LOCAL Byte_IO + cmp ecx, Byte_Output + jbe SHORT Byte_IO + VMMJmp Simulate_IO +Byte_IO: +IFIDNI , + je Out_Proc +ELSE +IFIDNI , + jb In_Proc +ELSE + je Out_Proc + jmp In_Proc +ENDIF +ENDIF + ENDM + +BeginDoc + + + + + + + +EndDoc +Emulate_Non_Byte_IO MACRO + LOCAL Byte_IO + cmp ecx, Byte_Output + jbe SHORT Byte_IO + VMMJmp Simulate_IO +Byte_IO: + ENDM + +BeginDoc + + + + + + + + +EndDoc + + +VxD_IOT_Hdr STRUC +VxD_IO_Ports DW ? +VxD_IOT_Hdr ENDS + +VxD_IO_Struc STRUC +VxD_IO_Port DW ? +VxD_IO_Proc DD ? +VxD_IO_Struc ENDS +.ERRNZ SIZE VxD_IOT_Hdr - 2 +Begin_VxD_IO_Table MACRO Table_Name +PUBLIC Table_Name +Table_Name LABEL WORD + +ifndef MASM6 +IF2 +IFNDEF Table_Name&_Entries +.err +ENDIF + dw Table_Name&_Entries +ELSE + dw ? +ENDIF +ELSE + dw Table_Name&_Entries +ENDIF + + ENDM + +.ERRNZ SIZE VxD_IO_Struc - 6 +VxD_IO MACRO Port, Proc_Name + dw Port + dd OFFSET32 Proc_Name + ENDM + +End_VxD_IO_Table MACRO Table_Name + +IFNDEF Table_Name +.err +ELSE + Table_Name&_Entries EQU (($-Table_Name)-2) / (SIZE VxD_IO_Struc) +IF Table_Name&_Entries LE 0 +.err +ENDIF +ENDIF + ENDM + + + + + + + + + + + + + +Push_Client_State MACRO Can_Trash_EDI + sub esp, SIZE Client_Reg_Struc + ??_pushed = ??_pushed + SIZE Client_Reg_Struc + ifidni , + mov edi, esp + VMMCall Save_Client_State + else + push edi + lea edi, [esp+4] + VMMCall Save_Client_State + pop edi + endif + ENDM + +Pop_Client_State MACRO Can_Trash_ESI + ifdifi , + push esi + lea esi, [esp+4] + VMMCall Restore_Client_State + pop esi + else + mov esi, esp + VMMCall Restore_Client_State + endif + add esp, SIZE Client_Reg_Struc + ??_pushed = ??_pushed - SIZE Client_Reg_Struc + ENDM + +BeginDoc + + + + + + + + + + + + + + +EndDoc + +CallRet MACRO P1, P2 +IFDEF DEBUG +IFIDNI , + call P2 +ELSE + call P1 +ENDIF + ret +ELSE + jmp P1 P2 +ENDIF + ENDM + +BeginDoc + + + + + + + + + + + + + + + +EndDoc + +CallJmp MACRO Function_Name, Return_Label +IFDEF DEBUG + call Function_Name + jmp Return_Label +ELSE + push Return_Label + jmp Function_Name +ENDIF + ENDM + + +BeginDoc + + + + + + +EndDoc + +IFDEF DEBUG + +VxDCallRet macro p:req + VxDCall p + ret +endm + +VMMCallRet macro p:req + VMMCall p + ret +endm + +ELSE + +VxDCallRet equ +VMMCallRet equ + +ENDIF + + + +PClient_DS equ WORD PTR -4 +PClient_ES equ WORD PTR -8 +PClient_FS equ WORD PTR -12 +PClient_GS equ WORD PTR -16 + + + + + + + + + + + +Client_Ptr_Flat MACRO Reg_32, Cli_Seg, Cli_Off, Can_Trash_EAX + +IFDIFI , + IFDIFI , + xchg Reg_32, eax + ENDIF +ENDIF +IFB + mov ax, (Client_&Cli_Seg * 100h) + 0FFh +ELSE + mov ax, (Client_&Cli_Seg * 100h) + Client_&Cli_Off +ENDIF + VMMCall Map_Flat + +IFDIFI , + xchg Reg_32, eax +ENDIF + + ENDM + + + +VxDint MACRO Int_Number + if (OPATTR Int_Number) AND 4 + push Int_Number + else + push DWORD PTR Int_Number + endif + VMMCall Exec_VxD_Int + ENDM + +VxDintMustComplete MACRO Int_Number + if (OPATTR Int_Number) AND 4 + push Int_Number + else + push DWORD PTR Int_Number + endif + VMMCall _ExecVxDIntMustComplete + ENDM + +Load_FS macro + VMMCall Load_FS_Service +endm + +endif +DUPLICATE_DEVICE_ID_BIT EQU 0 +DUPLICATE_DEVICE_ID EQU (1 SHL DUPLICATE_DEVICE_ID_BIT) +DUPLICATE_FROM_INT2F_BIT EQU 1 +DUPLICATE_FROM_INT2F EQU (1 SHL DUPLICATE_FROM_INT2F_BIT) +LOADING_FROM_INT2F_BIT EQU 2 +LOADING_FROM_INT2F EQU (1 SHL LOADING_FROM_INT2F_BIT) +DEVICE_LOAD_OK EQU 0 +ABORT_DEVICE_LOAD EQU 1 +ABORT_WIN386_LOAD EQU 2 +DEVICE_NOT_NEEDED EQU 3 +NO_FAIL_MESSAGE_BIT EQU 15 +NO_FAIL_MESSAGE EQU (1 SHL NO_FAIL_MESSAGE_BIT) +LDRSRV_GET_PROFILE_STRING EQU 0 +LDRSRV_GET_NEXT_PROFILE_STRING EQU 1 +LDRSRV_RESERVED EQU 2 +LDRSRV_GET_PROFILE_BOOLEAN EQU 3 +LDRSRV_GET_PROFILE_DECIMAL_INT EQU 4 +LDRSRV_GET_PROFILE_HEX_INT EQU 5 +LDRSRV_COPY_EXTENDED_MEMORY EQU 6 +LDRSRV_GET_MEMORY_INFO EQU 7 +LDRSRV_RegOpenKey EQU 100H +LDRSRV_RegCreateKey EQU 101H +LDRSRV_RegCloseKey EQU 102H +LDRSRV_RegDeleteKey EQU 103H +LDRSRV_RegSetValue EQU 104H +LDRSRV_RegQueryValue EQU 105H +LDRSRV_RegEnumKey EQU 106H +LDRSRV_RegDeleteValue EQU 107H +LDRSRV_RegEnumValue EQU 108H +LDRSRV_RegQueryValueEx EQU 109H +LDRSRV_RegSetValueEx EQU 10AH +LDRSRV_RegFlushKey EQU 10BH +LDRSRV_COPY_INIT EQU 1 +LDRSRV_COPY_LOCKED EQU 2 +LDRSRV_COPY_PAGEABLE EQU 3 +RCODE_OBJ EQU -1 +LCODE_OBJ EQU 01H +LDATA_OBJ EQU 02H +PCODE_OBJ EQU 03H +PDATA_OBJ EQU 04H +SCODE_OBJ EQU 05H +SDATA_OBJ EQU 06H +CODE16_OBJ EQU 07H +LMSG_OBJ EQU 08H +PMSG_OBJ EQU 09H +DBOC_OBJ EQU 0BH +DBOD_OBJ EQU 0CH +PLCODE_OBJ EQU 0DH +PPCODE_OBJ EQU 0FH +ICODE_OBJ EQU 11H +IDATA_OBJ EQU 12H +ICODE16_OBJ EQU 13H +IMSG_OBJ EQU 14H + +ObjectLocation STRUC +OL_LinearAddr DD ? +OL_Size DD ? +OL_ObjType DB ? +ObjectLocation ENDS +MAXOBJECTS EQU 25 + +Device_Location_List STRUC +DLL_DDB DD ? +DLL_NumObjects DB ? +DLL_ObjLocation DB SIZE ObjectLocation * 1 DUP (?) +Device_Location_List ENDS +PE_BIT EQU 0 +PE_MASK EQU (1 SHL PE_BIT) +MP_BIT EQU 1 +MP_MASK EQU (1 SHL MP_BIT) +EM_BIT EQU 2 +EM_MASK EQU (1 SHL EM_BIT) +TS_BIT EQU 3 +TS_MASK EQU (1 SHL TS_BIT) +ET_BIT EQU 4 +ET_MASK EQU (1 SHL ET_BIT) +PG_BIT EQU 31 +PG_MASK EQU (1 SHL PG_BIT) +CF_BIT EQU 0 +CF_MASK EQU (1 SHL CF_BIT) +PF_BIT EQU 2 +PF_MASK EQU (1 SHL PF_BIT) +AF_BIT EQU 4 +AF_MASK EQU (1 SHL AF_BIT) +ZF_BIT EQU 6 +ZF_MASK EQU (1 SHL ZF_BIT) +SF_BIT EQU 7 +SF_MASK EQU (1 SHL SF_BIT) +TF_BIT EQU 8 +TF_MASK EQU (1 SHL TF_BIT) +IF_BIT EQU 9 +IF_MASK EQU (1 SHL IF_BIT) +DF_BIT EQU 10 +DF_MASK EQU (1 SHL DF_BIT) +OF_BIT EQU 11 +OF_MASK EQU (1 SHL OF_BIT) +IOPL_MASK EQU 3000H +IOPL_BIT0 EQU 12 +IOPL_BIT1 EQU 13 +NT_BIT EQU 14 +NT_MASK EQU (1 SHL NT_BIT) +RF_BIT EQU 16 +RF_MASK EQU (1 SHL RF_BIT) +VM_BIT EQU 17 +VM_MASK EQU (1 SHL VM_BIT) +AC_BIT EQU 18 +AC_MASK EQU (1 SHL AC_BIT) +VIF_BIT EQU 19 +VIF_MASK EQU (1 SHL VIF_BIT) +VIP_BIT EQU 20 +VIP_MASK EQU (1 SHL VIP_BIT) + + + + + + +IFDEF MASM6 +loopde EQU +loopdne EQU +loopdz EQU +loopdnz EQU +ELSE +loopd EQU +loopde EQU +loopdne EQU +loopdz EQU +loopdnz EQU +ENDIF + +P_SIZE EQU 1000H +P_PRESBIT EQU 0 +P_PRES EQU (1 SHL P_PRESBIT) +P_WRITEBIT EQU 1 +P_WRITE EQU (1 SHL P_WRITEBIT) +P_USERBIT EQU 2 +P_USER EQU (1 SHL P_USERBIT) +P_ACCBIT EQU 5 +P_ACC EQU (1 SHL P_ACCBIT) +P_DIRTYBIT EQU 6 +P_DIRTY EQU (1 SHL P_DIRTYBIT) +P_AVAIL EQU (P_PRES+P_WRITE+P_USER) +PG_VM EQU 0 +PG_SYS EQU 1 +PG_RESERVED1 EQU 2 +PG_PRIVATE EQU 3 +PG_RESERVED2 EQU 4 +PG_RELOCK EQU 5 +PG_INSTANCE EQU 6 +PG_HOOKED EQU 7 +PG_IGNORE EQU 0FFFFFFFFH +D_PRES EQU 080H +D_NOTPRES EQU 0 +D_DPL0 EQU 0 +D_DPL1 EQU 020H +D_DPL2 EQU 040H +D_DPL3 EQU 060H +D_SEG EQU 010H +D_CTRL EQU 0 +D_GRAN_BYTE EQU 000H +D_GRAN_PAGE EQU 080H +D_DEF16 EQU 000H +D_DEF32 EQU 040H +D_CODE EQU 08H +D_DATA EQU 0 +D_X EQU 0 +D_RX EQU 02H +D_C EQU 04H +D_R EQU 0 +D_W EQU 02H +D_ED EQU 04H +D_ACCESSED EQU 1 +RW_DATA_TYPE EQU (D_PRES+D_SEG+D_DATA+D_W) +R_DATA_TYPE EQU (D_PRES+D_SEG+D_DATA+D_R) +CODE_TYPE EQU (D_PRES+D_SEG+D_CODE+D_RX) +D_PAGE32 EQU (D_GRAN_PAGE+D_DEF32) +SELECTOR_MASK EQU 0FFF8H +SEL_LOW_MASK EQU 0F8H +TABLE_MASK EQU 04H +RPL_MASK EQU 03H +RPL_CLR EQU (NOT RPL_MASK) +IVT_ROM_DATA_SIZE EQU 500H +endif diff --git a/programs/hd_load/9x2klbr/comp_ldr.bat b/programs/hd_load/9x2klbr/comp_ldr.bat new file mode 100644 index 0000000000..92b1ea7fa2 --- /dev/null +++ b/programs/hd_load/9x2klbr/comp_ldr.bat @@ -0,0 +1 @@ +fasm 9x2klbr.asm 9x2klbr.exe diff --git a/programs/hd_load/9x2klbr/compile.txt b/programs/hd_load/9x2klbr/compile.txt new file mode 100644 index 0000000000..9f52e1938c --- /dev/null +++ b/programs/hd_load/9x2klbr/compile.txt @@ -0,0 +1,12 @@ +Изменение кода mtldr требует перекомпиляции VxD. +Изменение кода VxD требует перекомпиляции VxD. +Изменение кода exe-шника отражается только на exe-шнике. +После компиляции mtldr требуется перегнать бинарник mtldr в inc-файл, + понятный masm'у. Это делается через bintodb (взятого из пакета masm): + File->Open->mtldr, подредактировать по существующему образцу, + File->Save->mtldr.inc. +Для компиляции mtldr и 9x2klbr.exe требуется fasm, для компиляции ldklbr.vxd + требуется пакет masm. +Компилирующие bat-ники прилагаются. + diamond + mailto: diamondz@land.ru \ No newline at end of file diff --git a/programs/hd_load/9x2klbr/make_vxd.bat b/programs/hd_load/9x2klbr/make_vxd.bat new file mode 100644 index 0000000000..540306b454 --- /dev/null +++ b/programs/hd_load/9x2klbr/make_vxd.bat @@ -0,0 +1,2 @@ +ml /coff /c /Cx /DMASM6 /DBLD_COFF /DIS_32 vxd.asm +link /vxd /stub:masmstub /def:deffile.def vxd.obj diff --git a/programs/hd_load/9x2klbr/masmstub b/programs/hd_load/9x2klbr/masmstub new file mode 100644 index 0000000000..119ed9c8a9 Binary files /dev/null and b/programs/hd_load/9x2klbr/masmstub differ diff --git a/programs/hd_load/9x2klbr/mtldr b/programs/hd_load/9x2klbr/mtldr new file mode 100644 index 0000000000..9b0d7faf89 Binary files /dev/null and b/programs/hd_load/9x2klbr/mtldr differ diff --git a/programs/hd_load/9x2klbr/mtldr.inc b/programs/hd_load/9x2klbr/mtldr.inc new file mode 100644 index 0000000000..e14e67fa63 --- /dev/null +++ b/programs/hd_load/9x2klbr/mtldr.inc @@ -0,0 +1,204 @@ +mtldr_size = 3224 +mtldr: +db 255,255,255,255,128,208,12,250,176,17,230,32,227,0,230,160 +db 227,0,176,8,230,33,227,0,176,112,230,161,227,0,176,4 +db 230,33,227,0,176,2,230,161,227,0,176,1,230,33,227,0 +db 230,161,227,0,176,0,230,33,227,0,230,161,227,0,184,3 +db 0,205,16,176,52,230,67,227,0,176,255,230,64,227,0,230 +db 64,227,0,184,1,194,205,21,233,184,1,172,132,192,116,9 +db 180,14,187,7,0,205,16,235,242,195,102,3,6,0,208,102 +db 96,102,59,6,152,220,114,55,128,62,228,208,0,116,93,102 +db 104,0,0,0,0,102,80,6,83,102,104,16,0,1,0,184 +db 0,66,138,22,4,208,137,230,30,22,31,205,19,31,131,196 +db 16,102,97,114,55,129,195,0,2,102,64,73,117,193,195,102 +db 49,210,102,15,183,14,158,220,102,247,241,254,194,136,209,102 +db 15,164,194,16,247,54,156,220,136,214,136,197,192,228,6,8 +db 225,184,1,2,138,22,4,208,205,19,235,197,190,229,208,232 +db 121,255,235,254,0,68,105,115,107,32,114,101,97,100,32,101 +db 114,114,111,114,33,0,2,32,75,111,108,105,98,114,105,79 +db 83,32,98,111,111,116,108,111,97,100,101,114,44,32,114,117 +db 110,110,105,110,103,32,111,110,32,0,117,110,107,110,111,119 +db 110,32,102,105,108,101,115,121,115,116,101,109,44,32,99,97 +db 110,110,111,116,32,99,111,110,116,105,110,117,101,0,70,65 +db 84,49,50,47,70,65,84,49,54,32,45,32,117,110,115,117 +db 112,112,111,114,116,101,100,13,10,0,70,65,84,51,50,13 +db 10,0,78,84,70,83,13,10,0,69,114,114,111,114,58,32 +db 0,77,70,84,0,92,0,36,73,78,68,69,88,95,82,79 +db 79,84,32,110,111,116,32,102,111,117,110,100,0,99,97,110 +db 110,111,116,32,114,101,97,100,32,97,116,116,114,105,98,117 +db 116,101,0,36,68,65,84,65,32,110,111,116,32,102,111,117 +db 110,100,0,105,115,32,97,32,100,105,114,101,99,116,111,114 +db 121,0,110,111,116,32,97,32,100,105,114,101,99,116,111,114 +db 121,0,116,111,111,32,102,114,97,103,109,101,110,116,101,100 +db 32,102,105,108,101,0,101,120,116,101,110,100,101,100,32,109 +db 101,109,111,114,121,32,101,114,114,111,114,0,98,97,100,32 +db 99,108,117,115,116,101,114,0,100,97,116,97,32,101,114,114 +db 111,114,0,49,192,142,216,142,192,142,208,102,188,254,255,0 +db 0,252,251,138,22,4,208,180,8,205,19,115,5,185,255,255 +db 136,206,15,182,198,64,163,156,220,136,202,131,226,63,137,22 +db 158,220,247,226,134,205,192,237,6,65,137,14,160,220,247,225 +db 163,152,220,137,22,154,220,138,22,4,208,180,65,187,170,85 +db 205,19,114,15,129,251,85,170,117,9,246,193,1,116,4,254 +db 6,228,208,190,246,208,232,226,253,102,161,0,208,102,131,248 +db 255,117,20,102,49,192,185,1,0,187,0,5,232,224,253,102 +db 161,198,6,102,163,0,208,185,1,0,187,0,5,232,207,253 +db 15,182,6,13,5,163,172,220,102,129,62,54,5,70,65,84 +db 49,116,29,102,129,62,82,5,70,65,84,51,116,26,102,129 +db 62,3,5,78,84,70,83,15,132,231,0,232,141,253,235,254 +db 190,62,209,232,133,253,235,254,190,90,209,232,125,253,102,15 +db 183,6,11,5,102,15,182,30,13,5,102,247,227,102,163,180 +db 220,102,15,183,30,14,5,102,137,30,200,220,102,15,182,6 +db 16,5,102,247,38,36,5,102,1,216,102,15,182,30,13,5 +db 102,41,216,102,41,216,102,163,166,220,129,6,5,208,0,208 +db 102,161,44,5,199,6,164,220,117,209,80,139,54,5,208,86 +db 172,60,92,116,4,60,0,117,247,103,135,68,36,2,198,68 +db 255,0,137,54,5,208,232,114,3,89,132,201,116,13,246,69 +db 11,16,190,194,209,15,132,58,3,235,207,246,69,11,16,190 +db 179,209,15,133,45,3,191,5,0,104,0,32,7,38,198,69 +db 251,1,38,102,199,69,252,1,0,0,0,102,171,6,30,7 +db 232,242,3,7,115,36,38,102,139,77,248,38,102,3,77,252 +db 102,57,200,116,14,38,102,199,5,1,0,0,0,102,175,102 +db 171,235,218,38,102,255,69,248,235,211,102,49,192,102,171,233 +db 184,0,190,98,209,232,163,252,102,15,183,6,11,5,102,80 +db 102,15,182,30,13,5,102,247,227,102,163,180,220,102,199,6 +db 166,220,0,0,0,0,102,139,14,64,5,128,249,0,127,12 +db 246,217,102,49,192,102,64,102,211,224,235,3,102,247,225,102 +db 163,184,220,102,91,102,49,210,102,247,243,163,188,220,199,6 +db 164,220,113,209,102,15,182,6,13,5,102,247,38,48,5,139 +db 14,188,220,187,0,64,137,223,83,232,78,252,232,152,3,95 +db 184,128,0,187,0,7,232,39,4,190,163,209,15,130,99,2 +db 137,30,162,220,129,6,5,208,0,208,102,184,5,0,0,0 +db 199,6,164,220,117,209,80,139,54,5,208,86,172,60,92,116 +db 4,60,0,117,247,103,135,68,36,2,198,68,255,0,137,54 +db 5,208,232,121,6,89,132,201,117,220,49,246,6,15,161,100 +db 172,60,0,190,141,209,15,132,25,2,190,1,0,102,49,255 +db 104,0,16,7,49,219,100,102,173,102,145,103,227,66,100,102 +db 173,102,96,102,15,182,14,13,5,102,247,225,102,3,6,166 +db 220,232,198,251,180,135,102,139,14,180,220,102,81,209,233,190 +db 83,214,6,30,7,205,21,7,132,228,190,230,209,15,133,210 +db 1,102,89,102,1,14,109,214,102,97,102,64,226,195,235,182 +db 30,7,199,6,164,220,141,220,102,49,192,187,0,5,185,1 +db 0,232,46,1,161,14,5,3,6,28,5,163,200,220,147,15 +db 182,6,16,5,247,38,22,5,1,216,187,0,7,139,14,17 +db 5,131,193,15,193,233,4,232,8,1,1,200,163,170,220,193 +db 225,9,137,223,1,203,198,7,0,128,61,0,190,169,209,15 +db 132,112,1,190,141,220,232,237,1,116,8,131,231,224,131,199 +db 32,235,230,131,231,224,190,179,209,246,69,11,16,15,133,82 +db 1,139,69,26,80,72,72,15,182,14,13,5,247,225,3,6 +db 170,220,163,174,220,247,54,172,220,102,15,183,192,104,0,32 +db 31,190,1,0,102,43,4,114,17,102,131,60,0,104,141,209 +db 15,132,32,1,89,131,198,8,235,234,102,3,4,102,3,68 +db 4,106,0,31,102,15,183,14,172,220,82,102,247,225,90,102 +db 15,183,210,102,1,208,102,3,6,166,220,102,163,176,220,88 +db 104,0,16,7,80,49,219,232,87,0,193,225,5,140,192,1 +db 200,142,192,88,232,13,0,114,235,184,75,76,190,130,220,234 +db 0,0,0,16,187,0,7,80,209,232,103,3,4,36,137,194 +db 193,232,9,3,6,200,220,185,2,0,6,30,7,232,50,0 +db 7,129,226,255,1,1,211,139,7,89,247,193,1,0,116,3 +db 193,232,4,37,255,15,190,252,209,61,247,15,15,132,147,0 +db 195,72,72,15,182,14,13,5,247,225,3,6,170,220,102,15 +db 183,192,102,96,102,15,183,219,190,83,214,102,193,224,9,102 +db 5,0,0,16,147,102,137,68,18,102,184,0,0,48,9,140 +db 192,102,193,224,4,102,1,216,102,137,68,26,180,135,193,225 +db 8,6,106,0,7,205,21,7,128,252,0,190,230,209,117,67 +db 102,97,195,0,0,0,0,0,0,0,0,0,0,0,0,0 +db 0,0,0,255,255,0,0,1,147,0,0,255,255,0,0,16 +db 147,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +db 0,0,0,86,190,105,209,232,193,249,139,54,164,220,232,186 +db 249,190,110,209,232,180,249,94,232,176,249,235,254,103,139,116 +db 36,2,137,54,164,220,104,169,209,235,217,187,0,9,137,223 +db 102,80,232,153,0,139,14,180,220,193,233,5,102,88,128,61 +db 0,116,218,103,139,116,36,2,102,80,232,57,0,116,17,131 +db 231,224,131,199,32,226,229,102,88,232,137,0,115,191,114,203 +db 102,88,103,139,116,36,2,137,54,164,220,131,231,224,190,179 +db 209,139,69,20,102,193,224,16,139,69,26,102,133,192,190,163 +db 209,116,128,194,2,0,81,185,9,0,172,60,46,116,21,60 +db 0,116,35,60,97,114,7,60,122,119,3,128,13,32,174,225 +db 233,65,89,195,176,32,73,243,174,117,246,247,199,1,0,117 +db 240,185,4,0,235,212,176,32,73,243,174,117,228,247,199,1 +db 0,117,7,185,3,0,243,174,117,215,49,201,89,195,102,37 +db 255,255,255,15,102,15,182,14,13,5,102,247,225,102,3,6 +db 166,220,233,245,248,187,0,7,102,80,102,193,232,7,102,59 +db 6,137,220,116,15,102,163,137,220,102,3,6,200,220,185,1 +db 0,232,214,248,102,88,102,131,224,127,103,102,139,4,133,0 +db 7,0,0,102,37,255,255,255,15,102,61,247,255,255,15,190 +db 252,209,15,132,221,254,195,139,93,4,139,77,6,67,1,251 +db 67,129,199,254,1,73,139,7,171,67,67,129,199,254,1,226 +db 245,195,3,125,20,131,61,255,116,20,57,5,117,11,61,128 +db 0,117,13,128,125,9,0,116,7,3,125,4,235,231,49,255 +db 195,3,116,32,102,49,219,172,132,192,116,78,104,141,209,15 +db 182,200,193,233,4,15,132,139,254,146,131,226,15,15,132,131 +db 254,1,206,1,214,88,86,78,102,15,190,4,73,116,9,78 +db 102,193,224,8,138,4,226,247,102,149,78,102,15,190,4,137 +db 209,73,116,9,78,102,193,224,8,138,4,226,247,94,102,1 +db 235,102,171,102,137,216,102,171,235,173,102,49,192,102,171,195 +db 87,80,38,198,7,1,67,83,137,30,196,220,3,125,20,232 +db 115,255,133,255,116,42,128,125,8,0,117,22,137,254,95,79 +db 176,0,170,139,68,16,171,145,3,116,20,243,164,137,251,88 +db 95,195,102,131,125,16,0,117,214,137,254,95,232,98,255,87 +db 103,131,124,36,2,32,15,132,173,0,103,139,124,36,4,184 +db 32,0,232,45,255,133,255,15,132,156,0,6,187,0,192,103 +db 139,124,36,6,83,255,54,196,220,30,7,232,146,255,143,6 +db 196,220,94,187,0,128,83,86,232,136,0,94,91,1,218,103 +db 139,68,36,4,7,57,7,117,103,61,128,0,117,6,128,127 +db 6,0,117,92,102,131,127,16,0,116,85,102,131,127,8,0 +db 117,13,80,103,139,68,36,2,59,6,196,220,88,117,65,102 +db 96,102,139,71,16,137,211,255,54,196,220,6,30,7,232,142 +db 0,7,143,6,196,220,102,97,102,96,137,215,3,125,20,232 +db 179,254,102,139,71,8,102,59,69,16,117,243,137,254,103,139 +db 124,36,32,131,239,4,232,184,254,103,137,124,36,32,102,97 +db 3,95,4,57,211,114,142,91,88,95,59,30,196,220,117,2 +db 75,249,195,172,60,0,117,11,173,102,15,183,208,145,137,223 +db 243,164,195,102,49,210,102,173,102,145,103,227,47,102,173,102 +db 151,102,81,102,139,14,180,220,102,137,248,102,247,225,83,232 +db 232,246,91,102,89,102,71,102,161,180,220,102,1,194,102,193 +db 232,4,140,197,1,197,142,197,226,215,235,202,142,193,195,190 +db 0,7,102,139,14,184,220,102,247,225,83,255,54,164,220,199 +db 6,164,220,113,209,232,9,0,143,6,164,220,95,232,247,253 +db 195,104,141,209,128,60,0,117,53,102,133,210,15,133,196,252 +db 102,61,0,0,1,0,15,131,186,252,102,129,249,0,0,1 +db 0,15,131,175,252,59,68,2,15,131,168,252,59,76,2,15 +db 135,161,252,131,198,3,1,198,137,223,243,164,88,195,102,139 +db 62,180,220,102,247,247,137,22,196,220,1,209,102,80,102,145 +db 102,49,210,102,72,102,247,247,102,64,102,145,102,88,131,198 +db 1,102,49,210,83,102,139,28,102,133,219,15,132,169,0,102 +db 1,218,131,198,8,102,57,208,115,235,102,139,124,252,102,82 +db 102,87,102,41,194,102,1,223,102,41,215,102,57,202,114,3 +db 102,137,202,131,62,196,220,0,117,47,102,96,102,15,182,30 +db 13,5,146,247,227,145,102,151,102,247,227,103,139,92,36,40 +db 232,247,245,103,137,92,36,40,102,97,102,1,208,102,41,209 +db 102,95,102,90,117,159,91,88,195,102,81,102,15,182,14,13 +db 5,102,137,248,102,82,102,247,225,104,0,16,7,49,219,232 +db 200,245,137,217,86,87,139,54,196,220,103,139,124,36,20,41 +db 241,30,6,31,7,243,164,103,137,124,36,20,6,31,95,94 +db 102,90,102,89,102,71,199,6,196,220,0,0,102,64,102,73 +db 116,174,102,74,117,132,235,162,190,141,209,233,181,251,139,30 +db 162,220,137,30,198,220,83,232,181,254,161,184,220,1,6,162 +db 220,95,184,144,0,87,139,30,162,220,137,30,192,220,232,79 +db 253,190,119,209,15,130,139,251,137,30,162,220,95,184,160,0 +db 139,30,162,220,137,30,194,220,232,53,253,115,6,199,6,194 +db 220,0,0,137,30,162,220,139,54,192,220,139,30,162,220,232 +db 33,254,102,139,111,8,131,195,16,3,31,246,71,12,2,117 +db 44,103,139,116,36,2,15,182,79,80,141,127,82,49,192,172 +db 60,97,114,7,60,122,119,3,128,13,32,175,225,241,114,13 +db 119,6,103,128,62,0,116,64,3,95,8,235,206,246,71,12 +db 1,15,132,56,251,131,62,194,220,0,15,132,47,251,3,95 +db 8,102,139,71,248,102,247,38,180,220,139,54,194,220,102,137 +db 233,139,30,162,220,232,41,254,139,62,162,220,232,24,252,139 +db 30,162,220,131,195,24,235,145,103,139,116,36,2,137,54,164 +db 220,103,128,124,36,4,0,116,25,190,194,209,246,71,75,16 +db 15,132,207,250,102,139,7,139,30,198,220,137,30,162,220,194 +db 2,0,190,179,209,246,71,75,16,15,133,182,250,102,139,7 +db 139,30,198,220,137,30,162,220,187,0,64,83,232,176,253,95 +db 184,128,0,104,0,32,7,49,219,232,84,252,190,163,209,15 +db 132,144,250,137,30,162,220,194,2,0,14,31,14,7,187,0 +db 5,137,222,185,1,0,81,102,161,176,220,102,80,232,74,244 +db 104,0,16,7,49,255,185,8,0,243,167,190,8,210,15,133 +db 97,250,128,14,145,208,1,128,14,211,208,1,49,219,102,88 +db 89,232,38,244,128,38,144,208,254,128,38,211,208,253,102,199 +db 6,101,214,0,0,1,147,102,15,183,6,174,220,102,193,224 +db 9,102,5,0,0,16,147,102,163,109,214,190,83,214,30,7 +db 180,135,185,0,1,205,21,128,252,0,190,230,209,15,133,18 +db 250,203,1,1,0,10,220,0,0,255,255,255,255,107,101,114 +db 110,101,108,46,109,110,116,0 \ No newline at end of file diff --git a/programs/hd_load/9x2klbr/mtldr_code/compile.bat b/programs/hd_load/9x2klbr/mtldr_code/compile.bat new file mode 100644 index 0000000000..511b3602e2 --- /dev/null +++ b/programs/hd_load/9x2klbr/mtldr_code/compile.bat @@ -0,0 +1,4 @@ +fasm mtldr.asm ..\mtldr +cd .. +bintodb +cd mtldr_code diff --git a/programs/hd_load/9x2klbr/mtldr_code/fat32.inc b/programs/hd_load/9x2klbr/mtldr_code/fat32.inc new file mode 100644 index 0000000000..197c6260db --- /dev/null +++ b/programs/hd_load/9x2klbr/mtldr_code/fat32.inc @@ -0,0 +1,112 @@ +fat32_parse_dir: +; in: eax=directory cluster +; out: eax=entry cluster + mov bx, 900h + mov di, bx + push eax + call read_cluster + mov cx, word [cluster_size] + shr cx, 5 ; div 20h +.scan_cluster: + pop eax + cmp byte [di], 0 + jz file_not_found + mov si, [esp+2] + push eax + call fat_compare_name + jz .file_found + and di, not 1Fh + add di, 20h + loop .scan_cluster + pop eax + call next_cluster + jnc file_not_found + jc fat32_parse_dir +.file_found: + pop eax + mov si, [esp+2] + mov [cur_obj], si + and di, not 1Fh + mov si, directory_string + mov ax, [di+14h] + shl eax, 10h + mov ax, [di+1Ah] + test eax, eax + mov si, nodata_string + jz find_error_si + ret 2 + +fat_compare_name: + push cx + mov cx, 9 +.scan: + lodsb + cmp al, '.' + jz .ext + cmp al, 0 + jz .nameend + cmp al, 'a' + jb .notletter + cmp al, 'z' + ja .notletter + or byte [di], 20h +.notletter: + scasb + loopz .scan +.notfound: + inc cx ; to clear ZF flag + pop cx + ret +.ext: + mov al, ' ' + dec cx + repz scasb + jnz .notfound + test di, 1 + jnz .notfound + mov cx, 4 + jmp .scan +.nameend: + mov al, ' ' + dec cx + repz scasb + jnz .notfound + test di, 1 + jnz .file_found + mov cx, 3 + repz scasb + jnz .notfound +.file_found: + xor cx, cx ; to set ZF flag + pop cx + ret + +read_cluster: +; in: eax=cluster,bx->buffer + and eax, 0FFFFFFFh + movzx ecx, byte [50Dh] ; sects_per_clust + mul ecx + add eax, [data_start] +; call read +; ret + jmp relative_read +next_cluster: + mov bx, 700h +; sector is 200h bytes long, one entry in FAT occupies 4 bytes => 80h entries in sector + push eax + shr eax, 7 ; div 80h + cmp eax, [fat_cur_sector] + jz @f + mov [fat_cur_sector], eax + add eax, [fat_start] + mov cx, 1 + call relative_read +@@: + pop eax + and eax, 7Fh + mov eax, [700h+eax*4] + and eax, 0FFFFFFFh + cmp eax, 0FFFFFF7h + mov si, bad_cluster_string + jz find_error_si + ret diff --git a/programs/hd_load/9x2klbr/mtldr_code/mtldr.asm b/programs/hd_load/9x2klbr/mtldr_code/mtldr.asm new file mode 100644 index 0000000000..5d133b75e4 --- /dev/null +++ b/programs/hd_load/9x2klbr/mtldr_code/mtldr.asm @@ -0,0 +1,733 @@ +; KolibriOS bootloader +; this code has been written by diamond in 2005,2006 specially for KolibriOS + + format binary + use16 + + org 0xD000 + +; may be changed from ldklbr.vxd +partition_start dd -1 +boot_drive db 80h +imgnameofs dw menuet_img_name - 0xD000 + +macro out_delay port +{ + out port, al + jcxz $+2 +} + + cli +; reprogram IRQs + mov al, 11h + out_delay 20h + out_delay 0A0h + mov al, 8 + out_delay 21h + mov al, 70h + out_delay 0A1h + mov al, 4 + out_delay 21h + mov al, 2 + out_delay 0A1h + mov al, 1 + out_delay 21h + out_delay 0A1h + + mov al, 0 + out_delay 21h + out_delay 0A1h + +; set videomode + mov ax, 3 + int 10h +; reprogram timer + mov al, 00110100b + out_delay 43h + mov al, 0FFh + out_delay 40h + out_delay 40h + +; reset mouse + mov ax, 0C201h + int 15h + + jmp start + +out_string: + lodsb + test al, al + jz .xxx + mov ah, 0Eh + mov bx, 7 + int 10h + jmp out_string +.xxx: ret + +relative_read: + add eax, [partition_start] + +; read from hard disk +; drive_size must be already initialized +; in: eax = absolute sector +; cx = number of sectors +; es:bx -> buffer +read: + pushad + cmp eax, [drive_size] + jb .old_style +; new style - LBA, function 42 + cmp [has_lba], 0 + jz disk_error +; allocate disk address packet on the stack +; qword +8: absolute block number + push dword 0 ; dword +C is high dword + push eax ; dword +8 is low dword +; dword +4: buffer address + push es ; word +6 is segment + push bx ; word +4 is offset +; word +2: number of blocks = 1 +; word +0: size of packet = 10h + push dword 10010h +; now pair ss:sp contain address of disk address packet +.patch1: + mov ax, 4200h + mov dl, [boot_drive] + mov si, sp + push ds + push ss + pop ds + int 13h + pop ds + add sp, 10h +.end: + popad + jc disk_error + add bx, 200h + inc eax + dec cx + jnz read + ret +.old_style: +; old style - CHS, function 2 +; convert absolute sector in eax to cylinder-head-sector coordinates +; calculate sector + xor edx, edx + movzx ecx, [sectors] + div ecx +; sectors are counted from 1 + inc dl + mov cl, dl ; low 6 bits of cl = sector number +; calculate head number + shld edx, eax, 10h ; convert eax to dx:ax + div [heads] + mov dh, dl ; dh = head + mov ch, al ; ch = low 8 bits of cylinder + shl ah, 6 + or cl, ah ; high 2 bits of cl = high 2 bits of cylinder +.patch2: + mov ax, 201h ; function 2, al=1 - number of sectors + mov dl, [boot_drive] + int 13h + jmp .end + +disk_error: + mov si, disk_error_msg + call out_string + jmp $ + +has_lba db 0 + +disk_error_msg db 'Disk read error!',0 +start_msg db 2,' KolibriOS bootloader, running on ',0 +errfs_msg db 'unknown filesystem, cannot continue',0 +fat16_msg db 'FAT12/FAT16 - unsupported',13,10,0 +fat32_msg db 'FAT32',13,10,0 +ntfs_msg db 'NTFS',13,10,0 +error_msg db 'Error' +colon db ': ',0 +mft_string db 'MFT',0 +root_string db '\',0 +noindex_string db '$INDEX_ROOT not found',0 +invalid_read_request_string db 'cannot read attribute',0 +nodata_string db '$DATA ' +notfound_string db 'not found',0 +directory_string db 'is a directory',0 +notdir_string db 'not a directory',0 +fragmented_string db 'too fragmented file',0 +exmem_string db 'extended memory error',0 +bad_cluster_string db 'bad cluster',0 +data_error_msg db 'data error',0 + +start: + xor ax, ax + mov ds, ax + mov es, ax +; our stack is 4Kb-2b!!! (0xFFE) + mov ss, ax + mov esp, 0FFFEh + cld + sti +; calculate drive size + mov dl, [boot_drive] + mov ah, 8 ; 8 = get drive parameters + int 13h +; now: CF is set on error; +; ch = low 8 bits of maximum cylinder number +; cl : low 6 bits makes maximum sector number, high 2 bits are high 2 bits of maximum cylinder number +; dh = maximum head number + jnc @f + mov cx, -1 + mov dh, cl +@@: + movzx ax, dh + inc ax +; ax = number of heads + mov [heads], ax + mov dl, cl + and dx, 3Fh +; dx = number of sectors +; (note that sectors are counted from 1, and maximum sector number = number of sectors) + mov [sectors], dx + mul dx + xchg cl, ch + shr ch, 6 + inc cx +; cx = number of cylinders + mov [cyls], cx + mul cx + mov word [drive_size], ax + mov word [drive_size+2], dx +; this drive supports LBA? + mov dl, [boot_drive] + mov ah, 41h + mov bx, 55AAh + int 13h + jc .no_lba + cmp bx, 0AA55h + jnz .no_lba + test cl, 1 + jz .no_lba + inc [has_lba] +.no_lba: +; say hi to user + mov si, start_msg + call out_string + mov eax, [partition_start] + cmp eax, -1 + jnz @f +; now read first sector to determine file system type +; first sector of disk is MBR sector + xor eax, eax + mov cx, 1 + mov bx, 500h + call read + mov eax, [6C6h] ; first disk + mov [partition_start], eax +@@: + mov cx, 1 + mov bx, 500h + call read + movzx ax, byte [50Dh] + mov [sect_per_clust], ax +; determine file system + cmp dword [536h], 'FAT1' + jz fat1x + cmp dword [552h], 'FAT3' + jz fat32 + cmp dword [503h], 'NTFS' + jz ntfs +; mov si, errfs_msg ; already is + call out_string + jmp $ +fat1x: + mov si, fat16_msg + call out_string + jmp $ +fat32: + mov si, fat32_msg + call out_string + movzx eax, word [50Bh] ; bytes_per_sect + movzx ebx, byte [50Dh] ; sects_per_clust + mul ebx + mov [cluster_size], eax + movzx ebx, word [50Eh] ; reserved_sect + mov [fat_start], ebx + movzx eax, byte [510h] ; num_fats + mul dword [524h] ; sect_fat + add eax, ebx +; cluster 2 begins from sector eax + movzx ebx, byte [50Dh] ; sects_per_clust + sub eax, ebx + sub eax, ebx + mov [data_start], eax +; parse image name + add [imgnameofs], 0xD000 + mov eax, [52Ch] ; root_cluster + mov [cur_obj], root_string +.parsedir: + push ax + mov si, [imgnameofs] + push si +@@: + lodsb + cmp al, '\' + jz @f + cmp al, 0 + jnz @b +@@: + xchg ax, [esp+2] + mov byte [si-1], 0 + mov [imgnameofs], si + call fat32_parse_dir + pop cx + test cl, cl + jz .end + test byte [di+0Bh], 10h + mov si, notdir_string + jz find_error_si + jmp .parsedir +.end: + test byte [di+0Bh], 10h + mov si, directory_string + jnz find_error_si +; parse FAT chunk +; runlist at 2000:0000 + mov di, 5 + push 2000h + pop es + mov byte [es:di-5], 1 ; of course, non-resident + mov dword [es:di-4], 1 + stosd +.parsefat: + push es + push ds + pop es + call next_cluster + pop es + jnc .done + mov ecx, [es:di-8] + add ecx, [es:di-4] + cmp eax, ecx + jz .contc + mov dword [es:di], 1 + scasd + stosd + jmp .parsefat +.contc: + inc dword [es:di-8] + jmp .parsefat +.done: + xor eax, eax + stosd + jmp read_img_file + +ntfs: + mov si, ntfs_msg + call out_string + movzx eax, word [50Bh] ; bpb_bytes_per_sect + push eax + movzx ebx, byte [50Dh] ; bpb_sects_per_clust + mul ebx + mov [cluster_size], eax + mov [data_start], 0 + mov ecx, [540h] ; frs_size + cmp cl, 0 + jg .1 + neg cl + xor eax, eax + inc eax + shl eax, cl + jmp .2 +.1: + mul ecx +.2: + mov [frs_size], eax + pop ebx + xor edx, edx + div ebx + mov [frs_sectors], ax +; read first MFT record - description of MFT itself + mov [cur_obj], mft_string + movzx eax, byte [50Dh] ; bpb_sects_per_clust + mul dword [530h] ; mft_cluster + mov cx, [frs_sectors] + mov bx, 4000h + mov di, bx + push bx + call relative_read + call restore_usa +; scan for unnamed $DATA attribute + pop di + mov ax, 80h ; $DATA + mov bx, 700h + call load_attr + mov si, nodata_string + jc find_error_si + mov [free], bx +; load menuet.img +; parse image name + add [imgnameofs], 0xD000 + mov eax, 5 ; root cluster + mov [cur_obj], root_string +.parsedir: + push ax + mov si, [imgnameofs] + push si +@@: + lodsb + cmp al, '\' + jz @f + cmp al, 0 + jnz @b +@@: + xchg ax, [esp+2] + mov byte [si-1], 0 + mov [imgnameofs], si + call ntfs_parse_dir + pop cx + test cl, cl + jnz .parsedir +read_img_file: + xor si, si + push es + pop fs +; yes! Now read file to 0x100000 + lods byte [fs:si] + cmp al, 0 ; assume nonresident attr + mov si, invalid_read_request_string + jz find_error_si + mov si, 1 + xor edi, edi +; read buffer to 1000:0000 and move it to extended memory + push 1000h + pop es + xor bx, bx +.img_read_block: + lods dword [fs:si] ; eax=length + xchg eax, ecx + jecxz .img_read_done + lods dword [fs:si] ; eax=disk cluster +.img_read_cluster: + pushad +; read part of file + movzx ecx, byte [50Dh] + mul ecx + add eax, [data_start] + call relative_read +; move it to extended memory + mov ah, 87h + mov ecx, [cluster_size] + push ecx + shr cx, 1 + mov si, movedesc + push es + push ds + pop es + int 15h + pop es + test ah, ah + mov si, exmem_string + jnz find_error_si + pop ecx + add [dest_addr], ecx + popad + inc eax + loop .img_read_cluster + jmp .img_read_block +.img_read_done: +; menuet.img loaded; now load kernel.mnt +load_kernel: + push ds + pop es + mov [cur_obj], kernel_mnt_name +; read boot sector + xor eax, eax + mov bx, 500h + mov cx, 1 + call read_img +; init vars + mov ax, [50Eh] ; reserved_sect + add ax, [51Ch] ; hidden + mov word [fat_start], ax + xchg ax, bx + movzx ax, byte [510h] ; num_fats + mul word [516h] ; fat_length + add ax, bx +; read root dir + mov bx, 700h + mov cx, [511h] ; dir_entries + add cx, 0Fh + shr cx, 4 + call read_img + add ax, cx + mov [img_data_start], ax + shl cx, 9 + mov di, bx + add bx, cx + mov byte [bx], 0 +.scan_loop: + cmp byte [di], 0 + mov si, notfound_string + jz find_error_si + mov si, kernel_mnt_name + call fat_compare_name + jz .found + and di, not 1Fh + add di, 20h + jmp .scan_loop +.found: + and di, not 1Fh + mov si, directory_string + test byte [di+0Bh], 10h + jnz find_error_si +; found, now load it to 1000h:0000h + mov ax, [di+1Ah] +; first cluster of kernel.mnt in ax +; translate it to sector on disk in menuet.img + push ax + dec ax + dec ax + movzx cx, byte [50Dh] + mul cx + add ax, [img_data_start] +; now ax is sector in menuet.img + mov [kernel_mnt_in_img], ax + div [sect_per_clust] +; now ax is cluster in menuet.img and +; dx is offset from the beginning of cluster + movzx eax, ax + push 2000h + pop ds + mov si, 1 +.scani: + sub eax, [si] + jb .scanidone +; sanity check + cmp dword [si], 0 + push invalid_read_request_string + jz find_error_sp + pop cx +; next chunk + add si, 8 + jmp .scani +.scanidone: + add eax, [si] ; undo last subtract + add eax, [si+4] ; get cluster + push 0 + pop ds + movzx ecx, [sect_per_clust] + push dx + mul ecx ; get sector + pop dx + movzx edx, dx + add eax, edx + add eax, [data_start] + mov [kernel_mnt_1st], eax + pop ax + push 1000h + pop es +.read_loop: + push ax + xor bx, bx + call img_read_cluster + shl cx, 9-4 + mov ax, es + add ax, cx + mov es, ax + pop ax + call img_next_cluster + jc .read_loop + mov ax, 'KL' + mov si, loader_block + jmp 1000h:0000h + +img_next_cluster: + mov bx, 700h + push ax + shr ax, 1 + add ax, [esp] + mov dx, ax + shr ax, 9 + add ax, word [fat_start] + mov cx, 2 + push es + push ds + pop es + call read_img + pop es + and dx, 1FFh + add bx, dx + mov ax, [bx] + pop cx + test cx, 1 + jz .1 + shr ax, 4 +.1: + and ax, 0FFFh + mov si, bad_cluster_string + cmp ax, 0FF7h + jz find_error_si + ret +img_read_cluster: + dec ax + dec ax + movzx cx, byte [50Dh] ; sects_per_clust + mul cx + add ax, [img_data_start] + movzx eax, ax +; call read_img +; ret +read_img: +; in: ax = sector, es:bx->buffer, cx=length in sectors + pushad + movzx ebx, bx + mov si, movedesc + shl eax, 9 + add eax, 93100000h + mov dword [si+sou_addr-movedesc], eax + mov eax, 9300000h + mov ax, es + shl eax, 4 + add eax, ebx + mov [si+dest_addr-movedesc], eax + mov ah, 87h + shl cx, 8 ; mul 200h/2 + push es + push 0 + pop es + int 15h + pop es + cmp ah, 0 + mov si, exmem_string + jnz find_error_si + popad + ret + +movedesc: + times 16 db 0 +; source + dw 0xFFFF ; segment length +sou_addr dw 0000h ; linear address + db 1 ; linear address + db 93h ; access rights + dw 0 +; destination + dw 0xFFFF ; segment length +dest_addr dd 93100000h ; high byte contains access rights + ; three low bytes contains linear address (updated when reading) + dw 0 + times 32 db 0 + +find_error_si: + push si +find_error_sp: + mov si, error_msg + call out_string + mov si, [cur_obj] + call out_string + mov si, colon + call out_string + pop si + call out_string + jmp $ + +file_not_found: + mov si, [esp+2] + mov [cur_obj], si + push notfound_string + jmp find_error_sp + + include 'fat32.inc' + include 'ntfs.inc' + +write1st: +; callback from kernel.mnt +; write first sector of kernel.mnt from 1000:0000 back to disk + push cs + pop ds + push cs + pop es +; sanity check + mov bx, 500h + mov si, bx + mov cx, 1 + push cx + mov eax, [kernel_mnt_1st] + push eax + call relative_read + push 1000h + pop es + xor di, di + mov cx, 8 + repz cmpsw + mov si, data_error_msg + jnz find_error_si +; ok, now write back to disk + or byte [read.patch1+2], 1 + or byte [read.patch2+2], 1 + xor bx, bx + pop eax + pop cx + call relative_read + and byte [read.patch1+1], not 1 + and byte [read.patch2+2], not 2 +; and to image in memory (probably this may be done by kernel.mnt itself?) + mov dword [sou_addr], 93010000h + movzx eax, [kernel_mnt_in_img] + shl eax, 9 + add eax, 93100000h + mov dword [dest_addr], eax + mov si, movedesc + push ds + pop es + mov ah, 87h + mov cx, 100h + int 15h + cmp ah, 0 + mov si, exmem_string + jnz find_error_si + retf + +loader_block: + db 1 ; version + dw 1 ; flags - image is loaded + dw write1st ; offset + dw 0 ; segment + +fat_cur_sector dd -1 + +; ----------------------------------------------- +; ------------------ Settings ------------------- +; ----------------------------------------------- + +; must be in lowercase, see ntfs_parse_dir.scan, fat32_parse_dir.scan +kernel_mnt_name db 'kernel.mnt',0 + +; uninitialized data follows +drive_size dd ? ; in sectors +heads dw ? +sectors dw ? +cyls dw ? +free dw ? +cur_obj dw ? +data_start dd ? +img_data_start dw ? +sect_per_clust dw ? +kernel_mnt_in_img dw ? +kernel_mnt_1st dd ? +; NTFS data +cluster_size dd ? ; in bytes +frs_size dd ? ; in bytes +frs_sectors dw ? ; in sectors +mft_data_attr dw ? +index_root dw ? +index_alloc dw ? +ofs dw ? +dir dw ? +; FAT32 data +fat_start dd ? +cur_cluster dd ? + +; will be initialized by ldklbr.vxd +menuet_img_name rb 300 diff --git a/programs/hd_load/9x2klbr/mtldr_code/ntfs.inc b/programs/hd_load/9x2klbr/mtldr_code/ntfs.inc new file mode 100644 index 0000000000..3aae8be8c4 --- /dev/null +++ b/programs/hd_load/9x2klbr/mtldr_code/ntfs.inc @@ -0,0 +1,519 @@ +restore_usa: +; Update Sequence Array restore + mov bx, [di+4] + mov cx, [di+6] + inc bx + add bx, di + inc bx + add di, 1feh + dec cx +@@: + mov ax, [bx] + stosw + inc bx + inc bx + add di, 1feh + loop @b + ret + +find_attr: +; in: di->file record, ax=attribute +; out: di->attribute or di=0 if not found + add di, [di+14h] +.1: +; attributes codes are formally dwords, but all they fit in word + cmp word [di], -1 + jz .notfound + cmp word [di], ax + jnz .continue +; for $DATA attribute, scan only unnamed + cmp ax, 80h + jnz .found + cmp byte [di+9], 0 + jz .found +.continue: + add di, [di+4] + jmp .1 +.notfound: + xor di, di +.found: + ret + +process_mcb_nonres: +; in: si->attribute, es:di->buffer +; out: di->buffer end + add si, [si+20h] + xor ebx, ebx +.loop: + lodsb + test al, al + jz .done + push invalid_read_request_string + movzx cx, al + shr cx, 4 + jz find_error_sp + xchg ax, dx + and dx, 0Fh + jz find_error_sp + add si, cx + add si, dx + pop ax + push si + dec si + movsx eax, byte [si] + dec cx + jz .l1e +.l1: + dec si + shl eax, 8 + mov al, [si] + loop .l1 +.l1e: + xchg ebp, eax + dec si + movsx eax, byte [si] + mov cx, dx + dec cx + jz .l2e +.l2: + dec si + shl eax, 8 + mov al, byte [si] + loop .l2 +.l2e: + pop si + add ebx, ebp +; eax=length, ebx=disk block + stosd + mov eax, ebx + stosd + jmp .loop +.done: + xor eax, eax + stosd + ret + +load_attr: +; in: ax=attribute, es:bx->buffer, di->base record +; out: bx->buffer end; CF set if not found + push di + push ax + mov byte [es:bx], 1 + inc bx + push bx + mov [ofs], bx +; scan for attrubute + add di, [di+14h] +@@: + call find_attr.1 + test di, di + jz .notfound1 + cmp byte [di+8], 0 + jnz .nonresident +; resident attribute + mov si, di + pop di + dec di + mov al, 0 + stosb + mov ax, [si+10h] + stosw + xchg ax, cx + add si, [si+14h] + rep movsb + mov bx, di + pop ax + pop di + ret +.nonresident: +; nonresident attribute + cmp dword [di+10h], 0 + jnz @b +; read start of data + mov si, di + pop di + call process_mcb_nonres + push di +.notfound1: +; $ATTRIBUTE_LIST is always in base file record + cmp word [esp+2], 20h + jz .nofragmented +; scan for $ATTRIBUTE_LIST = 20h + mov di, [esp+4] + mov ax, 20h + call find_attr + test di, di + jz .nofragmented +; load $ATTRIBUTE_LIST itself + push es + mov bx, 0C000h + mov di, [esp+6] + push bx + push [ofs] + push ds + pop es + call load_attr + pop [ofs] + pop si + mov bx, 8000h + push bx + push si + call read_attr_full + pop si + pop bx + add dx, bx + mov ax, [esp+4] + pop es +.1: + cmp [bx], ax + jnz .continue1 +; only unnamed $DATA attributes! + cmp ax, 80h + jnz @f + cmp byte [bx+6], 0 + jnz .continue1 +@@: + cmp dword [bx+10h], 0 + jz .continue1 + cmp dword [bx+8], 0 + jnz @f + push ax + mov ax, [esp+2] + cmp ax, [ofs] + pop ax + jnz .continue1 +@@: + pushad + mov eax, [bx+10h] + mov bx, dx + push [ofs] + push es + push ds + pop es + call read_file_record + pop es + pop [ofs] + popad + pushad + mov di, dx + add di, [di+14h] +.2: + call find_attr.1 + mov eax, [bx+8] + cmp eax, [di+10h] + jnz .2 + mov si, di + mov di, [esp+20h] + sub di, 4 + call process_mcb_nonres + mov [esp+20h], di + popad +.continue1: + add bx, [bx+4] + cmp bx, dx + jb .1 +.nofragmented: + pop bx + pop ax + pop di + cmp bx, [ofs] + jnz @f + dec bx + stc +@@: + ret + +read_attr_full: +; in: si->decoded attribute data, bx->buffer +; out: edx=length in bytes + lodsb + cmp al, 0 + jnz .nonresident +; resident + lodsw + movzx edx, ax + xchg ax, cx + mov di, bx + rep movsb + ret +.nonresident: +; nonresident :-) + xor edx, edx +.loop: + lodsd + xchg ecx, eax + jecxz .loopend + lodsd + xchg edi, eax +; read ecx clusters from cluster edi to es:bx +.intloop: + push ecx +; read 1 cluster from physical cluster edi to es:bx + mov ecx, [cluster_size] + mov eax, edi + mul ecx + push bx + call relative_read + pop bx + pop ecx + inc edi + mov eax, [cluster_size] + add edx, eax + shr eax, 4 + mov bp, es + add bp, ax + mov es, bp + loop .intloop + jmp .loop +.loopend: + mov es, cx + ret + +read_file_record: +; in: eax=index of record, bx=buffer + mov si, 700h + mov ecx, [frs_size] + mul ecx + push bx + push [cur_obj] + mov [cur_obj], mft_string + call read_attr + pop [cur_obj] + pop di + call restore_usa + ret +read_attr: +; in: edx:eax=offset in bytes, ecx=size in bytes, bx=buffer, si=attribute + push invalid_read_request_string + cmp byte [si], 0 + jnz .nonresident + test edx, edx + jnz find_error_sp + cmp eax, 10000h + jae find_error_sp + cmp ecx, 10000h + jae find_error_sp + cmp ax, [si+2] + jae find_error_sp + cmp cx, [si+2] + ja find_error_sp + add si, 3 + add si, ax + mov di, bx + rep movsb + pop ax + ret +.nonresident: + mov edi, [cluster_size] + div edi + mov [ofs], dx + add cx, dx + push eax + xchg eax, ecx + xor edx, edx + dec eax + div edi + inc eax + xchg eax, ecx + pop eax + add si, 1 + xor edx, edx + push bx +; eax=offset in clusters, ecx=size in clusters +.scan: + mov ebx, [si] + test ebx, ebx + jz .notfound + add edx, ebx + add si, 8 + cmp eax, edx + jae .scan + mov edi, [si-4] +; now edx=end of block, ebx=length of block, edi=start of block on disk +; eax=required offset, ecx=required length + push edx + push edi + sub edx, eax + add edi, ebx + sub edi, edx + cmp edx, ecx + jb @f + mov edx, ecx +@@: +; read (edx) clusters from (edi=disk offset in clusters) to ([esp+8]) + cmp [ofs], 0 + jnz .ofs_read +.cont: + pushad + movzx ebx, byte [50Dh] +; xchg eax, edx +; mul ebx + xchg ax, dx + mul bx + xchg cx, ax + xchg eax, edi + mul ebx + mov bx, [esp+8+20h] + call relative_read + mov [esp+8+20h], bx + popad +.cont2: + add eax, edx + sub ecx, edx +.cont3: + pop edi + pop edx + jnz .scan + pop bx + pop ax + ret +.ofs_read: + push ecx + movzx ecx, byte [50Dh] ; bpb_sects_per_clust + mov eax, edi + push edx + mul ecx + push 1000h + pop es + xor bx, bx + call relative_read + mov cx, bx + push si + push di + mov si, [ofs] + mov di, [esp+8+12] + sub cx, si + push ds + push es + pop ds + pop es + rep movsb + mov [esp+8+12], di + push es + pop ds + pop di + pop si + pop edx + pop ecx + inc edi + mov [ofs], 0 + inc eax + dec ecx + jz .cont3 + dec edx + jnz .cont + jmp .cont2 +.notfound: + mov si, invalid_read_request_string + jmp find_error_si + +ntfs_parse_dir: +; in: eax=directory iRecord, [word sp+2]=filename +; out: si=$DATA attribute of file + mov bx, [free] + mov [dir], bx + push bx + call read_file_record + mov ax, word [frs_size] + add [free], ax + pop di +; find attributes $INDEX_ROOT, $INDEX_ALLOCATION, $BITMAP + mov ax, 90h ; $INDEX_ROOT + push di + mov bx, [free] + mov [index_root], bx + call load_attr + mov si, noindex_string + jc find_error_si + mov [free], bx + pop di + mov ax, 0A0h ; $INDEX_ALLOCATION + mov bx, [free] + mov [index_alloc], bx + call load_attr + jnc @f + mov [index_alloc], 0 +@@: + mov [free], bx +; search for entry + mov si, [index_root] + mov bx, [free] + call read_attr_full + mov ebp, [bx+8] ; subnode_size + add bx, 10h +.scan_record: + add bx, [bx] +.scan: + test byte [bx+0Ch], 2 + jnz .not_found + mov si, [esp+2] + movzx cx, byte [bx+50h] ; namelen + lea di, [bx+52h] ; name + xor ax, ax +@@: + lodsb + cmp al, 'a' + jb .notletter + cmp al, 'z' + ja .notletter + or byte [di], 20h +.notletter: + scasw + loopz @b + jb .not_found + ja @f + cmp byte [esi], 0 + jz .file_found +@@: + add bx, [bx+8] + jmp .scan +.not_found: + test byte [bx+0Ch], 1 + jz file_not_found + cmp [index_alloc], 0 + jz file_not_found + add bx, [bx+8] + mov eax, [bx-8] + mul [cluster_size] + mov si, [index_alloc] + mov ecx, ebp + mov bx, [free] + call read_attr + mov di, [free] + call restore_usa + mov bx, [free] + add bx, 18h + jmp .scan_record +.file_found: + mov si, [esp+2] + mov [cur_obj], si + cmp byte [esp+4], 0 + jz .need_file + mov si, notdir_string + test byte [bx+48h+3], 10h + jz find_error_si + mov eax, [bx] + mov bx, [dir] + mov [free], bx + ret 2 +.need_file: + mov si, directory_string + test byte [bx+48h+3], 10h ; directory? + jnz find_error_si +; read entry + mov eax, [bx] + mov bx, [dir] + mov [free], bx + mov bx, 4000h + push bx + call read_file_record + pop di + mov ax, 80h + push 2000h + pop es + xor bx, bx + call load_attr + mov si, nodata_string + jz find_error_si + mov [free], bx + ret 2 diff --git a/programs/hd_load/9x2klbr/readme_dos.txt b/programs/hd_load/9x2klbr/readme_dos.txt new file mode 100644 index 0000000000..56110073ae --- /dev/null +++ b/programs/hd_load/9x2klbr/readme_dos.txt @@ -0,0 +1,33 @@ +Ќ §­ зҐ­ЁҐ: ЇаЁ § ЇгбЄҐ (Ї®¤ Win95/98/ME) (Є®а४⭮) ўлЈаг¦ Ґв Windows Ё +ў¬Ґбв® ­Ґс § Јаг¦ Ґв KolibriOS. + +“бв ­®ўЄ  ­Ґ вॡгҐвбп. + +‡ ЇгбЄ: + 9x2klbr [[¤ЁбЄ:]\[Їгвм\][Ё¬п_®Ўа § ]] +” ©« ®Ўа §  ¤®«¦Ґ­ а бЇ®« Ј вмбп ­  ¦сбвЄ®¬ ¤ЁбЄҐ. +‡­ зҐ­Ёп Ї® 㬮«з ­Ёо: ¤ЁбЄ C:, Є в «®Ј Є®а­Ґў®©, ®Ўа § kolibri.img +‚ ЇгвЁ Ё ў Ё¬Ґ­Ё ®Ўа §  ¤®«¦­л Ўлвм в®«мЄ® бЁ¬ў®«л Ё§ ЇҐаў®© Ї®«®ўЁ­л +ASCII-в Ў«Ёжл. ‚ з бв­®бвЁ, ­Ґ ¤®«¦­® Ўлвм агббЄЁе ЎгЄў. + +FAT: ЏаЁ­Ё¬ овбп в®«мЄ® Є®а®вЄЁҐ Ё¬Ґ­  Ї Ї®Є Ё д ©« , в.Ґ. progra~1 ў¬Ґбв® +Program Files; ¤«п Ё¬с­ вЁЇ  kolibri Ё menuet.075 (­Ґ Ў®«ҐҐ 8 ЎгЄў ў Ё¬Ґ­Ё, +­Ґ Ў®«ҐҐ 3 ЎгЄў ў а биЁаҐ­ЁЁ, ­Ґв бЇҐжЁ «м­ле бЁ¬ў®«®ў) нв® ўлЇ®«­Ґ­® + ўв®¬ вЁзҐбЄЁ, ў ®ЎйҐ¬ б«гз Ґ Є®а®вЄ®Ґ Ё¬п ¬®¦­® г§­ вм, ­ ЇаЁ¬Ґа, +ў Explorer'®ўбЄ®¬ ¤Ё «®ЈҐ "Properties" (Ї®¤ § Ј®«®ўЄ®¬ "MS-DOS name"). + +‚Їа®зҐ¬, Ґб«Ё нвЁ вॡ®ў ­Ёп ­Ґ Ўг¤гв ўлЇ®«­Ґ­л, § Јаг§зЁЄ ­Ґ бв ­Ґв +д®а¬ вЁа®ў вм ¤ЁбЄ :-),   Їа®бв® б®®ЎйЁв, зв®, ¬®«, 'not found'. + +ЏаЁ¬Ґал: + 9x2klbr d:\download\kolibri\kolibri1.img + 9x2klbr c:\progra~1\kolibri\ + 9x2klbr \progra~1\kolibri\ + (Ўг¤Ґв Јаг§Ёвм Ё§ kolibri.img) + 9x2klbr e:\ + (нЄўЁў «Ґ­в­® 9x2klbr e:\kolibri.img) + 9x2klbr + (ЎҐ§ Ї а ¬Ґва®ў; нЄўЁў «Ґ­в­® 9x2klbr c:\kolibri.img) + + diamond + mailto: diamondz@land.ru diff --git a/programs/hd_load/9x2klbr/readme_win.txt b/programs/hd_load/9x2klbr/readme_win.txt new file mode 100644 index 0000000000..7e31e6c109 --- /dev/null +++ b/programs/hd_load/9x2klbr/readme_win.txt @@ -0,0 +1,33 @@ +Назначение: при запуске (под Win95/98/ME) (корректно) выгружает Windows и +вместо неё загружает KolibriOS. + +Установка не требуется. + +Запуск: + 9x2klbr [[диск:]\[путь\][имя_образа]] +Файл образа должен располагаться на жёстком диске. +Значения по умолчанию: диск C:, каталог корневой, образ kolibri.img +В пути и в имени образа должны быть только символы из первой половины +ASCII-таблицы. В частности, не должно быть русских букв. + +FAT: Принимаются только короткие имена папок и файла, т.е. progra~1 вместо +Program Files; для имён типа kolibri и menuet.075 (не более 8 букв в имени, +не более 3 букв в расширении, нет специальных символов) это выполнено +автоматически, в общем случае короткое имя можно узнать, например, +в Explorer'овском диалоге "Properties" (под заголовком "MS-DOS name"). + +Впрочем, если эти требования не будут выполнены, загрузчик не станет +форматировать диск :-), а просто сообщит, что, мол, 'not found'. + +Примеры: + 9x2klbr d:\download\kolibri\kolibri1.img + 9x2klbr c:\progra~1\kolibri\ + 9x2klbr \progra~1\kolibri\ + (будет грузить из kolibri.img) + 9x2klbr e:\ + (эквивалентно 9x2klbr e:\kolibri.img) + 9x2klbr + (без параметров; эквивалентно 9x2klbr c:\kolibri.img) + + diamond + mailto: diamondz@land.ru diff --git a/programs/hd_load/9x2klbr/vxd.asm b/programs/hd_load/9x2klbr/vxd.asm new file mode 100644 index 0000000000..71f293621e --- /dev/null +++ b/programs/hd_load/9x2klbr/vxd.asm @@ -0,0 +1,234 @@ + .386p +WIN40COMPAT = 1 + include vmm.inc + include v86mmgr.inc + DECLARE_VIRTUAL_DEVICE LDKLBR,1,0,LDKLBR_Control,UNDEFINED_DEVICE_ID,1 + +;Begin_control_dispatch LDKLBR +;Control_Dispatch w32_DeviceIoControl, OnDeviceIoControl +;Control_Dispatch Sys_Dynamic_Device_Exit, OnExit +;End_control_dispatch LDKLBR + +VxD_LOCKED_DATA_SEG +VkdControlProc dd 0 +vkdddb dd 0 +diskinfobuf: + db 10h,0,0,0FFh + db 0Ch dup (0) + +oldidt label fword + dw 03FFh + dd 0 + + include mtldr.inc + +imgname dd 0 + +VxD_LOCKED_DATA_ENDS + +VxD_LOCKED_CODE_SEG + +BeginProc NewControlProc + cmp eax, Reboot_Processor + jz short MyReboot + jmp [VkdControlProc] +EndProc NewControlProc + +BeginProc MyReboot + VMMCall _MapPhysToLinear,<0D000h,2000h,0> + push eax + VMMCall _MapPhysToLinear,<0,1000h,0> + xchg eax, ebx + cli + lea esi, [ebx+53Ch] + lodsd + mov [ebx+413h], ax + shr eax, 10h + mov [ebx+40Eh], ax +; restore BIOS IDT - vectors 00..1F + mov edi, ebx + mov ecx, 20h + rep movsd +; int 19 + mov eax, [ebx+810h] + mov [ebx+64h], eax +; vectors 40,41,42,43,46,4B,4F + lea edi, [ebx+40h*4] + movsd + movsd + movsd + movsd + scasd + scasd + movsd + add edi, 10h + movsd + add edi, 0Ch + movsd +; vectors 70..77 +; lea esi, [ebx+5DCh] + lea edi, [ebx+70h*4] + mov ecx, 8 + rep movsd + +; reboot to mtldr + mov dword ptr [ebx+467h], 0D000007h ; 0D00:0007 + mov al, 0Fh + out 70h, al + jecxz $+2 + jecxz $+2 + mov al, 5 + out 71h, al +; copy mtldr code + mov esi, offset mtldr +; mov edi, 0D000h + pop edi + push edi + mov ecx, mtldr_size + rep movsb +; copy mtldr parameters + mov esi, [imgname] + mov edi, esi + mov al, 0 + xor ecx, ecx + dec ecx + repnz scasb + pop edi + not ecx + movzx eax, word ptr [edi+5] + add edi, eax + rep movsb +; load old IDT + lidt [oldidt] +; reboot + mov al, 0FEh + out 64h, al + hlt +EndProc MyReboot + +BeginProc LDKLBR_Control + cmp eax, w32_DeviceIoControl + jz short OnDeviceIoControl + cmp eax, Sys_Dynamic_Device_Exit + jz short OnExit + cmp eax, Reboot_Processor + jz MyReboot + clc + ret + +OnExit: +; allow unload if and only if we are not hooking + cmp [VkdControlProc], 1 + cmc + ret + +OnDeviceIoControl: + cmp dword ptr [esi+12], DIOC_Open + jz @@open + cmp dword ptr [esi+12], 0Fh + jnz _exit +; request to set path of image + mov ecx, [esi+20] ; cbInBuffer + cmp ecx, 300 + ja short @@paramerr + test ecx, ecx + jnz short @@param1ok +@@paramerr: + xor eax, eax + inc eax +@@errret: + mov ecx, [vkdddb] + mov edx, [VkdControlProc] + mov [ecx + VxD_Desc_Block.DDB_Control_Proc], edx + mov [VkdControlProc], 0 + ret +@@param1ok: + mov eax, [esi+16] ; lpvInBuffer +; set drive + mov dl, [eax] + or dl, 20h + sub dl, 60h + jz short @@paramerr + cmp dl, 'z'-60h + ja short @@paramerr + push esi + Push_Client_State Uses_edi + mov ecx, 10h + stc + push ds + pop fs + mov esi, offset diskinfobuf + VMMCall Get_Cur_VM_Handle + VxDCall V86MMGR_Allocate_Buffer + VMMCall Begin_Nest_V86_Exec + assume ebp:ptr Client_Reg_Struc + mov [ebp.Client_AX], 440Dh + mov [ebp.Client_BL], dl + mov [ebp.Client_CX], 086Fh + mov [ebp.Client_DX], di + mov eax, edi + shr eax, 10h + mov [ebp.Client_DS], ax + mov eax, 21h + VMMCall Exec_Int + VMMCall End_Nest_Exec + mov ecx, 10h + stc + push ds + pop fs + VxDCall V86MMGR_Free_Buffer + Pop_Client_State Uses_esi + pop esi + mov al, byte ptr [diskinfobuf+3] + cmp al, 0FFh + jz @@errret + cmp al, 80h + jb @@paramerr + mov byte ptr [mtldr+4], al + mov eax, dword ptr [diskinfobuf+8] + mov dword ptr [mtldr], eax +; set path + mov ecx, [imgname] + jecxz @f + VMMCall _HeapFree, +@@: + mov ecx, [esi+20] + dec ecx + push ecx + VMMCall _HeapAllocate, + pop ecx + mov [imgname], eax + xchg edi, eax + mov esi, [esi+16] + inc esi +@@1: + lodsb + cmp al, 'A' + jb short @f + cmp al, 'Z' + ja short @f + or al, 20h +@@: + stosb + loop @@1 + xor eax, eax + ret +@@open: +; don't hook if already hooked + cmp [VkdControlProc], 0 + jnz short @f + mov eax, 0Dh + VMMCall Get_DDB + mov [vkdddb], ecx + mov eax, [ecx + VxD_Desc_Block.DDB_Control_Proc] + mov [VkdControlProc], eax + mov [ecx + VxD_Desc_Block.DDB_Control_Proc], NewControlProc +@@: + xor eax, eax +_exit: + ret +EndProc LDKLBR_Control + +VxD_LOCKED_CODE_ENDS + + end diff --git a/programs/hd_load/meosload/AUTOEXEC.BAT b/programs/hd_load/meosload/AUTOEXEC.BAT new file mode 100644 index 0000000000..1890ba536d --- /dev/null +++ b/programs/hd_load/meosload/AUTOEXEC.BAT @@ -0,0 +1,28 @@ +goto %config% +:dos1 +rem c:\vc401\vc +lh keyrus +lh mmouse +lh C:\WINDOWS\COMMAND\mscdex /d:12345678 +lh \dn\dn +bootgui=0 +:dos2 +rem essolo.com +lh keyrus +lh mmouse +lh \dn\dn +bootgui=0 +:win +rem c:\essolo.com +set path=C:\WINDOWS;C:\WINDOWS\COMMAND;c:\;c:\windows\;c:\windows\comand\;c:\arc\;c:\dn\ +C:\WINDOWS\COMMAND\DELTREE /y C:\WINDOWS\TEMP\*.* +mode con codepage prepare=((866) C:\WINDOWS\COMMAND\ega3.cpi) +mode con codepage select=866 +keyb ru,,C:\WINDOWS\COMMAND\keybrd3.sys +goto continue +:meos +c:\kolibri\meosload.com +:l:\meosload.com +:continue +rem bootgui=1 + diff --git a/programs/hd_load/meosload/CONFIG.SYS b/programs/hd_load/meosload/CONFIG.SYS new file mode 100644 index 0000000000..c531c047d3 --- /dev/null +++ b/programs/hd_load/meosload/CONFIG.SYS @@ -0,0 +1,27 @@ +[menu] +menucolor=7 +menuitem=win,Windows 98SE +menuitem=dos1,Dos Navigator+CD +menuitem=dos2,Dos Navigator +menuitem=kos,KolibriOS +menudefault=win,15 +[dos1] +rem DEVICE=essolo.sys +DEVICE=C:\WINDOWS\himem.sys +device=C:\WINDOWS\COMMAND\display.sys con=(ega,,1) +DEVICE=C:\WINDOWS\emm386.exe noems +device=osi105p.sys +dos=high,umb +[dos2] +rem DEVICE=essolo.sys +DEVICE=C:\WINDOWS\himem.sys +device=C:\WINDOWS\COMMAND\display.sys con=(ega,,1) +DEVICE=C:\WINDOWS\emm386.exe noems +dos=high,umb +[win] +rem DEVICE=c:\essolo.sys +DEVICE=C:\WINDOWS\himem.sys +device=C:\WINDOWS\COMMAND\display.sys con=(ega,,1) +Country=007,866,C:\WINDOWS\COMMAND\country.sys +[kos] +[common] diff --git a/programs/hd_load/meosload/History.txt b/programs/hd_load/meosload/History.txt new file mode 100644 index 0000000000..fa8b3570f0 --- /dev/null +++ b/programs/hd_load/meosload/History.txt @@ -0,0 +1,9 @@ +14.02.2003 +Version 1.0 - Base version + +11.06.2003 +Version 1.1 - Added support of loading from IMAGE-file. + (see of Ivan Poddubny kernel modification) + +28.10.2006 +menuet.img renamed to kolibri.img diff --git a/programs/hd_load/meosload/L_readme.txt b/programs/hd_load/meosload/L_readme.txt new file mode 100644 index 0000000000..4c8c5248c9 --- /dev/null +++ b/programs/hd_load/meosload/L_readme.txt @@ -0,0 +1,18 @@ +Љ Є нвЁ¬ Ї®«м§®ў вмбп? +‚ᥠ­Ё¦ҐЇҐаҐзЁб«Ґ­­®Ґ  Євг «м­® в®«мЄ® ¤«п вҐе, г Є®Ј® Ё¬Ґовбп б«Ґ¤гойЁҐ Ћ‘: +MS-DOS, Windows95, Windows98 Ё«Ё Ёе ¬®¤ЁдЁЄ жЁЁ. „«п вҐе, г Є®Ј® Windows2000 +Ё«Ё WindowsXP ­Ґ®Ўе®¤Ё¬® Ї®«м§®ў вмбп § Јаг§зЁЄ®¬ mtldr ( ўв®а Diamond), +в Є¦Ґ ўе®¤пйЁ¬ ў ¤ЁбваЁЎгвЁў. + +‘®§¤ с¬ Ї ЇЄг ­  ¤ЁбЄҐ: +C:\KOLIBRI Ё«Ё D:\KOLIBRI Ё«Ё E:\KOLIBRI Ё«Ё «оЎ®© ¤агЈ®© ¤ЁбЄ, ­  ў иҐ гᬮв७ЁҐ. +Џ®¬Ґй Ґ¬ ў нвг Ї ЇЄг MeOSload.com, е®вп Ї® ЇаҐ¦­Ґ¬г ¬®¦­® ҐЈ® ®бв ўЁвм Ё ў +Є®а­Ґ в®Ј® ¤ЁбЄ , ў Є®в®а®¬ ­ е®¤Ёвмбп Ї ЇЄ  KOLIBRI. +Џ®¬Ґй Ґ¬ KOLIBRI.IMG ў Ї ЇЄг KOLIBRI, е®вп ­ЁЄв® ў ¬ ­Ґ § ЇаҐй Ґв, Є Є Ё +а ­миҐ, ®бв ўЁвм ўбс ў Є®а­Ґ ¤ЁбЄ . +” ©«л Autoexec.bat Ё Config.sys ¤®«¦­л Ўлвм ¤®а Ў®в ­л ¤«п ўлЎ®а  § Јаг§ЄЁ +Љ®«ЁЎаЁ. ЏаЁ¬Ґа®¬ ¬®Јгв б«г¦Ёвм д ©«л, ў«®¦Ґ­­лҐ ў вг ¦Ґ Ї ЇЄг, Ё§ Є®в®а®© ўл +®вЄал«Ё нвг ¤®Єг¬Ґ­в жЁо. …б«Ё ў®§­ЁЄ­гв ў®Їа®бл, ®Ўа й ©вҐбм ­  д®аг¬ +http://meos.sysbin.com + +“¤ зЁ! diff --git a/programs/hd_load/meosload/L_readme_Win.txt b/programs/hd_load/meosload/L_readme_Win.txt new file mode 100644 index 0000000000..48a21965d3 --- /dev/null +++ b/programs/hd_load/meosload/L_readme_Win.txt @@ -0,0 +1,18 @@ +Как этим пользоваться? +Все нижеперечисленное актуально только для тех, у кого имеются следующие ОС: +MS-DOS, Windows95, Windows98 или их модификации. Для тех, у кого Windows2000 +или WindowsXP необходимо пользоваться загрузчиком mtldr (автор Diamond), +также входящим в дистрибутив. + +Создаём папку на диске: +C:\KOLIBRI или D:\KOLIBRI или E:\KOLIBRI или любой другой диск, на ваше усмотрение. +Помещаем в эту папку MeOSload.com, хотя по прежнему можно его оставить и в +корне того диска, в котором находиться папка KOLIBRI. +Помещаем KOLIBRI.IMG в папку KOLIBRI, хотя никто вам не запрещает, как и +раньше, оставить всё в корне диска. +Файлы Autoexec.bat и Config.sys должны быть доработаны для выбора загрузки +Колибри. Примером могут служить файлы, вложенные в ту же папку, из которой вы +открыли эту документацию. Если возникнут вопросы, обращайтесь на форум +http://meos.sysbin.com + +Удачи! diff --git a/programs/hd_load/meosload/MeOSload.asm b/programs/hd_load/meosload/MeOSload.asm new file mode 100644 index 0000000000..53f57a21de --- /dev/null +++ b/programs/hd_load/meosload/MeOSload.asm @@ -0,0 +1,364 @@ +; +; MenuesOS Boot Loader +; +; Author: Trans +; Date: 14.02.03 +; Version: 1.0 +; +; Current Version: 1.1 +; Date of modification: 11.06.03 +; +; Compile with FASM +; + +;--------Code------------ + org 100h +start: + push cs + pop ds + mov ax,0003h + int 10h + + mov dx,title + call print + mov dx,mes1 + call print + + mov dx,img0 + call file_open + test ax,ax + jnz loader_continue + mov dx,img2 + call file_open + test ax,ax + jne loader_continue + mov dx,img3 + call file_open + test ax,ax + je loader_not_find_file +loader_continue: + mov [handle],ax + +;---------Read boot-sector----------- + mov bx,ax + mov dx,buffer + mov cx,512 + call file_read + +;--------Read parametrs-------------- + mov ax,[buffer+0bh] + mov [SectSize],ax + mov al,[buffer+0dh] + mov [ClustSect],al + mov ax,[buffer+0eh] + mov [ResSect],ax + add ax,[ResRgn] + mov [FATRgn],ax + mov al,[buffer+10h] + mov [FATCnt],al + xor bx,bx + mov bl,al + mov ax,[buffer+11h] + mov [RootEnt],ax + shr ax,4 ; ax=ax*32/512 + mov [RootDirRgnSz],ax + mov ax,[buffer+16h] + mov [FATSect],ax + mul bx + mov [FATRgnSz],ax + add ax,[FATRgn] + mov [RootDirRgn],ax + add ax,[RootDirRgnSz] + mov [DataRgn],ax + +;------Read FATs and RootDir--------- + xor eax,eax + xor edx,edx + mov ax,[FATRgn] + mul [SectSize] + mov cx,dx + mov dx,ax + mov bx,[handle] + call file_offset + mov ax,[FATRgnSz] + mul [SectSize] + mov cx,ax + mov dx,buffer + mov bx,[handle] + call file_read + mov cx,[RootEnt] + shl cx,5 + mov dx,Root + mov bx,[handle] + call file_read + +;-------Search entry pointer in RootDir--------- + push ds + pop es + mov cx,[RootEnt] + mov bx,Root +loader_loc_00: + push cx + mov cx,11 + mov di,bx + mov si,kernel + repe cmpsb + jnz loader_notfound + pop cx + jmp loader_find +loader_notfound: + pop cx + add bx,32 + loop loader_loc_00 +loader_find: + + mov ax,[bx+1ah] + mov [FirstClust],ax + mov eax,[bx+1ch] + mov [filesize],eax + +;------Read Kernel---------------------- + call read_kernel + +;--------------------------------------- + + mov bx,[handle] + call file_close +;;;;;;;;;;;;;;;;;;;;;; + jmp loader_yes +;;;;;;;;;;;;;;;;;;;;;; +; mov dx,mes2 +; call print +;loader_key: +; mov ah,00h +; int 16h +; cmp al,1bh ;ESC +; je loader_no +; cmp al,6eh ;'n' +; je loader_no +; cmp al,4eh ;'N' +; je loader_no +; cmp al,79h ;'y' +; je loader_yes +; cmp al,59h ;'Y' +; je loader_yes +; jmp loader_key + +loader_not_find_file: + mov dx,mes4 + call print + jmp loader_exit + +loader_yes: + mov dx,yes + call print + mov ax,7000h + mov es,ax + mov si,move_kernel + xor di,di + mov cx,len_mk + rep movsb + jmp far 7000h:0000h +; jmp loader_exit +loader_no: + mov dx,no + call print + +loader_exit: + mov dx,mes3 + call print + retn +;----Subprogramms-------- + +print: +; in: dx - offset of ASCII string +; out: + mov ah,09h + int 21h + retn + +file_open: +; in: ds:dx - offset of ASCIIZ filename string +; out: ax - file handle (ax=0 - not found) + mov ax,3d00h + int 21h + jnc fo_exit + xor ax,ax +fo_exit: + retn + +file_close: +; in: bx - file handle +; out: + mov ah,3eh + int 21h + retn + +file_read: +; in: bx - file handle +; ds:dx - buffer +; cx - numbers of bytes +; out: + mov ah,3fh + int 21h + retn + +file_offset: +; in: bx - file handle +; cx:dx - offset in bytes (cx*65535+dx) +; out: + mov ax,4200h + int 21h + retn + +sector_find: +; in: ax - No of Cluster +; out: ax - 1st sector of Cluster + dec ax + dec ax + push bx + xor bx,bx + mov bl,[ClustSect] + mul bx + pop bx + add ax,[DataRgn] + retn + +read_cluster: +; in: ax - No of Cluster +; ds:dx - buffer +; out: + push dx + call sector_find + push ax + xor eax,eax + xor ebx,ebx + pop ax + mov bx,[SectSize] + mul ebx + mov dx,ax + shr eax,16 + mov cx,ax + mov bx,[handle] + call file_offset + xor ax,ax + mov al,[ClustSect] + mul [SectSize] + mov cx,ax + mov bx,[handle] + pop dx + call file_read + retn + +read_kernel: +; in: +; out: + mov ax,8000h + mov es,ax ;8000:0000 = 80000h - Temporal location of kernel + xor di,di ; + mov ax,[FirstClust] + mov bp,ax +rk_loc_00: + push es + mov dx,Root + call read_cluster + xor ax,ax ; Moving cluster to area of location kernel + mov al,[ClustSect] ; + mul [SectSize] ; + mov cx,ax ; + pop es ; + mov si,Root ; + rep movsb ; + cmp di,00h + jne rk_continue + mov ax,es + add ax,1000h + mov es,ax +rk_continue: + mov ax,bp + cmp ax,0ff8h + jae rk_done + shl ax,1 ; Val=Clustrer*1,5 //(Cluster*3)/2 + add ax,bp ; + shr ax,1 ; + mov bx,ax + add bx,buffer + mov ax,[bx] + bt bp,0 + jc rk_nechet + and ax,0fffh + jmp rk_chet +rk_nechet: + shr ax,4 +rk_chet: + mov bp,ax + jmp rk_loc_00 +rk_done: + retn + +move_kernel: +; in: +; out: + mov ax,8000h + mov ds,ax + mov ax,1000h + mov es,ax + xor si,si + xor di,di + mov cx,8000h + rep movsb + mov cx,8000h + rep movsb + mov bx,es + add bx,1000h + mov es,bx + mov bx,ds + add bx,1000h + mov ds,bx + mov cx,8000h + rep movsb + mov cx,8000h + rep movsb + mov ax,1000h + mov ds,ax + mov es,ax + jmp far 1000h:0000h + retn +len_mk=$-move_kernel + +;--------Data------------ +title db 'MenuetOS/KolibriOS Boot Loader. Ver.1.1 Copyright(C) 2003, Trans.',0ah,0dh,0ah,0dh,'$' +mes1 db 'It is alternative of boot from floppy.',0ah,0dh + db 'You MUST select HD booting !!!',0ah,0dh,0ah,0dh,'$' +mes2 db 'Are you sure loading KolibriOS? (Y/N):','$' +yes db 'Y','$' +no db 'N','$' +mes3 db 0ah,0dh,0ah,0dh,'See you later ...',0ah,0dh,'$' +mes4 db 0ah,0dh,0ah,0dh,'Not Found: ' +img0 db 'kolibri\kolibri.img',0,', ' +img2 db 'kolibri.img',0,', ' +img3 db 'menuet.img',0,' :($' +kernel db 'KERNEL MNT',0 +handle dw ? +SectSize dw ? ; +0bh +ClustSect db ? ; +0dh +ResSect dw ? ; +0eh +FATCnt db ? ; +10h +RootEnt dw ? ; +11h +FATSect dw ? ; +16h +filesize dd ? ; +1ch +FirstClust dw ? ; +1ah + +ResRgn dw 0 ; = VolumeStart +FATRgn dw ? ; = ResRgn+ResSect +RootDirRgn dw ? ; = FATRgn+(FATCnt*FATSect) +DataRgn dw ? ; = RootDirRgn+((RootEnt*32)/SectSize) +ResRgnSz dw ? ; = ResSect +FATRgnSz dw ? ; = FATCnt*FATSect +RootDirRgnSz dw ? ; = (RootEnt*32)/SectSize +;First sector of cluster N = DataRgn+((N-2)*ClustSect) + +buffer: + org 3000h +Root: + diff --git a/programs/hd_load/mtldr/fat32.inc b/programs/hd_load/mtldr/fat32.inc new file mode 100644 index 0000000000..197c6260db --- /dev/null +++ b/programs/hd_load/mtldr/fat32.inc @@ -0,0 +1,112 @@ +fat32_parse_dir: +; in: eax=directory cluster +; out: eax=entry cluster + mov bx, 900h + mov di, bx + push eax + call read_cluster + mov cx, word [cluster_size] + shr cx, 5 ; div 20h +.scan_cluster: + pop eax + cmp byte [di], 0 + jz file_not_found + mov si, [esp+2] + push eax + call fat_compare_name + jz .file_found + and di, not 1Fh + add di, 20h + loop .scan_cluster + pop eax + call next_cluster + jnc file_not_found + jc fat32_parse_dir +.file_found: + pop eax + mov si, [esp+2] + mov [cur_obj], si + and di, not 1Fh + mov si, directory_string + mov ax, [di+14h] + shl eax, 10h + mov ax, [di+1Ah] + test eax, eax + mov si, nodata_string + jz find_error_si + ret 2 + +fat_compare_name: + push cx + mov cx, 9 +.scan: + lodsb + cmp al, '.' + jz .ext + cmp al, 0 + jz .nameend + cmp al, 'a' + jb .notletter + cmp al, 'z' + ja .notletter + or byte [di], 20h +.notletter: + scasb + loopz .scan +.notfound: + inc cx ; to clear ZF flag + pop cx + ret +.ext: + mov al, ' ' + dec cx + repz scasb + jnz .notfound + test di, 1 + jnz .notfound + mov cx, 4 + jmp .scan +.nameend: + mov al, ' ' + dec cx + repz scasb + jnz .notfound + test di, 1 + jnz .file_found + mov cx, 3 + repz scasb + jnz .notfound +.file_found: + xor cx, cx ; to set ZF flag + pop cx + ret + +read_cluster: +; in: eax=cluster,bx->buffer + and eax, 0FFFFFFFh + movzx ecx, byte [50Dh] ; sects_per_clust + mul ecx + add eax, [data_start] +; call read +; ret + jmp relative_read +next_cluster: + mov bx, 700h +; sector is 200h bytes long, one entry in FAT occupies 4 bytes => 80h entries in sector + push eax + shr eax, 7 ; div 80h + cmp eax, [fat_cur_sector] + jz @f + mov [fat_cur_sector], eax + add eax, [fat_start] + mov cx, 1 + call relative_read +@@: + pop eax + and eax, 7Fh + mov eax, [700h+eax*4] + and eax, 0FFFFFFFh + cmp eax, 0FFFFFF7h + mov si, bad_cluster_string + jz find_error_si + ret diff --git a/programs/hd_load/mtldr/install.txt b/programs/hd_load/mtldr/install.txt new file mode 100644 index 0000000000..d5b322cf5c --- /dev/null +++ b/programs/hd_load/mtldr/install.txt @@ -0,0 +1,101 @@ +“бв ­®ўЄ  ®бгйҐбвў«пҐвбп б«Ґ¤гойЁ¬ Їа®бвл¬ бЇ®б®Ў®¬: + Ј 1. ‘Є®ЇЁаг©вҐ д ©«л mtldr Ё kolibri.img ў C:\ + (ЌҐ ­а ўЁвбп C:\? Џа®зЁв ©вҐ § ¬Ґз ­Ёп ­Ё¦Ґ.) + + Ј 2 ) „«п Ї®«м§®ў вҐ«Ґ© NT-ᥬҐ©бвў  ¤® Vista (NT/2k/XP/2003 Server (?)): + ¤®Ў ўм⥠ў boot.ini ў а §¤Ґ« [operating systems] бва®Єг +c:\mtldr="KolibriOS" + («ЁЎ® ®вЄалў «оЎл¬ ⥪бв®ўл¬ аҐ¤ Єв®а®¬ c:\boot.ini, + «ЁЎ® зҐаҐ§ Control Panel -> System -> Advanced -> Startup and Recovery + -> Edit). Ќ §ў ­ЁҐ ў Є ўлзЄ е ¬®¦ҐвҐ § ¬Ґ­Ёвм ­  ўбс, зв® ў ¬ ­а ўЁвбп, + Ї®¤ нвЁ¬ ­ §ў ­ЁҐ¬ бЁб⥬  Ўг¤Ґв Ї®пў«пвмбп ў бЇЁбЄҐ § Јаг§ЄЁ. +’ҐЇҐам ЇаЁ § Јаг§ЄҐ Ўг¤Ґв ўл¤ ў вмбп нЄа ­ ўлЎ®а  ®ЇҐа жЁ®­­®© бЁб⥬л. + + Ј 2Ў) „«п Ї®«м§®ў вҐ«Ґ© 9x-ᥬҐ©бвў  (95/98) +(  ¬®¦Ґв Ўлвм, нв® Ўг¤Ґв а Ў®в вм Ё ¤«п ­ҐЄ®в®але DOS): + ¤®Ў ўм⥠ў config.sys бва®Єг +install=c:\mtldr + ЇҐаў®© бва®Є®©, Ґб«Ё г ў б Їа®бв®© «Ё­Ґ©­л© config.sys, + ЇҐаў®© бва®Є®© ў ᮮ⢥вбвўго饩 ᥪ樨, Ґб«Ё config.sys + а §ЎЁв ­  ᥪ樨 (Ё ­ зЁ­ Ґвбп б [menu]) +’ҐЇҐам ЇаЁ § Јаг§ЄҐ mtldr Ўг¤Ґв бЇа иЁў вм: "Load KolibriOS? [y/n]: " Ё ®¦Ё¤ вм +­ ¦ вЁп ®¤­®Ј® Ё§ 'y','Y','n','N'. + +„«п Windows Millenium нв® ­Ґ а Ў®в Ґв, в.Є. Me'и­л© § Јаг§зЁЄ ­Ґ +§ Јаг¦ Ґв ў­Ґи­ҐЈ® Є®¤  Ё§ config.sys. (‘Ї бЁЎ® camper'г §  гЄ § ­ЁҐ +­  нв®в ЇаЁбЄ®аЎ­л© д Єв.) €бЇ®«м§г©вҐ 9x2klbr. + + Ј 2ў) „«п Ї®«м§®ў вҐ«Ґ© Vista: + ®вЄа®©вҐ Є®¬ ­¤­го бва®Єг б  ¤¬Ё­Ёбва в®абЄЁ¬Ё ЇаЁўЁ«ҐЈЁп¬Ё + (Їг­Єв "Run as administrator" ў Є®­вҐЄбв­®¬ ¬Ґ­о); + Ґб«Ё ўл ­Ґ Ї« ­ЁагҐвҐ гбв ­®ўЄЁ ­ҐбЄ®«мЄЁе ў аЁ ­в®ў Љ®«ЁЎаЁ + Є Є ®ЇЁб ­® ў § ¬Ґз ­Ёпе, Їа®бв® § ЇгбвЁвҐ ЇаЁ« Ј Ґ¬л© vista_install.bat; + Ё­ зҐ ўлЇ®«­ЁвҐ б«Ґ¤гойЁҐ Є®¬ ­¤л: +bcdedit /create /d "KolibriOS" /application BOOTSECTOR + (Ќ §ў ­ЁҐ ў Є ўлзЄ е ¬®¦ҐвҐ § ¬Ґ­Ёвм ­  ўбс, зв® ў ¬ ­а ўЁвбп, + Ї®¤ нвЁ¬ ­ §ў ­ЁҐ¬ бЁб⥬  Ўг¤Ґв Ї®пў«пвмбп ў бЇЁбЄҐ § Јаг§ЄЁ.) + „®«¦­® Ї®пўЁвмбп б®®ЎйҐ­ЁҐ вЁЇ  +"‡ ЇЁбм {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} гбЇҐи­® ᮧ¤ ­ ." + „ «ҐҐ ў Є®¬ ­¤ е Ї®¤бв ў«п©вҐ Ї®«г祭­®Ґ §­ зҐ­ЁҐ (®­®, ў®®ЎйҐ Ј®ў®ап, + а §­®Ґ ­  а §­ле Є®¬ЇмовҐа е). +bcdedit /set {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} DEVICE PARTITION=C: +bcdedit /set {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} PATH \mtldr +bcdedit /displayorder {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} /addlast + +“¤ «Ґ­ЁҐ ў б«гз пе 2 ) Ё 2Ў) ®бгйҐбвў«пҐвбп г¤ «Ґ­ЁҐ¬ ўўҐ¤с­­ле ¤ ­­ле ў +boot.ini Ё config.sys ᮮ⢥вб⢥­­®. “¤ «Ґ­ЁҐ ў б«гз Ґ 2ў) ¤Ґ« Ґвбп в Є: + +vista_remove.bat, Ґб«Ё гбв ­®ўЄ  Ўл«  зҐаҐ§ vista_install.bat; +bcdedit /delete {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} ў ®ЎйҐ¬ б«гз Ґ + +…б«Ё ўл ­Ґ Ї®¬­ЁвҐ ­ §­ зҐ­­л© ЇаЁ гбв ­®ўЄҐ GUID (нв® ­®а¬ «м­®Ґ пў«Ґ­ЁҐ), +в® г§­ вм ҐЈ® ¬®¦­®, ўлЇ®«­Ёў Є®¬ ­¤г bcdedit ЎҐ§  аЈг¬Ґ­в®ў Ё ­ ©¤п +ў ўлўҐ¤Ґ­­®¬ бЇЁбЄҐ ᮮ⢥вбвўгойЁ© н«Ґ¬Ґ­в. + +‚® ўбҐе б«гз пе ў нЄа ­Ґ ўлЎ®а  Ї а ¬Ґва®ў KolibriOS ¬®¦­® ­  ў®Їа®б, +®вЄг¤  Јаг§Ёвм ®Ўа § (Їг­Єв d, "®Ўа § ¤ЁбЄҐвл"), +®вўҐз вм "3" (ЁбЇ®«м§®ў вм 㦥 § Ја㦥­­л© ®Ўа §). + +‡ ¬Ґз ­Ёп: + +1. Џ®Є  зв® ўбс нв® а Ў®в Ґв ¤«п д ©«®ўле бЁб⥬ NTFS Ё FAT32, Ї®¤¤Ґа¦Є  FAT16 +­Ґ ॠ«Ё§®ў ­  ў бўп§Ё б ¬®Ё¬ Ј«гЎ®ЄЁ¬ гЎҐ¦¤Ґ­ЁҐ¬, з⮠ᥩз б FAT16 - ®ЎкҐЄв +зЁбв® Ёбв®аЁзҐбЄЁ©. …б«Ё ўл ЁбЇ®«м§гҐвҐ FAT16, г ў б бв®Ёв Windows Ё ўл Ї® +Є ЄЁ¬-в® ЇаЁзЁ­ ¬ ­Ґ е®вЁвҐ ЇҐаҐе®¤Ёвм ­  FAT32 - ­ ЇЁиЁвҐ ¬­Ґ +- ¬®¦Ґв Ўлвм, ў ¬ г¤ бвбп ¬Ґ­п ЇҐаҐгЎҐ¤Ёвм. + +2. ‘ ¬ § Јаг§зЁЄ mtldr ­Ґ®Ўп§ вҐ«м­® Ї®¬Ґй вм ў C:\. Џ®¤ 9x Ё Vista ®­ ¬®¦Ґв +а §¬Ґй вмбп Ј¤Ґ гЈ®¤­®, ў NT/2k/XP - ­  ¤ЁбЄҐ C:, ­® ­Ґ®Ўп§ вҐ«м­® +ў Є®а­Ґў®© Ї ЇЄҐ. (ђ §г¬ҐҐвбп, ЇаЁ гбв ­®ўЄҐ ­г¦­® гЄ §лў вм ў¬Ґбв® +c:\mtldr ॠ«м­л© Їгвм Ё ॠ«м­®Ґ Ё¬п д ©« .) + +3. ЋЎа § kolibri.img ⮦Ґ ­Ґ®Ўп§ вҐ«м­® Ї®¬Ґй вм ў C:\. Њ®¦­® ЎҐ§ ўбпЄЁе +Ё§¬Ґ­Ґ­Ё© ў гбв ­®ўЄҐ ЁбЇ®«м§®ў вм Є®а­Ґўго Ї ЇЄг «оЎ®Ј® «®ЈЁзҐбЄ®Ј® ¤ЁбЄ , +а §¬Ґй о饣®бп ­  ЇҐаў®¬ дЁ§ЁзҐбЄ®¬. + +4. …б«Ё е®зҐвбп ЁбЇ®«м§®ў вм «®ЈЁзҐбЄЁ© ¤ЁбЄ ­  ¤агЈ®¬ дЁ§ЁзҐбЄ®¬ ¤ЁбЄҐ? +‘Ј®¤Ёвбп «оЎ®© Ё§ б«Ґ¤гойЁе ў аЁ ­в®ў: +a) (…б«Ё ўл 㬥ҐвҐ а Ў®в вм б FASM'®¬) ‚ Ёб室­ЁЄ е (Є®в®алҐ ¬®¦­® бЄ з вм + ­  http://diamondz.land.ru, в ¬ ¦Ґ, Ј¤Ґ Ё б ¬ § Јаг§зЁЄ) Ї®¬Ґ­п©вҐ + Є®­бв ­вг boot_drive (ў Є®­жҐ mtldr.asm) б 80h ­  Ё¤Ґ­вЁдЁЄ в®а ¤ЁбЄ , + 80h ᮮ⢥вбвўгҐв ЇҐаў®¬г, 81h - ўв®а®¬г Ё в.¤. ЏҐаҐЄ®¬ЇЁ«Ёаг©вҐ. +Ў) (…б«Ё ўл 㬥ҐвҐ а Ў®в вм б hex-। Єв®а®¬) Џ®¬Ґ­п©вҐ Ў ©в Ї® ᬥ饭Ёо 0xD98 + б 80h ­  Ё¤Ґ­вЁдЁЄ в®а ¤ЁбЄ  (Є Є ў Їг­ЄвҐ  ). +ў) €бЇ®«м§г©вҐ гбв ­®ўйЁЄ mtldr_install (бЄ з вм ҐЈ® ¬®¦­® в ¬ ¦Ґ). + Ћ­ ­ бва®Ёв § Јаг§зЁЄ Ё б ¬ ¦Ґ ҐЈ® Ё гбв ­®ўЁв. + +5. …б«Ё 祬-в® ­Ґ ­а ўЁвбп Є®а­Ґў п Ї ЇЄ ? ’гв Ї®пў«повбп ¤ў  ў аЁ ­в : + ) ‚ Ёб室­ЁЄ е Ї®¬Ґ­п©вҐ бва®Єг kolibri_img_name (ў Є®­жҐ mtldr.asm) + ­  Їгвм Є д ©«г. Ќ ЇаЁ¬Ґа, ¤«п C:\Program Files\kolibri\kolibri.img § ЇЁиЁвҐ + 'progra~1\kolibri\kolibri.img' (ЇаЁ н⮬ ­г¦­л Ё¬Ґ­  8.3). ЏҐаҐЄ®¬ЇЁ«Ёаг©вҐ. +Ў) €бЇ®«м§г©вҐ гбв ­®ўйЁЄ mtldr_install. + +6. …б«Ё ў®бЇ®«м§®ў вмбп ४®¬Ґ­¤ жЁп¬Ё Їг­Єв®ў 2 Ё 5 Ё Ї®ўв®аЁвм гбв ­®ўЄг + ­ҐбЄ®«мЄ® а § ¤«п а §­ле а бЇ®«®¦Ґ­Ё© бўп§ЄЁ mtldr+kolibri.img, + ¬®¦­® Ї®«гзЁвм ў § Ја㧮筮¬ ¬Ґ­о ­ҐбЄ®«мЄ® ўе®¤®ў ¤«п а §­ле ўҐабЁ© + Љ®«ЁЎаЁ (Ё«Ё ¤«п ўҐабЁ© б а §­л¬Ё ­ бва®©Є ¬Ё). + +7. Џ®¦Ґ« ­Ёп, § ¬Ґз ­Ёп, ЇаҐ¤«®¦Ґ­Ёп ўлбл« ©вҐ ­  ¬л«®, гЄ § ­­®Ґ ­Ё¦Ґ. + + diamond + mailto: diamondz@land.ru diff --git a/programs/hd_load/mtldr/mtldr.asm b/programs/hd_load/mtldr/mtldr.asm new file mode 100644 index 0000000000..c44c383095 --- /dev/null +++ b/programs/hd_load/mtldr/mtldr.asm @@ -0,0 +1,852 @@ +; KolibriOS bootloader +; this code has been written by diamond in 2005,2006,2008 specially for KolibriOS + +; this code is loaded by ntldr to 0D00:0000 +; and by io.sys from config.sys to xxxx:0100 +; and by bootmgr in vista to 0000:7C00 + format binary + use16 + + org 0xD000 +; entry point for 9x and Vista booting + call @f +; db 'd' xor 'i' xor 'a' xor 'm' xor 'o' xor 'n' xor 'd' + db 'NTFS' +@@: + pop si + sub si, 3 + cmp si, 7C00h + jz boot_vista + mov si, load_question + 100h - 0D000h + call out_string +; mov si, answer + 100h - 0D000h ; already is +xxy: mov ah, 0 + int 16h + or al, 20h + mov [si], al + cmp al, 'y' + jz xxz + cmp al, 'n' + jnz xxy +; continue load Windows +; call out_string +; ret +out_string: + lodsb + test al, al + jz .xxx + mov ah, 0Eh + mov bx, 7 + int 10h + jmp out_string +.xxx: ret +xxz: +; boot KolibriOS + call out_string + push 0 + pop ds + mov word [4], new01handler + 100h - 0D000h + mov [6], cs + pushf + pop ax + or ah, 1 + push ax + popf +; int 19h +; pushf ; there will be no iret + call far [19h*4] +xxt: +; TF has been cleared when entered new01handler +; pushf +; pop ax +; and ah, not 1 +; push ax +; popf + xor di, di + mov ds, di + cmp word [8*4+2], 0F000h + jz @f + les bx, [8*4] + mov eax, [es:bx+1] + mov [8*4], eax +@@: + mov si, 100h +boot_vista: + push cs + pop ds + push 0D00h + pop es + mov cx, 2000h/2 + rep movsw + jmp 0D00h:0256h +load_question db 'Load KolibriOS? [y/n]: ',0 +answer db ? + db 13,10,0 + +new01handler: +; [sp]=ip, [sp+2]=cs, [sp+4]=flags + push bp + mov bp, sp + push bx + push ds + lds bx, [bp+2] + cmp word [bx], 19cdh + jz xxt + pop ds + pop bx + pop bp + iret + +relative_read: + add eax, [partition_start] + +; read from hard disk +; drive_size must be already initialized +; in: eax = absolute sector +; cx = number of sectors +; es:bx -> buffer +read: + pushad + cmp eax, [drive_size] + jb .old_style +; new style - LBA, function 42 + cmp [has_lba], 0 + jz disk_error +; allocate disk address packet on the stack +; qword +8: absolute block number + push dword 0 ; dword +C is high dword + push eax ; dword +8 is low dword +; dword +4: buffer address + push es ; word +6 is segment + push bx ; word +4 is offset +; word +2: number of blocks = 1 +; word +0: size of packet = 10h + push dword 10010h +; now pair ss:sp contain address of disk address packet +.patch1: + mov ax, 4200h + mov dl, [boot_drive] + mov si, sp + push ds + push ss + pop ds + int 13h + pop ds + add sp, 10h +.end: + popad + jc disk_error + add bx, 200h + inc eax + dec cx + jnz read + ret +.old_style: +; old style - CHS, function 2 +; convert absolute sector in eax to cylinder-head-sector coordinates +; calculate sector + xor edx, edx + movzx ecx, [sectors] + div ecx +; sectors are counted from 1 + inc dx + mov cl, dl ; low 6 bits of cl = sector number +; calculate head number + shld edx, eax, 10h ; convert eax to dx:ax + div [heads] + mov dh, dl ; dh = head + mov ch, al ; ch = low 8 bits of cylinder + shl ah, 6 + or cl, ah ; high 2 bits of cl = high 2 bits of cylinder +.patch2: + mov ax, 201h ; function 2, al=1 - number of sectors + mov dl, [boot_drive] + int 13h + jmp .end + +disk_error: + mov si, disk_error_msg + call out_string + jmp $ + +has_lba db 0 + +disk_error_msg db 'Disk read error!',0 +start_msg db 2,' KolibriOS bootloader',13,10,0 +part_msg db 'looking at partition ' +part_char db '0' ; will be incremented before writing message + db ' ... ',0 +errfs_msg db 'unknown filesystem',13,10,0 +fat16_msg db 'FAT12/FAT16 - unsupported',13,10,0 +fat32_msg db 'FAT32' +newline db 13,10,0 +ntfs_msg db 'NTFS',13,10,0 +error_msg db 'Error' +colon db ': ',0 +mft_string db 'MFT',0 +root_string db '\',0 +noindex_string db '$INDEX_ROOT not found',0 +invalid_read_request_string db 'cannot read attribute',0 +nodata_string db '$DATA ' +notfound_string db 'not found',0 +directory_string db 'is a directory',0 +notdir_string db 'not a directory',0 +fragmented_string db 'too fragmented file',0 +exmem_string db 'extended memory error',0 +bad_cluster_string db 'bad cluster',0 +data_error_msg db 'data error',0 + +; init procedure - ntldr jmps here + repeat 0D256h - $ + db 1 + end repeat +start: +; cs=es=0D00, ds=07C0, ss=0 +; esi=edi=ebp=0, esp=7C00 + xor ax, ax + mov ds, ax + mov es, ax +; our stack is 4Kb-512b-2b!!! (0xDFE) + mov ss, ax + mov esp, 0FFFEh + +; we are booting from hard disk identified by [boot_drive] + mov dl, [boot_drive] + cld + sti +; calculate drive size + mov ah, 8 ; 8 = get drive parameters + int 13h +; now: CF is set on error; +; ch = low 8 bits of maximum cylinder number +; cl : low 6 bits makes maximum sector number, high 2 bits are high 2 bits of maximum cylinder number +; dh = maximum head number + jnc @f + mov cx, -1 + mov dh, cl +@@: + movzx ax, dh + inc ax +; ax = number of heads + mov [heads], ax + mov dl, cl + and dx, 3Fh +; dx = number of sectors +; (note that sectors are counted from 1, and maximum sector number = number of sectors) + mov [sectors], dx + mul dx + xchg cl, ch + shr ch, 6 + inc cx +; cx = number of cylinders + mov [cyls], cx + mul cx + mov word [drive_size], ax + mov word [drive_size+2], dx +; this drive supports LBA? + mov dl, [boot_drive] + mov ah, 41h + mov bx, 55AAh + int 13h + jc .no_lba + cmp bx, 0AA55h + jnz .no_lba + test cl, 1 + jz .no_lba + inc [has_lba] +.no_lba: +; say hi to user + mov si, start_msg + call out_string +; now read first sector to determine file system type +; first sector of disk is MBR sector + xor eax, eax +new_partition_ex: + mov cx, 1 + mov bx, 0F000h + call read +new_partition: + mov bx, [cur_partition_ofs] + mov al, [bx+4] ; partition type + test al, al + jz next_partition + cmp al, 5 + jz @f + cmp al, 0xF + jnz not_extended +@@: +; extended partition + mov eax, [bx+8] ; partition start + add eax, [extended_part_start] + mov [extended_part_cur], eax +next_partition: + add [cur_partition_ofs], 10h + cmp [cur_partition_ofs], 0xF1FE + jb new_partition + mov eax, [extended_part_cur] + test eax, eax + jz partitions_done + cmp [extended_part_start], 0 + jnz @f + mov [extended_part_start], eax +@@: + mov [extended_parent], eax + and [extended_part_cur], 0 + mov [cur_partition_ofs], 0xF1BE + jmp new_partition_ex +partitions_done: + mov si, total_kaput + call out_string + jmp $ +not_extended: + mov eax, [bx+8] + add eax, [extended_parent] + mov [partition_start], eax + push ax + mov si, part_msg + inc [si+part_char-part_msg] + call out_string + pop ax + mov cx, 1 + mov bx, 500h + call read + movzx ax, byte [50Dh] + mov [sect_per_clust], ax +; determine file system + cmp dword [536h], 'FAT1' + jz fat1x + cmp dword [552h], 'FAT3' + jz fat32 + cmp dword [503h], 'NTFS' + jz ntfs + mov si, errfs_msg + call out_string + jmp next_partition +fat1x: + mov si, fat16_msg + call out_string + jmp next_partition +fat32: + mov si, fat32_msg + call out_string + movzx eax, word [50Bh] ; bytes_per_sect + movzx ebx, byte [50Dh] ; sects_per_clust + mul ebx + mov [cluster_size], eax + movzx ebx, word [50Eh] ; reserved_sect + mov [fat_start], ebx + movzx eax, byte [510h] ; num_fats + mul dword [524h] ; sect_fat + add eax, ebx +; cluster 2 begins from sector eax + movzx ebx, byte [50Dh] ; sects_per_clust + sub eax, ebx + sub eax, ebx + mov [data_start], eax +; parse image name + mov eax, [52Ch] ; root_cluster + mov [cur_obj], root_string +.parsedir: + push ax + mov si, [imgnameofs] + push si +@@: + lodsb + cmp al, 0 + jz @f + cmp al, '\' + jnz @b + dec si + mov [missing_slash], si + inc si +@@: + xchg ax, [esp+2] + mov byte [si-1], 0 + mov [imgnameofs], si + call fat32_parse_dir + call restore_slash + pop cx + test cl, cl + jz .end + test byte [di+0Bh], 10h + mov si, notdir_string + jz find_error_si + jmp .parsedir +.end: + test byte [di+0Bh], 10h + mov si, directory_string + jnz find_error_si +; parse FAT chunk +; runlist at 2000:0000 + mov di, 5 + push 2000h + pop es + mov byte [es:di-5], 1 ; of course, non-resident + mov dword [es:di-4], 1 + stosd +.parsefat: + push es + push ds + pop es + call next_cluster + pop es + jnc .done + mov ecx, [es:di-8] + add ecx, [es:di-4] + cmp eax, ecx + jz .contc + mov dword [es:di], 1 + scasd + stosd + jmp .parsefat +.contc: + inc dword [es:di-8] + jmp .parsefat +.done: + xor eax, eax + stosd + jmp read_img_file + +ntfs: + mov si, ntfs_msg + call out_string + movzx eax, word [50Bh] ; bpb_bytes_per_sect + push eax + movzx ebx, byte [50Dh] ; bpb_sects_per_clust + mul ebx + mov [cluster_size], eax + mov [data_start], 0 + mov ecx, [540h] ; frs_size + cmp cl, 0 + jg .1 + neg cl + xor eax, eax + inc eax + shl eax, cl + jmp .2 +.1: + mul ecx +.2: + mov [frs_size], eax + pop ebx + xor edx, edx + div ebx + mov [frs_sectors], ax +; read first MFT record - description of MFT itself + mov [cur_obj], mft_string + movzx eax, byte [50Dh] ; bpb_sects_per_clust + mul dword [530h] ; mft_cluster + mov cx, [frs_sectors] + mov bx, 4000h + mov di, bx + push bx + call relative_read + call restore_usa +; scan for unnamed $DATA attribute + pop di + mov ax, 80h ; $DATA + mov bx, 700h + call load_attr + mov si, nodata_string + jc find_error_si + mov [free], bx +; load kolibri.img +; parse image name + mov eax, 5 ; root cluster + mov [cur_obj], root_string +.parsedir: + push ax + mov si, [imgnameofs] + push si +@@: + lodsb + cmp al, 0 + jz @f + cmp al, '\' + jnz @b + dec si + mov [missing_slash], si + inc si +@@: + xchg ax, [esp+2] + mov byte [si-1], 0 + mov [imgnameofs], si + call ntfs_parse_dir + call restore_slash + pop cx + test cl, cl + jnz .parsedir +read_img_file: + xor si, si + push es + pop fs +; yes! Now read file to 0x100000 + lods byte [fs:si] + cmp al, 0 ; assume nonresident attr + mov si, invalid_read_request_string + jz find_error_si + mov si, 1 + xor edi, edi +; read buffer to 1000:0000 and move it to extended memory + push 1000h + pop es + xor bx, bx +.img_read_block: + lods dword [fs:si] ; eax=length + xchg eax, ecx + jecxz .img_read_done + lods dword [fs:si] ; eax=disk cluster +.img_read_cluster: + pushad +; read part of file + movzx ecx, byte [50Dh] + mul ecx + add eax, [data_start] + call relative_read +; move it to extended memory + mov ah, 87h + mov ecx, [cluster_size] + push ecx + shr cx, 1 + mov si, movedesc + push es + push ds + pop es + int 15h + pop es + test ah, ah + mov si, exmem_string + jnz find_error_si + pop ecx + add [dest_addr], ecx + popad + inc eax + loop .img_read_cluster + jmp .img_read_block +.img_read_done: +; kolibri.img loaded; now load kernel.mnt +load_kernel: + push ds + pop es + mov [cur_obj], kernel_mnt_name +; read boot sector + xor eax, eax + mov bx, 500h + mov cx, 1 + call read_img +; init vars + mov ax, [50Eh] ; reserved_sect + add ax, [51Ch] ; hidden + mov word [fat_start], ax + xchg ax, bx + movzx ax, byte [510h] ; num_fats + mul word [516h] ; fat_length + add ax, bx +; read root dir + mov bx, 700h + mov cx, [511h] ; dir_entries + add cx, 0Fh + shr cx, 4 + call read_img + add ax, cx + mov [img_data_start], ax + shl cx, 9 + mov di, bx + add bx, cx + mov byte [bx], 0 +.scan_loop: + cmp byte [di], 0 + mov si, notfound_string + jz find_error_si + mov si, kernel_mnt_name + call fat_compare_name + jz .found + and di, not 1Fh + add di, 20h + jmp .scan_loop +.found: + and di, not 1Fh + mov si, directory_string + test byte [di+0Bh], 10h + jnz find_error_si +; found, now load it to 1000h:0000h + mov ax, [di+1Ah] +; first cluster of kernel.mnt in ax +; translate it to sector on disk in kolibri.img + push ax + dec ax + dec ax + movzx cx, byte [50Dh] + mul cx + add ax, [img_data_start] +; now ax is sector in kolibri.img + mov [kernel_mnt_in_img], ax + div [sect_per_clust] +; now ax is cluster in kolibri.img and +; dx is offset from the beginning of cluster + movzx eax, ax + push 2000h + pop ds + mov si, 1 +.scani: + sub eax, [si] + jb .scanidone +; sanity check + cmp dword [si], 0 + push invalid_read_request_string + jz find_error_sp + pop cx +; next chunk + add si, 8 + jmp .scani +.scanidone: + add eax, [si] ; undo last subtract + add eax, [si+4] ; get cluster + push 0 + pop ds + movzx ecx, [sect_per_clust] + push dx + mul ecx ; get sector + pop dx + movzx edx, dx + add eax, edx + add eax, [data_start] + mov [kernel_mnt_1st], eax + pop ax + push 1000h + pop es +.read_loop: + push ax + xor bx, bx + call img_read_cluster + shl cx, 9-4 + mov ax, es + add ax, cx + mov es, ax + pop ax + call img_next_cluster + jc .read_loop + mov ax, 'KL' + mov si, loader_block + jmp 1000h:0000h + +img_next_cluster: + mov bx, 700h + push ax + shr ax, 1 + add ax, [esp] + mov dx, ax + shr ax, 9 + add ax, word [fat_start] + mov cx, 2 + push es + push ds + pop es + call read_img + pop es + and dx, 1FFh + add bx, dx + mov ax, [bx] + pop cx + test cx, 1 + jz .1 + shr ax, 4 +.1: + and ax, 0FFFh + mov si, bad_cluster_string + cmp ax, 0FF7h + jz find_error_si + ret +img_read_cluster: + dec ax + dec ax + movzx cx, byte [50Dh] ; sects_per_clust + mul cx + add ax, [img_data_start] + movzx eax, ax +; call read_img +; ret +read_img: +; in: ax = sector, es:bx->buffer, cx=length in sectors + pushad + movzx ebx, bx + mov si, movedesc + shl eax, 9 + add eax, 93100000h + mov dword [si+sou_addr-movedesc], eax + mov eax, 9300000h + mov ax, es + shl eax, 4 + add eax, ebx + mov [si+dest_addr-movedesc], eax + mov ah, 87h + shl cx, 8 ; mul 200h/2 + push es + push 0 + pop es + int 15h + pop es + cmp ah, 0 + mov si, exmem_string + jnz find_error_si + popad + ret + +movedesc: + times 16 db 0 +; source + dw 0xFFFF ; segment length +sou_addr dw 0000h ; linear address + db 1 ; linear address + db 93h ; access rights + dw 0 +; destination + dw 0xFFFF ; segment length +dest_addr dd 93100000h ; high byte contains access rights + ; three low bytes contains linear address (updated when reading) + dw 0 + times 32 db 0 + +find_error_si: + push si +find_error_sp: + mov si, error_msg + call out_string + mov si, [cur_obj] + call out_string + mov si, colon + call out_string + pop si + call out_string + mov si, newline + call out_string + or [fat_cur_sector], -1 + mov [imgnameofs], kolibri_img_name + call restore_slash + mov sp, 0xFFFE + jmp next_partition + +file_not_found: + mov si, [esp+2] + mov [cur_obj], si + push notfound_string + jmp find_error_sp + +restore_slash: + mov si, [missing_slash] + test si, si + jz @f + and [missing_slash], 0 + mov byte [si], '\' +@@: ret + + include 'fat32.inc' + include 'ntfs.inc' + +write1st: +; callback from kernel.mnt +; write first sector of kernel.mnt from 1000:0000 back to disk + push cs + pop ds + push cs + pop es +; sanity check + mov bx, 500h + mov si, bx + mov cx, 1 + push cx + mov eax, [kernel_mnt_1st] + push eax + call relative_read + push 1000h + pop es + xor di, di + mov cx, 8 + repz cmpsw + mov si, data_error_msg + jnz find_error_si +; ok, now write back to disk + or byte [read.patch1+2], 1 + or byte [read.patch2+2], 1 + xor bx, bx + pop eax + pop cx + call relative_read + and byte [read.patch1+1], not 1 + and byte [read.patch2+2], not 2 +; and to image in memory (probably this may be done by kernel.mnt itself?) + mov dword [sou_addr], 93010000h + movzx eax, [kernel_mnt_in_img] + shl eax, 9 + add eax, 93100000h + mov dword [dest_addr], eax + mov si, movedesc + push ds + pop es + mov ah, 87h + mov cx, 100h + int 15h + cmp ah, 0 + mov si, exmem_string + jnz find_error_si + retf + +loader_block: + db 1 ; version + dw 1 ; flags - image is loaded + dw write1st ; offset + dw 0 ; segment + +fat_cur_sector dd -1 +imgnameofs dw kolibri_img_name + +; ----------------------------------------------- +; ------------------ Settings ------------------- +; ----------------------------------------------- + +; must be in lowercase, see ntfs_parse_dir.scan, fat32_parse_dir.scan +kernel_mnt_name db 'kernel.mnt',0 +kolibri_img_name db 'kolibri.img',0 + +; change next variable if you want to boot from other physical drive +boot_drive db 80h + +total_kaput db 13,10,'Fatal: image is not found.',13,10,0 +missing_slash dw 0 + align 2 + +cur_partition_ofs dw 0xF1BE +extended_part_start dd 0 +extended_part_cur dd 0 +extended_parent dd 0 + +; uninitialized data follows +drive_size dd ? ; in sectors +heads dw ? +sectors dw ? +cyls dw ? +partition_start dd ? +free dw ? +cur_obj dw ? +data_start dd ? +img_data_start dw ? +sect_per_clust dw ? +kernel_mnt_in_img dw ? +kernel_mnt_1st dd ? +; NTFS data +cluster_size dd ? ; in bytes +frs_size dd ? ; in bytes +frs_sectors dw ? ; in sectors +mft_data_attr dw ? +index_root dw ? +index_alloc dw ? +ofs dw ? +dir dw ? +; FAT32 data +fat_start dd ? +cur_cluster dd ? +; file must be 16 sectors long + + repeat 0F000h - $ + db 2 + end repeat diff --git a/programs/hd_load/mtldr/ntfs.inc b/programs/hd_load/mtldr/ntfs.inc new file mode 100644 index 0000000000..1b38f5478f --- /dev/null +++ b/programs/hd_load/mtldr/ntfs.inc @@ -0,0 +1,531 @@ +restore_usa: +; Update Sequence Array restore + mov bx, [di+4] + mov cx, [di+6] + inc bx + add bx, di + inc bx + add di, 1feh + dec cx +@@: + mov ax, [bx] + stosw + inc bx + inc bx + add di, 1feh + loop @b + ret + +find_attr: +; in: di->file record, ax=attribute +; out: di->attribute or di=0 if not found + add di, [di+14h] +.1: +; attributes codes are formally dwords, but all they fit in word + cmp word [di], -1 + jz .notfound + cmp word [di], ax + jnz .continue +; for $DATA attribute, scan only unnamed + cmp ax, 80h + jnz .found + cmp byte [di+9], 0 + jz .found +.continue: + add di, [di+4] + jmp .1 +.notfound: + xor di, di +.found: + ret + +process_mcb_nonres: +; in: si->attribute, es:di->buffer +; out: di->buffer end + add si, [si+20h] + xor ebx, ebx +.loop: + lodsb + test al, al + jz .done + push invalid_read_request_string + movzx cx, al + shr cx, 4 + jz find_error_sp + xchg ax, dx + and dx, 0Fh + jz find_error_sp + add si, cx + add si, dx + pop ax + push si + dec si + movsx eax, byte [si] + dec cx + jz .l1e +.l1: + dec si + shl eax, 8 + mov al, [si] + loop .l1 +.l1e: + xchg ebp, eax + dec si + movsx eax, byte [si] + mov cx, dx + dec cx + jz .l2e +.l2: + dec si + shl eax, 8 + mov al, byte [si] + loop .l2 +.l2e: + pop si + add ebx, ebp +; eax=length, ebx=disk block + stosd + mov eax, ebx + stosd + jmp .loop +.done: + xor eax, eax + stosd + ret + +load_attr: +; in: ax=attribute, es:bx->buffer, di->base record +; out: bx->buffer end; CF set if not found + push di + push ax + mov byte [es:bx], 1 + inc bx + push bx + mov [ofs], bx +; scan for attrubute + add di, [di+14h] +@@: + call find_attr.1 + test di, di + jz .notfound1 + cmp byte [di+8], 0 + jnz .nonresident + jmp .resident +.aux_resident: + push di + popad +; resident attribute +.resident: + mov si, di + pop di + dec di + mov al, 0 + stosb + mov ax, [si+10h] + stosw + xchg ax, cx + add si, [si+14h] + rep movsb + mov bx, di + pop ax + pop di + ret +.nonresident: +; nonresident attribute + cmp dword [di+10h], 0 + jnz @b +; read start of data + mov si, di + pop di + call process_mcb_nonres + sub di, 4 + push di +.notfound1: +; $ATTRIBUTE_LIST is always in base file record + cmp word [esp+2], 20h + jz .nofragmented +; scan for $ATTRIBUTE_LIST = 20h + mov di, [esp+4] + mov ax, 20h + call find_attr + test di, di + jz .nofragmented +; load $ATTRIBUTE_LIST itself + push es + mov bx, 0C000h + mov di, [esp+6] + push bx + push [ofs] + push ds + pop es + call load_attr + pop [ofs] + pop si + mov bx, 8000h + push bx + push si + call read_attr_full + pop si + pop bx + add dx, bx + mov ax, [esp+4] + pop es +.1: + cmp [bx], ax + jnz .continue1 +; only unnamed $DATA attributes! + cmp ax, 80h + jnz @f + cmp byte [bx+6], 0 + jnz .continue1 +@@: + cmp dword [bx+10h], 0 + jz .continue1 + cmp dword [bx+8], 0 + jnz @f + push ax + mov ax, [esp+2] + cmp ax, [ofs] + pop ax + jnz .continue1 +@@: + pushad + mov eax, [bx+10h] + mov bx, dx + push [ofs] + push es + push ds + pop es + call read_file_record + pop es + pop [ofs] + popad + pushad + pop di + mov di, dx + add di, [di+14h] +.2: + call find_attr.1 + cmp byte [di+8], 0 + jz .aux_resident + mov eax, [bx+8] + cmp eax, [di+10h] + jnz .2 + mov si, di + mov di, [esp+1Eh] + call process_mcb_nonres + sub di, 4 + mov [esp+1Eh], di + push di + popad +.continue1: + add bx, [bx+4] + cmp bx, dx + jb .1 +.nofragmented: + pop bx + pop ax + pop di + cmp bx, [ofs] + jnz @f + dec bx + stc + ret +@@: + add bx, 4 + ret + +read_attr_full: +; in: si->decoded attribute data, bx->buffer +; out: edx=length in bytes + lodsb + cmp al, 0 + jnz .nonresident +; resident + lodsw + movzx edx, ax + xchg ax, cx + mov di, bx + rep movsb + ret +.nonresident: +; nonresident :-) + xor edx, edx +.loop: + lodsd + xchg ecx, eax + jecxz .loopend + lodsd + xchg edi, eax +; read ecx clusters from cluster edi to es:bx +.intloop: + push ecx +; read 1 cluster from physical cluster edi to es:bx + mov ecx, [cluster_size] + mov eax, edi + mul ecx + push bx + call relative_read + pop bx + pop ecx + inc edi + mov eax, [cluster_size] + add edx, eax + shr eax, 4 + mov bp, es + add bp, ax + mov es, bp + loop .intloop + jmp .loop +.loopend: + mov es, cx + ret + +read_file_record: +; in: eax=index of record, bx=buffer + mov si, 700h + mov ecx, [frs_size] + mul ecx + push bx + push [cur_obj] + mov [cur_obj], mft_string + call read_attr + pop [cur_obj] + pop di + call restore_usa + ret +read_attr: +; in: edx:eax=offset in bytes, ecx=size in bytes, bx=buffer, si=attribute + push invalid_read_request_string + cmp byte [si], 0 + jnz .nonresident + test edx, edx + jnz find_error_sp + cmp eax, 10000h + jae find_error_sp + cmp ecx, 10000h + jae find_error_sp + cmp ax, [si+2] + jae find_error_sp + cmp cx, [si+2] + ja find_error_sp + add si, 3 + add si, ax + mov di, bx + rep movsb + pop ax + ret +.nonresident: + mov edi, [cluster_size] + div edi + mov [ofs], dx + add cx, dx + push eax + xchg eax, ecx + xor edx, edx + dec eax + div edi + inc eax + xchg eax, ecx + pop eax + add si, 1 + xor edx, edx + push bx +; eax=offset in clusters, ecx=size in clusters +.scan: + mov ebx, [si] + test ebx, ebx + jz .notfound + add edx, ebx + add si, 8 + cmp eax, edx + jae .scan + mov edi, [si-4] +; now edx=end of block, ebx=length of block, edi=start of block on disk +; eax=required offset, ecx=required length + push edx + push edi + sub edx, eax + add edi, ebx + sub edi, edx + cmp edx, ecx + jb @f + mov edx, ecx +@@: +; read (edx) clusters from (edi=disk offset in clusters) to ([esp+8]) + cmp [ofs], 0 + jnz .ofs_read +.cont: + pushad + movzx ebx, byte [50Dh] +; xchg eax, edx +; mul ebx + xchg ax, dx + mul bx + xchg cx, ax + xchg eax, edi + mul ebx + mov bx, [esp+8+20h] + call relative_read + mov [esp+8+20h], bx + popad +.cont2: + add eax, edx + sub ecx, edx +.cont3: + pop edi + pop edx + jnz .scan + pop bx + pop ax + ret +.ofs_read: + push ecx + movzx ecx, byte [50Dh] ; bpb_sects_per_clust + mov eax, edi + push edx + mul ecx + push 1000h + pop es + xor bx, bx + call relative_read + mov cx, bx + push si + push di + mov si, [ofs] + mov di, [esp+8+12] + sub cx, si + push ds + push es + pop ds + pop es + rep movsb + mov [esp+8+12], di + push es + pop ds + pop di + pop si + pop edx + pop ecx + inc edi + mov [ofs], 0 + inc eax + dec ecx + jz .cont3 + dec edx + jnz .cont + jmp .cont2 +.notfound: + mov si, invalid_read_request_string + jmp find_error_si + +ntfs_parse_dir: +; in: eax=directory iRecord, [word sp+2]=filename +; out: si=$DATA attribute of file + mov bx, [free] + mov [dir], bx + push bx + call read_file_record + mov ax, word [frs_size] + add [free], ax + pop di +; find attributes $INDEX_ROOT, $INDEX_ALLOCATION, $BITMAP + mov ax, 90h ; $INDEX_ROOT + push di + mov bx, [free] + mov [index_root], bx + call load_attr + mov si, noindex_string + jc find_error_si + mov [free], bx + pop di + mov ax, 0A0h ; $INDEX_ALLOCATION + mov bx, [free] + mov [index_alloc], bx + call load_attr + jnc @f + mov [index_alloc], 0 +@@: + mov [free], bx +; search for entry + mov si, [index_root] + mov bx, [free] + call read_attr_full + mov ebp, [bx+8] ; subnode_size + add bx, 10h +.scan_record: + add bx, [bx] +.scan: + test byte [bx+0Ch], 2 + jnz .not_found + mov si, [esp+2] + movzx cx, byte [bx+50h] ; namelen + lea di, [bx+52h] ; name + xor ax, ax +@@: + lodsb + cmp al, 'a' + jb .notletter + cmp al, 'z' + ja .notletter + or byte [di], 20h +.notletter: + scasw + loopz @b + jb .not_found + ja @f + cmp byte [esi], 0 + jz .file_found +@@: + add bx, [bx+8] + jmp .scan +.not_found: + test byte [bx+0Ch], 1 + jz file_not_found + cmp [index_alloc], 0 + jz file_not_found + add bx, [bx+8] + mov eax, [bx-8] + mul [cluster_size] + mov si, [index_alloc] + mov ecx, ebp + mov bx, [free] + call read_attr + mov di, [free] + call restore_usa + mov bx, [free] + add bx, 18h + jmp .scan_record +.file_found: + mov si, [esp+2] + mov [cur_obj], si + cmp byte [esp+4], 0 + jz .need_file + mov si, notdir_string + test byte [bx+48h+3], 10h + jz find_error_si + mov eax, [bx] + mov bx, [dir] + mov [free], bx + ret 2 +.need_file: + mov si, directory_string + test byte [bx+48h+3], 10h ; directory? + jnz find_error_si +; read entry + mov eax, [bx] + mov bx, [dir] + mov [free], bx + mov bx, 4000h + push bx + call read_file_record + pop di + mov ax, 80h + push 2000h + pop es + xor bx, bx + call load_attr + mov si, nodata_string + jz find_error_si + mov [free], bx + ret 2 diff --git a/programs/hd_load/mtldr/vista_install.bat b/programs/hd_load/mtldr/vista_install.bat new file mode 100644 index 0000000000..b2fd812410 --- /dev/null +++ b/programs/hd_load/mtldr/vista_install.bat @@ -0,0 +1,4 @@ +bcdedit /create {AA48ABEF-FF35-4f09-874F-4CFF92467DC4} /d "KolibriOS" /application BOOTSECTOR +bcdedit /set {AA48ABEF-FF35-4f09-874F-4CFF92467DC4} DEVICE PARTITION=C: +bcdedit /set {AA48ABEF-FF35-4f09-874F-4CFF92467DC4} PATH \mtldr +bcdedit /displayorder {AA48ABEF-FF35-4f09-874F-4CFF92467DC4} /addlast \ No newline at end of file diff --git a/programs/hd_load/mtldr/vista_remove.bat b/programs/hd_load/mtldr/vista_remove.bat new file mode 100644 index 0000000000..dc9464484e --- /dev/null +++ b/programs/hd_load/mtldr/vista_remove.bat @@ -0,0 +1 @@ +bcdedit /delete {AA48ABEF-FF35-4f09-874F-4CFF92467DC4} \ No newline at end of file diff --git a/programs/hd_load/mtldr_install/compile.bat b/programs/hd_load/mtldr_install/compile.bat new file mode 100644 index 0000000000..c84690ebd3 --- /dev/null +++ b/programs/hd_load/mtldr_install/compile.bat @@ -0,0 +1 @@ +fasm mtldr_install.asm \ No newline at end of file diff --git a/programs/hd_load/mtldr_install/mtldr_code/compile.bat b/programs/hd_load/mtldr_install/mtldr_code/compile.bat new file mode 100644 index 0000000000..7a72cad097 --- /dev/null +++ b/programs/hd_load/mtldr_install/mtldr_code/compile.bat @@ -0,0 +1 @@ +fasm mtldr.asm ..\mtldr_for_installer diff --git a/programs/hd_load/mtldr_install/mtldr_code/fat32.inc b/programs/hd_load/mtldr_install/mtldr_code/fat32.inc new file mode 100644 index 0000000000..197c6260db --- /dev/null +++ b/programs/hd_load/mtldr_install/mtldr_code/fat32.inc @@ -0,0 +1,112 @@ +fat32_parse_dir: +; in: eax=directory cluster +; out: eax=entry cluster + mov bx, 900h + mov di, bx + push eax + call read_cluster + mov cx, word [cluster_size] + shr cx, 5 ; div 20h +.scan_cluster: + pop eax + cmp byte [di], 0 + jz file_not_found + mov si, [esp+2] + push eax + call fat_compare_name + jz .file_found + and di, not 1Fh + add di, 20h + loop .scan_cluster + pop eax + call next_cluster + jnc file_not_found + jc fat32_parse_dir +.file_found: + pop eax + mov si, [esp+2] + mov [cur_obj], si + and di, not 1Fh + mov si, directory_string + mov ax, [di+14h] + shl eax, 10h + mov ax, [di+1Ah] + test eax, eax + mov si, nodata_string + jz find_error_si + ret 2 + +fat_compare_name: + push cx + mov cx, 9 +.scan: + lodsb + cmp al, '.' + jz .ext + cmp al, 0 + jz .nameend + cmp al, 'a' + jb .notletter + cmp al, 'z' + ja .notletter + or byte [di], 20h +.notletter: + scasb + loopz .scan +.notfound: + inc cx ; to clear ZF flag + pop cx + ret +.ext: + mov al, ' ' + dec cx + repz scasb + jnz .notfound + test di, 1 + jnz .notfound + mov cx, 4 + jmp .scan +.nameend: + mov al, ' ' + dec cx + repz scasb + jnz .notfound + test di, 1 + jnz .file_found + mov cx, 3 + repz scasb + jnz .notfound +.file_found: + xor cx, cx ; to set ZF flag + pop cx + ret + +read_cluster: +; in: eax=cluster,bx->buffer + and eax, 0FFFFFFFh + movzx ecx, byte [50Dh] ; sects_per_clust + mul ecx + add eax, [data_start] +; call read +; ret + jmp relative_read +next_cluster: + mov bx, 700h +; sector is 200h bytes long, one entry in FAT occupies 4 bytes => 80h entries in sector + push eax + shr eax, 7 ; div 80h + cmp eax, [fat_cur_sector] + jz @f + mov [fat_cur_sector], eax + add eax, [fat_start] + mov cx, 1 + call relative_read +@@: + pop eax + and eax, 7Fh + mov eax, [700h+eax*4] + and eax, 0FFFFFFFh + cmp eax, 0FFFFFF7h + mov si, bad_cluster_string + jz find_error_si + ret diff --git a/programs/hd_load/mtldr_install/mtldr_code/mtldr.asm b/programs/hd_load/mtldr_install/mtldr_code/mtldr.asm new file mode 100644 index 0000000000..805089d34a --- /dev/null +++ b/programs/hd_load/mtldr_install/mtldr_code/mtldr.asm @@ -0,0 +1,786 @@ +; KolibriOS bootloader +; this code has been written by diamond in 2005,2006 specially for KolibriOS + +; this code is loaded by ntldr to 0D00:0000 +; and by io.sys from config.sys to xxxx:0100 +; and by bootmgr in vista to 0000:7C00 + format binary + use16 + + org 0xD000 + +; entry point for 9x booting + call @f +; db 'd' xor 'i' xor 'a' xor 'm' xor 'o' xor 'n' xor 'd' + db 'NTFS' + +; file offset +7 +; may be changed by installator +boot_drive db 80h +partition_start dd -1 +imgnameofs dw menuet_img_name + +@@: + pop si + sub si, 3 + cmp si, 7C00h + jz boot_vista + mov si, load_question + 100h - 0D000h + call out_string + mov si, answer + 100h - 0D000h +xxy: mov ah, 0 + int 16h + or al, 20h + mov [si], al + cmp al, 'y' + jz xxz + cmp al, 'n' + jnz xxy +; continue load Windows +; call out_string +; ret +out_string: + lodsb + test al, al + jz .xxx + mov ah, 0Eh + mov bx, 7 + int 10h + jmp out_string +.xxx: ret +xxz: +; boot KolibriOS + call out_string + push 0 + pop ds + mov word [4], new01handler + 100h - 0D000h + mov [6], cs + pushf + pop ax + or ah, 1 + push ax + popf +; int 19h +; pushf ; there will be no iret + call far [19h*4] +xxt: +; TF has been cleared when entered new01handler +; pushf +; pop ax +; and ah, not 1 +; push ax +; popf + push 0 + pop ds + cmp word [8*4+2], 0F000h + jz @f + les bx, [8*4] + mov eax, [es:bx+1] + mov [8*4], eax +@@: + mov si, 100h +boot_vista: + xor di, di + push cs + pop ds + push 0D00h + pop es + mov cx, 2000h/2 + rep movsw + jmp 0D00h:0256h + +new01handler: +; [sp]=ip, [sp+2]=cs, [sp+4]=flags + push bp + mov bp, sp + push bx + push ds + lds bx, [bp+2] + cmp word [bx], 19cdh + jz xxt + pop ds + pop bx + pop bp + iret + +relative_read: + add eax, [partition_start] + +; read from hard disk +; drive_size must be already initialized +; in: eax = absolute sector +; cx = number of sectors +; es:bx -> buffer +read: + pushad + cmp eax, [drive_size] + jb .old_style + xor dx, dx +; new style - LBA, function 42 + cmp [has_lba], dl + jz disk_error +; allocate disk address packet on the stack +; qword +8: absolute block number + push dx + push dx +; push dword 0 ; dword +C is high dword + push eax ; dword +8 is low dword +; dword +4: buffer address + push es ; word +6 is segment + push bx ; word +4 is offset +; word +2: number of blocks = 1 + push 1 +; word +0: size of packet = 10h + push 10h +; now pair ss:sp contain address of disk address packet +.patch1: + mov ax, 4200h + mov dl, [boot_drive] + mov si, sp + push ds + push ss + pop ds + int 13h + pop ds + lea sp, [si+10h] +.end: + popad + jc disk_error + add bx, 200h + inc eax + dec cx + jnz read + ret +.old_style: +; old style - CHS, function 2 +; convert absolute sector in eax to cylinder-head-sector coordinates +; calculate sector + xor edx, edx + movzx ecx, [sectors] + div ecx +; sectors are counted from 1 + inc dl + mov cl, dl ; low 6 bits of cl = sector number +; calculate head number +; shld edx, eax, 10h ; convert eax to dx:ax + push eax + pop ax + pop dx + div [heads] + mov dh, dl ; dh = head + mov ch, al ; ch = low 8 bits of cylinder + shl ah, 6 + or cl, ah ; high 2 bits of cl = high 2 bits of cylinder +.patch2: + mov ax, 201h ; function 2, al=1 - number of sectors + mov dl, [boot_drive] + int 13h + jmp .end + +disk_error: + mov si, disk_error_msg + call out_string + jmp $ + +answer db ? + db 13,10 +has_lba db 0 + +disk_error_msg db 'Disk read error!',0 +start_msg db 2,' KolibriOS bootloader, running on ',0 +errfs_msg db 'unknown filesystem, cannot continue',0 +fat16_msg db 'FAT12/FAT16 - unsupported',13,10,0 +fat32_msg db 'FAT32',13,10,0 +ntfs_msg db 'NTFS',13,10,0 +error_msg db 'Error' +colon db ': ',0 +mft_string db 'MFT',0 +root_string db '\',0 +noindex_string db '$INDEX_ROOT not found',0 +invalid_read_request_string db 'cannot read attribute',0 +nodata_string db '$DATA ' +notfound_string db 'not found',0 +directory_string db 'is a directory',0 +notdir_string db 'not a directory',0 +fragmented_string db 'too fragmented file',0 +bad_cluster_string db 'bad cluster',0 +exmem_string db 'extended memory error',0 + +load_question db 'Load KolibriOS? [y/n]: ',0 + + repeat 0D256h - $ + db 1 + end repeat + +start: + xor ax, ax + mov ds, ax + mov es, ax +; our stack is 4Kb-2b!!! (0xFFE) + mov ss, ax + mov esp, 0FFFEh + cld + sti +; calculate drive size + mov dl, [boot_drive] + mov ah, 8 ; 8 = get drive parameters + int 13h +; now: CF is set on error; +; ch = low 8 bits of maximum cylinder number +; cl : low 6 bits makes maximum sector number, high 2 bits are high 2 bits of maximum cylinder number +; dh = maximum head number + jnc @f + mov cx, -1 + mov dh, cl +@@: + movzx ax, dh + inc ax +; ax = number of heads + mov [heads], ax + mov dl, cl + and dx, 3Fh +; dx = number of sectors +; (note that sectors are counted from 1, and maximum sector number = number of sectors) + mov [sectors], dx + mul dx + xchg cl, ch + shr ch, 6 + inc cx +; cx = number of cylinders + mov [cyls], cx + mul cx + mov word [drive_size], ax + mov word [drive_size+2], dx +; this drive supports LBA? + mov dl, [boot_drive] + mov ah, 41h + mov bx, 55AAh + int 13h + jc .no_lba + cmp bx, 0AA55h + jnz .no_lba + test cl, 1 + jz .no_lba + inc [has_lba] +.no_lba: +; say hi to user + mov si, start_msg + call out_string + mov eax, [partition_start] + cmp eax, -1 + jnz @f +; now read first sector to determine file system type +; first sector of disk is MBR sector + xor eax, eax + mov cx, 1 + mov bx, 500h + call read + mov eax, [6C6h] ; first disk + mov [partition_start], eax +@@: + mov cx, 1 + mov bx, 500h + call read + movzx ax, byte [50Dh] + mov [sect_per_clust], ax +; determine file system + cmp dword [536h], 'FAT1' + jz fat1x + cmp dword [552h], 'FAT3' + jz fat32 + cmp dword [503h], 'NTFS' + jz ntfs +; mov si, errfs_msg ; already is + call out_string + jmp $ +fat1x: + mov si, fat16_msg + call out_string + jmp $ +fat32: + mov si, fat32_msg + call out_string + movzx eax, word [50Bh] ; bytes_per_sect + movzx ebx, byte [50Dh] ; sects_per_clust + mul ebx + mov [cluster_size], eax + movzx ebx, word [50Eh] ; reserved_sect + mov [fat_start], ebx + movzx eax, byte [510h] ; num_fats + mul dword [524h] ; sect_fat + add eax, ebx +; cluster 2 begins from sector eax + movzx ebx, byte [50Dh] ; sects_per_clust + sub eax, ebx + sub eax, ebx + mov [data_start], eax +; parse image name + mov eax, [52Ch] ; root_cluster + mov [cur_obj], root_string +.parsedir: + push ax + mov si, [imgnameofs] + push si +@@: + lodsb + cmp al, '\' + jz @f + cmp al, 0 + jnz @b +@@: + xchg ax, [esp+2] + mov byte [si-1], 0 + mov [imgnameofs], si + call fat32_parse_dir + pop cx + test cl, cl + jz .end + test byte [di+0Bh], 10h + mov si, notdir_string + jz find_error_si + jmp .parsedir +.end: + test byte [di+0Bh], 10h + mov si, directory_string + jnz find_error_si +; parse FAT chunk +; runlist at 2000:0000 + mov di, 5 + push 2000h + pop es + mov byte [es:di-5], 1 ; of course, non-resident + mov dword [es:di-4], 1 + stosd +.parsefat: + push es + push ds + pop es + call next_cluster + pop es + jnc .done + mov ecx, [es:di-8] + add ecx, [es:di-4] + cmp eax, ecx + jz .contc + mov dword [es:di], 1 + scasd + stosd + jmp .parsefat +.contc: + inc dword [es:di-8] + jmp .parsefat +.done: + xor eax, eax + stosd + jmp read_img_file + +ntfs: + mov si, ntfs_msg + call out_string + movzx eax, word [50Bh] ; bpb_bytes_per_sect + push eax + movzx ebx, byte [50Dh] ; bpb_sects_per_clust + mul ebx + mov [cluster_size], eax + mov [data_start], 0 + mov ecx, [540h] ; frs_size + cmp cl, 0 + jg .1 + neg cl + xor eax, eax + inc eax + shl eax, cl + jmp .2 +.1: + mul ecx +.2: + mov [frs_size], eax + pop ebx + xor edx, edx + div ebx + mov [frs_sectors], ax +; read first MFT record - description of MFT itself + mov [cur_obj], mft_string + movzx eax, byte [50Dh] ; bpb_sects_per_clust + mul dword [530h] ; mft_cluster + mov cx, [frs_sectors] + mov bx, 4000h + mov di, bx + push bx + call relative_read + call restore_usa +; scan for unnamed $DATA attribute + pop di + mov ax, 80h ; $DATA + mov bx, 700h + call load_attr + mov si, nodata_string + jc find_error_si + mov [free], bx +; load menuet.img +; parse image name + mov eax, 5 ; root cluster + mov [cur_obj], root_string +.parsedir: + push ax + mov si, [imgnameofs] + push si +@@: + lodsb + cmp al, '\' + jz @f + cmp al, 0 + jnz @b +@@: + xchg ax, [esp+2] + mov byte [si-1], 0 + mov [imgnameofs], si + call ntfs_parse_dir + pop cx + test cl, cl + jnz .parsedir +read_img_file: + xor si, si + push es + pop fs +; yes! Now read file to 0x100000 + lods byte [fs:si] + cmp al, 0 ; assume nonresident attr + mov si, invalid_read_request_string + jz find_error_si + mov si, 1 + xor edi, edi +; read buffer to 1000:0000 and move it to extended memory + push 1000h + pop es + xor bx, bx +.img_read_block: + lods dword [fs:si] ; eax=length + xchg eax, ecx + jecxz .img_read_done + lods dword [fs:si] ; eax=disk cluster +.img_read_cluster: + pushad +; read part of file + movzx ecx, byte [50Dh] + mul ecx + add eax, [data_start] + call relative_read +; move it to extended memory + mov ah, 87h + mov ecx, [cluster_size] + push ecx + shr cx, 1 + mov si, movedesc + push es + push ds + pop es + int 15h + pop es + test ah, ah + mov si, exmem_string + jnz find_error_si + pop ecx + add [dest_addr], ecx + popad + inc eax + loop .img_read_cluster + jmp .img_read_block +.img_read_done: +; menuet.img loaded; now load kernel.mnt +load_kernel: + push ds + pop es + mov [cur_obj], kernel_mnt_name +; read boot sector + xor eax, eax + mov bx, 500h + mov cx, 1 + call read_img +; init vars + mov ax, [50Eh] ; reserved_sect + add ax, [51Ch] ; hidden + mov word [fat_start], ax + xchg ax, bx + movzx ax, byte [510h] ; num_fats + mul word [516h] ; fat_length + add ax, bx +; read root dir + mov bx, 700h + mov cx, [511h] ; dir_entries + add cx, 0Fh + shr cx, 4 + call read_img + add ax, cx + mov [img_data_start], ax + shl cx, 9 + mov di, bx + add bx, cx + mov byte [bx], 0 +.scan_loop: + cmp byte [di], 0 + mov si, notfound_string + jz find_error_si + mov si, kernel_mnt_name + call fat_compare_name + jz .found + and di, not 1Fh + add di, 20h + jmp .scan_loop +.found: + and di, not 1Fh + mov si, directory_string + test byte [di+0Bh], 10h + jnz find_error_si +; found, now load it to 1000h:0000h + mov ax, [di+1Ah] +; first cluster of kernel.mnt in ax +; translate it to sector on disk in menuet.img + push ax + dec ax + dec ax + movzx cx, byte [50Dh] + mul cx + add ax, [img_data_start] +; now ax is sector in menuet.img + mov [kernel_mnt_in_img], ax + div [sect_per_clust] +; now ax is cluster in menuet.img and +; dx is offset from the beginning of cluster + movzx eax, ax + push 2000h + pop ds + mov si, 1 +.scani: + sub eax, [si] + jb .scanidone +; sanity check + cmp dword [si], 0 + push invalid_read_request_string + jz find_error_sp + pop cx +; next chunk + add si, 8 + jmp .scani +.scanidone: + add eax, [si] ; undo last subtract + add eax, [si+4] ; get cluster + push 0 + pop ds + movzx ecx, [sect_per_clust] + push dx + mul ecx ; get sector + pop dx + movzx edx, dx + add eax, edx + add eax, [data_start] + mov [kernel_mnt_1st], eax + pop ax + push 1000h + pop es +.read_loop: + push ax + xor bx, bx + call img_read_cluster + shl cx, 9-4 + mov ax, es + add ax, cx + mov es, ax + pop ax + call img_next_cluster + jc .read_loop + mov ax, 'KL' + mov si, loader_block + jmp 1000h:0000h + +img_next_cluster: + mov bx, 700h + push ax + shr ax, 1 + add ax, [esp] + mov dx, ax + shr ax, 9 + add ax, word [fat_start] + mov cx, 2 + push es + push ds + pop es + call read_img + pop es + and dx, 1FFh + add bx, dx + mov ax, [bx] + pop cx + test cx, 1 + jz .1 + shr ax, 4 +.1: + and ax, 0FFFh + mov si, bad_cluster_string + cmp ax, 0FF7h + jz find_error_si + ret +img_read_cluster: + dec ax + dec ax + movzx cx, byte [50Dh] ; sects_per_clust + mul cx + add ax, [img_data_start] + movzx eax, ax +; call read_img +; ret +read_img: +; in: ax = sector, es:bx->buffer, cx=length in sectors + pushad + movzx ebx, bx + mov si, movedesc + shl eax, 9 + add eax, 93100000h + mov dword [si+sou_addr-movedesc], eax + mov eax, 9300000h + mov ax, es + shl eax, 4 + add eax, ebx + mov [si+dest_addr-movedesc], eax + mov ah, 87h + shl cx, 8 ; mul 200h/2 + push es + push 0 + pop es + int 15h + pop es + cmp ah, 0 + mov si, exmem_string + jnz find_error_si + popad + ret + +movedesc: + times 16 db 0 +; source + dw 0xFFFF ; segment length +sou_addr dw 0000h ; linear address + db 1 ; linear address + db 93h ; access rights + dw 0 +; destination + dw 0xFFFF ; segment length +dest_addr dd 93100000h ; high byte contains access rights + ; three low bytes contains linear address (updated when reading) + dw 0 + times 32 db 0 + +find_error_si: + push si +find_error_sp: + mov si, error_msg + call out_string + mov si, [cur_obj] + call out_string + mov si, colon + call out_string + pop si + call out_string + jmp $ + +file_not_found: + mov si, [esp+2] + mov [cur_obj], si + push notfound_string + jmp find_error_sp + + include 'fat32.inc' + include 'ntfs.inc' + +write1st: +; callback from kernel.mnt +; write first sector of kernel.mnt from 1000:0000 back to disk + push cs + pop ds + push cs + pop es +; sanity check + mov bx, 500h + mov si, bx + mov cx, 1 + push cx + mov eax, [kernel_mnt_1st] + push eax + call relative_read + push 1000h + pop es + xor di, di + mov cx, 8 + repz cmpsw + mov si, data_error_msg + jnz find_error_si +; ok, now write back to disk + or byte [read.patch1+2], 1 + or byte [read.patch2+2], 1 + xor bx, bx + pop eax + pop cx + call relative_read + and byte [read.patch1+1], not 1 + and byte [read.patch2+2], not 2 +; and to image in memory (probably this may be done by kernel.mnt itself?) + mov dword [sou_addr], 93010000h + movzx eax, [kernel_mnt_in_img] + shl eax, 9 + add eax, 93100000h + mov dword [dest_addr], eax + mov si, movedesc + push ds + pop es + mov ah, 87h + mov cx, 100h + int 15h + cmp ah, 0 + mov si, exmem_string + jnz find_error_si + retf + +loader_block: + db 1 ; version + dw 1 ; flags - image is loaded + dw write1st ; offset + dw 0 ; segment + +fat_cur_sector dd -1 + +data_error_msg db 'data error',0 + +; ----------------------------------------------- +; ------------------ Settings ------------------- +; ----------------------------------------------- + +; must be in lowercase, see ntfs_parse_dir.scan, fat32_parse_dir.scan +kernel_mnt_name db 'kernel.mnt',0 + +; will be initialized by installer +menuet_img_name rb 300 + +; uninitialized data follows +drive_size dd ? ; in sectors +heads dw ? +sectors dw ? +cyls dw ? +free dw ? +cur_obj dw ? +data_start dd ? +img_data_start dw ? +sect_per_clust dw ? +kernel_mnt_in_img dw ? +kernel_mnt_1st dd ? +; NTFS data +cluster_size dd ? ; in bytes +frs_size dd ? ; in bytes +frs_sectors dw ? ; in sectors +mft_data_attr dw ? +index_root dw ? +index_alloc dw ? +ofs dw ? +dir dw ? +; FAT32 data +fat_start dd ? +cur_cluster dd ? diff --git a/programs/hd_load/mtldr_install/mtldr_code/ntfs.inc b/programs/hd_load/mtldr_install/mtldr_code/ntfs.inc new file mode 100644 index 0000000000..1b38f5478f --- /dev/null +++ b/programs/hd_load/mtldr_install/mtldr_code/ntfs.inc @@ -0,0 +1,531 @@ +restore_usa: +; Update Sequence Array restore + mov bx, [di+4] + mov cx, [di+6] + inc bx + add bx, di + inc bx + add di, 1feh + dec cx +@@: + mov ax, [bx] + stosw + inc bx + inc bx + add di, 1feh + loop @b + ret + +find_attr: +; in: di->file record, ax=attribute +; out: di->attribute or di=0 if not found + add di, [di+14h] +.1: +; attributes codes are formally dwords, but all they fit in word + cmp word [di], -1 + jz .notfound + cmp word [di], ax + jnz .continue +; for $DATA attribute, scan only unnamed + cmp ax, 80h + jnz .found + cmp byte [di+9], 0 + jz .found +.continue: + add di, [di+4] + jmp .1 +.notfound: + xor di, di +.found: + ret + +process_mcb_nonres: +; in: si->attribute, es:di->buffer +; out: di->buffer end + add si, [si+20h] + xor ebx, ebx +.loop: + lodsb + test al, al + jz .done + push invalid_read_request_string + movzx cx, al + shr cx, 4 + jz find_error_sp + xchg ax, dx + and dx, 0Fh + jz find_error_sp + add si, cx + add si, dx + pop ax + push si + dec si + movsx eax, byte [si] + dec cx + jz .l1e +.l1: + dec si + shl eax, 8 + mov al, [si] + loop .l1 +.l1e: + xchg ebp, eax + dec si + movsx eax, byte [si] + mov cx, dx + dec cx + jz .l2e +.l2: + dec si + shl eax, 8 + mov al, byte [si] + loop .l2 +.l2e: + pop si + add ebx, ebp +; eax=length, ebx=disk block + stosd + mov eax, ebx + stosd + jmp .loop +.done: + xor eax, eax + stosd + ret + +load_attr: +; in: ax=attribute, es:bx->buffer, di->base record +; out: bx->buffer end; CF set if not found + push di + push ax + mov byte [es:bx], 1 + inc bx + push bx + mov [ofs], bx +; scan for attrubute + add di, [di+14h] +@@: + call find_attr.1 + test di, di + jz .notfound1 + cmp byte [di+8], 0 + jnz .nonresident + jmp .resident +.aux_resident: + push di + popad +; resident attribute +.resident: + mov si, di + pop di + dec di + mov al, 0 + stosb + mov ax, [si+10h] + stosw + xchg ax, cx + add si, [si+14h] + rep movsb + mov bx, di + pop ax + pop di + ret +.nonresident: +; nonresident attribute + cmp dword [di+10h], 0 + jnz @b +; read start of data + mov si, di + pop di + call process_mcb_nonres + sub di, 4 + push di +.notfound1: +; $ATTRIBUTE_LIST is always in base file record + cmp word [esp+2], 20h + jz .nofragmented +; scan for $ATTRIBUTE_LIST = 20h + mov di, [esp+4] + mov ax, 20h + call find_attr + test di, di + jz .nofragmented +; load $ATTRIBUTE_LIST itself + push es + mov bx, 0C000h + mov di, [esp+6] + push bx + push [ofs] + push ds + pop es + call load_attr + pop [ofs] + pop si + mov bx, 8000h + push bx + push si + call read_attr_full + pop si + pop bx + add dx, bx + mov ax, [esp+4] + pop es +.1: + cmp [bx], ax + jnz .continue1 +; only unnamed $DATA attributes! + cmp ax, 80h + jnz @f + cmp byte [bx+6], 0 + jnz .continue1 +@@: + cmp dword [bx+10h], 0 + jz .continue1 + cmp dword [bx+8], 0 + jnz @f + push ax + mov ax, [esp+2] + cmp ax, [ofs] + pop ax + jnz .continue1 +@@: + pushad + mov eax, [bx+10h] + mov bx, dx + push [ofs] + push es + push ds + pop es + call read_file_record + pop es + pop [ofs] + popad + pushad + pop di + mov di, dx + add di, [di+14h] +.2: + call find_attr.1 + cmp byte [di+8], 0 + jz .aux_resident + mov eax, [bx+8] + cmp eax, [di+10h] + jnz .2 + mov si, di + mov di, [esp+1Eh] + call process_mcb_nonres + sub di, 4 + mov [esp+1Eh], di + push di + popad +.continue1: + add bx, [bx+4] + cmp bx, dx + jb .1 +.nofragmented: + pop bx + pop ax + pop di + cmp bx, [ofs] + jnz @f + dec bx + stc + ret +@@: + add bx, 4 + ret + +read_attr_full: +; in: si->decoded attribute data, bx->buffer +; out: edx=length in bytes + lodsb + cmp al, 0 + jnz .nonresident +; resident + lodsw + movzx edx, ax + xchg ax, cx + mov di, bx + rep movsb + ret +.nonresident: +; nonresident :-) + xor edx, edx +.loop: + lodsd + xchg ecx, eax + jecxz .loopend + lodsd + xchg edi, eax +; read ecx clusters from cluster edi to es:bx +.intloop: + push ecx +; read 1 cluster from physical cluster edi to es:bx + mov ecx, [cluster_size] + mov eax, edi + mul ecx + push bx + call relative_read + pop bx + pop ecx + inc edi + mov eax, [cluster_size] + add edx, eax + shr eax, 4 + mov bp, es + add bp, ax + mov es, bp + loop .intloop + jmp .loop +.loopend: + mov es, cx + ret + +read_file_record: +; in: eax=index of record, bx=buffer + mov si, 700h + mov ecx, [frs_size] + mul ecx + push bx + push [cur_obj] + mov [cur_obj], mft_string + call read_attr + pop [cur_obj] + pop di + call restore_usa + ret +read_attr: +; in: edx:eax=offset in bytes, ecx=size in bytes, bx=buffer, si=attribute + push invalid_read_request_string + cmp byte [si], 0 + jnz .nonresident + test edx, edx + jnz find_error_sp + cmp eax, 10000h + jae find_error_sp + cmp ecx, 10000h + jae find_error_sp + cmp ax, [si+2] + jae find_error_sp + cmp cx, [si+2] + ja find_error_sp + add si, 3 + add si, ax + mov di, bx + rep movsb + pop ax + ret +.nonresident: + mov edi, [cluster_size] + div edi + mov [ofs], dx + add cx, dx + push eax + xchg eax, ecx + xor edx, edx + dec eax + div edi + inc eax + xchg eax, ecx + pop eax + add si, 1 + xor edx, edx + push bx +; eax=offset in clusters, ecx=size in clusters +.scan: + mov ebx, [si] + test ebx, ebx + jz .notfound + add edx, ebx + add si, 8 + cmp eax, edx + jae .scan + mov edi, [si-4] +; now edx=end of block, ebx=length of block, edi=start of block on disk +; eax=required offset, ecx=required length + push edx + push edi + sub edx, eax + add edi, ebx + sub edi, edx + cmp edx, ecx + jb @f + mov edx, ecx +@@: +; read (edx) clusters from (edi=disk offset in clusters) to ([esp+8]) + cmp [ofs], 0 + jnz .ofs_read +.cont: + pushad + movzx ebx, byte [50Dh] +; xchg eax, edx +; mul ebx + xchg ax, dx + mul bx + xchg cx, ax + xchg eax, edi + mul ebx + mov bx, [esp+8+20h] + call relative_read + mov [esp+8+20h], bx + popad +.cont2: + add eax, edx + sub ecx, edx +.cont3: + pop edi + pop edx + jnz .scan + pop bx + pop ax + ret +.ofs_read: + push ecx + movzx ecx, byte [50Dh] ; bpb_sects_per_clust + mov eax, edi + push edx + mul ecx + push 1000h + pop es + xor bx, bx + call relative_read + mov cx, bx + push si + push di + mov si, [ofs] + mov di, [esp+8+12] + sub cx, si + push ds + push es + pop ds + pop es + rep movsb + mov [esp+8+12], di + push es + pop ds + pop di + pop si + pop edx + pop ecx + inc edi + mov [ofs], 0 + inc eax + dec ecx + jz .cont3 + dec edx + jnz .cont + jmp .cont2 +.notfound: + mov si, invalid_read_request_string + jmp find_error_si + +ntfs_parse_dir: +; in: eax=directory iRecord, [word sp+2]=filename +; out: si=$DATA attribute of file + mov bx, [free] + mov [dir], bx + push bx + call read_file_record + mov ax, word [frs_size] + add [free], ax + pop di +; find attributes $INDEX_ROOT, $INDEX_ALLOCATION, $BITMAP + mov ax, 90h ; $INDEX_ROOT + push di + mov bx, [free] + mov [index_root], bx + call load_attr + mov si, noindex_string + jc find_error_si + mov [free], bx + pop di + mov ax, 0A0h ; $INDEX_ALLOCATION + mov bx, [free] + mov [index_alloc], bx + call load_attr + jnc @f + mov [index_alloc], 0 +@@: + mov [free], bx +; search for entry + mov si, [index_root] + mov bx, [free] + call read_attr_full + mov ebp, [bx+8] ; subnode_size + add bx, 10h +.scan_record: + add bx, [bx] +.scan: + test byte [bx+0Ch], 2 + jnz .not_found + mov si, [esp+2] + movzx cx, byte [bx+50h] ; namelen + lea di, [bx+52h] ; name + xor ax, ax +@@: + lodsb + cmp al, 'a' + jb .notletter + cmp al, 'z' + ja .notletter + or byte [di], 20h +.notletter: + scasw + loopz @b + jb .not_found + ja @f + cmp byte [esi], 0 + jz .file_found +@@: + add bx, [bx+8] + jmp .scan +.not_found: + test byte [bx+0Ch], 1 + jz file_not_found + cmp [index_alloc], 0 + jz file_not_found + add bx, [bx+8] + mov eax, [bx-8] + mul [cluster_size] + mov si, [index_alloc] + mov ecx, ebp + mov bx, [free] + call read_attr + mov di, [free] + call restore_usa + mov bx, [free] + add bx, 18h + jmp .scan_record +.file_found: + mov si, [esp+2] + mov [cur_obj], si + cmp byte [esp+4], 0 + jz .need_file + mov si, notdir_string + test byte [bx+48h+3], 10h + jz find_error_si + mov eax, [bx] + mov bx, [dir] + mov [free], bx + ret 2 +.need_file: + mov si, directory_string + test byte [bx+48h+3], 10h ; directory? + jnz find_error_si +; read entry + mov eax, [bx] + mov bx, [dir] + mov [free], bx + mov bx, 4000h + push bx + call read_file_record + pop di + mov ax, 80h + push 2000h + pop es + xor bx, bx + call load_attr + mov si, nodata_string + jz find_error_si + mov [free], bx + ret 2 diff --git a/programs/hd_load/mtldr_install/mtldr_install.asm b/programs/hd_load/mtldr_install/mtldr_install.asm new file mode 100644 index 0000000000..1412f85429 --- /dev/null +++ b/programs/hd_load/mtldr_install/mtldr_install.asm @@ -0,0 +1,1426 @@ + format PE GUI 4.0 +section '.text' code readable executable +entry start +start: + xor ebx, ebx + push ofn + call [GetOpenFileNameA] + test eax, eax + jnz @f + push ebx + call [ExitProcess] +@@: + call [GetVersion] + test eax, eax + sets [b9x] + js install_9x + mov [img_name+2], bl + push ebx + push ebx + push 3 + push ebx + push 3 + push 80000000h + push dn + call [CreateFileA] + inc eax + jnz @f +norights: + push 10h + push ebx + push norightsmsg +mbx: + push ebx + call [MessageBoxA] + push ebx + call [ExitProcess] +@@: + lea esi, [eax-1] + push ebx + push tmp + push 12 + push sdn + push ebx + push ebx + push 0x2D1080 + push esi + call [DeviceIoControl] + test eax, eax + jnz @f +cnr: + push esi + call [CloseHandle] + jmp norights +@@: + push ebx + push tmp + push 20h + push pi + push ebx + push ebx + push 0x74004 + push esi + call [DeviceIoControl] + test eax, eax + jz cnr + push esi + call [CloseHandle] + cmp [sdn], 7 + jz @f + push 10h + push 0 + push nohd + jmp mbx +@@: + mov al, byte [sdn+4] + or al, 80h + mov [mtldr_code+7], al + mov eax, [pi] + mov edx, [pi+4] + shrd eax, edx, 9 + shr edx, 9 + jz @f +m1e: push 10h + push ebx + push m1 + jmp mbx +@@: +install_cmn: + mov [mtldr_code+8], eax + mov esi, img_name + mov edi, img_real_name + mov byte [esi+2], '\' + push 256 + push edi + push esi + call [GetShortPathNameA] + cmp eax, 256 + jb @f + push 10h + push ebx + push ptl + jmp mbx +@@: + test eax, eax + jnz @f + push esi edi + mov ecx, 256/4 + rep movsd + pop edi esi +@@: + cmp byte [edi], 0 + jz lcd + cmp byte [edi], 'A' + jb lcc + cmp byte [edi], 'Z' + ja lcc + add byte [edi], 20h +lcc: + inc edi + jmp @b +lcd: + mov esi, img_real_name + cmp [b9x], 0 + jnz @f + cmp byte [esi], 'c' + jnz notc +@@: + push 256/4 + pop ecx + lea edi, [esi+ecx*4] + rep movsd + mov edi, esi + xor eax, eax + or ecx, -1 + repnz scasb + dec edi + std + mov al, '\' + repnz scasb + cld + inc edi + inc edi + mov eax, 'mtld' + stosd + mov al, 'r' + stosb + jmp cmn +notc: + mov dword [mtldr_name], 'C:\m' + mov dword [mtldr_name+4], 'tldr' + mov edi, mtldr_name+8 +cmn: + and word [edi], 0 +mf: + push mtldr_name + call [GetFileAttributesA] + inc eax + jnz @f + call [GetLastError] + cmp eax, 2 + jz fo +@@: + cmp byte [edi], 0 + jnz @f + mov byte [edi], '0' + jmp mf +@@: + cmp byte [edi], '9' + jae @f +mfi: + inc byte [edi] + jmp mf +@@: + ja @f + mov byte [edi], 'A' + jmp mf +@@: + cmp byte [edi], 'Z' + jb mfi +nomx: push 10h + push ebx + push nom + jmp mbx +fo: + cmp [b9x], 0 + jnz install_9x_2 + call write_mtldr1 + push ecx + call [GetVersion] + pop ecx + cmp al, 6 + jae install_vista + mov al, 2 + mov edi, tmp_data + neg ecx + add ecx, 2000h - mtldr_code_size + push ebx + push tmp + push ecx + push edi + push esi + rep stosb + call [WriteFile] + push esi + call [CloseHandle] + push bootini + mov edi, systitle+1 + mov esi, ostitle + mov byte [edi-1], '"' +@@: + lodsb + test al, al + jz @f + stosb + jmp @b +@@: + mov word [edi], '"' + push bootini + call [GetFileAttributesA] + push eax + and al, not 1 + push eax + push bootini + call [SetFileAttributesA] + push bootini + push systitle + push mtldr_name + push mtldr_name + push mtldr_name + call [CharToOemA] + push osstr + call [WritePrivateProfileStringA] + xchg eax, [esp] + push eax + push bootini + call [SetFileAttributesA] + pop eax + test eax, eax + jnz suci +; failed, delete written mtldr + call delete_mtldr + push 10h + push ebx + push insterr + jmp mbx +suci: + push 40h + push suct + push succ + jmp mbx + +install_9x: + mov al, [img_name] + or al, 20h + sub al, 'a'-1 + mov byte [regs], al + push ebx + push ebx + push 3 + push ebx + push 3 + push 80000000h + push vwin32 + call [CreateFileA] + inc eax + jz norights + dec eax + xchg eax, esi + push ebx + push tmp + push 28 + push regs + push 28 + push regs + push 1 + push esi + call [DeviceIoControl] + push eax + push esi + call [CloseHandle] + pop eax + test eax, eax +@@: jz norights + mov al, [diskinfobuf+3] + cmp al, 0xFF + jz @b + cmp al, 80h + jb norights + mov [mtldr_code+7], al + cmp dword [diskinfobuf+12], 0 + jnz m1e + mov eax, [diskinfobuf+8] + jmp install_cmn + +install_9x_2: + push ebx + push ebx + push 3 + push ebx + push 1 + push 80000000h + push config + call [CreateFileA] + inc eax + jnz @f +ie2: + push 10h + push ebx + push insterr2 + jmp mbx +@@: + dec eax + xchg eax, esi + push ebx + push esi + call [GetFileSize] + inc eax + jz ie2 + dec eax + xchg eax, ebp + push 4 + push 1000h + push ebp + push ebx + call [VirtualAlloc] + xchg eax, edi + test edi, edi + jz ie2 + push ebx + push tmp + push ebp + push edi + push esi + call [ReadFile] + push esi + call [CloseHandle] + push ebx + push 80h + push 2 + push ebx + push ebx + push 40000000h + push config + call [CreateFileA] + inc eax + jz ie2 + dec eax + xchg eax, esi + mov eax, dword [edi] + or eax, 0x20202000 + cmp eax, '[men' + jz menu + push ostitle + call [lstrlenA] + cmp eax, 17 + ja bt1 + push esi edi + mov esi, ostitle + mov edi, mtldr_code+23Ah + mov ecx, eax + rep movsb + mov dword [edi], '? [y' + mov dword [edi+4], '/n]:' + mov word [edi+8], ' ' + pop edi esi + jmp ct1 +bt1: + push img_real_name+3 + call [lstrlenA] + add eax, mtldr_code_size+1+100h + mov word [mtldr_code+0x19], ax +ct1: + push ebx + push tmp + push 8 + push install + push esi + call [WriteFile] +cfgd: + mov eax, mtldr_name + push eax + push eax + push eax + call [CharToOemA] + call [lstrlenA] + push ebx + push tmp + push eax + push mtldr_name + push esi + call [WriteFile] + push ebx + push tmp + push 2 + push newline + push esi + call [WriteFile] + push ebx + push tmp + push ebp + push edi + push esi + call [WriteFile] + push esi + call [CloseHandle] + call write_mtldr1 + push ostitle + call [lstrlenA] + cmp eax, 11 + jbe @f + push ebx + push tmp + push ld2sz + push ld2 + push esi + push ebx + push tmp + push eax + push ostitle + push esi + push ebx + push tmp + push ld1sz + push ld1 + push esi + call [WriteFile] + call [WriteFile] + call [WriteFile] +@@: + push esi + call [CloseHandle] + jmp suci +menu: + push edi + or ecx, -1 +mes: + mov al, 0xA + repnz scasb + cmp byte [edi], '[' + jz med + cmp dword [edi], 'menu' + jnz mes + cmp dword [edi+4], 'item' + jnz mes + cmp byte [edi+8], '=' + jnz mes + mov eax, [edi+9] + or eax, ' ' + cmp eax, 'koli' + jnz mes + mov eax, [edi+13] + and eax, 0xFFFFFF + or eax, ' ' + cmp eax, 'bri' + jnz mes + movzx eax, byte [edi+16] + or al, 0x20 + mov [menuitems+eax], 1 + jmp mes +med: + cmp word [edi-4], 0x0A0D + jnz @f + dec edi + dec edi + jmp med +@@: + sub edi, [esp] + push ebx + push tmp + push edi + push dword [esp+12] + push esi + call [WriteFile] + add [esp], edi + sub ebp, edi + mov ecx, 7 + cmp [menuitems+0x20], 0 + jnz @f + cmp [menuitems+','], 0 + jz mef +@@: + mov eax, '0' +mel1: + cmp [menuitems+eax], 0 + jz med1 + inc eax + cmp al, '9'+1 + jb mel1 + jnz @f + mov al, 'a' + jmp mel1 +@@: + cmp al, 'z' + jbe mel1 + push ebx + push tmp + push ebp + push dword [esp+12] + push esi + call [WriteFile] + push esi + call [CloseHandle] + jmp nomx +med1: + mov [menuitem+7], al + mov ecx, 8 +mef: + push ebx + push tmp + push ecx + push menuitem + push esi + push ebx + push tmp + push ecx + push menuitem + push esi + push ebx + push tmp + push 9 + push mis + push esi + call [WriteFile] + call [WriteFile] + push ebx + push tmp + push title9xsz + push title9x + push esi + call [WriteFile] + push ebx + push tmp + push ostitle + call [lstrlenA] + push eax + push ostitle + push esi + call [WriteFile] + push ebx + push tmp + push title9x2sz + push title9x2 + push esi + call [WriteFile] + call [WriteFile] + push ebx + push tmp + push 11 + push sec9x2 + push esi + call [WriteFile] + mov byte [mtldr_code+1], 37h + pop edi + jmp cfgd + +install_vista: + push esi + call [CloseHandle] + mov edi, sbn + call adjust_privilege + mov edi, srn + call adjust_privilege + push ebx + push ebx + call [CoInitializeEx] + test eax, eax + js we + push ebx + push ebx + push ebx + push 3 + push ebx + push ebx + push ebx + push -1 + push ebx + call [CoInitializeSecurity] + test eax, eax + jns @f +we2: + call [CoUninitialize] +we: + call delete_mtldr + push 10h + push ebx + push wmierr + jmp mbx +@@: + push ebx + push esp + push IID_IWbemLocator + push 1 + push ebx + push CLSID_WbemLocator + call [CoCreateInstance] + pop edi + test eax, eax + js we2 + push ebx + push esp + push ebx + push ebx + push ebx + push ebx + push ebx + push ebx + push ns + push edi + mov esi, [edi] + call dword [esi+12] + push eax + push edi + call dword [esi+8] + pop eax + pop edi + test eax, eax + js we2 + push ebx + push ebx + push 3 + push 3 + push ebx + push ebx + push 10 + push edi + call [CoSetProxyBlanket] + test eax, eax + jns @f +we3: + mov eax, [edi] + push edi + call dword [eax+8] + jmp we2 +@@: + xor esi, esi + push osp + push osn + push bs + call call_method + test eax, eax + js we3 + mov esi, guid + mov ebp, menuitems + push esi + call [CoCreateGuid] + push 2000h/2 + push ebp + push esi + call [StringFromGUID2] + mov esi, [varout+8] + push con + push bs + call call_method + jns @f +wecei: + mov ebp, coerr +wece: + mov eax, [esi] + push esi + call dword [eax+8] + mov eax, [edi] + push edi + call dword [eax+8] + call [CoUninitialize] + call delete_mtldr + push 10h + push ebx + push ebp + jmp mbx +@@: + pop eax + push esi + push eax + mov ebp, tmp_data + mov dword [vartmpstr+8], ebp + mov dword [vari32+8], 0x12000004 + push 2000h/2 + push ebp + push -1 + push ostitle + push ebx + push ebx + call [MultiByteToWideChar] + mov esi, [varout+8] + push ssen + push bo + call call_method + mov ebp, setproperr + js wece2 + sub dword [esp], 24 + mov byte [vari32+8], 2 + push 2000h/2 + push tmp_data + push -1 + push mtldr_name+2 + push ebx + push ebx + call [MultiByteToWideChar] + push ssen + push bo + call call_method + js wece2 + mov dword [vari32+8], 0x11000001 + mov ecx, tmp_data + mov dword [ecx], '\' + ('?' shl 16) + mov dword [ecx+4], '?' + ('\' shl 16) + xor eax, eax + mov dword [ecx+12], eax + mov al, [mtldr_name+1] + shl eax, 16 + mov al, [mtldr_name] + mov dword [ecx+8], eax + push spden + push bo + call call_method + js wece2 + mov eax, [esi] + push esi + call dword [eax+8] + pop eax + pop esi + push eax + push oon + push bs + call call_method + mov ebp, orerr + js wece3 + pop eax + push esi + push eax + mov esi, [varout+8] + mov dword [vari32+8], 0x24000001 + push gen + push bo + call call_method + js wece2 + push esi + mov esi, [varout+8] + push ebx + push ebx + push varout + push ebx + push idsn + mov eax, [esi] + push esi + call dword [eax+16] + push eax + mov eax, [esi] + push esi + call dword [eax+8] + pop eax + pop esi + test eax, eax + js wece2 + push esi + cmp word [varout], 2008h + jnz wece4 + mov esi, [varout+8] + cmp word [esi], 1 + jnz wece4 + push dword [esi+20] + mov eax, [esi+16] + inc eax + push eax + push esp + push esi + call [SafeArrayRedim] + pop ecx + pop ecx + test eax, eax + js wece4 + push menuitems + call [SysAllocString] + test eax, eax + jz wece4 + push eax + mov ecx, [esi+16] + add ecx, [esi+20] + dec ecx + push ecx + mov ecx, esp + push eax + push ecx + push esi + call [SafeArrayPutElement] + pop ecx + call [SysFreeString] + pop esi + push solen + push bo + call call_method + js wece2 + push varout + call [VariantClear] + mov eax, [esi] + push esi + call dword [eax+8] + pop eax + pop esi + mov eax, [esi] + push esi + call dword [eax+8] + mov eax, [edi] + push edi + call dword [eax+8] + call [CoUninitialize] + jmp suci +wece4: + pop esi +wece2: + mov eax, [esi] + push esi + call dword [eax+8] + pop eax + pop esi + push eax +wece3: + mov dword [vartmpstr+8], menuitems + pop eax + push dop + push don + push bs + call call_method + pop eax + jmp wece + +write_mtldr1: + push ebx + push 80h + push 2 + push ebx + push ebx + push 40000000h + push mtldr_name + call [CreateFileA] + inc eax + jnz @f + push 10h + push ebx + push noc + jmp mbx +@@: + dec eax + xchg eax, esi + push ebx + push tmp + push mtldr_code_size + push mtldr_code + push esi + call [WriteFile] + push img_real_name + push img_real_name + call [CharToOemA] + mov edi, img_real_name+3 + push edi + call [lstrlenA] + inc eax + push eax + push ebx + push tmp + push eax + push edi + push esi + call [WriteFile] + pop ecx + ret +delete_mtldr: + push mtldr_name + push mtldr_name + push mtldr_name + call [OemToCharA] + call [DeleteFileA] + ret + +adjust_privilege: + cmp [advapi32], 0 + jnz @f + push advapi32_name + call [LoadLibraryA] + mov [advapi32], eax + mov esi, eax + test esi, esi + jz ape + push opts + push esi + call [GetProcAddress] + mov [OpenProcessToken], eax + test eax, eax + jz ape + push lpvs + push esi + call [GetProcAddress] + mov [LookupPrivilegeValueA], eax + test eax, eax + jz ape + push atps + push esi + call [GetProcAddress] + mov [AdjustTokenPrivileges], eax + test eax, eax + jz ape +@@: + push ebx + push esp + push 28h + call [GetCurrentProcess] + push eax + call [OpenProcessToken] + test eax, eax + pop esi + jz ape + push 2 + push ebx + push ebx + mov eax, esp + push 1 + push eax + push edi + push ebx + call [LookupPrivilegeValueA] + test eax, eax + jz ape2 + mov eax, esp + push ebx + push ebx + push ebx + push eax + push ebx + push esi + call [AdjustTokenPrivileges] + test eax, eax + jz ape2 + add esp, 10h + push esi + call [CloseHandle] + ret +ape2: + add esp, 10h + push esi + call [CloseHandle] +ape: + push 10h + push ebx + push apf + jmp mbx + +call_method: + push ebx + mov eax, esp + push ebx + push eax + push ebx + push ebx + push dword [eax+8] + mov eax, [edi] + push edi + call dword [eax+24] + xchg edi, [esp] + test eax, eax + js r + push ebx + mov eax, esp + push ebx + push eax + push ebx + push dword [eax+16] + mov eax, [edi] + push edi + call dword [eax+76] + push eax + mov eax, [edi] + push edi + call dword [eax+8] + pop eax + pop edi + test eax, eax + js r + push ebx + push esp + push ebx + mov eax, [edi] + push edi + call dword [eax+60] + push eax + mov eax, [edi] + push edi + call dword [eax+8] + pop eax + pop edi + test eax, eax + js r +cml1: + mov eax, [esp+16] + add dword [esp+16], 8 + cmp dword [eax], 0 + jz cme1 + push ebx + push dword [eax+4] + push ebx + push dword [eax] + mov eax, [edi] + push edi + call dword [eax+20] + test eax, eax + js r2 + jmp cml1 +cme1: + and dword [varout], 0 + mov ecx, [esp+8] + test esi, esi + jz cms + push ebx + push ebx + push varout + push ebx + push rpn + mov eax, [esi] + push esi + call dword [eax+16] + test eax, eax + js r2 + cmp word [varout], 8 + jnz r2 + mov ecx, [varout+8] +cms: + pop edx + push edx + push ebx + mov eax, esp + push ebx + push eax + push edi + push ebx + push ebx + push dword [eax+16] + push ecx + mov eax, [edx] + push edx + call dword [eax+96] + push eax + mov eax, [edi] + push edi + call dword [eax+8] + push varout + call [VariantClear] + pop eax + pop edi + test eax, eax + js r + push ebx + push ebx + push varout + push ebx + push retvaln + mov eax, [edi] + push edi + call dword [eax+16] + test eax, eax + js r2 + mov eax, 80000000h + cmp word [varout], 11 + jnz r2 + cmp word [varout+8], 0 + jz r2 + mov eax, [esp+16] + mov eax, [eax-4] + test eax, eax + jz r2 + push ebx + push ebx + push varout + push ebx + push eax + mov eax, [edi] + push edi + call dword [eax+16] + test eax, eax + js r2 + cmp word [varout], 13 + setnz al + shl eax, 31 +r2: + push eax + mov eax, [edi] + push edi + call dword [eax+8] + pop eax +r: + pop edi + test eax, eax + ret 8 + +ofn_hook: + cmp dword [esp+8], 2 + jnz @f + push 260 + push ostitle + push 23 + push dword [esp+12+4] + call [GetDlgItemTextA] +@@: + xor eax, eax + ret 10h + +section '.data' data readable writable +data resource from 'rsrc.res' +end data + + align 4 +ofn: + dd 76 + dd 0 + dd ofn_title_template + dd filter + dd 0 + dd 0 + dd 0 + dd img_name + dd 100h + dd 0 + dd 0 + dd 0 + dd ofn_title + dd 818A4h + dd 0 + dd aImg + dd 0 + dd ofn_hook + dd 0 +ofn_title_template: + dw 1,-1 + dd 0 + dd 0 + dd 56000444h + dw 2 + dw 0,0,275,28 + dw 0,0,0 + dw 8 + dd 0 + du 'MS Sans Serif',0 + align 4 + dd 0 + dd 0 + dd 50010000h + dw 5,12,45,9 + dw -1 + dw 0 + dw -1,82h + du 'Title:',0 + dw 0 + align 4 + dd 0 + dd 204h + dd 50010080h + dw 54,10,218,12 + dw 23 + dw 0 + dw -1,81h + du 'KolibriOS',0 + dw 0 + +filter db 'Image files (*.img)',0,'*.img',0,'All files',0,'*.*',0,0 +ofn_title db 'Select KolibriOS image file',0 +aImg db 'img',0 +norightsmsg db 'Cannot query drive info.',10 + db 'Probably it is invalid drive or you are not administrator',0 +nohd db 'Image must be on hard disk!',0 +m1 db 'Please mail to diamondz@land.ru',0 +nom db "Too many mtldr's found!",0 +noc db 'Cannot create mtldr file!',0 +osstr db 'operating systems',0 +bootini db 'c:\boot.ini',0 +insterr db 'Cannot write to boot.ini. Probably you are not administrator.',0 +insterr2 db 'Cannot open config.sys',0 +ptl db 'Path is too long',0 +succ db 'Installation successful!',0 +suct db 'Success',0 +vwin32 db '\\.\vwin32',0 +config db 'C:\config.sys',0 +sec9x2 db ']',13,10 +install db 'install=' +newline db 13,10 +menuitem db 'kolibri',0 +mis db 'menuitem=' +title9x db ',Load ' +title9xsz = $ - title9x +title9x2 db 13,10,13,10,'[' +title9x2sz = $ - title9x2 +ld1 db 'Load ' +ld1sz = $ - ld1 +ld2 db '? [y/n]: ',0 +ld2sz = $ - ld2 +apf db 'Cannot adjust backup and restore privileges',0 +opts db 'OpenProcessToken',0 +lpvs db 'LookupPrivilegeValueA',0 +atps db 'AdjustTokenPrivileges',0 +sbn db 'SeBackupPrivilege',0 +srn db 'SeRestorePrivilege',0 +wmierr db 'BCD WMI API: initialization error',0 +coerr db 'Cannot create BCD object for KolibriOS loader',0 +setproperr db 'Cannot create BCD element in object for KolibriOS loader',0 +orerr db 'Cannot add KolibriOS loader in BCD display list',0 +ns du 'root\wmi',0 +retvaln du 'ReturnValue' +emptystr du 0 +rpn du '__Relpath',0 +bs du 'BcdStore',0 +bo du 'BcdObject',0 +osn du 'OpenStore',0 +con du 'CreateObject',0 +don du 'DeleteObject',0 +oon du 'OpenObject',0 +ssen du 'SetStringElement',0 +spden du 'SetPartitionDeviceElement',0 +gen du 'GetElement',0 +solen du 'SetObjectListElement',0 +fn du 'File',0 +storen du 'Store',0 +idn du 'Id',0 +idsn du 'Ids',0 +tn du 'Type',0 +obn du 'Object',0 +sn du 'String',0 +dtn du 'DeviceType',0 +aon du 'AdditionalOptions',0 +pn du 'Path',0 +en du 'Element',0 +bg du '{9dea862c-5cdd-4e70-acc1-f32b344d4795}',0 + +align 4 +advapi32 dd 0 + +regs: + dd 0 + dd diskinfobuf + dd 86Fh + dd 440Dh + dd 0 + dd 0 + dd 1 + +diskinfobuf: + db 10h,0,0,0FFh + times 0Ch db 0 + +IID_IWbemLocator: + dd 0DC12A687h + dw 737Fh + dw 11CFh + db 88h, 4Dh, 00h, 0AAh, 00h, 4Bh, 2Eh, 24h +CLSID_WbemLocator: + dd 4590F811h + dw 1D3Ah + dw 11D0h + db 89h, 1Fh, 00h, 0AAh, 00h, 4Bh, 2Eh, 24h +IID_IWbemClassObject: + dd 0DC12A681h + dw 737Fh + dw 11CFh + db 88h, 4Dh, 00h, 0AAh, 00h, 4Bh, 2Eh, 24h +varemptystr: + dd 8, 0, emptystr, 0 +vartmpstr: + dd 8, 0, menuitems, 0 +varbootmgr: + dd 8, 0, bg, 0 +vari32: + dd 3, 0, 10400008h, 0 +vari32_pd: + dd 3, 0, 2, 0 +osp: + dd fn, varemptystr + dd 0, storen + dd idn, vartmpstr + dd tn, vari32 + dd 0, obn + dd tn, vari32 + dd sn, vartmpstr + dd 0, 0 + dd tn, vari32 + dd dtn, vari32_pd + dd aon, varemptystr + dd pn, vartmpstr + dd 0, 0 + dd idn, varbootmgr + dd 0, obn + dd tn, vari32 + dd 0, en + dd tn, vari32 + dd idsn, varout + dd 0, 0 + +dop: + dd idn, vartmpstr + dd 0, 0 + +data import +macro thunk a +{a#_thunk:dw 0 +db `a,0} + dd 0,0,0, rva kernel32_name, rva kernel32_thunks + dd 0,0,0, rva user32_name, rva user32_thunks + dd 0,0,0, rva comdlg32_name, rva comdlg32_thunks + dd 0,0,0, rva ole32_name, rva ole32_thunks + dd 0,0,0, rva oleaut32_name, rva oleaut32_thunks + dd 0,0,0,0,0 +kernel32_name db 'kernel32.dll',0 +user32_name db 'user32.dll',0 +advapi32_name db 'advapi32.dll',0 +comdlg32_name db 'comdlg32.dll',0 +ole32_name db 'ole32.dll',0 +oleaut32_name db 'oleaut32.dll',0 + +kernel32_thunks: +GetVersion dd rva GetVersion_thunk +CreateFileA dd rva CreateFileA_thunk +DeviceIoControl dd rva DeviceIoControl_thunk +CloseHandle dd rva CloseHandle_thunk +GetFileAttributesA dd rva GetFileAttributesA_thunk +SetFileAttributesA dd rva SetFileAttributesA_thunk +GetLastError dd rva GetLastError_thunk +ReadFile dd rva ReadFile_thunk +WriteFile dd rva WriteFile_thunk +ExitProcess dd rva ExitProcess_thunk +WritePrivateProfileStringA dd rva WritePrivateProfileStringA_thunk +GetShortPathNameA dd rva GetShortPathNameA_thunk +lstrlenA dd rva lstrlenA_thunk +VirtualAlloc dd rva VirtualAlloc_thunk +GetFileSize dd rva GetFileSize_thunk +DeleteFileA dd rva DeleteFileA_thunk +MultiByteToWideChar dd rva MultiByteToWideChar_thunk +GetCurrentProcess dd rva GetCurrentProcess_thunk +LoadLibraryA dd rva LoadLibraryA_thunk +GetProcAddress dd rva GetProcAddress_thunk + dw 0 +thunk GetVersion +thunk CreateFileA +thunk DeviceIoControl +thunk CloseHandle +thunk GetFileAttributesA +thunk SetFileAttributesA +thunk GetLastError +thunk ReadFile +thunk WriteFile +thunk ExitProcess +thunk WritePrivateProfileStringA +thunk GetShortPathNameA +thunk lstrlenA +thunk VirtualAlloc +thunk GetFileSize +thunk DeleteFileA +thunk MultiByteToWideChar +thunk GetCurrentProcess +thunk LoadLibraryA +thunk GetProcAddress + +user32_thunks: +MessageBoxA dd rva MessageBoxA_thunk +CharToOemA dd rva CharToOemA_thunk +OemToCharA dd rva OemToCharA_thunk +GetDlgItemTextA dd rva GetDlgItemTextA_thunk + dw 0 +thunk MessageBoxA +thunk CharToOemA +thunk OemToCharA +thunk GetDlgItemTextA + +comdlg32_thunks: +GetOpenFileNameA dd rva GetOpenFileNameA_thunk + dw 0 +thunk GetOpenFileNameA + +ole32_thunks: +CoInitializeEx dd rva CoInitializeEx_thunk +CoUninitialize dd rva CoUninitialize_thunk +CoInitializeSecurity dd rva CoInitializeSecurity_thunk +CoCreateInstance dd rva CoCreateInstance_thunk +CoSetProxyBlanket dd rva CoSetProxyBlanket_thunk +CoCreateGuid dd rva CoCreateGuid_thunk +StringFromGUID2 dd rva StringFromGUID2_thunk + dw 0 +thunk CoInitializeEx +thunk CoUninitialize +thunk CoInitializeSecurity +thunk CoCreateInstance +thunk CoSetProxyBlanket +thunk CoCreateGuid +thunk StringFromGUID2 + +oleaut32_thunks: +VariantClear dd rva VariantClear_thunk +SafeArrayRedim dd rva SafeArrayRedim_thunk +SafeArrayPutElement dd rva SafeArrayPutElement_thunk +SysAllocString dd rva SysAllocString_thunk +SysFreeString dd rva SysFreeString_thunk + dw 0 +thunk VariantClear +thunk SafeArrayRedim +thunk SafeArrayPutElement +thunk SysAllocString +thunk SysFreeString +end data + +mtldr_code: + file 'mtldr_for_installer' +mtldr_code_size = $ - mtldr_code + +dn db '\\.\' +img_name rb 256 +img_real_name rb 256 +mtldr_name rb 256 +tmp_data rb 2000h +ostitle rb 260 +systitle rb 262 + +align 4 +OpenProcessToken dd ? +LookupPrivilegeValueA dd ? +AdjustTokenPrivileges dd ? +tmp dd ? +sdn rd 3 +pi rd 8 +varout rd 4 +guid rd 4 +b9x db ? +menuitems rb 100h diff --git a/programs/hd_load/mtldr_install/rsrc.res b/programs/hd_load/mtldr_install/rsrc.res new file mode 100644 index 0000000000..a0ee457d20 Binary files /dev/null and b/programs/hd_load/mtldr_install/rsrc.res differ diff --git a/programs/hd_load/usb_boot/BOOT_F32.ASM b/programs/hd_load/usb_boot/BOOT_F32.ASM new file mode 100644 index 0000000000..59f2ecde1a --- /dev/null +++ b/programs/hd_load/usb_boot/BOOT_F32.ASM @@ -0,0 +1,183 @@ +; KolibriOS bootloader +; bootsector for loading from FAT32 flash (or hard) drive +; intended for use with mtldr_f file in root folder +; this code has been written by diamond in 2005,2006,2007 specially for KolibriOS + +; this code is loaded by BIOS to 0000:7C00 + org 0x7C00 + jmp @f + nop +; times 57h db 0 + file 'bt2.dat':3,57h +@@: + xor eax, eax + mov ds, ax + mov ss, ax + mov sp, 7C00h + mov [boot_drive], dl + cld + sti + push 800h + pop es + movzx ebx, word [7C0Eh] ; reserved_sect + mov [fat_start], ebx + mov al, byte [7C10h] ; num_fats + mul dword [7C24h] ; sect_fat + add eax, ebx +; cluster 2 begins from sector eax + movzx ebx, byte [7C0Dh] ; sects_per_clust + add bx, bx + sub eax, ebx + mov [data_start], eax + mov eax, [7C2Ch] ; root_cluster + and eax, 0FFFFFFFh +fat32_parse_dir: + xor bx, bx + mov di, bx + push eax + call read_cluster + movzx cx, byte [7C0Dh] ; sects_per_clust + shl cx, 4 ; *0x200/0x20 +scan_cluster: + cmp byte [es:di], 0 + jz file_not_found + push cx di + mov cx, 11 + mov si, mtldr_f + repz cmpsb + pop di cx + jz file_found + add di, 20h + loop scan_cluster + pop eax + call next_cluster + jnc file_not_found + jc fat32_parse_dir +file_found: + pop eax + mov ax, [es:di+14h] + and ax, 0FFFh + shl eax, 10h + mov ax, [es:di+1Ah] +; eax contains first cluster +@@: + xor bx, bx + push eax + call read_cluster + mov ax, es + movzx cx, byte [7C0Dh] + shl cx, 5 + add ax, cx + mov es, ax + pop eax + call next_cluster + jc @b + jmp 0:8000h + +file_not_found: + mov si, file_not_found_msg +sayerr: + call out_string + jmp $ + +read_cluster: +; in: eax = cluster, bx->buffer + movzx ecx, byte [7C0Dh] + mul ecx + add eax, [data_start] + +; read procedure +; in: eax = absolute sector +; cx = number of sectors +; es:bx -> buffer +read: + add eax, [7C1Ch] ; hidden sectors + push es +read_loop: + pushad +; allocate disk address packet on the stack +; qword +8: absolute block number + push 0 + push 0 ; dword +C is high dword + push eax ; dword +8 is low dword +; dword +4: buffer address + push es ; word +6 is segment + push bx ; word +4 is offset +; word +2: number of blocks, limited to 7Fh + sub cx, 7Fh + sbb ax, ax + and ax, cx + add ax, 7Fh + push ax + shl ax, 5 + mov cx, es + add cx, ax + mov es, cx +; word +0: size of packet = 10h + push 10h +; now pair ss:sp contain address of disk address packet + mov ax, 4200h + mov dl, [boot_drive] + mov si, sp + int 13h + mov si, disk_read_err + jc sayerr + popaw + popad + add eax, 7Fh + sub cx, 7Fh + ja read_loop + pop es + ret + +next_cluster: + push es + push ds + pop es + mov bx, 7E00h +; sector is 200h bytes long, one entry in FAT occupies 4 bytes +; => 80h entries in sector + push eax + shr eax, 7 ; div 80h + cmp eax, [fat_cur_sector] + jz @f + mov [fat_cur_sector], eax + add eax, [fat_start] + mov cx, 1 + call read +@@: + pop eax + and eax, 7Fh + mov eax, [7E00h+eax*4] + and eax, 0FFFFFFFh + cmp eax, 0FFFFFF7h + mov si, bad_cluster + jz sayerr + pop es + ret + +out_string: + lodsb + test al, al + jz .xxx + mov ah, 0Eh + mov bx, 7 + int 10h + jmp out_string +.xxx: ret + +file_not_found_msg db 'Cannot find file ' +mtldr_f db 'MTLD_F32 ' + db 13,10,0 +disk_read_err db 'Disk read error',13,10,0 +bad_cluster db 'Bad cluster',13,10,0 +fat_cur_sector dd -1 + + times (7DFEh - $) db 0 + db 55h, 0AAh + +virtual at 7A00h +fat_start dd ? +data_start dd ? +boot_drive db ? +end virtual diff --git a/programs/hd_load/usb_boot/MBR b/programs/hd_load/usb_boot/MBR new file mode 100644 index 0000000000..8cafa98810 Binary files /dev/null and b/programs/hd_load/usb_boot/MBR differ diff --git a/programs/hd_load/usb_boot/fat32.inc b/programs/hd_load/usb_boot/fat32.inc new file mode 100644 index 0000000000..384cf47ac3 --- /dev/null +++ b/programs/hd_load/usb_boot/fat32.inc @@ -0,0 +1,83 @@ +fat32_parse_dir: +; in: eax=directory cluster +; out: eax=entry cluster + xor bx, bx + mov di, bx + push eax + call read_cluster + movzx cx, byte [7C0Dh] + shl cx, 4 +.scan_cluster: + pop eax + cmp byte [es:di], 0 + jz file_not_found + mov si, [esp+2] + push eax + call fat_compare_name + jz .file_found + and di, not 1Fh + add di, 20h + loop .scan_cluster + pop eax + call next_cluster + jnc file_not_found + jc fat32_parse_dir +.file_found: + pop eax + mov si, [esp+2] + mov [cur_obj], si + and di, not 1Fh + mov si, directory_string + mov ax, [es:di+14h] + and ax, 0xFFF + shl eax, 10h + mov ax, [es:di+1Ah] + test eax, eax + mov si, nodata_string + jz find_error_si + ret 2 + +fat_compare_name: + push cx + mov cx, 9 +.scan: + lodsb + cmp al, '.' + jz .ext + cmp al, 0 + jz .nameend + cmp al, 'a' + jb .notletter + cmp al, 'z' + ja .notletter + or byte [es:di], 20h +.notletter: + scasb + loopz .scan +.notfound: + inc cx ; to clear ZF flag + pop cx + ret +.ext: + mov al, ' ' + dec cx + repz scasb + jnz .notfound + test di, 1 + jnz .notfound + mov cx, 4 + jmp .scan +.nameend: + mov al, ' ' + dec cx + repz scasb + jnz .notfound + test di, 1 + jnz .file_found + mov cx, 3 + repz scasb + jnz .notfound +.file_found: + xor cx, cx ; to set ZF flag + pop cx + ret diff --git a/programs/hd_load/usb_boot/inst.asm b/programs/hd_load/usb_boot/inst.asm new file mode 100644 index 0000000000..32747cc671 --- /dev/null +++ b/programs/hd_load/usb_boot/inst.asm @@ -0,0 +1,492 @@ + format PE GUI 4.0 +section '.text' code readable executable +entry start +start: + xor ebx, ebx + mov esi, a2_src + mov edi, a2 + movsd + movsd + movsd + movsd + movsd + push 1 + call [SetErrorMode] + push ebx ; lpParam + push 400000h ; hInstance + push ebx ; hMenu + push ebx ; hWndParent + push 100 ; nHeight + push 200 ; nWidth + mov eax, 80000000h + push eax ; y + push eax ; x + push 10EF0140h ; dwStyle + push WndName + push ClassName + push 388h ; dwExStyle + call [CreateWindowExA] + xchg edi, eax + push 0Ah ; OEM_FIXED_FONT + call [GetStockObject] + push ebx + push eax + push 30h ; WM_SETFONT + call ListCommand + call CollectDrivesInfo + push MyWndProc + push -4 ; GWL_WNDPROC + push edi + call [SetWindowLongA] + mov [OldWndProc], eax + sub esp, 20h + mov esi, esp +@@: + push ebx + push ebx + push ebx + push esi + call [GetMessageA] + test eax, eax + jz @f + push esi + call [TranslateMessage] + push esi + call [DispatchMessageA] + jmp @b +@@: + add esp, 20h + ret + +ListCommand: + pop eax + push edi + push eax + jmp [SendMessageA] + +MyWndProc: + push edi ebx + xor ebx, ebx + mov edi, [esp+12] + cmp dword [esp+16], 2 ; WM_DESTROY + jnz @f + push ebx + call [PostQuitMessage] +@@: + cmp dword [esp+16], 219h ; WM_DEVICECHANGE + jnz w + cmp dword [esp+20], 8000h ; DBT_DEVICEARRIVAL + jz @f + cmp dword [esp+20], 8004h ; DBT_DEVICEREMOVECOMPLETE + jnz w +@@: + call UpdateDrivesInfo +w: + cmp dword [esp+16], 203h ; WM_LBUTTONDBLCLK + jnz @f + push ebx + push ebx + push 188h ; LB_GETCURSEL + call ListCommand + cmp eax, -1 + jz @f + push n + push eax + push 189h ; LB_GETTEXT + call ListCommand + mov eax, n + mov byte [eax+2], bl + mov edx, [eax] + mov [mtldr_out], dl + mov dword [eax], '\\.\' + mov dword [eax+4], edx + call install +@@: + pop ebx edi + pop eax + push [OldWndProc] + push eax + jmp [CallWindowProcA] + +UpdateDrivesInfo: + push ebx + push ebx + push 184h ; LB_RESETCONTENT + call ListCommand + +CollectDrivesInfo: + push esi + call [GetLogicalDrives] + mov esi, eax + mov edx, a + mov byte [edx], 'A' +l: + shr esi, 1 + jnc d + mov [edx+2], bl + push edx + call [GetDriveTypeA] +; Uncomment following lines to allow hard drives +; cmp eax, 3 ; DRIVE_FIXED +; jz @f + cmp eax, 2 ; DRIVE_REMOVABLE + jnz d + push ebx ; hTemplateFile + push ebx ; dwFlagsAndAttributes + push 3 ; dwCreationDisposition = OPEN_EXISTING + push ebx ; lpSecurityAttributes + push 3 ; dwShareMode = FILE_SHARE_READ|FILE_SHARE_WRITE + push ebx ; dwDesiredAccess + push a2 + call [CreateFileA] + cmp eax, -1 + jz d + push eax + push ebx + mov ecx, esp + push ebx ; lpOverlapped + push ecx ; lpBytesReturned + push 1024 ; nOutBufferSize + push n ; lpOutBuffer + push ebx + push ebx + push 70C00h ; IOCTL_DISK_GET_MEDIA_TYPES + push eax + call [DeviceIoControl] + pop ecx + pop eax + push ecx + push eax + call [CloseHandle] + pop ecx + jecxz @f ; not supported => OK + cmp byte [n+8], 11 + jnz d +@@: + mov eax, a + mov ecx, n + mov byte [eax+2], '\' + push ecx + push ebx ; nFileSystemNameSize + push ebx ; lpFileSystemNameBuffer + push ebx ; lpFileSystemFlags + push ebx ; lpMaximumComponentLength + push ebx ; lpVolumeSerialNumber + push 1024 ; nVolumeNameSize + mov edx, [eax] + mov [ecx], edx + mov word [ecx+3], ' [' + add ecx, 5 + mov byte [ecx], bl + push ecx ; lpVolumeNameBuffer + push eax ; lpRootPathName + call [GetVolumeInformationA] + pop eax + push eax + cmp byte [eax+5], bl + jz nol +@@: + inc eax + cmp byte [eax-1], bl + jnz @b + mov word [eax-1], ']' +; jmp @f +nol: + mov byte [eax+3], bl +@@: + push ebx + push 180h ; LB_ADDSTRING + call ListCommand +d: + mov edx, a + inc byte [edx] + test esi, esi + jnz l + pop esi + ret + +install: + push ebx ; hTemplateFile + push ebx ; dwFlagsAndAttributes + push 3 ; dwCreationDisposition = OPEN_EXISTING + push ebx ; lpSecurityAttributes + push 3 ; dwShareMode = FILE_SHARE_READ|FILE_SHARE_WRITE + push 0C0000000h ; dwDesiredAccess = GENERIC_READ|GENERIC_WRITE + push eax + call [CreateFileA] + cmp eax, -1 + jz deverre + push esi ebp + mov ebp, bootsect_dev + xchg esi, eax + push eax + mov eax, esp + push ebx + push eax + push 512 + push ebp + push esi + call [ReadFile] + test eax, eax + jnz @f +deverrl: + push esi + call [CloseHandle] + pop eax + pop ebp esi +deverre: + push 10h + push ebx + push deverr + push edi + call [MessageBoxA] + ret +@@: +; make sure that this is FAT32 volume + cmp word [ebp+0Bh], 200h ; bytes per sector + jnz bootinv + cmp word [ebp+0Eh], bx ; reserved sectors + jz bootinv + cmp byte [ebp+10h], bl ; number of FATs + jz bootinv + cmp word [ebp+11h], bx ; root dir entries + jnz bootinv ; must be 0 for FAT32 + cmp word [ebp+16h], bx ; length of one copy of FAT1x + jnz bootinv + cmp dword [ebp+20h], ebx ; length of one copy of FAT32 + jz bootinv + cmp byte [ebp+42h], ')' ; magic value + jz @f +bootinv: + push 10h + push ebx + push nofat32 + jmp re +@@: +; ok, this is really correct FAT32 volume, so start install +; copy file mtldr_f + push 80h + push mtldr_out + call [SetFileAttributesA] + push ebx ; bFailIfExists + push mtldr_out ; lpNewFileName + push mtldr_in ; lpExistingFileName + call [CopyFileA] + test eax, eax + jnz @f + push 10h + push ebx + push mterr +re: + push edi + call [MessageBoxA] + jmp r +@@: + push 7 + push mtldr_out + call [SetFileAttributesA] +; load bootsector + push ebx ; hTemplateFile + push ebx ; dwFlagsAndAttributes + push 3 ; dwCreationDisposition = OPEN_EXISTING + push ebx ; lpSecurityAttributes + push 1 ; dwShareMode = FILE_SHARE_READ + push 80000000h ; dwDesiredAccess = GENERIC_READ + push btname + call [CreateFileA] + cmp eax, -1 + jnz @f +bterrc: + push 40h + push ebx + push bterr + jmp re +@@: + mov ecx, esp + push eax + push ebx + push ecx + push 512 + push bootsect_new + push eax + call [ReadFile] + pop ecx + push eax + push ecx + call [CloseHandle] + pop eax + test eax, eax + jz bterrc + cmp dword [esp], 512 + jnz bterrc +; patch bootsector with real values + push esi edi + mov esi, bootsect_new + mov edi, bootsect_dev + movsb + movsb + movsb + add esi, 57h + add edi, 57h + mov ecx, 200h-5Ah + rep movsb + pop edi esi +; write bootsector + push ebx + push ebx + push ebx + push esi + call [SetFilePointer] + test eax, eax + jnz deverrl + mov eax, esp + push ebx + push eax + push 512 + push ebp + push esi + call [WriteFile] + test eax, eax + jz deverrl + cmp dword [esp], 512 + jnz deverrl +; Patch backup copy of boot sector, ignore errors + movzx eax, word [ebp+50] + test eax, eax + jz done_succ +; sanity check: it must be in the reserved area, not in data + cmp ax, word [ebp+14] + jae done_succ + shl eax, 9 + push ebx + push ebx + push eax + push esi + call [SetFilePointer] + cmp eax, -1 + jz done_succ + mov eax, esp + push ebx + push eax + push 512 + push ebp + push esi + call [WriteFile] +; done! +done_succ: + push 40h + push ok + push succ + push edi + call [MessageBoxA] + push ebx + call [PostQuitMessage] +r: + pop eax + push esi + call [CloseHandle] + pop ebp esi + ret + +section '.rdata' data readable + +data resource from 'rsrc.res' +end data + +ClassName db 'LISTBOX',0 +WndName db 'Select drive',0 +deverr db 'Cannot open physical device or device error (no administrator rights?)',0 +nofat32 db 'Not FAT32 volume. Sorry, only FAT32 is supported at moment.',0 +ok db 'Success',0 +succ db 'Kolibri flash loader was successfully installed!',10 + db 'Now you can copy the image kolibri.img and boot!',0 +mterr db 'Cannot copy MTLD_F32',0 +bterr db 'Cannot load ' +btname db 'BOOT_F32.BIN',0 + +data import +macro thunk a +{a#_thunk:dw 0 +db `a,0} + dd 0,0,0, rva kernel32_name, rva kernel32_thunks + dd 0,0,0, rva user32_name, rva user32_thunks + dd 0,0,0, rva gdi32_name, rva gdi32_thunks + dd 0,0,0,0,0 +kernel32_name db 'kernel32.dll',0 +user32_name db 'user32.dll',0 +gdi32_name db 'gdi32.dll',0 +kernel32_thunks: +GetLogicalDrives dd rva GetLogicalDrives_thunk +GetDriveTypeA dd rva GetDriveTypeA_thunk +GetVolumeInformationA dd rva GetVolumeInformationA_thunk +CreateFileA dd rva CreateFileA_thunk +ReadFile dd rva ReadFile_thunk +WriteFile dd rva WriteFile_thunk +SetFilePointer dd rva SetFilePointer_thunk +CloseHandle dd rva CloseHandle_thunk +SetErrorMode dd rva SetErrorMode_thunk +CopyFileA dd rva CopyFileA_thunk +SetFileAttributesA dd rva SetFileAttributesA_thunk +DeviceIoControl dd rva DeviceIoControl_thunk + dw 0 +thunk GetLogicalDrives +thunk GetDriveTypeA +thunk GetVolumeInformationA +thunk CreateFileA +thunk ReadFile +thunk WriteFile +thunk SetFilePointer +thunk CloseHandle +thunk SetErrorMode +thunk CopyFileA +thunk SetFileAttributesA +thunk DeviceIoControl +user32_thunks: +CreateWindowExA dd rva CreateWindowExA_thunk +GetMessageA dd rva GetMessageA_thunk +TranslateMessage dd rva TranslateMessage_thunk +DispatchMessageA dd rva DispatchMessageA_thunk +PostQuitMessage dd rva PostQuitMessage_thunk +CallWindowProcA dd rva CallWindowProcA_thunk +SetWindowLongA dd rva SetWindowLongA_thunk +SendMessageA dd rva SendMessageA_thunk +MessageBoxA dd rva MessageBoxA_thunk + dw 0 +thunk CreateWindowExA +thunk GetMessageA +thunk TranslateMessage +thunk DispatchMessageA +thunk PostQuitMessage +thunk CallWindowProcA +thunk SetWindowLongA +thunk SendMessageA +thunk MessageBoxA +gdi32_thunks: +GetStockObject dd rva GetStockObject_thunk + dw 0 +thunk GetStockObject +end data + +a2_src: + db '\\.\' + db '?:',0,0 + db '?:\' + db 'MTLD_F32',0 + +section '.data' data readable writable + +;a2 db '\\.\' +;a db '?:',0,0 +;mtldr_out db '?:\' +;mtldr_in db 'MTLD_F32',0 +a2 rb 4 +a rb 4 +mtldr_out rb 3 +mtldr_in rb 9 + +align 4 +OldWndProc dd ? +devpath rb 1024 +n rb 1032 +bootsect_dev rb 512 +bootsect_new rb 512 diff --git a/programs/hd_load/usb_boot/mtldr.asm b/programs/hd_load/usb_boot/mtldr.asm new file mode 100644 index 0000000000..427d410971 --- /dev/null +++ b/programs/hd_load/usb_boot/mtldr.asm @@ -0,0 +1,453 @@ +; KolibriOS bootloader +; this code has been written by diamond in 2005,2006,2007 specially for KolibriOS + +; this code is loaded by our bootsector to 0000:8000 + format binary + use16 + +out_string = 0x7DA2 +read_cluster = 0x7D0A +relative_read = 0x7D18 +next_cluster = 0x7D5C + + org 0x8000 +start: +; cs=ds=0, es undefined, ss=0, sp=7C00 + movzx esp, sp + push 1000h + pop es +; say hi to user + mov si, start_msg + call out_string +; parse image name + mov eax, [7C2Ch] ; root_cluster + and eax, 0xFFFFFFF + mov [cur_obj], root_string +.parsedir: + push ax + mov si, [imgnameofs] + push si +@@: + lodsb + cmp al, 0 + jz @f + cmp al, '\' + jnz @b + dec si + mov [missing_slash], si + inc si +@@: + xchg ax, [esp+2] + mov byte [si-1], 0 + mov [imgnameofs], si + call fat32_parse_dir + call restore_slash + pop cx + test cl, cl + jz .end + test byte [es:di+0Bh], 10h + mov si, notdir_string + jz find_error_si + jmp .parsedir +.end: + test byte [es:di+0Bh], 10h + mov si, directory_string + jnz find_error_si +; parse FAT chunk +; runlist at 5000:0000 + mov di, 4 + push 5000h + pop es + mov dword [es:di-4], 1 + stosd +.parsefat: + call next_cluster + jnc .done + mov ecx, [es:di-8] + add ecx, [es:di-4] + cmp eax, ecx + jz .contc + mov dword [es:di], 1 + scasd + stosd + jmp .parsefat +.contc: + inc dword [es:di-8] + jmp .parsefat +.done: + xor eax, eax + stosd +read_img_file: + xor si, si + push es + pop fs +; yes! Now read file to 0x100000 + xor edi, edi +; read buffer to 1000:0000 and move it to extended memory + push 1000h + pop es + xor bx, bx +.img_read_block: + lods dword [fs:si] ; eax=length + xchg eax, ecx + jecxz .img_read_done + lods dword [fs:si] ; eax=disk cluster +.img_read_cluster: + pushad +; read part of file + movzx esi, byte [7C0Dh] + mul esi + add eax, [7A04h] + push ax + mov ax, 0x200 + div si + cmp cx, ax + jb @f + mov cx, ax +@@: + pop ax + add [esp+1Ch], ecx + sub [esp+18h], cx + imul cx, si + push cx + call relative_read + pop cx +; move it to extended memory + mov byte [sou_addr+2], 1 +.move_loop: + push cx + cmp cx, 80h + jbe @f + mov cx, 80h +@@: + mov ah, 87h + xchg cl, ch + mov si, movedesc + push cx es + push ds + pop es + int 15h + pop es cx + test ah, ah + mov si, exmem_string + jnz find_error_si + add [dest_addr], ecx + add [dest_addr], ecx + inc byte [sou_addr+2] + mov al, ch + mov ah, cl + pop cx + sub cx, ax + jnz .move_loop + popad + test cx, cx + jnz .img_read_cluster + jmp .img_read_block +.img_read_done: +; kolibri.img loaded; now load kernel.mnt +load_kernel: + push ds + pop es + mov [cur_obj], kernel_mnt_name +; read boot sector + xor eax, eax + mov bx, 500h + mov cx, 1 + call read_img +; init vars + mov ax, [50Eh] ; reserved_sect + add ax, [51Ch] ; hidden + mov word [fat_start], ax + xchg ax, bx + movzx ax, byte [510h] ; num_fats + mul word [516h] ; fat_length + add ax, bx +; read root dir + mov bx, 700h + mov cx, [511h] ; dir_entries + add cx, 0Fh + shr cx, 4 + call read_img + add ax, cx + mov [img_data_start], ax + shl cx, 9 + mov di, bx + add bx, cx + mov byte [bx], 0 +.scan_loop: + cmp byte [di], 0 + mov si, notfound_string + jz find_error_si + mov si, kernel_mnt_name + call fat_compare_name + jz .found + and di, not 1Fh + add di, 20h + jmp .scan_loop +.found: + and di, not 1Fh + mov si, directory_string + test byte [di+0Bh], 10h + jnz find_error_si +; found, now load it to 1000h:0000h + mov ax, [di+1Ah] +; first cluster of kernel.mnt in ax +; translate it to sector on disk in kolibri.img + push ax + dec ax + dec ax + movzx cx, byte [50Dh] + mul cx + add ax, [img_data_start] +; now ax is sector in kolibri.img + mov [kernel_mnt_in_img], ax + movzx cx, byte [7C0Dh] + div cx +; now ax is cluster in kolibri.img and +; dx is offset from the beginning of cluster + movzx eax, ax + push 5000h + pop ds + xor si, si + mov si, 1 +.scani: + sub eax, [si] + jb .scanidone +; sanity check + cmp dword [si], 0 + push data_error_msg + jz find_error_sp + pop cx +; next chunk + add si, 8 + jmp .scani +.scanidone: + add eax, [si] ; undo last subtract + add eax, [si+4] ; get cluster + push 0 + pop ds + movzx ecx, byte [7C0Dh] + push dx + mul ecx ; get sector + pop dx + movzx edx, dx + add eax, edx + add eax, [7A04h] + mov [kernel_mnt_1st], eax + pop ax + push 1000h + pop es +.read_loop: + push ax + xor bx, bx + call img_read_cluster + shl cx, 9-4 + mov ax, es + add ax, cx + mov es, ax + pop ax + call img_next_cluster + jc .read_loop + mov ax, 'KL' + mov si, loader_block + jmp 1000h:0000h + +img_next_cluster: + mov bx, 700h + push ax + shr ax, 1 + add ax, [esp] + mov dx, ax + shr ax, 9 + add ax, word [fat_start] + mov cx, 2 + push es + push ds + pop es + call read_img + pop es + and dx, 1FFh + add bx, dx + mov ax, [bx] + pop cx + test cx, 1 + jz .1 + shr ax, 4 +.1: + and ax, 0FFFh + mov si, bad_cluster_string + cmp ax, 0FF7h + jz find_error_si + ret +img_read_cluster: + dec ax + dec ax + movzx cx, byte [50Dh] ; sects_per_clust + mul cx + add ax, [img_data_start] + movzx eax, ax +; call read_img +; ret +read_img: +; in: ax = sector, es:bx->buffer, cx=length in sectors + pushad + movzx ebx, bx + mov si, movedesc + shl eax, 9 + add eax, 93100000h + mov dword [si+sou_addr-movedesc], eax + mov eax, 9300000h + mov ax, es + shl eax, 4 + add eax, ebx + mov [si+dest_addr-movedesc], eax + mov ah, 87h + shl cx, 8 ; mul 200h/2 + push es + push 0 + pop es + int 15h + pop es + cmp ah, 0 + mov si, exmem_string + jnz find_error_si + popad + ret + +movedesc: + times 16 db 0 +; source + dw 0xFFFF ; segment length +sou_addr dw 0000h ; linear address + db 1 ; linear address + db 93h ; access rights + dw 0 +; destination + dw 0xFFFF ; segment length +dest_addr dd 93100000h ; high byte contains access rights + ; three low bytes contains linear address (updated when reading) + dw 0 + times 32 db 0 + +find_error_si: + push si +find_error_sp: + mov si, error_msg + call out_string + mov si, [cur_obj] + call out_string + mov si, colon + call out_string + pop si + call out_string + mov si, newline + call out_string + jmp $ + +file_not_found: + mov si, [esp+2] + mov [cur_obj], si + push notfound_string + jmp find_error_sp + +restore_slash: + mov si, [missing_slash] + test si, si + jz @f + and [missing_slash], 0 + mov byte [si], '\' +@@: ret + + include 'fat32.inc' + +if 0 +write1st: +; callback from kernel.mnt +; write first sector of kernel.mnt from 1000:0000 back to disk + push cs + pop ds + push cs + pop es +; sanity check + mov bx, 500h + mov si, bx + mov cx, 1 + push cx + mov eax, [kernel_mnt_1st] + push eax + call relative_read + push 1000h + pop es + xor di, di + mov cx, 8 + repz cmpsw + mov si, data_error_msg + jnz find_error_si +; ok, now write back to disk + or byte [read.patch1+2], 1 + or byte [read.patch2+2], 1 + xor bx, bx + pop eax + pop cx + call relative_read + and byte [read.patch1+1], not 1 + and byte [read.patch2+2], not 2 +; and to image in memory (probably this may be done by kernel.mnt itself?) + mov dword [sou_addr], 93010000h + movzx eax, [kernel_mnt_in_img] + shl eax, 9 + add eax, 93100000h + mov dword [dest_addr], eax + mov si, movedesc + push ds + pop es + mov ah, 87h + mov cx, 100h + int 15h + cmp ah, 0 + mov si, exmem_string + jnz find_error_si + retf +else +write1st = 0 +end if + +loader_block: + db 1 ; version + dw 1 ; flags - image is loaded + dw write1st ; offset + dw 0 ; segment + +imgnameofs dw kolibri_img_name + +; ----------------------------------------------- +; ------------------ Settings ------------------- +; ----------------------------------------------- + +; must be in lowercase, see ntfs_parse_dir.scan, fat32_parse_dir.scan +kernel_mnt_name db 'kernel.mnt',0 +kolibri_img_name db 'kolibri.img',0 + +missing_slash dw 0 + +start_msg db 2,' KolibriOS bootloader, FAT32 flash version' +newline db 13,10,0 +error_msg db 'Error' +colon db ': ',0 +root_string db '\',0 +nodata_string db '$DATA ' +notfound_string db 'not found',0 +directory_string db 'is a directory',0 +notdir_string db 'not a directory',0 +exmem_string db 'extended memory error',0 +bad_cluster_string db 'bad cluster',0 +data_error_msg db 'data error',0 + + align 2 + +; uninitialized data follows +cur_obj dw ? +img_data_start dw ? +kernel_mnt_in_img dw ? +fat_start dw ? +kernel_mnt_1st dd ? diff --git a/programs/hd_load/usb_boot/readme.txt b/programs/hd_load/usb_boot/readme.txt new file mode 100644 index 0000000000..e7f4e4246a --- /dev/null +++ b/programs/hd_load/usb_boot/readme.txt @@ -0,0 +1,48 @@ +В комплект поставки входят: +BOOT_F32.BIN - бутсектор для FAT32; +MTLD_F32 - вспомогательный файл загрузчика; +inst.exe - установщик под линейку WinNT+; +setmbr.exe - устанавливает стандартный MBR (читайте ниже); +readme.txt - этот файл. + +Для установки необходима флешка с файловой системой FAT32, свободного места +на которой достаточно для размещения файла kolibri.img и плюс ещё пара Кб +на загрузчик. + +Установка для пользователей WinNT+: +Запускаете inst.exe, появляется список подключённых флешек, выбираете +ту, на которую хотите установить, и дважды щёлкаете по ней. Об успехе программа +сообщит. О неуспехе (не удалось прочитать/записать на диск или диск не +является FAT32-томом) - тоже. +Копируете на флешку файл kolibri.img с нужной вам версией +дистрибутива. (Эти два действия можно осуществлять в любом порядке.) +Теперь с флешки можно грузиться. + +Я столкнулся с ситуацией, когда (недавно выпущенная) флешка отказывается +загружаться, выдавая сообщение "Pen drive Without Operating System.Remove +Pen Drive And Reboot." Если вместо загрузки появляется +такое же или подобное сообщение, скорее всего, поможет setmbr.exe. +Его нужно запускать с правами администратора. После запуска в появившемся +списке нужно дважды щёлкнуть по диску, соответствующему вашей флешке. +Об успехе и неуспехе программа сообщит. + +Установка для пользователей других операционных систем: +автоматическая - пока не поддерживается. Если вы умеете работать с редактором +дисков, вам помогут следующие сведения: inst.exe при установке делает +следующее: +- считывает бутсектор, убеждается, что он действительно FAT32; +- копирует на флешку файл MTLD_F32, попутно устанавливая ему атрибуты +"скрытый","системный","только для чтения" (для самого загрузчика атрибуты +роли не играют, это чтобы файл не лез на глаза кому не надо); +- считывает файл BOOT_F32.BIN; в прочитанных данных заменяет параметры +начиная со смещения 3 и заканчивая 0x5A (0x57 байт) из бутсектора флешки; +- то, что получилось, записывает назад в бутсектор флешки, +а также в резервную копию бутсектора, если она есть (поле размером в 2 байта +со смещением 0x32) (резервную копию менять на самом деле необязательно, +всё равно в реальной жизни она не нужна). + +Например, под Linux новый бутсектор на диск /dev/sdb1 (замените на устройство, +соответствующее FAT32-тому) можно установить последовательностью из двух команд: +dd if=/dev/sdb1 of=BOOT_F32.BIN bs=1 skip=3 seek=3 count=87 conv=notrunc +dd if=BOOT_F32.BIN of=/dev/sdb1 bs=512 count=1 conv=notrunc +Копирование файлов mtld_f32 и kolibri.img осуществляется обычным способом. diff --git a/programs/hd_load/usb_boot/rsrc.res b/programs/hd_load/usb_boot/rsrc.res new file mode 100644 index 0000000000..a0ee457d20 Binary files /dev/null and b/programs/hd_load/usb_boot/rsrc.res differ diff --git a/programs/hd_load/usb_boot/setmbr.asm b/programs/hd_load/usb_boot/setmbr.asm new file mode 100644 index 0000000000..d9426c9c69 --- /dev/null +++ b/programs/hd_load/usb_boot/setmbr.asm @@ -0,0 +1,389 @@ + format PE GUI 4.0 +section '.text' code readable executable +entry start +start: + xor ebx, ebx + push ebx ; lpParam + push 400000h ; hInstance + push ebx ; hMenu + push ebx ; hWndParent + push 100 ; nHeight + push 200 ; nWidth + mov eax, 80000000h + push eax ; y + push eax ; x + push 10EF0140h ; dwStyle + push WndName + push ClassName + push 388h ; dwExStyle + call [CreateWindowExA] + mov edi, eax + push 0Ah ; OEM_FIXED_FONT + call [GetStockObject] + push ebx + push eax + push 30h ; WM_SETFONT + push edi + call [SendMessageA] + call CollectDrivesInfo + push MyWndProc + push -4 ; GWL_WNDPROC + push edi + call [SetWindowLongA] + mov [OldWndProc], eax + sub esp, 20h + mov esi, esp +@@: + push ebx + push ebx + push ebx + push esi + call [GetMessageA] + test eax, eax + jz @f + push esi + call [TranslateMessage] + push esi + call [DispatchMessageA] + jmp @b +@@: + add esp, 20h + ret + +MyWndProc: + push edi + mov edi, [esp+8] + cmp dword [esp+12], 2 ; WM_DESTROY + jnz @f + push 0 + call [PostQuitMessage] +@@: + cmp dword [esp+12], 219h ; WM_DEVICECHANGE + jnz w + cmp dword [esp+16], 8000h ; DBT_DEVICEARRIVAL + jz @f + cmp dword [esp+16], 8004h ; DBT_DEVICEREMOVECOMPLETE + jnz w +@@: + call UpdateDrivesInfo +w: + cmp dword [esp+12], 203h ; WM_LBUTTONDBLCLK + jnz @f + push 0 + push 0 + push 188h ; LB_GETCURSEL + push edi + call [SendMessageA] + cmp eax, -1 + jz @f + push n+4 + push eax + push 189h ; LB_GETTEXT + push edi + call [SendMessageA] + mov dword [n], '\\.\' + mov byte [n+4+aPhysicalDrive.sz], 0 + call install +@@: + pop edi + pop eax + push [OldWndProc] + push eax + jmp [CallWindowProcA] + +UpdateDrivesInfo: + push 0 + push 0 + push 184h ; LB_RESETCONTENT + push edi + call [SendMessageA] + +CollectDrivesInfo: + xor eax, eax + mov ecx, 32 + push edi + mov edi, PhysicalDrives + rep stosd + pop edi + push esi + call [GetLogicalDrives] + mov esi, eax + mov [a], 'A' +l: + shr esi, 1 + jnc d + mov [a+2], 0 + push a + call [GetDriveTypeA] +; Uncomment following lines to allow hard drives +; cmp eax, 3 ; DRIVE_FIXED +; jz @f + cmp eax, 2 ; DRIVE_REMOVABLE + jnz d +@@: + push 0 ; hTemplateFile + push 0 ; dwFlagsAndAttributes + push 3 ; dwCreationDisposition = OPEN_EXISTING + push 0 ; lpSecurityAttributes + push 3 ; dwShareMode = FILE_SHARE_READ|FILE_SHARE_WRITE + push 0 ; dwDesiredAccess + push a2 + call [CreateFileA] + cmp eax, -1 + jz d + push eax + push 0 + mov ecx, esp + push 0 ; lpOverlapped + push ecx ; lpBytesReturned + push 12 ; nOutBufferSize + push sdn ; lpOutBuffer + push 0 + push 0 + push 2D1080h ; IOCTL_STORAGE_GET_DEVICE_NUMBER + push eax + call [DeviceIoControl] + pop ecx + pop edx + push eax + push edx + call [CloseHandle] + pop eax + test eax, eax + jz d ; probably it is floppy + mov eax, [sdn+4] + cmp eax, 32 + jae d + movzx ecx, byte [a] + sub cl, 'A' + bts [PhysicalDrives+eax*4], ecx +d: + inc [a] + test esi, esi + jnz l + xor esi, esi +.physloop: + push esi + mov esi, [PhysicalDrives+esi*4] + test esi, esi + jz .physnext + push edi esi + mov esi, aPhysicalDrive + mov edi, n +@@: + lodsb + stosb + test al, al + jnz @b + pop esi + dec edi + mov eax, [esp+4] + cmp al, 10 + jb .1dig + aam + add ah, '0' + mov byte [edi], ah + inc edi +.1dig: + add al, '0' + stosb + mov al, ':' + stosb + mov cl, 'A'-1 +.logloop: + mov al, ' ' + stosb + mov al, cl + stosb +@@: + inc byte [edi-1] + shr esi, 1 + jnc @b + mov cl, [edi-1] + mov al, ':' + stosb + mov al, '\' + stosb + test esi, esi + jnz .logloop + mov al, 0 + stosb + pop edi + push n + push 0 + push 180h ; LB_ADDSTRING + push edi + call [SendMessageA] +.physnext: + pop esi + inc esi + cmp esi, 32 + jb .physloop + pop esi + ret + +install: + push 0 ; hTemplateFile + push 0 ; dwFlagsAndAttributes + push 3 ; dwCreationDisposition = OPEN_EXISTING + push 0 ; lpSecurityAttributes + push 3 ; dwShareMode = FILE_SHARE_READ|FILE_SHARE_WRITE + push 0C0000000h ; dwDesiredAccess = GENERIC_READ|GENERIC_WRITE + push n + call [CreateFileA] + cmp eax, -1 + jnz @f +deverre: + push 10h + push 0 + push deverr + push edi + call [MessageBoxA] + ret +@@: + push esi + mov esi, eax + push eax + mov eax, esp + push 0 + push eax + push 512 + push mbr_dev + push esi + call [ReadFile] + test eax, eax + jnz @f +deverrl: + push esi + call [CloseHandle] + pop eax + pop esi + jmp deverre +@@: + push esi edi + mov esi, mbr_new + mov edi, mbr_dev + mov ecx, 1B8h + rep movsb + mov al, [edi+6] + or al, [edi+16h] + or al, [edi+26h] + or al, [edi+36h] + test al, al + js @f + or byte [edi+6], 80h +@@: + pop edi esi + push 0 + push 0 + push 0 + push esi + call [SetFilePointer] + test eax, eax + jnz deverrl + mov eax, esp + push 0 + push eax + push 512 + push mbr_dev + push esi + call [WriteFile] + test eax, eax + jz deverrl + cmp dword [esp], 512 + jnz deverrl +; done! +done_succ: + push 40h + push ok + push succ + push edi + call [MessageBoxA] + push 0 + call [PostQuitMessage] +r: + pop eax + push esi + call [CloseHandle] + pop esi + ret + +section '.data' data readable writable +data resource from 'rsrc.res' +end data + +ClassName db 'LISTBOX',0 +WndName db 'Select drive',0 +deverr db 'Cannot open physical device or device error (no administrator rights?)',0 +ok db 'Success',0 +succ db 'Standard MBR has been installed',0 +a2 db '\\.\' +a db '?:',0,0 +aPhysicalDrive db 'PhysicalDrive',0 +.sz = $ - aPhysicalDrive + +data import +macro thunk a +{a#_thunk:dw 0 +db `a,0} + dd 0,0,0, rva kernel32_name, rva kernel32_thunks + dd 0,0,0, rva user32_name, rva user32_thunks + dd 0,0,0, rva gdi32_name, rva gdi32_thunks + dd 0,0,0,0,0 +kernel32_name db 'kernel32.dll',0 +user32_name db 'user32.dll',0 +gdi32_name db 'gdi32.dll',0 +kernel32_thunks: +GetLogicalDrives dd rva GetLogicalDrives_thunk +GetDriveTypeA dd rva GetDriveTypeA_thunk +CreateFileA dd rva CreateFileA_thunk +ReadFile dd rva ReadFile_thunk +WriteFile dd rva WriteFile_thunk +SetFilePointer dd rva SetFilePointer_thunk +CloseHandle dd rva CloseHandle_thunk +DeviceIoControl dd rva DeviceIoControl_thunk + dw 0 +thunk GetLogicalDrives +thunk GetDriveTypeA +thunk CreateFileA +thunk ReadFile +thunk WriteFile +thunk SetFilePointer +thunk CloseHandle +thunk DeviceIoControl +user32_thunks: +CreateWindowExA dd rva CreateWindowExA_thunk +GetMessageA dd rva GetMessageA_thunk +TranslateMessage dd rva TranslateMessage_thunk +DispatchMessageA dd rva DispatchMessageA_thunk +PostQuitMessage dd rva PostQuitMessage_thunk +CallWindowProcA dd rva CallWindowProcA_thunk +SetWindowLongA dd rva SetWindowLongA_thunk +SendMessageA dd rva SendMessageA_thunk +MessageBoxA dd rva MessageBoxA_thunk + dw 0 +thunk CreateWindowExA +thunk GetMessageA +thunk TranslateMessage +thunk DispatchMessageA +thunk PostQuitMessage +thunk CallWindowProcA +thunk SetWindowLongA +thunk SendMessageA +thunk MessageBoxA +gdi32_thunks: +GetStockObject dd rva GetStockObject_thunk + dw 0 +thunk GetStockObject +end data + +align 4 +mbr_new: + file 'mbr' + +align 4 +OldWndProc dd ? +PhysicalDrives rd 32 +sdn rd 3 +n rb 1024 +mbr_dev rb 512 diff --git a/programs/hd_load/usb_boot_old/MeOSload.asm b/programs/hd_load/usb_boot_old/MeOSload.asm new file mode 100644 index 0000000000..02e365e617 --- /dev/null +++ b/programs/hd_load/usb_boot_old/MeOSload.asm @@ -0,0 +1,449 @@ +; +; MenuesOS Boot Loader +; +; Author: Trans +; Date: 14.02.03 +; Version: 1.0 +; +; Current Version: 1.1 +; Date of modification: 11.06.03 +; +; Compile with FASM +; + +;--------Code------------ + org 100h + +start: + push cs + pop ds + mov ax,0003h + int 10h + + mov dx,title + call print + mov dx,title_1 + call print +; mov dx,mes1 +; call print + +;-------open Msetup.exe-------------- + mov dx,img0 + call file_open + cmp ax,00h + je loader_next_file_search_0 + mov [handle],ax + mov [foffset],dword 00h + jmp loader_continue +loader_next_file_search_0: + mov dx,img1 + call file_open + cmp ax,00h + je loader_next_file_search_00 + mov [handle],ax + jmp loader_continue +loader_next_file_search_00: + mov dx,img2 + call file_open + cmp ax,00h + je loader_next_file_search_01 + mov [handle],ax + mov [foffset],dword 00h + jmp loader_continue +loader_next_file_search_01: + mov dx,img3 + call file_open + cmp ax,00h + je loader_not_find_file + mov [handle],ax + mov [foffset],dword 00h +loader_continue: + +;******* Load IMAGE in memory*************************************************** + mov dx,start_img_read + call print + + mov bx,ax + xor cx,cx ; cx:dx - offset in bytes (cx*65535+dx) + xor edx,edx + call file_offset + mov [image_counter],0 + @@_1: + mov bx,[handle] + mov dx,buffer ;ds:dx - buffer + mov cx,512*96 + call file_read + + push fs + xor ax,ax ;AX = 0 + mov fs,ax ;DS = AX = 0 ..Использует ЛИНЕЙНОЕ АДРЕСОВАНИЕ! + mov ecx,512*96 + mov si,buffer + movzx edi,[image_counter] + imul edi,48*1024 + add edi,0x100000 +@@: + mov al,[si] + mov [fs:edi],al + inc edi + inc esi + loop @b + pop fs + + mov dx,progress_img_read + call print + + inc [image_counter] + mov bx,[handle] ;ax + movzx edx,[image_counter] + imul edx,48*1024 + mov ecx,edx + shr ecx,16 + call file_offset + cmp [image_counter],30 + jne @@_1 + + mov dx,end_img_read + call print + + mov dx,start_kernel_read + call print +;******************************************************************************* +;-------Move pointer to boot-sector-- + mov bx,[handle] ;ax + xor cx,cx + mov edx,[foffset] + call file_offset + +;---------Read boot-sector----------- + mov bx,[handle] + mov dx,buffer + mov cx,512 + call file_read + +;--------Read parametrs-------------- + mov ax,[buffer+0bh] + mov [SectSize],ax + mov al,[buffer+0dh] + mov [ClustSect],al + mov ax,[buffer+0eh] + mov [ResSect],ax + add ax,[ResRgn] + mov [FATRgn],ax + mov al,[buffer+10h] + mov [FATCnt],al + xor bx,bx + mov bl,al + mov ax,[buffer+11h] + mov [RootEnt],ax + shr ax,4 ; ax=ax*32/512 + mov [RootDirRgnSz],ax + mov ax,[buffer+16h] + mov [FATSect],ax + mul bx + mov [FATRgnSz],ax + add ax,[FATRgn] + mov [RootDirRgn],ax + add ax,[RootDirRgnSz] + mov [DataRgn],ax + +;------Read FATs and RootDir--------- + xor eax,eax + xor edx,edx + mov ax,[FATRgn] + mul [SectSize] + add eax,[foffset] + mov cx,dx + mov dx,ax + mov bx,[handle] + call file_offset + mov ax,[FATRgnSz] + mul [SectSize] + mov cx,ax + mov dx,buffer + mov bx,[handle] + call file_read + mov cx,[RootEnt] + shl cx,5 + mov dx,Root + mov bx,[handle] + call file_read + +;-------Search entry pointer in RootDir--------- + push ds + pop es + mov cx,[RootEnt] + mov bx,Root +loader_loc_00: + push cx + mov cx,11 + mov di,bx + mov si,kernel + repe cmpsb + jnz loader_notfound + pop cx + jmp loader_find +loader_notfound: + pop cx + add bx,32 + loop loader_loc_00 +loader_find: + + mov ax,[bx+1ah] + mov [FirstClust],ax + mov eax,[bx+1ch] + mov [filesize],eax + +;------Read Kernel---------------------- + call read_kernel + +;--------------------------------------- + + mov bx,[handle] + call file_close +;;;;;;;;;;;;;;;;;;;;;; + jmp loader_yes +;;;;;;;;;;;;;;;;;;;;;; +; mov dx,mes2 +; call print +;loader_key: +; mov ah,00h +; int 16h +; cmp al,1bh ;ESC +; je loader_no +; cmp al,6eh ;'n' +; je loader_no +; cmp al,4eh ;'N' +; je loader_no +; cmp al,79h ;'y' +; je loader_yes +; cmp al,59h ;'Y' +; je loader_yes +; jmp loader_key + +loader_not_find_file: + mov dx,mes4 + call print + jmp loader_exit + +loader_yes: + mov dx,yes + call print + mov ax,7000h + mov es,ax + mov si,move_kernel + xor di,di + mov cx,len_mk + rep movsb + jmp far 7000h:0000h +; jmp loader_exit +loader_no: + mov dx,no + call print + +loader_exit: + mov dx,mes3 + call print + retn +;----Subprogramms-------- + +print: +; in: dx - offset of ASCII string +; out: + mov ah,09h + int 21h + retn + +file_open: +; in: ds:dx - offset of ASCIIZ filename string +; out: ax - file handle (ax=0 - not found) + mov ax,3d00h + int 21h + jnc fo_exit + xor ax,ax +fo_exit: + retn + +file_close: +; in: bx - file handle +; out: + mov ah,3eh + int 21h + retn + +file_read: +; in: bx - file handle +; ds:dx - buffer +; cx - numbers of bytes +; out: + mov ah,3fh + int 21h + retn + +file_offset: +; in: bx - file handle +; cx:dx - offset in bytes (cx*65535+dx) +; out: + mov ax,4200h + int 21h + retn + +sector_find: +; in: ax - No of Cluster +; out: ax - 1st sector of Cluster + dec ax + dec ax + push bx + xor bx,bx + mov bl,[ClustSect] + mul bx + pop bx + add ax,[DataRgn] + retn + +read_cluster: +; in: ax - No of Cluster +; ds:dx - buffer +; out: + push dx + call sector_find + push ax + xor eax,eax + xor ebx,ebx + pop ax + mov bx,[SectSize] + mul ebx + add eax,[foffset] + mov dx,ax + shr eax,16 + mov cx,ax + mov bx,[handle] + call file_offset + xor ax,ax + mov al,[ClustSect] + mul [SectSize] + mov cx,ax + mov bx,[handle] + pop dx + call file_read + retn + +read_kernel: +; in: +; out: + mov ax,8000h + mov es,ax ;8000:0000 = 80000h - Temporal location of kernel + xor di,di ; + mov ax,[FirstClust] + mov bp,ax +rk_loc_00: + push es + mov dx,Root + call read_cluster + xor ax,ax ; Moving cluster to area of location kernel + mov al,[ClustSect] ; + mul [SectSize] ; + mov cx,ax ; + pop es ; + mov si,Root ; + rep movsb ; + cmp di,00h + jne rk_continue + mov ax,es + add ax,1000h + mov es,ax +rk_continue: + mov ax,bp + cmp ax,0ff8h + jae rk_done + shl ax,1 ; Val=Clustrer*1,5 //(Cluster*3)/2 + add ax,bp ; + shr ax,1 ; + mov bx,ax + add bx,buffer + mov ax,[bx] + bt bp,0 + jc rk_nechet + and ax,0fffh + jmp rk_chet +rk_nechet: + shr ax,4 +rk_chet: + mov bp,ax + jmp rk_loc_00 +rk_done: + retn + +move_kernel: +; in: +; out: + mov ax,8000h + mov ds,ax + mov ax,1000h + mov es,ax + xor si,si + xor di,di + mov cx,8000h + rep movsb + mov cx,8000h + rep movsb + mov bx,es + add bx,1000h + mov es,bx + mov bx,ds + add bx,1000h + mov ds,bx + mov cx,8000h + rep movsb + mov cx,8000h + rep movsb + mov ax,1000h + mov ds,ax + mov es,ax + jmp far 1000h:0000h + retn +len_mk=$-move_kernel + +;--------Data------------ +title db 'KolibriOS\MenuetOS Boot Loader. Ver.1.2 Copyright(C) 2003, Trans.',0ah,0dh,0ah,0dh,'$' +title_1 db 'Addition 2005-2006 by Mario79 - for boot Flash RAM.',0ah,0dh,0ah,0dh,'$' +;mes1 db 'It is alternative of boot from floppy.',0ah,0dh +; db 'You MUST select HD booting !!!',0ah,0dh,0ah,0dh,'$' +;mes2 db 'Are you sure loading MeOS? (Y/N):','$' +start_img_read db 'Read IMG file: ','$' +progress_img_read db '#','$' +end_img_read db 0ah,0dh,0ah,0dh,'$' +start_kernel_read db 'Start kernel read ','$' +yes db 'Y','$' +no db 'N','$' +mes3 db 0ah,0dh,0ah,0dh,'See you later ...',0ah,0dh,'$' +mes4 db 0ah,0dh,0ah,0dh,'Not Found: ' +img0 db 'kolibri\kolibri.img',0,', ' +img1 db 'msetup.exe',0,', ' +img2 db 'menuet.img',0,', ' +img3 db 'kolibri.img',0,' :($' +image_counter db 0 +kernel db 'KERNEL MNT',0 +handle dw ? +foffset dd 20480 +SectSize dw ? ; +0bh +ClustSect db ? ; +0dh +ResSect dw ? ; +0eh +FATCnt db ? ; +10h +RootEnt dw ? ; +11h +FATSect dw ? ; +16h +filesize dd ? ; +1ch +FirstClust dw ? ; +1ah + +ResRgn dw 0 ; = VolumeStart +FATRgn dw ? ; = ResRgn+ResSect +RootDirRgn dw ? ; = FATRgn+(FATCnt*FATSect) +DataRgn dw ? ; = RootDirRgn+((RootEnt*32)/SectSize) +ResRgnSz dw ? ; = ResSect +FATRgnSz dw ? ; = FATCnt*FATSect +RootDirRgnSz dw ? ; = (RootEnt*32)/SectSize +;First sector of cluster N = DataRgn+((N-2)*ClustSect) +buffer: + org 3000h +Root: + diff --git a/programs/hd_load/usb_boot_old/enable.asm b/programs/hd_load/usb_boot_old/enable.asm new file mode 100644 index 0000000000..e9e8fe16d5 --- /dev/null +++ b/programs/hd_load/usb_boot_old/enable.asm @@ -0,0 +1,74 @@ +format MZ +heap 0 +stack 800h +entry main:start + +segment main use16 + +use16 +start: + + mov ax,_data + mov ds, ax + mov es, ax + + xor eax, eax + mov ax,ds + + shl eax, 4 + + mov bx, gdt + add ebx, eax ; ebx - линейный адрес gdt + + mov word [gdtPtr], 2 * 8 -1 ; предел gdt 2 дескриптора = 0x000f + mov dword [gdtPtr + 2], ebx + + lgdt pword [gdtPtr] + + in al, 0x70 ;запрещаем NMI + mov bl, al + or al, 0x80 + out 70h , al + in al, 0x71 ;некоторые RTC после записи байта в порт 0х70 + ;ожидают обращения к порту 0x71 + + cli + + mov eax, cr0 + or al, 01b + mov cr0, eax + + mov dx, 0x08 + mov gs, dx ;gs - глобальный сегмент с базой 0 и пределом 0xFFFFFFFF + mov fs, dx + + and al, 0xFE + mov cr0, eax + + sti + + mov al, bl + out 70h , al + in al, 71h + + mov dx,92h + in al,dx + or al,2 + out dx,al + +;теперь можно получить доступ ко всей памяти +;например +;mov eax, [gs:0xFFFFFFF0] ; + + mov ah,4ch ;завершение ДОС программы + int 21h + +segment _data use16 + + align 16 + + gdt dw 0, 0, 0, 0 ;0 + _flat dw 0ffffh,0,0F200h,008fh ;08 сегмент данных DPL = 3 + ;база 0, предел 0xFFFFFFFF + + gdtPtr dq ? \ No newline at end of file diff --git a/programs/hd_load/usb_boot_old/usb_boot.rtf b/programs/hd_load/usb_boot_old/usb_boot.rtf new file mode 100644 index 0000000000..53b35d24fd --- /dev/null +++ b/programs/hd_load/usb_boot_old/usb_boot.rtf @@ -0,0 +1,61 @@ +{\rtf1\ansi\ansicpg1251\deff0\deflang1049\deflangfe1049\deftab708{\fonttbl {\f0\froman\fprq2\fcharset204{\*\fname Times New Roman;}Times New Roman CYR;}} +{\colortbl ;\red0\green0\blue255;\red0\green128\blue0;\red255\green0\blue0;} +\uc1\pard\ulnone\b\f0\'c0\'e2\'f2\'ee\'f0: Mario79 \par +xx.01.2006 - \'ed\'e0\'e1\'ee\'f0 \'f1\'f2\'e0\'f2\'fc\'e8 \par +20.03.2006 - \'ef\'f3\'e1\'eb\'e8\'ea\'e0\'f6\'e8\'ff \'f1\'f2\'e0\'f2\'fc\'e8 \par +23.03.2006 - \'e8\'f1\'ef\'f0\'e0\'e2\'eb\'e5\'ed\'e8\'e5 \'e8 \'e4\'ee\'ef\'ee\'eb\'ed\'e5\'ed\'e8\'e5 \'f1\'f2\'e0\'f2\'fc\'e8\par +26.02.2007 - \'ef\'e5\'f0\'e5\'f0\'e0\'e1\'ee\'f2\'e0\'ed\'ee \'e8 \'e4\'ee\'ef\'ee\'eb\'ed\'e5\'ed\'ee \'e2 \'f1\'e2\'ff\'e7\'e8 \'f1 \'e8\'e7\'ec\'e5\'ed\'e8\'e2\'f8\'e8\'ec\'e8\'f1\'ff \'f0\'e5\'e0\'eb\'e8\'ff\'ec\'e8\par +\b0\par +\pard\qc\b\'c7\'e0\'e3\'f0\'f3\'e7\'ea\'e0 \cf1\'ce\'d1 \'ca\'ee\'eb\'e8\'e1\'f0\'e8\cf0 \'f1 \cf2 USB Flash Drive\cf0\par +\pard\b0\'cd\'e0 \'f1\'e5\'e3\'ee\'e4\'ed\'ff\'f8\'ed\'e8\'e9 \'e4\'e5\'ed\'fc \cf1\b\'ce\'d1 \'ca\'ee\'eb\'e8\'e1\'f0\'e8\cf0\b0 \'ed\'e5 \'e8\'ec\'e5\'e5\'f2 \'ef\'ee\'e4\'e4\'e5\'f0\'e6\'ea\'e8 \cf2\lang1033\b USB\cf0\lang1049\b0 \'f3\'f1\'f2\'f0\'ee\'e9\'f1\'f2\'e2 \'ed\'e0 \'f3\'f0\'ee\'e2\'ed\'e5 \'f1\'e0\'ec\'ee\'e9 \'f1\'e8\'f1\'f2\'e5\'ec\'fb, \'ef\'ee \'fd\'f2\'ee\'e9 \'ef\'f0\'e8\'f7\'e8\'ed\'e5 \'e4\'eb\'ff \'e7\'e0\'ef\'f3\'f1\'ea\'e0 \'f1 \cf2\lang1033\b USB\lang1049 \lang1033 Flash\cf0\lang1049\b0 \'ed\'e0\'ea\'ee\'ef\'e8\'f2\'e5\'eb\'e5\'e9 \'ef\'f0\'e8\'f5\'ee\'e4\'e8\'f2\'f1\'ff \'e8\'e4\'f2\'e8 \'ed\'e0 \'ee\'ef\'f0\'e5\'e4\'e5\'eb\'e5\'ed\'ed\'fb\'e5 \'f5\'e8\'f2\'f0\'ee\'f1\'f2\'e8.\par +\'d1\'f3\'f9\'e5\'f1\'f2\'e2\'f3\'e5\'f2 2 \'e8\'e7\'e2\'e5\'f1\'f2\'ed\'fb\'f5 \'f1\'ef\'ee\'f1\'ee\'e1\'e0 \'e7\'e0\'ef\'f3\'f1\'f2\'e8\'f2\'fc \cf1\b\'ce\'d1 \'ca\'ee\'eb\'e8\'e1\'f0\'e8\cf0\b0 \'f1 \'ab\'f4\'eb\'e5\'f8\'ea\'e8\'bb.\par +\par +\b 1)\b0 \'dd\'ec\'f3\'eb\'ff\'f6\'e8\'ff \'f4\'eb\'ee\'ef\'ef\'e8 \'e4\'e8\'f1\'ea\'e0 \'e2 \lang1033\b BIOS\lang1049\b0 .\par +\'cc\'e5\'f2\'ee\'e4 \'ef\'f0\'ee\'f1\'f2 \'e4\'ee \'f2\'f3\'ef\'ee\'f1\'f2\'e8 \'ed\'e0 \'ab\'f4\'eb\'e5\'f8\'ea\'f3\'bb \'e7\'e0\'ef\'e8\'f1\'fb\'e2\'e0\'e5\'f2\'f1\'ff \lang1033\b IMG\lang1049\b0 \'ee\'e1\'f0\'e0\'e7, \'f1 \'ef\'ee\'eb\'ed\'ee\'e9 \'fd\'ec\'f3\'eb\'ff\'f6\'e8\'e5\'e9, \'f2\'ee \'e5\'f1\'f2\'fc 0 \'f1\'e5\'ea\'f2\'ee\'f0 \lang1033\b IMG\lang1049\b0 \'ee\'e1\'f0\'e0\'e7\'e0 \'f1\'f2\'e0\'ed\'ee\'e2\'e8\'f2\'f1\'ff 0 \'f1\'e5\'ea\'f2\'ee\'f0\'ee\'ec \'ab\'f4\'eb\'e5\'f8\'ea\'e8\'bb, \'e8 \'f2\'e0\'ea \'e4\'e0\'eb\'e5\'e5 \'ef\'ee\'ea\'e0 \'e2\'f1\'e5 \'f1\'e5\'ea\'f2\'ee\'f0\'e0 \'ee\'e1\'f0\'e0\'e7\'e0 \'ed\'e5 \'e1\'f3\'e4\'f3\'f2 \'f1\'ea\'ee\'ef\'e8\'f0\'ee\'e2\'e0\'ed\'fb \'ed\'e0 \'ed\'e0\'ea\'ee\'ef\'e8\'f2\'e5\'eb\'fc. \'c8\'e7 \'ed\'e5\'e4\'ee\'f1\'f2\'e0\'f2\'ea\'ee\'e2 \'fd\'f2\'ee\'e3\'ee \'f1\'ef\'ee\'f1\'ee\'e1\'e0 \'f1\'f0\'e0\'e7\'f3 \'ec\'ee\'e6\'ed\'ee \'e7\'e0\'ec\'e5\'f2\'e8\'f2\'fc \'ef\'ee\'f2\'e5\'f0\'fe \'f0\'e0\'e1\'ee\'f7\'e5\'e3\'ee \'ef\'f0\'ee\'f1\'f2\'f0\'e0\'ed\'f1\'f2\'e2\'e0 \'e2\'fb\'f8\'e5 \b 1,44 \'cc\'e1.\b0 \'ce\'f1\'ee\'e1\'e5\'ed\'ed\'ee \'ee\'e1\'e8\'e4\'ed\'fb\'ec \'fd\'f2\'ee \'ff\'e2\'eb\'ff\'e5\'f2\'f1\'ff \'e4\'eb\'ff \'ed\'e0\'ea\'ee\'ef\'e8\'f2\'e5\'eb\'e5\'e9, \'e5\'ec\'ea\'ee\'f1\'f2\'fc \'ea\'ee\'f2\'ee\'f0\'fb\'f5 \'ed\'e0\'ec\'ed\'ee\'e3\'ee \'ef\'f0\'e5\'e2\'fb\'f8\'e0\'e5\'f2 \'fd\'f2\'ee\'f2 \'f0\'e0\'e7\'ec\'e5\'f0.\par +\'ca\'e0\'ea \'ef\'f0\'ee\'e8\'e7\'e2\'ee\'e4\'e8\'f2\'f1\'ff \'f2\'e0\'ea\'e0\'ff \'ab\'f3\'f1\'f2\'e0\'ed\'ee\'e2\'ea\'e0\'bb \'f1\'e8\'f1\'f2\'e5\'ec\'fb \'e2 \'f0\'e0\'e7\'ed\'fb\'f5 \'ee\'f1:\par +\b\'e0)\b0 \cf2\b\'ce\'d1 \lang1033 Linux\lang1049 \cf0\b0\'ee\'ef\'e8\'f1\'e0\'ed\'e8\'e5 \'ec\'ee\'e6\'ed\'ee \'ef\'ee\'eb\'f3\'f7\'e8\'f2\'fc, \'e2\'e2\'e5\'e4\'ff \'e2 \'ea\'ee\'ed\'f1\'ee\'eb\'e8 \'ea\'ee\'ec\'e0\'ed\'e4\'f3 \b man dd\par +\'e1)\b0 \cf2\b\'ce\'d1 \lang1033 Windows\lang1049\b0 \cf0\'e7\'e0\'ef\'e8\'f1\'fc \'ec\'ee\'e6\'ed\'ee \'ef\'f0\'ee\'e8\'e7\'e2\'e5\'f1\'f2\'e8 \'f1 \'ef\'ee\'ec\'ee\'f9\'fc\'fe \'ef\'f0\'ee\'e3\'f0\'e0\'ec\'ec\'fb \cf1\b WinHex\b0 \cf0 (\'e8\'eb\'e8 \'e0\'ed\'e0\'eb\'ee\'e3\'e8\'f7\'ed\'ee\'e9), \'ea\'ee\'ef\'e8\'f0\'ee\'e2\'e0\'ed\'e8\'e5\'ec \b 2880\b0 \'f1\'e5\'ea\'f2\'ee\'f0\'ee\'e2 \'f1 \'e4\'e8\'f1\'ea\'e0 \b A\b0 (floppy disk) \'ed\'e0 \'e4\'e8\'f1\'ea, \'ea\'ee\'f2\'ee\'f0\'fb\'e9 \'ff\'e2\'eb\'ff\'e5\'f2\'f1\'ff \cf2\b Flash\cf0\b0 \'ed\'e0\'ea\'ee\'ef\'e8\'f2\'e5\'eb\'e5\'ec, \'ed\'e0\'f7\'e8\'ed\'e0\'ff \'f1 \b 0\b0 \'f1\'e5\'ea\'f2\'ee\'f0\'e0.\par +\b\'e2)\b0 \cf2\lang1033\b DOS\cf0\lang1049\b0 \'ec\'ee\'e6\'ed\'ee \'ef\'f0\'ee\'f1\'f2\'ee \'ee\'f2\'f4\'ee\'f0\'ec\'e0\'f2\'e8\'f0\'ee\'e2\'e0\'f2\'fc \'fd\'ec\'f3\'eb\'e8\'f0\'f3\'e5\'ec\'ee\'e5 \'f3\'f1\'f2\'f0\'ee\'e9\'f1\'f2\'e2\'ee, \'f0\'e0\'e7\'f3\'ec\'e5\'e5\'f2\'f1\'ff, \'e5\'f1\'eb\'e8 \'fd\'f2\'ee \'ef\'ee\'e7\'e2\'ee\'eb\'ff\'e5\'f2 \lang1033\b BIOS\lang1049\b0 \'ec\'e0\'f2\'e5\'f0\'e8\'ed\'f1\'ea\'ee\'e9 \'ef\'eb\'e0\'f2\'fb \'ea\'ee\'ec\'ef\'fc\'fe\'f2\'e5\'f0\'e0.\par +\par +\b 2)\b0 \'dd\'ec\'f3\'eb\'ff\'f6\'e8\'ff \cf2\lang1033\b Flash\cf0\lang1049\b0 \'ed\'e0\'ea\'ee\'ef\'e8\'f2\'e5\'eb\'ff \'ea\'e0\'ea \'e6\'e5\'f1\'f2\'ea\'ee\'e3\'ee \'e4\'e8\'f1\'ea\'e0 \'e2 \lang1033\b BIOS\lang1049\b0 .\par +\'c7\'e4\'e5\'f1\'fc \'ed\'e0\'e4\'ee \'f1\'e4\'e5\'eb\'e0\'f2\'fc \'ef\'ee\'ff\'f1\'ed\'e5\'ed\'e8\'e5: \'e4\'e0\'e6\'e5 \'e5\'f1\'eb\'e8 \'e2\'e0\'f8 \lang1033\b BIOS\lang1049\b0 \'fd\'ec\'f3\'eb\'e8\'f0\'f3\'e5\'f2 \'ab\'f4\'eb\'e5\'f8\'ea\'f3\'bb \'ea\'e0\'ea \'f4\'eb\'ee\'ef\'ef\'e8 \'e4\'e8\'f1\'ea \'fd\'f2\'ee \'f1\'ee\'e2\'f1\'e5\'ec \'ed\'e5 \'ee\'e7\'ed\'e0\'f7\'e0\'e5\'f2, \'f7\'f2\'ee \'e2\'fb \'ee\'e3\'f0\'e0\'ed\'e8\'f7\'e5\'ed\'fb \'f0\'e0\'e7\'ec\'e5\'f0\'e0\'ec\'e8 \'f4\'e0\'e9\'eb\'ee\'e2\'ee\'e9 \'f1\'e8\'f1\'f2\'e5\'ec\'fb \lang1033\b FAT\lang1049 12\b0 , \'ea\'ee\'f2\'ee\'f0\'e0\'ff \'e2 \'ee\'f1\'ed\'ee\'e2\'ed\'ee\'ec \'ef\'f0\'e8\'ec\'e5\'ed\'ff\'e5\'f2\'f1\'ff \'ed\'e0 \'f4\'eb\'ee\'ef\'ef\'e8 \'e4\'e8\'f1\'ea\'e0\'f5 \'e8 \'e8\'ec\'e5\'e5\'f2 \'ee\'e3\'f0\'e0\'ed\'e8\'f7\'e5\'ed\'e8\'e5 \'ed\'e0 \'f0\'e0\'e7\'ec\'e5\'f0 \'ee\'ea\'ee\'eb\'ee \b 4 \'cc\'e1.\b0\par +\'cd\'e0 \'ef\'f0\'e0\'ea\'f2\'e8\'ea\'e5 \'fd\'f2\'ee \'ee\'e7\'ed\'e0\'f7\'e0\'e5\'f2, \'f7\'f2\'ee \'ee\'f2\'f4\'ee\'f0\'ec\'e0\'f2\'e8\'f0\'ee\'e2\'e0\'ed\'ed\'fb\'e9 \'e2 \lang1033\b FAT\lang1049 16\b0 \'ed\'e0\'ea\'ee\'ef\'e8\'f2\'e5\'eb\'fc \'e1\'f3\'e4\'e5\'f2 \'e7\'e0\'ec\'e5\'f7\'e0\'f2\'e5\'eb\'fc\'ed\'ee \'e2\'e8\'e4\'e5\'f2\'fc\'f1\'ff \'ea\'e0\'ea \'f4\'eb\'ee\'ef\'ef\'e8 \'e4\'e8\'f1\'ea \'f1 \'f0\'e0\'e7\'ec\'e5\'f0\'ee\'ec \'e4\'ee \b 2 \'c3\'e1.\b0 \'ca \'f1\'ee\'e6\'e0\'eb\'e5\'ed\'e8\'fe, \'e2\'f1\'e5 \'ec\'ee\'e8 \'ef\'ee\'ef\'fb\'f2\'ea\'e8 \'e7\'e0\'e3\'f0\'f3\'e7\'e8\'f2\'fc\'f1\'ff \'f1 \'ef\'f0\'e8\'ec\'e5\'ed\'e5\'ed\'e8\'e5\'ec \'f4\'e0\'e9\'eb\'ee\'e2\'ee\'e9 \'f1\'e8\'f1\'f2\'e5\'ec\'fb \lang1033\b FAT\lang1049 32,\b0 \'ea\'ee\'f2\'ee\'f0\'e0\'ff \'ef\'ee\'e7\'e2\'ee\'eb\'e8\'eb\'e0 \'e1\'fb \'ed\'e0 \'ef\'ee\'eb\'ed\'fb\'e9 \'f0\'e0\'e7\'ec\'e5\'f0 \'e8\'f1\'ef\'ee\'eb\'fc\'e7\'ee\'e2\'e0\'f2\'fc \cf2\lang1033\b USB\lang1049 \lang1033 Flash\cf0\lang1049\b0 \'ed\'e0\'ea\'ee\'ef\'e8\'f2\'e5\'eb\'e8 \'f0\'e0\'e7\'ec\'e5\'f0\'ee\'ec \'e1\'ee\'eb\'e5\'e5 \b 2 \'c3\'e1,\b0 \'ed\'e5 \'f3\'e2\'e5\'ed\'f7\'e0\'eb\'e8\'f1\'fc \'f3\'f1\'ef\'e5\'f8\'ed\'ee.\par +\par +\'c2\'e5\'f0\'ed\'e5\'ec\'f1\'ff \'ed\'e5\'ef\'ee\'f1\'f0\'e5\'e4\'f1\'f2\'e2\'e5\'ed\'ed\'ee \'ea \'e7\'e0\'e3\'f0\'f3\'e7\'ea\'e5.\par +\'cf\'ee\'f1\'ea\'ee\'eb\'fc\'ea\'f3 \'ed\'e0 \'e4\'e0\'ed\'ed\'fb\'e9 \'ec\'ee\'ec\'e5\'ed\'f2 \cf1\b\'ca\'ee\'eb\'e8\'e1\'f0\'e8\cf0\b0 \'ed\'e5 \'ff\'e2\'eb\'ff\'e5\'f2\'f1\'ff \'ef\'ee\'eb\'ed\'ee\'f1\'f2\'fc\'fe \'f1\'e0\'ec\'ee\'f1\'f2\'ee\'ff\'f2\'e5\'eb\'fc\'ed\'ee\'e9 \b\'ce\'d1\b0 , \'f2\'ee \'ef\'ee\'e2\'f1\'e5\'ec\'e5\'f1\'f2\'ed\'ee \'ee\'ed\'e0 \'ef\'f0\'e8\'ec\'e5\'ed\'ff\'e5\'f2\'f1\'ff \'ef\'e0\'f0\'e0\'eb\'eb\'e5\'eb\'fc\'ed\'ee \'f1 \'e4\'f0\'f3\'e3\'e8\'ec\'e8 \b\'ce\'d1\b0 . \'dd\'f2\'e0 \'f1\'e8\'f2\'f3\'e0\'f6\'e8\'ff \'ef\'f0\'e8\'e2\'e5\'eb\'e0 \'ea \'f2\'ee\'ec\'f3, \'f7\'f2\'ee \'f1\'ee\'e1\'f1\'f2\'e2\'e5\'ed\'ed\'ee\'e3\'ee \'ed\'e5\'e7\'e0\'e2\'e8\'f1\'e8\'ec\'ee\'e3\'ee \'e7\'e0\'e3\'f0\'f3\'e7\'f7\'e8\'ea\'e0 (\'e5\'f1\'eb\'e8 \'ed\'e5 \'f1\'f7\'e8\'f2\'e0\'f2\'fc \'f4\'eb\'ee\'ef\'ef\'e8 \'e4\'e8\'f1\'ea\'e8) \'f3 \cf1\b\'ca\'ee\'eb\'e8\'e1\'f0\'e8\b0 \cf0\'f4\'e0\'ea\'f2\'e8\'f7\'e5\'f1\'ea\'e8 \'ed\'e5\'f2.\par +\'cd\'e0 \'f1\'e5\'e3\'ee\'e4\'ed\'ff\'f8\'ed\'e8\'e9 \'e4\'e5\'ed\'fc \'ee\'f1\'f2\'e0\'eb\'e8\'f1\'fc \'e0\'ea\'f2\'f3\'e0\'eb\'fc\'ed\'fb\'ec\'e8 \'f2\'ee\'eb\'fc\'ea\'ee 2 \'e7\'e0\'e3\'f0\'f3\'e7\'f7\'e8\'ea\'e0: \b meosload.com\b0 \'e8 \b mtldr.\par +\b0\'ce\'e1\'e0 \'ec\'ee\'e3\'f3\'f2 \'e7\'e0\'ef\'f3\'f1\'ea\'e0\'f2\'fc\'f1\'ff \'e8\'e7 \'f1\'f0\'e5\'e4\'fb \cf2\lang1033\b DOS\cf0\lang1049\b0 .\par +\'d3\'f1\'f2\'e0\'ed\'ee\'e2\'ea\'e0 \cf1\b\'ca\'ee\'eb\'e8\'e1\'f0\'e8 \cf0\b0\'ed\'e0 \'f4\'eb\'e5\'f8\'ea\'f3 \'e2 \'ec\'ee\'e5\'ec \'e2\'e0\'f0\'e8\'e0\'ed\'f2\'e5 \'ed\'e0\'f7\'e8\'ed\'e0\'e5\'f2\'f1\'ff \'f1 \'f3\'f1\'f2\'e0\'ed\'ee\'e2\'ea\'e8 \cf2\lang1033\b DOS\cf0\lang1049\b0 \'ed\'e0 \'f4\'eb\'e5\'f8\'ea\'f3, \'ea\'e0\'ea \'ef\'e5\'f0\'e2\'e8\'f7\'ed\'ee\'e9 \'f1\'e8\'f1\'f2\'e5\'ec\'ee\'e9, \'e8\'e7-\'ef\'ee\'e4 \'ea\'ee\'f2\'ee\'f0\'ee\'e9 \'e1\'f3\'e4\'f3\'f2 \'e7\'e0\'ef\'f3\'f9\'e5\'ed\'fb \'e7\'e0\'e3\'f0\'f3\'e7\'f7\'e8\'ea\'e8 \cf1\b\'ca\'ee\'eb\'e8\'e1\'f0\'e8\cf0\b0 . \'ca\'ee\'ed\'e5\'f7\'ed\'ee, \'e2 \'fd\'f2\'ee\'ec \'f1\'eb\'f3\'f7\'e0\'e5 \'f1 \'f2\'ee\'f7\'ea\'e8 \'e7\'f0\'e5\'ed\'e8\'ff \'eb\'e8\'f6\'e5\'ed\'e7\'e8\'e8 \'eb\'f3\'f7\'f8\'e5 \'e8\'f1\'ef\'ee\'eb\'fc\'e7\'ee\'e2\'e0\'f2\'fc \'ef\'ee\'eb\'ed\'fb\'e5 \'e0\'ed\'e0\'eb\'ee\'e3\'e8 \cf2\lang1033\b DOS\cf0\lang1049\b0 , \'ea\'ee\'f2\'ee\'f0\'fb\'e5 \'e8\'ec\'e5\'fe\'f2 \'f1\'e2\'ee\'e1\'ee\'e4\'ed\'f3\'fe \'eb\'e8\'f6\'e5\'ed\'e7\'e8\'fe \'ed\'e0 \'e8\'f1\'ef\'ee\'eb\'fc\'e7\'ee\'e2\'e0\'ed\'e8\'e5, \'ed\'ee \'ed\'e5 \'e2 \'fd\'f2\'ee\'ec \'f1\'f3\'f2\'fc, \'f2\'e0\'ea \'f7\'f2\'ee \'ed\'e5 \'e1\'f3\'e4\'e5\'ec \'ee\'f2\'e2\'eb\'e5\'ea\'e0\'f2\'fc\'f1\'ff \'ed\'e0 \'ec\'e5\'eb\'ee\'f7\'e8.\par +\par +\'d3\'f1\'f2\'e0\'ed\'ee\'e2\'e8\'f2\'fc \cf2\lang1033\b DOS\cf0\lang1049\b0 \'ed\'e0 \'ab\'f4\'eb\'e5\'f8\'ea\'f3\'bb \'ec\'ee\'e6\'ed\'ee \'ed\'e5\'f1\'ea\'ee\'eb\'fc\'ea\'e8\'ec\'e8 \'f1\'ef\'ee\'f1\'ee\'e1\'e0\'ec\'e8:\par +\b\'e0)\b0 \cf2\b\'ce\'d1 \lang1033 Windows\cf0\lang1049\b0 \'ef\'f0\'e8 \'f4\'ee\'f0\'ec\'e0\'f2\'e8\'f0\'ee\'e2\'e0\'ed\'e8\'e8 \'f4\'eb\'e5\'f8\'ea\'e8 \'e2\'fb\'e1\'f0\'e0\'f2\'fc \'ef\'f3\'ed\'ea\'f2 \'f1\'ea\'ee\'ef\'e8\'f0\'ee\'e2\'e0\'f2\'fc \'f1\'e8\'f1\'f2\'e5\'ec\'ed\'fb\'e5 \'f4\'e0\'e9\'eb\'fb, \'e2 \'ee\'e1\'f9\'e5\'ec, \'f2\'ee \'e6\'e5 \'f1\'e0\'ec\'ee\'e5 \'f7\'f2\'ee \'e8 \'e4\'eb\'ff \'f4\'eb\'ee\'ef\'ef\'e8 \'e4\'e8\'f1\'ea\'e5\'f2\'fb. \'ca \'f1\'ee\'e6\'e0\'eb\'e5\'ed\'e8\'fe, \'fd\'f2\'ee\'f2 \'ec\'e5\'f2\'ee\'e4 \'ef\'ee\'e4\'f5\'ee\'e4\'e8\'f2 \'f2\'ee\'eb\'fc\'ea\'ee \'e4\'eb\'ff \'eb\'e8\'ed\'e5\'e9\'ea\'e8 \b 9\'f5\b0 , \'ed\'e0 \b 2\'ca\b0 \'ed\'e5 \'ef\'f0\'ee\'e2\'e5\'f0\'ff\'eb, \'ed\'ee \'e2 \b\'d5\'d0\b0 \'fd\'f2\'ee\'f2 \'ef\'f3\'ed\'ea\'f2 \'ed\'e5\'e4\'ee\'f1\'f2\'f3\'ef\'e5\'ed.\par +\b\'e1) \cf2\lang1033 DOS\cf0\lang1049\b0 \'ef\'f0\'e8 \'ed\'e0\'eb\'e8\'f7\'e8\'e8 \'fd\'ec\'f3\'eb\'ff\'f6\'e8\'e8 \'ab\'f4\'eb\'e5\'f8\'ea\'e8\'bb \'ea\'e0\'ea \'e3\'e8\'e1\'ea\'ee\'e3\'ee \'e8\'eb\'e8 \'e6\'e5\'f1\'f2\'ea\'ee\'e3\'ee \'e4\'e8\'f1\'ea\'e0 \'ec\'ee\'e6\'e5\'f2 \'f1\'e4\'e5\'eb\'e0\'f2\'fc \'e4\'e8\'f1\'ea \'e7\'e0\'e3\'f0\'f3\'e7\'ee\'f7\'ed\'fb\'ec. \'c4\'eb\'ff \'fd\'f2\'ee\'e3\'ee \'ed\'f3\'e6\'ed\'ee \'e2\'e2\'e5\'f1\'f2\'e8 \'ea\'ee\'ec\'e0\'ed\'e4\'f3 \lang1033\b sys\lang1049 \lang1033 X\lang1049 :\b0 \'e3\'e4\'e5 \b\'d5\b0 \'e7\'e0\'ec\'e5\'ed\'e8\'f2\'fc \'ed\'e0 \'e1\'f3\'ea\'e2\'f3, \'ef\'ee\'e4 \'ea\'ee\'f2\'ee\'f0\'ee\'e9 \'f3 \'e2\'e0\'f1 \'e7\'ed\'e0\'f7\'e8\'f2\'f1\'ff \'fd\'ec\'f3\'eb\'e8\'f0\'f3\'e5\'ec\'fb\'e9\cf2\b \lang1033 Flash\cf0\lang1049\b0 \'ed\'e0\'ea\'ee\'ef\'e8\'f2\'e5\'eb\'fc (\cf3\b\'c1\'f3\'e4\'fc\'f2\'e5 \'ee\'f1\'f2\'ee\'f0\'ee\'e6\'ed\'fb, \'e5\'f1\'eb\'e8 \'e2\'fb \'f3\'ea\'e0\'e6\'e8\'f2\'e5 \'ed\'e5 \'f2\'ee\'f2 \'e4\'e8\'f1\'ea, \'f2\'ee \'ec\'ee\'e6\'e5\'f2\'e5 \'f3\'e1\'e8\'f2\'fc \'e7\'e0\'e3\'f0\'f3\'e7\'f7\'e8\'ea \'f3\'f1\'f2\'e0\'ed\'ee\'e2\'eb\'e5\'ed\'ed\'ee\'e9 \'ed\'e0 \'e2\'e0\'f8 \'e6\'e5\'f1\'f2\'ea\'e8\'e9 \'e4\'e8\'f1\'ea \'ce\'d1\cf0\b0 ). \'cf\'f0\'e8 \'fd\'f2\'ee\'ec \cf2\lang1033\b DOS\lang1049 ,\cf0\b0 \'ec\'ee\'e6\'e5\'f2, \'e8 \'e1\'f3\'e4\'e5\'f2 \'f0\'f3\'e3\'e0\'f2\'fc\'f1\'ff, \'ed\'ee \'ed\'e5 \'ee\'e1\'f0\'e0\'f9\'e0\'e9\'f2\'e5 \'ed\'e0 \'fd\'f2\'ee \'e2\'ed\'e8\'ec\'e0\'ed\'e8\'e5 \'e8 \'e2\'fb\'e1\'e5\'f0\'e8\'f2\'e5 \lang1033\b F\lang1049 \b0 (\'ef\'f0\'ee\'e4\'ee\'eb\'e6\'e8\'f2\'fc), \'e3\'eb\'e0\'e2\'ed\'ee\'e5 \'f7\'f2\'ee\'e1\'fb \'e2 \'e7\'e0\'e3\'f0\'f3\'e7\'ee\'f7\'ed\'fb\'e9 \'f1\'e5\'ea\'f2\'ee\'f0 \'ed\'e0\'ea\'ee\'ef\'e8\'f2\'e5\'eb\'ff \'e1\'fb\'eb \'e7\'e0\'ef\'e8\'f1\'e0\'ed \'e7\'e0\'e3\'f0\'f3\'e7\'f7\'e8\'ea, \'ea\'ee\'f2\'ee\'f0\'fb\'e9 \'e8 \'e1\'f3\'e4\'e5\'f2 \'e7\'e0\'ef\'f3\'f1\'ea\'e0\'f2\'fc\cf2\b \lang1033 DOS\cf0\lang1049\b0 \'f1 \'ab\'f4\'eb\'e5\'f8\'ea\'e8\'bb.\par +\'c2 \'f0\'e5\'e7\'f3\'eb\'fc\'f2\'e0\'f2\'e5 \'ec\'fb \'e1\'f3\'e4\'e5\'ec \'e8\'ec\'e5\'f2\'fc \cf2\lang1033\b USB\lang1049 \lang1033 Flash\cf0\lang1049\b0 \'ed\'e0\'ea\'ee\'ef\'e8\'f2\'e5\'eb\'fc \'f1 \'f3\'f1\'f2\'e0\'ed\'ee\'e2\'eb\'e5\'ed\'ed\'fb\'ec \cf2\lang1033\b DOS\cf0\lang1049\b0 .\par +\par +\'c8\'e7 \'e2\'f1\'e5\'f5 \'f4\'e0\'e9\'eb\'ee\'e2, \'ea\'ee\'f2\'ee\'f0\'fb\'e5 \'e1\'f3\'e4\'f3\'f2 \'ed\'e0\'f5\'ee\'e4\'e8\'f2\'fc\'f1\'ff \'ed\'e0 \'ab\'f4\'eb\'e5\'f8\'ea\'e5\'bb \'ed\'e5\'ee\'e1\'f5\'ee\'e4\'e8\'ec\'fb \'f2\'ee\'eb\'fc\'ea\'ee \b Command.com, Io.sys, Msdos.sys - \b0\'ee\'f1\'f2\'e0\'eb\'fc\'ed\'fb\'e5 \'ec\'ee\'e6\'ed\'ee \'f3\'e4\'e0\'eb\'e8\'f2\'fc, \'e4\'eb\'ff \'ed\'e0\'f8\'e8\'f5 \'f6\'e5\'eb\'e5\'e9 \'ee\'ed\'e8 \'ed\'e5 \'ed\'f3\'e6\'ed\'fb. \'c5\'f1\'eb\'e8 \'ef\'ee \'ea\'e0\'ea\'ee\'e9 \'eb\'e8\'e1\'ee \'ef\'f0\'e8\'f7\'e8\'ed\'e5 \'fd\'f2\'e8 \'f2\'f0\'e8 \'f4\'e0\'e9\'eb\'e0 \'ed\'e5 \'f1\'ea\'ee\'ef\'e8\'f0\'ee\'e2\'e0\'eb\'e8\'f1\'fc \'ed\'e0 \'ed\'e0\'ea\'ee\'ef\'e8\'f2\'e5\'eb\'fc, \'f2\'ee \'f1\'ea\'ee\'ef\'e8\'f0\'f3\'e9\'f2\'e5 \'e8\'f5 \'e2\'f0\'f3\'f7\'ed\'f3\'fe. \'c4\'e0\'eb\'e5\'e5 \'e6\'e5\'eb\'e0\'f2\'e5\'eb\'fc\'ed\'ee \'ef\'e5\'f0\'e5\'e7\'e0\'e3\'f0\'f3\'e7\'e8\'f2\'fc \'ea\'ee\'ec\'ef\'fc\'fe\'f2\'e5\'f0 \'e8 \'ef\'f0\'ee\'e2\'e5\'f0\'e8\'f2\'fc \'e7\'e0\'e3\'f0\'f3\'e7\'ea\'f3 \cf2\lang1033\b DOS\cf0\lang1049\b0 \'f1 \'f4\'eb\'e5\'f8\'ea\'e8. \'c5\'f1\'eb\'e8 \'e2\'f1\'e5 \'ef\'f0\'ee\'e9\'e4\'e5\'f2 \'ed\'ee\'f0\'ec\'e0\'eb\'fc\'ed\'ee, \'f2\'ee \'e2\'fb \'ef\'ee\'eb\'f3\'f7\'e8\'f2\'e5 \'ef\'f0\'e8\'e3\'eb\'e0\'f8\'e5\'ed\'e8\'e5 \'ea\'ee\'ec\'e0\'ed\'e4\'ed\'ee\'e9 \'f1\'f2\'f0\'ee\'ea\'e8 \cf2\lang1033\b DOS\cf0\lang1049\b0 , \'e2 \'ef\'f0\'ee\'f2\'e8\'e2\'ed\'ee\'ec \'f1\'eb\'f3\'f7\'e0\'e5 \'ed\'f3\'e6\'ed\'ee \'ef\'ee\'ef\'fb\'f2\'e0\'f2\'fc\'f1\'ff \'f3\'f1\'f2\'e0\'ed\'ee\'e2\'e8\'f2\'fc \'f1\'ed\'ee\'e2\'e0.\par +\'c2 \'e4\'ee\'ef\'ee\'eb\'ed\'e5\'ed\'e8\'e5 \'ea \'fd\'f2\'e8\'ec \'f2\'f0\'e5\'ec \'f4\'e0\'e9\'eb\'e0\'ec \'ef\'ee\'f2\'f0\'e5\'e1\'f3\'e5\'f2\'f1\'ff \'e2 \'f0\'f3\'f7\'ed\'f3\'fe \'f1\'ee\'e7\'e4\'e0\'f2\'fc \'e5\'f9\'e5 \'ef\'e0\'f0\'f3 \'ef\'f3\'f1\'f2\'fb\'f5 \'f4\'e0\'e9\'eb\'ee\'e2: \b Config.sys, Autoexec.bat\b0 - \'fd\'f2\'ee \'ed\'e5\'ee\'e1\'f5\'ee\'e4\'e8\'ec\'ee, \'e4\'eb\'ff \'f2\'ee\'e3\'ee \'f7\'f2\'ee\'e1\'fb \'f1\'e4\'e5\'eb\'e0\'f2\'fc \'e2\'ef\'ee\'f1\'eb\'e5\'e4\'f1\'f2\'e2\'e8\'e8 \'ef\'ee\'eb\'ed\'ee\'f1\'f2\'fc\'fe \'e0\'e2\'f2\'ee\'ec\'e0\'f2\'e8\'f7\'e5\'f1\'ea\'f3\'fe \'e7\'e0\'e3\'f0\'f3\'e7\'ea\'f3 \cf2\b\'ca\'ee\'eb\'e8\'e1\'f0\'e8\cf0\b0 , \'e0 \'ed\'e5 \'f1\'f2\'e0\'f0\'f2\'ee\'e2\'e0\'f2\'fc \'e7\'e0\'e3\'f0\'f3\'e7\'f7\'e8\'ea \'e8\'e7 \'ea\'ee\'ec\'e0\'ed\'e4\'ed\'ee\'e9 \'f1\'f2\'f0\'ee\'ea\'e8 \'ea\'e0\'e6\'e4\'fb\'e9 \'f0\'e0\'e7.\par +\par +\'cd\'f3, \'e2\'ee\'f2 \'ef\'ee\'eb\'ee\'e2\'e8\'ed\'e0 \'f0\'e0\'e1\'ee\'f2\'fb \'f1\'e4\'e5\'eb\'e0\'ed\'e0. \'c4\'e0\'eb\'e5\'e5 \'e2\'ee\'e7\'ed\'e8\'ea\'e0\'fe\'f2 \'ed\'e5\'ea\'ee\'f2\'ee\'f0\'fb\'e5 \'f2\'f0\'f3\'e4\'ed\'ee\'f1\'f2\'e8, \'ea\'ee\'f2\'ee\'f0\'fb\'e5 \'ec\'fb \'f3\'f1\'ef\'e5\'f8\'ed\'ee \'f0\'e0\'e7\'f0\'e5\'f8\'e8\'ec (\'e4\'eb\'ff \'f2\'ee\'e3\'ee \'ff \'e8 \'ef\'e8\'f1\'e0\'eb \'fd\'f2\'f3 \'f1\'f2\'e0\'f2\'fc\'fe).\par +\'d2\'f0\'f3\'e4\'ed\'ee\'f1\'f2\'e8 \'e7\'e0\'ea\'eb\'fe\'f7\'e0\'fe\'f2\'f1\'ff \'e2 \'f2\'ee\'ec, \'f7\'f2\'ee \'e2 \'f1\'f2\'e0\'ed\'e4\'e0\'f0\'f2\'ed\'ee\'ec \'e2\'e0\'f0\'e8\'e0\'ed\'f2\'e5 \'ed\'e8 \'ee\'e4\'e8\'ed \'e7\'e0\'e3\'f0\'f3\'e7\'f7\'e8\'ea\'e8 \'ed\'e5 \'e7\'e0\'e3\'f0\'f3\'e6\'e0\'e5\'f2 \lang1033\b IMG\lang1049\b0 \'ee\'e1\'f0\'e0\'e7 \'e2 \'ef\'e0\'ec\'ff\'f2\'fc (\'e7\'e0\'e3\'f0\'f3\'e6\'e0\'e5\'f2\'f1\'ff \'e8 \'e7\'e0\'ef\'f3\'f1\'ea\'e0\'e5\'f2\'f1\'ff \'f2\'ee\'eb\'fc\'ea\'ee \'ff\'e4\'f0\'ee), \'ef\'ee\'f1\'ea\'ee\'eb\'fc\'ea\'f3 \'ef\'ee\'e4\'f0\'e0\'e7\'f3\'ec\'e5\'e2\'e0\'e5\'f2\'f1\'ff, \'f7\'f2\'ee \'ee\'e1\'f0\'e0\'e7 \'e1\'f3\'e4\'e5\'f2 \'e7\'e0\'e3\'f0\'f3\'e6\'e5\'ed \'ff\'e4\'f0\'ee\'ec. \'cd\'ee \'ea\'e0\'ea \'e2\'fb, \'ed\'e0\'e2\'e5\'f0\'ed\'ee\'e5, \'f3\'e6\'e5 \'e4\'ee\'e3\'e0\'e4\'e0\'eb\'e8\'f1\'fc \'ee\'e1\'f0\'e0\'e7 \'ff\'e4\'f0\'f3 \'e3\'f0\'f3\'e7\'e8\'f2\'fc \'ef\'f0\'ee\'f1\'f2\'ee \'ed\'e5 \'ee\'f2\'ea\'f3\'e4\'e0, \'f2\'e0\'ea \'ea\'e0\'ea \'f1 \cf2\lang1033\b USB\cf0\lang1049\b0 \'f3\'f1\'f2\'f0\'ee\'e9\'f1\'f2\'e2\'e0\'ec\'e8 \cf2\b\'ca\'ee\'eb\'e8\'e1\'f0\'e8\cf0\b0 \'ef\'ee\'ea\'e0 \'ed\'e5 \'e4\'f0\'f3\'e6\'e8\'f2.\par +\par +\'ce\'f2\'f1\'fe\'e4\'e0 \'ee\'f1\'f2\'e0\'e5\'f2\'f1\'ff \'ee\'e4\'e8\'ed \'e2\'fb\'f5\'ee\'e4 - \'f1\'e4\'e5\'eb\'e0\'f2\'fc \'f2\'e0\'ea \'f7\'f2\'ee\'e1\'fb \'e7\'e0\'e3\'f0\'f3\'e7\'f7\'e8\'ea \'e7\'e0\'e3\'f0\'f3\'e7\'e8\'eb \'ed\'e5 \'f2\'ee\'eb\'fc\'ea\'ee \'ff\'e4\'f0\'ee, \'ed\'ee \'e8 \'ee\'e1\'f0\'e0\'e7 \'ef\'ee \'ed\'f3\'e6\'ed\'ee\'ec\'f3 \'ec\'e5\'f1\'f2\'f3 \'e2 \'ef\'e0\'ec\'ff\'f2\'e8. \'cd\'ce! (\'ce\'ef\'ff\'f2\'fc \'fd\'f2\'ee \'ed\'ee!) \'c7\'e0\'e3\'f0\'f3\'e7\'f7\'e8\'ea \'e7\'e0\'ef\'f3\'f9\'e5\'ed \'e2 \cf2\lang1033\b DOS\cf0\lang1049\b0 , \'ea\'ee\'f2\'ee\'f0\'fb\'e9 \'f0\'e0\'e1\'ee\'f2\'e0\'e5\'f2 \'e2 \'f0\'e5\'e0\'eb\'fc\'ed\'ee\'ec (\lang1033\b Real\lang1049 \lang1033 mode\lang1049\b0 ) \'f0\'e5\'e6\'e8\'ec\'e5 \'ef\'f0\'ee\'f6\'e5\'f1\'f1\'ee\'f0\'e0, \'f1 \'ee\'e3\'f0\'e0\'ed\'e8\'f7\'e5\'ed\'e8\'e5\'ec \'ed\'e0 \'e0\'e4\'f0\'e5\'f1\'e0\'f6\'e8\'fe \'ef\'e0\'ec\'ff\'f2\'e8 \'e2 \b 1 \'cc\'e1\b0 , \'e0 \'ee\'e1\'f0\'e0\'e7 \'e2 \'e0\'e4\'f0\'e5\'f1\'ed\'ee\'ec \'ef\'f0\'ee\'f1\'f2\'f0\'e0\'ed\'f1\'f2\'e2\'e5 \cf1\b\'ca\'ee\'eb\'e8\'e1\'f0\'e8\cf0\b0 \'ea\'e0\'ea \'f0\'e0\'e7 \'e4\'ee\'eb\'e6\'e5\'ed \'f0\'e0\'f1\'ef\'ee\'eb\'e0\'e3\'e0\'f2\'fc\'f1\'ff, \'e0\'ea\'ea\'f3\'f0\'e0\'f2 \'ed\'e0\'f7\'e8\'ed\'e0\'ff \'f1 \'ef\'e5\'f0\'e2\'ee\'e3\'ee \'ec\'e5\'e3\'e0\'e1\'e0\'e9\'f2\'e0 \'e8 \'e4\'e0\'eb\'e5\'e5 \'e2 \'ef\'e0\'ec\'ff\'f2\'e8.\par +\'ca\'e0\'ea \'e6\'e5 \'e1\'fb\'f2\'fc? \'dd\'e2\'f0\'e8\'ea\'e0! \lang1033\b DOS\lang1049\b0 \'e2\'e5\'e4\'fc \'ec\'ee\'e6\'e5\'f2 \'ee\'e1\'f0\'e0\'f9\'e0\'f2\'fc\'f1\'ff \'f7\'e5\'f0\'e5\'e7 \'e4\'ee\'ef\'ee\'eb\'ed\'e8\'f2\'e5\'eb\'fc\'ed\'fb\'e5 \'e4\'f0\'e0\'e9\'e2\'e5\'f0\'fb \'ea \'ef\'e0\'ec\'ff\'f2\'e8 \'e2\'fb\'f8\'e5 \'ef\'e5\'f0\'e2\'ee\'e3\'ee \'ec\'e5\'e3\'e0\'e1\'e0\'e9\'f2\'e0 (\'ea\'f1\'f2\'e0\'f2\'e8 \'f2\'e0\'ea \'e8 \'ef\'ee\'f1\'f2\'f3\'ef\'e0\'e5\'f2 \'ff\'e4\'f0\'ee \'ef\'f0\'e8 \'e7\'e0\'e3\'f0\'f3\'e7\'ea\'e5 \'ee\'e1\'f0\'e0\'e7\'e0 \'f1 \'f4\'eb\'ee\'ef\'ef\'e8), \'ed\'ee \'f0\'e5\'e0\'eb\'e8\'e7\'ee\'e2\'e0\'ed\'ee \'fd\'f2\'ee \'f2\'e0\'ea \'ea\'ee\'f0\'ff\'e2\'ee, \'f7\'f2\'ee \'ef\'ee\'eb\'fc\'e7\'ee\'e2\'e0\'f2\'fc\'f1\'ff \'fd\'f2\'e8\'ec \'ed\'e5 \'f5\'ee\'f7\'e5\'f2\'f1\'ff \'f1\'ee\'e2\'f1\'e5\'ec. (\'ca\'ee\'ed\'e5\'f7\'ed\'ee \'fd\'f2\'ee \'ec\'ee\'e5 \'f1\'f3\'e1\'fa\'e5\'ea\'f2\'e8\'e2\'ed\'ee\'e5 \'ec\'ed\'e5\'ed\'e8\'e5).\par +\par +\'ce\'e4\'ed\'ee\'e2\'f0\'e5\'ec\'e5\'ed\'ed\'ee \'f1 \'fd\'f2\'e8\'ec \'e5\'f1\'f2\'fc \'e4\'f0\'f3\'e3\'ee\'e9 \'f1\'ef\'ee\'f1\'ee\'e1 \'ee\'e1\'f0\'e0\'f2\'e8\'f2\'fc\'f1\'ff \'ea \'ef\'e0\'ec\'ff\'f2\'e8 \'e2\'fb\'f8\'e5 \'ef\'e5\'f0\'e2\'ee\'e3\'ee \'ec\'e5\'e3\'e0\'e1\'e0\'e9\'f2\'e0. \'c2 \'ef\'f0\'ee\'f6\'e5\'f1\'f1\'ee\'f0\'e0\'f5 \b\'f586\b0 \'f1\'f3\'f9\'e5\'f1\'f2\'e2\'f3\'e5\'f2 \'e2\'ee\'e7\'ec\'ee\'e6\'ed\'ee\'f1\'f2\'fc \'f3\'f1\'f2\'e0\'ed\'ee\'e2\'e8\'f2\'fc \'ed\'e5\'e4\'ee\'ea\'f3\'ec\'e5\'ed\'f2\'e8\'f0\'ee\'e2\'e0\'ed\'ed\'fb\'e9, \'ed\'ee \'f1\'f7\'e8\'f2\'e0\'fe\'f9\'e8\'e9\'f1\'ff \'ef\'f0\'e0\'ea\'f2\'e8\'f7\'e5\'f1\'ea\'e8 \'f1\'f2\'e0\'ed\'e4\'e0\'f0\'f2\'ed\'fb\'ec \'ab\'ed\'e5\'f0\'e5\'e0\'eb\'fc\'ed\'fb\'e9\'bb (\lang1033\b Unreal\lang1049 \lang1033 mode\lang1049\b0 ) \'f0\'e5\'e6\'e8\'ec \'f0\'e0\'e1\'ee\'f2\'fb.\par +\'ca\'ee\'ed\'e5\'f7\'ed\'ee, \'ef\'f0\'ff\'ec\'e0\'ff \'e0\'e4\'f0\'e5\'f1\'e0\'f6\'e8\'ff \'e2 \'f2\'e0\'ea\'ee\'ec \'f0\'e5\'e6\'e8\'ec\'e5 \'ed\'e5\'e2\'ee\'e7\'ec\'ee\'e6\'ed\'e0, \'ed\'ee \'ec\'ee\'e6\'ed\'ee \'ee\'e1\'f0\'e0\'f9\'e0\'f2\'fc\'f1\'ff \'ea \'ef\'e0\'ec\'ff\'f2\'e8 \'ea\'ee\'f1\'e2\'e5\'ed\'ed\'ee \'f7\'e5\'f0\'e5\'e7 \'f0\'e5\'e3\'e8\'f1\'f2\'f0\'fb, \'f3 \'ea\'ee\'f2\'ee\'f0\'fb\'f5 \'e1\'fb\'eb\'e8 \'e8\'e7\'ec\'e5\'ed\'e5\'ed\'fb \'eb\'e8\'ec\'e8\'f2\'fb \'e0\'e4\'f0\'e5\'f1\'e0\'f6\'e8\'e8.\par +\'c2 \'f0\'e5\'e7\'f3\'eb\'fc\'f2\'e0\'f2\'e5 \'ef\'ee\'eb\'f3\'f7\'e0\'e5\'ec \'f1\'f0\'e0\'e2\'ed\'e8\'f2\'e5\'eb\'fc\'ed\'ee \'ef\'f0\'ee\'f1\'f2\'ee\'e9 \'f1\'ef\'ee\'f1\'ee\'e1 \'e4\'ee\'f1\'f2\'f3\'ef\'e0 \'ea \'ef\'e0\'ec\'ff\'f2\'e8 \'e2\'ef\'eb\'ee\'f2\'fc \'e4\'ee \b 4 \'c3\'e1,\b0 \'ed\'e0\'f5\'ee\'e4\'ff\'f1\'fc \'f4\'e0\'ea\'f2\'e8\'f7\'e5\'f1\'ea\'e8 \'e2 \'f0\'e5\'e0\'eb\'fc\'ed\'ee\'ec \'f0\'e5\'e6\'e8\'ec\'e5 \'f0\'e0\'e1\'ee\'f2\'fb \'ef\'f0\'ee\'f6\'e5\'f1\'f1\'ee\'f0\'e0.\par +\par +\'c2 \'f0\'e5\'e7\'f3\'eb\'fc\'f2\'e0\'f2\'e5 \'ff \'e4\'ee\'f0\'e0\'e1\'ee\'f2\'e0\'eb \'e7\'e0\'e3\'f0\'f3\'e7\'f7\'e8\'ea \lang1033\b meosload\lang1049 .\lang1033 com\lang1049\b0 (\'ef\'ee\'f1\'ea\'ee\'eb\'fc\'ea\'f3 \'e2 \'e5\'e3\'ee \'ea\'ee\'e4\'e5 \'ec\'ed\'e5 \'ee\'ea\'e0\'e7\'e0\'eb\'ee\'f1\'fc \'ef\'f0\'ee\'f9\'e5 \'f0\'e0\'e7\'ee\'e1\'f0\'e0\'f2\'fc\'f1\'ff), \'f2\'e5\'ef\'e5\'f0\'fc \'ee\'ed \'e7\'e0\'e3\'f0\'f3\'e6\'e0\'e5\'f2 \'e8 \'ff\'e4\'f0\'ee \'e8 \'ee\'e1\'f0\'e0\'e7, \'e0 \'e7\'e0\'f2\'e5\'ec \'f1\'f2\'e0\'f0\'f2\'f3\'e5\'f2 \b\'ce\'d1\b0 .\par +\'c4\'eb\'ff \'e2\'ea\'eb\'fe\'f7\'e5\'ed\'e8\'ff \'ab\'ed\'e5\'f0\'e5\'e0\'eb\'fc\'ed\'ee\'e3\'ee\'bb \'f0\'e5\'ec\'e0 \'f0\'e0\'e1\'ee\'f2\'fb \'ef\'f0\'ee\'f6\'e5\'f1\'f1\'ee\'f0\'e0 \'ff \'e8\'e7\'ed\'e0\'f7\'e0\'eb\'fc\'ed\'ee \'e8\'f1\'ef\'ee\'eb\'fc\'e7\'ee\'e2\'e0\'eb \'ea\'ee\'e4, \'e2\'e7\'ff\'f2\'fb\'e9 \'f1 \cf1\ul \cf0\ulnone \'ea\'ee\'f2\'ee\'f0\'fb\'e9 \'ff \'ef\'e5\'f0\'e5\'f0\'e0\'e1\'ee\'f2\'e0\'eb \'e2 \'ef\'f0\'ee\'e3\'f0\'e0\'ec\'ec\'f3 \b enable.exe\par +\b0\'cf\'ee\'e7\'e6\'e5 \'ea\'ee\'e4 \'e1\'fb\'eb \'ef\'e5\'f0\'e5\'ef\'e8\'f1\'e0\'ed \'ed\'e0 \'f1\'e8\'ed\'f2\'e0\'ea\'f1\'e8\'f1 \lang1033\b FASM\lang1049\b0 (\'ee\'f0\'e8\'e3\'e8\'ed\'e0\'eb \'e1\'fb\'eb \'e4\'eb\'ff \lang1033\b TASM\lang1049\b0 ), \'f2\'ee\'e2\'e0\'f0\'e8\'f9\'e5\'ec \cf2\lang1033\b Serge\cf0\lang1049\b0 , \'e7\'e0 \'f7\'f2\'ee \'e5\'ec\'f3 \'ee\'e3\'f0\'ee\'ec\'ed\'ee\'e5 \'f1\'ef\'e0\'f1\'e8\'e1\'ee, \'ef\'ee\'f1\'ea\'ee\'eb\'fc\'ea\'f3 \'f3 \'ec\'e5\'ed\'ff \'ed\'e5 \'f5\'e2\'e0\'f2\'e8\'eb\'ee \'f3\'ec\'e0 \'e8 \'f2\'e5\'f0\'ef\'e5\'ed\'e8\'ff \'f1\'e4\'e5\'eb\'e0\'f2\'fc \'fd\'f2\'ee \'f1\'e0\'ec\'ee\'ec\'f3.\par +\par +\'c8\'f2\'e0\'ea, \'fd\'f2\'ee \'e1\'fb\'eb\'ee \'e4\'eb\'e8\'ed\'ed\'ee\'e5 \'ee\'f2\'f1\'f2\'f3\'ef\'eb\'e5\'ed\'e8\'e5, \'ed\'ee \'e1\'e5\'e7 \'ed\'e5\'e3\'ee \'e2\'fb \'e1\'fb \'ed\'e5 \'ef\'ee\'ed\'ff\'eb\'e8 \'e2\'f1\'fe \'e8\'e4\'e5\'fe \'ef\'f0\'e5\'e4\'eb\'ee\'e6\'e5\'ed\'ed\'ee\'e3\'ee \'ec\'ed\'ee\'e9 \'f1\'ef\'ee\'f1\'ee\'e1\'e0 \'e7\'e0\'e3\'f0\'f3\'e7\'ea\'e8.\par +\'ce\'f1\'f2\'e0\'eb\'ee\'f1\'fc \'eb\'e8\'f8\'fc \'f1\'ea\'ee\'ef\'e8\'f0\'ee\'e2\'e0\'f2\'fc \'ed\'e0 \'ab\'f4\'eb\'e5\'f8\'ea\'f3\'bb \'f4\'e0\'e9\'eb\'fb \b enable.exe \b0\'e8 \lang1033\b meosload\lang1049 .\lang1033 com\lang1049 ,\b0 \'e0 \'f2\'e0\'ea\'e6\'e5 \'ef\'f0\'ee\'ef\'e8\'f1\'e0\'f2\'fc \'e2 \b Autoexec.bat \b0\'e8\'f5 \'e7\'e0\'e3\'f0\'f3\'e7\'ea\'f3 (\b Autoexec.bat\b0 \'ec\'ee\'e6\'ed\'ee \'f0\'e5\'e4\'e0\'ea\'f2\'e8\'f0\'ee\'e2\'e0\'f2\'fc \'eb\'fe\'e1\'fb\'ec \'f2\'e5\'ea\'f1\'f2\'ee\'e2\'fb\'ec \'f0\'e5\'e4\'e0\'ea\'f2\'ee\'f0\'ee\'ec) \'e8, \'f0\'e0\'e7\'f3\'ec\'e5\'e5\'f2\'f1\'ff, \'ed\'e0 \'ab\'f4\'eb\'e5\'f8\'ea\'e5\'bb \'e2 \'ea\'ee\'f0\'ed\'e5 \'e4\'e8\'f1\'ea\'e0 \'e4\'ee\'eb\'e6\'e5\'ed \'ed\'e0\'f5\'ee\'e4\'e8\'f2\'fc\'f1\'ff \'f1\'e0\'ec \'f4\'e0\'e9\'eb \'ee\'e1\'f0\'e0\'e7\'e0 \lang1033\b kolibri\lang1049 .\lang1033 img\lang1049 .\par +\b0\par +\'c2\'ee\'f2 \'e2 \'ef\'f0\'e8\'ed\'f6\'e8\'ef\'e5 \'e8 \'e2\'f1\'e5. \'ce\'f1\'f2\'e0\'eb\'ee\'f1\'fc \'ef\'e5\'f0\'e5\'e7\'e0\'e3\'f0\'f3\'e7\'e8\'f2\'fc \'ea\'ee\'ec\'ef\'fc\'fe\'f2\'e5\'f0 \'e8 \'e2\'fb\'e1\'f0\'e0\'f2\'fc \'e7\'e0\'e3\'f0\'f3\'e7\'ea\'f3 \'f1 \cf2\lang1033\b USB\lang1049 \lang1033 Flash\cf0\lang1049\b0 \'ed\'e0\'ea\'ee\'ef\'e8\'f2\'e5\'eb\'ff. \'c2 \'f1\'e8\'ed\'e5\'ec \'ee\'ea\'ed\'e5 \'e7\'e0\'e3\'f0\'f3\'e7\'ea\'e8 \'e2 \'ea\'e0\'f7\'e5\'f1\'f2\'e2\'e5 \'e7\'e0\'e3\'f0\'f3\'e7\'ee\'f7\'ed\'ee\'e3\'ee \'f3\'f1\'f2\'f0\'ee\'e9\'f1\'f2\'e2\'e0 \'ed\'f3\'e6\'ed\'ee \'e2\'fb\'e1\'f0\'e0\'f2\'fc \'ef\'f3\'ed\'ea\'f2 \b 3-\'e8\'f1\'ef\'ee\'eb\'fc\'e7\'ee\'e2\'e0\'f2\'fc \'f3\'e6\'e5 \'e7\'e0\'e3\'f0\'f3\'e6\'e5\'ed\'ed\'fb\'e9 \'ee\'e1\'f0\'e0\'e7.\par +\par +\b0 P.S.\par +1) \'d5\'ee\'f7\'f3 \'e2\'fb\'f0\'e0\'e7\'e8\'f2\'fc \'e1\'ee\'eb\'fc\'f8\'f3\'fe \'ef\'f0\'e8\'e7\'ed\'e0\'f2\'e5\'eb\'fc\'ed\'ee\'f1\'f2\'fc \'e7\'e0 \'ef\'ee\'ec\'ee\'f9\'fc \'e2 \'ef\'ee\'e4\'e3\'ee\'f2\'ee\'e2\'ea\'e5 \'ec\'e0\'f2\'e5\'f0\'e8\'e0\'eb\'e0 \cf2\b\'c0\'ed\'e4\'f0\'e5\'fe (NoName)\b0 , \b\'dd\'e4\'f3\'e0\'f0\'e4\'f3 (DoomEdArchangel)\b0 \'e8 \b\'d1\'e5\'f0\'e3\'e5\'fe (Serge).\cf0\b0\par +2) \'c2 \'e0\'f0\'f5\'e8\'e2\'e5 \'f1 \'fd\'f2\'e8\'ec \'f4\'e0\'e9\'eb\'ee\'ec \'f1\'ee\'e4\'e5\'f0\'e6\'e0\'f2\'fc\'f1\'ff \'f3\'ef\'ee\'ec\'ff\'ed\'f3\'f2\'fb\'e5 \'e2 \'f2\'e5\'ea\'f1\'f2\'e5 \b enable.exe \b0\'e8 \lang1033\b meosload\lang1049 .\lang1033 com\lang1049\b0 \'e8 \'e8\'f5 \'e8\'f1\'f5\'ee\'e4\'ed\'fb\'e5 \'ea\'ee\'e4\'fb.\par +} + \ No newline at end of file diff --git a/programs/hd_load/usb_boot_old/usb_boot_1251.txt b/programs/hd_load/usb_boot_old/usb_boot_1251.txt new file mode 100644 index 0000000000..187e6dd672 --- /dev/null +++ b/programs/hd_load/usb_boot_old/usb_boot_1251.txt @@ -0,0 +1,57 @@ +Автор: Mario79 +xx.01.2006 - набор статьи +20.03.2006 - публикация статьи +23.03.2006 - исправление и дополнение статьи +26.02.2007 - переработано и дополнено в связи с изменившимися реалиями + +Загрузка ОС Колибри с USB Flash Drive +На сегодняшний день ОС Колибри не имеет поддержки USB устройств на уровне самой системы, по этой причине для запуска с USB Flash накопителей приходится идти на определенные хитрости. +Существует 2 известных способа запустить ОС Колибри с «флешки». + +1) Эмуляция флоппи диска в BIOS. +Метод прост до тупости на «флешку» записывается IMG образ, с полной эмуляцией, то есть 0 сектор IMG образа становится 0 сектором «флешки», и так далее пока все сектора образа не будут скопированы на накопитель. Из недостатков этого способа сразу можно заметить потерю рабочего пространства выше 1,44 Мб. Особенно обидным это является для накопителей, емкость которых намного превышает этот размер. +Как производится такая «установка» системы в разных ос: +а) ОС Linux описание можно получить, введя в консоли команду man dd +б) ОС Windows запись можно произвести с помощью программы WinHex (или аналогичной), копированием 2880 секторов с диска A (floppy disk) на диск, который является Flash накопителем, начиная с 0 сектора. +в) DOS можно просто отформатировать эмулируемое устройство, разумеется, если это позволяет BIOS материнской платы компьютера. + +2) Эмуляция Flash накопителя как жесткого диска в BIOS. +Здесь надо сделать пояснение: даже если ваш BIOS эмулирует «флешку» как флоппи диск это совсем не означает, что вы ограничены размерами файловой системы FAT12, которая в основном применяется на флоппи дисках и имеет ограничение на размер около 4 Мб. +На практике это означает, что отформатированный в FAT16 накопитель будет замечательно видеться как флоппи диск с размером до 2 Гб. К сожалению, все мои попытки загрузиться с применением файловой системы FAT32, которая позволила бы на полный размер использовать USB Flash накопители размером более 2 Гб, не увенчались успешно. + +Вернемся непосредственно к загрузке. +Поскольку на данный момент Колибри не является полностью самостоятельной ОС, то повсеместно она применяется параллельно с другими ОС. Эта ситуация привела к тому, что собственного независимого загрузчика (если не считать флоппи диски) у Колибри фактически нет. +На сегодняшний день остались актуальными только 2 загрузчика: meosload.com и mtldr. +Оба могут запускаться из среды DOS. +Установка Колибри на флешку в моем варианте начинается с установки DOS на флешку, как первичной системой, из-под которой будут запущены загрузчики Колибри. Конечно, в этом случае с точки зрения лицензии лучше использовать полные аналоги DOS, которые имеют свободную лицензию на использование, но не в этом суть, так что не будем отвлекаться на мелочи. + +Установить DOS на «флешку» можно несколькими способами: +а) ОС Windows при форматировании флешки выбрать пункт скопировать системные файлы, в общем, то же самое что и для флоппи дискеты. К сожалению, этот метод подходит только для линейки 9х, на 2К не проверял, но в ХР этот пункт недоступен. +б) DOS при наличии эмуляции «флешки» как гибкого или жесткого диска может сделать диск загрузочным. Для этого нужно ввести команду sys X: где Х заменить на букву, под которой у вас значится эмулируемый Flash накопитель (Будьте осторожны, если вы укажите не тот диск, то можете убить загрузчик установленной на ваш жесткий диск ОС). При этом DOS, может, и будет ругаться, но не обращайте на это внимание и выберите F (продолжить), главное чтобы в загрузочный сектор накопителя был записан загрузчик, который и будет запускать DOS с «флешки». +В результате мы будем иметь USB Flash накопитель с установленным DOS. + +Из всех файлов, которые будут находиться на «флешке» необходимы только Command.com, Io.sys, Msdos.sys - остальные можно удалить, для наших целей они не нужны. Если по какой либо причине эти три файла не скопировались на накопитель, то скопируйте их вручную. Далее желательно перезагрузить компьютер и проверить загрузку DOS с флешки. Если все пройдет нормально, то вы получите приглашение командной строки DOS, в противном случае нужно попытаться установить снова. +В дополнение к этим трем файлам потребуется в ручную создать еще пару пустых файлов: Config.sys, Autoexec.bat - это необходимо, для того чтобы сделать впоследствии полностью автоматическую загрузку Колибри, а не стартовать загрузчик из командной строки каждый раз. + +Ну, вот половина работы сделана. Далее возникают некоторые трудности, которые мы успешно разрешим (для того я и писал эту статью). +Трудности заключаются в том, что в стандартном варианте ни один загрузчики не загружает IMG образ в память (загружается и запускается только ядро), поскольку подразумевается, что образ будет загружен ядром. Но как вы, наверное, уже догадались образ ядру грузить просто не откуда, так как с USB устройствами Колибри пока не дружит. + +Отсюда остается один выход - сделать так чтобы загрузчик загрузил не только ядро, но и образ по нужному месту в памяти. НО! (Опять это но!) Загрузчик запущен в DOS, который работает в реальном (Real mode) режиме процессора, с ограничением на адресацию памяти в 1 Мб, а образ в адресном пространстве Колибри как раз должен располагаться, аккурат начиная с первого мегабайта и далее в памяти. +Как же быть? Эврика! DOS ведь может обращаться через дополнительные драйверы к памяти выше первого мегабайта (кстати так и поступает ядро при загрузке образа с флоппи), но реализовано это так коряво, что пользоваться этим не хочется совсем. (Конечно это мое субъективное мнение). + +Одновременно с этим есть другой способ обратиться к памяти выше первого мегабайта. В процессорах х86 существует возможность установить недокументированный, но считающийся практически стандартным «нереальный» (Unreal mode) режим работы. +Конечно, прямая адресация в таком режиме невозможна, но можно обращаться к памяти косвенно через регистры, у которых были изменены лимиты адресации. +В результате получаем сравнительно простой способ доступа к памяти вплоть до 4 Гб, находясь фактически в реальном режиме работы процессора. + +В результате я доработал загрузчик meosload.com (поскольку в его коде мне оказалось проще разобраться), теперь он загружает и ядро и образ, а затем стартует ОС. +Для включения «нереального» рема работы процессора я изначально использовал код, взятый с который я переработал в программу enable.exe +Позже код был переписан на синтаксис FASM (оригинал был для TASM), товарищем Serge, за что ему огромное спасибо, поскольку у меня не хватило ума и терпения сделать это самому. + +Итак, это было длинное отступление, но без него вы бы не поняли всю идею предложенного мной способа загрузки. +Осталось лишь скопировать на «флешку» файлы enable.exe и meosload.com, а также прописать в Autoexec.bat их загрузку (Autoexec.bat можно редактировать любым текстовым редактором) и, разумеется, на «флешке» в корне диска должен находиться сам файл образа kolibri.img. + +Вот в принципе и все. Осталось перезагрузить компьютер и выбрать загрузку с USB Flash накопителя. В синем окне загрузки в качестве загрузочного устройства нужно выбрать пункт 3-использовать уже загруженный образ. + +P.S. +1) Хочу выразить большую признательность за помощь в подготовке материала Андрею (NoName), Эдуарду (DoomEdArchangel) и Сергею (Serge). +2) В архиве с этим файлом содержаться упомянутые в тексте enable.exe и meosload.com и их исходные коды. \ No newline at end of file diff --git a/programs/hd_load/usb_boot_old/usb_boot_866.txt b/programs/hd_load/usb_boot_old/usb_boot_866.txt new file mode 100644 index 0000000000..250e84d7b1 --- /dev/null +++ b/programs/hd_load/usb_boot_old/usb_boot_866.txt @@ -0,0 +1,57 @@ +Ђўв®а: Mario79 +xx.01.2006 - ­ Ў®а бв вмЁ +20.03.2006 - ЇгЎ«ЁЄ жЁп бв вмЁ +23.03.2006 - ЁбЇа ў«Ґ­ЁҐ Ё ¤®Ї®«­Ґ­ЁҐ бв вмЁ +26.02.2007 - ЇҐаҐа Ў®в ­® Ё ¤®Ї®«­Ґ­® ў бўп§Ё б Ё§¬Ґ­ЁўиЁ¬Ёбп ॠ«Ёп¬Ё + +‡ Јаг§Є  Ћ‘ Љ®«ЁЎаЁ б USB Flash Drive +Ќ  ᥣ®¤­пи­Ё© ¤Ґ­м Ћ‘ Љ®«ЁЎаЁ ­Ґ Ё¬ҐҐв Ї®¤¤Ґа¦ЄЁ USB гбва®©бвў ­  га®ў­Ґ б ¬®© бЁб⥬л, Ї® нв®© ЇаЁзЁ­Ґ ¤«п § ЇгбЄ  б USB Flash ­ Є®ЇЁвҐ«Ґ© ЇаЁе®¤Ёвбп Ё¤вЁ ­  ®ЇаҐ¤Ґ«Ґ­­лҐ еЁва®бвЁ. +‘гйҐбвўгҐв 2 Ё§ўҐбв­ле бЇ®б®Ў  § ЇгбвЁвм Ћ‘ Љ®«ЁЎаЁ б «д«ҐиЄЁ». + +1) ќ¬г«пжЁп д«®ЇЇЁ ¤ЁбЄ  ў BIOS. +ЊҐв®¤ Їа®бв ¤® вгЇ®бвЁ ­  «д«ҐиЄг» § ЇЁблў Ґвбп IMG ®Ўа §, б Ї®«­®© н¬г«пжЁҐ©, в® Ґбвм 0 ᥪв®а IMG ®Ўа §  бв ­®ўЁвбп 0 ᥪв®а®¬ «д«ҐиЄЁ», Ё в Є ¤ «ҐҐ Ї®Є  ўбҐ ᥪв®а  ®Ўа §  ­Ґ Ўг¤гв бЄ®ЇЁа®ў ­л ­  ­ Є®ЇЁвҐ«м. €§ ­Ґ¤®бв вЄ®ў нв®Ј® бЇ®б®Ў  ба §г ¬®¦­® § ¬ҐвЁвм Ї®вҐао а Ў®зҐЈ® Їа®бва ­бвў  ўлиҐ 1,44 ЊЎ. Ћб®ЎҐ­­® ®ЎЁ¤­л¬ нв® пў«пҐвбп ¤«п ­ Є®ЇЁвҐ«Ґ©, Ґ¬Є®бвм Є®в®але ­ ¬­®Ј® ЇаҐўли Ґв нв®в а §¬Ґа. +Љ Є Їа®Ё§ў®¤Ёвбп в Є п «гбв ­®ўЄ » бЁбвҐ¬л ў а §­ле ®б: + ) Ћ‘ Linux ®ЇЁб ­ЁҐ ¬®¦­® Ї®«гзЁвм, ўўҐ¤п ў Є®­б®«Ё Є®¬ ­¤г man dd +Ў) Ћ‘ Windows § ЇЁбм ¬®¦­® Їа®Ё§ўҐбвЁ б Ї®¬®ймо Їа®Ја ¬¬л WinHex (Ё«Ё  ­ «®ЈЁз­®©), Є®ЇЁа®ў ­ЁҐ¬ 2880 ᥪв®а®ў б ¤ЁбЄ  A (floppy disk) ­  ¤ЁбЄ, Є®в®ал© пў«пҐвбп Flash ­ Є®ЇЁвҐ«Ґ¬, ­ зЁ­ п б 0 ᥪв®а . +ў) DOS ¬®¦­® Їа®бв® ®вд®а¬ вЁа®ў вм н¬г«Ёа㥬®Ґ гбва®©бвў®, ࠧ㬥Ґвбп, Ґб«Ё нв® Ї®§ў®«пҐв BIOS ¬ вҐаЁ­бЄ®© Ї« вл Є®¬ЇмовҐа . + +2) ќ¬г«пжЁп Flash ­ Є®ЇЁвҐ«п Є Є ¦ҐбвЄ®Ј® ¤ЁбЄ  ў BIOS. +‡¤Ґбм ­ ¤® ᤥ« вм Ї®пб­Ґ­ЁҐ: ¤ ¦Ґ Ґб«Ё ў и BIOS н¬г«ЁагҐв «д«ҐиЄг» Є Є д«®ЇЇЁ ¤ЁбЄ н⮠ᮢᥬ ­Ґ ®§­ з Ґв, зв® ўл ®Ја ­ЁзҐ­л а §¬Ґа ¬Ё д ©«®ў®© бЁб⥬л FAT12, Є®в®а п ў ®б­®ў­®¬ ЇаЁ¬Ґ­пҐвбп ­  д«®ЇЇЁ ¤ЁбЄ е Ё Ё¬ҐҐв ®Ја ­ЁзҐ­ЁҐ ­  а §¬Ґа ®Є®«® 4 ЊЎ. +Ќ  Їа ЄвЁЄҐ нв® ®§­ з Ґв, зв® ®вд®а¬ вЁа®ў ­­л© ў FAT16 ­ Є®ЇЁвҐ«м Ўг¤Ґв § ¬Ґз вҐ«м­® ўЁ¤Ґвмбп Є Є д«®ЇЇЁ ¤ЁбЄ б а §¬Ґа®¬ ¤® 2 ѓЎ. Љ ᮦ «Ґ­Ёо, ўбҐ ¬®Ё Ї®ЇлвЄЁ § Јаг§Ёвмбп б ЇаЁ¬Ґ­Ґ­ЁҐ¬ д ©«®ў®© бЁб⥬л FAT32, Є®в®а п Ї®§ў®«Ё«  Ўл ­  Ї®«­л© а §¬Ґа ЁбЇ®«м§®ў вм USB Flash ­ Є®ЇЁвҐ«Ё а §¬Ґа®¬ Ў®«ҐҐ 2 ѓЎ, ­Ґ 㢥­з «Ёбм гбЇҐи­®. + +‚Ґа­Ґ¬бп ­ҐЇ®б।б⢥­­® Є § Јаг§ЄҐ. +Џ®бЄ®«мЄг ­  ¤ ­­л© ¬®¬Ґ­в Љ®«ЁЎаЁ ­Ґ пў«пҐвбп Ї®«­®бвмо б ¬®бв®п⥫쭮© Ћ‘, в® Ї®ўбҐ¬Ґбв­® ®­  ЇаЁ¬Ґ­пҐвбп Ї а ««Ґ«м­® б ¤агЈЁ¬Ё Ћ‘. ќв  бЁвг жЁп ЇаЁўҐ«  Є ⮬г, зв® б®Ўб⢥­­®Ј® ­Ґ§ ўЁбЁ¬®Ј® § Јаг§зЁЄ  (Ґб«Ё ­Ґ бзЁв вм д«®ЇЇЁ ¤ЁбЄЁ) г Љ®«ЁЎаЁ д ЄвЁзҐбЄЁ ­Ґв. +Ќ  ᥣ®¤­пи­Ё© ¤Ґ­м ®бв «Ёбм  Євг «м­л¬Ё в®«мЄ® 2 § Јаг§зЁЄ : meosload.com Ё mtldr. +ЋЎ  ¬®Јгв § ЇгбЄ вмбп Ё§ б।л DOS. +“бв ­®ўЄ  Љ®«ЁЎаЁ ­  д«ҐиЄг ў ¬®Ґ¬ ў аЁ ­вҐ ­ зЁ­ Ґвбп б гбв ­®ўЄЁ DOS ­  д«ҐиЄг, Є Є ЇҐаўЁз­®© бЁб⥬®©, Ё§-Ї®¤ Є®в®а®© Ўг¤гв § ЇгйҐ­л § Јаг§зЁЄЁ Љ®«ЁЎаЁ. Љ®­Ґз­®, ў н⮬ б«гз Ґ б в®зЄЁ §аҐ­Ёп «ЁжҐ­§ЁЁ «гзиҐ ЁбЇ®«м§®ў вм Ї®«­лҐ  ­ «®ЈЁ DOS, Є®в®алҐ Ё¬Ґов бў®Ў®¤­го «ЁжҐ­§Ёо ­  ЁбЇ®«м§®ў ­ЁҐ, ­® ­Ґ ў н⮬ бгвм, в Є зв® ­Ґ Ўг¤Ґ¬ ®вў«ҐЄ вмбп ­  ¬Ґ«®зЁ. + +“бв ­®ўЁвм DOS ­  «д«ҐиЄг» ¬®¦­® ­ҐбЄ®«мЄЁ¬Ё бЇ®б®Ў ¬Ё: + ) Ћ‘ Windows ЇаЁ д®а¬ вЁа®ў ­ЁЁ д«ҐиЄЁ ўлЎа вм Їг­Єв бЄ®ЇЁа®ў вм бЁб⥬­лҐ д ©«л, ў ®ЎйҐ¬, в® ¦Ґ б ¬®Ґ зв® Ё ¤«п д«®ЇЇЁ ¤ЁбЄҐвл. Љ ᮦ «Ґ­Ёо, нв®в ¬Ґв®¤ Ї®¤е®¤Ёв в®«мЄ® ¤«п «Ё­Ґ©ЄЁ 9е, ­  2Љ ­Ґ Їа®ўҐап«, ­® ў •ђ нв®в Їг­Єв ­Ґ¤®бвгЇҐ­. +Ў) DOS ЇаЁ ­ «ЁзЁЁ н¬г«пжЁЁ «д«ҐиЄЁ» Є Є ЈЁЎЄ®Ј® Ё«Ё ¦ҐбвЄ®Ј® ¤ЁбЄ  ¬®¦Ґв ᤥ« вм ¤ЁбЄ § Ја㧮з­л¬. „«п нв®Ј® ­г¦­® ўўҐбвЁ Є®¬ ­¤г sys X: Ј¤Ґ • § ¬Ґ­Ёвм ­  ЎгЄўг, Ї®¤ Є®в®а®© г ў б §­ зЁвбп н¬г«ЁагҐ¬л© Flash ­ Є®ЇЁвҐ«м (Ѓг¤м⥠®бв®а®¦­л, Ґб«Ё ўл гЄ ¦ЁвҐ ­Ґ в®в ¤ЁбЄ, в® ¬®¦ҐвҐ гЎЁвм § Јаг§зЁЄ гбв ­®ў«Ґ­­®© ­  ў и ¦ҐбвЄЁ© ¤ЁбЄ Ћ‘). ЏаЁ н⮬ DOS, ¬®¦Ґв, Ё Ўг¤Ґв агЈ вмбп, ­® ­Ґ ®Ўа й ©вҐ ­  нв® ў­Ё¬ ­ЁҐ Ё ўлЎҐаЁвҐ F (Їа®¤®«¦Ёвм), Ј« ў­®Ґ зв®Ўл ў § Ја㧮з­л© ᥪв®а ­ Є®ЇЁвҐ«п Ўл« § ЇЁб ­ § Јаг§зЁЄ, Є®в®ал© Ё Ўг¤Ґв § ЇгбЄ вм DOS б «д«ҐиЄЁ». +‚ १г«мв вҐ ¬л Ўг¤Ґ¬ Ё¬Ґвм USB Flash ­ Є®ЇЁвҐ«м б гбв ­®ў«Ґ­­л¬ DOS. + +€§ ўбҐе д ©«®ў, Є®в®алҐ Ўг¤гв ­ е®¤Ёвмбп ­  «д«ҐиЄҐ» ­Ґ®Ўе®¤Ё¬л в®«мЄ® Command.com, Io.sys, Msdos.sys - ®бв «м­лҐ ¬®¦­® г¤ «Ёвм, ¤«п ­ иЁе 楫Ґ© ®­Ё ­Ґ ­г¦­л. …б«Ё Ї® Є Є®© «ЁЎ® ЇаЁзЁ­Ґ нвЁ ваЁ д ©«  ­Ґ бЄ®ЇЁа®ў «Ёбм ­  ­ Є®ЇЁвҐ«м, в® бЄ®ЇЁаг©вҐ Ёе ўагз­го. „ «ҐҐ ¦Ґ« вҐ«м­® ЇҐаҐ§ Јаг§Ёвм Є®¬ЇмовҐа Ё Їа®ўҐаЁвм § Јаг§Єг DOS б д«ҐиЄЁ. …б«Ё ўбҐ Їа®©¤Ґв ­®а¬ «м­®, в® ўл Ї®«гзЁвҐ ЇаЁЈ« иҐ­ЁҐ Є®¬ ­¤­®© бва®ЄЁ DOS, ў Їа®вЁў­®¬ б«гз Ґ ­г¦­® Ї®Їлв вмбп гбв ­®ўЁвм б­®ў . +‚ ¤®Ї®«­Ґ­ЁҐ Є нвЁ¬ в६ д ©« ¬ Ї®вॡгҐвбп ў агз­го ᮧ¤ вм ҐйҐ Ї аг Їгбвле д ©«®ў: Config.sys, Autoexec.bat - нв® ­Ґ®Ўе®¤Ё¬®, ¤«п в®Ј® зв®Ўл ᤥ« вм ўЇ®б«Ґ¤бвўЁЁ Ї®«­®бвмо  ўв®¬ вЁзҐбЄго § Јаг§Єг Љ®«ЁЎаЁ,   ­Ґ бв ав®ў вм § Јаг§зЁЄ Ё§ Є®¬ ­¤­®© бва®ЄЁ Є ¦¤л© а §. + +Ќг, ў®в Ї®«®ўЁ­  а Ў®вл ᤥ« ­ . „ «ҐҐ ў®§­ЁЄ ов ­ҐЄ®в®алҐ ваг¤­®бвЁ, Є®в®алҐ ¬л гбЇҐи­® а §аҐиЁ¬ (¤«п в®Ј® п Ё ЇЁб « нвг бв вмо). +’аг¤­®бвЁ § Є«оз овбп ў ⮬, зв® ў бв ­¤ ав­®¬ ў аЁ ­вҐ ­Ё ®¤Ё­ § Јаг§зЁЄЁ ­Ґ § Јаг¦ Ґв IMG ®Ўа § ў Ї ¬пвм (§ Јаг¦ Ґвбп Ё § ЇгбЄ Ґвбп в®«мЄ® п¤а®), Ї®бЄ®«мЄг Ї®¤а §г¬Ґў Ґвбп, зв® ®Ўа § Ўг¤Ґв § Ја㦥­ п¤а®¬. Ќ® Є Є ўл, ­ ўҐа­®Ґ, 㦥 ¤®Ј ¤ «Ёбм ®Ўа § п¤аг Јаг§Ёвм Їа®бв® ­Ґ ®вЄг¤ , в Є Є Є б USB гбва®©бвў ¬Ё Љ®«ЁЎаЁ Ї®Є  ­Ґ ¤аг¦Ёв. + +Ћвбо¤  ®бв Ґвбп ®¤Ё­ ўл室 - ᤥ« вм в Є зв®Ўл § Јаг§зЁЄ § Јаг§Ё« ­Ґ в®«мЄ® п¤а®, ­® Ё ®Ўа § Ї® ­г¦­®¬г ¬Ґбвг ў Ї ¬пвЁ. ЌЋ! (ЋЇпвм нв® ­®!) ‡ Јаг§зЁЄ § Їг饭 ў DOS, Є®в®ал© а Ў®в Ґв ў ॠ«м­®¬ (Real mode) ०Ё¬Ґ Їа®жҐбб®а , б ®Ја ­ЁзҐ­ЁҐ¬ ­   ¤аҐб жЁо Ї ¬пвЁ ў 1 ЊЎ,   ®Ўа § ў  ¤аҐб­®¬ Їа®бва ­б⢥ Љ®«ЁЎаЁ Є Є а § ¤®«¦Ґ­ а бЇ®« Ј вмбп,  ЄЄга в ­ зЁ­ п б ЇҐаў®Ј® ¬ҐЈ Ў ©в  Ё ¤ «ҐҐ ў Ї ¬пвЁ. +Љ Є ¦Ґ Ўлвм? ќўаЁЄ ! DOS ўҐ¤м ¬®¦Ґв ®Ўа й вмбп зҐаҐ§ ¤®Ї®«­ЁвҐ«м­лҐ ¤а ©ўҐал Є Ї ¬пвЁ ўлиҐ ЇҐаў®Ј® ¬ҐЈ Ў ©в  (Єбв вЁ в Є Ё Ї®бвгЇ Ґв п¤а® ЇаЁ § Јаг§ЄҐ ®Ўа §  б д«®ЇЇЁ), ­® ॠ«Ё§®ў ­® нв® в Є Є®апў®, зв® Ї®«м§®ў вмбп нвЁ¬ ­Ґ е®зҐвбп ᮢᥬ. (Љ®­Ґз­® нв® ¬®Ґ бгЎкҐЄвЁў­®Ґ ¬­Ґ­ЁҐ). + +Ћ¤­®ўаҐ¬Ґ­­® б нвЁ¬ Ґбвм ¤агЈ®© бЇ®б®Ў ®Ўа вЁвмбп Є Ї ¬пвЁ ўлиҐ ЇҐаў®Ј® ¬ҐЈ Ў ©в . ‚ Їа®жҐбб®а е е86 бгйҐбвўгҐв ў®§¬®¦­®бвм гбв ­®ўЁвм ­Ґ¤®Єг¬Ґ­вЁа®ў ­­л©, ­® бзЁв ойЁ©бп Їа ЄвЁзҐбЄЁ бв ­¤ ав­л¬ «­ҐаҐ «м­л©» (Unreal mode) ०Ё¬ а Ў®вл. +Љ®­Ґз­®, Їап¬ п  ¤аҐб жЁп ў в Є®¬ ०Ё¬Ґ ­Ґў®§¬®¦­ , ­® ¬®¦­® ®Ўа й вмбп Є Ї ¬пвЁ Є®бўҐ­­® зҐаҐ§ ॣЁбвал, г Є®в®але Ўл«Ё Ё§¬Ґ­Ґ­л «Ё¬Ёвл  ¤аҐб жЁЁ. +‚ १г«мв вҐ Ї®«гз Ґ¬ ба ў­ЁвҐ«м­® Їа®бв®© бЇ®б®Ў ¤®бвгЇ  Є Ї ¬пвЁ ўЇ«®вм ¤® 4 ѓЎ, ­ е®¤пбм д ЄвЁзҐбЄЁ ў ॠ«м­®¬ ०Ё¬Ґ а Ў®вл Їа®жҐбб®а . + +‚ १г«мв вҐ п ¤®а Ў®в « § Јаг§зЁЄ meosload.com (Ї®бЄ®«мЄг ў ҐЈ® Є®¤Ґ ¬­Ґ ®Є § «®бм Їа®йҐ а §®Ўа вмбп), ⥯Ґам ®­ § Јаг¦ Ґв Ё п¤а® Ё ®Ўа §,   § вҐ¬ бв авгҐв Ћ‘. +„«п ўЄ«о祭Ёп «­ҐаҐ «м­®Ј®» ६  а Ў®вл Їа®жҐбб®а  п Ё§­ з «м­® ЁбЇ®«м§®ў « Є®¤, ў§пвл© б Є®в®ал© п ЇҐаҐа Ў®в « ў Їа®Ја ¬¬г enable.exe +Џ®§¦Ґ Є®¤ Ўл« ЇҐаҐЇЁб ­ ­  бЁ­в ЄбЁб FASM (®аЁЈЁ­ « Ўл« ¤«п TASM), в®ў аЁйҐ¬ Serge, §  зв® Ґ¬г ®Ја®¬­®Ґ бЇ бЁЎ®, Ї®бЄ®«мЄг г ¬Ґ­п ­Ґ еў вЁ«® г¬  Ё вҐаЇҐ­Ёп ᤥ« вм нв® б ¬®¬г. + +€в Є, нв® Ўл«® ¤«Ё­­®Ґ ®вбвгЇ«Ґ­ЁҐ, ­® ЎҐ§ ­ҐЈ® ўл Ўл ­Ґ Ї®­п«Ё ўбо Ё¤Ґо ЇаҐ¤«®¦Ґ­­®Ј® ¬­®© бЇ®б®Ў  § Јаг§ЄЁ. +Ћбв «®бм «Ёим бЄ®ЇЁа®ў вм ­  «д«ҐиЄг» д ©«л enable.exe Ё meosload.com,   в Є¦Ґ Їа®ЇЁб вм ў Autoexec.bat Ёе § Јаг§Єг (Autoexec.bat ¬®¦­® । ЄвЁа®ў вм «оЎл¬ ⥪бв®ўл¬ аҐ¤ Єв®а®¬) Ё, ࠧ㬥Ґвбп, ­  «д«ҐиЄҐ» ў Є®а­Ґ ¤ЁбЄ  ¤®«¦Ґ­ ­ е®¤Ёвмбп б ¬ д ©« ®Ўа §  kolibri.img. + +‚®в ў ЇаЁ­жЁЇҐ Ё ўбҐ. Ћбв «®бм ЇҐаҐ§ Јаг§Ёвм Є®¬ЇмовҐа Ё ўлЎа вм § Јаг§Єг б USB Flash ­ Є®ЇЁвҐ«п. ‚ бЁ­Ґ¬ ®Є­Ґ § Јаг§ЄЁ ў Є зҐб⢥ § Ја㧮筮Ј® гбва®©бвў  ­г¦­® ўлЎа вм Їг­Єв 3-ЁбЇ®«м§®ў вм 㦥 § Ја㦥­­л© ®Ўа §. + +P.S. +1) •®зг ўла §Ёвм Ў®«миго ЇаЁ§­ вҐ«м­®бвм §  Ї®¬®йм ў Ї®¤Ј®в®ўЄҐ ¬ вҐаЁ «  Ђ­¤аҐо (NoName), ќ¤г а¤г (DoomEdArchangel) Ё ‘ҐаЈҐо (Serge). +2) ‚  аеЁўҐ б нвЁ¬ д ©«®¬ ᮤҐа¦ вмбп гЇ®¬п­гвлҐ ў ⥪б⥠enable.exe Ё meosload.com Ё Ёе Ёб室­лҐ Є®¤л. \ No newline at end of file