Compare commits
2 Commits
main
...
d55f2055f2
Author | SHA1 | Date | |
---|---|---|---|
d55f2055f2 | |||
ebdd11511d |
@@ -28,8 +28,6 @@ jobs:
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Get describe
|
||||
id: vars
|
||||
@@ -76,15 +74,20 @@ jobs:
|
||||
g++ -o /home/autobuild/tools/win32/bin/objconv -O2 *.cpp
|
||||
chmod +x /home/autobuild/tools/win32/bin/objconv
|
||||
|
||||
- name: Build and install kerpack and kpack
|
||||
- name: Build and install kerpack
|
||||
if: steps.cache-toolchain.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
export PATH=/home/autobuild/tools/win32/bin:$PATH
|
||||
cd ${{ gitea.workspace }}/programs/other/kpack/kerpack_linux/
|
||||
make
|
||||
chmod +x kerpack
|
||||
chmod +x kpack
|
||||
mv kerpack /home/autobuild/tools/win32/bin/.
|
||||
|
||||
- name: Build and install kpack
|
||||
if: steps.cache-toolchain.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
cd ${{ gitea.workspace }}/programs/other/kpack/linux/
|
||||
bash build.sh
|
||||
chmod +x kpack
|
||||
mv kpack /home/autobuild/tools/win32/bin/.
|
||||
|
||||
- name: Build and install clink
|
||||
@@ -141,7 +144,6 @@ jobs:
|
||||
- name: (en_US) Build KolibriOS
|
||||
run: |
|
||||
export PATH=/home/autobuild/tools/win32/bin:$PATH
|
||||
source kos32-export-env-vars ${{ gitea.workspace }}
|
||||
tup build-en_US
|
||||
|
||||
- name: (en_US) Upload floppy image
|
||||
@@ -166,7 +168,6 @@ jobs:
|
||||
- name: (ru_RU) Build KolibriOS
|
||||
run: |
|
||||
export PATH=/home/autobuild/tools/win32/bin:$PATH
|
||||
source kos32-export-env-vars ${{ gitea.workspace }}
|
||||
tup build-ru_RU
|
||||
|
||||
- name: (ru_RU) Upload floppy image
|
||||
@@ -191,7 +192,6 @@ jobs:
|
||||
- name: (es_ES) Build KolibriOS
|
||||
run: |
|
||||
export PATH=/home/autobuild/tools/win32/bin:$PATH
|
||||
source kos32-export-env-vars ${{ gitea.workspace }}
|
||||
tup build-es_ES
|
||||
|
||||
- name: (es_ES) Upload floppy image
|
||||
|
@@ -2,70 +2,81 @@
|
||||
|
||||
## Type of contributing
|
||||
|
||||
There are two main types of contributions accepted to the main KolibriOS repository:
|
||||
There are two main types of contributions, accepted in KolibriOS:
|
||||
|
||||
- Submitting issues about problems in the project
|
||||
- Submitting code to the project via pull requests
|
||||
- Submitting issues about problems in project
|
||||
- Submitting code to project via pull requests
|
||||
|
||||
Both these types are described in detail below.
|
||||
Each of these types is described in details below.
|
||||
|
||||
## Issues
|
||||
|
||||
You can help us by submitting issues about problems found in the system. Currently, there are two main ways of submitting an issue in the project: **Bug Reports** and **Feature Requests**:
|
||||
You can help us by submitting issues about problems, found in system. Currently, there are two main ways of submitting an issue in the project: **Bug Reports** and **Feature Requests**:
|
||||
|
||||
- Bug Reports are suitable if you find a **bug** (crash, error, unexpected behavior) in some part of the system (kernel, drivers, apps, etc.) and want to report it
|
||||
- Feature Requests are used, when you want to propose some **improvement** to the system (missing features, improved user experience, etc.)
|
||||
- Bug Reports are suitable if you find a **bug** (crash, error, inexcpected behaviour) in some part of the system (kernel, drivers, apps etc.) and want to report it
|
||||
- Feature Request are used, when you wont to propose some **improvement** to the system (missing features, impoved user experience, etc.)
|
||||
|
||||
## Pull requests
|
||||
|
||||
You can also help us by submitting code via pull requests. The process of submitting a pull request consists of the following steps:
|
||||
You can also help us by submitting code via pull requests. The process of submitting a pull request consists of following steps:
|
||||
|
||||
1. Find what you want to implement or improve
|
||||
2. Make a fork of kolibrios (or other needed) repository
|
||||
2. Make a fork of kolibrios repository
|
||||
3. Create a branch with a name that matches your changes
|
||||
4. Implement and test the changes
|
||||
5. Create commits according to the [accepted style](#commit-style)
|
||||
6. Create and submit a pull request into `main` branch
|
||||
5. Create commits according to the [accepted style](##commit-style)
|
||||
6. Create and submit a pull request into main branch
|
||||
7. Wait for CI/CD pipelines and code review to pass
|
||||
|
||||
When a pull request is submitted, at least two project participants must conduct a code review, after which the proposed changes need to be corrected (if requested) and merged into the project.
|
||||
When a pull request is submitted, at least two project participants must conduct a code review, after which the proposed changes can be corrected (if it's necessary) and merged into the project.
|
||||
|
||||
## Commit style
|
||||
|
||||
### Message pattern
|
||||
### Pattern
|
||||
|
||||
The commit message should look like this:
|
||||
|
||||
```test
|
||||
Commit message header
|
||||
[Category] Commit message header
|
||||
|
||||
Commit message body, if needed
|
||||
```
|
||||
|
||||
- Commit message header and body should reflect changes made in commit
|
||||
- Commit message header should start with a capital letter
|
||||
- Commit message body should be separated from the header by one empty line
|
||||
|
||||
### Length
|
||||
|
||||
Maximum number of characters in a commit header is **72** (standard for **Git**). Also, **72** is the maximum length of a line in a commit body.
|
||||
|
||||
### Multiple authors
|
||||
### Categories
|
||||
|
||||
If you are making a commit together with another developer, you need to add:
|
||||
List of existing categories accepted in the project:
|
||||
|
||||
```
|
||||
Co-authored-by: ANOTHER-NAME <ANOTHER-NAME@EXAMPLE.COM>
|
||||
- `Krn` - kernel
|
||||
- `Drv` - drivers
|
||||
- `Libs` - libraries
|
||||
- `Apps` - user-space applications
|
||||
- `Skins` - skins
|
||||
- `Build` - build system
|
||||
- `CI/CD` - CI/CD
|
||||
- `Docs` - documentation
|
||||
- `Data` - images, configs, resources, etc.
|
||||
- `All` - global changes
|
||||
|
||||
If changes are made to a specific component, the name of the component separated by `/` character needs to be specified. For example:
|
||||
|
||||
```text
|
||||
Apps/shell
|
||||
Libs/libimg
|
||||
```
|
||||
|
||||
to the end commit message body on a new line.
|
||||
|
||||
### Merge commits
|
||||
## Merge commits
|
||||
|
||||
> [!WARNING]
|
||||
> Merge commits are **prohibited** in the project
|
||||
|
||||
Use **rebase** to keep your branch up to date.
|
||||
|
||||
## Conclusion
|
||||
|
||||
We hope this small instructions will help you to get familiar with KolibriOS contribution rules and inspire you to participate in the life of our project.
|
||||
We hope this small instructions will help you to can common with KolibriOS contributon and inspire you to participate in the work of this project.
|
||||
|
14
README.md
@@ -1,13 +1,13 @@
|
||||
# KolibriOS
|
||||
|
||||
[](./COPYING.TXT)
|
||||
[](https://git.kolibrios.org/KolibriOS/kolibrios/actions)
|
||||
[](https://git.kolibrios.org/KolibriOS/kolibrios/actions/workflows/build.yaml)
|
||||
|
||||
KolibriOS is a hobby operating system for x86-compatible computers, which is currently being developed by a small but passionate team of enthusiasts.
|
||||
KolibriOS is a hobby operating system for x86-compatible computers, which is currently being developed by a small teem of enthusiasts.
|
||||
|
||||
Its kernel, most drivers, and many programs are written entirely in [FASM](https://flatassembler.net/) assembly language, making them very compact and lean on system resources.
|
||||
It's kernel is written entirely in [FASM](https://flatassembler.net/) assembly language, making it very compact and lean on system resources.
|
||||
|
||||
Based on [MenuetOS](https://www.menuetos.net/), it uses its own standards and is NOT fully POSIX or UNIX compliant.
|
||||
Based on [MenuetOS](https://www.menuetos.net/), it uses its own standards and is NOT fully POSIX or UNIX compliant
|
||||
|
||||
## Contributing
|
||||
|
||||
@@ -20,3 +20,9 @@ Common list of tasks, issues and enhancement proposals can be found on [this pag
|
||||
## Special thanks
|
||||
|
||||
The KolibriOS team expresses special thanks to the author of the 32-bit **MenuetOS**, [Ville Turjanmaa](https://www.menuetos.net/contact.htm). We also want to note that all **MenuetOS** copyrights have been preserved.
|
||||
|
||||
## License
|
||||
|
||||
Contents of this repository are licensed under the terms of **GNU GPL 2.0** unless otherwise specified.
|
||||
|
||||
See [this](./COPYING.TXT) file for details.
|
||||
|
@@ -49,6 +49,8 @@ img_files = {
|
||||
{"MEDIA/IMGF/INVSOL.OBJ", "common/media/ImgF/invSol.obj"},
|
||||
{"MEDIA/PIXIESKN.PNG", SRC_PROGS .. "/cmm/pixie2/pixieskn.png"},
|
||||
{"NETWORK/FTPC.INI", SRC_PROGS .. "/network/ftpc/ftpc.ini"},
|
||||
{"NETWORK/FTPC_SYS.PNG", SRC_PROGS .. "/network/ftpc/ftpc_sys.png"},
|
||||
{"NETWORK/FTPC_NOD.PNG", SRC_PROGS .. "/network/ftpc/ftpc_nod.png"},
|
||||
{"NETWORK/FTPD.INI", "common/network/ftpd.ini"},
|
||||
{"NETWORK/KNMAP", "common/network/knmap"},
|
||||
{"NETWORK/USERS.INI", "common/network/users.ini"},
|
||||
@@ -69,7 +71,6 @@ img_files = {
|
||||
{"SETTINGS/SYSTEM.INI", "common/settings/system.ini"},
|
||||
{"SETTINGS/TASKBAR.INI", "common/settings/taskbar.ini"},
|
||||
{"SETTINGS/SYSTEM.ENV", "common/settings/system.env"},
|
||||
{"SETTINGS/USBDRV.DAT",VAR_DRVS .. "/usb/usbother/usbdrv.dat"},
|
||||
}
|
||||
|
||||
-- For russian build, add russian-only files.
|
||||
@@ -84,7 +85,6 @@ if build_type == "ru_RU" then tup.append_table(img_files, {
|
||||
{"SETTINGS/MYKEY.INI", SRC_PROGS .. "/system/MyKey/trunk/mykey.ini"},
|
||||
{"SETTINGS/SYSPANEL.INI", "ru_RU/settings/syspanel.ini"},
|
||||
}) elseif build_type == "en_US" then tup.append_table(img_files, {
|
||||
{"WELCOME.HTM", VAR_DATA .. "/" .. build_type .. "/welcome.htm.kpack"},
|
||||
{"EXAMPLE.ASM", SRC_PROGS .. "/develop/examples/example/trunk/example.asm"},
|
||||
{"DEVELOP/BACKY", SRC_PROGS .. "/develop/backy/Backy"},
|
||||
{"File Managers/KFAR.INI", "common/File Managers/kfar.ini"},
|
||||
@@ -156,7 +156,7 @@ extra_files = {
|
||||
{"kolibrios/3D/info3ds/OBJECTS.PNG", SRC_PROGS .. "/develop/info3ds/objects.png"},
|
||||
{"kolibrios/3D/info3ds/TOOLBAR.PNG", SRC_PROGS .. "/develop/info3ds/toolbar.png"},
|
||||
{"kolibrios/3D/info3ds/FONT8X9.BMP", SRC_PROGS .. "/fs/kfar/trunk/font8x9.bmp"},
|
||||
{"kolibrios/3D/blocks/blocks.kex", "../programs/bcc32/games/blocks/bin/blocks.kex"},
|
||||
{"kolibrios/3D/blocks/", "../programs/bcc32/games/blocks/bin/*"},
|
||||
{"kolibrios/3D/blocks/models/", "../programs/bcc32/games/blocks/models/*"},
|
||||
{"kolibrios/3D/md2view/", "common/3d/md2view/*"},
|
||||
{"kolibrios/3D/md2view/md2_model/", "common/3d/md2view/md2_model/*"},
|
||||
@@ -196,8 +196,8 @@ extra_files = {
|
||||
{"kolibrios/develop/utils/SPEDump", SRC_PROGS .. "/develop/SPEDump/SPEDump.kex"},
|
||||
{"kolibrios/emul/", "common/emul/*"},
|
||||
{"kolibrios/emul/dosbox/", "common/emul/DosBox/*"},
|
||||
{"kolibrios/emul/e80/readme.txt", SRC_PROGS .. "/emulator/e80/readme.txt"},
|
||||
{"kolibrios/emul/e80/keyboard.png", SRC_PROGS .. "/emulator/e80/keyboard.png"},
|
||||
{"kolibrios/emul/e80/readme.txt", SRC_PROGS .. "/emulator/e80/trunk/readme.txt"},
|
||||
{"kolibrios/emul/e80/keyboard.png", SRC_PROGS .. "/emulator/e80/trunk/keyboard.png"},
|
||||
{"kolibrios/emul/fceu/fceu", SRC_PROGS .. "/emulator/fceu/fceu"},
|
||||
{"kolibrios/emul/fceu/FCEU ReadMe.txt", SRC_PROGS .. "/emulator/fceu/FCEU ReadMe.txt"},
|
||||
{"kolibrios/emul/chip8/chip8", VAR_PROGS .. "/emulator/chip8/chip8"},
|
||||
@@ -285,11 +285,10 @@ extra_files = {
|
||||
{"kolibrios/netsurf/res/", "common/network/netsurf/res/*"},
|
||||
{"kolibrios/res/skins/", "../skins/authors.txt"},
|
||||
{"kolibrios/res/templates/", "common/templates/*"},
|
||||
{"kolibrios/res/templates/", SRC_PROGS .. "/emulator/e80/games/*"},
|
||||
{"kolibrios/res/templates/", SRC_PROGS .. "/emulator/e80/trunk/games/*"},
|
||||
{"kolibrios/res/templates/NES/", "common/templates/NES/*"},
|
||||
{"kolibrios/res/wallpapers/", "common/wallpapers/*"},
|
||||
{"kolibrios/res/system/", build_type .. "/settings/kolibri.lbl"},
|
||||
{"kolibrios/res/system/", "common/signs.png"},
|
||||
{"kolibrios/utils/vmode", "common/vmode"},
|
||||
{"kolibrios/utils/texture", "common/utils/texture"},
|
||||
{"kolibrios/utils/cnc_editor/cnc_editor", VAR_PROGS .. "/other/cnc_editor/cnc_editor"},
|
||||
@@ -410,8 +409,7 @@ tup.append_table(img_files, {
|
||||
{"HACONFIG", VAR_PROGS .. "/other/ha/HACONFIG"},
|
||||
{"ACLOCK", VAR_PROGS .. "/demos/aclock/aclock"},
|
||||
{"APM", VAR_PROGS .. "/system/apm/apm"},
|
||||
{"CALC", VAR_PROGS .. "/other/calc/calc"},
|
||||
{"CALCPLUS", VAR_PROGS .. "/other/calcplus/calcplus"},
|
||||
{"CALC", VAR_PROGS .. "/other/calc/trunk/calc"},
|
||||
{"CALENDAR", VAR_PROGS .. "/system/calendar/trunk/calendar"},
|
||||
{"COLRDIAL", VAR_PROGS .. "/system/colrdial/color_dialog"},
|
||||
{"CROPFLAT", VAR_PROGS .. "/system/cropflat/cropflat"},
|
||||
@@ -429,14 +427,14 @@ tup.append_table(img_files, {
|
||||
{"KPACK", VAR_PROGS .. "/other/kpack/trunk/kpack"},
|
||||
{"LAUNCHER", VAR_PROGS .. "/system/launcher/trunk/launcher"},
|
||||
{"LOADDRV", VAR_PROGS .. "/system/loaddrv/loaddrv"},
|
||||
{"MAGNIFY", VAR_PROGS .. "/system/magnify/magnify"},
|
||||
{"MAGNIFY", VAR_PROGS .. "/demos/magnify/trunk/magnify"},
|
||||
{"MGB", VAR_PROGS .. "/testing/mgb/trunk/mgb"},
|
||||
{"MOUSEMUL", VAR_PROGS .. "/system/mousemul/trunk/mousemul"},
|
||||
{"MADMOUSE", VAR_PROGS .. "/other/madmouse/madmouse"},
|
||||
{"MYKEY", VAR_PROGS .. "/system/MyKey/trunk/MyKey"},
|
||||
{"PCIDEV", VAR_PROGS .. "/testing/pcidev/trunk/PCIDEV"},
|
||||
{"RDSAVE", VAR_PROGS .. "/system/rdsave/trunk/rdsave"},
|
||||
{"RTFREAD", VAR_PROGS .. "/other/rtfread/rtfread"},
|
||||
{"RTFREAD", VAR_PROGS .. "/other/rtfread/trunk/rtfread"},
|
||||
{"SEARCHAP", VAR_PROGS .. "/system/searchap/searchap"},
|
||||
{"SCRSHOOT", VAR_PROGS .. "/media/scrshoot/scrshoot"},
|
||||
{"SETUP", VAR_PROGS .. "/system/setup/trunk/setup"},
|
||||
@@ -458,14 +456,14 @@ tup.append_table(img_files, {
|
||||
{"DEMOS/BCDCLK", VAR_PROGS .. "/demos/bcdclk/trunk/bcdclk"},
|
||||
{"DEMOS/BUDHBROT", VAR_PROGS .. "/demos/buddhabrot/trunk/buddhabrot"},
|
||||
{"DEMOS/EYES", VAR_PROGS .. "/demos/eyes/trunk/eyes"},
|
||||
{"DEMOS/FIREWORK", VAR_PROGS .. "/demos/firework/firework"},
|
||||
{"DEMOS/MOVBACK", VAR_PROGS .. "/demos/movback/movback"},
|
||||
{"DEMOS/PLASMA", VAR_PROGS .. "/demos/plasma/plasma"},
|
||||
{"DEMOS/FIREWORK", VAR_PROGS .. "/demos/firework/trunk/firework"},
|
||||
{"DEMOS/MOVBACK", VAR_PROGS .. "/demos/movback/trunk/movback"},
|
||||
{"DEMOS/PLASMA", VAR_PROGS .. "/demos/plasma/trunk/plasma"},
|
||||
{"DEMOS/SPIRAL", VAR_PROGS .. "/demos/spiral/spiral"},
|
||||
{"DEMOS/TINYFRAC", VAR_PROGS .. "/demos/tinyfrac/trunk/tinyfrac"},
|
||||
{"DEMOS/TRANTEST", VAR_PROGS .. "/demos/trantest/trunk/trantest"},
|
||||
{"DEMOS/TUBE", VAR_PROGS .. "/demos/tube/tube"},
|
||||
{"DEMOS/UNVWATER", VAR_PROGS .. "/demos/unvwater/unvwater"},
|
||||
{"DEMOS/TUBE", VAR_PROGS .. "/demos/tube/trunk/tube"},
|
||||
{"DEMOS/UNVWATER", VAR_PROGS .. "/demos/unvwater/trunk/unvwater"},
|
||||
{"DEMOS/WEB", VAR_PROGS .. "/demos/web/trunk/web"},
|
||||
{"DEMOS/ZEROLINE", VAR_PROGS .. "/demos/zeroline/trunk/zeroline"},
|
||||
{"DEVELOP/BOARD", VAR_PROGS .. "/system/board/trunk/board"},
|
||||
@@ -476,7 +474,6 @@ tup.append_table(img_files, {
|
||||
{"DEVELOP/ENTROPYV", VAR_PROGS .. "/develop/entropyview/entropyview"},
|
||||
{"DEVELOP/FASM", VAR_PROGS .. "/develop/fasm/1.73/fasm"},
|
||||
{"DEVELOP/GENFILES", VAR_PROGS .. "/testing/genfiles/GenFiles"},
|
||||
{"DEVELOP/PIPET", VAR_PROGS .. "/other/pipet/pipet"},
|
||||
{"DEVELOP/H2D2B", VAR_PROGS .. "/develop/h2d2b/trunk/h2d2b"},
|
||||
{"DEVELOP/HEED", VAR_PROGS .. "/develop/heed/trunk/heed"},
|
||||
{"DEVELOP/MTDBG", VAR_PROGS .. "/develop/mtdbg/mtdbg"},
|
||||
@@ -524,10 +521,10 @@ tup.append_table(img_files, {
|
||||
{"LIB/RASTERWORKS.OBJ", VAR_PROGS .. "/develop/libraries/fontRasterWorks_unicode/RasterWorks.obj"},
|
||||
{"LIB/SORT.OBJ", VAR_PROGS .. "/develop/libraries/sorter/sort.obj"},
|
||||
{"LIB/TINYGL.OBJ", VAR_PROGS .. "/develop/libraries/TinyGL/asm_fork/tinygl.obj"},
|
||||
{"MEDIA/ANIMAGE", VAR_PROGS .. "/media/animage/animage"},
|
||||
{"MEDIA/ANIMAGE", VAR_PROGS .. "/media/animage/trunk/animage"},
|
||||
{"MEDIA/FILLSCR", VAR_PROGS .. "/media/FillScr/fillscr"},
|
||||
{"MEDIA/KIV", VAR_PROGS .. "/media/kiv/kiv"},
|
||||
{"MEDIA/LISTPLAY", VAR_PROGS .. "/media/listplay/listplay"},
|
||||
{"MEDIA/KIV", VAR_PROGS .. "/media/kiv/trunk/kiv"},
|
||||
{"MEDIA/LISTPLAY", VAR_PROGS .. "/media/listplay/trunk/listplay"},
|
||||
{"MEDIA/MIDAMP", VAR_PROGS .. "/media/midamp/trunk/midamp"},
|
||||
{"MEDIA/MP3INFO", VAR_PROGS .. "/media/mp3info/mp3info"},
|
||||
{"MEDIA/PALITRA", VAR_PROGS .. "/media/palitra/trunk/palitra"},
|
||||
@@ -568,7 +565,6 @@ tup.append_table(img_files, {
|
||||
{"DRIVERS/OHCI.SYS", VAR_DRVS .. "/usb/ohci.sys"},
|
||||
{"DRIVERS/EHCI.SYS", VAR_DRVS .. "/usb/ehci.sys"},
|
||||
{"DRIVERS/USBHID.SYS", VAR_DRVS .. "/usb/usbhid/usbhid.sys"},
|
||||
{"DRIVERS/USBOTHER.SYS",VAR_DRVS .. "/usb/usbother/usbother.sys"},
|
||||
{"DRIVERS/USBSTOR.SYS", VAR_DRVS .. "/usb/usbstor.sys"},
|
||||
{"DRIVERS/RDC.SYS", VAR_DRVS .. "/video/rdc.sys"},
|
||||
{"DRIVERS/COMMOUSE.SYS", VAR_DRVS .. "/mouse/commouse.sys"},
|
||||
@@ -606,7 +602,6 @@ tup.append_table(extra_files, {
|
||||
{"kolibrios/3D/voxel_utilites/VOX_CREATOR" , VAR_PROGS .. "/media/voxel_editor/utilites/vox_creator"},
|
||||
{"kolibrios/3D/voxel_utilites/VOX_MOVER" , VAR_PROGS .. "/media/voxel_editor/utilites/vox_mover"},
|
||||
{"kolibrios/3D/voxel_utilites/VOX_TGL" , VAR_PROGS .. "/media/voxel_editor/utilites/vox_tgl"},
|
||||
{"kolibrios/demos/flag", VAR_PROGS .. "/demos/flag/flag"},
|
||||
{"kolibrios/demos/life3", VAR_PROGS .. "/games/life3/life3"},
|
||||
{"kolibrios/demos/qjulia", VAR_PROGS .. "/demos/qjulia/trunk/qjulia"},
|
||||
{"kolibrios/develop/koldbg", VAR_PROGS .. "/develop/koldbg/koldbg"},
|
||||
@@ -630,12 +625,13 @@ tup.append_table(extra_files, {
|
||||
{"kolibrios/media/zsea/plugins/rotate.obj", VAR_PROGS .. "/media/zsea/plugins/rotate/rotate.obj"},
|
||||
{"kolibrios/media/zsea/plugins/scaling.obj", VAR_PROGS .. "/media/zsea/plugins/scaling/scaling.obj"},
|
||||
{"kolibrios/utils/AMDtemp", VAR_PROGS .. "/system/amd_temp_view/AMDtemp"},
|
||||
{"kolibrios/utils/calcplus", VAR_PROGS .. "/other/calcplus/calcplus"},
|
||||
{"kolibrios/utils/kfm/kfm", VAR_PROGS .. "/fs/kfm/trunk/kfm"},
|
||||
{"kolibrios/utils/tedit/t_edit", VAR_PROGS .. "/other/t_edit/t_edit"},
|
||||
{"kolibrios/3D/blocks/block.bin", VAR_PROGS .. "/bcc32/games/blocks/block.bin"}
|
||||
})
|
||||
-- For russian build, add russian-only programs.
|
||||
if build_type == "ru_RU" then tup.append_table(img_files, {
|
||||
{"PERIOD", VAR_PROGS .. "/other/period/trunk/period"},
|
||||
{"GAMES/KLAVISHA", VAR_PROGS .. "/games/klavisha/klavisha"},
|
||||
{"DEVELOP/EXAMPLES/TESTCON2", VAR_PROGS .. "/develop/libraries/console_coff/examples/testcon2_rus"},
|
||||
}) else tup.append_table(img_files, {
|
||||
@@ -643,7 +639,6 @@ if build_type == "ru_RU" then tup.append_table(img_files, {
|
||||
}) end
|
||||
|
||||
if build_type == "ru_RU" then tup.append_table(extra_files, {
|
||||
{"kolibrios/utils/period", VAR_PROGS .. "/other/period/period"},
|
||||
{"kolibrios/games/Dungeons/Dungeons", VAR_PROGS .. "/games/Dungeons/Dungeons"},
|
||||
}) end
|
||||
|
||||
@@ -669,12 +664,12 @@ tup.append_table(img_files, {
|
||||
{"EASYSHOT", VAR_PROGS .. "/cmm/misc/easyshot.com"},
|
||||
{"MOUSECFG", VAR_PROGS .. "/cmm/mousecfg/mousecfg.com"},
|
||||
{"BARSCFG", VAR_PROGS .. "/cmm/barscfg/barscfg.com"},
|
||||
{"SEARCH", VAR_PROGS .. "/cmm/misc/search.com"},
|
||||
{"SYSPANEL", VAR_PROGS .. "/cmm/misc/software_widget.com"},
|
||||
{"SYSMON", VAR_PROGS .. "/cmm/sysmon/sysmon.com"},
|
||||
{"TMPDISK", VAR_PROGS .. "/cmm/tmpdisk/tmpdisk.com"},
|
||||
{"DEVELOP/CLIPVIEW", VAR_PROGS .. "/cmm/clipview/clipview.com"},
|
||||
{"DEVELOP/MENU", VAR_PROGS .. "/cmm/menu/menu.com"},
|
||||
{"DEVELOP/PIPET", VAR_PROGS .. "/cmm/misc/pipet.com"},
|
||||
{"File Managers/EOLITE", VAR_PROGS .. "/cmm/eolite/Eolite.com"},
|
||||
{"File Managers/KFM2", VAR_PROGS .. "/cmm/misc/kfm2.com"},
|
||||
{"DEVELOP/DIFF", VAR_PROGS .. "/cmm/diff/diff.com"},
|
||||
@@ -699,6 +694,7 @@ tup.append_table(extra_files, {
|
||||
{"kolibrios/utils/notes", VAR_PROGS .. "/cmm/notes/notes.com"},
|
||||
{"kolibrios/utils/osupdate", VAR_PROGS .. "/cmm/misc/osupdate.com"},
|
||||
{"kolibrios/utils/quark", VAR_PROGS .. "/cmm/quark/quark.com"},
|
||||
{"kolibrios/utils/kf_view", VAR_PROGS .. "/cmm/kf_font_viewer/font_viewer.com"},
|
||||
})
|
||||
end -- tup.getconfig('NO_CMM') ~= 'full'
|
||||
|
||||
@@ -754,7 +750,7 @@ tup.append_table(img_files, {
|
||||
tup.append_table(extra_files, {
|
||||
-- {"kolibrios/3D/cubeline", VAR_PROGS .. "/demos/cubeline/trunk/cubeline"},
|
||||
{"kolibrios/3D/gears", VAR_PROGS .. "/demos/gears/gears"},
|
||||
{"kolibrios/emul/e80/e80", VAR_PROGS .. "/emulator/e80/e80"},
|
||||
{"kolibrios/emul/e80/e80", VAR_PROGS .. "/emulator/e80/trunk/e80"},
|
||||
{"kolibrios/emul/uarm/", VAR_CONTRIB .. "/other/uarm/uARM"},
|
||||
{"kolibrios/games/2048", VAR_PROGS .. "/games/2048/2048"},
|
||||
{"kolibrios/games/checkers", VAR_PROGS .. "/games/checkers/checkers"},
|
||||
@@ -895,6 +891,10 @@ for i,v in ipairs(img_files) do
|
||||
str = string.gsub(str, "%%", "%%%%") -- escape % as %%
|
||||
cmd += " && str=" .. str
|
||||
cmd += ' && echo -n $str | dd status=none of=%o bs=1 seek=`expr 274 - length "$str"` conv=notrunc'
|
||||
str2='$(get-current-cmtid|grep -oE "\\+[0-9]+")'
|
||||
str2 = string.gsub(str2, "%$", "\\$") -- escape $ as \$
|
||||
cmd += " && str2=" .. str2
|
||||
cmd += ' && echo -n $str2 | dd status=none of=%o bs=1 seek=216 conv=notrunc'
|
||||
end
|
||||
local_file = VAR_KERNEL .. "/.kernel.mnt"
|
||||
tup.definerule{inputs = {v[2]}, command = cmd, outputs = {local_file}}
|
||||
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 44 KiB |
Before Width: | Height: | Size: 700 B After Width: | Height: | Size: 720 B |
Before Width: | Height: | Size: 809 B After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 20 KiB |
@@ -29,6 +29,7 @@ Dicty=/k/utils/DICTY.KEX,79
|
||||
fNav=/k/utils/fNav/fNav,93
|
||||
CncEditor=/k/utils/cnc_editor/cnc_editor,15
|
||||
Life=/k/demos/life2,13
|
||||
Calc+=/k/utils/calcplus,4
|
||||
TinyBasic=/k/develop/TinyBasic/TinyBasic,91
|
||||
THashView=/k/utils/thashview,124
|
||||
Notes=/k/utils/notes,117
|
||||
|
@@ -79,7 +79,7 @@ next=$TextEditor
|
||||
[Assoc]
|
||||
/=/sys/file managers/eolite
|
||||
|
||||
kf=/sys/syspanel
|
||||
kf=/kolibrios/utils/kf_view
|
||||
|
||||
txt=$CodeEdit
|
||||
log=$CodeEdit
|
||||
|
Before Width: | Height: | Size: 66 KiB |
@@ -1,2 +0,0 @@
|
||||
if tup.getconfig("NO_FASM") ~= "" then return end
|
||||
tup.rule("welcome.htm", "cp %f %o" .. tup.getconfig("KPACK_CMD"), "welcome.htm.kpack")
|
@@ -235,8 +235,8 @@ ico=58
|
||||
x=68
|
||||
y=68
|
||||
[21]
|
||||
name=CALC+
|
||||
path=CALCPLUS
|
||||
name=CALC
|
||||
path=CALC
|
||||
param=
|
||||
ico=4
|
||||
x=204
|
||||
|
@@ -12,7 +12,6 @@
|
||||
23 Game Center |allgames
|
||||
60 System panel |syspanel
|
||||
18 Documentation |docpack
|
||||
49 Search |search
|
||||
53 Run |run
|
||||
04 Shut down |end
|
||||
#1 **** DEMOS
|
||||
@@ -92,7 +91,6 @@
|
||||
59 Screen keyboard |zkey
|
||||
#10 **** DATA PROCESSING
|
||||
16 Calculator |calc
|
||||
16 Calculator+ |calcplus
|
||||
03 Tinypad |tinypad
|
||||
28 CodeEdit |develop/cedit
|
||||
21 Table processor |table
|
||||
|
@@ -1,95 +0,0 @@
|
||||
<html>
|
||||
<title>Welcome notes</title>
|
||||
|
||||
<body bgcolor=#fff>
|
||||
|
||||
<h1>
|
||||
<font color=1BB71A>Welcome to KolibriOS</font>
|
||||
</h1>
|
||||
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">
|
||||
Dear friends,
|
||||
|
||||
What you see now is the most compact operating system in the whole world. KolibriOS is a piece of programming art that is based on logic and coffee.
|
||||
|
||||
As no one reads manuals, I'm here to help with the most common issues that new users of KolibriOS are facing. This document is also required to read for any <b>YouTube blogger</b> who wants to make a review of the system :)
|
||||
|
||||
<dd><h3><kosicon n=5> Floppy version</h3>
|
||||
The asterisk [*] in the Menu means the app isn't available in the Floppy version, only in the Big distro (Flash/ISO/UEFI-HDD). Not all programs are available via Menu to encourage you to explore KolibriOS files by yourself.
|
||||
|
||||
<h3><kosicon n=25> If you have problems with USB</h3>
|
||||
Only USB 1.1 and USB 2.0 ports are supported, not USB 3+. And yep, the USB driver is written entirely in assembler. Some motherboards have options like "USB Legacy Support" or something similar, which may help the system detect your device. Also, some ports on your motherboard may work while others may not, only G-d knows why. So, play with the BIOS/UEFI settings and try different ports.
|
||||
|
||||
<h3><kosicon n=7> Sound</h3>
|
||||
List of supported devices:
|
||||
- Most AC97 cards: Intel, nForce, VIA
|
||||
- A variety of HD Audio devices: Intel, Realtek...
|
||||
- SIS PCI audio (Sis 7012)
|
||||
- Creative labs EMU10K1X (Dell OEM)
|
||||
- Media Forte FM801
|
||||
- ISA Sound Blaster 16
|
||||
<i>Only THIS particular model works,
|
||||
not other cards that have software SB16-emulation</i>
|
||||
|
||||
<h3><kosicon n=61> Video</h3>
|
||||
By default, you can change the resolution only on the blue boot screen. The modes listed there are provided by the video card's BIOS. It is impossible to 'simply add additional screen modes to the list'. If video card's BIOS doesn't provide some modes then you need a driver. It is not possible to write a generic video card driver. Separate driver must be written for each specific video card model.
|
||||
Intel and AMD drivers for some video cards are ported from Linux and are available in the Big distro.
|
||||
|
||||
Check SYSPANEL. Features: ability to change resolution in KolibriOS, hardware cursor (not actual anymore), bit-blit operations acceleration.
|
||||
|
||||
<h3><kosicon n=25> Wi-Fi</h3>
|
||||
Not supported. You have to know that the Wi-Fi specification is so complex that it is almost impossible to write the code for it from scratch. Only big OSes like Windows / Linux / BSD have it. MacOS and Haiku just ported the BSD drivers. I don't say porting them to KolibiOS is not possible, but the required effort is going to be tremendous.
|
||||
|
||||
<h3><kosicon n=25> LAN/Ethernet</h3>
|
||||
List of supported devices:
|
||||
- 3c59x 3Com Fast EtherLink (3c59x/450/555/556/575/900/905/980)
|
||||
- ar81xx Atheros 8131/8132/8151/8152/8161/8162/8171/8172
|
||||
Killer E2200/E2400/E2500
|
||||
- dec21x4x* Accton en1207B-TX, DEC 21140, ..., VirtualPC
|
||||
- forcedeth* Nvidia nForce chipset integrated Ethernet
|
||||
- i8255x Intel eepro/100 (i8255x, i82562, i82801, ...), QEMU
|
||||
- i8254x Intel PRO/1000 (i8254x), Virtualbox, BOCHS, QEMU
|
||||
- mtd80x Myson MTD803
|
||||
- pcnet32 AMD PCnet (79c970, 79c978, 79c973, ...), Virtualbox, QEMU
|
||||
- r6040 RDC Semiconductors R6040
|
||||
- rhine VIA Rhine II and III
|
||||
- rtl8029 Realtek 8029/8019, ne2000 PCI, BOCHS, QEMU
|
||||
- rtl8139 Realtek 8139 and clones, QEMU
|
||||
- rtl8169 Realtek 8110/8111/8167/8168/8169
|
||||
- sis900 SiS900, 7016
|
||||
|
||||
* - in development
|
||||
|
||||
Blessed be our Flemish friend Jeffrey, who has written most of the Network staff by him: stack, drivers, and a lot of apps (except WebView).
|
||||
|
||||
<h3><kosicon n=12> WebView</h3>
|
||||
It was never intended to be a browser, but rather a Help Center that uses HTML markup. It fits this purpose well, doesn't it? According to current WebView's codebase (that was my first app ever) it will never become a normal web browser. Please help us and write/port something good. For example, it will be nice try to finish Netsurf port.
|
||||
|
||||
<h3><kosicon n=9> How did you achieve so much while being so small?</h3>
|
||||
- Kernel, almost all drivers and most applications are written in assembly language
|
||||
- Files in IMG are packed via the LZMA algorithm from 7-Zip. They are unpacked to RAM when accessed
|
||||
- Most of the images are manually optimized: posterization, dithering and other techniques were used
|
||||
- Files names in IMG fit 8.3 naming convention (name.extension) which doesn't use additional FAT12 space
|
||||
- Image files are combined into a single file
|
||||
- Compact binary header of applications, no sections
|
||||
- Resources are reused, and file duplication is avoided, for example:
|
||||
~ Many apps use shared libraries
|
||||
~ KFM2 and Eolite are a single app, just with different appearance
|
||||
~ APP+, Games Center and System Panel are a single app also
|
||||
~ Memory Blocks game uses system icons as images
|
||||
|
||||
|
||||
See more <a href=http://wiki.kolibrios.org/wiki/Hardware_Support>http://wiki.kolibrios.org/wiki/Hardware_Support</a>
|
||||
</dd>
|
||||
|
||||
<h3><kosicon n=13> Last words</h3>
|
||||
<font bg=#F9F0A3>We want to express our gratitude to every KolibriOS contributor. Also, we would like to give special thanks to Ville M. Turjanmaa, the author of MenuetOS, the predecessor of our system.
|
||||
|
||||
Finally, we want to thank you, brave and curious users, as we are doing it all for you!
|
||||
|
||||
Have fun!</font>
|
||||
|
||||
Sincerely yours,
|
||||
KolibriOS Team
|
||||
|
||||
<img src=/kolibrios/res/system/signs.png alt="You have to use Big Distro to see this image!">
|
||||
<!-- Somewhere deep in the Galaxy stars light up and go out, empires are born and turn to dust. In this impenetrable darkness and decadence, there are people who are still working on KolibriOS. Many years will pass and perhaps you and I will no longer be here, and our great-grandchildren will ask "Who were those insane who made such an incredible OS?" -->
|
@@ -235,8 +235,8 @@ ico=58
|
||||
x=68
|
||||
y=68
|
||||
[21]
|
||||
name=CALC+
|
||||
path=CALCPLUS
|
||||
name=CALC
|
||||
path=CALC
|
||||
param=
|
||||
ico=4
|
||||
x=204
|
||||
|
@@ -13,7 +13,6 @@
|
||||
16 Centro de juegos |allgames
|
||||
60 System panel |syspanel
|
||||
18 Ayuda |docpack
|
||||
49 Buscar |search
|
||||
53 Ejecutar aplicaci<63>n |run
|
||||
04 Apagar |end
|
||||
#1 **** DEMOS
|
||||
@@ -96,7 +95,6 @@
|
||||
24 NDN * |/kolibrios/utils/ndn/ndn
|
||||
#11 **** PROCESO DE DATOS
|
||||
16 Calculadora |calc
|
||||
16 Calculadora+ |calcplus
|
||||
16 Tinypad |tinypad
|
||||
16 CodeEdit |develop/cedit
|
||||
16 Procesador de tablas |table
|
||||
|
@@ -235,8 +235,8 @@ ico=58
|
||||
x=68
|
||||
y=68
|
||||
[21]
|
||||
name=CALC+
|
||||
path=CALCPLUS
|
||||
name=CALC
|
||||
path=CALC
|
||||
param=
|
||||
ico=4
|
||||
x=204
|
||||
|
@@ -80,7 +80,6 @@
|
||||
65 NDN * |/kolibrios/utils/ndn/ndn
|
||||
#11 **** DATA PROCESSING ****
|
||||
16 Kalkulaator |calc
|
||||
16 Kalkulaator+ |calcplus
|
||||
16 Teksti redaktor |tinypad
|
||||
16 CodeEdit |develop/cedit
|
||||
16 Tabelarvutus |table
|
||||
|
@@ -235,8 +235,8 @@ ico=58
|
||||
x=68
|
||||
y=68
|
||||
[21]
|
||||
name=CALC+
|
||||
path=CALCPLUS
|
||||
name=CALC
|
||||
path=CALC
|
||||
param=
|
||||
ico=4
|
||||
x=204
|
||||
|
@@ -79,7 +79,6 @@
|
||||
65 NDN * |/kolibrios/utils/ndn/ndn
|
||||
#11 **** DATA PROCESSING
|
||||
16 Calcolatrice |calc
|
||||
16 Calcolatrice+ |calcplus
|
||||
16 Tinypad |tinypad
|
||||
16 CodeEdit |develop/cedit
|
||||
16 Table Processor |table
|
||||
|
@@ -235,8 +235,8 @@ ico=58
|
||||
x=68
|
||||
y=68
|
||||
[21]
|
||||
name=CALC+
|
||||
path=CALCPLUS
|
||||
name=CALC
|
||||
path=CALC
|
||||
param=
|
||||
ico=4
|
||||
x=204
|
||||
|
@@ -12,7 +12,6 @@
|
||||
23 <20><><EFBFBD><E0AEA2> 業<><E6A5AD> |allgames
|
||||
60 <20><><EFBFBD>⥬<EFBFBD><E2A5AC><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> |syspanel
|
||||
18 <20><><EFBFBD>㬥<EFBFBD><E3ACA5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> |docpack
|
||||
49 <20><><EFBFBD><EFBFBD><EFBFBD> |search
|
||||
53 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ணࠬ<E0AEA3><E0A0AC> |run
|
||||
04 <20><><EFBFBD><EFBFBD><EFBFBD>襭<EFBFBD><E8A5AD> ࠡ<><E0A0A1><EFBFBD> |end
|
||||
#1 **** 2D <20><><EFBFBD><EFBFBD><EFBFBD>
|
||||
@@ -90,7 +89,6 @@
|
||||
59 <20><>࠭<EFBFBD><E0A0AD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> |zkey
|
||||
#10 **** <20><><EFBFBD><EFBFBD>
|
||||
16 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> |calc
|
||||
16 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>+ |calcplus
|
||||
03 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Tinypad |tinypad
|
||||
28 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> CodeEdit |develop/cedit
|
||||
21 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> |table
|
||||
@@ -120,7 +118,7 @@
|
||||
45 <20><><EFBFBD><EFBFBD>⮩ <20><>ਭ<EFBFBD><E0A8AD><EFBFBD><EFBFBD><EFBFBD> |easyshot
|
||||
29 FB2 <20><>⠫<EFBFBD><E2A0AB> |fb2read
|
||||
16 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> |aclock
|
||||
21 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> |/kolibrios/utils/period
|
||||
21 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> |period
|
||||
59 <20>७<EFBFBD><E0A5AD><EFBFBD><EFBFBD> KJ|ABuIIIA |games/klavisha
|
||||
16 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> |demos/bcdclk
|
||||
53 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> |timer
|
||||
|
@@ -1,5 +1,3 @@
|
||||
SERIAL_COMPATIBLE_API_VER = 0 ; increments in case of breaking changes
|
||||
|
||||
SERIAL_API_GET_VERSION = 0
|
||||
SERIAL_API_SRV_ADD_PORT = 1
|
||||
SERIAL_API_SRV_REMOVE_PORT = 2
|
||||
@@ -23,18 +21,14 @@ SERIAL_CONF_PARITY_ODD = 2
|
||||
SERIAL_CONF_PARITY_MARK = 3
|
||||
SERIAL_CONF_PARITY_SPACE = 4
|
||||
|
||||
SERIAL_CONF_STOP_BITS_1 = 0
|
||||
SERIAL_CONF_STOP_BITS_1_5 = 1
|
||||
SERIAL_CONF_STOP_BITS_2 = 2
|
||||
|
||||
SERIAL_CONF_FLOW_CTRL_NONE = 0
|
||||
|
||||
struct SP_DRIVER
|
||||
size dd ? ; size of this struct
|
||||
startup dd ? ; int __stdcall (*startup)(void *drv_data, const struct serial_conf *conf);
|
||||
shutdown dd ? ; int __stdcall (*shutdown)(void *drv_data);
|
||||
reconf dd ? ; int __stdcall (*reconf)(void *drv_data, const struct serial_conf *conf);
|
||||
tx dd ? ; int __stdcall (*tx)(void *drv_data);
|
||||
startup dd ? ; void __stdcall (*startup)(void *drv_data, const struct serial_conf *conf);
|
||||
shutdown dd ? ; void __stdcall (*shutdown)(void *drv_data);
|
||||
reconf dd ? ; void __stdcall (*reconf)(void *drv_data, const struct serial_conf *conf);
|
||||
tx dd ? ; void __stdcall (*tx)(void *drv_data);
|
||||
ends
|
||||
|
||||
struct SP_CONF
|
||||
@@ -129,30 +123,6 @@ proc serial_port_init
|
||||
ret
|
||||
endp
|
||||
|
||||
proc serial_port_get_version stdcall, version:dword
|
||||
locals
|
||||
.handler dd ?
|
||||
.io_code dd ?
|
||||
.input dd ?
|
||||
.inp_size dd ?
|
||||
.output dd ?
|
||||
.out_size dd ?
|
||||
endl
|
||||
mov eax, [serial_drv_handle]
|
||||
mov [.handler], eax
|
||||
mov dword [.io_code], SERIAL_API_GET_VERSION
|
||||
mov [.input], 0
|
||||
mov dword [.inp_size], 0
|
||||
mov eax, [version]
|
||||
mov [.output], eax
|
||||
mov dword [.out_size], 4
|
||||
|
||||
lea ecx, [.handler]
|
||||
mcall SF_SYS_MISC, SSF_CONTROL_DRIVER
|
||||
|
||||
ret
|
||||
endp
|
||||
|
||||
proc serial_port_open stdcall uses ebx, port_id:dword, conf:dword, handle:dword
|
||||
locals
|
||||
.handler dd ?
|
||||
|
@@ -9,6 +9,8 @@ __DEBUG_LEVEL__ = L_DBG
|
||||
|
||||
SERIAL_RING_BUF_SIZE = 32768
|
||||
|
||||
API_VERSION = 1
|
||||
|
||||
section '.flat' readable writable executable
|
||||
|
||||
include '../struct.inc'
|
||||
@@ -21,9 +23,6 @@ include 'common.inc'
|
||||
include 'ring_buf.inc'
|
||||
include 'uart16550.inc'
|
||||
|
||||
CURRENT_API = 0x0001
|
||||
API_VERSION = (SERIAL_COMPATIBLE_API_VER shl 16) + CURRENT_API
|
||||
|
||||
struct SERIAL_OBJ
|
||||
magic dd ?
|
||||
destroy dd ?
|
||||
@@ -46,7 +45,7 @@ struct SERIAL_PORT
|
||||
conf SP_CONF
|
||||
ends
|
||||
|
||||
proc START c, reason:dword, cmdline:dword
|
||||
proc START c, reason:dword
|
||||
cmp [reason], DRV_ENTRY
|
||||
jne .fail
|
||||
|
||||
@@ -348,12 +347,15 @@ proc sp_validate_conf
|
||||
mov eax, [ecx + SP_CONF.baudrate]
|
||||
test eax, eax
|
||||
jz .fail
|
||||
mov al, [ecx + SP_CONF.word_size]
|
||||
cmp al, 8
|
||||
jne .fail ; TODO implement different word size
|
||||
mov al, [ecx + SP_CONF.stop_bits]
|
||||
cmp al, SERIAL_CONF_STOP_BITS_2
|
||||
ja .fail
|
||||
cmp al, 1
|
||||
jne .fail ; TODO implement different stop bits count
|
||||
mov al, [ecx + SP_CONF.parity]
|
||||
cmp al, SERIAL_CONF_PARITY_SPACE
|
||||
ja .fail
|
||||
cmp al, SERIAL_CONF_PARITY_NONE
|
||||
jne .fail ; TODO implement parity
|
||||
mov al, [ecx + SP_CONF.flow_ctrl]
|
||||
cmp al, SERIAL_CONF_FLOW_CTRL_NONE
|
||||
jne .fail ; TODO implement flow control
|
||||
@@ -548,6 +550,7 @@ proc sp_setup
|
||||
mov eax, [edi + SERIAL_PORT.drv]
|
||||
mov ecx, [edi + SERIAL_PORT.drv_data]
|
||||
stdcall dword [eax + SP_DRIVER.reconf], ecx, esi
|
||||
xor eax, eax
|
||||
push eax
|
||||
test eax, eax
|
||||
jnz @f
|
||||
|
@@ -350,10 +350,10 @@ endl
|
||||
; calc stop bits
|
||||
mov bx, LCR_STOP_1
|
||||
mov al, [esi + SP_CONF.stop_bits]
|
||||
cmp al, SERIAL_CONF_STOP_BITS_1
|
||||
cmp al, 1
|
||||
je .stop_bits_ok
|
||||
or bx, LCR_STOP_2
|
||||
cmp al, SERIAL_CONF_STOP_BITS_2
|
||||
cmp al, 2
|
||||
jne .fail
|
||||
.stop_bits_ok:
|
||||
or [lcr], bx
|
||||
|
@@ -1123,53 +1123,11 @@ proc uart_shutdown stdcall uses ebx, data:dword
|
||||
ret
|
||||
endp
|
||||
|
||||
proc uart_reconf stdcall uses esi, dev:dword, conf:dword
|
||||
locals
|
||||
ConfPacket rb 8
|
||||
endl
|
||||
proc uart_reconf stdcall uses ebx esi, dev:dword, conf:dword
|
||||
mov ebx, [dev]
|
||||
mov esi, [conf]
|
||||
xor edx, edx
|
||||
mov al, [esi + SP_CONF.word_size]
|
||||
cmp al, 7
|
||||
jb .invalid
|
||||
cmp al, 8
|
||||
ja .invalid
|
||||
mov dl, al
|
||||
; odd and even parities are different from serial api
|
||||
; serial api: even=1 odd=2
|
||||
; ft232x api: odd=1 even=2
|
||||
movzx eax, [esi + SP_CONF.parity]
|
||||
cmp al, SERIAL_CONF_PARITY_SPACE
|
||||
ja .invalid
|
||||
cmp al, SERIAL_CONF_PARITY_ODD
|
||||
ja .parity_ok
|
||||
cmp al, SERIAL_CONF_PARITY_EVEN
|
||||
jb .parity_ok
|
||||
; swap bits
|
||||
xor al, 0x3
|
||||
.parity_ok:
|
||||
shl eax, 8 ; parity offset
|
||||
or edx, eax
|
||||
movzx eax, [esi + SP_CONF.stop_bits]
|
||||
cmp al, SERIAL_CONF_STOP_BITS_2
|
||||
ja .invalid
|
||||
shl eax, 11 ; stop bits offset
|
||||
or edx, eax
|
||||
mov word [ConfPacket], (FTDI_DEVICE_OUT_REQTYPE) \
|
||||
+ (SIO_SET_DATA shl 8)
|
||||
mov word [ConfPacket + 2], dx
|
||||
mov word [ConfPacket + 4], 0
|
||||
mov word [ConfPacket + 6], 0
|
||||
lea edx, [ConfPacket]
|
||||
stdcall ftdi_blocking_ctrl_tranfser, [dev], edx
|
||||
test eax, eax
|
||||
jnz .exit
|
||||
stdcall ftdi_set_baudrate, [dev], [esi + SP_CONF.baudrate]
|
||||
ret
|
||||
|
||||
.invalid:
|
||||
or eax, -1
|
||||
.exit:
|
||||
stdcall ftdi_set_baudrate, ebx, [esi + SP_CONF.baudrate]
|
||||
; TODO set word_size, parity, etc.
|
||||
ret
|
||||
endp
|
||||
|
||||
@@ -1246,10 +1204,17 @@ proc uart_rx stdcall uses ebx esi, data:dword
|
||||
ret
|
||||
endp
|
||||
|
||||
proc ftdi_set_baudrate stdcall uses ebx, dev:dword, baud:dword
|
||||
proc ftdi_set_baudrate stdcall uses ebx esi edi, dev:dword, baud:dword
|
||||
locals
|
||||
ConfPacket rb 8
|
||||
ConfPacket rb 10
|
||||
EventData rd 3
|
||||
endl
|
||||
xor esi, esi
|
||||
xor ecx, ecx
|
||||
invoke CreateEvent
|
||||
mov [EventData], eax
|
||||
mov [EventData + 4], edx
|
||||
|
||||
mov ebx, [dev]
|
||||
cmp [ebx + ftdi_context.chipType], TYPE_2232H
|
||||
jl .c_clk
|
||||
@@ -1292,7 +1257,7 @@ endl
|
||||
jmp .calcend
|
||||
|
||||
.c_nextbaud2:
|
||||
cmp dword [baud], C_CLK / (2 * 16)
|
||||
cmp dword [edi + 8], C_CLK / (2 * 16)
|
||||
jl .c_nextbaud3
|
||||
mov edx, 2
|
||||
mov ecx, C_CLK / (2 * 16)
|
||||
@@ -1383,51 +1348,23 @@ endl
|
||||
mov word [ConfPacket + 4], cx
|
||||
mov word [ConfPacket + 6], 0
|
||||
|
||||
lea ebx, [ConfPacket]
|
||||
stdcall ftdi_blocking_ctrl_tranfser, [dev], ebx
|
||||
|
||||
ret
|
||||
endp
|
||||
|
||||
proc ftdi_blocking_ctrl_tranfser stdcall uses ebx esi edi, dev:dword, conf:dword
|
||||
; conf is a pointer to values: bmRequestType, bRequest, wValue, wIndex, wLength
|
||||
locals
|
||||
EventData rd 3
|
||||
endl
|
||||
xor esi, esi
|
||||
xor ecx, ecx
|
||||
invoke CreateEvent
|
||||
test eax, eax
|
||||
jz .exit
|
||||
mov [EventData], eax
|
||||
mov [EventData + 4], edx
|
||||
|
||||
mov eax, [dev]
|
||||
mov esi, [conf]
|
||||
lea esi, [ConfPacket]
|
||||
lea edi, [EventData]
|
||||
invoke USBControlTransferAsync, [eax + ftdi_context.nullP], esi, 0,\
|
||||
invoke USBControlTransferAsync, [ebx + ftdi_context.nullP], esi, 0,\
|
||||
0, control_callback, edi, 0
|
||||
test eax, eax
|
||||
jz .error
|
||||
|
||||
mov eax, [EventData]
|
||||
mov ebx, [EventData + 4]
|
||||
invoke WaitEvent
|
||||
|
||||
cmp [EventData + 8], 0 ; USB_STATUS_OK
|
||||
jne .error
|
||||
|
||||
mov eax, [EventData]
|
||||
mov ebx, [EventData + 4]
|
||||
invoke DestroyEvent
|
||||
xor eax, eax
|
||||
ret
|
||||
|
||||
.error:
|
||||
mov eax, [EventData]
|
||||
mov ebx, [EventData + 4]
|
||||
invoke DestroyEvent
|
||||
.exit:
|
||||
.error:
|
||||
or eax, -1
|
||||
ret
|
||||
endp
|
||||
|
@@ -1,4 +0,0 @@
|
||||
if tup.getconfig("NO_FASM") ~= "" then return end
|
||||
ROOT = "../../.."
|
||||
tup.rule("usbother.asm", "fasm %f %o " .. tup.getconfig("PESTRIP_CMD") .. tup.getconfig("KPACK_CMD"), "%B.sys")
|
||||
tup.rule("usbdrv.asm", "fasm %f %o ", "%B.dat")
|
@@ -1,214 +0,0 @@
|
||||
;*****************************************************************************;
|
||||
; Copyright (C) 2025, Mikhail Frolov aka Doczom . All rights reserved. ;
|
||||
; Distributed under terms of the 3-Clause BSD License. ;
|
||||
;*****************************************************************************;
|
||||
; File of usb drivers
|
||||
; base = 0
|
||||
; offset | Size | Name | Description
|
||||
;=======================|=======|===============|=============================
|
||||
; base + 0 | 4 | ID_drv_table | offset to dev_ven drv array
|
||||
; base + 4 | 4 | Class_table | offset to class drv array
|
||||
;
|
||||
; n = 0 .. count driver with ID table
|
||||
; nt = count driver with ID table
|
||||
; ID_drv_table + 0*(n-1)| 4 | ID_TABLE | offset from base to table VID:PID
|
||||
; ID_drv_table + 4*(n-1)| 4 | DRV_NAME | offset from base to name of driver
|
||||
; ID_drv_table + 8*nt | 8 | __ZERO | terminaror of list
|
||||
|
||||
; k = 0 .. count driver on class code
|
||||
; kt = count driver on class code
|
||||
; Class_table + 0*(k-1) | 1 | LENGTH_CLASS | length of class code 1..3
|
||||
; Class_table + 1*(k-1) | 1 | USB_CLASS | main usb class code (M)
|
||||
; Class_table + 2*(k-1) | 1 | USB_SUBCLASS | USB subclass code or zero(V)
|
||||
; Class_table + 2*(k-1) | 1 | USB_PROTOCOL | USB protocol code or zero(V)
|
||||
; Class_table + 4*(k-1) | 4 | DRV_NAME | offset from base to name of driver
|
||||
; Class_table + 8*kt | 8 | __ZERO | terminaror of list
|
||||
|
||||
; i = 0 .. count VID:PID
|
||||
; it = count VID:PID
|
||||
; ID_TABLE + 0*(i-1) | 2 | VID | Vendor id
|
||||
; ID_TABLE + 2*(i-1) | 2 | PID | Product id
|
||||
; ID_TABLE + 4*it | 4 | __ZERO | terminaror of list
|
||||
|
||||
|
||||
macro INIT_USBDRV_FILE {
|
||||
local ..id_list, ..class_list
|
||||
|
||||
format binary as 'dat'
|
||||
use32
|
||||
org 0
|
||||
dd ..id_list
|
||||
dd ..class_list
|
||||
|
||||
|
||||
macro ID_DRV_TABLE \{
|
||||
dd 0, 0
|
||||
\}
|
||||
|
||||
macro CLASS_TABLE \{
|
||||
dd 0, 0
|
||||
\}
|
||||
macro ID_TABLE \{
|
||||
\}
|
||||
macro DRV_NAME_LIST \{
|
||||
\}
|
||||
postpone \{
|
||||
..id_list: ID_DRV_TABLE
|
||||
..class_list: CLASS_TABLE
|
||||
ID_TABLE
|
||||
DRV_NAME_LIST
|
||||
\}
|
||||
}
|
||||
|
||||
macro ADD_CLASS drv_name, class, subclass, protocol {
|
||||
|
||||
local ..length, ..class_code, ..drv_name
|
||||
|
||||
..length = 3
|
||||
|
||||
match =X, class \{
|
||||
err 'Class is mandatory argument'
|
||||
\}
|
||||
match =X, protocol \{
|
||||
..length = 2
|
||||
\}
|
||||
match =X, subclass \{
|
||||
..length = 1
|
||||
\}
|
||||
|
||||
..class_code = ..length or (class shl 8)
|
||||
|
||||
if ..length = 3
|
||||
..class_code = ..class_code or (protocol shl 24)
|
||||
end if
|
||||
if ..length = 2
|
||||
..class_code = ..class_code or (subclass shl 16)
|
||||
end if
|
||||
|
||||
|
||||
; add in list
|
||||
|
||||
macro DRV_NAME_LIST \{
|
||||
..drv_name: db drv_name, 0
|
||||
DRV_NAME_LIST
|
||||
\}
|
||||
|
||||
macro CLASS_TABLE \{
|
||||
dd ..class_code, ..drv_name
|
||||
CLASS_TABLE
|
||||
\}
|
||||
}
|
||||
|
||||
macro ADD_ID drv_name, [device_id] {
|
||||
common
|
||||
local ..drv_name, ..id_table
|
||||
|
||||
macro ID_TABLE \{
|
||||
ID_TABLE
|
||||
..id_table:
|
||||
\}
|
||||
|
||||
reverse
|
||||
local vid_pid
|
||||
match VID:PID, device_id \{
|
||||
vid_pid = (PID shl 16) + VID
|
||||
\}
|
||||
|
||||
|
||||
macro ID_TABLE \{
|
||||
ID_TABLE
|
||||
dd vid_pid
|
||||
\}
|
||||
|
||||
common
|
||||
macro ID_TABLE \{
|
||||
ID_TABLE
|
||||
dd 0
|
||||
\}
|
||||
macro DRV_NAME_LIST \{
|
||||
..drv_name: db drv_name, 0
|
||||
DRV_NAME_LIST
|
||||
\}
|
||||
macro ID_DRV_TABLE \{
|
||||
dd ..id_table, ..drv_name
|
||||
ID_DRV_TABLE
|
||||
\}
|
||||
}
|
||||
|
||||
; ADD ID driver Linux
|
||||
macro ADD_IDL drv_name, [vendor_id, device_id] {
|
||||
common
|
||||
local ..drv_name, ..id_table
|
||||
|
||||
macro ID_TABLE \{
|
||||
ID_TABLE
|
||||
..id_table:
|
||||
\}
|
||||
|
||||
reverse
|
||||
local vid_pid
|
||||
vid_pid = (device_id shl 16) + vendor_id
|
||||
|
||||
macro ID_TABLE \{
|
||||
ID_TABLE
|
||||
dd vid_pid
|
||||
\}
|
||||
|
||||
common
|
||||
macro ID_TABLE \{
|
||||
ID_TABLE
|
||||
dd 0
|
||||
\}
|
||||
macro DRV_NAME_LIST \{
|
||||
..drv_name: db drv_name, 0
|
||||
DRV_NAME_LIST
|
||||
\}
|
||||
macro ID_DRV_TABLE \{
|
||||
dd ..id_table, ..drv_name
|
||||
ID_DRV_TABLE
|
||||
\}
|
||||
}
|
||||
|
||||
|
||||
INIT_USBDRV_FILE
|
||||
|
||||
;ADD_CLASS 'usbcdc-ctrl' , 0x02, X , X
|
||||
;ADD_CLASS 'usbimage' , 0x06, 1 , 1
|
||||
;ADD_CLASS 'usbcdc-data' , 0x0A, X , X
|
||||
;ADD_CLASS 'ccid' , 0x0B, X , X
|
||||
;ADD_CLASS 'uvd' , 0x0E, X , X
|
||||
;ADD_CLASS 'uvd_2' , 0x0E, 0x02, X
|
||||
;ADD_CLASS 'usb_bluetooth' , 0xE0, 0x01, X
|
||||
;ADD_CLASS 'usb_wifi' , 0xE0, 0x02, X
|
||||
|
||||
|
||||
|
||||
ADD_ID 'usbftdi',\
|
||||
0x0403:0 ; Any FTDI device
|
||||
|
||||
;https://github.com/avrdudes/avrdude/blob/main/src/usbdevs.h#L51
|
||||
;ADD_ID 'usbasp',\
|
||||
; 0x16c0:0x05dc,\ ; VOTI Obdev's free shared PID
|
||||
; 0x03e8:0xc7b4,\ ; ATMEL (unofficial) USBasp
|
||||
; 0x16c0:0x092f ; VOTI NIBObee PID
|
||||
|
||||
;https://github.com/WCHSoftGroup/ch341par_linux/blob/main/driver/ch34x_pis.c
|
||||
;ADD_IDL 'ch341par',\
|
||||
; 0x1a86, 0x5512,\ ; ch341a default
|
||||
; 0x1a86, 0x55db,\ ; CH347T Mode1 SPI+IIC+UART
|
||||
; 0x1a86, 0x55dd,\ ; CH347T Mode3 JTAG+UART
|
||||
; 0x1a86, 0x55de,\ ; CH347F
|
||||
; 0x1a86, 0x55e7 ; CH339W
|
||||
|
||||
;https://github.com/openbsd/src/blob/master/sys/dev/usb/uchcom.c
|
||||
;https://github.com/WCHSoftGroup/ch341ser_linux/blob/main/driver/ch341.c
|
||||
;ADD_IDL 'ch341ser',\
|
||||
; 0x1a86, 0x7523,\ ; ch340 chip
|
||||
; 0x1a86, 0x7522,\ ; ch340k chip
|
||||
; 0x1a86, 0x5523,\ ; ch341 chip
|
||||
; 0x1a86, 0xe523,\ ; ch330 chip
|
||||
; 0x4348, 0x5523 ; ch340 custom chip
|
||||
|
||||
|
||||
|
||||
|
@@ -1,523 +0,0 @@
|
||||
;*****************************************************************************;
|
||||
; Copyright (C) 2025, Mikhail Frolov aka Doczom . All rights reserved. ;
|
||||
; Distributed under terms of the 3-Clause BSD License. ;
|
||||
; ;
|
||||
; usbother is a driver for loading USB drivers of a certain class and vendor. ;
|
||||
; ;
|
||||
; Version 0.1.1, 24 May 2025 ;
|
||||
; ;
|
||||
;*****************************************************************************;
|
||||
format PE native 0.05
|
||||
entry START
|
||||
; const
|
||||
|
||||
DRV_VERSION = 0x0101 ; 0.1.1
|
||||
|
||||
|
||||
; struct
|
||||
include '../../struct.inc'
|
||||
|
||||
; USB device descriptor
|
||||
struct DEVICE_DESCR
|
||||
bLength db ?
|
||||
bDescriptorType db ?
|
||||
bcdUSB dw ?
|
||||
bDeviceClass db ?
|
||||
bDeviceSubClass db ?
|
||||
bDeviceProtocol db ?
|
||||
bMaxPacketSize0 db ?
|
||||
idVendor dw ?
|
||||
idProduct dw ?
|
||||
bcdDevice dw ?
|
||||
iManufacturer db ?
|
||||
iProduct db ?
|
||||
iSerialNumber db ?
|
||||
bNumConfigurations db ?
|
||||
ends
|
||||
|
||||
struct INTERFACE_DESCR
|
||||
bLength db ?
|
||||
bDescriptorType db ?
|
||||
bInterfaceNumber db ?
|
||||
bAlternateSetting db ?
|
||||
bNumEndpoints db ?
|
||||
bInterfaceClass db ?
|
||||
bInterfaceSubClass db ?
|
||||
bInterfaceProtocol db ?
|
||||
iInterface db ?
|
||||
ends
|
||||
|
||||
|
||||
struct SRV
|
||||
srv_name rb 16 ;ASCIIZ string
|
||||
magic dd ? ;+0x10 ;'SRV '
|
||||
size dd ? ;+0x14 ;size of structure SRV
|
||||
fd dd ? ;+0x18 ;next SRV descriptor
|
||||
bk dd ? ;+0x1C ;prev SRV descriptor
|
||||
base dd ? ;+0x20 ;service base address
|
||||
entry dd ? ;+0x24 ;service START function
|
||||
srv_proc dd ? ;+0x28 ;user mode service handler
|
||||
srv_proc_ex dd ? ;+0x2C ;kernel mode service handler
|
||||
ends
|
||||
|
||||
struct USBSRV
|
||||
srv SRV
|
||||
usb_func dd ?
|
||||
ends
|
||||
|
||||
struct USBFUNC
|
||||
strucsize dd ?
|
||||
add_device dd ?
|
||||
device_disconnect dd ?
|
||||
ends
|
||||
|
||||
USBDRV_TYPE_NOLOCK = 0 ; usb device not controlled (native driver
|
||||
; not found and IOCTL not opened device)
|
||||
USBDRV_TYPE_NATIVE = 1 ; native PE kernel driver for usb
|
||||
USBDRV_TYPE_IOCTL = 2 ; usb device is controlled by IOCTL service
|
||||
; (driver or userspace process/threads)
|
||||
USBDRV_IOCTL_BLOCKED = 4 ; blocked IOCTL interface, device disconnected
|
||||
|
||||
|
||||
|
||||
struct DRV_CONTEXT
|
||||
next dd ?
|
||||
prev dd ?
|
||||
drv_hand dd ?
|
||||
drv_pdata dd ?
|
||||
flags dd ?
|
||||
|
||||
config_descr dd ?
|
||||
interface_descr dd ?
|
||||
ep rd 64 ; 32 IN + 32 OUT endpoints' pipes
|
||||
ends
|
||||
DRV_CONTEXT.ep0 fix (DRV_CONTEXT.ep + 0)
|
||||
|
||||
|
||||
section '.flat' code readable writable executable
|
||||
|
||||
include '../../proc32.inc'
|
||||
include '../../peimport.inc'
|
||||
include '../../macros.inc'
|
||||
|
||||
|
||||
proc START c, state:dword, cmdline:dword
|
||||
|
||||
cmp [state], DRV_ENTRY
|
||||
jne .end
|
||||
; init
|
||||
|
||||
mov ecx, drv_list_lock
|
||||
invoke MutexInit
|
||||
|
||||
mov ecx, interface_list_lock
|
||||
invoke MutexInit
|
||||
|
||||
; load drv_list
|
||||
stdcall load_drv_list, default_list
|
||||
test eax, eax
|
||||
jnz .end
|
||||
|
||||
; reg driver
|
||||
invoke RegUSBDriver, drv_name, service_proc, usb_functions
|
||||
ret
|
||||
.end:
|
||||
xor eax, eax
|
||||
ret
|
||||
endp
|
||||
|
||||
proc load_drv_list stdcall, .path:dword
|
||||
|
||||
push ebx
|
||||
mov ecx, drv_list_lock
|
||||
invoke MutexLock
|
||||
; load file
|
||||
invoke LoadFile, [.path]
|
||||
test eax, eax
|
||||
push eax
|
||||
jnz @f
|
||||
mov dword[esp], -1
|
||||
jmp .exit
|
||||
@@:
|
||||
cmp [drv_list], 0
|
||||
jz @f
|
||||
|
||||
invoke KernelFree, [drv_list]
|
||||
@@:
|
||||
mov eax,[esp]
|
||||
mov [drv_list], eax
|
||||
mov dword[esp], 0
|
||||
.exit:
|
||||
mov ecx, drv_list_lock
|
||||
invoke MutexUnlock
|
||||
pop eax
|
||||
pop ebx
|
||||
ret
|
||||
endp
|
||||
|
||||
|
||||
proc service_proc stdcall, .ioctl:dword
|
||||
|
||||
push esi
|
||||
or eax, -1
|
||||
mov esi, [.ioctl]
|
||||
|
||||
mov ecx, [esi + IOCTL.io_code]
|
||||
cmp ecx, .count_ioctl_codes
|
||||
jae .fail
|
||||
|
||||
jmp dword[.table_subfunction + ecx*4]
|
||||
|
||||
.table_subfunction:
|
||||
dd .get_version
|
||||
dd .update_list
|
||||
dd .get_array_dev
|
||||
dd .get_full_dev_data
|
||||
dd .open_dev
|
||||
dd .close_dev
|
||||
dd .control_transfer
|
||||
dd .bulk_transfer
|
||||
dd .interrupt_transfer
|
||||
;dd .control_transfer_async
|
||||
;dd .bulk_transfer_async
|
||||
;dd .interrupt_transfer_async
|
||||
.count_ioctl_codes = ($ - .table_subfunction)/4
|
||||
|
||||
.get_version:
|
||||
mov eax, [esi + IOCTL.output]
|
||||
cmp [esi + IOCTL.out_size], 4
|
||||
jne .fail
|
||||
|
||||
mov dword[eax], DRV_VERSION
|
||||
xor eax, eax
|
||||
jmp .exit
|
||||
|
||||
.update_list:
|
||||
; update list
|
||||
mov ecx, [esi + IOCTL.input]
|
||||
cmp [esi + IOCTL.inp_size], 0
|
||||
jnz @f
|
||||
|
||||
mov ecx, default_list
|
||||
@@:
|
||||
stdcall load_drv_list, ecx
|
||||
|
||||
.exit:
|
||||
pop esi
|
||||
ret
|
||||
|
||||
.get_array_dev:
|
||||
.get_full_dev_data:
|
||||
.open_dev:
|
||||
.close_dev:
|
||||
;
|
||||
.control_transfer:
|
||||
.bulk_transfer:
|
||||
.interrupt_transfer:
|
||||
|
||||
.fail:
|
||||
or eax, -1
|
||||
jmp .exit
|
||||
endp
|
||||
|
||||
|
||||
proc AddDevice stdcall, .config_pipe:dword, \
|
||||
.config_descr:dword,\
|
||||
.interface:dword
|
||||
|
||||
push esi edi
|
||||
mov eax, sizeof.DRV_CONTEXT
|
||||
invoke Kmalloc
|
||||
test eax, eax
|
||||
jz .err_init
|
||||
|
||||
mov esi, eax
|
||||
|
||||
mov ecx, interface_list_lock
|
||||
invoke MutexLock
|
||||
|
||||
mov edx, [usb_interface_list] ; next
|
||||
mov [esi + DRV_CONTEXT.next], edx
|
||||
mov [esi + DRV_CONTEXT.prev], usb_interface_list
|
||||
mov [usb_interface_list], esi
|
||||
mov [edx + DRV_CONTEXT.prev], esi
|
||||
|
||||
mov ecx, interface_list_lock
|
||||
invoke MutexUnlock
|
||||
|
||||
and [esi + DRV_CONTEXT.drv_hand], 0
|
||||
mov [esi + DRV_CONTEXT.flags], USBDRV_TYPE_NOLOCK
|
||||
|
||||
; lock mutex
|
||||
mov ecx, drv_list_lock
|
||||
invoke MutexLock
|
||||
|
||||
; save device context data
|
||||
mov eax, [.config_pipe]
|
||||
mov [esi + DRV_CONTEXT.ep0], eax
|
||||
mov eax, [.config_descr]
|
||||
mov [esi + DRV_CONTEXT.config_descr], eax
|
||||
mov eax, [.interface]
|
||||
mov [esi + DRV_CONTEXT.interface_descr], eax
|
||||
|
||||
; get pointer to list
|
||||
mov edx, [drv_list]
|
||||
test edx, edx
|
||||
jz .err_exit
|
||||
|
||||
mov edi, edx
|
||||
add edi, [edx]
|
||||
|
||||
; get in ecx VID:PID code
|
||||
invoke USBGetParam, [.config_pipe], 0
|
||||
mov ecx, dword[eax + DEVICE_DESCR.idVendor]
|
||||
|
||||
.loop_id_drv:
|
||||
cmp dword[edi], 0
|
||||
jz .end_loop_id_drv
|
||||
|
||||
mov edx, [drv_list]
|
||||
add edx, [edi] ; ID_TABLE
|
||||
.loop_id:
|
||||
cmp dword[edx], 0
|
||||
jz .end_loop_id
|
||||
|
||||
; check id
|
||||
mov eax, ecx
|
||||
test word[edx + 2], 0xffff
|
||||
jne @f
|
||||
; driver for all devices of VID
|
||||
and eax, 0xffff
|
||||
@@:
|
||||
cmp [edx], eax ; check VID:PID
|
||||
je @f
|
||||
|
||||
add edx, 4
|
||||
jmp .loop_id
|
||||
@@: ; found
|
||||
call .load_drv
|
||||
jnz .exit
|
||||
|
||||
add edx, 4
|
||||
jmp .loop_id
|
||||
.end_loop_id:
|
||||
add edi, 8
|
||||
jmp .loop_id_drv
|
||||
|
||||
.end_loop_id_drv:
|
||||
|
||||
|
||||
push esi
|
||||
mov esi, str_1
|
||||
invoke SysMsgBoardStr
|
||||
pop esi
|
||||
|
||||
|
||||
; get in ecx class code
|
||||
mov eax, [.interface]
|
||||
mov ecx, dword[eax + INTERFACE_DESCR.bInterfaceClass] ; 24-31 bits
|
||||
|
||||
mov edi, [drv_list]
|
||||
add edi, [edi + 4]
|
||||
.loop_class:
|
||||
cmp dword[edi], 0
|
||||
jz .end_loop_class
|
||||
|
||||
; check class
|
||||
movzx eax, byte[edi] ; length
|
||||
and eax, 11b ; protect - max length = 3
|
||||
lea eax, [eax*8] ; 1 = 8; 2 = 16; 3 = 24
|
||||
xor edx, edx
|
||||
bts edx, eax
|
||||
dec edx ; bitmask
|
||||
|
||||
mov eax, [edi]
|
||||
shr eax, 8
|
||||
and eax, edx ; good class in list
|
||||
|
||||
and edx, ecx ; good class of device
|
||||
|
||||
cmp eax, edx
|
||||
je @f
|
||||
|
||||
add edi, 8
|
||||
jmp .loop_class
|
||||
@@: ; found
|
||||
call .load_drv
|
||||
jnz .exit
|
||||
|
||||
add edi, 8
|
||||
jmp .loop_class
|
||||
|
||||
; IN: edi - item list of driver
|
||||
; esi - DRV_CONTEXT
|
||||
; OUT: ZF - not found zF - found
|
||||
; function save drv handl in DRV_CONTEXT.drv_hand
|
||||
; and pdata in DRV_CONTEXT.drv_pdata
|
||||
.load_drv:
|
||||
push ecx edx
|
||||
; load driver
|
||||
push esi
|
||||
mov esi, str_2
|
||||
invoke SysMsgBoardStr
|
||||
pop esi
|
||||
|
||||
mov ecx, [drv_list]
|
||||
add ecx, [edi + 4]
|
||||
|
||||
pusha
|
||||
mov esi, ecx
|
||||
invoke SysMsgBoardStr
|
||||
mov esi, str_newline
|
||||
invoke SysMsgBoardStr
|
||||
popa
|
||||
|
||||
invoke GetService, ecx
|
||||
test eax, eax
|
||||
jz @f
|
||||
|
||||
mov [esi + DRV_CONTEXT.drv_hand], eax
|
||||
; get function list
|
||||
mov ecx, [eax + USBSRV.usb_func]
|
||||
|
||||
; call AddDevice of driver
|
||||
stdcall [ecx + USBFUNC.add_device], [.config_pipe], \
|
||||
[.config_descr],\
|
||||
[.interface]
|
||||
mov [esi + DRV_CONTEXT.drv_pdata], eax
|
||||
test eax, eax
|
||||
jnz .load_drv.good
|
||||
|
||||
push esi
|
||||
mov esi, str_4
|
||||
invoke SysMsgBoardStr
|
||||
pop esi
|
||||
|
||||
and [esi + DRV_CONTEXT.drv_hand], 0
|
||||
@@:
|
||||
pushf
|
||||
push esi
|
||||
mov esi, str_5
|
||||
invoke SysMsgBoardStr
|
||||
pop esi
|
||||
popf
|
||||
|
||||
pop edx ecx
|
||||
retn
|
||||
.load_drv.good:
|
||||
pushf
|
||||
push esi
|
||||
mov esi, str_3
|
||||
invoke SysMsgBoardStr
|
||||
pop esi
|
||||
popf
|
||||
|
||||
mov [esi + DRV_CONTEXT.flags], USBDRV_TYPE_NATIVE
|
||||
pop edx ecx
|
||||
retn
|
||||
|
||||
|
||||
.err_exit:
|
||||
mov eax, esi
|
||||
invoke Kfree
|
||||
xor esi, esi
|
||||
.end_loop_class:
|
||||
.exit:
|
||||
; driver not found - Added libusb driver
|
||||
|
||||
; unlock mutex
|
||||
mov ecx, drv_list_lock
|
||||
invoke MutexUnlock
|
||||
|
||||
mov eax, esi
|
||||
pop edi esi
|
||||
ret
|
||||
.err_init:
|
||||
xor eax, eax
|
||||
pop edi esi
|
||||
ret
|
||||
endp
|
||||
|
||||
|
||||
proc DeviceDisconnected stdcall, .pdata:dword
|
||||
|
||||
mov eax, [.pdata]
|
||||
|
||||
test [eax + DRV_CONTEXT.flags], USBDRV_TYPE_NATIVE
|
||||
jz .no_native
|
||||
|
||||
cmp [eax + DRV_CONTEXT.drv_hand], 0
|
||||
jz .free
|
||||
|
||||
; call device disconnected
|
||||
mov ecx, [eax + DRV_CONTEXT.drv_hand]
|
||||
|
||||
mov edx, [ecx + USBSRV.usb_func]
|
||||
cmp dword[edx], USBFUNC.device_disconnect
|
||||
jbe .free ; TODO: check
|
||||
|
||||
stdcall [edx + USBFUNC.device_disconnect], [eax + DRV_CONTEXT.drv_pdata]
|
||||
.free:
|
||||
; clear list of DRV_CONTENT
|
||||
mov ecx, interface_list_lock
|
||||
invoke MutexLock
|
||||
|
||||
mov eax, [.pdata]
|
||||
mov edx, [eax + DRV_CONTEXT.prev]
|
||||
mov ecx, [eax + DRV_CONTEXT.next]
|
||||
mov [edx + DRV_CONTEXT.next], ecx
|
||||
mov [ecx + DRV_CONTEXT.prev], edx
|
||||
|
||||
mov ecx, interface_list_lock
|
||||
invoke MutexUnlock
|
||||
|
||||
; free context
|
||||
mov eax, [.pdata]
|
||||
invoke Kfree
|
||||
ret
|
||||
.no_native:
|
||||
test [eax + DRV_CONTEXT.flags], USBDRV_TYPE_IOCTL
|
||||
jz .free
|
||||
|
||||
; set state for block user api and clear struct
|
||||
or [eax + DRV_CONTEXT.flags], USBDRV_IOCTL_BLOCKED
|
||||
xor ecx, ecx
|
||||
;mov [eax + DRV_CONTEXT.drv_hand], ecx
|
||||
;mov [eax + DRV_CONTEXT.drv_pdata], ecx
|
||||
mov [eax + DRV_CONTEXT.config_descr], ecx
|
||||
mov [eax + DRV_CONTEXT.interface_descr], ecx
|
||||
mov [eax + DRV_CONTEXT.ep0], ecx
|
||||
; TODO
|
||||
jmp .free
|
||||
endp
|
||||
|
||||
; data
|
||||
drv_list_lock MUTEX
|
||||
|
||||
drv_list dd ?
|
||||
|
||||
interface_list_lock MUTEX
|
||||
usb_interface_list:
|
||||
dd usb_interface_list
|
||||
dd usb_interface_list
|
||||
|
||||
|
||||
usb_functions:
|
||||
dd .end - usb_functions
|
||||
dd AddDevice
|
||||
dd DeviceDisconnected
|
||||
.end:
|
||||
|
||||
drv_name db 'usbother', 0
|
||||
|
||||
default_list: db '/sys/settings/usbdrv.dat', 0
|
||||
|
||||
str_1: db 'USBOTHER: Driver for this ID not found', 13, 10, 0
|
||||
str_2: db 'USBOTHER: Check found driver: ', 0, 13, 10, 0
|
||||
str_3: db 'USBOTHER: Device driver is good', 13, 10, 0
|
||||
str_4: db 'USBOTHER: Device driver fail prob', 13, 10, 0
|
||||
str_5: db 'USBOTHER: Device driver load error', 13, 10, 0
|
||||
str_newline: db 13,10,0
|
||||
|
||||
data fixups
|
||||
end data
|
261
kernel/tags/kolibri0.5.2.1/blkdev/cdrom.inc
Normal file
@@ -0,0 +1,261 @@
|
||||
sys_cd_audio:
|
||||
|
||||
cmp word [cdbase],word 0
|
||||
jnz @f
|
||||
mov eax,1
|
||||
ret
|
||||
@@:
|
||||
|
||||
; eax=1 cdplay at ebx 0x00FFSSMM
|
||||
; eax=2 get tracklist size of ecx to [ebx]
|
||||
; eax=3 stop/pause playing
|
||||
|
||||
cmp eax,1
|
||||
jnz nocdp
|
||||
call sys_cdplay
|
||||
ret
|
||||
nocdp:
|
||||
|
||||
cmp eax,2
|
||||
jnz nocdtl
|
||||
mov edi,[0x3010]
|
||||
add edi,0x10
|
||||
add ebx,[edi]
|
||||
call sys_cdtracklist
|
||||
ret
|
||||
nocdtl:
|
||||
|
||||
cmp eax,3
|
||||
jnz nocdpause
|
||||
call sys_cdpause
|
||||
ret
|
||||
nocdpause:
|
||||
|
||||
mov eax,0xffffff01
|
||||
ret
|
||||
|
||||
|
||||
|
||||
sys_cd_atapi_command:
|
||||
|
||||
pushad
|
||||
|
||||
mov dx,word [cdbase]
|
||||
add dx,6
|
||||
mov ax,word [cdid]
|
||||
out dx,al
|
||||
mov esi,10
|
||||
call delay_ms
|
||||
mov dx,word [cdbase]
|
||||
add dx,7
|
||||
in al,dx
|
||||
and al,0x80
|
||||
cmp al,0
|
||||
jnz res
|
||||
jmp cdl6
|
||||
res:
|
||||
mov dx,word [cdbase]
|
||||
add dx,7
|
||||
mov al,0x8
|
||||
out dx,al
|
||||
mov dx,word [cdbase]
|
||||
add dx,0x206
|
||||
mov al,0xe
|
||||
out dx,al
|
||||
mov esi,1
|
||||
call delay_ms
|
||||
mov dx,word [cdbase]
|
||||
add dx,0x206
|
||||
mov al,0x8
|
||||
out dx,al
|
||||
mov esi,30
|
||||
call delay_ms
|
||||
xor cx,cx
|
||||
cdl5:
|
||||
inc cx
|
||||
cmp cx,10
|
||||
jz cdl6
|
||||
mov dx,word [cdbase]
|
||||
add dx,7
|
||||
in al,dx
|
||||
and al,0x88
|
||||
cmp al,0x00
|
||||
jz cdl5
|
||||
mov esi,100
|
||||
call delay_ms
|
||||
jmp cdl5
|
||||
cdl6:
|
||||
mov dx,word [cdbase]
|
||||
add dx,4
|
||||
mov al,0
|
||||
out dx,al
|
||||
mov dx,word [cdbase]
|
||||
add dx,5
|
||||
mov al,0
|
||||
out dx,al
|
||||
mov dx,word [cdbase]
|
||||
add dx,7
|
||||
mov al,0xec
|
||||
out dx,al
|
||||
mov esi,5
|
||||
call delay_ms
|
||||
mov dx,word [cdbase]
|
||||
add dx,1
|
||||
mov al,0
|
||||
out dx,al
|
||||
add dx,1
|
||||
mov al,0
|
||||
out dx,al
|
||||
add dx,1
|
||||
mov al,0
|
||||
out dx,al
|
||||
add dx,1
|
||||
mov al,0
|
||||
out dx,al
|
||||
add dx,1
|
||||
mov al,128
|
||||
out dx,al
|
||||
add dx,2
|
||||
mov al,0xa0
|
||||
out dx,al
|
||||
xor cx,cx
|
||||
mov dx,word [cdbase]
|
||||
add dx,7
|
||||
cdl1:
|
||||
inc cx
|
||||
cmp cx,100
|
||||
jz cdl2
|
||||
in al,dx
|
||||
and ax,0x88
|
||||
cmp al,0x8
|
||||
jz cdl2
|
||||
mov esi,2
|
||||
call delay_ms
|
||||
jmp cdl1
|
||||
cdl2:
|
||||
|
||||
popad
|
||||
ret
|
||||
|
||||
|
||||
sys_cdplay:
|
||||
|
||||
mov ax,5
|
||||
push ax
|
||||
push ebx
|
||||
cdplay:
|
||||
call sys_cd_atapi_command
|
||||
cli
|
||||
mov dx,word [cdbase]
|
||||
mov ax,0x0047
|
||||
out dx,ax
|
||||
mov al,1
|
||||
mov ah,[esp+0] ; min xx
|
||||
out dx,ax
|
||||
mov ax,[esp+1] ; fr sec
|
||||
out dx,ax
|
||||
mov ax,256+99
|
||||
out dx,ax
|
||||
mov ax,0x0001
|
||||
out dx,ax
|
||||
mov ax,0x0000
|
||||
out dx,ax
|
||||
mov esi,10
|
||||
call delay_ms
|
||||
sti
|
||||
add dx,7
|
||||
in al,dx
|
||||
test al,1
|
||||
jz cdplayok
|
||||
mov ax,[esp+4]
|
||||
dec ax
|
||||
mov [esp+4],ax
|
||||
cmp ax,0
|
||||
jz cdplayfail
|
||||
jmp cdplay
|
||||
cdplayfail:
|
||||
cdplayok:
|
||||
pop ebx
|
||||
pop ax
|
||||
xor eax, eax
|
||||
ret
|
||||
|
||||
|
||||
sys_cdtracklist:
|
||||
|
||||
push ebx
|
||||
tcdplay:
|
||||
call sys_cd_atapi_command
|
||||
mov dx,word [cdbase]
|
||||
mov ax,0x43+2*256
|
||||
out dx,ax
|
||||
mov ax,0x0
|
||||
out dx,ax
|
||||
mov ax,0x0
|
||||
out dx,ax
|
||||
mov ax,0x0
|
||||
out dx,ax
|
||||
mov ax,200
|
||||
out dx,ax
|
||||
mov ax,0x0
|
||||
out dx,ax
|
||||
in al,dx
|
||||
mov cx,1000
|
||||
mov dx,word [cdbase]
|
||||
add dx,7
|
||||
cld
|
||||
cdtrnwewait:
|
||||
mov esi,10
|
||||
call delay_ms
|
||||
in al,dx
|
||||
and al,128
|
||||
cmp al,0
|
||||
jz cdtrl1
|
||||
loop cdtrnwewait
|
||||
cdtrl1:
|
||||
; read the result
|
||||
mov ecx,[esp+0]
|
||||
mov dx,word [cdbase]
|
||||
cdtrread:
|
||||
add dx,7
|
||||
in al,dx
|
||||
and al,8
|
||||
cmp al,8
|
||||
jnz cdtrdone
|
||||
sub dx,7
|
||||
in ax,dx
|
||||
mov [ecx],ax
|
||||
add ecx,2
|
||||
jmp cdtrread
|
||||
cdtrdone:
|
||||
pop ecx
|
||||
xor eax, eax
|
||||
ret
|
||||
|
||||
|
||||
sys_cdpause:
|
||||
|
||||
call sys_cd_atapi_command
|
||||
|
||||
mov dx,word [cdbase]
|
||||
mov ax,0x004B
|
||||
out dx,ax
|
||||
mov ax,0
|
||||
out dx,ax
|
||||
mov ax,0
|
||||
out dx,ax
|
||||
mov ax,0
|
||||
out dx,ax
|
||||
mov ax,0
|
||||
out dx,ax
|
||||
mov ax,0
|
||||
out dx,ax
|
||||
|
||||
mov esi,10
|
||||
call delay_ms
|
||||
add dx,7
|
||||
in al,dx
|
||||
|
||||
xor eax, eax
|
||||
ret
|
||||
|
73
kernel/tags/kolibri0.5.2.1/blkdev/fdc.inc
Normal file
@@ -0,0 +1,73 @@
|
||||
iglobal
|
||||
;function pointers.
|
||||
fdc_irq_func dd fdc_null
|
||||
endg
|
||||
|
||||
uglobal
|
||||
dmasize db 0x0
|
||||
dmamode db 0x0
|
||||
endg
|
||||
|
||||
fdc_init: ;start with clean tracks.
|
||||
mov edi,0xD201
|
||||
mov al,0
|
||||
mov ecx,160
|
||||
rep stosb
|
||||
ret
|
||||
|
||||
fdc_filesave: ;ebx: cluster to be saved.
|
||||
pusha ;returns immediately. does not trigger a write.
|
||||
mov eax,ebx
|
||||
add eax,31
|
||||
mov bl,18
|
||||
div bl
|
||||
mov ah,0
|
||||
add eax,0xD201
|
||||
mov [eax],byte 1 ;This track is now dirty.
|
||||
popa
|
||||
ret
|
||||
|
||||
fdc_irq:
|
||||
call [fdc_irq_func]
|
||||
fdc_null:
|
||||
ret
|
||||
|
||||
save_image:
|
||||
call reserve_flp
|
||||
call restorefatchain
|
||||
pusha
|
||||
call check_label
|
||||
cmp [FDC_Status],0
|
||||
jne unnecessary_save_image
|
||||
mov [FDD_Track],0 ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov [FDD_Head],0 ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov [FDD_Sector],1 ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov esi,0x100000
|
||||
call SeekTrack
|
||||
save_image_1:
|
||||
push esi
|
||||
call take_data_from_application_1
|
||||
pop esi
|
||||
add esi,512
|
||||
call WriteSectWithRetr
|
||||
; call WriteSector
|
||||
cmp [FDC_Status],0
|
||||
jne unnecessary_save_image
|
||||
inc [FDD_Sector]
|
||||
cmp [FDD_Sector],19
|
||||
jne save_image_1
|
||||
mov [FDD_Sector],1
|
||||
inc [FDD_Head]
|
||||
cmp [FDD_Head],2
|
||||
jne save_image_1
|
||||
mov [FDD_Head],0
|
||||
inc [FDD_Track]
|
||||
call SeekTrack
|
||||
cmp [FDD_Track],80
|
||||
jne save_image_1
|
||||
unnecessary_save_image:
|
||||
mov [fdc_irq_func],fdc_null
|
||||
popa
|
||||
mov [flp_status],0
|
||||
ret
|
||||
|
613
kernel/tags/kolibri0.5.2.1/blkdev/flp_drv.inc
Normal file
@@ -0,0 +1,613 @@
|
||||
;**********************************************************
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
;**********************************************************
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Mario79
|
||||
|
||||
give_back_application_data: ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov edi,[3010h]
|
||||
mov edi,[edi+10h]
|
||||
add edi,ecx
|
||||
give_back_application_data_1:
|
||||
mov esi,0xD000 ;FDD_DataBuffer ;0x40000
|
||||
xor ecx,ecx
|
||||
mov cx,128
|
||||
cld
|
||||
rep movsd
|
||||
ret
|
||||
|
||||
take_data_from_application: ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov esi,[3010h]
|
||||
mov esi,[esi+10h]
|
||||
add esi,ecx
|
||||
take_data_from_application_1:
|
||||
mov edi,0xD000 ;FDD_DataBuffer ;0x40000
|
||||
xor ecx,ecx
|
||||
mov cx,128
|
||||
cld
|
||||
rep movsd
|
||||
ret
|
||||
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (FDC_Status)
|
||||
FDC_Normal equ 0 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
FDC_TimeOut equ 1 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
FDC_DiskNotFound equ 2 ;<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
FDC_TrackNotFound equ 3 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
FDC_SectorNotFound equ 4 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1,44 <EFBFBD><EFBFBD>)
|
||||
MAX_Track equ 79
|
||||
MAX_Head equ 1
|
||||
MAX_Sector equ 18
|
||||
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
TickCounter dd ?
|
||||
; <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
FDC_Status DB ?
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
FDD_IntFlag DB ?
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
FDD_Time DD ?
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
FDD_Type db 0
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
FDD_Track DB ?
|
||||
FDD_Head DB ?
|
||||
FDD_Sector DB ?
|
||||
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
FDC_ST0 DB ?
|
||||
FDC_ST1 DB ?
|
||||
FDC_ST2 DB ?
|
||||
FDC_C DB ?
|
||||
FDC_H DB ?
|
||||
FDC_R DB ?
|
||||
FDC_N DB ?
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
ReadRepCounter DB ?
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
RecalRepCounter DB ?
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
;FDD_DataBuffer: times 512 db 0 ;DB 512 DUP (?)
|
||||
fdd_motor_status db 0
|
||||
timer_fdd_motor dd 0
|
||||
|
||||
;*************************************
|
||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
||||
;*************************************
|
||||
Init_FDC_DMA:
|
||||
pushad
|
||||
mov al,0
|
||||
out 0x0c,al ; reset the flip-flop to a known state.
|
||||
mov al,6 ; mask channel 2 so we can reprogram it.
|
||||
out 0x0a,al
|
||||
mov al,[dmamode] ; 0x46 -> Read from floppy - 0x4A Write to floppy
|
||||
out 0x0b,al
|
||||
mov al,0
|
||||
out 0x0c,al ; reset the flip-flop to a known state.
|
||||
mov eax,0xD000
|
||||
out 0x04,al ; set the channel 2 starting address to 0
|
||||
shr eax,8
|
||||
out 0x04,al
|
||||
shr eax,8
|
||||
out 0x81,al
|
||||
mov al,0
|
||||
out 0x0c, al ; reset flip-flop
|
||||
mov al, 0xff ;set count (actual size -1)
|
||||
out 0x5, al
|
||||
mov al,0x1 ;[dmasize] ;(0x1ff = 511 / 0x23ff =9215)
|
||||
out 0x5,al
|
||||
mov al,2
|
||||
out 0xa,al
|
||||
popad
|
||||
ret
|
||||
|
||||
;***********************************
|
||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> FDC *
|
||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: *
|
||||
;* AL - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>. *
|
||||
;***********************************
|
||||
FDCDataOutput:
|
||||
; pusha
|
||||
push ax cx dx
|
||||
mov AH,AL ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> AH
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov [FDC_Status],FDC_Normal
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov DX,3F4h ;(<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> FDC)
|
||||
xor CX,CX ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
@@TestRS:
|
||||
in AL,DX ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> RS
|
||||
and AL,0C0h ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 6 <EFBFBD> 7
|
||||
cmp AL,80h ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 6 <EFBFBD> 7
|
||||
je @@OutByteToFDC
|
||||
loop @@TestRS
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov [FDC_Status],FDC_TimeOut
|
||||
jmp @@End_5
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
@@OutByteToFDC:
|
||||
inc DX
|
||||
mov AL,AH
|
||||
out DX,AL
|
||||
@@End_5:
|
||||
; popa
|
||||
pop dx cx ax
|
||||
ret
|
||||
|
||||
;******************************************
|
||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> FDC *
|
||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. *
|
||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: *
|
||||
;* AL - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>. *
|
||||
;******************************************
|
||||
FDCDataInput:
|
||||
push ECX
|
||||
push DX
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov [FDC_Status],FDC_Normal
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov DX,3F4h ;(<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> FDC)
|
||||
xor CX,CX ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
@@TestRS_1:
|
||||
in AL,DX ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> RS
|
||||
and AL,0C0h ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 6 <EFBFBD> 7
|
||||
cmp AL,0C0h ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 6 <EFBFBD> 7
|
||||
je @@GetByteFromFDC
|
||||
loop @@TestRS_1
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov [FDC_Status],FDC_TimeOut
|
||||
jmp @@End_6
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
@@GetByteFromFDC:
|
||||
inc DX
|
||||
in AL,DX
|
||||
@@End_6: pop DX
|
||||
pop ECX
|
||||
ret
|
||||
|
||||
;*********************************************
|
||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
||||
;*********************************************
|
||||
FDCInterrupt:
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov [FDD_IntFlag],1
|
||||
ret
|
||||
|
||||
|
||||
;******************************************
|
||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
||||
;******************************************
|
||||
SetUserInterrupts:
|
||||
mov [fdc_irq_func],FDCInterrupt
|
||||
ret
|
||||
|
||||
;*******************************************
|
||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
||||
;*******************************************
|
||||
WaitFDCInterrupt:
|
||||
pusha
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov [FDC_Status],FDC_Normal
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov [FDD_IntFlag],0
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov eax,[timer_ticks]
|
||||
mov [TickCounter],eax
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
@@TestRS_2:
|
||||
cmp [FDD_IntFlag],0
|
||||
jnz @@End_7 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
call change_task
|
||||
mov eax,[timer_ticks]
|
||||
sub eax,[TickCounter]
|
||||
cmp eax,50 ;25 ;5 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 5 <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
jb @@TestRS_2
|
||||
; jl @@TestRS_2
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov [FDC_Status],FDC_TimeOut
|
||||
; mov [flp_status],0
|
||||
@@End_7: popa
|
||||
ret
|
||||
|
||||
;*********************************
|
||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> "A:" *
|
||||
;*********************************
|
||||
FDDMotorON:
|
||||
pusha
|
||||
; cmp [fdd_motor_status],1
|
||||
; je fdd_motor_on
|
||||
mov al,[flp_number]
|
||||
cmp [fdd_motor_status],al
|
||||
je fdd_motor_on
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov DX,3F2h ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov AL,0
|
||||
out DX,AL
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
cmp [flp_number],1
|
||||
jne FDDMotorON_B
|
||||
; call FDDMotorOFF_B
|
||||
mov AL,1Ch ; Floppy A
|
||||
jmp FDDMotorON_1
|
||||
FDDMotorON_B:
|
||||
; call FDDMotorOFF_A
|
||||
mov AL,2Dh ; Floppy B
|
||||
FDDMotorON_1:
|
||||
out DX,AL
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov eax,[timer_ticks]
|
||||
mov [TickCounter],eax
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0,5 <EFBFBD>
|
||||
@@dT:
|
||||
call change_task
|
||||
mov eax,[timer_ticks]
|
||||
sub eax,[TickCounter]
|
||||
cmp eax,50 ;10
|
||||
jb @@dT
|
||||
cmp [flp_number],1
|
||||
jne fdd_motor_on_B
|
||||
mov [fdd_motor_status],1
|
||||
jmp fdd_motor_on
|
||||
fdd_motor_on_B:
|
||||
mov [fdd_motor_status],2
|
||||
fdd_motor_on:
|
||||
call save_timer_fdd_motor
|
||||
popa
|
||||
ret
|
||||
|
||||
;*****************************************
|
||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
||||
;*****************************************
|
||||
save_timer_fdd_motor:
|
||||
mov eax,[timer_ticks]
|
||||
mov [timer_fdd_motor],eax
|
||||
ret
|
||||
|
||||
;*****************************************
|
||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
||||
;*****************************************
|
||||
check_fdd_motor_status:
|
||||
cmp [fdd_motor_status],0
|
||||
je end_check_fdd_motor_status_1
|
||||
mov eax,[timer_ticks]
|
||||
sub eax,[timer_fdd_motor]
|
||||
cmp eax,500
|
||||
jb end_check_fdd_motor_status
|
||||
call FDDMotorOFF
|
||||
mov [fdd_motor_status],0
|
||||
end_check_fdd_motor_status_1:
|
||||
mov [flp_status],0
|
||||
end_check_fdd_motor_status:
|
||||
ret
|
||||
|
||||
;**********************************
|
||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
||||
;**********************************
|
||||
FDDMotorOFF:
|
||||
push AX
|
||||
push DX
|
||||
cmp [flp_number],1
|
||||
jne FDDMotorOFF_1
|
||||
call FDDMotorOFF_A
|
||||
jmp FDDMotorOFF_2
|
||||
FDDMotorOFF_1:
|
||||
call FDDMotorOFF_B
|
||||
FDDMotorOFF_2:
|
||||
pop DX
|
||||
pop AX
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov [root_read],0
|
||||
mov [flp_fat],0
|
||||
ret
|
||||
|
||||
FDDMotorOFF_A:
|
||||
mov DX,3F2h ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov AL,0Ch ; Floppy A
|
||||
out DX,AL
|
||||
ret
|
||||
|
||||
FDDMotorOFF_B:
|
||||
mov DX,3F2h ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov AL,5h ; Floppy B
|
||||
out DX,AL
|
||||
ret
|
||||
|
||||
;*******************************
|
||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> "A:" *
|
||||
;*******************************
|
||||
RecalibrateFDD:
|
||||
pusha
|
||||
call save_timer_fdd_motor
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
||||
mov AL,07h
|
||||
call FDCDataOutput
|
||||
mov AL,00h
|
||||
call FDCDataOutput
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
call WaitFDCInterrupt
|
||||
; cmp [FDC_Status],0
|
||||
; je no_fdc_status_error
|
||||
; mov [flp_status],0
|
||||
;no_fdc_status_error:
|
||||
call save_timer_fdd_motor
|
||||
popa
|
||||
ret
|
||||
|
||||
;*****************************************************
|
||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: *
|
||||
;* FDD_Track - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (0-79); *
|
||||
;* FDD_Head - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (0-1). *
|
||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> FDC_Status. *
|
||||
;*****************************************************
|
||||
SeekTrack:
|
||||
pusha
|
||||
call save_timer_fdd_motor
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
||||
mov AL,0Fh
|
||||
call FDCDataOutput
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov AL,[FDD_Head]
|
||||
shl AL,2
|
||||
call FDCDataOutput
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov AL,[FDD_Track]
|
||||
call FDCDataOutput
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
call WaitFDCInterrupt
|
||||
cmp [FDC_Status],FDC_Normal
|
||||
jne @@Exit
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov AL,08h
|
||||
call FDCDataOutput
|
||||
call FDCDataInput
|
||||
mov [FDC_ST0],AL
|
||||
call FDCDataInput
|
||||
mov [FDC_C],AL
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?
|
||||
test [FDC_ST0],100000b
|
||||
je @@Err
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?
|
||||
mov AL,[FDC_C]
|
||||
cmp AL,[FDD_Track]
|
||||
jne @@Err
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?
|
||||
mov AL,[FDC_ST0]
|
||||
and AL,100b
|
||||
shr AL,2
|
||||
cmp AL,[FDD_Head]
|
||||
jne @@Err
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov [FDC_Status],FDC_Normal
|
||||
jmp @@Exit
|
||||
@@Err: ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov [FDC_Status],FDC_TrackNotFound
|
||||
; mov [flp_status],0
|
||||
@@Exit:
|
||||
call save_timer_fdd_motor
|
||||
popa
|
||||
ret
|
||||
|
||||
;*******************************************************
|
||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: *
|
||||
;* FDD_Track - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (0-79); *
|
||||
;* FDD_Head - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (0-1); *
|
||||
;* FDD_Sector - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (1-18). *
|
||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> FDC_Status. *
|
||||
;* <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> FDD_DataBuffer. *
|
||||
;*******************************************************
|
||||
ReadSector:
|
||||
pushad
|
||||
call save_timer_fdd_motor
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 500 <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<EFBFBD>
|
||||
mov AX,0
|
||||
mov DX,03F7h
|
||||
out DX,AL
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov [dmamode],0x46
|
||||
call Init_FDC_DMA
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
||||
mov AL,0E6h ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
call FDCDataOutput
|
||||
mov AL,[FDD_Head]
|
||||
shl AL,2
|
||||
call FDCDataOutput
|
||||
mov AL,[FDD_Track]
|
||||
call FDCDataOutput
|
||||
mov AL,[FDD_Head]
|
||||
call FDCDataOutput
|
||||
mov AL,[FDD_Sector]
|
||||
call FDCDataOutput
|
||||
mov AL,2 ;<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (512 <EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
||||
call FDCDataOutput
|
||||
mov AL,18 ;+1; 3Fh ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
call FDCDataOutput
|
||||
mov AL,1Bh ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> GPL
|
||||
call FDCDataOutput
|
||||
mov AL,0FFh ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> DTL
|
||||
call FDCDataOutput
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
call WaitFDCInterrupt
|
||||
cmp [FDC_Status],FDC_Normal
|
||||
jne @@Exit_1
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
call GetStatusInfo
|
||||
test [FDC_ST0],11011000b
|
||||
jnz @@Err_1
|
||||
mov [FDC_Status],FDC_Normal
|
||||
jmp @@Exit_1
|
||||
@@Err_1: mov [FDC_Status],FDC_SectorNotFound
|
||||
; mov [flp_status],0
|
||||
@@Exit_1:
|
||||
call save_timer_fdd_motor
|
||||
popad
|
||||
ret
|
||||
|
||||
;*******************************************************
|
||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>) *
|
||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: *
|
||||
;* FDD_Track - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (0-79); *
|
||||
;* FDD_Head - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (0-1); *
|
||||
;* FDD_Sector - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (1-18). *
|
||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> FDC_Status. *
|
||||
;* <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> FDD_DataBuffer. *
|
||||
;*******************************************************
|
||||
ReadSectWithRetr:
|
||||
pusha
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov [RecalRepCounter],0
|
||||
@@TryAgain:
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov [ReadRepCounter],0
|
||||
@@ReadSector_1:
|
||||
call ReadSector
|
||||
cmp [FDC_Status],0
|
||||
je @@Exit_2
|
||||
cmp [FDC_Status],1
|
||||
je @@Err_3
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
inc [ReadRepCounter]
|
||||
cmp [ReadRepCounter],3
|
||||
jb @@ReadSector_1
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
call RecalibrateFDD
|
||||
call SeekTrack
|
||||
inc [RecalRepCounter]
|
||||
cmp [RecalRepCounter],3
|
||||
jb @@TryAgain
|
||||
; mov [flp_status],0
|
||||
@@Exit_2:
|
||||
popa
|
||||
ret
|
||||
@@Err_3:
|
||||
mov [flp_status],0
|
||||
popa
|
||||
ret
|
||||
|
||||
;*******************************************************
|
||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: *
|
||||
;* FDD_Track - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (0-79); *
|
||||
;* FDD_Head - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (0-1); *
|
||||
;* FDD_Sector - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (1-18). *
|
||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> FDC_Status. *
|
||||
;* <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> FDD_DataBuffer <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. *
|
||||
;*******************************************************
|
||||
WriteSector:
|
||||
pushad
|
||||
call save_timer_fdd_motor
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 500 <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<EFBFBD>
|
||||
mov AX,0
|
||||
mov DX,03F7h
|
||||
out DX,AL
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov [dmamode],0x4A
|
||||
call Init_FDC_DMA
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
||||
mov AL,0xC5 ;0x45 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
call FDCDataOutput
|
||||
mov AL,[FDD_Head]
|
||||
shl AL,2
|
||||
call FDCDataOutput
|
||||
mov AL,[FDD_Track]
|
||||
call FDCDataOutput
|
||||
mov AL,[FDD_Head]
|
||||
call FDCDataOutput
|
||||
mov AL,[FDD_Sector]
|
||||
call FDCDataOutput
|
||||
mov AL,2 ;<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (512 <EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
||||
call FDCDataOutput
|
||||
mov AL,18; 3Fh ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
call FDCDataOutput
|
||||
mov AL,1Bh ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> GPL
|
||||
call FDCDataOutput
|
||||
mov AL,0FFh ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> DTL
|
||||
call FDCDataOutput
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
call WaitFDCInterrupt
|
||||
cmp [FDC_Status],FDC_Normal
|
||||
jne @@Exit_3
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
call GetStatusInfo
|
||||
test [FDC_ST0],11000000b ;11011000b
|
||||
jnz @@Err_2
|
||||
mov [FDC_Status],FDC_Normal
|
||||
jmp @@Exit_3
|
||||
@@Err_2: mov [FDC_Status],FDC_SectorNotFound
|
||||
@@Exit_3:
|
||||
call save_timer_fdd_motor
|
||||
popad
|
||||
ret
|
||||
|
||||
;*******************************************************
|
||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>) *
|
||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: *
|
||||
;* FDD_Track - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (0-79); *
|
||||
;* FDD_Head - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (0-1); *
|
||||
;* FDD_Sector - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (1-18). *
|
||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> FDC_Status. *
|
||||
;* <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> FDD_DataBuffer <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. *
|
||||
;*******************************************************
|
||||
WriteSectWithRetr:
|
||||
pusha
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov [RecalRepCounter],0
|
||||
@@TryAgain_1:
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov [ReadRepCounter],0
|
||||
@@WriteSector_1:
|
||||
call WriteSector
|
||||
cmp [FDC_Status],0
|
||||
je @@Exit_4
|
||||
cmp [FDC_Status],1
|
||||
je @@Err_4
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
inc [ReadRepCounter]
|
||||
cmp [ReadRepCounter],3
|
||||
jb @@WriteSector_1
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
call RecalibrateFDD
|
||||
call SeekTrack
|
||||
inc [RecalRepCounter]
|
||||
cmp [RecalRepCounter],3
|
||||
jb @@TryAgain_1
|
||||
@@Exit_4:
|
||||
popa
|
||||
ret
|
||||
@@Err_4:
|
||||
mov [flp_status],0
|
||||
popa
|
||||
ret
|
||||
|
||||
;*********************************************
|
||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
||||
;*********************************************
|
||||
GetStatusInfo:
|
||||
push AX
|
||||
call FDCDataInput
|
||||
mov [FDC_ST0],AL
|
||||
call FDCDataInput
|
||||
mov [FDC_ST1],AL
|
||||
call FDCDataInput
|
||||
mov [FDC_ST2],AL
|
||||
call FDCDataInput
|
||||
mov [FDC_C],AL
|
||||
call FDCDataInput
|
||||
mov [FDC_H],AL
|
||||
call FDCDataInput
|
||||
mov [FDC_R],AL
|
||||
call FDCDataInput
|
||||
mov [FDC_N],AL
|
||||
pop AX
|
||||
ret
|
||||
|
522
kernel/tags/kolibri0.5.2.1/blkdev/rd.inc
Normal file
@@ -0,0 +1,522 @@
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; RAMDISK functions ;;
|
||||
;; (C) 2004 Ville Turjanmaa, License: GPL ;;
|
||||
;; Addings by M.Lisovin ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
; calculate fat chain
|
||||
|
||||
calculatefatchain:
|
||||
|
||||
pushad
|
||||
|
||||
mov esi,0x100000+512
|
||||
mov edi,0x280000
|
||||
|
||||
fcnew:
|
||||
mov eax,dword [esi]
|
||||
mov ebx,dword [esi+4]
|
||||
mov ecx,dword [esi+8]
|
||||
mov edx,ecx
|
||||
shr edx,4 ;8 ok
|
||||
shr dx,4 ;7 ok
|
||||
xor ch,ch
|
||||
shld ecx,ebx,20 ;6 ok
|
||||
shr cx,4 ;5 ok
|
||||
shld ebx,eax,12
|
||||
and ebx,0x0fffffff ;4 ok
|
||||
shr bx,4 ;3 ok
|
||||
shl eax,4
|
||||
and eax,0x0fffffff ;2 ok
|
||||
shr ax,4 ;1 ok
|
||||
mov dword [edi],eax
|
||||
add edi,4
|
||||
mov dword [edi],ebx
|
||||
add edi,4
|
||||
mov dword [edi],ecx
|
||||
add edi,4
|
||||
mov dword [edi],edx
|
||||
add edi,4
|
||||
add esi,12
|
||||
|
||||
cmp edi,0x280000+2856*2 ;2849 clusters
|
||||
jnz fcnew
|
||||
|
||||
popad
|
||||
ret
|
||||
|
||||
|
||||
restorefatchain: ; restore fat chain
|
||||
|
||||
pushad
|
||||
|
||||
mov esi,0x280000
|
||||
mov edi,0x100000+512
|
||||
|
||||
fcnew2:
|
||||
mov eax,dword [esi]
|
||||
mov ebx,dword [esi+4]
|
||||
shl ax,4
|
||||
shl eax,4
|
||||
shl bx,4
|
||||
shr ebx,4
|
||||
shrd eax,ebx,8
|
||||
shr ebx,8
|
||||
mov dword [edi],eax
|
||||
add edi,4
|
||||
mov word [edi],bx
|
||||
add edi,2
|
||||
add esi,8
|
||||
|
||||
cmp edi,0x100000+512+4278 ;4274 bytes - all used FAT
|
||||
jb fcnew2
|
||||
|
||||
mov esi,0x100000+512 ; duplicate fat chain
|
||||
mov edi,0x100000+512+0x1200
|
||||
mov ecx,1069 ;4274/4
|
||||
cld
|
||||
rep movsd
|
||||
|
||||
popad
|
||||
ret
|
||||
|
||||
|
||||
ramdisk_free_space:
|
||||
;---------------------------------------------
|
||||
;
|
||||
; returns free space in edi
|
||||
; rewr.by Mihasik
|
||||
;---------------------------------------------
|
||||
|
||||
push eax ebx ecx
|
||||
|
||||
mov edi,0x280000 ;start of FAT
|
||||
xor ax,ax ;Free cluster=0x0000 in FAT
|
||||
xor ebx,ebx ;counter
|
||||
mov ecx,2849 ;2849 clusters
|
||||
cld
|
||||
rdfs1:
|
||||
repne scasw
|
||||
jnz rdfs2 ;if last cluster not 0
|
||||
inc ebx
|
||||
jcxz rdfs2 ;if last cluster=0
|
||||
jmp rdfs1 ;if not last
|
||||
rdfs2:
|
||||
shl ebx,9 ;free clusters*512
|
||||
mov edi,ebx
|
||||
|
||||
pop ecx ebx eax
|
||||
ret
|
||||
|
||||
|
||||
expand_filename:
|
||||
;---------------------------------------------
|
||||
;
|
||||
; exapand filename with '.' to 11 character
|
||||
; eax - pointer to filename
|
||||
;---------------------------------------------
|
||||
|
||||
push esi edi ebx
|
||||
|
||||
mov edi,esp ; check for '.' in the name
|
||||
add edi,12+8
|
||||
|
||||
mov esi,eax
|
||||
|
||||
mov eax,edi
|
||||
mov [eax+0],dword ' '
|
||||
mov [eax+4],dword ' '
|
||||
mov [eax+8],dword ' '
|
||||
|
||||
flr1:
|
||||
|
||||
cmp [esi],byte '.'
|
||||
jne flr2
|
||||
mov edi,eax
|
||||
add edi,7
|
||||
jmp flr3
|
||||
|
||||
flr2:
|
||||
|
||||
mov bl,[esi]
|
||||
mov [edi],bl
|
||||
|
||||
flr3:
|
||||
|
||||
inc esi
|
||||
inc edi
|
||||
|
||||
mov ebx,eax
|
||||
add ebx,11
|
||||
|
||||
cmp edi,ebx
|
||||
jbe flr1
|
||||
|
||||
pop ebx edi esi
|
||||
ret
|
||||
|
||||
fileread:
|
||||
;----------------------------------------------------------------
|
||||
;
|
||||
; fileread - sys floppy
|
||||
;
|
||||
; eax points to filename 11 chars
|
||||
; ebx first wanted block ; 1+ ; if 0 then set to 1
|
||||
; ecx number of blocks to read ; 1+ ; if 0 then set to 1
|
||||
; edx mem location to return data
|
||||
; esi length of filename 12*X 0=root
|
||||
;
|
||||
; ret ebx = size or 0xffffffff file not found
|
||||
; eax = 0 ok read or other = errormsg
|
||||
;
|
||||
;--------------------------------------------------------------
|
||||
test ebx,ebx ;if ebx=0 - set to 1
|
||||
jnz frfl5
|
||||
inc ebx
|
||||
frfl5:
|
||||
test ecx,ecx ;if ecx=0 - set to 1
|
||||
jnz frfl6
|
||||
inc ecx
|
||||
frfl6:
|
||||
test esi,esi ; return ramdisk root
|
||||
jnz fr_noroot ;if not root
|
||||
cmp ebx,14 ;14 clusters=root dir
|
||||
ja oorr
|
||||
cmp ecx,14
|
||||
ja oorr
|
||||
jmp fr_do
|
||||
oorr:
|
||||
mov eax,5 ;out of root range (fnf)
|
||||
xor ebx,ebx
|
||||
dec ebx ;0xffffffff
|
||||
ret
|
||||
|
||||
fr_do: ;reading rootdir
|
||||
mov edi,edx
|
||||
dec ebx
|
||||
push edx
|
||||
mov edx,ecx
|
||||
add edx,ebx
|
||||
cmp edx,15 ;ebx+ecx=14+1
|
||||
pushf
|
||||
jbe fr_do1
|
||||
sub edx,14
|
||||
sub ecx,edx
|
||||
fr_do1:
|
||||
shl ebx,9
|
||||
mov esi,0x100000+512*19
|
||||
add esi,ebx
|
||||
shl ecx,7
|
||||
cld
|
||||
rep movsd
|
||||
popf
|
||||
pop edx
|
||||
jae fr_do2
|
||||
xor eax,eax ; ok read
|
||||
xor ebx,ebx
|
||||
ret
|
||||
fr_do2: ;if last cluster
|
||||
mov eax,6 ;end of file
|
||||
xor ebx,ebx
|
||||
ret
|
||||
|
||||
fr_noroot:
|
||||
|
||||
sub esp,32
|
||||
call expand_filename
|
||||
|
||||
dec ebx
|
||||
|
||||
push eax
|
||||
|
||||
push eax ebx ecx edx esi edi
|
||||
call rd_findfile
|
||||
je fifound
|
||||
add esp,32+28 ;if file not found
|
||||
ret
|
||||
|
||||
fifound:
|
||||
|
||||
mov ebx,[edi-11+28] ;file size
|
||||
mov [esp+20],ebx
|
||||
mov [esp+24],ebx
|
||||
add edi,0xf
|
||||
movzx eax,word [edi]
|
||||
mov edi,eax ;edi=cluster
|
||||
|
||||
frnew:
|
||||
|
||||
add eax,31 ;bootsector+2*fat+filenames
|
||||
shl eax,9 ;*512
|
||||
add eax,0x100000 ;image base
|
||||
mov ebx,[esp+8]
|
||||
mov ecx,512 ;[esp+4]
|
||||
|
||||
cmp [esp+16],dword 0 ; wanted cluster ?
|
||||
jne frfl7
|
||||
call memmove
|
||||
add [esp+8],dword 512
|
||||
dec dword [esp+12] ; last wanted cluster ?
|
||||
cmp [esp+12],dword 0
|
||||
je frnoread
|
||||
jmp frfl8
|
||||
frfl7:
|
||||
dec dword [esp+16]
|
||||
frfl8:
|
||||
shl edi,1 ;find next cluster from FAT
|
||||
add edi,0x280000
|
||||
movzx eax,word [edi]
|
||||
mov edi,eax
|
||||
cmp edi,4095 ;eof - cluster
|
||||
jz frnoread2
|
||||
|
||||
cmp [esp+24],dword 512 ;eof - size
|
||||
jb frnoread
|
||||
sub [esp+24],dword 512
|
||||
|
||||
jmp frnew
|
||||
|
||||
frnoread2:
|
||||
|
||||
cmp [esp+16],dword 0 ; eof without read ?
|
||||
je frnoread
|
||||
|
||||
pop edi esi edx ecx
|
||||
add esp,4
|
||||
pop ebx ; ebx <- eax : size of file
|
||||
add esp,36
|
||||
mov eax,6 ; end of file
|
||||
ret
|
||||
|
||||
frnoread:
|
||||
|
||||
pop edi esi edx ecx
|
||||
add esp,4
|
||||
pop ebx ; ebx <- eax : size of file
|
||||
add esp,36
|
||||
xor eax,eax ;read ok
|
||||
ret
|
||||
|
||||
filedelete:
|
||||
;--------------------------------------------
|
||||
;
|
||||
; filedelete - sys floppy
|
||||
; in:
|
||||
; eax - pointer to filename 11 chars
|
||||
;
|
||||
; out:
|
||||
; eax - 0 = successful, 5 = file not found
|
||||
;
|
||||
;--------------------------------------------
|
||||
|
||||
sub esp,32
|
||||
call expand_filename
|
||||
|
||||
push eax ebx ecx edx esi edi
|
||||
|
||||
call rd_findfile
|
||||
je fifoundd
|
||||
pop edi esi edx ecx ebx eax ;file not found
|
||||
add esp,32
|
||||
mov eax,5
|
||||
ret
|
||||
|
||||
fifoundd:
|
||||
|
||||
mov [edi-11],byte 0xE5 ;mark filename deleted
|
||||
add edi,0xf
|
||||
movzx eax,word [edi]
|
||||
mov edi,eax ;edi = cluster
|
||||
|
||||
frnewd:
|
||||
|
||||
shl edi,1 ;find next cluster from FAT
|
||||
add edi,0x280000
|
||||
movzx eax,word [edi]
|
||||
mov [edi],word 0x0 ;clear fat chain cluster
|
||||
mov edi,eax
|
||||
cmp edi,dword 0xff8 ;last cluster ?
|
||||
jb frnewd
|
||||
|
||||
pop edi esi edx ecx ebx eax
|
||||
add esp,32
|
||||
xor eax,eax ; file found
|
||||
ret
|
||||
|
||||
|
||||
|
||||
filesave:
|
||||
;----------------------------------------------------------
|
||||
;
|
||||
; filesave - sys floppy
|
||||
;
|
||||
; eax points to filename 11 chars
|
||||
;
|
||||
; eax ; pointer to file name
|
||||
; ebx ; buffer
|
||||
; ecx ; count to write in bytes
|
||||
; edx ; 0 create new , 1 append
|
||||
;
|
||||
;-----------------------------------------------------------
|
||||
|
||||
sub esp,32
|
||||
call expand_filename
|
||||
test edx,edx
|
||||
jnz fsdel
|
||||
pusha
|
||||
call filedelete
|
||||
popa
|
||||
|
||||
fsdel:
|
||||
|
||||
call ramdisk_free_space
|
||||
cmp ecx,edi
|
||||
jbe rd_do_save
|
||||
add esp,32
|
||||
mov eax,8 ;disk full
|
||||
ret
|
||||
|
||||
rd_do_save:
|
||||
|
||||
push eax ebx ecx edx esi edi
|
||||
|
||||
mov edi,0x100000+512*18+512 ;Point at directory
|
||||
mov edx,224 +1
|
||||
; find an empty spot for filename in the root dir
|
||||
l20ds:
|
||||
dec edx
|
||||
test edx,edx
|
||||
jz frnoreadds
|
||||
l21ds:
|
||||
cmp [edi],byte 0xE5
|
||||
jz fifoundds
|
||||
cmp [edi],byte 0x0
|
||||
jz fifoundds
|
||||
add edi,32 ; Advance to next entry
|
||||
jmp l20ds
|
||||
fifoundds:
|
||||
|
||||
push edi ; move the filename to root dir
|
||||
mov esi,[esp+4+20]
|
||||
mov ecx,11
|
||||
cld
|
||||
rep movsb
|
||||
pop edi
|
||||
mov edx,edi
|
||||
add edx,11+0xf ; edx <- cluster save position
|
||||
mov ebx,[esp+12] ; save file size
|
||||
mov [edi+28],ebx
|
||||
mov [edi+11],byte 0x20 ; attribute
|
||||
; Ivan Poddubny 11/12/2003:
|
||||
call get_date_for_file ; from FAT32.INC
|
||||
mov [edi+24],ax ; date
|
||||
call get_time_for_file ; from FAT32.INC
|
||||
mov [edi+22],ax ; time
|
||||
; End
|
||||
mov edi,0x280000 ;pointer to first cluster
|
||||
mov ecx,2849
|
||||
cld
|
||||
frnewds:
|
||||
xor ax,ax
|
||||
repne scasw
|
||||
mov ebx,2848
|
||||
sub ebx,ecx
|
||||
mov [edx],bx ; save next cluster pos. to prev cl.
|
||||
mov edx,edi ; next save pos abs mem add
|
||||
dec edx
|
||||
dec edx
|
||||
call fdc_filesave
|
||||
pusha ; move save to floppy cluster
|
||||
add ebx,31
|
||||
shl ebx,9
|
||||
add ebx,0x100000
|
||||
mov eax,[esp+32+16]
|
||||
mov ecx,512
|
||||
call memmove
|
||||
popa
|
||||
|
||||
mov eax,[esp+12]
|
||||
cmp eax,512
|
||||
jb flnsa
|
||||
sub eax,512
|
||||
mov [esp+12],eax
|
||||
mov eax,[esp+16]
|
||||
add eax,512
|
||||
mov [esp+16],eax
|
||||
jmp frnewds
|
||||
|
||||
flnsa:
|
||||
dec edi
|
||||
dec edi
|
||||
mov [edi],word 4095 ; mark end of file - last cluster
|
||||
|
||||
frnoreadds:
|
||||
|
||||
pop edi esi edx ecx ebx eax
|
||||
add esp,32
|
||||
|
||||
; pusha
|
||||
; cli
|
||||
; call fdc_commitfile
|
||||
; sti
|
||||
; popa
|
||||
|
||||
xor eax,eax ;ok write
|
||||
ret
|
||||
|
||||
rd_findfile:
|
||||
;by Mihasik
|
||||
;IN: eax - pointer to filename OUT: filestring+11 in edi or notZero in flags and fnf in eax,ebx
|
||||
|
||||
mov edi,0x100000+512*18+512 ;Point at directory
|
||||
cld
|
||||
rd_newsearch:
|
||||
mov esi,eax
|
||||
mov ecx,11
|
||||
rep cmpsb
|
||||
je rd_ff
|
||||
add cl,21
|
||||
add edi,ecx
|
||||
cmp edi,0x100000+512*33
|
||||
jb rd_newsearch
|
||||
mov eax,5 ;if file not found - eax=5
|
||||
xor ebx,ebx
|
||||
dec ebx ;ebx=0xffffffff and zf=0
|
||||
rd_ff:
|
||||
ret
|
||||
|
||||
rd_getfileinfo:
|
||||
;get date, time, size or attributes of file
|
||||
;IN: eax - pointer to file, ebx - type of function: 12-get filesize, 13-get fileattr, 14-get filedate
|
||||
;ecx - filelengh 0=root
|
||||
;OUT: eax=0 - Ok or 5 - file not found ebx - date/time, size or attributes
|
||||
test ecx,ecx
|
||||
jnz no_getfinfo_root
|
||||
mov eax,5 ;if root - fnf
|
||||
xor ebx,ebx
|
||||
dec ebx
|
||||
ret
|
||||
no_getfinfo_root: ;if not root
|
||||
sub esp,32
|
||||
call expand_filename
|
||||
call rd_findfile
|
||||
je fifoundi
|
||||
add esp,32 ;if file not found
|
||||
ret
|
||||
fifoundi:
|
||||
cmp ebx,13
|
||||
jne no_rd_attr
|
||||
movzx ebx,byte [edi] ;get attributes
|
||||
jmp rd_getfileinfo_end
|
||||
no_rd_attr:
|
||||
cmp ebx,14
|
||||
jne no_rd_date
|
||||
mov ebx,dword [edi+11] ;get date/time
|
||||
jmp rd_getfileinfo_end
|
||||
no_rd_date:
|
||||
mov ebx,dword [edi+17] ;get size
|
||||
rd_getfileinfo_end:
|
||||
xor eax,eax
|
||||
add esp,32
|
||||
ret
|
26
kernel/tags/kolibri0.5.2.1/blkdev/rdsave.inc
Normal file
@@ -0,0 +1,26 @@
|
||||
cmp eax,6 ; SAVE FLOPPY IMAGE (HD version only)
|
||||
jnz nosaveimage
|
||||
cmp ebx,1
|
||||
jnz img_save_hd_1
|
||||
mov edx,bootpath ; path = '/KOLIBRI '
|
||||
jmp img_save_hd_3
|
||||
img_save_hd_1:
|
||||
cmp ebx,2
|
||||
jnz img_save_hd_2
|
||||
mov edx,bootpath2 ; path = 0 (root dir)
|
||||
jmp img_save_hd_3
|
||||
img_save_hd_2:
|
||||
cmp ebx,3
|
||||
jnz exit_for_anyone
|
||||
mov edx,[3010h]
|
||||
mov edx,[edx+10h]
|
||||
add edx,ecx
|
||||
img_save_hd_3:
|
||||
call restorefatchain ; restore FAT !!!
|
||||
mov eax,image_save
|
||||
mov ebx,1440*1024 ; size 1440 Kb
|
||||
mov ecx,0x100000 ; address of image
|
||||
call file_write
|
||||
ret
|
||||
|
||||
nosaveimage:
|
917
kernel/tags/kolibri0.5.2.1/boot/bootcode.inc
Normal file
@@ -0,0 +1,917 @@
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; BOOTCODE.INC ;;
|
||||
;; ;;
|
||||
;; 16 bit bootcode for MenuetOS ;;
|
||||
;; ;;
|
||||
;; Copyright 2002 Ville Turjanmaa ;;
|
||||
;; ;;
|
||||
;; See file COPYING for details ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
|
||||
|
||||
;==========================================================================
|
||||
;
|
||||
; 16 BIT FUNCTIONS
|
||||
;
|
||||
;==========================================================================
|
||||
|
||||
print: push si
|
||||
mov si,leftpr-0x10000
|
||||
call printplain
|
||||
pop si
|
||||
|
||||
printplain: pusha
|
||||
mov dx,0x1000
|
||||
mov es,dx
|
||||
cmp byte [es:display_atboot-0x10000],2
|
||||
je printplain_exit
|
||||
mov ds,dx
|
||||
cld
|
||||
lodsb
|
||||
prpl1:
|
||||
mov ah,0xe
|
||||
xor bh,bh
|
||||
int 0x10
|
||||
lodsb
|
||||
cmp al,0
|
||||
jne prpl1
|
||||
printplain_exit:
|
||||
popa
|
||||
ret
|
||||
|
||||
setbase1000: push ax
|
||||
mov ax,0x1000
|
||||
mov es,ax
|
||||
mov ds,ax
|
||||
pop ax
|
||||
ret
|
||||
|
||||
getkey: push ecx
|
||||
push edx
|
||||
add ebx,0x0101
|
||||
xor eax,eax
|
||||
|
||||
gk1:
|
||||
in al,0x60
|
||||
mov cl,al
|
||||
gk0:
|
||||
in al,0x60
|
||||
cmp al,cl
|
||||
je gk0
|
||||
cmp ax,11
|
||||
jg gk0
|
||||
gk0_1:
|
||||
mov cl,al
|
||||
|
||||
; add al,47
|
||||
; mov [ds:keyinbs-0x10000],al
|
||||
; mov si,keyinbs-0x10000
|
||||
; call printplain
|
||||
|
||||
gk12:
|
||||
in al,0x60
|
||||
cmp al,cl
|
||||
je gk12
|
||||
cmp ax,240
|
||||
jne gk13
|
||||
mov al,cl
|
||||
jmp gk14
|
||||
gk13:
|
||||
add cl,128
|
||||
cmp al,cl
|
||||
jne gk1
|
||||
sub al,128
|
||||
gk14:
|
||||
|
||||
movzx edx,bl
|
||||
cmp eax,edx
|
||||
jb gk1
|
||||
movzx edx,bh
|
||||
cmp eax,edx
|
||||
jg gk1
|
||||
test ebx,0x010000
|
||||
jnz gk3
|
||||
mov cx,0x1000
|
||||
mov dx,cx
|
||||
add eax,47
|
||||
mov cx,ax
|
||||
cmp cx,58
|
||||
jb gk_nozero
|
||||
sub cx,10
|
||||
gk_nozero:
|
||||
mov [ds:keyin-0x10000],cl
|
||||
mov si,keyin-0x10000
|
||||
call printplain
|
||||
gk3:
|
||||
sub eax,48
|
||||
pop edx
|
||||
pop ecx
|
||||
ret
|
||||
|
||||
|
||||
;=========================================================================
|
||||
;
|
||||
; 16 BIT CODE
|
||||
;
|
||||
;=========================================================================
|
||||
|
||||
|
||||
start_of_code:
|
||||
|
||||
; RESET 16 BIT SELECTORS/REGISTERS/STACK
|
||||
|
||||
mov ax,0x1000
|
||||
mov es,ax
|
||||
mov ds,ax
|
||||
|
||||
mov ax,0x3000
|
||||
mov ss,ax
|
||||
mov sp,0xec00
|
||||
|
||||
xor ax,ax
|
||||
xor bx,bx
|
||||
xor cx,cx
|
||||
xor dx,dx
|
||||
xor si,si
|
||||
xor di,di
|
||||
xor bp,bp
|
||||
|
||||
|
||||
|
||||
; DRAW FRAMES
|
||||
|
||||
call setbase1000
|
||||
|
||||
cmp byte [es:display_atboot-0x10000],2
|
||||
je no_mode_atboot
|
||||
|
||||
mov ax,0x0003
|
||||
mov bx,0x0000
|
||||
mov dx,0x0000
|
||||
int 0x10
|
||||
|
||||
no_mode_atboot:
|
||||
|
||||
; Load & set russian VGA font (RU.INC)
|
||||
mov bp,RU_FNT1-10000h ; RU_FNT1 - First part
|
||||
mov bx,1000h ; 768 bytes
|
||||
mov cx,30h ; 48 symbols
|
||||
mov dx,80h ; 128 - position of first symbol
|
||||
mov ax,1100h
|
||||
push cs
|
||||
pop es
|
||||
int 10h
|
||||
|
||||
mov bp,RU_FNT2-10000h ; RU_FNT2 -Second part
|
||||
mov bx,1000h ; 512 bytes
|
||||
mov cx,20h ; 32 symbols
|
||||
mov dx,0E0h ; 224 - position of first symbol
|
||||
mov ax,1100h
|
||||
push cs
|
||||
pop es
|
||||
int 10h
|
||||
; End set VGA russian font
|
||||
|
||||
call setbase1000
|
||||
mov ax,0xb800
|
||||
mov es,ax
|
||||
mov di,0
|
||||
mov si,d80x25-0x10000
|
||||
mov cx,80*25
|
||||
mov ah,1*16+15
|
||||
dfl1:
|
||||
cld
|
||||
lodsb
|
||||
stosw
|
||||
loop dfl1
|
||||
|
||||
call setbase1000
|
||||
|
||||
|
||||
; SAY HI TO USER
|
||||
|
||||
mov si,linef2-0x10000
|
||||
call printplain
|
||||
mov si,version-0x10000
|
||||
call print
|
||||
|
||||
|
||||
; TEST FOR 386+
|
||||
|
||||
pushf
|
||||
pop ax
|
||||
mov dx,ax
|
||||
xor ax,0x4000
|
||||
push ax
|
||||
popf
|
||||
pushf
|
||||
pop ax
|
||||
and ax,0x4000
|
||||
and dx,0x4000
|
||||
cmp ax,dx
|
||||
jnz cpugood
|
||||
mov si,not386-0x10000
|
||||
call print
|
||||
jmp $
|
||||
cpugood:
|
||||
|
||||
; RESET 32 BIT SELECTORS/REGISTERS/SELECTORS
|
||||
|
||||
mov ax,0x1000
|
||||
mov es,ax
|
||||
mov ds,ax
|
||||
|
||||
mov ax,0x3000
|
||||
mov ss,ax
|
||||
mov esp,0xec00
|
||||
|
||||
xor eax,eax
|
||||
xor ebx,ebx
|
||||
xor ecx,ecx
|
||||
xor edx,edx
|
||||
xor esi,esi
|
||||
xor edi,edi
|
||||
xor ebp,ebp
|
||||
|
||||
|
||||
|
||||
; FLUSH 8042 KEYBOARD CONTROLLER
|
||||
|
||||
;// mike.dld [
|
||||
; mov al,0xED
|
||||
; out 0x60,al
|
||||
; or cx,-1
|
||||
; @@:
|
||||
; in al,0x64
|
||||
; test al,2
|
||||
; jz @f
|
||||
; loop @b
|
||||
; @@:
|
||||
; mov al,0
|
||||
; out 0x60,al
|
||||
; or cx,-1
|
||||
; @@:
|
||||
; in al,0x64
|
||||
; test al,2
|
||||
; jz @f
|
||||
; loop @b
|
||||
; @@:
|
||||
;// mike.dld ]
|
||||
|
||||
; mov ecx,10000
|
||||
; fl1:
|
||||
; in al,0x64
|
||||
; loop fl1
|
||||
; test al,1
|
||||
; jz fl2
|
||||
; in al,0x60
|
||||
; jmp fl1
|
||||
; fl2:
|
||||
|
||||
;****************************************************************
|
||||
; The function is modified Mario79
|
||||
;*****************************************************************
|
||||
; wait_kbd: ; variant 1
|
||||
; mov cx,2500h ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 10 <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
; test_kbd:
|
||||
; in al,64h ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
; test al,2 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
; loopnz test_kbd
|
||||
|
||||
mov al,0xf6 ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
out 0x60,al
|
||||
mov cx,0
|
||||
wait_loop: ; variant 2
|
||||
; reading state of port of 8042 controller
|
||||
in al,64h
|
||||
and al,00000010b ; ready flag
|
||||
; wait until 8042 controller is ready
|
||||
loopnz wait_loop
|
||||
|
||||
; DISPLAY VESA INFORMATION
|
||||
|
||||
mov ax,0x0
|
||||
mov es,ax
|
||||
mov ax,0x4f00
|
||||
mov di,0xa000
|
||||
int 0x10
|
||||
cmp ax,0x004f
|
||||
je vesaok2
|
||||
mov dx,0x1000
|
||||
mov es,dx
|
||||
mov si,novesa-0x10000
|
||||
call print
|
||||
mov ax,16
|
||||
jmp novesafound
|
||||
vesaok2:
|
||||
mov ax,[es:di+4]
|
||||
mov dx,ax
|
||||
add ax,'0'*256+'0'
|
||||
push word 0x1000
|
||||
pop es
|
||||
mov [es:vervesa+vervesa_off-0x10000], ah
|
||||
mov [es:vervesa+vervesa_off+2-0x10000], al
|
||||
; ivan 24/11/2004 begin
|
||||
;push ax
|
||||
; ivan 24/11/2004 end
|
||||
mov si,vervesa-0x10000
|
||||
call print
|
||||
novesafound:
|
||||
call setbase1000
|
||||
; ivan 24/11/2004 begin
|
||||
;pop bx
|
||||
; ivan 24/11/2004 end
|
||||
|
||||
|
||||
; ASK GRAPHICS MODE
|
||||
|
||||
movzx eax,byte [es:preboot_graph-0x10000]
|
||||
cmp eax,0
|
||||
jne pre_graph
|
||||
mov si,gr_mode-0x10000
|
||||
call printplain
|
||||
gml0:
|
||||
mov ebx,0x0A01
|
||||
call getkey
|
||||
pre_graph:
|
||||
cmp eax,1
|
||||
jl sgml1
|
||||
cmp eax,8
|
||||
jg sgml1
|
||||
mov si,ax
|
||||
sub si,1
|
||||
shl si,4
|
||||
add si,gr_table-0x10000
|
||||
mov bx,[es:si+0]
|
||||
mov cx,[es:si+4]
|
||||
mov dx,[es:si+8]
|
||||
jmp gml10
|
||||
sgml1:
|
||||
cmp al,9
|
||||
jnz gml00
|
||||
mov bx,0x13
|
||||
mov cx,640
|
||||
mov dx,480
|
||||
push word 0x0
|
||||
pop es
|
||||
mov [es:0x9000],byte 32
|
||||
mov dword [es:0x9018],0x800000
|
||||
push word 0x1000
|
||||
pop es
|
||||
jmp gml10
|
||||
gml00:
|
||||
cmp al,0xa
|
||||
jnz gml02
|
||||
mov bx,0x12
|
||||
mov cx,640
|
||||
mov dx,480
|
||||
push word 0x0
|
||||
pop es
|
||||
mov [es:0x9000],byte 32
|
||||
mov dword [es:0x9018],0x800000
|
||||
push word 0x1000
|
||||
pop es
|
||||
jmp gml10
|
||||
gml02:
|
||||
jmp gml0
|
||||
gr_table:
|
||||
dd 0x112+0100000000000000b , 640 , 480 , 0
|
||||
dd 0x115+0100000000000000b , 800 , 600 , 0
|
||||
dd 0x118+0100000000000000b , 1024 , 768 , 0
|
||||
dd 0x11B+0100000000000000b , 1280 , 1024 , 0
|
||||
dd 0x112 , 640 , 480 , 0
|
||||
dd 0x115 , 800 , 600 , 0
|
||||
dd 0x118 , 1024 , 768 , 0
|
||||
dd 0x11B , 1280 ,1024 , 0
|
||||
gml10:
|
||||
push word 0x0000
|
||||
pop es
|
||||
mov [es:0x9008],bx
|
||||
mov [es:0x900A],cx
|
||||
mov [es:0x900C],dx
|
||||
push word 0x1000
|
||||
pop es
|
||||
mov ax,32
|
||||
cmp bx,0x13
|
||||
je nov
|
||||
cmp bx,0x12
|
||||
je nov
|
||||
|
||||
|
||||
; USE DEFAULTS OR PROBE
|
||||
|
||||
; bx - mode : cx - x size : dx - y size
|
||||
|
||||
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
movzx ax,[es:preboot_gprobe-0x10000]
|
||||
test ax,ax
|
||||
jne pre_probe
|
||||
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
test bx,0100000000000000b
|
||||
jz noprobe
|
||||
|
||||
mov si,probetext-0x10000
|
||||
call printplain
|
||||
push bx
|
||||
mov ebx,0x0201
|
||||
call getkey
|
||||
pop bx
|
||||
|
||||
pre_probe:
|
||||
cmp ax,1
|
||||
je noprobe
|
||||
|
||||
push cx dx
|
||||
|
||||
mov bx,0x100
|
||||
|
||||
newprobe:
|
||||
|
||||
inc bx
|
||||
cmp bx,0x17f
|
||||
jne probemore
|
||||
|
||||
mov si,prnotfnd-0x10000
|
||||
call printplain
|
||||
|
||||
jmp $
|
||||
|
||||
probemore:
|
||||
|
||||
mov ax,0x4f01
|
||||
mov cx,bx
|
||||
and cx,0xfff
|
||||
push word 0x0000
|
||||
pop es
|
||||
mov di,0xa000
|
||||
int 0x10
|
||||
|
||||
mov eax,[es:di] ; lfb ?
|
||||
test eax,10000000b
|
||||
jz newprobe
|
||||
|
||||
mov eax,[es:di+0x12] ; x size ?
|
||||
cmp ax,word [esp+2]
|
||||
jne newprobe
|
||||
|
||||
mov eax,[es:di+0x14] ; y size ?
|
||||
cmp ax,dx
|
||||
jne newprobe
|
||||
|
||||
movzx eax,byte [es:di+0x19]
|
||||
cmp eax,32 ;24
|
||||
jb newprobe
|
||||
|
||||
push word 0x0000 ; save probed mode
|
||||
pop es
|
||||
add bx,0100000000000000b
|
||||
mov [es:0x9008],bx
|
||||
push word 0x1000
|
||||
pop es
|
||||
|
||||
push bx
|
||||
|
||||
mov si,prid-0x10000
|
||||
call printplain
|
||||
|
||||
pop bx dx cx
|
||||
|
||||
noprobe:
|
||||
|
||||
|
||||
; FIND VESA 2.0 LFB & BPP
|
||||
|
||||
mov ax,0x4f01
|
||||
mov cx,bx
|
||||
and cx,0xfff
|
||||
push word 0x0000
|
||||
pop es
|
||||
mov di,0xa000
|
||||
int 0x10
|
||||
; LFB
|
||||
mov ecx,[es:di+0x28]
|
||||
mov [es:0x9018],ecx
|
||||
; BPP
|
||||
movzx ax,byte [es:di+0x19]
|
||||
mov [es:0x9000],ax
|
||||
; ---- vbe voodoo
|
||||
BytesPerScanLine equ 0x10
|
||||
push ax
|
||||
mov ax, [es:di+BytesPerScanLine]
|
||||
mov [es:0x9001],ax
|
||||
pop ax
|
||||
; -----
|
||||
nov:
|
||||
cmp ax,24
|
||||
jnz nbpp24
|
||||
mov si,bt24-0x10000
|
||||
jmp bppl
|
||||
nbpp24:
|
||||
cmp ax,32
|
||||
jnz nbpp32
|
||||
mov si,bt32-0x10000
|
||||
jmp bppl
|
||||
nbpp32:
|
||||
mov si,btns-0x10000
|
||||
call print
|
||||
jmp $
|
||||
bppl:
|
||||
call printplain
|
||||
|
||||
|
||||
; FIND VESA 1.2 PM BANK SWITCH ADDRESS
|
||||
|
||||
mov ax,0x4f0A
|
||||
mov bx,0x0
|
||||
int 0x10
|
||||
xor eax,eax
|
||||
xor ebx,ebx
|
||||
mov ax,es
|
||||
shl eax,4
|
||||
mov bx,di
|
||||
add eax,ebx
|
||||
xor ebx,ebx
|
||||
mov bx,[es:di]
|
||||
add eax,ebx
|
||||
push word 0x0
|
||||
pop es
|
||||
mov [es:0x9014],eax
|
||||
push word 0x1000
|
||||
pop es
|
||||
|
||||
|
||||
|
||||
; GRAPHICS ACCELERATION
|
||||
|
||||
mov al, [es:preboot_mtrr-0x10000]
|
||||
test al,al
|
||||
jne pre_mtrr
|
||||
mov si,gr_acc-0x10000
|
||||
call printplain
|
||||
mov ebx,0x0201
|
||||
call getkey
|
||||
pre_mtrr:
|
||||
push word 0x0000
|
||||
pop es
|
||||
mov [es:0x901C],al
|
||||
push word 0x1000
|
||||
pop es
|
||||
mov si,linef-0x10000
|
||||
call printplain
|
||||
|
||||
|
||||
; VRR_M USE
|
||||
|
||||
mov al,[es:preboot_vrrm-0x10000]
|
||||
test al,al
|
||||
jne pre_vrrm
|
||||
mov si,vrrmprint-0x10000
|
||||
call print
|
||||
mov ebx,0x0301
|
||||
call getkey
|
||||
pre_vrrm:
|
||||
push word 0x0000
|
||||
pop es
|
||||
mov [es:0x9030],al
|
||||
push word 0x1000
|
||||
pop es
|
||||
mov si,linef2-0x10000
|
||||
call printplain
|
||||
|
||||
|
||||
; MEMORY MODEL
|
||||
|
||||
; movzx eax,byte [es:preboot_memory-0x10000]
|
||||
; cmp eax,0
|
||||
; jne pre_mem
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; mario79 - memory size ;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; mov ax,0E801h
|
||||
;;; xor bx,bx ; thanks to Alexei for bugfix [18.07.2004]
|
||||
; xor cx, cx
|
||||
; xor dx, dx
|
||||
; int 0x15
|
||||
; movzx ebx, dx ;bx
|
||||
; movzx eax, cx ;ax
|
||||
; shl ebx,6 ; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (x64)
|
||||
; add eax,ebx
|
||||
; add eax, 1000h ;440h
|
||||
; cmp eax,40000h ; 256?
|
||||
; jge mem_256_z
|
||||
; cmp eax,20000h ; 128?
|
||||
; jge mem_128_z
|
||||
; cmp eax,10000h ; 64?
|
||||
; jge mem_64_z
|
||||
; cmp eax,8000h ; 32?
|
||||
; jge mem_32_z
|
||||
; jmp mem_16_z
|
||||
;
|
||||
;mem_256_z: mov si,memokz256-0x10000
|
||||
; call printplain
|
||||
; mov eax,5
|
||||
; jmp pre_mem
|
||||
;mem_128_z: mov si,memokz128-0x10000
|
||||
; call printplain
|
||||
; mov eax,4
|
||||
; jmp pre_mem
|
||||
;mem_64_z: mov si,memokz64-0x10000
|
||||
; call printplain
|
||||
; mov eax,3
|
||||
; jmp pre_mem
|
||||
;mem_32_z: mov si,memokz32-0x10000
|
||||
; call printplain
|
||||
; mov eax,2
|
||||
; jmp pre_mem
|
||||
;mem_16_z: mov si,memokz16-0x10000
|
||||
; call printplain
|
||||
; mov eax,1
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; pre_mem:
|
||||
; push word 0x0000
|
||||
; pop es
|
||||
; mov [es:0x9030],al
|
||||
; push word 0x1000
|
||||
; pop es
|
||||
; mov si,linef-0x10000
|
||||
; call printplain
|
||||
|
||||
|
||||
|
||||
|
||||
; DIRECT WRITE TO LFB, PAGING DISABLED
|
||||
|
||||
; movzx eax,byte [es:preboot_lfb-0x10000]
|
||||
; mov eax,1 ; paging disabled
|
||||
; cmp eax,0
|
||||
; jne pre_lfb
|
||||
; mov si,gr_direct-0x10000
|
||||
; call printplain
|
||||
; mov ebx,0x0201
|
||||
; call getkey
|
||||
; pre_lfb:
|
||||
; push word 0x0000
|
||||
; pop es
|
||||
; mov [es:0x901E],al
|
||||
; mov ax,0x1000
|
||||
; mov es,ax
|
||||
; mov si,linef-0x10000
|
||||
; call printplain
|
||||
push 0
|
||||
pop es
|
||||
mov [es:0x901E],byte 1
|
||||
push 0x1000
|
||||
pop es
|
||||
|
||||
|
||||
|
||||
; BOOT DEVICE
|
||||
|
||||
movzx eax,byte [es:preboot_device-0x10000]
|
||||
cmp eax,0
|
||||
jne pre_device
|
||||
mov si,bdev-0x10000
|
||||
call printplain
|
||||
mov ebx,0x0301
|
||||
call getkey
|
||||
pre_device:
|
||||
dec al
|
||||
mov [es:boot_dev-0x10000],al
|
||||
mov si,linef-0x10000
|
||||
call printplain
|
||||
|
||||
|
||||
|
||||
; READ DISKETTE TO MEMORY
|
||||
|
||||
cmp [boot_dev-0x10000],0
|
||||
jne no_sys_on_floppy
|
||||
mov si,diskload-0x10000
|
||||
call print
|
||||
mov ax,0x0000 ; reset drive
|
||||
mov dx,0x0000
|
||||
int 0x13
|
||||
mov cx,0x0001 ; startcyl,startsector
|
||||
mov dx,0x0000 ; starthead,drive
|
||||
push word 80*2 ; read no of sect
|
||||
reads:
|
||||
pusha
|
||||
xor si,si
|
||||
newread:
|
||||
push word 0x0
|
||||
pop es
|
||||
mov bx,0xa000 ; es:bx -> data area
|
||||
mov ax,0x0200+18 ; read, no of sectors to read
|
||||
int 0x13
|
||||
cmp ah,0
|
||||
jz goodread
|
||||
add si,1
|
||||
cmp si,10
|
||||
jnz newread
|
||||
mov si,badsect-0x10000
|
||||
call printplain
|
||||
jmp $
|
||||
goodread:
|
||||
; move -> 1mb
|
||||
mov si,movedesc-0x10000
|
||||
push word 0x1000
|
||||
pop es
|
||||
mov cx,256*18
|
||||
mov ah,0x87
|
||||
int 0x15
|
||||
|
||||
cmp ah,0 ; was the move successfull ?
|
||||
je goodmove
|
||||
mov dx,0x3f2 ; floppy motor off
|
||||
mov al,0
|
||||
out dx,al
|
||||
mov si,memmovefailed-0x10000
|
||||
call print
|
||||
jmp $
|
||||
goodmove:
|
||||
|
||||
mov eax,[es:movedesc-0x10000+0x18+2]
|
||||
add eax,512*18
|
||||
mov [es:movedesc-0x10000+0x18+2],eax
|
||||
popa
|
||||
inc dh
|
||||
cmp dh,2
|
||||
jnz bb2
|
||||
mov dh,0
|
||||
inc ch
|
||||
pusha ; print prosentage
|
||||
push word 0x1000
|
||||
pop es
|
||||
xor eax,eax ; 5
|
||||
mov al,ch
|
||||
shr eax,2
|
||||
and eax,1
|
||||
mov ebx,5
|
||||
mul bx
|
||||
add al,48
|
||||
mov [es:pros+1-0x10000],al
|
||||
xor eax,eax ; 10
|
||||
mov al,ch
|
||||
shr eax,3
|
||||
add al,48
|
||||
mov [es:pros-0x10000],al
|
||||
mov si,pros-0x10000
|
||||
call printplain
|
||||
popa
|
||||
bb2:
|
||||
pop ax
|
||||
dec ax
|
||||
push ax
|
||||
cmp ax,0
|
||||
jnz rs
|
||||
jmp readdone
|
||||
rs:
|
||||
jmp reads
|
||||
movedesc:
|
||||
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
|
||||
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
|
||||
|
||||
db 0xff,0xff,0x0,0xa0,0x00,0x93,0x0,0x0
|
||||
db 0xff,0xff,0x0,0x00,0x10,0x93,0x0,0x0
|
||||
|
||||
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
|
||||
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
|
||||
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
|
||||
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
|
||||
readdone:
|
||||
pop ax
|
||||
mov dx,0x3f2 ; floppy motor off
|
||||
mov al,0
|
||||
out dx,al
|
||||
mov si,backspace-0x10000
|
||||
call printplain
|
||||
call printplain
|
||||
mov si,okt-0x10000
|
||||
call printplain
|
||||
no_sys_on_floppy:
|
||||
mov ax,0x0000 ; reset drive
|
||||
mov dx,0x0000
|
||||
int 0x13
|
||||
mov dx,0x3f2 ; floppy motor off
|
||||
mov al,0
|
||||
out dx,al
|
||||
|
||||
|
||||
; PAGE TABLE
|
||||
|
||||
push word 0x0000
|
||||
pop es
|
||||
mov ecx,[es:0x9018]
|
||||
push ecx
|
||||
|
||||
map_mem equ 64 ; amount of memory to map
|
||||
|
||||
mov bx,0x6000
|
||||
mov es,bx ; [es:di] = 6000:0
|
||||
xor edi,edi
|
||||
mov ecx,256*map_mem ; Map (mapmem) M
|
||||
mov eax,7
|
||||
cld
|
||||
pt2:
|
||||
cmp ecx,256*(map_mem-8) ; 8 M map to LFB
|
||||
jnz pt3
|
||||
pop eax
|
||||
add eax,7
|
||||
pt3:
|
||||
cmp ecx,256*(map_mem-12) ; 12 M back to linear = physical
|
||||
jnz pt4
|
||||
mov eax,12*0x100000 + 7
|
||||
pt4:
|
||||
stosd
|
||||
add eax,4096
|
||||
loop pt2
|
||||
|
||||
mov bx,0x7100
|
||||
mov es,bx
|
||||
xor edi,edi
|
||||
mov eax,8*0x100000+7
|
||||
mov ecx,256*4
|
||||
pt5:
|
||||
stosd
|
||||
add eax,0x1000
|
||||
loop pt5
|
||||
|
||||
; 4 KB PAGE DIRECTORY
|
||||
|
||||
mov bx , 0x7F00
|
||||
mov es , bx ; [es:di] = 7000:0
|
||||
xor edi, edi
|
||||
mov ecx, 64 / 4
|
||||
mov eax, 0x60007 ; for 0 M
|
||||
cld
|
||||
pd4k:
|
||||
stosd
|
||||
add eax, 0x1000
|
||||
loop pd4k
|
||||
mov dword [es:0x800],0x71007 ;map region 0x80000000-0x803FFFFF to 0x800000-0xCFFFFF
|
||||
xor esi,esi
|
||||
mov edi,second_base_address shr 20
|
||||
mov ecx,64/4
|
||||
mov bx,0x7F00
|
||||
mov ds,bx
|
||||
rep movsd
|
||||
mov bx,0x1000
|
||||
mov ds,bx
|
||||
|
||||
mov eax, 0x7F000 +8+16 ; Page directory and enable caches
|
||||
mov cr3, eax
|
||||
|
||||
; SET GRAPHICS
|
||||
|
||||
mov dx,0x0000
|
||||
mov es,dx
|
||||
mov bx,[es:0x9008]
|
||||
mov ax,bx ; vga & 320x200
|
||||
cmp ax,0x13
|
||||
je setgr
|
||||
cmp ax,0x12
|
||||
je setgr
|
||||
mov ax,0x4f02 ; Vesa
|
||||
setgr:
|
||||
int 0x10
|
||||
cmp ah,0
|
||||
jz gmok
|
||||
mov si,fatalsel-0x10000
|
||||
call print
|
||||
jmp $
|
||||
|
||||
gmok:
|
||||
mov dx,0x1000
|
||||
mov es,dx
|
||||
|
||||
; set mode 0x12 graphics registers:
|
||||
|
||||
cmp bx,0x12
|
||||
jne gmok2
|
||||
|
||||
mov al,0x05
|
||||
mov dx,0x03ce
|
||||
out dx,al ; select GDC mode register
|
||||
mov al,0x02
|
||||
mov dx,0x03cf
|
||||
out dx,al ; set write mode 2
|
||||
|
||||
mov al,0x02
|
||||
mov dx,0x03c4
|
||||
out dx,al ; select VGA sequencer map mask register
|
||||
mov al,0x0f
|
||||
mov dx,0x03c5
|
||||
out dx,al ; set mask for all planes 0-3
|
||||
|
||||
mov al,0x08
|
||||
mov dx,0x03ce
|
||||
out dx,al ; select GDC bit mask register
|
||||
; for writes to 0x03cf
|
||||
|
||||
gmok2:
|
||||
mov dx,0x1000
|
||||
mov es,dx
|
111
kernel/tags/kolibri0.5.2.1/boot/booteng.inc
Normal file
@@ -0,0 +1,111 @@
|
||||
;======================================================================
|
||||
;
|
||||
; BOOT DATA
|
||||
;
|
||||
;======================================================================
|
||||
|
||||
macro line_full_top {
|
||||
db 201
|
||||
times 78 db 205
|
||||
db 187
|
||||
}
|
||||
macro line_full_bottom {
|
||||
db 200
|
||||
times 78 db 205
|
||||
db 188
|
||||
}
|
||||
macro line_half {
|
||||
db 186,' '
|
||||
times 76 db 0xc4
|
||||
db ' ',186
|
||||
}
|
||||
macro line_space {
|
||||
db 186
|
||||
times 78 db 32
|
||||
db 186
|
||||
}
|
||||
d80x25: line_full_top
|
||||
line_space
|
||||
line_space
|
||||
line_half
|
||||
line_space
|
||||
line_space
|
||||
line_space
|
||||
line_space
|
||||
line_space
|
||||
line_space
|
||||
line_space
|
||||
line_space
|
||||
line_space
|
||||
line_space
|
||||
line_space
|
||||
line_space
|
||||
line_space
|
||||
line_space
|
||||
line_space
|
||||
line_space
|
||||
line_space
|
||||
line_space
|
||||
; line_space
|
||||
db 186,' KolibriOS based on MenuetOS and comes with ABSOLUTELY '
|
||||
db 'NO WARRANTY ',186
|
||||
db 186,' See file COPYING for details '
|
||||
db ' ',186
|
||||
line_full_bottom
|
||||
|
||||
novesa db "Display: EGA/CGA",13,10,0
|
||||
vervesa db "Version of Vesa: Vesa x.x ",13,10,0
|
||||
vervesa_off=22
|
||||
gr_mode db 186," Vesa 2.0+ 16 M LFB: [1] 640x480, [2] 800x600, "
|
||||
db "[3] 1024x768, [4] 1280x1024",13,10
|
||||
db 186," Vesa 1.2 16 M Bnk: [5] 640x480, [6] 800x600, "
|
||||
db "[7] 1024x768, [8] 1280x1024",13,10
|
||||
db 186," EGA/CGA 256 Colors: [9] 320x200, "
|
||||
db "VGA 16 Colors: [0] 640x480",13,10
|
||||
db 186," Select mode: ",0
|
||||
bt24 db 13,10,186," Bits Per Pixel: 24",13,10,0
|
||||
bt32 db 13,10,186," Bits Per Pixel: 32",13,10,0
|
||||
vrrmprint db 13,10,186," Apply VRR? (picture frequency greater than 60Hz"
|
||||
db " only for transfers:",13,10
|
||||
db 186," 1024*768->800*600 and 800*600->640*480) [1-yes,2-no]:",0
|
||||
askmouse db " Mouse at:"
|
||||
db " [1] PS/2 (USB), [2] Com1, [3] Com2."
|
||||
db " Select port [1-3]: ",0
|
||||
no_com1 db 13,10,186, " No COM1 mouse",0
|
||||
no_com2 db 13,10,186, " No COM2 mouse",0
|
||||
gr_acc db 13,10,186," Vesa 2.0+ : MTRR graphics acceleration "
|
||||
db "[1-yes/2-no] ? ",0
|
||||
gr_direct db 186," Use direct LFB writing? "
|
||||
db "[1-yes/2-no] ? ",0
|
||||
;mem_model db 13,10,186," Motherboard memory [1-16 Mb / 2-32 Mb / "
|
||||
; db "3-64Mb / 4-128 Mb / 5-256 Mb] ? ",0
|
||||
bootlog db 13,10,186," After bootlog display [1-continue/2-pause] ? ",0
|
||||
bdev db 186
|
||||
db " Load ramdisk from [1-floppy; 2-C:\menuet.img (FAT32);"
|
||||
db 13,10,186," "
|
||||
db "3-use preloaded ram-image from kernel restart]: ",0
|
||||
probetext db 13,10,13,10,186," Use standart graphics mode? [1-yes, "
|
||||
db "2-probe bios (Vesa 3.0)]: ",0
|
||||
;memokz256 db 13,10,186," RAM 256 Mb",0
|
||||
;memokz128 db 13,10,186," RAM 128 Mb",0
|
||||
;memokz64 db 13,10,186," RAM 64 Mb",0
|
||||
;memokz32 db 13,10,186," RAM 32 Mb",0
|
||||
;memokz16 db 13,10,186," RAM 16 Mb",0
|
||||
prid db " pr.",0
|
||||
prnotfnd db " pr. - not found.",0
|
||||
modena db "Fatal - VBE 0x112+ required.",0
|
||||
not386 db "Fatal - CPU 386+ required.",0
|
||||
btns db 13,10,186,"Fatal - Can't determine color depth.",0
|
||||
fatalsel db 13,10,"Fatal - Graphics mode not supported by hardware.",0
|
||||
badsect db 13,10,186," Fatal - Bad sector. Replace floppy. ",0
|
||||
memmovefailed db "Fatal - Int 0x15 move failed.",0
|
||||
linef2 db 13,10
|
||||
linef db 13,10,0
|
||||
okt db " ... OK",0
|
||||
keyin db "x",0
|
||||
keyinbs db "x",8,0
|
||||
diskload db 13,10,186," Loading diskette: 00 %",8,8,8,8,0
|
||||
backspace db 8,0
|
||||
pros db "00",8,8,0
|
||||
leftpr db 186," ",0
|
||||
boot_dev db 0 ; 0=floppy, 1=hd
|
112
kernel/tags/kolibri0.5.2.1/boot/bootru.inc
Normal file
@@ -0,0 +1,112 @@
|
||||
;======================================================================
|
||||
;
|
||||
; BOOT DATA
|
||||
;
|
||||
;======================================================================
|
||||
|
||||
macro line_full_top {
|
||||
db 201
|
||||
times 78 db 205
|
||||
db 187
|
||||
}
|
||||
macro line_full_bottom {
|
||||
db 200
|
||||
times 78 db 205
|
||||
db 188
|
||||
}
|
||||
macro line_half {
|
||||
db 186,' '
|
||||
times 76 db 0xc4
|
||||
db ' ',186
|
||||
}
|
||||
macro line_space {
|
||||
db 186
|
||||
times 78 db 32
|
||||
db 186
|
||||
}
|
||||
d80x25: line_full_top
|
||||
line_space
|
||||
line_space
|
||||
line_half
|
||||
line_space
|
||||
line_space
|
||||
line_space
|
||||
line_space
|
||||
line_space
|
||||
line_space
|
||||
line_space
|
||||
line_space
|
||||
line_space
|
||||
line_space
|
||||
line_space
|
||||
line_space
|
||||
line_space
|
||||
line_space
|
||||
line_space
|
||||
line_space
|
||||
line_space
|
||||
line_space
|
||||
; line_space
|
||||
db 186,' Kolibri OS <20>᭮<EFBFBD><E1ADAE><EFBFBD><EFBFBD> <20><> Menuet OS <20> <20><> <20>।<EFBFBD><E0A5A4>⠢<EFBFBD><E2A0A2><EFBFBD><EFBFBD> '
|
||||
db '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>a<EFBFBD>⨩. ',186
|
||||
db 186,' <20><><EFBFBD><EFBFBD><E0AEA1><EFBFBD> ᬮ<><E1ACAE><EFBFBD><EFBFBD><EFBFBD> 䠩<> GNU.TXT '
|
||||
db ' ',186
|
||||
line_full_bottom
|
||||
|
||||
novesa db "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: EGA/CGA",13,10,0
|
||||
vervesa db "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> VESA: Vesa x.x ",13,10,0
|
||||
vervesa_off=19
|
||||
gr_mode db 186," Vesa 2.0+ 16 M LFB: [1] 640x480, [2] 800x600, "
|
||||
db "[3] 1024x768, [4] 1280x1024",13,10
|
||||
db 186," Vesa 1.2 16 M Bnk: [5] 640x480, [6] 800x600, "
|
||||
db "[7] 1024x768, [8] 1280x1024",13,10
|
||||
db 186," EGA/CGA 256 <20><><EFBFBD>⮢: [9] 320x200, "
|
||||
db "VGA 16 <20><><EFBFBD>⮢: [0] 640x480",13,10
|
||||
db 186," <20>롥<EFBFBD><EBA1A5><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>०<EFBFBD><E0A5A6>: ",0
|
||||
bt24 db 13,10,186," <20><>㡨<EFBFBD><E3A1A8> 梥<><E6A2A5>: 24",13,10,0
|
||||
bt32 db 13,10,186," <20><>㡨<EFBFBD><E3A1A8> 梥<><E6A2A5>: 32",13,10,0
|
||||
vrrmprint db 13,10,186," <20>ᯮ<EFBFBD>짮<EFBFBD><ECA7AE><EFBFBD><EFBFBD> VRR? (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD> 60 <20><>"
|
||||
db " ⮫쪮 <20><><EFBFBD> <20><><EFBFBD><EFBFBD>室<EFBFBD><E5AEA4>:",13,10
|
||||
db 186," 1024*768>800*600 <20> 800*600>640*480) [1-<2D><>, 2-<2D><><EFBFBD>]: ",0
|
||||
askmouse db "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:" ; 186, " "
|
||||
db " [1] PS/2 (USB), [2] Com1, [3] Com2."
|
||||
db " <20>롥<EFBFBD><EBA1A5><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> [1-3]: ",0
|
||||
no_com1 db 13,10,186," No COM1 mouse",0
|
||||
no_com2 db 13,10,186," No COM2 mouse",0
|
||||
gr_acc db 13,10,186," Vesa 2.0+: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> MTRR <20><><EFBFBD> <20>७<E1AAAE><E0A5AD> <20><><EFBFBD>䨪<EFBFBD>? "
|
||||
db "[1-<2D><>/2-<2D><><EFBFBD>]: ",0
|
||||
gr_direct db 186," <20>ᯮ<EFBFBD>짮<EFBFBD><ECA7AE><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>? "
|
||||
db "[1-<2D><>/2-<2D><><EFBFBD>]: ",0
|
||||
;mem_model db 13,10,186," <20><><EFBFBD>+<2B> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> [1-16 Mb / 2-32 Mb / "
|
||||
; db "3-64Mb / 4-128 Mb / 5-256 Mb]: ",0
|
||||
bootlog db 13,10,186," <20><><EFBFBD>ᬮ<EFBFBD><E1ACAE><EFBFBD><EFBFBD><EFBFBD> <20><>ୠ<EFBFBD> <20><><EFBFBD><EFBFBD>㧪<EFBFBD>? [1-<2D><><EFBFBD>/2-<2D><>]: ",0
|
||||
bdev db 186
|
||||
db " <20><><EFBFBD><EFBFBD>㧨<EFBFBD><E3A7A8> <20><>ࠧ <20><> [1-<2D><>᪥<EFBFBD><E1AAA5>; 2-C:\menuet.img (FAT32);"
|
||||
db 13,10,186," "
|
||||
db "3-<2D>ᯮ<EFBFBD>짮<EFBFBD><ECA7AE><EFBFBD><EFBFBD> 㦥 <20><><EFBFBD><EFBFBD>㦥<EFBFBD><E3A6A5><EFBFBD><EFBFBD> <20><>ࠧ]: ",0
|
||||
probetext db 13,10,13,10,186," <20>⠭<EFBFBD><E2A0AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>०<EFBFBD><E0A5A6>? [1-<2D><>, "
|
||||
db "2-<2D><EFBFBD><E0AEA2><EFBFBD><EFBFBD><EFBFBD> <20><>㣨<EFBFBD> (Vesa 3.0)]: ",0
|
||||
;memokz256 db 13,10,186," RAM 256 Mb",0
|
||||
;memokz128 db 13,10,186," RAM 128 Mb",0
|
||||
;memokz64 db 13,10,186," RAM 64 Mb",0
|
||||
;memokz32 db 13,10,186," RAM 32 Mb",0
|
||||
;memokz16 db 13,10,186," RAM 16 Mb",0
|
||||
prid db " pr.",0
|
||||
prnotfnd db " pr. - <20>訡<EFBFBD><E8A8A1>.",0
|
||||
modena db "<EFBFBD>訡<EFBFBD><EFBFBD> - <20>ॡ<EFBFBD><E0A5A1><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>প<EFBFBD> VBE 0x112+.",0
|
||||
not386 db "<EFBFBD>訡<EFBFBD><EFBFBD> - <20>ॡ<EFBFBD><E0A5A1><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 386+.",0
|
||||
btns db 13,10,186," <20>訡<EFBFBD><E8A8A1> - <20><> <20><><EFBFBD><EFBFBD> <20><>।<EFBFBD><E0A5A4><EFBFBD><EFBFBD><EFBFBD> <20><>㡨<EFBFBD><E3A1A8> 梥<><E6A2A5>.",0
|
||||
fatalsel db 13,10,"<EFBFBD>訡<EFBFBD><EFBFBD> - <20><><EFBFBD>࠭<EFBFBD><E0A0AD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>०<EFBFBD><E0A5A6> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ন<EFBFBD><E0A6A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.",0
|
||||
badsect db 13,10,186," <20>訡<EFBFBD><E8A8A1> - <20><>᪥<EFBFBD><E1AAA5> <20><><EFBFBD>०<EFBFBD><E0A5A6><EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD><E0AEA1><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. "
|
||||
db 0
|
||||
memmovefailed db "Fatal - Int 0x15 move failed.",0
|
||||
linef2 db 13,10
|
||||
linef db 13,10,0
|
||||
okt db " ... OK",0
|
||||
keyin db "x",0
|
||||
keyinbs db "x",8,0
|
||||
diskload db 13,10,186," <20><><EFBFBD><EFBFBD>㧪<EFBFBD> <20><>᪥<EFBFBD><E1AAA5>: 00 %",8,8,8,8,0
|
||||
backspace db 8,0
|
||||
pros db "00",8,8,0
|
||||
leftpr db 186," ",0
|
||||
boot_dev db 0
|
23
kernel/tags/kolibri0.5.2.1/boot/preboot.inc
Normal file
@@ -0,0 +1,23 @@
|
||||
display_modechg db 0 ; display mode change for text, yes/no (0 or 2)
|
||||
;
|
||||
; !! Important note !!
|
||||
;
|
||||
; Must be set to 2, to avoid two screenmode
|
||||
; changes within a very short period of time.
|
||||
|
||||
display_atboot db 0 ; show boot screen messages ( 2-no )
|
||||
|
||||
preboot_graph db 0 ; graph mode
|
||||
preboot_gprobe db 0 ; probe vesa3 videomodes (1-no, 2-yes)
|
||||
preboot_vrrm db 0 ; use VRR_M (1-yes, 2- no)
|
||||
;;preboot_mouse db 0 ; mouse port (1-PS2, 2-COM1, 3-COM2)
|
||||
preboot_mtrr db 0 ; mtrr acceleration (1-yes, 2-no)
|
||||
preboot_device db 0 ; boot device
|
||||
; (1-floppy 2-harddisk 3-kernel restart)
|
||||
;;preboot_memory db 0 ; amount of memory
|
||||
; (1-16Mb;2-32Mb;3-64Mb;4-128Mb;5-256Mb)
|
||||
; !!!! 0 - autodetect !!!!
|
||||
preboot_blogesc db 1 ; start immediately after bootlog
|
||||
|
||||
hdsysimage db 'MENUET IMG' ; load from
|
||||
image_save db 'MENUET IMG' ; save to
|
95
kernel/tags/kolibri0.5.2.1/boot/rdload.inc
Normal file
@@ -0,0 +1,95 @@
|
||||
; READ RAMDISK IMAGE FROM HD
|
||||
|
||||
cmp [boot_dev],1
|
||||
jne no_sys_on_hd
|
||||
|
||||
test [0x40001],byte 0x40
|
||||
jz position_2
|
||||
mov [hdbase],0x1f0
|
||||
mov [hdid],0x0
|
||||
mov [hdpos],1
|
||||
mov [fat32part],0
|
||||
position_1_1:
|
||||
inc [fat32part]
|
||||
call search_and_read_image
|
||||
cmp [image_retrieved],1
|
||||
je yes_sys_on_hd
|
||||
movzx eax,byte [0x40002]
|
||||
cmp [fat32part],eax
|
||||
jle position_1_1
|
||||
position_2:
|
||||
test [0x40001],byte 0x10
|
||||
jz position_3
|
||||
mov [hdbase],0x1f0
|
||||
mov [hdid],0x10
|
||||
mov [hdpos],2
|
||||
mov [fat32part],0
|
||||
position_2_1:
|
||||
inc [fat32part]
|
||||
call search_and_read_image
|
||||
cmp [image_retrieved],1
|
||||
je yes_sys_on_hd
|
||||
movzx eax,byte [0x40003]
|
||||
cmp eax,[fat32part]
|
||||
jle position_2_1
|
||||
position_3:
|
||||
test [0x40001],byte 0x4
|
||||
jz position_4
|
||||
mov [hdbase],0x170
|
||||
mov [hdid],0x0
|
||||
mov [hdpos],3
|
||||
mov [fat32part],0
|
||||
position_3_1:
|
||||
inc [fat32part]
|
||||
call search_and_read_image
|
||||
cmp [image_retrieved],1
|
||||
je yes_sys_on_hd
|
||||
movzx eax,byte [0x40004]
|
||||
cmp eax,[fat32part]
|
||||
jle position_3_1
|
||||
position_4:
|
||||
test [0x40001],byte 0x1
|
||||
jz no_sys_on_hd
|
||||
mov [hdbase],0x170
|
||||
mov [hdid],0x10
|
||||
mov [hdpos],4
|
||||
mov [fat32part],0
|
||||
position_4_1:
|
||||
inc [fat32part]
|
||||
call search_and_read_image
|
||||
cmp [image_retrieved],1
|
||||
je yes_sys_on_hd
|
||||
movzx eax,byte [0x40005]
|
||||
cmp eax,[fat32part]
|
||||
jle position_4_1
|
||||
jmp yes_sys_on_hd
|
||||
|
||||
search_and_read_image:
|
||||
; mov [0xfe10],dword 0 ; entries in hd cache
|
||||
call set_FAT32_variables
|
||||
mov edx, bootpath
|
||||
call read_image
|
||||
test eax, eax
|
||||
jz image_present
|
||||
mov edx, bootpath2
|
||||
call read_image
|
||||
test eax, eax
|
||||
jz image_present
|
||||
ret
|
||||
image_present:
|
||||
mov [image_retrieved],1
|
||||
ret
|
||||
|
||||
read_image:
|
||||
mov eax, hdsysimage
|
||||
mov ebx, 1474560/512
|
||||
mov ecx, 0x100000
|
||||
mov esi, 0
|
||||
mov edi, 12
|
||||
call file_read
|
||||
ret
|
||||
|
||||
image_retrieved db 0
|
||||
counter_of_partitions db 0
|
||||
no_sys_on_hd:
|
||||
yes_sys_on_hd:
|
92
kernel/tags/kolibri0.5.2.1/boot/ru.inc
Normal file
@@ -0,0 +1,92 @@
|
||||
; Generated by RUFNT.EXE
|
||||
; By BadBugsKiller (C)
|
||||
; Modifyed by BadBugsKiller 12.01.2004 17:45
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> 2-<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ASCII (<EFBFBD><EFBFBD><EFBFBD>'<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>), <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 866.
|
||||
RU_FNT1:
|
||||
db 0x00, 0x00, 0x1E, 0x36, 0x66, 0xC6, 0xC6, 0xFE, 0xC6, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0xFE, 0x62, 0x60, 0x60, 0x7C, 0x66, 0x66, 0x66, 0x66, 0xFC, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0xFC, 0x66, 0x66, 0x66, 0x7C, 0x66, 0x66, 0x66, 0x66, 0xFC, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0xFE, 0x66, 0x62, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0xF0, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x1E, 0x36, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0xFF, 0xC3, 0x81, 0x00, 0x00
|
||||
db 0x00, 0x00, 0xFE, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x62, 0x66, 0xFE, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0xDB, 0xDB, 0x5A, 0x5A, 0x7E, 0x7E, 0x5A, 0xDB, 0xDB, 0xDB, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x7C, 0xC6, 0x06, 0x06, 0x3C, 0x06, 0x06, 0x06, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0xC6, 0xC6, 0xC6, 0xCE, 0xDE, 0xF6, 0xE6, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x6C, 0x38, 0xC6, 0xC6, 0xC6, 0xCE, 0xDE, 0xF6, 0xE6, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0xE6, 0x66, 0x6C, 0x6C, 0x78, 0x78, 0x6C, 0x6C, 0x66, 0xE6, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x1F, 0x36, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0xCF, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0xC6, 0xEE, 0xFE, 0xFE, 0xD6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0xFE, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0xFE, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00
|
||||
|
||||
db 0x00, 0x00, 0xFC, 0x66, 0x66, 0x66, 0x66, 0x7C, 0x60, 0x60, 0x60, 0xF0, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xC0, 0xC0, 0xC0, 0xC0, 0xC2, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0xFF, 0xDB, 0x99, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7E, 0x06, 0x06, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x7E, 0xDB, 0xDB, 0xDB, 0xDB, 0xDB, 0xDB, 0x7E, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0xC6, 0xC6, 0x6C, 0x7C, 0x38, 0x38, 0x7C, 0x6C, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xFF, 0x03, 0x03, 0x00, 0x00
|
||||
db 0x00, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7E, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0xD6, 0xD6, 0xD6, 0xD6, 0xD6, 0xD6, 0xD6, 0xD6, 0xD6, 0xFE, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0xD6, 0xD6, 0xD6, 0xD6, 0xD6, 0xD6, 0xD6, 0xD6, 0xD6, 0xFF, 0x03, 0x03, 0x00, 0x00
|
||||
db 0x00, 0x00, 0xF8, 0xF0, 0xB0, 0x30, 0x3E, 0x33, 0x33, 0x33, 0x33, 0x7E, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0xC3, 0xC3, 0xC3, 0xC3, 0xF3, 0xDB, 0xDB, 0xDB, 0xDB, 0xF3, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0xF0, 0x60, 0x60, 0x60, 0x7C, 0x66, 0x66, 0x66, 0x66, 0xFC, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x7C, 0xC6, 0x06, 0x26, 0x3E, 0x26, 0x06, 0x06, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0xCE, 0xDB, 0xDB, 0xDB, 0xFB, 0xDB, 0xDB, 0xDB, 0xDB, 0xCE, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x3F, 0x66, 0x66, 0x66, 0x3E, 0x3E, 0x66, 0x66, 0x66, 0xE7, 0x00, 0x00, 0x00, 0x00
|
||||
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x0C, 0x7C, 0xCC, 0xCC, 0xCC, 0x76, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x02, 0x06, 0x7C, 0xC0, 0xC0, 0xFC, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x66, 0x66, 0x7C, 0x66, 0x66, 0xFC, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0x62, 0x62, 0x60, 0x60, 0x60, 0xF0, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x36, 0x66, 0x66, 0x66, 0x66, 0xFF, 0xC3, 0xC3, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xFE, 0xC0, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0xD6, 0xD6, 0x54, 0x7C, 0x54, 0xD6, 0xD6, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xC6, 0x06, 0x3C, 0x06, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0xC6, 0xC6, 0xCE, 0xD6, 0xE6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x6C, 0x38, 0xC6, 0xC6, 0xCE, 0xD6, 0xE6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0xE6, 0x6C, 0x78, 0x78, 0x6C, 0x66, 0xE6, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x36, 0x66, 0x66, 0x66, 0x66, 0xE6, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0xC6, 0xEE, 0xFE, 0xFE, 0xD6, 0xD6, 0xC6, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0xC6, 0xC6, 0xC6, 0xFE, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x00, 0x00, 0x00, 0x00
|
||||
|
||||
RU_FNT2:
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0xDC, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7C, 0x60, 0x60, 0xF0, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xC6, 0xC0, 0xC0, 0xC0, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x5A, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7E, 0x06, 0x06, 0xC6, 0x7C, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x3C, 0x18, 0x7E, 0xDB, 0xDB, 0xDB, 0xDB, 0xDB, 0x7E, 0x18, 0x18, 0x3C, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0xC6, 0x6C, 0x38, 0x38, 0x38, 0x6C, 0xC6, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0xFF, 0x03, 0x03, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0x7E, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0xD6, 0xD6, 0xD6, 0xD6, 0xD6, 0xD6, 0xFE, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0xD6, 0xD6, 0xD6, 0xD6, 0xD6, 0xD6, 0xFE, 0x03, 0x03, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0xB0, 0xB0, 0x3E, 0x33, 0x33, 0x7E, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0xC6, 0xC6, 0xC6, 0xF6, 0xDE, 0xDE, 0xF6, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x60, 0x60, 0x7C, 0x66, 0x66, 0xFC, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xC6, 0x06, 0x3E, 0x06, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0xCE, 0xDB, 0xDB, 0xFB, 0xDB, 0xDB, 0xCE, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0xC6, 0xC6, 0x7E, 0x36, 0x66, 0xE7, 0x00, 0x00, 0x00, 0x00
|
||||
|
||||
db 0x6C, 0x00, 0xFE, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x62, 0x66, 0xFE, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x6C, 0x00, 0x7C, 0xC6, 0xC6, 0xFC, 0xC0, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x7C, 0xC6, 0xC0, 0xC8, 0xF8, 0xC8, 0xC0, 0xC0, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0xC6, 0xC0, 0xF8, 0xC0, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x66, 0x00, 0x3C, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x6C, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x6C, 0x38, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7E, 0x06, 0x06, 0xC6, 0x7C, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x6C, 0x38, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7E, 0x06, 0x06, 0xC6, 0x7C, 0x00
|
||||
db 0x00, 0x38, 0x6C, 0x6C, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x0E, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0xEC, 0x6C, 0x3C, 0x1C, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0xCF, 0xCD, 0xEF, 0xEC, 0xFF, 0xDC, 0xDC, 0xCC, 0xCC, 0xCC, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0xC6, 0x7C, 0xC6, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0xC6, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
523
kernel/tags/kolibri0.5.2.1/boot/shutdown.inc
Normal file
@@ -0,0 +1,523 @@
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; Shutdown for Menuet
|
||||
;;
|
||||
;; Distributed under General Public License
|
||||
;; See file COPYING for details.
|
||||
;; Copyright 2003 Ville Turjanmaa
|
||||
;;
|
||||
|
||||
|
||||
system_shutdown: ; shut down the system
|
||||
|
||||
mov eax,3 ; stop playing cd
|
||||
call sys_cd_audio
|
||||
cli
|
||||
cld
|
||||
|
||||
mov al,[0x2f0000+0x9030]
|
||||
cmp al,1
|
||||
jl no_shutdown_parameter
|
||||
cmp al,4
|
||||
jg no_shutdown_parameter
|
||||
jmp yes_shutdown_param
|
||||
no_shutdown_parameter:
|
||||
|
||||
movzx ecx,word [0x2f0000+0x900A]
|
||||
movzx esi,word [0x2f0000+0x900C]
|
||||
imul ecx,esi ;[0xfe04]
|
||||
; mov ecx,0x500000/4 ;3fff00/4 ; darken screen
|
||||
push ecx
|
||||
mov esi,[0xfe80]
|
||||
cmp esi,32*0x100000
|
||||
jbe no_darken_screen
|
||||
mov edi,16*0x100000
|
||||
sdnewpix:
|
||||
mov eax,[esi]
|
||||
add esi,4
|
||||
shr eax,1
|
||||
and eax,0x7f7f7f7f
|
||||
stosd
|
||||
loop sdnewpix
|
||||
pop ecx
|
||||
mov esi,16*0x100000
|
||||
mov edi,[0xfe80]
|
||||
cld
|
||||
rep movsd
|
||||
no_darken_screen:
|
||||
|
||||
mov eax,[0xfe00]
|
||||
shr eax,1
|
||||
sub eax,220
|
||||
|
||||
mov ebx,[0xfe04]
|
||||
shr ebx,1
|
||||
mov [shutdownpos],ebx
|
||||
sub ebx,120
|
||||
|
||||
mov edi,1
|
||||
mov ecx,0x0000ff
|
||||
|
||||
sdnewpix2:
|
||||
|
||||
call [putpixel]
|
||||
|
||||
inc eax
|
||||
mov esi,[0xfe00]
|
||||
shr esi,1
|
||||
add esi,220
|
||||
cmp eax,esi
|
||||
jnz sdnewpix2
|
||||
|
||||
dec ecx
|
||||
|
||||
mov eax,[0xfe00]
|
||||
shr eax,1
|
||||
sub eax,220
|
||||
|
||||
inc ebx
|
||||
|
||||
mov edx,[shutdownpos]
|
||||
add edx,105
|
||||
cmp ebx,edx
|
||||
jnz sdnewpix2
|
||||
|
||||
|
||||
mov esi,[0xfe00] ; menuet version
|
||||
shr esi,1
|
||||
sub esi,220
|
||||
add esi,27
|
||||
shl esi,16
|
||||
mov eax,esi
|
||||
add eax,[shutdownpos]
|
||||
sub eax,105
|
||||
mov ebx,0xffff00
|
||||
mov ecx,version
|
||||
mov edx,34
|
||||
mov edi,1
|
||||
call dtext
|
||||
|
||||
mov esi,[0xfe00] ; 'it is safe..'
|
||||
shr esi,1
|
||||
sub esi,220
|
||||
add esi,27
|
||||
shl esi,16
|
||||
mov eax,esi
|
||||
add eax,[shutdownpos]
|
||||
add eax,33
|
||||
mov esi,6
|
||||
mov ebx,0xffffff
|
||||
mov ecx,shutdowntext
|
||||
mov edx,40
|
||||
mov edi,1
|
||||
newsdt:
|
||||
call dtext
|
||||
add eax,10
|
||||
add ecx,40
|
||||
dec esi
|
||||
jnz newsdt
|
||||
|
||||
mov eax,rosef ; load rose.txt
|
||||
mov ebx,0
|
||||
mov ecx,16800
|
||||
mov edx,0x90000
|
||||
mov esi,12
|
||||
call fileread
|
||||
|
||||
mov esi,[0xfe00] ; draw rose
|
||||
shr esi,1
|
||||
add esi,20
|
||||
shl esi,16
|
||||
mov eax,esi
|
||||
add eax,[shutdownpos]
|
||||
sub eax,110
|
||||
|
||||
mov ebx,0x00ff00
|
||||
mov ecx,0x90001
|
||||
mov edx,27
|
||||
mov edi,1
|
||||
|
||||
nrl:
|
||||
call dtext
|
||||
sub ebx,0x050000
|
||||
add eax,8
|
||||
add ecx,31
|
||||
cmp ecx,dword 0x90001+25*31
|
||||
jnz nrl
|
||||
|
||||
call checkEgaCga
|
||||
|
||||
yes_shutdown_param:
|
||||
|
||||
cli
|
||||
|
||||
mov eax,kernel ; load kernel.mnt to 0x8000:0
|
||||
mov esi,12
|
||||
mov ebx,0
|
||||
mov ecx,-1
|
||||
mov edx,0x80000
|
||||
call fileread
|
||||
|
||||
mov esi,restart_kernel_4000 ; move kernel re-starter to 0x4000:0
|
||||
mov edi,0x40000
|
||||
mov ecx,1000
|
||||
cld
|
||||
rep movsb
|
||||
|
||||
mov eax,0x2F0000 ; restore 0x0 - 0xffff
|
||||
mov ebx,0x0000
|
||||
mov ecx,0xffff
|
||||
call memmove
|
||||
|
||||
call restorefatchain
|
||||
|
||||
mov eax,pr_mode_exit
|
||||
mov [0x467+0],ax
|
||||
mov [0x467+2],word 0x1000
|
||||
|
||||
mov al,0x0F
|
||||
out 0x70,al
|
||||
mov al,0x05
|
||||
out 0x71,al
|
||||
|
||||
mov al,0xFE
|
||||
out 0x64,al
|
||||
hlt
|
||||
|
||||
use16
|
||||
|
||||
pr_mode_exit:
|
||||
|
||||
mov ax,1000
|
||||
mov ds,ax
|
||||
mov es,ax
|
||||
mov fs,ax
|
||||
mov gs,ax
|
||||
mov ss,ax
|
||||
; mov bl,[shutdown_parameter]
|
||||
; mov [es:shutdown_parameter-0x10000],bl
|
||||
|
||||
jmp real_mode-0x10000
|
||||
|
||||
old_ints_h:
|
||||
dw 4*0x20
|
||||
dd 0
|
||||
dw 0
|
||||
|
||||
rdelay:
|
||||
ret
|
||||
real_mode:
|
||||
|
||||
lidt [cs:old_ints_h-0x10000]
|
||||
mov sp,0xfff0
|
||||
;remap IRQs
|
||||
mov al,0x11
|
||||
out 0x20,al
|
||||
call rdelay
|
||||
out 0xA0,al
|
||||
call rdelay
|
||||
|
||||
mov al,0x08
|
||||
out 0x21,al
|
||||
call rdelay
|
||||
mov al,0x70
|
||||
out 0xA1,al
|
||||
call rdelay
|
||||
|
||||
mov al,0x04
|
||||
out 0x21,al
|
||||
call rdelay
|
||||
mov al,0x02
|
||||
out 0xA1,al
|
||||
call rdelay
|
||||
|
||||
mov al,0x01
|
||||
out 0x21,al
|
||||
call rdelay
|
||||
out 0xA1,al
|
||||
call rdelay
|
||||
|
||||
mov al,2
|
||||
out 0x21,al
|
||||
mov al,0
|
||||
out 0xA1,al
|
||||
sti
|
||||
|
||||
jmp temp_3456
|
||||
|
||||
nbw:
|
||||
xor ax,ax
|
||||
in al,0x60
|
||||
call pause_key
|
||||
cmp al,7
|
||||
jge nbw
|
||||
mov bl,al
|
||||
nbw2:
|
||||
in al,0x60
|
||||
call pause_key
|
||||
cmp al,bl
|
||||
je nbw2
|
||||
cmp al,240 ;ax,240
|
||||
jne nbw31
|
||||
mov al,bl
|
||||
dec al
|
||||
jmp nbw32
|
||||
nbw31:
|
||||
add bl,128
|
||||
cmp al,bl
|
||||
jne nbw
|
||||
sub al,129
|
||||
|
||||
nbw32:
|
||||
|
||||
cmp al,1 ; write floppy
|
||||
jne no_floppy_write
|
||||
call floppy_write
|
||||
jmp temp_3456 ;nbw
|
||||
no_floppy_write:
|
||||
|
||||
cmp al,2 ; poweroff
|
||||
jne no_apm_off
|
||||
call APM_PowerOff
|
||||
no_apm_off:
|
||||
|
||||
cmp al,3 ; boot
|
||||
jnz no_sys_boot
|
||||
mov ax,0x0040
|
||||
mov ds,ax
|
||||
mov word[0x0072],0x1234
|
||||
jmp 0xF000:0xFFF0
|
||||
no_sys_boot:
|
||||
|
||||
cmp al,4 ; restart kernel
|
||||
je restart_kernel
|
||||
|
||||
temp_3456:
|
||||
push word 0x0000
|
||||
pop es
|
||||
mov al,byte [es:0x9030]
|
||||
cmp al,1
|
||||
jl nbw
|
||||
cmp al,4
|
||||
jg nbw
|
||||
jmp nbw32
|
||||
|
||||
; jmp nbw
|
||||
pause_key:
|
||||
mov ecx,100
|
||||
pause_key_1:
|
||||
loop pause_key_1
|
||||
ret
|
||||
|
||||
iglobal
|
||||
kernel db 'KERNEL MNT'
|
||||
; shutdown_parameter db 0
|
||||
endg
|
||||
|
||||
restart_kernel:
|
||||
|
||||
mov ax,0x0003 ; set text mode for screen
|
||||
int 0x10
|
||||
|
||||
jmp 0x4000:0000
|
||||
|
||||
|
||||
restart_kernel_4000:
|
||||
|
||||
mov di,0x1000 ; load kernel image from 0x8000:0 -> 0x1000:0
|
||||
|
||||
new_kernel_block_move:
|
||||
|
||||
mov ebx,0
|
||||
|
||||
new_kernel_byte_move:
|
||||
|
||||
mov ax,di
|
||||
add ax,0x7000
|
||||
mov es,ax
|
||||
mov dl,[es:bx]
|
||||
mov es,di
|
||||
mov [es:bx],dl
|
||||
|
||||
inc ebx
|
||||
cmp ebx,65536
|
||||
jbe new_kernel_byte_move
|
||||
|
||||
add di,0x1000
|
||||
cmp di,0x2000
|
||||
jbe new_kernel_block_move
|
||||
|
||||
wbinvd ; write and invalidate cache
|
||||
|
||||
mov ax,0x1000
|
||||
mov es,ax
|
||||
mov ax,0x2000
|
||||
mov ss,ax
|
||||
mov sp,0xff00
|
||||
|
||||
jmp 0x1000:0000
|
||||
|
||||
|
||||
APM_PowerOff:
|
||||
;!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
mov ax,0x5300
|
||||
xor bx,bx
|
||||
int 0x15
|
||||
push ax
|
||||
|
||||
mov ax,0x5301
|
||||
xor bx,bx
|
||||
int 0x15
|
||||
|
||||
mov ax,0x5308
|
||||
mov bx,1
|
||||
mov cx,bx
|
||||
int 0x15
|
||||
|
||||
mov ax,0x530E
|
||||
xor bx,bx
|
||||
pop cx
|
||||
int 0x15
|
||||
|
||||
mov ax,0x530D
|
||||
mov bx,1
|
||||
mov cx,bx
|
||||
int 0x15
|
||||
|
||||
mov ax,0x530F
|
||||
mov bx,1
|
||||
mov cx,bx
|
||||
int 0x15
|
||||
|
||||
mov ax,0x5307
|
||||
mov bx,1
|
||||
mov cx,3
|
||||
int 0x15
|
||||
;!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
ret
|
||||
uglobal
|
||||
flm db 0
|
||||
endg
|
||||
|
||||
floppy_write: ; write diskette image to physical floppy
|
||||
|
||||
pusha
|
||||
|
||||
mov ax,0x1000
|
||||
mov es,ax
|
||||
cmp [es:flm-0x10000],byte 1
|
||||
je fwwritedone
|
||||
mov [es:flm-0x10000],byte 1
|
||||
|
||||
mov ax,0x0000 ; reset drive
|
||||
mov dx,0x0000
|
||||
int 0x13
|
||||
|
||||
mov cx,0x0001 ; startcyl,startsector
|
||||
mov dx,0x0000 ; starthead,drive
|
||||
push word 80*2 ; read no of sect
|
||||
|
||||
fwwrites:
|
||||
pusha
|
||||
|
||||
; move 1mb+ -> 0:a000
|
||||
|
||||
pusha
|
||||
mov si,fwmovedesc -0x10000
|
||||
push word 0x1000
|
||||
pop es
|
||||
mov cx,256*18
|
||||
mov ah,0x87
|
||||
int 0x15
|
||||
mov eax,[es:fwmovedesc-0x10000+0x12]
|
||||
add eax,512*18
|
||||
mov [es:fwmovedesc-0x10000+0x12],eax
|
||||
popa
|
||||
|
||||
xor si,si
|
||||
fwnewwrite:
|
||||
push word 0x0
|
||||
pop es
|
||||
mov bx,0xa000 ; es:bx -> data area
|
||||
mov ax,0x0300+18 ; read, no of sectors to read
|
||||
int 0x13
|
||||
|
||||
cmp ah,0
|
||||
jz fwgoodwrite
|
||||
|
||||
add si,1
|
||||
cmp si,10
|
||||
jnz fwnewwrite
|
||||
|
||||
add esp,32+2
|
||||
|
||||
popa ; can't access diskette
|
||||
ret
|
||||
|
||||
fwgoodwrite:
|
||||
|
||||
popa
|
||||
|
||||
inc dh
|
||||
cmp dh,2
|
||||
jnz fwbb2
|
||||
mov dh,0
|
||||
inc ch
|
||||
|
||||
fwbb2:
|
||||
|
||||
cld
|
||||
pop ax
|
||||
dec ax
|
||||
push ax
|
||||
cmp ax,0
|
||||
jnz fwrs
|
||||
|
||||
pop ax
|
||||
|
||||
jmp fwwritedone
|
||||
fwrs:
|
||||
jmp fwwrites
|
||||
|
||||
fwmovedesc:
|
||||
|
||||
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
|
||||
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
|
||||
db 0xff,0xff,0x0,0x00,0x10,0x93,0x0,0x0
|
||||
db 0xff,0xff,0x0,0xa0,0x00,0x93,0x0,0x0
|
||||
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
|
||||
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
|
||||
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
|
||||
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
|
||||
|
||||
fwwritedone:
|
||||
|
||||
popa
|
||||
|
||||
ret
|
||||
|
||||
|
||||
use32
|
||||
|
||||
uglobal
|
||||
shutdownpos dd 0x0
|
||||
endg
|
||||
|
||||
iglobal
|
||||
;shutdowntext:
|
||||
; db "IT'S SAFE TO POWER OFF COMPUTER OR "
|
||||
; db ' '
|
||||
; db '1) SAVE RAMDISK TO FLOPPY '
|
||||
; db '2) APM - POWEROFF '
|
||||
; db '3) REBOOT '
|
||||
; db '4) RESTART KERNEL '
|
||||
shutdowntext:
|
||||
db "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>᭮<EFBFBD> <EFBFBD>몫<EFBFBD>祭<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> "
|
||||
db ' '
|
||||
db '1) <20><><EFBFBD>࠭<EFBFBD><E0A0AD><EFBFBD> ࠬ<><E0A0AC><EFBFBD><EFBFBD> <20><> <20><>᪥<EFBFBD><E1AAA5> '
|
||||
db '2) APM - <20>몫<EFBFBD>祭<EFBFBD><E7A5AD> <20><>⠭<EFBFBD><E2A0AD> '
|
||||
db '3) <20><>१<EFBFBD><E0A5A7><EFBFBD>㧪<EFBFBD> <20><><EFBFBD>⥬<EFBFBD> '
|
||||
db '4) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD> '
|
||||
rosef:
|
||||
db 'ROSE TXT'
|
||||
endg
|
4
kernel/tags/kolibri0.5.2.1/build_en.bat
Normal file
@@ -0,0 +1,4 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix en >lang.inc
|
||||
@fasm kernel.asm kernel.mnt
|
||||
@pause
|
4
kernel/tags/kolibri0.5.2.1/build_ru.bat
Normal file
@@ -0,0 +1,4 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix ru >lang.inc
|
||||
@fasm kernel.asm kernel.mnt
|
||||
@pause
|
46
kernel/tags/kolibri0.5.2.1/bus/pci/pci16.inc
Normal file
@@ -0,0 +1,46 @@
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; PCI16.INC ;;
|
||||
;; ;;
|
||||
;; 16 bit PCI driver code ;;
|
||||
;; ;;
|
||||
;; Version 0.2 December 21st, 2002 ;;
|
||||
;; ;;
|
||||
;; Author: Victor Prodan, victorprodan@yahoo.com ;;
|
||||
;; ;;
|
||||
;; See file COPYING for details ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
|
||||
init_pci_16:
|
||||
|
||||
pushad
|
||||
|
||||
xor ax,ax
|
||||
mov es,ax
|
||||
mov byte [es:0x9020],1 ;default mechanism:1
|
||||
mov ax,0xb101
|
||||
int 0x1a
|
||||
or ah,ah
|
||||
jnz pci16skip
|
||||
|
||||
mov [es:0x9021],cl ;last PCI bus in system
|
||||
mov [es:0x9022],bx
|
||||
mov [es:0x9024],edi
|
||||
|
||||
; we have a PCI BIOS, so check which configuration mechanism(s)
|
||||
; it supports
|
||||
; AL = PCI hardware characteristics (bit0 => mechanism1, bit1 => mechanism2)
|
||||
test al,1
|
||||
jnz pci16skip
|
||||
test al,2
|
||||
jz pci16skip
|
||||
mov byte [es:0x9020],2 ; if (al&3)==2 => mechanism 2
|
||||
|
||||
pci16skip:
|
||||
|
||||
mov ax,0x1000
|
||||
mov es,ax
|
||||
|
||||
popad
|
358
kernel/tags/kolibri0.5.2.1/bus/pci/pci32.inc
Normal file
@@ -0,0 +1,358 @@
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; PCI32.INC ;;
|
||||
;; ;;
|
||||
;; 32 bit PCI driver code ;;
|
||||
;; ;;
|
||||
;; Version 0.2 December 21st, 2002 ;;
|
||||
;; ;;
|
||||
;; Author: Victor Prodan, victorprodan@yahoo.com ;;
|
||||
;; Credits: ;;
|
||||
;; Ralf Brown ;;
|
||||
;; Mike Hibbett, mikeh@oceanfree.net ;;
|
||||
;; ;;
|
||||
;; See file COPYING for details ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
|
||||
;***************************************************************************
|
||||
; Function
|
||||
; pci_api:
|
||||
;
|
||||
; Description
|
||||
; entry point for system PCI calls
|
||||
;***************************************************************************
|
||||
|
||||
align 4
|
||||
|
||||
pci_api:
|
||||
|
||||
cmp [pci_access_enabled],1
|
||||
jne no_pci_access_for_applications
|
||||
|
||||
or al,al
|
||||
jnz pci_fn_1
|
||||
; PCI function 0: get pci version (AH.AL)
|
||||
movzx eax,word [0x2F0000+0x9022]
|
||||
ret
|
||||
|
||||
pci_fn_1:
|
||||
cmp al,1
|
||||
jnz pci_fn_2
|
||||
|
||||
; PCI function 1: get last bus in AL
|
||||
mov al,[0x2F0000+0x9021]
|
||||
ret
|
||||
|
||||
pci_fn_2:
|
||||
cmp al,2
|
||||
jne pci_fn_3
|
||||
; PCI function 2: get pci access mechanism
|
||||
mov al,[0x2F0000+0x9020]
|
||||
ret
|
||||
pci_fn_3:
|
||||
|
||||
cmp al,4
|
||||
jz pci_read_reg ;byte
|
||||
cmp al,5
|
||||
jz pci_read_reg ;word
|
||||
cmp al,6
|
||||
jz pci_read_reg ;dword
|
||||
|
||||
cmp al,8
|
||||
jz pci_write_reg ;byte
|
||||
cmp al,9
|
||||
jz pci_write_reg ;word
|
||||
cmp al,10
|
||||
jz pci_write_reg ;dword
|
||||
|
||||
no_pci_access_for_applications:
|
||||
|
||||
mov eax,-1
|
||||
|
||||
ret
|
||||
|
||||
;***************************************************************************
|
||||
; Function
|
||||
; pci_make_config_cmd
|
||||
;
|
||||
; Description
|
||||
; creates a command dword for use with the PCI bus
|
||||
; bus # in ah
|
||||
; device+func in bh (dddddfff)
|
||||
; register in bl
|
||||
;
|
||||
; command dword returned in eax ( 10000000 bbbbbbbb dddddfff rrrrrr00 )
|
||||
;***************************************************************************
|
||||
|
||||
align 4
|
||||
|
||||
pci_make_config_cmd:
|
||||
shl eax,8 ; move bus to bits 16-23
|
||||
mov ax,bx ; combine all
|
||||
and eax,0xffffff
|
||||
or eax,0x80000000
|
||||
ret
|
||||
|
||||
;***************************************************************************
|
||||
; Function
|
||||
; pci_read_reg:
|
||||
;
|
||||
; Description
|
||||
; read a register from the PCI config space into EAX/AX/AL
|
||||
; IN: ah=bus,device+func=bh,register address=bl
|
||||
; number of bytes to read (1,2,4) coded into AL, bits 0-1
|
||||
;***************************************************************************
|
||||
|
||||
align 4
|
||||
|
||||
pci_read_reg:
|
||||
cmp byte [0x2F0000+0x9020],2 ;what mechanism will we use?
|
||||
je pci_read_reg_2
|
||||
|
||||
; mechanism 1
|
||||
push esi ; save register size into ESI
|
||||
mov esi,eax
|
||||
and esi,3
|
||||
|
||||
call pci_make_config_cmd
|
||||
mov ebx,eax
|
||||
; get current state
|
||||
mov dx,0xcf8
|
||||
in eax, dx
|
||||
push eax
|
||||
; set up addressing to config data
|
||||
mov eax,ebx
|
||||
and al,0xfc ; make address dword-aligned
|
||||
out dx,eax
|
||||
; get requested DWORD of config data
|
||||
mov dl,0xfc
|
||||
and bl,3
|
||||
or dl,bl ; add to port address first 2 bits of register address
|
||||
|
||||
or esi,esi
|
||||
jz pci_read_byte1
|
||||
cmp esi,1
|
||||
jz pci_read_word1
|
||||
cmp esi,2
|
||||
jz pci_read_dword1
|
||||
jmp pci_fin_read1
|
||||
|
||||
pci_read_byte1:
|
||||
in al,dx
|
||||
jmp pci_fin_read1
|
||||
pci_read_word1:
|
||||
in ax,dx
|
||||
jmp pci_fin_read1
|
||||
pci_read_dword1:
|
||||
in eax,dx
|
||||
jmp pci_fin_read1
|
||||
pci_fin_read1:
|
||||
; restore configuration control
|
||||
xchg eax,[esp]
|
||||
mov dx,0xcf8
|
||||
out dx,eax
|
||||
|
||||
pop eax
|
||||
pop esi
|
||||
ret
|
||||
pci_read_reg_2:
|
||||
|
||||
test bh,128 ;mech#2 only supports 16 devices per bus
|
||||
jnz pci_read_reg_err
|
||||
|
||||
push esi ; save register size into ESI
|
||||
mov esi,eax
|
||||
and esi,3
|
||||
|
||||
push eax
|
||||
;store current state of config space
|
||||
mov dx,0xcf8
|
||||
in al,dx
|
||||
mov ah,al
|
||||
mov dl,0xfa
|
||||
in al,dx
|
||||
|
||||
xchg eax,[esp]
|
||||
; out 0xcfa,bus
|
||||
mov al,ah
|
||||
out dx,al
|
||||
; out 0xcf8,0x80
|
||||
mov dl,0xf8
|
||||
mov al,0x80
|
||||
out dx,al
|
||||
; compute addr
|
||||
shr bh,3 ; func is ignored in mechanism 2
|
||||
or bh,0xc0
|
||||
mov dx,bx
|
||||
|
||||
or esi,esi
|
||||
jz pci_read_byte2
|
||||
cmp esi,1
|
||||
jz pci_read_word2
|
||||
cmp esi,2
|
||||
jz pci_read_dword2
|
||||
jmp pci_fin_read2
|
||||
|
||||
pci_read_byte2:
|
||||
in al,dx
|
||||
jmp pci_fin_read2
|
||||
pci_read_word2:
|
||||
in ax,dx
|
||||
jmp pci_fin_read2
|
||||
pci_read_dword2:
|
||||
in eax,dx
|
||||
; jmp pci_fin_read2
|
||||
pci_fin_read2:
|
||||
|
||||
; restore configuration space
|
||||
xchg eax,[esp]
|
||||
mov dx,0xcfa
|
||||
out dx,al
|
||||
mov dl,0xf8
|
||||
mov al,ah
|
||||
out dx,al
|
||||
|
||||
pop eax
|
||||
pop esi
|
||||
ret
|
||||
|
||||
pci_read_reg_err:
|
||||
xor eax,eax
|
||||
dec eax
|
||||
ret
|
||||
|
||||
|
||||
;***************************************************************************
|
||||
; Function
|
||||
; pci_write_reg:
|
||||
;
|
||||
; Description
|
||||
; write a register from ECX/CX/CL into the PCI config space
|
||||
; IN: ah=bus,device+func=bh,register address (dword aligned)=bl,
|
||||
; value to write in ecx
|
||||
; number of bytes to write (1,2,4) coded into AL, bits 0-1
|
||||
;***************************************************************************
|
||||
|
||||
align 4
|
||||
|
||||
pci_write_reg:
|
||||
cmp byte [0x2F0000+0x9020],2 ;what mechanism will we use?
|
||||
je pci_write_reg_2
|
||||
|
||||
; mechanism 1
|
||||
push esi ; save register size into ESI
|
||||
mov esi,eax
|
||||
and esi,3
|
||||
|
||||
call pci_make_config_cmd
|
||||
mov ebx,eax
|
||||
; get current state into ecx
|
||||
mov dx,0xcf8
|
||||
in eax, dx
|
||||
push eax
|
||||
; set up addressing to config data
|
||||
mov eax,ebx
|
||||
and al,0xfc ; make address dword-aligned
|
||||
out dx,eax
|
||||
; write DWORD of config data
|
||||
mov dl,0xfc
|
||||
and bl,3
|
||||
or dl,bl
|
||||
mov eax,ecx
|
||||
|
||||
or esi,esi
|
||||
jz pci_write_byte1
|
||||
cmp esi,1
|
||||
jz pci_write_word1
|
||||
cmp esi,2
|
||||
jz pci_write_dword1
|
||||
jmp pci_fin_write1
|
||||
|
||||
pci_write_byte1:
|
||||
out dx,al
|
||||
jmp pci_fin_write1
|
||||
pci_write_word1:
|
||||
out dx,ax
|
||||
jmp pci_fin_write1
|
||||
pci_write_dword1:
|
||||
out dx,eax
|
||||
jmp pci_fin_write1
|
||||
pci_fin_write1:
|
||||
|
||||
; restore configuration control
|
||||
pop eax
|
||||
mov dl,0xf8
|
||||
out dx,eax
|
||||
|
||||
xor eax,eax
|
||||
pop esi
|
||||
|
||||
ret
|
||||
pci_write_reg_2:
|
||||
|
||||
test bh,128 ;mech#2 only supports 16 devices per bus
|
||||
jnz pci_write_reg_err
|
||||
|
||||
|
||||
push esi ; save register size into ESI
|
||||
mov esi,eax
|
||||
and esi,3
|
||||
|
||||
push eax
|
||||
;store current state of config space
|
||||
mov dx,0xcf8
|
||||
in al,dx
|
||||
mov ah,al
|
||||
mov dl,0xfa
|
||||
in al,dx
|
||||
xchg eax,[esp]
|
||||
; out 0xcfa,bus
|
||||
mov al,ah
|
||||
out dx,al
|
||||
; out 0xcf8,0x80
|
||||
mov dl,0xf8
|
||||
mov al,0x80
|
||||
out dx,al
|
||||
; compute addr
|
||||
shr bh,3 ; func is ignored in mechanism 2
|
||||
or bh,0xc0
|
||||
mov dx,bx
|
||||
; write register
|
||||
mov eax,ecx
|
||||
|
||||
or esi,esi
|
||||
jz pci_write_byte2
|
||||
cmp esi,1
|
||||
jz pci_write_word2
|
||||
cmp esi,2
|
||||
jz pci_write_dword2
|
||||
jmp pci_fin_write2
|
||||
|
||||
pci_write_byte2:
|
||||
out dx,al
|
||||
jmp pci_fin_write2
|
||||
pci_write_word2:
|
||||
out dx,ax
|
||||
jmp pci_fin_write2
|
||||
pci_write_dword2:
|
||||
out dx,eax
|
||||
jmp pci_fin_write2
|
||||
pci_fin_write2:
|
||||
; restore configuration space
|
||||
pop eax
|
||||
mov dx,0xcfa
|
||||
out dx,al
|
||||
mov dl,0xf8
|
||||
mov al,ah
|
||||
out dx,al
|
||||
|
||||
xor eax,eax
|
||||
pop esi
|
||||
ret
|
||||
|
||||
pci_write_reg_err:
|
||||
xor eax,eax
|
||||
dec eax
|
||||
ret
|
473
kernel/tags/kolibri0.5.2.1/core/mem.inc
Normal file
@@ -0,0 +1,473 @@
|
||||
if ~defined mem_inc
|
||||
mem_inc_fix:
|
||||
mem_inc fix mem_inc_fix
|
||||
;include "memmanag.inc"
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;High-level memory management in MenuetOS.
|
||||
;;It uses memory manager in memmanager.inc
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
second_base_address=0xC0000000
|
||||
std_application_base_address=0x10000000
|
||||
general_page_table_ dd 0
|
||||
general_page_table=general_page_table_+second_base_address
|
||||
;-----------------------------------------------------------------------------
|
||||
create_general_page_table:
|
||||
;input
|
||||
; none
|
||||
;output
|
||||
; none
|
||||
;Procedure create general page directory and write
|
||||
;it address to [general_page_table].
|
||||
pushad
|
||||
mov eax,1 ;alloc 1 page
|
||||
mov ebx,general_page_table ;write address to [general_page_table]
|
||||
call MEM_Alloc_Pages ;allocate page directory
|
||||
mov eax,[general_page_table]
|
||||
call MEM_Get_Linear_Address ;eax - linear address of page directory
|
||||
mov edi,eax
|
||||
mov ebx,eax
|
||||
xor eax,eax
|
||||
mov ecx,4096/4
|
||||
cld
|
||||
rep stosd ;clear page directory
|
||||
|
||||
mov eax,4
|
||||
mov edx,eax
|
||||
call MEM_Alloc_Pages ;alloc page tables for 0x0-0x1000000 region
|
||||
cmp eax,edx
|
||||
jnz $ ;hang if not enough memory
|
||||
|
||||
;fill page tables
|
||||
xor esi,esi
|
||||
mov ebp,7
|
||||
|
||||
.loop:
|
||||
;esi - number of page in page directory
|
||||
;ebp - current page address
|
||||
;ebx - linear address of page directory
|
||||
mov eax,[ebx+4*esi]
|
||||
add dword [ebx+4*esi],7 ;add flags to address of page table
|
||||
call MEM_Get_Linear_Address
|
||||
;eax - linear address of page table
|
||||
mov ecx,4096/4
|
||||
;ecx (counter) - number of pages in page table
|
||||
;current address=4Mb*esi
|
||||
cmp esi,2
|
||||
jz .start_lfb_map ;lfb map begin at 0x800000
|
||||
cmp esi,3
|
||||
jz .end_lfb_map ;lfb map end at 0xC00000
|
||||
jmp .loop1
|
||||
.start_lfb_map:
|
||||
;current address=lfb address
|
||||
mov ebp,[0x2f0000+0x9018]
|
||||
add ebp,7 ;add flags
|
||||
jmp .loop1
|
||||
.end_lfb_map:
|
||||
;current address=linear address
|
||||
mov ebp,12*0x100000+7
|
||||
|
||||
.loop1:
|
||||
mov [eax],ebp ;write page address (with flags) in page table
|
||||
add eax,4
|
||||
add ebp,4096 ;size of page=4096 bytes
|
||||
loop .loop1
|
||||
|
||||
inc esi ;next page directory entry
|
||||
cmp esi,edx
|
||||
jnz .loop
|
||||
|
||||
;map region 0x80000000-0x803fffff to 0x800000-0xcfffff
|
||||
mov eax,1 ;size of the region is 4Mb so only 1 page table needed
|
||||
mov edx,ebx ;ebx still contains linear address of the page directory
|
||||
add ebx,0x800
|
||||
call MEM_Alloc_Pages ;alloc page table for the region
|
||||
mov eax,[ebx]
|
||||
add dword [ebx],7 ;add flags
|
||||
call MEM_Get_Linear_Address ;get linear address of the page table
|
||||
mov ebx,eax
|
||||
mov ecx,4096/4 ;number of pages in page table
|
||||
mov eax,8*0x100000+7
|
||||
.loop3:
|
||||
;ebx - linear address of page table
|
||||
;eax - current linear address with flags
|
||||
mov [ebx],eax
|
||||
add ebx,4
|
||||
add eax,4096
|
||||
loop .loop3
|
||||
|
||||
;map region 0xC0000000-* to 0x0-*
|
||||
mov esi,edx ;esi=linear address of the page directory
|
||||
lea edi,[esi+(second_base_address shr 20)];add offset of entry (0xC00)
|
||||
mov ecx,4
|
||||
rep movsd ;first 16Mb of the region mapped as 0x0-0x1000000 block
|
||||
mov eax,[0xfe8c] ;eax=memory size
|
||||
add eax,0x3fffff
|
||||
shr eax,22
|
||||
mov esi,eax ;calculate number of entries in page directory
|
||||
sub esi,4 ;subtract entries for first 16Mb.
|
||||
mov ebp,0x1000000+7 ;start physical address with flags
|
||||
|
||||
;mapping memory higher than 16Mb
|
||||
.loop4:
|
||||
;esi (counter) - number of entries in page directory
|
||||
;edi - address of entry
|
||||
test esi,esi
|
||||
jle .loop4end
|
||||
call MEM_Alloc_Page ;alloc page table for entry in page directory
|
||||
mov [edi],eax
|
||||
add dword [edi],7 ;write physical address of page table in page directory
|
||||
add edi,4 ;move entry pointer
|
||||
call MEM_Get_Linear_Address
|
||||
mov ecx,eax
|
||||
xor edx,edx
|
||||
|
||||
.loop5:
|
||||
;ecx - linear address of page table
|
||||
;edx - index of page in page table
|
||||
;ebp - current mapped physical address with flags
|
||||
mov [ecx+4*edx],ebp ;write address of page in page table
|
||||
add ebp,0x1000 ;move to next page
|
||||
inc edx
|
||||
cmp edx,4096/4
|
||||
jl .loop5
|
||||
|
||||
dec esi
|
||||
jmp .loop4
|
||||
.loop4end:
|
||||
|
||||
.set_cr3:
|
||||
;set value of cr3 register to the address of page directory
|
||||
mov eax,[general_page_table]
|
||||
add eax,8+16 ;add flags
|
||||
mov cr3,eax ;now we have full access paging
|
||||
|
||||
popad
|
||||
ret
|
||||
;-----------------------------------------------------------------------------
|
||||
simple_clone_cr3_table:
|
||||
;Parameters:
|
||||
; eax - physical address of cr3 table (page directory)
|
||||
;result:
|
||||
; eax - physical address of clone of cr3 table.
|
||||
;Function copy only page directory.
|
||||
push ecx
|
||||
push edx
|
||||
push esi
|
||||
push edi
|
||||
call MEM_Get_Linear_Address
|
||||
;eax - linear address of cr3 table
|
||||
mov esi,eax
|
||||
call MEM_Alloc_Page
|
||||
test eax,eax
|
||||
jz .failed
|
||||
;eax - physical address of new page diretory
|
||||
mov edx,eax
|
||||
call MEM_Get_Linear_Address
|
||||
mov edi,eax
|
||||
mov ecx,4096/4
|
||||
cld
|
||||
;esi - address of old page directory
|
||||
;edi - address of new page directory
|
||||
rep movsd ;copy page directory
|
||||
mov eax,edx
|
||||
.failed:
|
||||
pop edi
|
||||
pop esi
|
||||
pop edx
|
||||
pop ecx
|
||||
ret
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
create_app_cr3_table:
|
||||
;Parameters:
|
||||
; eax - slot of process (index in 0x3000 table)
|
||||
;result:
|
||||
; eax - physical address of table.
|
||||
;This function create page directory for new process and
|
||||
;write it physical address to offset 0xB8 of extended
|
||||
;process information.
|
||||
push ebx
|
||||
|
||||
mov ebx,eax
|
||||
mov eax,[general_page_table]
|
||||
call simple_clone_cr3_table ;clone general page table
|
||||
shl ebx,8
|
||||
mov [second_base_address+0x80000+ebx+0xB8],eax ;save address of page directory
|
||||
|
||||
pop ebx
|
||||
ret
|
||||
;-----------------------------------------------------------------------------
|
||||
get_cr3_table:
|
||||
;Input:
|
||||
; eax - slot of process
|
||||
;result:
|
||||
; eax - physical address of page directory
|
||||
shl eax,8 ;size of process extended information=256 bytes
|
||||
mov eax,[second_base_address+0x80000+eax+0xB8]
|
||||
ret
|
||||
;-----------------------------------------------------------------------------
|
||||
dispose_app_cr3_table:
|
||||
;Input:
|
||||
; eax - slot of process
|
||||
;result:
|
||||
; none
|
||||
;This procedure frees page directory,
|
||||
;page tables and all memory of process.
|
||||
pushad
|
||||
mov ebp,eax
|
||||
;ebp = process slot in the procedure.
|
||||
shl eax,8
|
||||
mov eax,[second_base_address+0x80000+eax+0xB8]
|
||||
mov ebx,eax
|
||||
;ebx = physical address of page directory
|
||||
call MEM_Get_Linear_Address
|
||||
mov edi,eax
|
||||
;edi = linear address of page directory
|
||||
mov eax,[edi+(std_application_base_address shr 20)]
|
||||
and eax,not (4096-1)
|
||||
call MEM_Get_Linear_Address
|
||||
mov esi,eax
|
||||
;esi = linear address of first page table
|
||||
|
||||
;search threads
|
||||
; mov ecx,0x200
|
||||
xor edx,edx
|
||||
mov eax,0x2
|
||||
|
||||
.loop:
|
||||
;eax = current slot of process
|
||||
mov ecx,eax
|
||||
shl ecx,5
|
||||
cmp byte [second_base_address+0x3000+ecx+0xa],9 ;if process running?
|
||||
jz .next ;skip empty slots
|
||||
shl ecx,3
|
||||
cmp [second_base_address+0x80000+ecx+0xB8],ebx ;compare page directory addresses
|
||||
jnz .next
|
||||
inc edx ;thread found
|
||||
.next:
|
||||
inc eax
|
||||
cmp eax,[0x3004] ;exit loop if we look through all processes
|
||||
jle .loop
|
||||
|
||||
;edx = number of threads
|
||||
;our process is zombi so it isn't counted
|
||||
cmp edx,1
|
||||
jg .threadsexists
|
||||
;if there isn't threads then clear memory.
|
||||
add edi,std_application_base_address shr 20
|
||||
|
||||
.loop1:
|
||||
;edi = linear address of current directory entry
|
||||
;esi = linear address of current page table
|
||||
test esi,esi
|
||||
jz .loop1end
|
||||
xor ecx,ecx
|
||||
|
||||
.loop2:
|
||||
;ecx = index of page
|
||||
mov eax,[esi+4*ecx]
|
||||
test eax,eax
|
||||
jz .loopend ;skip empty entries
|
||||
and eax,not (4096-1) ;clear flags
|
||||
push ecx
|
||||
call MEM_Free_Page ;free page
|
||||
pop ecx
|
||||
.loopend:
|
||||
inc ecx
|
||||
cmp ecx,1024 ;there are 1024 pages in page table
|
||||
jl .loop2
|
||||
|
||||
mov eax,esi
|
||||
call MEM_Free_Page_Linear ;free page table
|
||||
.loop1end:
|
||||
add edi,4 ;move to next directory entry
|
||||
mov eax,[edi]
|
||||
and eax,not (4096-1)
|
||||
call MEM_Get_Linear_Address
|
||||
mov esi,eax ;calculate linear address of new page table
|
||||
test edi,0x800
|
||||
jz .loop1 ;test if we at 0x80000000 address?
|
||||
|
||||
and edi,not (4096-1) ;clear offset of page directory entry
|
||||
mov eax,edi
|
||||
call MEM_Free_Page_Linear ;free page directory
|
||||
popad
|
||||
ret
|
||||
|
||||
.threadsexists: ;do nothing
|
||||
popad ;last thread will free memory
|
||||
ret
|
||||
;-----------------------------------------------------------------------------
|
||||
mem_alloc_specified_region:
|
||||
;eax - linear directory address
|
||||
;ebx - start address (aligned to 4096 bytes)
|
||||
;ecx - size in pages
|
||||
;result:
|
||||
; eax=1 - ok
|
||||
; eax=0 - failed
|
||||
;Try to alloc and map ecx pages to [ebx;ebx+4096*ecx) interval.
|
||||
pushad
|
||||
mov ebp,ebx ;save start address for recoil
|
||||
mov esi,eax
|
||||
.gen_loop:
|
||||
;esi = linear directory address
|
||||
;ebx = current address
|
||||
;ecx = remaining size in pages
|
||||
mov edx,ebx
|
||||
shr edx,22
|
||||
mov edi,[esi+4*edx] ;find directory entry for current address
|
||||
test edi,edi
|
||||
jnz .table_exists ;check if page table allocated
|
||||
call MEM_Alloc_Page ;alloc page table
|
||||
test eax,eax
|
||||
jz .failed
|
||||
mov [esi+4*edx],eax
|
||||
add dword [esi+4*edx],7 ;write it address with flags
|
||||
call MEM_Get_Linear_Address
|
||||
call mem_fill_page ;clear page table
|
||||
jmp .table_linear
|
||||
.table_exists:
|
||||
;calculate linear address of page table
|
||||
mov eax,edi
|
||||
and eax,not (4096-1) ;clear flags
|
||||
call MEM_Get_Linear_Address
|
||||
.table_linear:
|
||||
;eax = linear address of page table
|
||||
mov edx,ebx
|
||||
shr edx,12
|
||||
and edx,(1024-1) ;calculate index in page table
|
||||
mov edi,eax
|
||||
|
||||
.loop:
|
||||
;edi = linear address of page table
|
||||
;edx = current page table index
|
||||
;ecx = remaining size in pages
|
||||
;ebx = current address
|
||||
test ecx,ecx
|
||||
jle .endloop1 ;all requested pages allocated
|
||||
|
||||
call MEM_Alloc_Page ;alloc new page
|
||||
test eax,eax
|
||||
jz .failed
|
||||
mov [edi+4*edx],eax
|
||||
add dword [edi+4*edx],7 ;write it address with flags
|
||||
call MEM_Get_Linear_Address
|
||||
call mem_fill_page ;clear new page
|
||||
;go to next page table entry
|
||||
dec ecx
|
||||
add ebx,4096
|
||||
inc edx
|
||||
test edx,(1024-1)
|
||||
jnz .loop
|
||||
|
||||
jmp .gen_loop
|
||||
|
||||
.endloop1:
|
||||
popad
|
||||
mov eax,1 ;ok
|
||||
ret
|
||||
|
||||
.failed:
|
||||
;calculate data for recoil
|
||||
sub ebx,ebp
|
||||
shr ebx,12
|
||||
mov ecx,ebx ;calculate number of allocated pages
|
||||
mov eax,esi ;restore linear address of page directory
|
||||
mov ebx,ebp ;restore initial address
|
||||
call mem_free_specified_region ;free all allocated pages
|
||||
popad
|
||||
xor eax,eax ;fail
|
||||
ret
|
||||
;-----------------------------------------------------------------------------
|
||||
mem_fill_page:
|
||||
;Input:
|
||||
; eax - address
|
||||
;result:
|
||||
; none
|
||||
;set to zero 4096 bytes at eax address.
|
||||
push ecx
|
||||
push edi
|
||||
mov edi,eax
|
||||
mov ecx,4096/4
|
||||
xor eax,eax
|
||||
rep stosd
|
||||
lea eax,[edi-4096]
|
||||
pop edi
|
||||
pop ecx
|
||||
ret
|
||||
;-----------------------------------------------------------------------------
|
||||
mem_free_specified_region:
|
||||
;eax - linear page directory address
|
||||
;ebx - start address (aligned to 4096 bytes)
|
||||
;ecx - size in pages
|
||||
;result - none
|
||||
;Free pages in [ebx;ebx+4096*ecx) region.
|
||||
pushad
|
||||
mov esi,eax
|
||||
xor ebp,ebp
|
||||
|
||||
.gen_loop:
|
||||
;esi = linear page directory address
|
||||
;ebx = current address
|
||||
;ecx = remaining pages
|
||||
;ebp = 0 for first page table
|
||||
; 1 otherwise
|
||||
mov edx,ebx
|
||||
shr edx,22
|
||||
mov eax,[esi+4*edx] ;find directory entry for current address
|
||||
and eax,not (4096-1)
|
||||
test eax,eax
|
||||
jnz .table_exists
|
||||
;skip absent page tables
|
||||
mov edx,ebx
|
||||
shr edx,12
|
||||
and edx,(1024-1) ;edx - index of current page
|
||||
add ebx,1 shl 22
|
||||
add ecx,edx
|
||||
and ebx,not ((1 shl 22)-1)
|
||||
mov ebp,1 ;set flag
|
||||
sub ecx,1024 ;ecx=ecx-(1024-edx)
|
||||
jg .gen_loop
|
||||
popad
|
||||
ret
|
||||
.table_exists:
|
||||
call MEM_Get_Linear_Address
|
||||
;eax - linear address of table
|
||||
mov edx,ebx
|
||||
shr edx,12
|
||||
and edx,(1024-1) ;edx - index of current page
|
||||
mov edi,eax
|
||||
|
||||
.loop:
|
||||
;edi = linear address of page table entry
|
||||
;edx = index of page table entry
|
||||
;ecx = remaining pages
|
||||
test ecx,ecx
|
||||
jle .endloop1
|
||||
|
||||
mov eax,[edi+4*edx]
|
||||
and eax,not (4096-1)
|
||||
call MEM_Free_Page ;free page
|
||||
mov dword [edi+4*edx],0 ;and clear page table entry
|
||||
dec ecx
|
||||
inc edx
|
||||
cmp edx,1024
|
||||
jl .loop
|
||||
|
||||
test ebp,ebp
|
||||
jz .first_page
|
||||
mov eax,edi
|
||||
call MEM_Free_Page_Linear ;free page table
|
||||
mov edx,ebx
|
||||
shr edx,22
|
||||
mov dword [esi+4*edx],0 ;and clear page directory entry
|
||||
.first_page:
|
||||
add ebx,1 shl 22
|
||||
and ebx,not ((1 shl 22)-1) ;calculate new current address
|
||||
mov ebp,1 ;set flag
|
||||
jmp .gen_loop
|
||||
|
||||
.endloop1:
|
||||
popad
|
||||
ret
|
||||
end if
|
977
kernel/tags/kolibri0.5.2.1/core/memmanag.inc
Normal file
@@ -0,0 +1,977 @@
|
||||
if ~defined memmanager_inc
|
||||
memmanager_inc_fix:
|
||||
memmanager_inc fix memmanager_inc_fix
|
||||
;for testing in applications
|
||||
if defined B32
|
||||
iskernel=1
|
||||
else
|
||||
iskernel=0
|
||||
end if
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Memory allocator for MenuetOS kernel
|
||||
;; Andrey Halyavin, halyavin@land.ru 2005
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; heap block structure -
|
||||
;; you can handle several ranges of
|
||||
;; pages simultaneosly.
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
.heap_linear_address equ 0
|
||||
.heap_block_size equ 4
|
||||
.heap_physical_address equ 8
|
||||
.heap_reserved equ 12
|
||||
.heap_block_info equ 16
|
||||
max_heaps equ 8
|
||||
.range_info equ 36
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; memory manager data
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
MEM_heap_block_ rd .heap_block_info*max_heaps/4
|
||||
MEM_heap_block=MEM_heap_block_+second_base_address
|
||||
MEM_heap_count_ rd 1
|
||||
MEM_heap_count=MEM_heap_count_+second_base_address
|
||||
if iskernel = 0
|
||||
MEM_general_mutex rd 1
|
||||
MEM_call_count rd 1
|
||||
MEM_mutex_pid rd 1
|
||||
MEM_mutex_count rd 1
|
||||
else
|
||||
MEM_cli_count_ rd 1
|
||||
MEM_cli_count=MEM_cli_count_+second_base_address
|
||||
MEM_cli_prev_ rd 1
|
||||
MEM_cli_prev=MEM_cli_prev_+second_base_address
|
||||
end if
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;MEM_Init
|
||||
;;Initialize memory manager structures.
|
||||
;;Must be called first.
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
MEM_Init:
|
||||
push eax
|
||||
xor eax,eax
|
||||
if iskernel = 0
|
||||
mov [MEM_heap_count],eax
|
||||
mov [MEM_general_mutex],eax
|
||||
mov [MEM_call_count],eax
|
||||
mov [MEM_mutex_pid],eax
|
||||
mov [MEM_mutex_count],eax
|
||||
else
|
||||
mov [MEM_cli_prev],eax ;init value = 0
|
||||
dec eax
|
||||
mov [MEM_cli_count],eax ;init value = -1
|
||||
end if
|
||||
pop eax
|
||||
ret
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;change_task
|
||||
;;procedure for changing tasks.
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
if iskernel = 0
|
||||
change_task:
|
||||
push eax
|
||||
push ebx
|
||||
mov eax,5
|
||||
xor ebx,ebx
|
||||
inc ebx
|
||||
int 0x40
|
||||
pop ebx
|
||||
pop eax
|
||||
ret
|
||||
end if
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;MEM_get_pid
|
||||
;;determine current pid
|
||||
;;result:
|
||||
;; eax - pid
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
if iskernel = 0
|
||||
MEM_get_pid:
|
||||
push ebx
|
||||
push ecx
|
||||
sub esp,1024
|
||||
mov eax,9
|
||||
mov ebx,esp
|
||||
mov ecx,-1
|
||||
int 0x40
|
||||
mov eax,[esp+30]
|
||||
add esp,1024
|
||||
pop ecx
|
||||
pop ebx
|
||||
ret
|
||||
else
|
||||
; pid_address dd 0x3000
|
||||
;MEM_get_pid:
|
||||
; mov eax,[pid_address]
|
||||
; mov eax,[eax]
|
||||
; ret
|
||||
end if
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;MEM_Heap_Lock
|
||||
;;Wait until all operations with heap will be finished.
|
||||
;;Between MEM_Heap_Lock and MEM_Heap_UnLock operations
|
||||
;;with heap are forbidden.
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
MEM_Heap_Lock:
|
||||
if iskernel = 0
|
||||
push eax
|
||||
inc dword [MEM_call_count]
|
||||
MEM_Heap_Lock_wait:
|
||||
mov eax,1
|
||||
xchg [MEM_general_mutex],eax
|
||||
test eax,eax
|
||||
jz MEM_Heap_Lock_end
|
||||
call MEM_get_pid
|
||||
cmp [MEM_mutex_pid],eax
|
||||
jz MEM_Heap_Lock_end1
|
||||
call change_task
|
||||
jmp MEM_Heap_Lock_wait
|
||||
MEM_Heap_Lock_end1:
|
||||
inc dword [MEM_mutex_count]
|
||||
pop eax
|
||||
ret
|
||||
MEM_Heap_Lock_end:
|
||||
call MEM_get_pid
|
||||
mov [MEM_mutex_pid],eax
|
||||
mov dword [MEM_mutex_count],1
|
||||
pop eax
|
||||
ret
|
||||
else
|
||||
pushfd
|
||||
cli
|
||||
inc dword [MEM_cli_count]
|
||||
jz MEM_Heap_First_Lock
|
||||
add esp,4
|
||||
ret
|
||||
MEM_Heap_First_Lock: ;save interrupt flag
|
||||
shr dword [esp],9
|
||||
and dword [esp],1
|
||||
pop dword [MEM_cli_prev]
|
||||
ret
|
||||
end if
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;MEM_Heap_UnLock
|
||||
;;After this routine operations with heap are allowed.
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
MEM_Heap_UnLock:
|
||||
if iskernel = 0
|
||||
push eax
|
||||
xor eax,eax
|
||||
dec dword [MEM_mutex_count]
|
||||
jnz MEM_Heap_UnLock_No_Wait1
|
||||
dec dword [MEM_call_count]
|
||||
mov [MEM_mutex_pid],eax
|
||||
mov [MEM_general_mutex],eax;release mutex BEFORE task switching
|
||||
jz MEM_Heap_UnLock_No_Wait
|
||||
call change_task ;someone want to use heap - switch tasks
|
||||
MEM_Heap_UnLock_No_Wait:
|
||||
pop eax
|
||||
ret
|
||||
MEM_Heap_UnLock_No_Wait1:
|
||||
dec dword [MEM_call_count]
|
||||
jz MEM_Heap_UnLock_No_Wait2
|
||||
call change_task
|
||||
MEM_Heap_UnLock_No_Wait2:
|
||||
pop eax
|
||||
ret
|
||||
else
|
||||
dec dword [MEM_cli_count]
|
||||
js MEM_Heap_UnLock_last
|
||||
ret
|
||||
MEM_Heap_UnLock_last:
|
||||
cmp dword [MEM_cli_prev],0 ;restore saved interrupt flag
|
||||
jz MEM_Heap_UnLock_No_sti
|
||||
sti
|
||||
MEM_Heap_UnLock_No_sti:
|
||||
ret
|
||||
end if
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;MEM_Add_Heap
|
||||
;;Add new range to memory manager.
|
||||
;;eax - linear address
|
||||
;;ebx - size in pages
|
||||
;;ecx - physical address
|
||||
;;Result:
|
||||
;; eax=1 - success
|
||||
;; eax=0 - failed
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
MEM_Add_Heap:
|
||||
push edx
|
||||
call MEM_Heap_Lock
|
||||
mov edx,[MEM_heap_count]
|
||||
cmp edx,max_heaps
|
||||
jz MEM_Add_Heap_Error
|
||||
inc dword [MEM_heap_count]
|
||||
shl edx,4
|
||||
mov [MEM_heap_block+edx+.heap_linear_address],eax
|
||||
mov [MEM_heap_block+edx+.heap_block_size],ebx
|
||||
shl dword [MEM_heap_block+edx+.heap_block_size],12
|
||||
mov [MEM_heap_block+edx+.heap_physical_address],ecx
|
||||
lea edx,[4*ebx+.range_info+4095] ;calculate space for page info table
|
||||
and edx,0xFFFFF000
|
||||
mov [eax],eax
|
||||
add [eax],edx ;first 4 bytes - pointer to first free page
|
||||
;clean page info area
|
||||
push edi
|
||||
lea edi,[eax+4]
|
||||
mov ecx,edx
|
||||
shr ecx,2
|
||||
push eax
|
||||
xor eax,eax
|
||||
rep stosd
|
||||
pop eax
|
||||
pop edi
|
||||
;create free pages list.
|
||||
mov ecx,[eax]
|
||||
shl ebx,12
|
||||
add eax,ebx ;eax - address after block
|
||||
MEM_Add_Heap_loop:
|
||||
add ecx,4096
|
||||
mov [ecx-4096],ecx ;set forward pointer
|
||||
cmp ecx,eax
|
||||
jnz MEM_Add_Heap_loop
|
||||
mov dword [ecx-4096],0 ;set end of list
|
||||
MEM_Add_Heap_ret:
|
||||
call MEM_Heap_UnLock
|
||||
pop edx
|
||||
ret
|
||||
MEM_Add_Heap_Error:
|
||||
xor eax,eax
|
||||
jmp MEM_Add_Heap_ret
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;MEM_Get_Physical_Address
|
||||
;;Translate linear address to physical address
|
||||
;;Parameters:
|
||||
;; eax - linear address
|
||||
;;Result:
|
||||
;; eax - physical address
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
if used MEM_Get_Physical_Address
|
||||
MEM_Get_Physical_Address:
|
||||
push ecx
|
||||
call MEM_Heap_Lock
|
||||
mov ecx,[MEM_heap_count]
|
||||
dec ecx
|
||||
shl ecx,4
|
||||
MEM_Get_Physical_Address_loop:
|
||||
sub eax,[MEM_heap_block+ecx+.heap_linear_address]
|
||||
jl MEM_Get_Physical_Address_next
|
||||
cmp eax,[MEM_heap_block+ecx+.heap_block_size]
|
||||
jge MEM_Get_Physical_Address_next
|
||||
add eax,[MEM_heap_block+ecx+.heap_physical_address]
|
||||
jmp MEM_Get_Physical_Address_loopend
|
||||
MEM_Get_Physical_Address_next:
|
||||
add eax,[MEM_heap_block+ecx+.heap_linear_address]
|
||||
sub ecx,16
|
||||
jns MEM_Get_Physical_Address_loop
|
||||
xor eax,eax ;address not found
|
||||
MEM_Get_Physical_Address_loopend:
|
||||
call MEM_Heap_UnLock
|
||||
pop ecx
|
||||
ret
|
||||
end if
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;MEM_Get_Linear_Address
|
||||
;;Translate physical address to linear address.
|
||||
;;Parameters:
|
||||
;; eax - physical address
|
||||
;;Result:
|
||||
;; eax - linear address
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
if used MEM_Get_Linear_Address
|
||||
MEM_Get_Linear_Address:
|
||||
push ecx
|
||||
call MEM_Heap_Lock
|
||||
mov ecx,[MEM_heap_count]
|
||||
dec ecx
|
||||
shl ecx,4
|
||||
MEM_Get_Linear_Address_loop:
|
||||
sub eax,[MEM_heap_block+ecx+.heap_physical_address]
|
||||
jl MEM_Get_Linear_Address_Next
|
||||
cmp eax,[MEM_heap_block+ecx+.heap_block_size]
|
||||
jge MEM_Get_Linear_Address_Next
|
||||
add eax,[MEM_heap_block+ecx+.heap_linear_address]
|
||||
call MEM_Heap_UnLock
|
||||
pop ecx
|
||||
ret
|
||||
MEM_Get_Linear_Address_Next:
|
||||
add eax,[MEM_heap_block+ecx+.heap_physical_address]
|
||||
sub ecx,16
|
||||
jns MEM_Get_Linear_Address_loop
|
||||
call MEM_Heap_UnLock
|
||||
pop ecx
|
||||
xor eax,eax ;address not found
|
||||
ret
|
||||
end if
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;MEM_Alloc_Page
|
||||
;;Allocate and add reference to page
|
||||
;;Result:
|
||||
;; eax<>0 - physical address of page
|
||||
;; eax=0 - not enough memory
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
if used MEM_Alloc_Page
|
||||
MEM_Alloc_Page:
|
||||
push ecx
|
||||
call MEM_Heap_Lock
|
||||
mov ecx,[MEM_heap_count]
|
||||
dec ecx
|
||||
shl ecx,4
|
||||
MEM_Alloc_Page_loop:
|
||||
push ecx
|
||||
mov ecx,[MEM_heap_block+ecx+.heap_linear_address]
|
||||
cmp dword [ecx],0
|
||||
jz MEM_Alloc_Page_loopend
|
||||
mov eax,[ecx]
|
||||
push dword [eax]
|
||||
pop dword [ecx]
|
||||
sub eax,ecx
|
||||
push eax
|
||||
shr eax,10
|
||||
mov word [ecx+.range_info+eax],1
|
||||
pop eax
|
||||
pop ecx
|
||||
add eax,[MEM_heap_block+ecx+.heap_physical_address]
|
||||
jmp MEM_Alloc_Page_ret
|
||||
MEM_Alloc_Page_loopend:
|
||||
pop ecx
|
||||
sub ecx,16
|
||||
jns MEM_Alloc_Page_loop
|
||||
xor eax,eax
|
||||
MEM_Alloc_Page_ret:
|
||||
call MEM_Heap_UnLock
|
||||
pop ecx
|
||||
ret
|
||||
end if
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;MEM_Alloc_Page_Linear
|
||||
;;Allocate and add reference to page
|
||||
;;Result:
|
||||
;; eax<>0 - linear address of page
|
||||
;; eax=0 - not enough memory
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
if used MEM_Alloc_Page_Linear
|
||||
MEM_Alloc_Page_Linear:
|
||||
push ecx
|
||||
call MEM_Heap_Lock
|
||||
mov ecx,[MEM_heap_count]
|
||||
dec ecx
|
||||
shl ecx,4
|
||||
MEM_Alloc_Page_Linear_loop:
|
||||
push ecx
|
||||
mov ecx,[MEM_heap_block+ecx+.heap_linear_address]
|
||||
cmp dword [ecx],0
|
||||
jz MEM_Alloc_Page_Linear_loopend
|
||||
mov eax,[ecx]
|
||||
push dword [eax]
|
||||
pop dword [ecx]
|
||||
push eax
|
||||
sub eax,ecx
|
||||
shr eax,10
|
||||
mov word [ecx+.range_info+eax],1
|
||||
pop eax
|
||||
pop ecx
|
||||
jmp MEM_Alloc_Page_Linear_ret
|
||||
MEM_Alloc_Page_Linear_loopend:
|
||||
pop ecx
|
||||
sub ecx,16
|
||||
jns MEM_Alloc_Page_Linear_loop
|
||||
xor eax,eax
|
||||
MEM_Alloc_Page_Linear_ret:
|
||||
call MEM_Heap_UnLock
|
||||
pop ecx
|
||||
ret
|
||||
end if
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;MEM_Free_Page
|
||||
;;Remove reference and free page if number of
|
||||
;;references is equal to 0
|
||||
;;Parameters:
|
||||
;; eax - physical address of page
|
||||
;;Result:
|
||||
;; eax - 1 success
|
||||
;; eax - 0 failed
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
if used MEM_Free_Page
|
||||
MEM_Free_Page:
|
||||
test eax,eax
|
||||
jz MEM_Free_Page_Zero
|
||||
test eax,0xFFF
|
||||
jnz MEM_Free_Page_Not_Aligned
|
||||
push ebx
|
||||
push ecx
|
||||
push edx
|
||||
call MEM_Heap_Lock
|
||||
mov ecx,[MEM_heap_count]
|
||||
dec ecx
|
||||
shl ecx,4
|
||||
MEM_Free_Page_Heap_loop:
|
||||
sub eax,[MEM_heap_block+ecx+.heap_physical_address]
|
||||
js MEM_Free_Page_Heap_loopnext
|
||||
cmp eax,[MEM_heap_block+ecx+.heap_block_size]
|
||||
jl MEM_Free_Page_Heap_loopend
|
||||
MEM_Free_Page_Heap_loopnext:
|
||||
add eax,[MEM_heap_block+ecx+.heap_physical_address]
|
||||
sub ecx,16
|
||||
jns MEM_Free_Page_Heap_loop
|
||||
xor eax,eax
|
||||
inc eax
|
||||
jmp MEM_Free_Page_ret
|
||||
MEM_Free_Page_Heap_loopend:
|
||||
mov ecx,[MEM_heap_block+ecx+.heap_linear_address]
|
||||
mov ebx,eax
|
||||
add eax,ecx
|
||||
shr ebx,10
|
||||
mov edx,[ecx+.range_info+ebx]
|
||||
test edx,0x80000000
|
||||
jnz MEM_Free_Page_Bucket
|
||||
test dx,dx
|
||||
jz MEM_Free_Page_Error
|
||||
dec word [ecx+.range_info+ebx]
|
||||
jnz MEM_Free_Page_OK
|
||||
MEM_Free_Page_Bucket:
|
||||
push dword [ecx]
|
||||
mov [ecx],eax
|
||||
pop dword [eax]
|
||||
mov dword [ecx+.range_info+ebx],0
|
||||
MEM_Free_Page_OK:
|
||||
mov eax,1
|
||||
MEM_Free_Page_ret:
|
||||
call MEM_Heap_UnLock
|
||||
pop edx
|
||||
pop ecx
|
||||
pop ebx
|
||||
ret
|
||||
MEM_Free_Page_Error:
|
||||
xor eax,eax
|
||||
jmp MEM_Free_Page_ret
|
||||
MEM_Free_Page_Zero:
|
||||
inc eax
|
||||
ret
|
||||
MEM_Free_Page_Not_Aligned:
|
||||
xor eax,eax
|
||||
ret
|
||||
end if
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;MEM_Free_Page_Linear
|
||||
;;Remove reference and free page if number of
|
||||
;;references is equal to 0
|
||||
;;Parameters:
|
||||
;; eax - linear address of page
|
||||
;;Result:
|
||||
;; eax - 1 success
|
||||
;; eax - 0 failed
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
if used MEM_Free_Page_Linear
|
||||
MEM_Free_Page_Linear:
|
||||
test eax,eax
|
||||
jz MEM_Free_Page_Linear_Zero
|
||||
test eax,0xFFF
|
||||
jnz MEM_Free_Page_Linear_Not_Aligned
|
||||
push ebx
|
||||
push ecx
|
||||
push edx
|
||||
call MEM_Heap_Lock
|
||||
mov ecx,[MEM_heap_count]
|
||||
dec ecx
|
||||
shl ecx,4
|
||||
|
||||
MEM_Free_Page_Linear_Heap_loop:
|
||||
sub eax,[MEM_heap_block+ecx+.heap_linear_address]
|
||||
js MEM_Free_Page_Linear_Heap_loopnext
|
||||
cmp eax,[MEM_heap_block+ecx+.heap_block_size]
|
||||
jl MEM_Free_Page_Linear_Heap_loopend
|
||||
MEM_Free_Page_Linear_Heap_loopnext:
|
||||
add eax,[MEM_heap_block+ecx+.heap_linear_address]
|
||||
sub ecx,16
|
||||
jns MEM_Free_Page_Linear_Heap_loop
|
||||
xor eax,eax
|
||||
inc eax
|
||||
jmp MEM_Free_Page_Linear_ret
|
||||
|
||||
MEM_Free_Page_Linear_Heap_loopend:
|
||||
mov ecx,[MEM_heap_block+ecx+.heap_linear_address]
|
||||
mov ebx,eax
|
||||
add eax,ecx
|
||||
shr ebx,10
|
||||
mov edx,[ecx+.range_info+ebx]
|
||||
test edx,0x80000000
|
||||
jnz MEM_Free_Page_Linear_Bucket
|
||||
test dx,dx
|
||||
jz MEM_Free_Page_Linear_Error
|
||||
dec word [ecx+.range_info+ebx]
|
||||
jnz MEM_Free_Page_Linear_OK
|
||||
MEM_Free_Page_Linear_Bucket:
|
||||
mov edx,[ecx]
|
||||
mov [eax],edx
|
||||
mov dword [eax+4],0
|
||||
mov [ecx],eax
|
||||
test edx,edx
|
||||
jz MEM_Free_Page_No_Next
|
||||
mov [edx+4],eax
|
||||
MEM_Free_Page_No_Next:
|
||||
mov dword [ecx+.range_info+ebx],0
|
||||
MEM_Free_Page_Linear_OK:
|
||||
xor eax, eax
|
||||
inc eax
|
||||
MEM_Free_Page_Linear_ret:
|
||||
call MEM_Heap_UnLock
|
||||
pop edx
|
||||
pop ecx
|
||||
pop ebx
|
||||
ret
|
||||
|
||||
MEM_Free_Page_Linear_Error:
|
||||
xor eax,eax
|
||||
jmp MEM_Free_Page_Linear_ret
|
||||
|
||||
MEM_Free_Page_Linear_Zero:
|
||||
inc eax
|
||||
ret
|
||||
|
||||
MEM_Free_Page_Linear_Not_Aligned:
|
||||
xor eax,eax
|
||||
ret
|
||||
end if
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;MEM_Alloc_Pages
|
||||
;;Allocates set of pages.
|
||||
;;Parameters:
|
||||
;; eax - number of pages
|
||||
;; ebx - buffer for physical addresses
|
||||
;;Result:
|
||||
;; eax - number of allocated pages
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
if used MEM_Alloc_Pages
|
||||
MEM_Alloc_Pages:
|
||||
push eax
|
||||
push ebx
|
||||
push ecx
|
||||
mov ecx,eax
|
||||
test ecx,ecx
|
||||
jz MEM_Alloc_Pages_ret
|
||||
MEM_Alloc_Pages_loop:
|
||||
call MEM_Alloc_Page
|
||||
test eax,eax
|
||||
jz MEM_Alloc_Pages_ret
|
||||
mov [ebx],eax
|
||||
add ebx,4
|
||||
dec ecx
|
||||
jnz MEM_Alloc_Pages_loop
|
||||
MEM_Alloc_Pages_ret:
|
||||
sub [esp+8],ecx
|
||||
pop ecx
|
||||
pop ebx
|
||||
pop eax
|
||||
ret
|
||||
end if
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;MEM_Alloc_Pages_Linear
|
||||
;;Allocates set of pages.
|
||||
;;Parameters:
|
||||
;; eax - number of pages
|
||||
;; ebx - buffer for linear addresses
|
||||
;;Result:
|
||||
;; eax - number of allocated pages
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
if used MEM_Alloc_Pages_Linear
|
||||
MEM_Alloc_Pages_Linear:
|
||||
push eax
|
||||
push ebx
|
||||
push ecx
|
||||
mov ecx,eax
|
||||
test ecx,ecx
|
||||
jz MEM_Alloc_Pages_Linear_ret
|
||||
MEM_Alloc_Pages_Linear_loop:
|
||||
call MEM_Alloc_Page_Linear
|
||||
test eax,eax
|
||||
jz MEM_Alloc_Pages_Linear_ret
|
||||
mov [ebx],eax
|
||||
add ebx,4
|
||||
dec ecx
|
||||
jnz MEM_Alloc_Pages_Linear_loop
|
||||
MEM_Alloc_Pages_Linear_ret:
|
||||
sub [esp+8],ecx
|
||||
pop ecx
|
||||
pop ebx
|
||||
pop eax
|
||||
ret
|
||||
end if
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;MEM_Free_Pages
|
||||
;;Parameters:
|
||||
;; eax - number of pages
|
||||
;; ebx - array of addresses
|
||||
;;Result:
|
||||
;; eax=1 - succcess
|
||||
;; eax=0 - failed
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
if used MEM_Free_Pages
|
||||
MEM_Free_Pages:
|
||||
push ebx
|
||||
push ecx
|
||||
mov ecx,eax
|
||||
test ecx,ecx
|
||||
jz MEM_Free_Pages_ret
|
||||
MEM_Free_Pages_loop:
|
||||
mov eax,[ebx]
|
||||
call MEM_Free_Page
|
||||
add ebx,4
|
||||
test eax,eax
|
||||
jz MEM_Free_Pages_ret
|
||||
dec ecx
|
||||
jnz MEM_Free_Pages_loop
|
||||
MEM_Free_Pages_ret:
|
||||
pop ecx
|
||||
pop ebx
|
||||
ret
|
||||
end if
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;MEM_Free_Pages_Linear
|
||||
;;Parameters:
|
||||
;; eax - number of pages
|
||||
;; ebx - array of addresses
|
||||
;;Result:
|
||||
;; eax=1 - succcess
|
||||
;; eax=0 - failed
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
if used MEM_Free_Pages_Linear
|
||||
MEM_Free_Pages_Linear:
|
||||
push ebx
|
||||
push ecx
|
||||
mov ecx,eax
|
||||
test ecx,ecx
|
||||
jz MEM_Free_Pages_Linear_ret
|
||||
MEM_Free_Pages_Linear_loop:
|
||||
mov eax,[ebx]
|
||||
call MEM_Free_Page_Linear
|
||||
add ebx,4
|
||||
test eax,eax
|
||||
jz MEM_Free_Pages_Linear_ret
|
||||
dec ecx
|
||||
jnz MEM_Free_Pages_Linear_loop
|
||||
MEM_Free_Pages_Linear_ret:
|
||||
pop ecx
|
||||
pop ebx
|
||||
ret
|
||||
end if
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;MEM_Get_Heap_Number
|
||||
;;Calculate number of heap which pointer belongs to.
|
||||
;;Parameter:
|
||||
;; eax - address
|
||||
;;Result:
|
||||
;; ecx - number of heap*16.
|
||||
;; eax=0 if address not found.
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
if used MEM_Get_Heap_Number
|
||||
MEM_Get_Heap_Number:
|
||||
call MEM_Heap_Lock
|
||||
mov ecx,[MEM_heap_count]
|
||||
dec ecx
|
||||
shl ecx,4
|
||||
MEM_Get_Heap_loop:
|
||||
sub eax,[MEM_heap_block+ecx+.heap_physical_address]
|
||||
jl MEM_Get_Heap_loopnext
|
||||
cmp eax,[MEM_heap_block+ecx+.heap_block_size]
|
||||
jl MEM_Get_Heap_loopend
|
||||
MEM_Get_Heap_loopnext:
|
||||
add eax,[MEM_heap_block+ecx+.heap_physical_address]
|
||||
sub ecx,16
|
||||
jns MEM_Get_Heap_loop
|
||||
call MEM_Heap_UnLock
|
||||
xor eax,eax
|
||||
ret
|
||||
MEM_Get_Heap_loopend:
|
||||
add eax,[MEM_heap_block+ecx+.heap_physical_address]
|
||||
call MEM_Heap_UnLock
|
||||
ret
|
||||
end if
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;MEM_Get_Heap_Number_Linear
|
||||
;;Calculate number of heap which pointer belongs to.
|
||||
;;Parameter:
|
||||
;; eax - address
|
||||
;;Result:
|
||||
;; ecx - number of heap*16.
|
||||
;; eax=0 if address not found.
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
if used MEM_Get_Heap_Number_Linear
|
||||
MEM_Get_Heap_Number_Linear:
|
||||
call MEM_Heap_Lock
|
||||
mov ecx,[MEM_heap_count]
|
||||
dec ecx
|
||||
shl ecx,4
|
||||
MEM_Get_Heap_Linear_loop:
|
||||
sub eax,[MEM_heap_block+ecx+.heap_linear_address]
|
||||
jl MEM_Get_Heap_Linear_loopnext
|
||||
cmp eax,[MEM_heap_block+ecx+.heap_block_size]
|
||||
jl MEM_Get_Heap_Linear_loopend
|
||||
MEM_Get_Heap_Linear_loopnext:
|
||||
add eax,[MEM_heap_block+ecx+.heap_linear_address]
|
||||
sub ecx,16
|
||||
jns MEM_Get_Heap_Linear_loop
|
||||
call MEM_Heap_UnLock
|
||||
xor eax,eax
|
||||
ret
|
||||
MEM_Get_Heap_Linear_loopend:
|
||||
add eax,[MEM_heap_block+ecx+.heap_linear_address]
|
||||
call MEM_Heap_UnLock
|
||||
ret
|
||||
end if
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;MEM_Alloc
|
||||
;;Allocate small region.
|
||||
;;Parameters:
|
||||
;; eax - size (0<eax<=4096)
|
||||
;;Result:
|
||||
;; eax - linear address
|
||||
;; eax=0 - not enough memory
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
if used MEM_Alloc
|
||||
MEM_Alloc:
|
||||
;find chain
|
||||
test eax,eax
|
||||
jng MEM_Alloc_Wrong_Size
|
||||
cmp eax,4096
|
||||
jg MEM_Alloc_Wrong_Size
|
||||
push ebx
|
||||
push ecx
|
||||
push edx
|
||||
push esi
|
||||
dec eax
|
||||
shr eax,4
|
||||
xor edx,edx
|
||||
MEM_Alloc_Find_Size:
|
||||
add edx,4
|
||||
shr eax,1
|
||||
jnz MEM_Alloc_Find_Size
|
||||
MEM_Alloc_Size_Found:
|
||||
mov ecx,edx
|
||||
shr ecx,2
|
||||
add ecx,4
|
||||
mov eax,1
|
||||
shl eax,cl
|
||||
mov esi,eax
|
||||
;esi - block size
|
||||
;edx - offset
|
||||
call MEM_Heap_Lock
|
||||
mov ecx,[MEM_heap_count]
|
||||
dec ecx
|
||||
shl ecx,4
|
||||
MEM_Alloc_Find_Heap:
|
||||
mov eax,[MEM_heap_block+ecx+.heap_linear_address]
|
||||
cmp dword [eax+edx],0
|
||||
jnz MEM_Alloc_Use_Existing
|
||||
sub ecx,16
|
||||
jns MEM_Alloc_Find_Heap
|
||||
;create new bucket page
|
||||
call MEM_Alloc_Page_Linear
|
||||
call MEM_Get_Heap_Number_Linear
|
||||
mov ecx,[MEM_heap_block+ecx+.heap_linear_address]
|
||||
mov [ecx+edx],eax
|
||||
lea ebx,[eax+4096]
|
||||
MEM_Alloc_List_loop:
|
||||
mov [eax],eax
|
||||
mov [eax+4],eax
|
||||
add [eax],esi
|
||||
sub [eax+4],esi
|
||||
add eax,esi
|
||||
cmp eax,ebx
|
||||
jnz MEM_Alloc_List_loop
|
||||
sub ebx,esi
|
||||
mov dword [ebx],0
|
||||
sub eax,4096
|
||||
mov dword [eax+4],0
|
||||
mov eax,ecx
|
||||
|
||||
MEM_Alloc_Use_Existing:
|
||||
mov ebx,eax
|
||||
mov eax,[eax+edx]
|
||||
mov ecx,[eax]
|
||||
mov [ebx+edx],ecx
|
||||
test ecx,ecx
|
||||
jz MEM_Alloc_Became_Empty
|
||||
mov dword [ecx+4],0
|
||||
MEM_Alloc_Became_Empty:
|
||||
mov ecx,eax
|
||||
sub ecx,ebx
|
||||
shr ecx,10
|
||||
and ecx,0xFFFFFFFC
|
||||
inc byte [ebx+.range_info+ecx+2]
|
||||
shr edx,2
|
||||
add edx,128
|
||||
dec edx
|
||||
mov [ebx+.range_info+ecx+3],dl
|
||||
|
||||
MEM_Alloc_ret:
|
||||
call MEM_Heap_UnLock
|
||||
pop esi
|
||||
pop edx
|
||||
pop ecx
|
||||
pop ebx
|
||||
ret
|
||||
MEM_Alloc_Wrong_Size:
|
||||
xor eax,eax
|
||||
ret
|
||||
end if
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;MEM_Free
|
||||
;;Parameters:
|
||||
;; eax - linear address
|
||||
;;Result:
|
||||
;; eax=1 - success
|
||||
;; eax=0 - failed
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
if used MEM_Free
|
||||
MEM_Free:
|
||||
test eax,eax
|
||||
jz MEM_Free_Zero
|
||||
push ebx
|
||||
push ecx
|
||||
push edx
|
||||
push esi
|
||||
push edi
|
||||
push ebp
|
||||
call MEM_Heap_Lock
|
||||
call MEM_Get_Heap_Number_Linear
|
||||
test eax,eax
|
||||
jz MEM_Free_ret
|
||||
mov edx,eax
|
||||
mov ecx,[MEM_heap_block+ecx+.heap_linear_address]
|
||||
sub edx,ecx
|
||||
shr edx,10
|
||||
and edx,0xFFFFFFFC
|
||||
mov ebx,[ecx+.range_info+edx]
|
||||
mov esi,ebx
|
||||
shr esi,24
|
||||
sub esi,128
|
||||
mov edi,[ecx+4+4*esi]
|
||||
mov [eax],edi
|
||||
mov dword [eax+4],0
|
||||
test edi,edi
|
||||
jz MEM_Free_Empty_List
|
||||
mov [edi+4],eax
|
||||
MEM_Free_Empty_List:
|
||||
mov [ecx+4+4*esi],eax
|
||||
sub ebx,0x10000
|
||||
mov [ecx+.range_info+edx],ebx
|
||||
test ebx,0xFF0000
|
||||
jnz MEM_Free_ret
|
||||
;delete empty blocks on the page
|
||||
lea edx,[esi+5]
|
||||
and eax,0xFFFFF000
|
||||
mov edi,eax
|
||||
mov eax,1
|
||||
xchg ecx,edx
|
||||
shl eax,cl
|
||||
mov ecx,edx
|
||||
mov edx,eax
|
||||
;edx - size of block
|
||||
;edi - start of page
|
||||
mov eax,edi
|
||||
lea ebx,[eax+4096]
|
||||
MEM_Free_Block_loop:
|
||||
cmp dword [eax+4],0
|
||||
jnz MEM_Free_Block_Not_First
|
||||
mov ebp,dword [eax]
|
||||
mov [ecx+4+4*esi],ebp
|
||||
test ebp,ebp
|
||||
jz MEM_Free_Block_Last
|
||||
mov dword [ebp+4],0
|
||||
MEM_Free_Block_Last:
|
||||
jmp MEM_Free_Block_loop_end
|
||||
MEM_Free_Block_Not_First:
|
||||
mov ebp,dword [eax]
|
||||
push ebp
|
||||
mov ebp,dword [eax+4]
|
||||
pop dword [ebp]
|
||||
mov ebp,dword [eax]
|
||||
test ebp,ebp
|
||||
jz MEM_Free_Block_loop_end
|
||||
push dword [eax+4]
|
||||
pop dword [ebp+4]
|
||||
; jmp MEM_Free_Block_loop_end
|
||||
MEM_Free_Block_loop_end:
|
||||
add eax,edx
|
||||
cmp eax,ebx
|
||||
jnz MEM_Free_Block_loop
|
||||
mov eax,edi
|
||||
call MEM_Free_Page_Linear
|
||||
MEM_Free_ret:
|
||||
call MEM_Heap_UnLock
|
||||
pop ebp
|
||||
pop edi
|
||||
pop esi
|
||||
pop edx
|
||||
pop ecx
|
||||
pop ebx
|
||||
ret
|
||||
MEM_Free_Zero:
|
||||
inc eax
|
||||
ret
|
||||
end if
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;MEM_Add_Reference
|
||||
;; eax - physical address of page
|
||||
;;Result:
|
||||
;; eax=1 - success
|
||||
;; eax=0 - failed
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
if used MEM_Add_Reference
|
||||
MEM_Add_Reference:
|
||||
push ebx
|
||||
push ecx
|
||||
call MEM_Heap_Lock
|
||||
call MEM_Get_Heap_Number
|
||||
test eax,eax
|
||||
jz MEM_Add_Reference_ret
|
||||
sub eax,[MEM_heap_block+ecx+.heap_physical_address]
|
||||
mov ecx,[MEM_heap_block+ecx+.heap_linear_address]
|
||||
shr eax,10
|
||||
and eax,0xFFFFFFFC
|
||||
test dword [ecx+eax+.range_info],0x80000000
|
||||
jnz MEM_Add_Reference_failed
|
||||
inc dword [ecx+eax+.range_info]
|
||||
MEM_Add_Reference_ret:
|
||||
call MEM_Heap_UnLock
|
||||
pop ecx
|
||||
pop ebx
|
||||
ret
|
||||
MEM_Add_Reference_failed:
|
||||
xor eax,eax
|
||||
jmp MEM_Add_Reference_ret
|
||||
end if
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;MEM_Add_Reference_Linear
|
||||
;; eax - linear address of page
|
||||
;;Result:
|
||||
;; eax=1 - success
|
||||
;; eax=0 - failed
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
if used MEM_Add_Reference_Linear
|
||||
MEM_Add_Reference_Linear:
|
||||
push ebx
|
||||
push ecx
|
||||
call MEM_Heap_Lock
|
||||
call MEM_Get_Heap_Number_Linear
|
||||
test eax,eax
|
||||
jz MEM_Add_Reference_Linear_ret
|
||||
mov ecx,[MEM_heap_block+ecx+.heap_linear_address]
|
||||
sub eax,ecx
|
||||
shr eax,10
|
||||
and eax,0xFFFFFFFC
|
||||
test dword [ecx+eax+.range_info],0x80000000
|
||||
jnz MEM_Add_Reference_Linear_failed
|
||||
inc dword [ecx+eax+.range_info]
|
||||
mov eax,1
|
||||
MEM_Add_Reference_Linear_ret:
|
||||
call MEM_Heap_UnLock
|
||||
pop ecx
|
||||
pop ebx
|
||||
ret
|
||||
MEM_Add_Reference_Linear_failed:
|
||||
xor eax,eax
|
||||
jmp MEM_Add_Reference_Linear_ret
|
||||
end if
|
||||
end if ;memmanager.inc
|
1357
kernel/tags/kolibri0.5.2.1/core/newproce.inc
Normal file
218
kernel/tags/kolibri0.5.2.1/core/physmem.inc
Normal file
@@ -0,0 +1,218 @@
|
||||
virtual at 0
|
||||
physical_mem_block:
|
||||
.start rd 1
|
||||
.size rd 1
|
||||
.flags rd 1 ;0-free, pid-used.
|
||||
.sizeof:
|
||||
end virtual
|
||||
max_physical_mem_blocks = 24
|
||||
uglobal
|
||||
num_physical_mem_blocks rd 1
|
||||
physical_mem_blocks rd 3*max_physical_mem_blocks
|
||||
endg
|
||||
Init_Physical_Memory_Manager:
|
||||
pushad
|
||||
mov edi,physical_mem_blocks
|
||||
mov ecx,3*max_physical_mem_blocks
|
||||
xor eax,eax
|
||||
cld
|
||||
rep stosd
|
||||
mov dword [num_physical_mem_blocks],2
|
||||
mov [physical_mem_blocks+physical_mem_block.start],0x60000
|
||||
mov [physical_mem_blocks+physical_mem_block.size],0x20000 ;128Kb
|
||||
mov [physical_mem_blocks+physical_mem_block.sizeof+physical_mem_block.start],0x780000
|
||||
mov [physical_mem_blocks+physical_mem_block.sizeof+physical_mem_block.size],0x80000 ;512Kb
|
||||
popad
|
||||
ret
|
||||
Insert_Block:
|
||||
;input:
|
||||
; eax - handle
|
||||
;output:
|
||||
; none
|
||||
push eax ecx esi edi
|
||||
sub eax,[num_physical_mem_blocks]
|
||||
neg eax
|
||||
mov edi,physical_mem_block.sizeof
|
||||
imul eax,edi
|
||||
shr eax,2
|
||||
mov ecx,eax
|
||||
mov esi,[num_physical_mem_blocks]
|
||||
imul esi,edi
|
||||
add esi,physical_mem_blocks
|
||||
lea edi,[esi+physical_mem_block.sizeof]
|
||||
std
|
||||
rep movsd
|
||||
pop edi esi ecx eax
|
||||
ret
|
||||
Delete_Block:
|
||||
;input:
|
||||
; eax - handle
|
||||
;output:
|
||||
; none
|
||||
pushad
|
||||
mov edi,eax
|
||||
sub eax,[num_physical_mem_blocks]
|
||||
neg eax
|
||||
dec eax
|
||||
mov esi,physical_mem_block.sizeof
|
||||
imul eax,esi
|
||||
imul edi,esi
|
||||
add edi,physical_mem_blocks
|
||||
lea esi,[edi+physical_mem_block.sizeof]
|
||||
mov ecx,eax
|
||||
shr ecx,2
|
||||
cld
|
||||
rep movsd
|
||||
popad
|
||||
ret
|
||||
Allocate_Physical_Block:
|
||||
;input:
|
||||
; eax - size
|
||||
;output:
|
||||
; eax - address or 0 if not enough memory.
|
||||
pushad
|
||||
cmp [num_physical_mem_blocks],max_physical_mem_blocks
|
||||
jge .error
|
||||
mov ebx,eax
|
||||
xor eax,eax
|
||||
mov esi,physical_mem_blocks
|
||||
.loop:
|
||||
cmp dword [esi+physical_mem_block.flags],0
|
||||
jnz .next
|
||||
cmp [esi+physical_mem_block.size],ebx
|
||||
jg .addblock
|
||||
jz .noaddblock
|
||||
.next:
|
||||
inc eax
|
||||
add esi,physical_mem_block.sizeof
|
||||
cmp eax,[num_physical_mem_blocks]
|
||||
jl .loop
|
||||
.error:
|
||||
popad
|
||||
xor eax,eax
|
||||
ret
|
||||
.noaddblock:
|
||||
mov eax,[esi+physical_mem_block.start]
|
||||
mov [esp+28],eax
|
||||
mov eax,[0x3010]
|
||||
mov eax,[eax+0x4]
|
||||
mov [esi+physical_mem_block.flags],eax
|
||||
popad
|
||||
ret
|
||||
.addblock:
|
||||
call Insert_Block
|
||||
inc dword [num_physical_mem_blocks]
|
||||
mov eax,[esi+physical_mem_block.start]
|
||||
mov [esp+28],eax
|
||||
mov ecx,[0x3010]
|
||||
mov ecx,[ecx+0x4]
|
||||
mov [esi+physical_mem_block.flags],ecx
|
||||
mov ecx,[esi+physical_mem_block.size]
|
||||
mov [esi+physical_mem_block.size],ebx
|
||||
sub ecx,ebx
|
||||
mov [esi+physical_mem_block.sizeof+physical_mem_block.size],ecx
|
||||
add ebx,[esi+physical_mem_block.start]
|
||||
mov [esi+physical_mem_block.sizeof+physical_mem_block.start],ebx
|
||||
mov dword [esi+physical_mem_block.sizeof+physical_mem_block.flags],0
|
||||
popad
|
||||
ret
|
||||
Free_Physical_Block:
|
||||
;input:
|
||||
; eax - address
|
||||
;output:
|
||||
; none
|
||||
pushad
|
||||
test eax,eax
|
||||
jz .ret
|
||||
mov ebx,eax
|
||||
xor eax,eax
|
||||
mov esi,physical_mem_blocks
|
||||
.loop:
|
||||
cmp ebx,[esi+physical_mem_block.start]
|
||||
jz .endloop
|
||||
inc eax
|
||||
add esi,physical_mem_block.sizeof
|
||||
cmp eax,[num_physical_mem_blocks]
|
||||
jl .loop
|
||||
jmp .ret
|
||||
.endloop:
|
||||
mov dword [esi+physical_mem_block.flags],0
|
||||
test eax,eax
|
||||
jz .no_union_previous
|
||||
cmp dword [esi-physical_mem_block.sizeof+physical_mem_block.flags],0
|
||||
jnz .no_union_previous
|
||||
mov ebx,[esi-physical_mem_block.sizeof+physical_mem_block.start]
|
||||
add ebx,[esi-physical_mem_block.sizeof+physical_mem_block.size]
|
||||
cmp ebx,[esi+physical_mem_block.start]
|
||||
jnz .no_union_previous
|
||||
mov ebx,[esi+physical_mem_block.size]
|
||||
add [esi-physical_mem_block.sizeof+physical_mem_block.size],ebx
|
||||
call Delete_Block
|
||||
dec eax
|
||||
dec [num_physical_mem_blocks]
|
||||
.no_union_previous:
|
||||
inc eax
|
||||
cmp eax,[num_physical_mem_blocks]
|
||||
jge .no_union_next
|
||||
cmp dword [esi+physical_mem_block.sizeof+physical_mem_block.flags],0
|
||||
jnz .no_union_next
|
||||
mov ebx,[esi+physical_mem_block.start]
|
||||
add ebx,[esi+physical_mem_block.size]
|
||||
cmp ebx,[esi+physical_mem_block.sizeof+physical_mem_block.start]
|
||||
jnz .no_union_next
|
||||
mov ebx,[esi+physical_mem_block.sizeof+physical_mem_block.size]
|
||||
add [esi+physical_mem_block.size],ebx
|
||||
call Delete_Block
|
||||
dec [num_physical_mem_blocks]
|
||||
.no_union_next:
|
||||
.ret:
|
||||
popad
|
||||
ret
|
||||
|
||||
sys_allocate_physical_block:
|
||||
;eax - subfunction number
|
||||
mov eax,ebx
|
||||
call Allocate_Physical_Block
|
||||
mov [esp+36],eax
|
||||
ret
|
||||
sys_free_physical_block:
|
||||
;eax - subfunction number
|
||||
mov eax,ebx
|
||||
call Free_Physical_Block
|
||||
ret
|
||||
sys_set_buffer:
|
||||
add ecx,std_application_base_address
|
||||
isys_set_buffer: ;for using in kernel
|
||||
;eax - subfunction number
|
||||
;ebx - physical address
|
||||
;ecx - buffer start
|
||||
;edx - buffer size
|
||||
lea edi,[ebx+second_base_address]
|
||||
mov esi,ecx
|
||||
mov ecx,edx
|
||||
rep movsb
|
||||
ret
|
||||
sys_get_buffer:
|
||||
add ecx,std_application_base_address
|
||||
isys_get_buffer: ;for using in kernel
|
||||
;eax - subfunction number
|
||||
;ebx - physical address
|
||||
;ecx - buffer start
|
||||
;edx - buffer size
|
||||
mov edi,ecx
|
||||
lea esi,[ebx+second_base_address]
|
||||
mov ecx,edx
|
||||
rep movsb
|
||||
ret
|
||||
sys_internal_services:
|
||||
cmp eax,4
|
||||
jle sys_sheduler
|
||||
cmp eax,5
|
||||
jz sys_allocate_physical_block
|
||||
cmp eax,6
|
||||
jz sys_free_physical_block
|
||||
cmp eax,7
|
||||
jz sys_set_buffer
|
||||
cmp eax,8
|
||||
jz sys_get_buffer
|
||||
ret
|
151
kernel/tags/kolibri0.5.2.1/core/sched.inc
Normal file
@@ -0,0 +1,151 @@
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; IRQ0 HANDLER (TIMER INTERRUPT) ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
align 32
|
||||
irq0:
|
||||
pushad
|
||||
push ds es
|
||||
mov ax, os_data
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
|
||||
mov edi,[0x3000]
|
||||
shl edi, 3
|
||||
; fields of TSS descriptor:
|
||||
mov [edi+gdts+ tss0 +5], word 01010000b *256 +11101001b
|
||||
|
||||
inc dword [timer_ticks]
|
||||
|
||||
mov eax, [timer_ticks]
|
||||
call playNote ; <<<--- Speaker driver
|
||||
|
||||
cmp eax,[next_usage_update]
|
||||
jb .nocounter
|
||||
add eax,100
|
||||
mov [next_usage_update],eax
|
||||
call updatecputimes
|
||||
.nocounter:
|
||||
|
||||
mov edi, [0x3010]
|
||||
|
||||
mov ebx, [edi+0x18] ; time stamp counter add
|
||||
call _rdtsc
|
||||
sub eax, ebx
|
||||
add eax, [edi+0x14] ; counter sum
|
||||
mov [edi+0x14], eax
|
||||
|
||||
mov ebx,[0x3000]
|
||||
mov [prev_slot], ebx
|
||||
|
||||
cmp [0xffff], byte 1
|
||||
je .do_not_change_task
|
||||
|
||||
|
||||
.waiting_for_termination:
|
||||
.waiting_for_reuse:
|
||||
.waiting_for_event:
|
||||
cmp ebx, [0x3004]
|
||||
jb @f
|
||||
mov edi, 0x3000
|
||||
xor ebx, ebx
|
||||
@@:
|
||||
|
||||
add edi,0x20
|
||||
inc ebx
|
||||
|
||||
mov al, byte [edi+0xA]
|
||||
cmp al, 3
|
||||
je .waiting_for_termination
|
||||
cmp al, 4
|
||||
je .waiting_for_termination
|
||||
cmp al, 9
|
||||
je .waiting_for_reuse
|
||||
|
||||
mov [0x3000],ebx
|
||||
mov [0x3010],edi
|
||||
|
||||
cmp al, 5
|
||||
jne .noevents
|
||||
call get_event_for_app
|
||||
test eax, eax
|
||||
jz .waiting_for_event
|
||||
mov [event_sched], eax
|
||||
mov [edi+0xA], byte 0
|
||||
.noevents:
|
||||
cmp ebx, [prev_slot]
|
||||
sete [0xffff]
|
||||
|
||||
|
||||
.do_not_change_task:
|
||||
|
||||
call _rdtsc
|
||||
mov [edi+0x18],eax
|
||||
|
||||
shl ebx, 3
|
||||
xor eax, eax
|
||||
add ebx, tss0
|
||||
mov word [far_jump.sel], bx ; selector
|
||||
mov dword [far_jump.offs], eax ; offset
|
||||
|
||||
mov al,0x20 ; send End Of Interrupt signal
|
||||
mov dx,0x20
|
||||
out dx,al
|
||||
|
||||
cmp [0xffff],byte 0
|
||||
je .switch
|
||||
dec byte [0xffff]
|
||||
jz @f
|
||||
.switch:
|
||||
jmp pword [far_jump]
|
||||
inc [context_counter] ;noname & halyavin
|
||||
@@:
|
||||
|
||||
pop es ds
|
||||
popad
|
||||
iret
|
||||
|
||||
|
||||
uglobal
|
||||
align 4
|
||||
far_jump:
|
||||
.offs dd ?
|
||||
.sel dw ?
|
||||
context_counter dd ? ;noname & halyavin
|
||||
next_usage_update dd ?
|
||||
timer_ticks dd ?
|
||||
prev_slot dd ?
|
||||
event_sched dd ?
|
||||
endg
|
||||
|
||||
|
||||
align 4
|
||||
change_task:
|
||||
|
||||
mov [0xffff],byte 2
|
||||
|
||||
dec dword [timer_ticks] ; because irq0 will increase it
|
||||
|
||||
int 0x20 ; irq0 handler
|
||||
|
||||
ret
|
||||
|
||||
|
||||
|
||||
align 4
|
||||
updatecputimes:
|
||||
|
||||
mov eax,[idleuse]
|
||||
mov [idleusesec],eax
|
||||
mov [idleuse],dword 0
|
||||
mov ecx, [0x3004]
|
||||
mov edi, 0x3020
|
||||
.newupdate:
|
||||
mov ebx,[edi+0x14]
|
||||
mov [edi+0x1c],ebx
|
||||
mov [edi+0x14],dword 0
|
||||
add edi,0x20
|
||||
dec ecx
|
||||
jnz .newupdate
|
||||
|
||||
ret
|
111
kernel/tags/kolibri0.5.2.1/core/sync.inc
Normal file
@@ -0,0 +1,111 @@
|
||||
if ~defined sync_inc
|
||||
sync_inc_fix:
|
||||
sync_inc fix sync_inc_fix
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;Synhronization for MenuetOS. ;;
|
||||
;;Author: Halyavin Andrey, halyavin@land.ru ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;simplest mutex.
|
||||
macro SimpleMutex name
|
||||
{
|
||||
; iglobal
|
||||
name dd 0
|
||||
name#.type = 1
|
||||
; endg
|
||||
}
|
||||
macro WaitSimpleMutex name
|
||||
{
|
||||
local start_wait,ok
|
||||
start_wait=$
|
||||
cli
|
||||
cmp [name],dword 0
|
||||
jz ok
|
||||
sti
|
||||
call change_task
|
||||
jmp start_wait
|
||||
ok=$
|
||||
push eax
|
||||
mov eax,dword [0x3010+second_base_address]
|
||||
mov eax,[eax+0x4]
|
||||
mov [name],eax
|
||||
pop eax
|
||||
sti
|
||||
}
|
||||
macro ReleaseSimpleMutex name
|
||||
{
|
||||
mov [name],dword 0
|
||||
}
|
||||
macro TryWaitSimpleMutex name ;result in eax and in flags
|
||||
{
|
||||
local ok,try_end
|
||||
cmp [name],dword 0
|
||||
jz ok
|
||||
xor eax,eax
|
||||
jmp try_end
|
||||
ok=$
|
||||
xor eax,eax
|
||||
inc eax
|
||||
try_end=$
|
||||
}
|
||||
macro SimpleCriticalSection name
|
||||
{
|
||||
; iglobal
|
||||
name dd 0
|
||||
dd 0
|
||||
name#.type=2
|
||||
; endg
|
||||
}
|
||||
macro WaitSimpleCriticalSection name
|
||||
{
|
||||
local start_wait,first_wait,inc_counter,end_wait
|
||||
push eax
|
||||
mov eax,[0x3010+second_base_address]
|
||||
mov eax,[eax+0x4]
|
||||
start_wait=$
|
||||
cli
|
||||
cmp [name],dword 0
|
||||
jz first_wait
|
||||
cmp [name],eax
|
||||
jz inc_counter
|
||||
sti
|
||||
call change_task
|
||||
jmp start_wait
|
||||
first_wait=$
|
||||
mov [name],eax
|
||||
mov [name+4],dword 1
|
||||
jmp end_wait
|
||||
inc_counter=$
|
||||
inc dword [name+4]
|
||||
end_wait=$
|
||||
sti
|
||||
pop eax
|
||||
}
|
||||
macro ReleaseSimpleCriticalSection name
|
||||
{
|
||||
local release_end
|
||||
dec dword [name+4]
|
||||
jnz release_end
|
||||
mov [name],dword 0
|
||||
release_end=$
|
||||
}
|
||||
macro TryWaitSimpleCriticalSection name ;result in eax and in flags
|
||||
{
|
||||
local ok,try_end
|
||||
mov eax,[0x3000+second_base_address]
|
||||
mov eax,[eax+0x4]
|
||||
cmp [name],eax
|
||||
jz ok
|
||||
cmp [name],0
|
||||
jz ok
|
||||
xor eax,eax
|
||||
jmp try_end
|
||||
ok=$
|
||||
xor eax,eax
|
||||
inc eax
|
||||
try_end=$
|
||||
}
|
||||
_cli equ call MEM_HeapLock
|
||||
_sti equ call MEM_HeapUnLock
|
||||
end if
|
||||
|
872
kernel/tags/kolibri0.5.2.1/core/sys32.inc
Normal file
@@ -0,0 +1,872 @@
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; MenuetOS process management, protected ring3 ;;
|
||||
;; ;;
|
||||
;; Distributed under GPL. See file COPYING for details. ;;
|
||||
;; Copyright 2003 Ville Turjanmaa ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
align 32
|
||||
|
||||
; GDT TABLE
|
||||
|
||||
gdts:
|
||||
|
||||
dw gdte-$-1
|
||||
dd gdts
|
||||
dw 0
|
||||
|
||||
int_code_l:
|
||||
os_code_l:
|
||||
|
||||
dw 0xffff
|
||||
dw 0x0000
|
||||
db 0x00
|
||||
dw 11011111b *256 +10011010b
|
||||
db 0x00
|
||||
|
||||
int_data_l:
|
||||
os_data_l:
|
||||
|
||||
dw 0xffff
|
||||
dw 0x0000
|
||||
db 0x00
|
||||
dw 11011111b *256 +10010010b
|
||||
db 0x00
|
||||
|
||||
app_code_l:
|
||||
dw ((0x80000000-std_application_base_address) shr 12) and 0xffff
|
||||
dw 0
|
||||
db 0
|
||||
dw 11010000b*256+11111010b+256*((0x80000000-std_application_base_address) shr 28)
|
||||
db std_application_base_address shr 24
|
||||
|
||||
app_data_l:
|
||||
dw (0x80000000-std_application_base_address) shr 12 and 0xffff
|
||||
dw 0
|
||||
db 0
|
||||
dw 11010000b*256+11110010b+256*((0x80000000-std_application_base_address) shr 28)
|
||||
db std_application_base_address shr 24
|
||||
|
||||
graph_data_l:
|
||||
|
||||
dw 0x3ff
|
||||
dw 0x0000
|
||||
db 0x00
|
||||
dw 11010000b *256 +11110010b
|
||||
db 0x00
|
||||
|
||||
tss0_l:
|
||||
times (max_processes+10) dd 0,0
|
||||
|
||||
gdte:
|
||||
|
||||
|
||||
|
||||
idtreg:
|
||||
dw 8*0x41-1
|
||||
dd idts+8
|
||||
label idts at 0xB100-8
|
||||
|
||||
|
||||
|
||||
uglobal
|
||||
tss_sceleton:
|
||||
l.back dw 0,0
|
||||
l.esp0 dd 0
|
||||
l.ss0 dw 0,0
|
||||
l.esp1 dd 0
|
||||
l.ss1 dw 0,0
|
||||
l.esp2 dd 0
|
||||
l.ss2 dw 0,0
|
||||
l.cr3 dd 0
|
||||
l.eip dd 0
|
||||
l.eflags dd 0
|
||||
l.eax dd 0
|
||||
l.ecx dd 0
|
||||
l.edx dd 0
|
||||
l.ebx dd 0
|
||||
l.esp dd 0
|
||||
l.ebp dd 0
|
||||
l.esi dd 0
|
||||
l.edi dd 0
|
||||
l.es dw 0,0
|
||||
l.cs dw 0,0
|
||||
l.ss dw 0,0
|
||||
l.ds dw 0,0
|
||||
l.fs dw 0,0
|
||||
l.gs dw 0,0
|
||||
l.ldt dw 0,0
|
||||
l.trap dw 0
|
||||
l.io dw 0
|
||||
endg
|
||||
|
||||
|
||||
build_process_gdt_tss_pointer:
|
||||
|
||||
mov ecx,tss_data
|
||||
mov edi,0
|
||||
setgdtl2:
|
||||
mov [edi+gdts+ tss0 +0], word tss_step
|
||||
mov [edi+gdts+ tss0 +2], cx
|
||||
mov eax,ecx
|
||||
shr eax,16
|
||||
mov [edi+gdts+ tss0 +4], al
|
||||
mov [edi+gdts+ tss0 +7], ah
|
||||
mov [edi+gdts+ tss0 +5], word 01010000b *256 +11101001b
|
||||
add ecx,tss_step
|
||||
add edi,8
|
||||
cmp edi,8*(max_processes+5)
|
||||
jbe setgdtl2
|
||||
|
||||
ret
|
||||
|
||||
|
||||
build_interrupt_table:
|
||||
|
||||
mov edi, idts+8
|
||||
mov esi, sys_int
|
||||
mov ecx, 0x40
|
||||
@@:
|
||||
mov eax, [esi]
|
||||
mov [edi], ax ; lower part of offset
|
||||
mov [edi+2], word os_code ; segment selector
|
||||
shr eax, 16
|
||||
mov [edi+4], word 10001110b shl 8 ; interrupt descriptor
|
||||
mov [edi+6], ax
|
||||
add esi, 4
|
||||
add edi, 8
|
||||
dec ecx
|
||||
jnz @b
|
||||
|
||||
;mov edi,8*0x40+idts+8
|
||||
mov [edi + 0], word (i40 and ((1 shl 16)-1))
|
||||
mov [edi + 2], word os_code
|
||||
mov [edi + 4], word 11101110b*256
|
||||
mov [edi + 6], word (i40 shr 16)
|
||||
|
||||
ret
|
||||
|
||||
|
||||
|
||||
iglobal
|
||||
sys_int:
|
||||
dd e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15
|
||||
dd e16,e17
|
||||
times 14 dd unknown_interrupt
|
||||
|
||||
dd irq0 ,irq1 ,p_irq2 ,p_irq3 ,p_irq4 ,p_irq5,p_irq6 ,p_irq7
|
||||
dd p_irq8,p_irq9,p_irq10,p_irq11,p_irq12,irqD ,p_irq14,p_irq15
|
||||
|
||||
times 16 dd unknown_interrupt
|
||||
|
||||
dd i40
|
||||
endg
|
||||
|
||||
; simply return control to interrupted process
|
||||
unknown_interrupt:
|
||||
iret
|
||||
|
||||
macro exc_wo_code [num]
|
||||
{
|
||||
forward
|
||||
e#num :
|
||||
mov bl, num
|
||||
jmp exc_c
|
||||
}
|
||||
|
||||
macro exc_w_code [num]
|
||||
{
|
||||
forward
|
||||
e#num :
|
||||
add esp, 4
|
||||
mov bl, num
|
||||
jmp exc_c
|
||||
}
|
||||
|
||||
exc_wo_code 0, 1, 2, 3, 4, 5, 6, 9, 15, 16 ; 18, 19
|
||||
exc_w_code 8, 10, 11, 12, 13, 14, 17
|
||||
|
||||
exc_c:
|
||||
mov ax, os_data
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
|
||||
movzx eax, bl
|
||||
mov [error_interrupt], eax
|
||||
call show_error_parameters
|
||||
|
||||
mov edx, [0x3010]
|
||||
mov [edx + 0xA], byte 4
|
||||
|
||||
jmp change_task
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; FPU ERROR HANDLER ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
align 4
|
||||
e7:
|
||||
clts
|
||||
|
||||
push eax
|
||||
push ds es
|
||||
|
||||
mov ax, os_data
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
|
||||
mov eax, [prev_user_of_fpu]
|
||||
shl eax, 8
|
||||
add eax, 0x80000 + 0x10
|
||||
fsave [eax]
|
||||
|
||||
mov eax, [0x3000]
|
||||
mov [prev_user_of_fpu], eax
|
||||
shl eax, 8
|
||||
add eax, 0x80000
|
||||
cmp [eax + 0x7f], byte 0
|
||||
je @f
|
||||
frstor [eax+0x10]
|
||||
@@:
|
||||
mov [eax + 0x7f], byte 1
|
||||
|
||||
pop es ds
|
||||
pop eax
|
||||
|
||||
iret
|
||||
|
||||
iglobal
|
||||
prev_user_of_fpu dd 1
|
||||
endg
|
||||
|
||||
|
||||
writehex:
|
||||
pusha
|
||||
|
||||
mov edi, [write_error_to]
|
||||
mov esi, 8
|
||||
@@:
|
||||
mov ecx, eax
|
||||
and ecx, 0xf
|
||||
|
||||
mov cl,[ecx+hexletters]
|
||||
mov [edi],cl
|
||||
dec edi
|
||||
|
||||
shr eax,4
|
||||
dec esi
|
||||
jnz @b
|
||||
|
||||
popa
|
||||
ret
|
||||
|
||||
iglobal
|
||||
hexletters db '0123456789ABCDEF'
|
||||
|
||||
error_interrupt dd -1
|
||||
|
||||
process_error db 'K : Process - forced terminate INT: 00000000',13,10,0
|
||||
process_pid db 'K : Process - forced terminate PID: 00000000',13,10,0
|
||||
process_eip db 'K : Process - forced terminate EIP: 00000000',13,10,0
|
||||
system_error db 'K : Kernel error',13,10,0
|
||||
endg
|
||||
|
||||
uglobal
|
||||
write_error_to dd 0x0
|
||||
endg
|
||||
|
||||
show_error_parameters:
|
||||
|
||||
mov [write_error_to],process_pid+43
|
||||
mov eax,[0x3000]
|
||||
shl eax, 5
|
||||
mov eax,[0x3000+4+eax]
|
||||
call writehex
|
||||
|
||||
mov [write_error_to],process_error+43
|
||||
mov eax,[error_interrupt]
|
||||
call writehex
|
||||
|
||||
cmp dword [esp+4+4], os_code ; CS
|
||||
jnz @f
|
||||
mov esi,system_error
|
||||
call sys_msg_board_str
|
||||
@@:
|
||||
mov eax, [esp+4] ; EIP
|
||||
|
||||
mov [write_error_to],process_eip+43
|
||||
call writehex
|
||||
|
||||
mov esi,process_error
|
||||
call sys_msg_board_str
|
||||
|
||||
mov esi,process_pid
|
||||
call sys_msg_board_str
|
||||
|
||||
mov esi,process_eip
|
||||
call sys_msg_board_str
|
||||
|
||||
ret
|
||||
|
||||
|
||||
|
||||
; irq1 -> hid/keyboard.inc
|
||||
|
||||
|
||||
macro irqh [num]
|
||||
{
|
||||
forward
|
||||
p_irq#num :
|
||||
pushad
|
||||
mov edi, num
|
||||
jmp irq_c
|
||||
}
|
||||
|
||||
irqh 2,3,4,5,7,8,9,10,11,12,14,15
|
||||
|
||||
irq_c:
|
||||
push ds es
|
||||
mov ax, os_data
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
call irqhandler
|
||||
pop es ds
|
||||
popad
|
||||
iret
|
||||
|
||||
p_irq6:
|
||||
pushad
|
||||
push ds es
|
||||
mov ax, os_data
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
call fdc_irq
|
||||
|
||||
mov [check_idle_semaphore],5
|
||||
mov al, 0x20
|
||||
out 0x20, al
|
||||
|
||||
pop es ds
|
||||
popad
|
||||
iret
|
||||
|
||||
irqD:
|
||||
pushad
|
||||
push ds es
|
||||
mov ax, os_data
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
|
||||
mov dx,0xf0
|
||||
mov al,0
|
||||
out dx,al
|
||||
|
||||
mov dx,0xa0
|
||||
mov al,0x20
|
||||
out dx,al
|
||||
mov dx,0x20
|
||||
out dx,al
|
||||
|
||||
pop es ds
|
||||
popad
|
||||
iret
|
||||
|
||||
|
||||
irqhandler:
|
||||
|
||||
push edi
|
||||
|
||||
mov esi,edi ; 1
|
||||
shl esi,6 ; 1
|
||||
add esi,irq00read ; 1
|
||||
shl edi,12 ; 1
|
||||
add edi,0x2E0000
|
||||
|
||||
mov [check_idle_semaphore],5
|
||||
|
||||
irqnewread:
|
||||
|
||||
mov dx,[esi] ; 2+
|
||||
|
||||
cmp dx,0 ; 1
|
||||
jz irqover
|
||||
cmp [esi+3],byte 1 ; 2 ; byte read
|
||||
jne noirqbyte ; 4-11
|
||||
|
||||
in al,dx
|
||||
|
||||
mov edx,[edi]
|
||||
cmp edx,4000
|
||||
je irqfull
|
||||
mov ebx,edi
|
||||
add ebx,0x10
|
||||
add ebx,edx
|
||||
mov [ebx],al
|
||||
inc edx
|
||||
mov [edi],edx
|
||||
|
||||
add esi,4
|
||||
jmp irqnewread
|
||||
|
||||
noirqbyte:
|
||||
|
||||
|
||||
cmp [esi+3],byte 2 ; word read
|
||||
jne noirqword
|
||||
|
||||
in ax,dx
|
||||
|
||||
mov edx,[edi]
|
||||
cmp edx,4000
|
||||
je irqfull
|
||||
mov ebx,edi
|
||||
add ebx,0x10
|
||||
add ebx,edx
|
||||
mov [ebx],ax
|
||||
add edx,2
|
||||
mov [edi],edx
|
||||
add esi,4
|
||||
jmp irqnewread
|
||||
|
||||
noirqword:
|
||||
irqfull:
|
||||
irqover:
|
||||
|
||||
mov al,0x20 ; ready for next irq
|
||||
out 0x20,al
|
||||
|
||||
pop ebx
|
||||
cmp ebx,7
|
||||
jbe noa0
|
||||
out 0xa0,al
|
||||
noa0:
|
||||
|
||||
ret
|
||||
|
||||
|
||||
|
||||
set_application_table_status:
|
||||
push eax
|
||||
|
||||
mov eax,[0x3000]
|
||||
shl eax, 5
|
||||
add eax,0x3000+4
|
||||
mov eax,[eax]
|
||||
|
||||
mov [application_table_status],eax
|
||||
|
||||
pop eax
|
||||
|
||||
ret
|
||||
|
||||
|
||||
clear_application_table_status:
|
||||
push eax
|
||||
|
||||
mov eax,[0x3000]
|
||||
shl eax, 5
|
||||
add eax,0x3000+4
|
||||
mov eax,[eax]
|
||||
|
||||
cmp eax,[application_table_status]
|
||||
jne apptsl1
|
||||
mov [application_table_status],0
|
||||
apptsl1:
|
||||
|
||||
pop eax
|
||||
|
||||
ret
|
||||
|
||||
|
||||
|
||||
sys_resize_app_memory:
|
||||
; eax = 1 - resize
|
||||
; ebx = new amount of memory
|
||||
|
||||
cmp eax,1
|
||||
jne .no_application_mem_resize
|
||||
|
||||
jmp new_mem_resize ;resize for new type of processes
|
||||
|
||||
|
||||
.no_application_mem_resize:
|
||||
|
||||
ret
|
||||
|
||||
|
||||
|
||||
get_app_params:
|
||||
|
||||
push eax
|
||||
|
||||
cmp [0x90000+6],word '00'
|
||||
jne no_00_header
|
||||
|
||||
mov eax,[0x90000+12]
|
||||
mov [app_start],eax
|
||||
mov eax,[0x90000+16]
|
||||
mov [app_i_end],eax
|
||||
mov eax,[0x90000+20]
|
||||
mov [app_mem],eax
|
||||
shr eax,1
|
||||
sub eax,0x10
|
||||
mov [app_esp],eax
|
||||
mov eax,[0x90000+24]
|
||||
mov [app_i_param],eax
|
||||
mov [app_i_icon],dword 0
|
||||
|
||||
pop eax
|
||||
mov esi,1
|
||||
ret
|
||||
|
||||
no_00_header:
|
||||
|
||||
|
||||
cmp [0x90000+6],word '01'
|
||||
jne no_01_header
|
||||
|
||||
mov eax,[0x90000+12]
|
||||
mov [app_start],eax
|
||||
mov eax,[0x90000+16]
|
||||
mov [app_i_end],eax
|
||||
mov eax,[0x90000+20]
|
||||
mov [app_mem],eax
|
||||
mov eax,[0x90000+24]
|
||||
mov [app_esp],eax
|
||||
mov eax,[0x90000+28]
|
||||
mov [app_i_param],eax
|
||||
mov eax,[0x90000+32]
|
||||
mov [app_i_icon],eax
|
||||
|
||||
pop eax
|
||||
mov esi,1
|
||||
ret
|
||||
|
||||
no_01_header:
|
||||
|
||||
pop eax
|
||||
mov esi,0
|
||||
ret
|
||||
|
||||
|
||||
start_application_fl:
|
||||
jmp new_start_application_fl
|
||||
|
||||
;************************************************************************
|
||||
|
||||
start_application_floppy:
|
||||
jmp new_start_application_floppy
|
||||
|
||||
;********************************************************************
|
||||
|
||||
start_application_hd:
|
||||
jmp new_start_application_hd
|
||||
|
||||
uglobal
|
||||
new_process_place dd 0x0
|
||||
app_start dd 0x0
|
||||
app_i_end dd 0x0
|
||||
app_mem dd 0x0
|
||||
app_esp dd 0x0
|
||||
app_i_param dd 0x0
|
||||
app_i_icon dd 0x0
|
||||
app_mem_pos dd 0x0
|
||||
appl_path dd 0x0
|
||||
appl_path_size dd 0x0
|
||||
endg
|
||||
|
||||
iglobal
|
||||
hd_app_string db 'HDAPP '
|
||||
process_loading db 'K : Process - loading ',13,10,0
|
||||
process_running db 'K : Process - done',13,10,0
|
||||
first_gdt_search dd 0x2
|
||||
endg
|
||||
|
||||
|
||||
sys_threads:
|
||||
|
||||
; eax=1 create thread
|
||||
;
|
||||
; ebx=thread start
|
||||
; ecx=thread stack value
|
||||
;
|
||||
; on return : eax = pid
|
||||
jmp new_sys_threads
|
||||
|
||||
iglobal
|
||||
process_terminating db 'K : Process - terminating',13,10,0
|
||||
process_terminated db 'K : Process - done',13,10,0
|
||||
endg
|
||||
|
||||
|
||||
terminate: ; terminate application
|
||||
push esi
|
||||
mov esi,process_terminating
|
||||
call sys_msg_board_str
|
||||
pop esi
|
||||
|
||||
cli
|
||||
cmp [application_table_status],0
|
||||
je term9
|
||||
sti
|
||||
call change_task
|
||||
jmp terminate
|
||||
term9:
|
||||
|
||||
call set_application_table_status
|
||||
|
||||
mov eax,esi
|
||||
call dispose_app_cr3_table
|
||||
|
||||
cmp [prev_user_of_fpu],esi ; if user fpu last -> fpu user = 1
|
||||
jne fpu_ok_1
|
||||
mov [prev_user_of_fpu],1
|
||||
fpu_ok_1:
|
||||
|
||||
mov [0xf400],byte 0 ; empty keyboard buffer
|
||||
mov [0xf500],byte 0 ; empty button buffer
|
||||
|
||||
|
||||
mov ecx,esi ; remove buttons
|
||||
bnewba2:
|
||||
mov edi,[0xfe88]
|
||||
mov eax,edi
|
||||
cld
|
||||
movzx ebx,word [edi]
|
||||
inc bx
|
||||
bnewba:
|
||||
dec bx
|
||||
jz bnmba
|
||||
add eax,0x10
|
||||
cmp cx,[eax]
|
||||
jnz bnewba
|
||||
pusha
|
||||
mov ecx,ebx
|
||||
inc ecx
|
||||
shl ecx,4
|
||||
mov ebx,eax
|
||||
add eax,0x10
|
||||
call memmove
|
||||
dec dword [edi]
|
||||
popa
|
||||
jmp bnewba2
|
||||
bnmba:
|
||||
|
||||
pusha ; save window coordinates for window restoring
|
||||
cld
|
||||
shl esi,5
|
||||
add esi,window_data
|
||||
mov ax,[esi+0]
|
||||
mov word [dlx],ax
|
||||
mov bx,[esi+8]
|
||||
add ax,bx
|
||||
mov word [dlxe],ax
|
||||
mov ax,[esi+4]
|
||||
mov word [dly],ax
|
||||
mov bx,[esi+12]
|
||||
add ax,bx
|
||||
mov word [dlye],ax
|
||||
mov [esi+0],word 0
|
||||
mov [esi+8],word 5
|
||||
mov ax,[0xFE04]
|
||||
mov [esi+4],ax
|
||||
mov [esi+12],word 5
|
||||
xor eax, eax
|
||||
mov [esi+16],eax;dword 0
|
||||
mov [esi+20],eax;dword 0
|
||||
mov [esi+24],eax;dword 0
|
||||
mov [esi+28],eax;dword 0
|
||||
popa
|
||||
|
||||
pusha
|
||||
mov edi,esi
|
||||
shl edi,5
|
||||
add edi,window_data
|
||||
mov ecx,32/4
|
||||
xor eax, eax
|
||||
; cld
|
||||
rep stosd
|
||||
|
||||
mov eax,[0xFE04] ; set window to start from maxy+1
|
||||
add eax,2
|
||||
|
||||
mov edi,esi
|
||||
shl edi,5
|
||||
add edi,window_data
|
||||
mov [edi+4],eax
|
||||
|
||||
popa
|
||||
|
||||
pusha
|
||||
mov edi,esi
|
||||
shl edi,5
|
||||
add edi,draw_data
|
||||
mov ecx,32/4
|
||||
xor eax, eax
|
||||
; cld
|
||||
rep stosd
|
||||
popa
|
||||
|
||||
pusha ; at 0x80000+
|
||||
mov edi,esi
|
||||
shl edi,8
|
||||
add edi,0x80000
|
||||
mov ecx,256/4
|
||||
xor eax, eax
|
||||
; cld
|
||||
rep stosd
|
||||
popa
|
||||
|
||||
pusha ; name to spaces
|
||||
mov edi,esi
|
||||
shl edi,8
|
||||
add edi,0x80000
|
||||
mov ecx,11
|
||||
mov eax,' '
|
||||
; cld
|
||||
rep stosb
|
||||
popa
|
||||
|
||||
pusha ; C000 --> C400
|
||||
mov eax, 0xc000
|
||||
mov esi, 0
|
||||
nlc40:
|
||||
add eax, 2
|
||||
inc esi
|
||||
cmp esi, [0x3004]
|
||||
jae nlc41
|
||||
movzx ecx, word [eax]
|
||||
mov [0xC400 + ecx*2], si
|
||||
jmp nlc40
|
||||
nlc41:
|
||||
popa
|
||||
|
||||
pusha ; remove hd1 reservation
|
||||
mov edx,esi
|
||||
shl edx, 5 ;imul edx,0x20
|
||||
add edx,0x3000
|
||||
mov edx,[edx+4]
|
||||
cmp [hd1_status],edx
|
||||
jne no_hd1_s_remove
|
||||
mov [hd1_status],0
|
||||
no_hd1_s_remove:
|
||||
popa
|
||||
|
||||
pusha ; remove all irq reservations
|
||||
mov edx,esi
|
||||
shl edx, 5 ;imul edx,0x20
|
||||
add edx,0x3000
|
||||
mov edx,[edx+4]
|
||||
mov edi,irq_owner
|
||||
mov ecx,16
|
||||
newirqfree:
|
||||
cmp [edi],edx
|
||||
jne nofreeirq
|
||||
mov [edi],dword 0
|
||||
nofreeirq:
|
||||
add edi,4
|
||||
loop newirqfree
|
||||
popa
|
||||
|
||||
|
||||
pusha ; remove all port reservations
|
||||
|
||||
mov edx,esi
|
||||
shl edx, 5 ;imul edx,0x20
|
||||
add edx,0x3000
|
||||
mov edx,[edx+4]
|
||||
|
||||
rmpr0:
|
||||
|
||||
mov esi,[0x2d0000]
|
||||
|
||||
cmp esi,0
|
||||
je rmpr9
|
||||
|
||||
rmpr3:
|
||||
|
||||
mov edi,esi
|
||||
shl edi,4
|
||||
add edi,0x2d0000
|
||||
|
||||
cmp edx,[edi]
|
||||
je rmpr4
|
||||
|
||||
dec esi
|
||||
jnz rmpr3
|
||||
|
||||
jmp rmpr9
|
||||
|
||||
rmpr4:
|
||||
|
||||
mov ecx,256
|
||||
sub ecx,esi
|
||||
shl ecx,4
|
||||
|
||||
mov esi,edi
|
||||
add esi,16
|
||||
cld
|
||||
rep movsb
|
||||
|
||||
dec dword [0x2d0000]
|
||||
|
||||
jmp rmpr0
|
||||
|
||||
rmpr9:
|
||||
|
||||
popa
|
||||
mov edi,esi ; do not run this process slot
|
||||
shl edi, 5
|
||||
mov [edi+0x300A],byte 9
|
||||
; call systest
|
||||
sti ; .. and life goes on
|
||||
|
||||
; movzx eax,word [dlx]
|
||||
; movzx ebx,word [dly]
|
||||
; movzx ecx,word [dlxe]
|
||||
; movzx edx,word [dlye]
|
||||
call calculatescreen
|
||||
|
||||
xor eax, eax
|
||||
xor esi, esi
|
||||
call redrawscreen
|
||||
|
||||
mov [0xfff4],byte 0 ; no mouse background
|
||||
mov [0xfff5],byte 0 ; draw mouse
|
||||
|
||||
mov [application_table_status],0
|
||||
|
||||
mov esi,process_terminated
|
||||
call sys_msg_board_str
|
||||
|
||||
;* start code - fix error redraw for terminate (2) - Mario79
|
||||
; cmp [draw_present],1
|
||||
; je no_draw_background_temp
|
||||
; mov [0xfff0],byte 1
|
||||
;no_draw_background_temp:
|
||||
; mov [draw_present],0
|
||||
ret
|
||||
;draw_present db 0
|
||||
;* end code - fix error redraw for terminate (2) - Mario79
|
||||
|
||||
iglobal
|
||||
boot_sched_1 db 'Building gdt tss pointer',0
|
||||
boot_sched_2 db 'Building IDT table',0
|
||||
endg
|
||||
|
||||
|
||||
build_scheduler:
|
||||
|
||||
mov esi,boot_sched_1
|
||||
call boot_log
|
||||
call build_process_gdt_tss_pointer
|
||||
|
||||
mov esi,boot_sched_2
|
||||
call boot_log
|
||||
call build_interrupt_table
|
||||
|
||||
ret
|
||||
|
144
kernel/tags/kolibri0.5.2.1/core/syscall.inc
Normal file
@@ -0,0 +1,144 @@
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; SYSTEM CALL ENTRY ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
align 32
|
||||
i40:
|
||||
push ds es
|
||||
pushad
|
||||
|
||||
mov ax,word os_data
|
||||
mov ds,ax
|
||||
mov es,ax
|
||||
|
||||
; for syscall trace function
|
||||
call save_registers
|
||||
|
||||
; load all registers in crossed order
|
||||
mov edi,[esp+28] ; eax
|
||||
mov eax,[esp+16] ; ebx
|
||||
mov ebx,[esp+24] ; ecx
|
||||
mov ecx,[esp+20] ; edx
|
||||
mov edx,[esp+4] ; esi
|
||||
mov esi,[esp+0] ; edi
|
||||
|
||||
; enable interupts - a task switch or an IRQ _CAN_ interrupt i40 handler
|
||||
sti
|
||||
push eax
|
||||
and edi,0xff
|
||||
call dword [servetable+edi*4]
|
||||
pop eax
|
||||
cli
|
||||
|
||||
popad
|
||||
pop es ds
|
||||
iretd
|
||||
|
||||
align 4
|
||||
save_registers:
|
||||
mov esi, [0x3010]
|
||||
mov eax, [esi+0x4] ; load PID
|
||||
lea esi, [esp+4]
|
||||
inc [save_syscall_count]
|
||||
mov edi,[save_syscall_count]
|
||||
and edi,0xF
|
||||
shl edi,6
|
||||
add edi,save_syscall_data+32
|
||||
mov [edi-32],eax
|
||||
mov ecx,32 / 4
|
||||
cld
|
||||
rep movsd
|
||||
ret
|
||||
|
||||
uglobal
|
||||
save_syscall_count dd 0x0
|
||||
endg
|
||||
|
||||
label save_syscall_data dword at 0x5000
|
||||
|
||||
|
||||
iglobal
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; SYSTEM FUNCTIONS TABLE ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
align 4
|
||||
servetable:
|
||||
|
||||
dd sys_drawwindow ; 0-DrawWindow
|
||||
dd syscall_setpixel ; 1-SetPixel
|
||||
dd sys_getkey ; 2-GetKey
|
||||
dd sys_clock ; 3-GetTime
|
||||
dd syscall_writetext ; 4-WriteText
|
||||
dd delay_hs ; 5-DelayHs
|
||||
dd syscall_openramdiskfile ; 6-OpenRamdiskFile
|
||||
dd syscall_putimage ; 7-PutImage
|
||||
dd sys_button ; 8-DefineButton
|
||||
dd sys_cpuusage ; 9-GetProcessInfo
|
||||
dd sys_waitforevent ; 10-WaitForEvent
|
||||
dd sys_getevent ; 11-CheckForEvent
|
||||
dd sys_redrawstat ; 12-BeginDraw and EndDraw
|
||||
dd syscall_drawrect ; 13-DrawRect
|
||||
dd syscall_getscreensize ; 14-GetScreenSize
|
||||
dd sys_background ; 15-bgr
|
||||
dd sys_cachetodiskette ; 16-FlushFloppyCache
|
||||
dd sys_getbutton ; 17-GetButton
|
||||
dd syscall_system ; 18-Shutdown,KillApp,WindowActivate
|
||||
dd syscall_startapp ; 19-StartApp
|
||||
dd sys_midi ; 20-ResetMidi and OutputMidi
|
||||
dd sys_setup ; 21-SetMidiBase,SetKeymap,SetShiftKeymap,.
|
||||
dd sys_settime ; 22-setting date,time,clock and alarm-clock
|
||||
dd sys_wait_event_timeout ; 23-TimeOutWaitForEvent
|
||||
dd syscall_cdaudio ; 24-PlayCdTrack,StopCd and GetCdPlaylist
|
||||
dd sys_sb16 ; 25-SetSb16
|
||||
dd sys_getsetup ; 26-GetMidiBase,GetKeymap,GetShiftKeymap,.
|
||||
dd sys_wss ; 27-SetWssMainVol and SetWssCdVol
|
||||
dd sys_sb16II ; 28-SetSb16
|
||||
dd sys_date ; 29-GetDate
|
||||
dd syscall_readhd ; 30-ReadHd
|
||||
dd syscall_starthdapp ; 31-StartHdApp
|
||||
dd syscall_delramdiskfile ; 32-DelRamdiskFile
|
||||
dd syscall_writeramdiskfile; 33-WriteRamdiskFile
|
||||
dd read_floppy_file ; 34-ReadFloppyDrive
|
||||
dd syscall_getpixel ; 35-GetPixel
|
||||
dd syscall_readstring ; 36-ReadString (not yet ready)
|
||||
dd readmousepos ; 37-GetMousePosition_ScreenRelative,.
|
||||
dd syscall_drawline ; 38-DrawLine
|
||||
dd sys_getbackground ; 39-GetBackgroundSize,ReadBgrData,.
|
||||
dd set_app_param ; 40-WantEvents
|
||||
dd syscall_getirqowner ; 41-GetIrqOwner
|
||||
dd get_irq_data ; 42-ReadIrqData
|
||||
dd sys_outport ; 43-SendDeviceData
|
||||
dd sys_programirq ; 44-ProgramIrqs
|
||||
dd reserve_free_irq ; 45-ReserveIrq and FreeIrq
|
||||
dd syscall_reserveportarea ; 46-ReservePortArea and FreePortArea
|
||||
dd display_number ; 47-WriteNum
|
||||
dd display_settings ; 48-SetRedrawType and SetButtonType
|
||||
dd syscall_appints ; 49-AppInts
|
||||
dd random_shaped_window ; 50-Window shape & scale
|
||||
dd syscall_threads ; 51-Threads
|
||||
dd stack_driver_stat ; 52-Stack driver status
|
||||
dd socket ; 53-Socket interface
|
||||
dd user_events ; 54-User events
|
||||
dd sound_interface ; 55-Sound interface
|
||||
dd write_to_hd ; 56-Write a file to hd
|
||||
dd delete_from_hd ; 57-Delete a file from hd
|
||||
dd file_system ; 58-Common file system interface
|
||||
dd sys_trace ; 59-System call trace
|
||||
dd new_sys_ipc ; 60-Inter Process Communication
|
||||
dd sys_gs ; 61-Direct graphics access
|
||||
dd sys_pci ; 62-PCI functions
|
||||
dd sys_msg_board ; 63-System message board
|
||||
dd sys_resize_app_memory ; 64-Resize application memory usage
|
||||
dd undefined_syscall ; 65-UTF
|
||||
dd sys_process_def ; 66-Process definitions - keyboard
|
||||
dd sys_window_move ; 67-Window move or resize
|
||||
dd sys_internal_services ; 68-Some internal services
|
||||
|
||||
times 255 - ( ($-servetable) /4 ) dd undefined_syscall
|
||||
|
||||
dd sys_end ; -1-end application
|
||||
endg
|
||||
|
115
kernel/tags/kolibri0.5.2.1/detect/commouse.inc
Normal file
@@ -0,0 +1,115 @@
|
||||
;**************************************************
|
||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
||||
;* COMPortNum <EFBFBD> COMPortBaseAddr <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
||||
;**************************************************
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Mario79
|
||||
|
||||
MSMouseSearch:
|
||||
pusha
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> COM-<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
MouseSearch:
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1200 <EFBFBD><EFBFBD><EFBFBD>
|
||||
mov DX,[COMPortBaseAddr]
|
||||
add DX,3
|
||||
in AL,DX
|
||||
or AL,80h ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> DLAB
|
||||
out DX,AL
|
||||
mov DX,[COMPortBaseAddr]
|
||||
mov AL,60h ;1200 <EFBFBD><EFBFBD><EFBFBD>
|
||||
out DX,AL
|
||||
inc DX
|
||||
mov AL,0
|
||||
out DX,AL
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 7 <EFBFBD><EFBFBD><EFBFBD>, 1 <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>,
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov DX,[COMPortBaseAddr]
|
||||
add DX,3
|
||||
mov AL,00000010b
|
||||
out DX,AL
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov DX,[COMPortBaseAddr]
|
||||
inc DX
|
||||
mov AL,0
|
||||
out DX,AL
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> MSMouse
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov DX,[COMPortBaseAddr]
|
||||
add DX,4 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov AL,0 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> DTR, RTS <EFBFBD> OUT2
|
||||
out DX,AL
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 5 "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" (0,2 <EFBFBD>)
|
||||
mov ecx,0xffff
|
||||
dT_1:
|
||||
dec ecx
|
||||
cmp ecx,0
|
||||
jne dT_1
|
||||
mov ecx,0xffff
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov AL,11b ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> DTR <EFBFBD> RTS
|
||||
out DX,AL
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov DX,[COMPortBaseAddr]
|
||||
in AL,DX
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
WaitData:
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> 10 "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
||||
dec ecx
|
||||
cmp ecx,0
|
||||
je NoMouse
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov DX,[COMPortBaseAddr]
|
||||
add DX,5
|
||||
in AL,DX
|
||||
test AL,1 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?
|
||||
jz WaitData
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov DX,[COMPortBaseAddr]
|
||||
in AL,DX
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?
|
||||
cmp AL,'M'
|
||||
je EndDetect
|
||||
NoMouse:
|
||||
inc [COMPortNum]
|
||||
cmp [COMPortNum],1
|
||||
ja EndDetect
|
||||
sub [COMPortBaseAddr],100h
|
||||
jmp MouseSearch
|
||||
|
||||
iglobal
|
||||
COMPortBaseAddr dw 3F8h
|
||||
COMPortNum dw 0
|
||||
endg
|
||||
|
||||
iglobal
|
||||
boot_setmouse_type db 'No COM mouse, set PS2',0
|
||||
db 'Detected - COM1 mouse',0
|
||||
db 'Detected - COM2 mouse',0
|
||||
|
||||
endg
|
||||
|
||||
EndDetect:
|
||||
cmp [COMPortNum],0 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0?
|
||||
jl ComMouseNotFound ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
cmp [COMPortNum],1 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1?
|
||||
ja ComMouseNotFound ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov ax,[COMPortNum]
|
||||
add al,2
|
||||
jmp set_detecting_mouse
|
||||
ComMouseNotFound:
|
||||
mov al,1
|
||||
set_detecting_mouse:
|
||||
mov [0xF604],al
|
||||
dec al
|
||||
movzx eax,al
|
||||
imul eax,22
|
||||
mov esi,boot_setmouse_type
|
||||
add esi,eax
|
||||
call boot_log
|
||||
popa
|
||||
|
||||
|
20
kernel/tags/kolibri0.5.2.1/detect/dev_fd.inc
Normal file
@@ -0,0 +1,20 @@
|
||||
;***************************************************
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> FDD
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Mario79
|
||||
;***************************************************
|
||||
xor eax,eax
|
||||
mov edi,0x40000
|
||||
mov ecx,16384
|
||||
cld
|
||||
rep stosd
|
||||
|
||||
mov al,0x10
|
||||
out 0x70,al
|
||||
mov cx,0xff
|
||||
wait_cmos:
|
||||
dec cx
|
||||
cmp cx,0
|
||||
jne wait_cmos
|
||||
in al,0x71
|
||||
mov [0x40000],al
|
374
kernel/tags/kolibri0.5.2.1/detect/dev_hdcd.inc
Normal file
@@ -0,0 +1,374 @@
|
||||
;******************************************************
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> HDD <EFBFBD> CD
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Mario79
|
||||
;******************************************************
|
||||
|
||||
;****************************************************
|
||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> HDD <EFBFBD> CD *
|
||||
;****************************************************
|
||||
FindHDD:
|
||||
mov [ChannelNumber],1
|
||||
mov [DiskNumber],0
|
||||
call FindHDD_3
|
||||
; mov ax,[Sector512+176]
|
||||
; mov [0x40006],ax
|
||||
; mov ax,[Sector512+126]
|
||||
; mov [0x40008],ax
|
||||
; mov ax,[Sector512+128]
|
||||
; mov [0x40008],ax
|
||||
mov [DiskNumber],1
|
||||
call FindHDD_3
|
||||
; mov al,[Sector512+176]
|
||||
; mov [0x40007],al
|
||||
inc [ChannelNumber]
|
||||
mov [DiskNumber],0
|
||||
call FindHDD_3
|
||||
; mov al,[Sector512+176]
|
||||
; mov [0x40008],al
|
||||
mov [DiskNumber],1
|
||||
call FindHDD_1
|
||||
; mov al,[Sector512+176]
|
||||
; mov [0x40009],al
|
||||
|
||||
jmp EndFindHDD
|
||||
|
||||
FindHDD_1:
|
||||
call ReadHDD_ID
|
||||
cmp [DevErrorCode],0
|
||||
jne FindHDD_2
|
||||
cmp [Sector512+6],word 16
|
||||
ja FindHDD_2
|
||||
cmp [Sector512+12],word 255
|
||||
ja FindHDD_2
|
||||
inc byte [0x40001]
|
||||
jmp FindHDD_2_2
|
||||
FindHDD_2:
|
||||
call DeviceReset
|
||||
cmp [DevErrorCode],0
|
||||
jne FindHDD_2_2
|
||||
call ReadCD_ID
|
||||
cmp [DevErrorCode],0
|
||||
jne FindHDD_2_2
|
||||
inc byte [0x40001]
|
||||
inc byte [0x40001]
|
||||
FindHDD_2_2:
|
||||
ret
|
||||
|
||||
FindHDD_3:
|
||||
call FindHDD_1
|
||||
shl byte [0x40001],2
|
||||
ret
|
||||
|
||||
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> LBA
|
||||
SectorAddress DD ?
|
||||
|
||||
;*************************************************
|
||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: *
|
||||
;* ChannelNumber - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (1 <EFBFBD><EFBFBD><EFBFBD> 2); *
|
||||
;* DiskNumber - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (0 <EFBFBD><EFBFBD><EFBFBD> 1). *
|
||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
||||
;* <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Sector512. *
|
||||
;*************************************************
|
||||
ReadHDD_ID:
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> CHS
|
||||
mov [ATAAddressMode],0
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov [ATAFeatures],0
|
||||
mov [ATAHead],0
|
||||
mov [ATACommand],0ECh
|
||||
call SendCommandToHDD
|
||||
cmp [DevErrorCode],0 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
jne @@End ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov DX,[ATABasePortAddr]
|
||||
add DX,7 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov ecx,0xffff
|
||||
@@WaitCompleet:
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
dec ecx
|
||||
cmp ecx,0
|
||||
je @@Error1 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
in AL,DX
|
||||
test AL,80h ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> BSY
|
||||
jnz @@WaitCompleet
|
||||
test AL,1 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ERR
|
||||
jnz @@Error6
|
||||
test AL,08h ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> DRQ
|
||||
jz @@WaitCompleet
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
; mov AX,DS
|
||||
; mov ES,AX
|
||||
mov EDI,Sector512 ;offset Sector512
|
||||
mov DX,[ATABasePortAddr] ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov CX,256 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
rep insw ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
jmp @@End
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
@@Error1:
|
||||
mov [DevErrorCode],1
|
||||
jmp @@End
|
||||
@@Error6:
|
||||
mov [DevErrorCode],6
|
||||
@@End: ret
|
||||
|
||||
|
||||
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1 <EFBFBD> 2
|
||||
StandardATABases DW 1F0h, 170h
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
ChannelNumber DW ?
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
DiskNumber DB ?
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ATA
|
||||
ATABasePortAddr DW ?
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ATA-<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
ATAFeatures DB ? ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
ATASectorCount DB ? ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
ATASectorNumber DB ? ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
ATACylinder DW ? ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
ATAHead DB ? ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
ATAAddressMode DB ? ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (0 - CHS, 1 - LBA)
|
||||
ATACommand DB ? ;<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
; <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (0 - <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, 1 - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, 2 - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
|
||||
; 3 - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, 4 - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
|
||||
; 5 - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, 6 - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
||||
DevErrorCode DB ?
|
||||
|
||||
;****************************************************
|
||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: *
|
||||
;* ChannelNumber - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (1 <EFBFBD><EFBFBD><EFBFBD> 2); *
|
||||
;* DiskNumber - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (0 <EFBFBD><EFBFBD><EFBFBD> 1); *
|
||||
;* ATAFeatures - "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"; *
|
||||
;* ATASectorCount - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>; *
|
||||
;* ATASectorNumber - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>; *
|
||||
;* ATACylinder - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>; *
|
||||
;* ATAHead - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>; *
|
||||
;* ATAAddressMode - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (0-CHS, 1-LBA); *
|
||||
;* ATACommand - <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. *
|
||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: *
|
||||
;* <EFBFBD> ATABasePortAddr - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> HDD; *
|
||||
;* <EFBFBD> DevErrorCode - <EFBFBD><EFBFBD><EFBFBD><EFBFBD>. *
|
||||
;* <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> DevErrorCode <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. *
|
||||
;****************************************************
|
||||
SendCommandToHDD:
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
cmp [ATAAddressMode],1
|
||||
ja @@Err2
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov BX,[ChannelNumber]
|
||||
cmp BX,1
|
||||
jb @@Err3
|
||||
cmp BX,2
|
||||
ja @@Err3
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
dec BX
|
||||
shl BX,1
|
||||
movzx ebx,bx
|
||||
mov AX,[ebx+StandardATABases]
|
||||
mov [ATABasePortAddr],AX
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> HDD <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov DX,[ATABasePortAddr]
|
||||
add DX,6 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov AL,[DiskNumber]
|
||||
cmp AL,1 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
ja @@Err4
|
||||
shl AL,4
|
||||
or AL,10100000b
|
||||
out DX,AL
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
inc DX
|
||||
mov ecx,0xfff
|
||||
; mov eax,[timer_ticks]
|
||||
; mov [TickCounter_1],eax
|
||||
@@WaitHDReady:
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
dec ecx
|
||||
cmp ecx,0
|
||||
je @@Err1
|
||||
; mov eax,[timer_ticks]
|
||||
; sub eax,[TickCounter_1]
|
||||
; cmp eax,300 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 300 <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
; ja @@Err1 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
in AL,DX
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> BSY
|
||||
test AL,80h
|
||||
jnz @@WaitHDReady
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> DRQ
|
||||
test AL,08h
|
||||
jnz @@WaitHDReady
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
cli
|
||||
mov DX,[ATABasePortAddr]
|
||||
inc DX ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
||||
mov AL,[ATAFeatures]
|
||||
out DX,AL
|
||||
inc DX ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov AL,[ATASectorCount]
|
||||
out DX,AL
|
||||
inc DX ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov AL,[ATASectorNumber]
|
||||
out DX,AL
|
||||
inc DX ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
||||
mov AX,[ATACylinder]
|
||||
out DX,AL
|
||||
inc DX ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
||||
mov AL,AH
|
||||
out DX,AL
|
||||
inc DX ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov AL,[DiskNumber]
|
||||
shl AL,4
|
||||
cmp [ATAHead],0Fh ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
ja @@Err5
|
||||
or AL,[ATAHead]
|
||||
or AL,10100000b
|
||||
mov AH,[ATAAddressMode]
|
||||
shl AH,6
|
||||
or AL,AH
|
||||
out DX,AL
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov AL,[ATACommand]
|
||||
inc DX ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
out DX,AL
|
||||
sti
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov [DevErrorCode],0
|
||||
jmp @@End_2
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
@@Err1: mov [DevErrorCode],1
|
||||
jmp @@End_2
|
||||
@@Err2: mov [DevErrorCode],2
|
||||
jmp @@End_2
|
||||
@@Err3: mov [DevErrorCode],3
|
||||
jmp @@End_2
|
||||
@@Err4: mov [DevErrorCode],4
|
||||
jmp @@End_2
|
||||
@@Err5: mov [DevErrorCode],5
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
@@End_2:
|
||||
ret
|
||||
|
||||
;*************************************************
|
||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ATAPI *
|
||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: *
|
||||
;* ChannelNumber - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>; *
|
||||
;* DiskNumber - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. *
|
||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
||||
;* <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Sector512. *
|
||||
;*************************************************
|
||||
ReadCD_ID:
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> CHS
|
||||
mov [ATAAddressMode],0
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov [ATAFeatures],0
|
||||
mov [ATASectorCount],0
|
||||
mov [ATASectorNumber],0
|
||||
mov [ATACylinder],0
|
||||
mov [ATAHead],0
|
||||
mov [ATACommand],0A1h
|
||||
call SendCommandToHDD
|
||||
cmp [DevErrorCode],0 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
jne @@End_1 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> HDD
|
||||
mov DX,[ATABasePortAddr]
|
||||
add DX,7 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1<EFBFBD>7h
|
||||
mov ecx,0xffff
|
||||
@@WaitCompleet_1:
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
dec ecx
|
||||
cmp ecx,0
|
||||
je @@Error1_1 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
in AL,DX
|
||||
test AL,80h ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> BSY
|
||||
jnz @@WaitCompleet_1
|
||||
test AL,1 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ERR
|
||||
jnz @@Error6_1
|
||||
test AL,08h ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> DRQ
|
||||
jz @@WaitCompleet_1
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
; mov AX,DS
|
||||
; mov ES,AX
|
||||
mov EDI,Sector512 ;offset Sector512
|
||||
mov DX,[ATABasePortAddr] ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1x0h
|
||||
mov CX,256 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
rep insw
|
||||
jmp @@End_1
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
@@Error1_1:
|
||||
mov [DevErrorCode],1
|
||||
jmp @@End_1
|
||||
@@Error6_1:
|
||||
mov [DevErrorCode],6
|
||||
@@End_1:
|
||||
ret
|
||||
|
||||
;*************************************************
|
||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> *
|
||||
;* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: *
|
||||
;* ChannelNumber - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (1 <EFBFBD><EFBFBD><EFBFBD> 2); *
|
||||
;* DiskNumber - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (0 <EFBFBD><EFBFBD><EFBFBD> 1). *
|
||||
;*************************************************
|
||||
DeviceReset:
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov BX,[ChannelNumber]
|
||||
cmp BX,1
|
||||
jb @@Err3_2
|
||||
cmp BX,2
|
||||
ja @@Err3_2
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
dec BX
|
||||
shl BX,1
|
||||
movzx ebx,bx
|
||||
mov DX,[ebx+StandardATABases]
|
||||
mov [ATABasePortAddr],DX
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
add DX,6 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov AL,[DiskNumber]
|
||||
cmp AL,1 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
ja @@Err4_2
|
||||
shl AL,4
|
||||
or AL,10100000b
|
||||
out DX,AL
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
||||
mov AL,08h
|
||||
inc DX ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
out DX,AL
|
||||
mov ecx,0xffff
|
||||
@@WaitHDReady_1:
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
dec ecx
|
||||
cmp ecx,0
|
||||
je @@Err1_2 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
in AL,DX
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> BSY
|
||||
test AL,80h
|
||||
jnz @@WaitHDReady_1
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
mov [DevErrorCode],0
|
||||
jmp @@End_3
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
@@Err1_2: mov [DevErrorCode],1
|
||||
jmp @@End_3
|
||||
@@Err3_2: mov [DevErrorCode],3
|
||||
jmp @@End_3
|
||||
@@Err4_2: mov [DevErrorCode],4
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
@@End_3:
|
||||
ret
|
||||
|
||||
EndFindHDD:
|
||||
|
4
kernel/tags/kolibri0.5.2.1/detect/disks.inc
Normal file
@@ -0,0 +1,4 @@
|
||||
include 'dev_fd.inc'
|
||||
include 'dev_hdcd.inc'
|
||||
include 'sear_par.inc'
|
||||
|
118
kernel/tags/kolibri0.5.2.1/detect/sear_par.inc
Normal file
@@ -0,0 +1,118 @@
|
||||
;****************************************************
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> HDD
|
||||
; <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Mario79
|
||||
;****************************************************
|
||||
mov [transfer_adress],0x4000a
|
||||
search_partitions_ide0:
|
||||
test [0x40001],byte 0x40
|
||||
jz search_partitions_ide1
|
||||
mov [hdbase],0x1f0
|
||||
mov [hdid],0x0
|
||||
mov [hdpos],1
|
||||
mov [fat32part],1
|
||||
search_partitions_ide0_1:
|
||||
call set_FAT32_variables
|
||||
cmp [problem_partition],0
|
||||
jne search_partitions_ide1
|
||||
inc byte [0x40002]
|
||||
call partition_data_transfer
|
||||
add [transfer_adress],100
|
||||
inc [fat32part]
|
||||
jmp search_partitions_ide0_1
|
||||
|
||||
search_partitions_ide1:
|
||||
test [0x40001],byte 0x10
|
||||
jz search_partitions_ide2
|
||||
mov [hdbase],0x1f0
|
||||
mov [hdid],0x10
|
||||
mov [hdpos],2
|
||||
mov [fat32part],1
|
||||
search_partitions_ide1_1:
|
||||
call set_FAT32_variables
|
||||
cmp [problem_partition],0
|
||||
jne search_partitions_ide2
|
||||
inc byte [0x40003]
|
||||
call partition_data_transfer
|
||||
add [transfer_adress],100
|
||||
inc [fat32part]
|
||||
jmp search_partitions_ide1_1
|
||||
|
||||
search_partitions_ide2:
|
||||
test [0x40001],byte 0x4
|
||||
jz search_partitions_ide3
|
||||
mov [hdbase],0x170
|
||||
mov [hdid],0x0
|
||||
mov [hdpos],3
|
||||
mov [fat32part],1
|
||||
search_partitions_ide2_1:
|
||||
call set_FAT32_variables
|
||||
cmp [problem_partition],0
|
||||
jne search_partitions_ide3
|
||||
inc byte [0x40004]
|
||||
call partition_data_transfer
|
||||
add [transfer_adress],100
|
||||
inc [fat32part]
|
||||
jmp search_partitions_ide2_1
|
||||
|
||||
search_partitions_ide3:
|
||||
test [0x40001],byte 0x1
|
||||
jz end_search_partitions_ide
|
||||
mov [hdbase],0x170
|
||||
mov [hdid],0x10
|
||||
mov [hdpos],4
|
||||
mov [fat32part],1
|
||||
search_partitions_ide3_1:
|
||||
call set_FAT32_variables
|
||||
cmp [problem_partition],0
|
||||
jne end_search_partitions_ide
|
||||
inc byte [0x40005]
|
||||
call partition_data_transfer
|
||||
add [transfer_adress],100
|
||||
inc [fat32part]
|
||||
jmp search_partitions_ide3_1
|
||||
|
||||
|
||||
partition_data_transfer:
|
||||
mov edi,[transfer_adress]
|
||||
mov esi,PARTITION_START
|
||||
xor ecx,ecx
|
||||
mov cx,69 ;100
|
||||
rep movsb
|
||||
ret
|
||||
transfer_adress dd 0
|
||||
partition_data_transfer_1:
|
||||
cli
|
||||
push edi
|
||||
mov edi,PARTITION_START
|
||||
mov esi,[transfer_adress]
|
||||
xor ecx,ecx
|
||||
mov cx,69 ;100
|
||||
rep movsb
|
||||
pop edi
|
||||
sti
|
||||
ret
|
||||
|
||||
end_search_partitions_ide:
|
||||
|
||||
;PARTITION_START dd 0x3f
|
||||
;PARTITION_END dd 0
|
||||
;SECTORS_PER_FAT dd 0x1f3a
|
||||
;NUMBER_OF_FATS dd 0x2
|
||||
;SECTORS_PER_CLUSTER dd 0x8
|
||||
;BYTES_PER_SECTOR dd 0x200 ; Note: if BPS <> 512 need lots of changes
|
||||
;ROOT_CLUSTER dd 2 ; first rootdir cluster
|
||||
;FAT_START dd 0 ; start of fat table
|
||||
;ROOT_START dd 0 ; start of rootdir (only fat16)
|
||||
;ROOT_SECTORS dd 0 ; count of rootdir sectors (only fat16)
|
||||
;DATA_START dd 0 ; start of data area (=first cluster 2)
|
||||
;LAST_CLUSTER dd 0 ; last availabe cluster
|
||||
;ADR_FSINFO dd 0 ; used only by fat32
|
||||
;
|
||||
;fatRESERVED dd 0x0FFFFFF6
|
||||
;fatBAD dd 0x0FFFFFF7
|
||||
;fatEND dd 0x0FFFFFF8
|
||||
;fatMASK dd 0x0FFFFFFF
|
||||
;
|
||||
;fat_type db 0 ; 0=none, 16=fat16, 32=fat32
|
||||
|
1084
kernel/tags/kolibri0.5.2.1/fs/fat12.inc
Normal file
2827
kernel/tags/kolibri0.5.2.1/fs/fat32.inc
Normal file
1095
kernel/tags/kolibri0.5.2.1/fs/fs.inc
Normal file
111
kernel/tags/kolibri0.5.2.1/fs/fs_phys.inc
Normal file
@@ -0,0 +1,111 @@
|
||||
hd_phys_read:
|
||||
;eax - sector number
|
||||
;ebx - destination
|
||||
pushad
|
||||
call wait_for_hd_idle
|
||||
popad
|
||||
push edx
|
||||
push eax
|
||||
cli
|
||||
xor eax,eax
|
||||
mov edx,[hdbase]
|
||||
inc edx
|
||||
out dx,al
|
||||
inc edx
|
||||
inc eax
|
||||
out dx,al
|
||||
inc edx
|
||||
;write sector number.
|
||||
mov eax,[esp]
|
||||
out dx,al
|
||||
shr eax,8
|
||||
inc edx
|
||||
out dx,al
|
||||
shr eax,8
|
||||
inc edx
|
||||
out dx,al
|
||||
shr eax,8
|
||||
inc edx
|
||||
and al,1+2+4+8
|
||||
add al,byte [hdid] ;+0 or +16
|
||||
or al,32+64+128
|
||||
out dx,al
|
||||
inc edx
|
||||
mov al,0x20
|
||||
out dx,al
|
||||
sti
|
||||
|
||||
call wait_for_sector_buffer
|
||||
cmp [hd_error],0
|
||||
jnz hd_read_error
|
||||
cli
|
||||
push edi
|
||||
mov edi,ebx
|
||||
mov ecx,256
|
||||
mov edx,[hdbase]
|
||||
cld
|
||||
rep insw
|
||||
pop edi
|
||||
sti
|
||||
pop edx
|
||||
pop eax
|
||||
ret
|
||||
|
||||
hd_phys_write:
|
||||
;eax - sector number
|
||||
;ebx - destination
|
||||
cmp eax,[partition_start]
|
||||
jb .ret
|
||||
cmp eax,[partition_end]
|
||||
ja .ret
|
||||
pushad
|
||||
call wait_for_hd_idle
|
||||
popad
|
||||
push edx
|
||||
push eax
|
||||
cli
|
||||
xor eax,eax
|
||||
mov edx,[hdbase]
|
||||
inc edx
|
||||
out dx,al
|
||||
inc edx
|
||||
inc eax
|
||||
out dx,al
|
||||
;write sector number
|
||||
inc edx
|
||||
mov eax,[esp]
|
||||
out dx,al
|
||||
shr eax,8
|
||||
inc edx
|
||||
out dx,al
|
||||
shr eax,8
|
||||
inc edx
|
||||
out dx,al
|
||||
shr eax,8
|
||||
inc edx
|
||||
and al,1+2+4+8
|
||||
add al,byte [hdid] ;+0 or +16
|
||||
or al,32+64+128
|
||||
out dx,al
|
||||
|
||||
inc edx
|
||||
mov al,0x30
|
||||
out dx,al
|
||||
sti
|
||||
|
||||
call wait_for_sector_buffer
|
||||
cmp [hd_error],0
|
||||
jnz hd_write_error
|
||||
cli
|
||||
push esi
|
||||
mov esi,ebx
|
||||
mov ecx,256
|
||||
mov edx,[hdbase]
|
||||
cld
|
||||
rep outsw
|
||||
pop esi
|
||||
sti
|
||||
pop edx
|
||||
pop eax
|
||||
.ret:
|
||||
ret
|
604
kernel/tags/kolibri0.5.2.1/gui/button.inc
Normal file
@@ -0,0 +1,604 @@
|
||||
max_buttons=4095
|
||||
dececx:
|
||||
|
||||
push eax
|
||||
push edx
|
||||
push ecx
|
||||
|
||||
mov edx,1
|
||||
dececl:
|
||||
|
||||
movzx eax,byte [esp+edx]
|
||||
cmp eax,0x20
|
||||
jge @f
|
||||
mov [esp+edx],byte 0x20
|
||||
@@:
|
||||
sub [esp+edx],byte 0x20
|
||||
|
||||
add edx,1
|
||||
cmp edx,4
|
||||
jbe dececl
|
||||
|
||||
pop ecx
|
||||
pop edx
|
||||
pop eax
|
||||
ret
|
||||
|
||||
|
||||
drawbuttonframes:
|
||||
|
||||
push esi
|
||||
push edi
|
||||
push eax
|
||||
push ebx
|
||||
push ecx
|
||||
push edx
|
||||
|
||||
shr eax,16
|
||||
shr ebx,16
|
||||
mov edx,[0x3010]
|
||||
|
||||
add eax,[edx-twdw]
|
||||
add ebx,[edx-twdw+4]
|
||||
mov cx,ax
|
||||
mov dx,bx
|
||||
shl eax,16
|
||||
shl ebx,16
|
||||
mov ax,cx
|
||||
mov bx,dx
|
||||
add ax,word [esp+12]
|
||||
mov esi,ebx
|
||||
mov edi,0
|
||||
mov ecx,[esp+0]
|
||||
add ecx,0x202020
|
||||
call [draw_line]
|
||||
|
||||
movzx edx,word [esp+8]
|
||||
add ebx,edx
|
||||
shl edx,16
|
||||
add ebx,edx
|
||||
mov ecx,[esp+0]
|
||||
call dececx
|
||||
call [draw_line]
|
||||
|
||||
mov ebx,esi
|
||||
push edx
|
||||
mov edx,eax
|
||||
shr edx,16
|
||||
mov ax,dx
|
||||
mov edx,ebx
|
||||
shr edx,16
|
||||
mov bx,dx
|
||||
mov dx,[esp+8+4]
|
||||
add bx,dx
|
||||
pop edx
|
||||
mov edi,0
|
||||
mov ecx,[esp+0]
|
||||
add ecx,0x202020
|
||||
call [draw_line]
|
||||
|
||||
mov esi,edx
|
||||
mov dx,[esp+12]
|
||||
add ax,dx
|
||||
shl edx,16
|
||||
add eax,edx
|
||||
add ebx,1*65536
|
||||
mov edx,esi
|
||||
mov ecx,[esp+0]
|
||||
call dececx
|
||||
call [draw_line]
|
||||
|
||||
pop edx
|
||||
pop ecx
|
||||
pop ebx
|
||||
pop eax
|
||||
pop edi
|
||||
pop esi
|
||||
|
||||
ret
|
||||
|
||||
button_dececx:
|
||||
|
||||
cmp [buttontype],dword 1
|
||||
jne .finish
|
||||
; je bdece
|
||||
; ret
|
||||
; bdece:
|
||||
push eax
|
||||
mov eax,0x01
|
||||
cmp edi,20
|
||||
jg @f
|
||||
mov eax,0x02
|
||||
@@:
|
||||
test ecx,0xff
|
||||
jz @f
|
||||
sub ecx,eax
|
||||
@@:
|
||||
shl eax,8
|
||||
test ecx,0xff00
|
||||
jz @f
|
||||
sub ecx,eax
|
||||
@@:
|
||||
shl eax,8
|
||||
test ecx,0xff0000
|
||||
jz @f
|
||||
sub ecx,eax
|
||||
@@:
|
||||
pop eax
|
||||
.finish:
|
||||
ret
|
||||
|
||||
|
||||
sys_button:
|
||||
|
||||
test ecx,0x80000000
|
||||
jnz remove_button
|
||||
|
||||
push esi
|
||||
push edi
|
||||
push eax
|
||||
push ebx
|
||||
push ecx
|
||||
push edx
|
||||
|
||||
test ecx,0x40000000
|
||||
jnz button_no_draw
|
||||
|
||||
pushad ; button body
|
||||
push ebx
|
||||
shr eax,16
|
||||
shr ebx,16
|
||||
mov edx,[0x3010]
|
||||
mov esi,[edx-twdw]
|
||||
mov edi,[edx-twdw+4]
|
||||
add eax,esi
|
||||
add ebx,edi
|
||||
mov cx,ax
|
||||
mov dx,bx
|
||||
shl eax,16
|
||||
shl ebx,16
|
||||
mov ax,cx
|
||||
mov bx,dx
|
||||
movzx ecx,word [4+32+esp+12]
|
||||
add eax,ecx
|
||||
mov ecx,[4+32+esp+0]
|
||||
cmp [buttontype],dword 0
|
||||
je @f
|
||||
add ecx,0x141414
|
||||
@@:
|
||||
movzx edi,word [esp]
|
||||
|
||||
; <Ivan Poddubny 15.08.2004>
|
||||
pop edx
|
||||
and edx, 0xFFFF
|
||||
;;cli
|
||||
.newline:
|
||||
call button_dececx
|
||||
push edi
|
||||
xor edi, edi
|
||||
call [draw_line]
|
||||
pop edi
|
||||
add ebx,1*65536+1 ; [ y start | y end ]
|
||||
dec edx
|
||||
jnz .newline
|
||||
;;sti
|
||||
;; pop ebx
|
||||
; </Ivan Poddubny 15.08.2004>
|
||||
popad
|
||||
|
||||
call drawbuttonframes
|
||||
|
||||
button_no_draw:
|
||||
|
||||
and ecx,0xffff
|
||||
|
||||
mov edi,[0x3010]
|
||||
sub edi,twdw
|
||||
|
||||
mov edi,[0xfe88]
|
||||
movzx eax,word [edi]
|
||||
cmp eax,max_buttons
|
||||
jge noaddbutt
|
||||
inc eax
|
||||
mov [edi],ax
|
||||
|
||||
shl eax,4
|
||||
add eax,edi
|
||||
|
||||
mov bx,[0x3000]
|
||||
mov [eax],bx
|
||||
|
||||
add eax,2 ; save button id number
|
||||
mov ebx,[esp+4]
|
||||
mov [eax],bx ; bits 0-15
|
||||
shr ebx,16
|
||||
mov [eax-2+0xc],bx; bits 16-31
|
||||
add eax,2 ; x start
|
||||
mov bx,[esp+12+2]
|
||||
mov [eax],bx
|
||||
add eax,2 ; x size
|
||||
mov bx,[esp+12+0]
|
||||
mov [eax],bx
|
||||
add eax,2 ; y start
|
||||
mov bx,[esp+8+2]
|
||||
mov [eax],bx
|
||||
add eax,2 ; y size
|
||||
mov bx,[esp+8+0]
|
||||
mov [eax],bx
|
||||
|
||||
noaddbutt:
|
||||
|
||||
pop edx
|
||||
pop ecx
|
||||
pop ebx
|
||||
pop eax
|
||||
pop edi
|
||||
pop esi
|
||||
|
||||
ret
|
||||
|
||||
|
||||
remove_button:
|
||||
|
||||
and ecx,0x7fffffff
|
||||
|
||||
rnewba2:
|
||||
|
||||
mov edi,[0xfe88]
|
||||
mov eax,edi
|
||||
movzx ebx,word [edi]
|
||||
inc bx
|
||||
|
||||
rnewba:
|
||||
|
||||
dec bx
|
||||
jz rnmba
|
||||
|
||||
add eax,0x10
|
||||
|
||||
mov dx,[0x3000]
|
||||
cmp dx,[eax]
|
||||
jnz rnewba
|
||||
|
||||
cmp cx,[eax+2]
|
||||
jnz rnewba
|
||||
|
||||
pushad
|
||||
mov ecx,ebx
|
||||
inc ecx
|
||||
shl ecx,4
|
||||
mov ebx,eax
|
||||
add eax,0x10
|
||||
call memmove
|
||||
dec dword [edi]
|
||||
popad
|
||||
|
||||
jmp rnewba2
|
||||
|
||||
rnmba:
|
||||
|
||||
ret
|
||||
|
||||
find_pressed_button_frames:
|
||||
|
||||
pushad
|
||||
|
||||
movzx ebx,word [eax+0]
|
||||
shl ebx,5
|
||||
add ebx,window_data
|
||||
movzx ecx,word [ebx+0] ; window x start
|
||||
movzx edx,word [eax+4] ; button x start
|
||||
add ecx,edx
|
||||
push ecx
|
||||
|
||||
mov dx,[eax+6] ; button x size
|
||||
add cx,dx
|
||||
mov esi,ecx
|
||||
inc esi
|
||||
mov cx,[ebx+4] ; window y start
|
||||
mov dx,[eax+8] ; button y start
|
||||
add ecx,edx
|
||||
mov ebx,ecx
|
||||
mov dx,[eax+10] ; button y size
|
||||
add dx,cx
|
||||
inc dx
|
||||
|
||||
pop eax
|
||||
|
||||
; eax x beginning
|
||||
; ebx y beginning
|
||||
; esi x end
|
||||
; edx y end
|
||||
; ecx color
|
||||
|
||||
mov [pressed_button_eax],eax
|
||||
mov [pressed_button_ebx],ebx
|
||||
mov [pressed_button_ecx],ecx
|
||||
mov [pressed_button_edx],edx
|
||||
mov [pressed_button_esi],esi
|
||||
|
||||
popad
|
||||
ret
|
||||
|
||||
uglobal
|
||||
pressed_button_eax dd 0
|
||||
pressed_button_ebx dd 0
|
||||
pressed_button_ecx dd 0
|
||||
pressed_button_edx dd 0
|
||||
pressed_button_esi dd 0
|
||||
endg
|
||||
|
||||
; negative button image
|
||||
|
||||
negativebutton:
|
||||
; If requested, do not display button
|
||||
; boarder on press.
|
||||
test ebx,0x20000000
|
||||
jz draw_negative_button
|
||||
ret
|
||||
draw_negative_button:
|
||||
|
||||
pushad
|
||||
|
||||
mov eax,[pressed_button_eax]
|
||||
mov ebx,[pressed_button_ebx]
|
||||
mov ecx,[pressed_button_ecx]
|
||||
mov edx,[pressed_button_edx]
|
||||
mov esi,[pressed_button_esi]
|
||||
mov ecx,0x01000000
|
||||
|
||||
dec edx
|
||||
push edx
|
||||
inc edx
|
||||
dec esi
|
||||
push esi
|
||||
inc esi
|
||||
|
||||
push eax
|
||||
push ebx
|
||||
push ecx
|
||||
push edx
|
||||
push edi
|
||||
|
||||
call [disable_mouse]
|
||||
|
||||
bdbnewline:
|
||||
mov edi,1 ; force
|
||||
cmp eax,[esp+16]
|
||||
jz bneg
|
||||
cmp eax,[esp+20]
|
||||
jz bneg
|
||||
cmp ebx,[esp+12]
|
||||
jz bneg
|
||||
cmp ebx,[esp+24]
|
||||
jnz nbneg
|
||||
; jz bneg
|
||||
; jmp nbneg
|
||||
|
||||
bneg:
|
||||
|
||||
;;;call [disable_mouse]
|
||||
call [putpixel]
|
||||
|
||||
nbneg:
|
||||
|
||||
inc eax
|
||||
cmp eax,esi
|
||||
jnz bdbnewline
|
||||
mov eax,[esp+16]
|
||||
inc ebx
|
||||
cmp ebx,edx
|
||||
jnz bdbnewline
|
||||
|
||||
add esp,28
|
||||
|
||||
popad
|
||||
|
||||
ret
|
||||
|
||||
; check buttons
|
||||
|
||||
|
||||
; 0000 word process number
|
||||
; 0002 word button id number : bits 0-15
|
||||
; 0004 word x start
|
||||
; 0006 word x size
|
||||
; 0008 word y start
|
||||
; 000A word y size
|
||||
; 000C word button id number : bits 16-31
|
||||
;
|
||||
; button table in 0x10 increments
|
||||
;
|
||||
; first at 0x10
|
||||
|
||||
|
||||
checkbuttons:
|
||||
|
||||
cmp [0xfb40],byte 0 ; mouse buttons pressed
|
||||
jnz @f
|
||||
ret
|
||||
@@:
|
||||
|
||||
pushad
|
||||
|
||||
xor esi, esi
|
||||
mov edi, [0xfe88]
|
||||
movzx edx, word [edi]
|
||||
test edx, edx
|
||||
jne @f
|
||||
popad
|
||||
ret
|
||||
|
||||
@@:
|
||||
|
||||
push esi
|
||||
inc edx
|
||||
push edx
|
||||
|
||||
buttonnewcheck:
|
||||
|
||||
pop edx
|
||||
pop esi
|
||||
inc esi
|
||||
cmp edx,esi
|
||||
jge bch
|
||||
|
||||
popad ; no button pressed
|
||||
ret
|
||||
|
||||
bch:
|
||||
|
||||
push esi
|
||||
push edx
|
||||
mov eax,esi
|
||||
shl eax,4
|
||||
add eax,edi
|
||||
|
||||
;......................start 1/2 : modified by vhanla .............................
|
||||
mov [buttonid],eax
|
||||
;......................end 1/2 : modified by vhanla .............................
|
||||
|
||||
; check that button is at top of windowing stack
|
||||
|
||||
movzx ebx,word [eax]
|
||||
movzx ecx,word [0xC000 + ebx * 2]
|
||||
cmp ecx,[0x3004]
|
||||
jne buttonnewcheck
|
||||
|
||||
; check that button start is inside window x/y end
|
||||
|
||||
movzx ebx,word [eax+0]
|
||||
shl ebx,5
|
||||
; add ebx,window_data
|
||||
; mov ecx,[window_data+ebx+8] ; window end X
|
||||
movzx edx,word [eax+4] ; button start X
|
||||
cmp edx, [window_data+ebx+8] ;ecx
|
||||
jge buttonnewcheck
|
||||
|
||||
; mov ecx,[window_data+ebx+12] ; window end Y
|
||||
movzx edx, word [eax+8] ; button start Y
|
||||
cmp edx, [window_data+ebx+12] ;ecx
|
||||
jge buttonnewcheck
|
||||
|
||||
; check coordinates
|
||||
; mouse x >= button x ?
|
||||
movzx ebx,word [eax+0]
|
||||
shl ebx,5
|
||||
add ebx,window_data
|
||||
movzx ecx,word [ebx+0] ; window x start
|
||||
movzx edx,word [eax+4] ; button x start
|
||||
add edx,ecx
|
||||
mov cx,[0xfb0a]
|
||||
cmp edx,ecx
|
||||
jg buttonnewcheck
|
||||
|
||||
movzx ebx,word [eax+6] ; button x size
|
||||
add edx,ebx
|
||||
cmp ecx,edx
|
||||
jg buttonnewcheck
|
||||
|
||||
; mouse y >= button y ?
|
||||
movzx ebx,word [eax+0]
|
||||
shl ebx,5
|
||||
add ebx,window_data
|
||||
movzx ecx,word [ebx+4] ; window y start
|
||||
movzx edx,word [eax+8] ; button y start
|
||||
add edx,ecx
|
||||
mov cx,[0xfb0c]
|
||||
cmp edx,ecx
|
||||
jg buttonnewcheck
|
||||
|
||||
movzx ebx,word [eax+10] ; button y size
|
||||
add edx,ebx
|
||||
cmp ecx,edx
|
||||
jg buttonnewcheck
|
||||
|
||||
; mouse on button
|
||||
|
||||
pop edx
|
||||
pop esi
|
||||
|
||||
mov bx,[eax+0xc] ; button id : bits 16-31
|
||||
shl ebx,16
|
||||
mov bx,[eax+2] ; button id : bits 00-16
|
||||
push ebx
|
||||
|
||||
mov [0xfb44],byte 1 ; no mouse down checks
|
||||
call find_pressed_button_frames
|
||||
call negativebutton
|
||||
|
||||
pushad
|
||||
cbwaitmouseup:
|
||||
|
||||
call checkidle
|
||||
|
||||
call check_mouse_data
|
||||
call [draw_pointer]
|
||||
|
||||
pushad
|
||||
call stack_handler
|
||||
popad
|
||||
|
||||
cmp [0xfb40],byte 0 ; mouse buttons pressed ?
|
||||
jnz cbwaitmouseup
|
||||
popad
|
||||
|
||||
call negativebutton
|
||||
mov [0xfff4],byte 0 ; no mouse background
|
||||
mov [0xfff5],byte 0 ; draw mouse
|
||||
;..................................... start 2/2 : modified by vhanla .............................
|
||||
; check coordinates
|
||||
jmp afterbuttonid
|
||||
buttonid dd 0x0 ;here a will backup the eax value
|
||||
afterbuttonid:
|
||||
|
||||
pusha
|
||||
mov eax,[buttonid]
|
||||
; mouse x >= button x ?
|
||||
movzx ebx,word [eax+0]
|
||||
shl ebx,5
|
||||
add ebx,window_data
|
||||
movzx ecx,word [ebx+0] ; window x start
|
||||
movzx edx,word [eax+4] ; button x start
|
||||
add edx,ecx
|
||||
mov cx,[0xfb0a]
|
||||
cmp edx,ecx
|
||||
jg no_on_button ;if we release the pointer out of the button area
|
||||
|
||||
movzx ebx,word [eax+6] ; button x size
|
||||
add edx,ebx
|
||||
cmp ecx,edx
|
||||
jg no_on_button
|
||||
|
||||
; mouse y >= button y ?
|
||||
movzx ebx,word [eax+0]
|
||||
shl ebx,5
|
||||
add ebx,window_data
|
||||
movzx ecx,word [ebx+4] ; window y start
|
||||
movzx edx,word [eax+8] ; button y start
|
||||
add edx,ecx
|
||||
mov cx,[0xfb0c]
|
||||
cmp edx,ecx
|
||||
jg no_on_button
|
||||
|
||||
movzx ebx,word [eax+10] ; button y size
|
||||
add edx,ebx
|
||||
cmp ecx,edx
|
||||
jg no_on_button
|
||||
popa
|
||||
mov [0xf500],byte 1 ; no of buttons in buffer
|
||||
pop ebx
|
||||
mov [0xf501],ebx ; lets put the button id in buffer
|
||||
push ebx
|
||||
pusha
|
||||
jmp yes_on_button
|
||||
no_on_button:
|
||||
mov [0xf500],byte 0 ; no of buttons in buffer
|
||||
yes_on_button:
|
||||
mov [0xfb44],byte 0 ; mouse down -> do not draw
|
||||
popa
|
||||
pop ebx
|
||||
popa
|
||||
ret
|
||||
;..................................... end 2/2 : modified by vhanla ................................
|
||||
|
194
kernel/tags/kolibri0.5.2.1/gui/event.inc
Normal file
@@ -0,0 +1,194 @@
|
||||
sys_getevent:
|
||||
|
||||
call get_event_for_app
|
||||
mov [esp+36],eax
|
||||
ret
|
||||
|
||||
|
||||
align 4
|
||||
|
||||
sys_wait_event_timeout:
|
||||
|
||||
mov ebx,[timer_ticks]
|
||||
add ebx,eax
|
||||
cmp ebx,[timer_ticks]
|
||||
jna .swfet2
|
||||
.swfet1:
|
||||
call get_event_for_app
|
||||
test eax,eax
|
||||
jne .eventoccur_time
|
||||
call change_task
|
||||
cmp ebx,[timer_ticks]
|
||||
jg .swfet1
|
||||
.swfet2:
|
||||
xor eax,eax
|
||||
.eventoccur_time:
|
||||
mov [esp+36],eax
|
||||
ret
|
||||
|
||||
|
||||
align 4
|
||||
|
||||
sys_waitforevent:
|
||||
|
||||
call get_event_for_app
|
||||
test eax,eax
|
||||
jne eventoccur
|
||||
newwait:
|
||||
|
||||
mov eax, [0x3010]
|
||||
mov [eax+0xA], byte 5
|
||||
call change_task
|
||||
|
||||
mov eax, [event_sched]
|
||||
|
||||
eventoccur:
|
||||
mov [esp+36],eax
|
||||
ret
|
||||
|
||||
|
||||
get_event_for_app:
|
||||
|
||||
pushad
|
||||
|
||||
mov edi,[0x3010] ; WINDOW REDRAW
|
||||
test [edi],dword 1
|
||||
jz no_eventoccur1
|
||||
;mov edi,[0x3010]
|
||||
cmp [edi-twdw+31],byte 0
|
||||
je no_eventoccur1
|
||||
popad
|
||||
mov eax,1
|
||||
ret
|
||||
no_eventoccur1:
|
||||
|
||||
;mov edi,[0x3010] ; KEY IN BUFFER
|
||||
test [edi],dword 2
|
||||
jz no_eventoccur2
|
||||
mov ecx, [0x3000]
|
||||
movzx edx,word [0xC000+ecx*2]
|
||||
mov eax, [0x3004]
|
||||
cmp eax,edx
|
||||
jne no_eventoccur2
|
||||
cmp [0xf400],byte 0
|
||||
je no_eventoccur2
|
||||
popad
|
||||
mov eax,2
|
||||
ret
|
||||
no_eventoccur2:
|
||||
|
||||
;mov edi,[0x3010] ; BUTTON IN BUFFER
|
||||
test [edi],dword 4
|
||||
jz no_eventoccur3
|
||||
cmp [0xf500],byte 0
|
||||
je no_eventoccur3
|
||||
mov ecx, [0x3000]
|
||||
movzx edx, word [0xC000+ecx*2]
|
||||
mov eax, [0x3004]
|
||||
cmp eax,edx
|
||||
jnz no_eventoccur3
|
||||
popad
|
||||
mov eax,[0xf501]
|
||||
cmp eax,65535
|
||||
je no_event_1
|
||||
mov eax,3
|
||||
ret
|
||||
|
||||
no_event_1:
|
||||
mov [window_minimize],1
|
||||
mov [0xf500],byte 0
|
||||
xor eax, eax
|
||||
ret
|
||||
|
||||
no_eventoccur3:
|
||||
|
||||
|
||||
;mov edi,[0x3010] ; mouse event
|
||||
test [edi],dword 00100000b
|
||||
jz no_mouse_event
|
||||
mov eax,[0x3000]
|
||||
shl eax,8
|
||||
test [eax+0x80000+0xA8],dword 00100000b
|
||||
jz no_mouse_event
|
||||
and [eax+0x80000+0xA8],dword 0xffffffff-00100000b
|
||||
popad
|
||||
mov eax,6
|
||||
ret
|
||||
no_mouse_event:
|
||||
|
||||
|
||||
;mov edi,[0x3010] ; DESKTOP BACKGROUND REDRAW
|
||||
test [edi],dword 16
|
||||
jz no_eventoccur5
|
||||
cmp [0xfff0],byte 2
|
||||
jnz no_eventoccur5
|
||||
popad
|
||||
mov eax,5
|
||||
ret
|
||||
no_eventoccur5:
|
||||
|
||||
;mov edi,[0x3010] ; IPC
|
||||
test [edi],dword 01000000b
|
||||
jz no_ipc
|
||||
mov eax,[0x3000]
|
||||
shl eax,8
|
||||
test [eax+0x80000+0xA8],dword 01000000b
|
||||
jz no_ipc
|
||||
and [eax+0x80000+0xA8],dword 0xffffffff-01000000b
|
||||
popad
|
||||
mov eax,7
|
||||
ret
|
||||
no_ipc:
|
||||
|
||||
|
||||
;mov edi,[0x3010] ; STACK
|
||||
test [edi],dword 10000000b
|
||||
jz no_stack_event
|
||||
mov eax,[0x3000]
|
||||
shl eax,8
|
||||
test [eax+0x80000+0xA8],dword 10000000b
|
||||
jz no_stack_event
|
||||
and [eax+0x80000+0xA8],dword 0xffffffff-10000000b
|
||||
popad
|
||||
mov eax,8
|
||||
ret
|
||||
no_stack_event:
|
||||
|
||||
cmp dword [edi], 0xFFFF
|
||||
jbe no_events
|
||||
|
||||
mov esi,0x2e0000 ; IRQ'S AND DATA
|
||||
mov ebx,0x00010000
|
||||
xor ecx, ecx
|
||||
irq_event_test:
|
||||
mov edi,[0x3010]
|
||||
test [edi],ebx
|
||||
jz no_irq_event
|
||||
mov edi,ecx
|
||||
shl edi,2
|
||||
add edi,irq_owner
|
||||
mov edx,[edi]
|
||||
mov eax,[0x3010]
|
||||
mov eax,[eax+0x4]
|
||||
cmp edx,eax
|
||||
jne no_irq_event
|
||||
cmp [esi],dword 0
|
||||
jz no_irq_event
|
||||
mov eax,ecx
|
||||
add eax,16
|
||||
mov [esp+28],eax
|
||||
popad
|
||||
ret
|
||||
no_irq_event:
|
||||
add esi,0x1000
|
||||
shl ebx,1
|
||||
inc ecx
|
||||
cmp ecx,16
|
||||
jb irq_event_test
|
||||
|
||||
no_events:
|
||||
popad
|
||||
xor eax, eax
|
||||
ret
|
||||
|
||||
|
151
kernel/tags/kolibri0.5.2.1/gui/font.inc
Normal file
@@ -0,0 +1,151 @@
|
||||
align 4
|
||||
dtext:
|
||||
; eax x & y
|
||||
; ebx font ( 0xX0000000 ) & color ( 0x00RRGGBB )
|
||||
; ecx start of text
|
||||
; edx length
|
||||
; edi 1 force
|
||||
|
||||
test ebx,0x10000000
|
||||
jnz dtext2
|
||||
|
||||
pushad
|
||||
|
||||
mov esi, edx
|
||||
and esi, 0xff
|
||||
test esi, esi ; zero length ?
|
||||
jnz @f
|
||||
popad
|
||||
ret
|
||||
@@:
|
||||
align 4
|
||||
.letnew:
|
||||
|
||||
push eax ecx edx
|
||||
movzx ebx,ax
|
||||
shr eax,16
|
||||
movzx edx,byte [ecx]
|
||||
mov ecx,[esp+3*4+32-16]
|
||||
call drawletter
|
||||
pop edx ecx eax
|
||||
|
||||
add eax,6*65536
|
||||
|
||||
inc ecx
|
||||
dec edx
|
||||
jnz .letnew
|
||||
|
||||
popad
|
||||
ret
|
||||
|
||||
align 4
|
||||
drawletter:
|
||||
;eax - x
|
||||
;ebx - y
|
||||
;ecx - color
|
||||
;edx - ascii code
|
||||
pushad
|
||||
call [disable_mouse]
|
||||
mov esi,9
|
||||
lea ebp,[0x3F600+8*edx+edx]
|
||||
.symloop:
|
||||
push esi
|
||||
mov dl,byte [ebp]
|
||||
mov esi,8
|
||||
.pixloop:
|
||||
test dl,1
|
||||
jz .nopix
|
||||
call [putpixel]
|
||||
.nopix:
|
||||
shr dl,1
|
||||
inc eax
|
||||
dec esi
|
||||
jnz .pixloop
|
||||
sub eax,8
|
||||
inc ebx
|
||||
inc ebp
|
||||
pop esi
|
||||
dec esi
|
||||
jnz .symloop
|
||||
popad
|
||||
ret
|
||||
|
||||
|
||||
|
||||
dtext2:
|
||||
|
||||
; eax x & y
|
||||
; ebx color
|
||||
; ecx start of text
|
||||
; edx length
|
||||
; edi 1 force
|
||||
|
||||
pushad
|
||||
|
||||
mov esi,edx
|
||||
and esi,0xff
|
||||
test esi,esi ; zero length ?
|
||||
jnz @f
|
||||
popad
|
||||
ret
|
||||
@@:
|
||||
|
||||
align 4
|
||||
letnew2:
|
||||
|
||||
push ecx
|
||||
push edx
|
||||
movzx ebx,ax
|
||||
shr eax,16
|
||||
movzx edx,byte [ecx]
|
||||
mov ecx,[esp+2*4+32-16]
|
||||
call drawletter2
|
||||
shl eax,16
|
||||
add eax,ebx
|
||||
pop edx
|
||||
pop ecx
|
||||
|
||||
inc ecx
|
||||
dec edx
|
||||
jnz letnew2
|
||||
|
||||
popad
|
||||
ret
|
||||
|
||||
align 4
|
||||
drawletter2:
|
||||
;eax - x
|
||||
;ebx - y
|
||||
;ecx - color
|
||||
;edx - symbol
|
||||
;edi - force?
|
||||
;result - eax=eax+sym_size
|
||||
pushad
|
||||
call [disable_mouse]
|
||||
shl edx,1
|
||||
mov esi,9
|
||||
lea ebp,[0x3EC00+4*edx+edx+1]
|
||||
.symloop:
|
||||
push esi
|
||||
mov dl,byte [ebp]
|
||||
xor esi,esi
|
||||
.pixloop:
|
||||
test dl,1
|
||||
jz .nopix
|
||||
call [putpixel]
|
||||
.nopix:
|
||||
shr dl,1
|
||||
inc esi
|
||||
inc eax
|
||||
cmp esi,8
|
||||
jl .pixloop
|
||||
sub eax,8
|
||||
inc ebx
|
||||
pop esi
|
||||
inc ebp
|
||||
dec esi
|
||||
jnz .symloop
|
||||
movzx edx,byte [ebp-10]
|
||||
add [esp+32-4],edx
|
||||
popad
|
||||
ret
|
243
kernel/tags/kolibri0.5.2.1/gui/mouse.inc
Normal file
@@ -0,0 +1,243 @@
|
||||
;mouseunder:
|
||||
; times 16*24 dd 0
|
||||
label mouseunder dword at 0x6900
|
||||
|
||||
iglobal
|
||||
|
||||
mousepointer:
|
||||
db 0x00,0x00,0x00,0x74,0x74,0x74,0x6e,0x6e,0x6e,0x6f
|
||||
db 0x6f,0x6f,0x71,0x71,0x71,0x75,0x75,0x75,0x79,0x79
|
||||
db 0x79,0x7c,0x7c,0x7c,0x7e,0x7e,0x7e,0x80,0x80,0x80
|
||||
db 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80
|
||||
db 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80
|
||||
db 0x80,0x00,0x00,0x00,0x63,0x63,0x63,0x63,0x63,0x63
|
||||
db 0x66,0x66,0x66,0x6c,0x6c,0x6c,0x72,0x72,0x72,0x78
|
||||
db 0x78,0x78,0x7c,0x7c,0x7c,0x7e,0x7e,0x7e,0x80,0x80
|
||||
db 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80
|
||||
db 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xc0
|
||||
db 0xc0,0xc0,0x00,0x00,0x00,0x54,0x54,0x54,0x57,0x57
|
||||
db 0x57,0x5f,0x5f,0x5f,0x68,0x68,0x68,0x71,0x71,0x71
|
||||
db 0x77,0x77,0x77,0x7c,0x7c,0x7c,0x7e,0x7e,0x7e,0x80
|
||||
db 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80
|
||||
db 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xc0,0xc0,0xc0
|
||||
db 0xc0,0xc0,0xc0,0x00,0x00,0x00,0x47,0x47,0x47,0x50
|
||||
db 0x50,0x50,0x5b,0x5b,0x5b,0x67,0x67,0x67,0x70,0x70
|
||||
db 0x70,0x77,0x77,0x77,0x7c,0x7c,0x7c,0x7e,0x7e,0x7e
|
||||
db 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80
|
||||
db 0x80,0x80,0x80,0x80,0x80,0xff,0xff,0xff,0xc0,0xc0
|
||||
db 0xc0,0xc0,0xc0,0xc0,0x00,0x00,0x00,0x3f,0x3f,0x3f
|
||||
db 0x4b,0x4b,0x4b,0x59,0x59,0x59,0x66,0x66,0x66,0x70
|
||||
db 0x70,0x70,0x77,0x77,0x77,0x7c,0x7c,0x7c,0x7e,0x7e
|
||||
db 0x7e,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80
|
||||
db 0x80,0x80,0x80,0xff,0xff,0xff,0xc0,0xc0,0xc0,0xc0
|
||||
db 0xc0,0xc0,0xc0,0xc0,0xc0,0x00,0x00,0x00,0x3a,0x3a
|
||||
db 0x3a,0x49,0x49,0x49,0x59,0x59,0x59,0x66,0x66,0x66
|
||||
db 0x70,0x70,0x70,0x77,0x77,0x77,0x7c,0x7c,0x7c,0x7e
|
||||
db 0x7e,0x7e,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80
|
||||
db 0x80,0xff,0xff,0xff,0xff,0xff,0xff,0xc0,0xc0,0xc0
|
||||
db 0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x00,0x00,0x00,0x39
|
||||
db 0x39,0x39,0x49,0x49,0x49,0x59,0x59,0x59,0x66,0x66
|
||||
db 0x66,0x71,0x71,0x71,0x78,0x78,0x78,0x7c,0x7c,0x7c
|
||||
db 0x7e,0x7e,0x7e,0x80,0x80,0x80,0x80,0x80,0x80,0xff
|
||||
db 0xff,0xff,0xff,0xff,0xff,0xc0,0xc0,0xc0,0xc0,0xc0
|
||||
db 0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x00,0x00,0x00
|
||||
db 0x39,0x39,0x39,0x4a,0x4a,0x4a,0x5a,0x5a,0x5a,0x68
|
||||
db 0x68,0x68,0x72,0x72,0x72,0x79,0x79,0x79,0x7d,0x7d
|
||||
db 0x7d,0x7f,0x7f,0x7f,0x80,0x80,0x80,0xff,0xff,0xff
|
||||
db 0xff,0xff,0xff,0xff,0xff,0xff,0xc0,0xc0,0xc0,0xc0
|
||||
db 0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x00,0x00
|
||||
db 0x00,0x3c,0x3c,0x3c,0x4e,0x4e,0x4e,0x5e,0x5e,0x5e
|
||||
db 0x6b,0x6b,0x6b,0x75,0x75,0x75,0x7a,0x7a,0x7a,0x7e
|
||||
db 0x7e,0x7e,0x80,0x80,0x80,0xff,0xff,0xff,0xff,0xff
|
||||
db 0xff,0xff,0xff,0xff,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0
|
||||
db 0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x00
|
||||
db 0x00,0x00,0x43,0x43,0x43,0x55,0x55,0x55,0x64,0x64
|
||||
db 0x64,0x70,0x70,0x70,0x78,0x78,0x78,0x7d,0x7d,0x7d
|
||||
db 0x80,0x80,0x80,0xff,0xff,0xff,0xff,0xff,0xff,0xc0
|
||||
db 0xc0,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
||||
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
||||
db 0x00,0x00,0x00,0x4e,0x4e,0x4e,0x5f,0x5f,0x5f,0x6d
|
||||
db 0x6d,0x6d,0x76,0x76,0x76,0x7c,0x7c,0x7c,0x80,0x80
|
||||
db 0x80,0xff,0xff,0xff,0xc0,0xc0,0xc0,0x00,0x00,0x00
|
||||
db 0xff,0xff,0xff,0xc0,0xc0,0xc0,0x00,0x00,0x00,0x14
|
||||
db 0x14,0x14,0x1b,0x1b,0x1b,0x29,0x29,0x29,0x3a,0x3a
|
||||
db 0x3a,0x4c,0x4c,0x4c,0x5d,0x5d,0x5d,0x6c,0x6c,0x6c
|
||||
db 0x75,0x75,0x75,0x7b,0x7b,0x7b,0x80,0x80,0x80,0xc0
|
||||
db 0xc0,0xc0,0x00,0x00,0x00,0x2f,0x2f,0x2f,0x80,0x80
|
||||
db 0x80,0xff,0xff,0xff,0xc0,0xc0,0xc0,0x00,0x00,0x00
|
||||
db 0x21,0x21,0x21,0x2e,0x2e,0x2e,0x40,0x40,0x40,0x52
|
||||
db 0x52,0x52,0x62,0x62,0x62,0x6f,0x6f,0x6f,0x77,0x77
|
||||
db 0x77,0x7c,0x7c,0x7c,0x80,0x80,0x80,0x00,0x00,0x00
|
||||
db 0x47,0x47,0x47,0x3b,0x3b,0x3b,0x80,0x80,0x80,0xff
|
||||
db 0xff,0xff,0xc0,0xc0,0xc0,0x00,0x00,0x00,0x25,0x25
|
||||
db 0x25,0x30,0x30,0x30,0x42,0x42,0x42,0x54,0x54,0x54
|
||||
db 0x64,0x64,0x64,0x70,0x70,0x70,0x78,0x78,0x78,0x7d
|
||||
db 0x7d,0x7d,0x00,0x00,0x00,0x62,0x62,0x62,0x52,0x52
|
||||
db 0x52,0x4a,0x4a,0x4a,0x43,0x43,0x43,0x80,0x80,0x80
|
||||
db 0xff,0xff,0xff,0xc0,0xc0,0xc0,0x00,0x00,0x00,0x33
|
||||
db 0x33,0x33,0x42,0x42,0x42,0x54,0x54,0x54,0x64,0x64
|
||||
db 0x64,0x71,0x71,0x71,0x79,0x79,0x79,0x7d,0x7d,0x7d
|
||||
db 0x72,0x72,0x72,0x6b,0x6b,0x6b,0x5f,0x5f,0x5f,0x5a
|
||||
db 0x5a,0x5a,0x54,0x54,0x54,0x80,0x80,0x80,0xff,0xff
|
||||
db 0xff,0xc0,0xc0,0xc0,0x00,0x00,0x00,0x35,0x35,0x35
|
||||
db 0x41,0x41,0x41,0x53,0x53,0x53,0x63,0x63,0x63,0x70
|
||||
db 0x70,0x70,0x78,0x78,0x78,0x7d,0x7d,0x7d,0x77,0x77
|
||||
db 0x77,0x73,0x73,0x73,0x6c,0x6c,0x6c,0x68,0x68,0x68
|
||||
db 0x62,0x62,0x62,0x5a,0x5a,0x5a,0x80,0x80,0x80,0xff
|
||||
db 0xff,0xff,0xc0,0xc0,0xc0,0x00,0x00,0x00,0x41,0x41
|
||||
db 0x41,0x52,0x52,0x52,0x62,0x62,0x62,0x6f,0x6f,0x6f
|
||||
db 0x78,0x78,0x78,0x7d,0x7d,0x7d,0x7b,0x7b,0x7b,0x79
|
||||
db 0x79,0x79,0x74,0x74,0x74,0x72,0x72,0x72,0x6e,0x6e
|
||||
db 0x6e,0x66,0x66,0x66,0x80,0x80,0x80,0xc0,0xc0,0xc0
|
||||
db 0xc0,0xc0,0xc0,0x00,0x00,0x00,0x44,0x44,0x44,0x52
|
||||
db 0x52,0x52,0x62,0x62,0x62,0x6e,0x6e,0x6e,0x77,0x77
|
||||
db 0x77,0x7c,0x7c,0x7c,0x7e,0x7e,0x7e,0x7c,0x7c,0x7c
|
||||
db 0x7a,0x7a,0x7a,0x79,0x79,0x79,0x75,0x75,0x75,0x6f
|
||||
db 0x6f,0x6f,0x65,0x65,0x65,0x00,0x00,0x00,0x00,0x00
|
||||
db 0x00,0x48,0x48,0x48,0x4b,0x4b,0x4b,0x56,0x56,0x56
|
||||
db 0x65,0x65,0x65,0x70,0x70,0x70,0x78,0x78,0x78,0x7d
|
||||
db 0x7d,0x7d,0x80,0x80,0x80,0x7f,0x7f,0x7f,0x7e,0x7e
|
||||
db 0x7e,0x7d,0x7d,0x7d,0x7a,0x7a,0x7a,0x76,0x76,0x76
|
||||
db 0x6f,0x6f,0x6f,0x65,0x65,0x65,0x5c,0x5c,0x5c,0x56
|
||||
db 0x56,0x56,0x58,0x58,0x58,0x60,0x60,0x60,0x6b,0x6b
|
||||
db 0x6b,0x73,0x73,0x73,0x7a,0x7a,0x7a,0x7d,0x7d,0x7d
|
||||
db 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x7f
|
||||
db 0x7f,0x7f,0x7d,0x7d,0x7d,0x7a,0x7a,0x7a,0x76,0x76
|
||||
db 0x76,0x70,0x70,0x70,0x6a,0x6a,0x6a,0x66,0x66,0x66
|
||||
db 0x66,0x66,0x66,0x6c,0x6c,0x6c,0x72,0x72,0x72,0x78
|
||||
db 0x78,0x78,0x7c,0x7c,0x7c,0x7e,0x7e,0x7e,0x80,0x80
|
||||
db 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80
|
||||
db 0x7f,0x7f,0x7f,0x7d,0x7d,0x7d,0x7b,0x7b,0x7b,0x77
|
||||
db 0x77,0x77,0x73,0x73,0x73,0x71,0x71,0x71,0x71,0x71
|
||||
db 0x71,0x74,0x74,0x74,0x78,0x78,0x78,0x7b,0x7b,0x7b
|
||||
db 0x7d,0x7d,0x7d,0x7f,0x7f,0x7f,0x80,0x80,0x80,0x80
|
||||
db 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80
|
||||
db 0x80,0x7f,0x7f,0x7f,0x7d,0x7d,0x7d,0x7c,0x7c,0x7c
|
||||
db 0x7a,0x7a,0x7a,0x78,0x78,0x78,0x78,0x78,0x78,0x7a
|
||||
db 0x7a,0x7a,0x7c,0x7c,0x7c,0x7e,0x7e,0x7e,0x7f,0x7f
|
||||
db 0x7f,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80
|
||||
db 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80
|
||||
db 0x80,0x80,0x7f,0x7f,0x7f,0x7e,0x7e,0x7e,0x7e,0x7e
|
||||
db 0x7e,0x7d,0x7d,0x7d,0x7d,0x7d,0x7d,0x7e,0x7e,0x7e
|
||||
db 0x7e,0x7e,0x7e,0x7f,0x7f,0x7f,0x80,0x80,0x80,0x80
|
||||
db 0x80,0x80
|
||||
|
||||
mousepointer1:
|
||||
db 0xff,0xff,0xff,0x06,0x06,0x06,0x0a,0x0a
|
||||
db 0x0a,0x08,0x08,0x08,0x00,0x00,0x00,0x00,0x00,0x00
|
||||
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
||||
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
||||
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
||||
db 0xff,0xff,0xff,0xff,0xff,0xff,0x19,0x19,0x19,0x16
|
||||
db 0x16,0x16,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
||||
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
||||
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
||||
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff
|
||||
db 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x2e,0x2e,0x2e
|
||||
db 0x23,0x23,0x23,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
||||
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
||||
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
||||
db 0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff
|
||||
db 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0x3f
|
||||
db 0x3f,0x29,0x29,0x29,0x00,0x00,0x00,0x00,0x00,0x00
|
||||
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
||||
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
||||
db 0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff
|
||||
db 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x47
|
||||
db 0x47,0x47,0x2c,0x2c,0x2c,0x00,0x00,0x00,0x00,0x00
|
||||
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
||||
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
||||
db 0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
|
||||
db 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
|
||||
db 0x48,0x48,0x48,0x2c,0x2c,0x2c,0x16,0x16,0x16,0x00
|
||||
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
||||
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
||||
db 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
|
||||
db 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
|
||||
db 0xff,0x48,0x48,0x48,0x2c,0x2c,0x2c,0x16,0x16,0x16
|
||||
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
||||
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff
|
||||
db 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
|
||||
db 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
|
||||
db 0xff,0xff,0x48,0x48,0x48,0x2c,0x2c,0x2c,0x00,0x00
|
||||
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
||||
db 0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff
|
||||
db 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
|
||||
db 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
|
||||
db 0xff,0xff,0xff,0x48,0x48,0x48,0x2c,0x2c,0x2c,0x00
|
||||
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
||||
db 0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff
|
||||
db 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
|
||||
db 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
|
||||
db 0xff,0xff,0xff,0xff,0x47,0x47,0x47,0x29,0x29,0x29
|
||||
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
||||
db 0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
|
||||
db 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
|
||||
db 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
|
||||
db 0xff,0xff,0xff,0xff,0xff,0x40,0x40,0x40,0x23,0x23
|
||||
db 0x23,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
||||
db 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
|
||||
db 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
|
||||
db 0xff,0xaa,0xaa,0xaa,0x9f,0x9f,0x9f,0x8c,0x8c,0x8c
|
||||
db 0x70,0x70,0x70,0x4f,0x4f,0x4f,0x30,0x30,0x30,0x00
|
||||
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff
|
||||
db 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x8f,0x8f,0x8f
|
||||
db 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
|
||||
db 0xff,0xff,0x9c,0x9c,0x9c,0x87,0x87,0x87,0x6c,0x6c
|
||||
db 0x6c,0x4f,0x4f,0x4f,0x32,0x32,0x32,0x19,0x19,0x19
|
||||
db 0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff
|
||||
db 0xff,0xff,0x69,0x69,0x69,0x84,0x84,0x84,0xff,0xff
|
||||
db 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
|
||||
db 0x92,0x92,0x92,0x79,0x79,0x79,0x59,0x59,0x59,0x3c
|
||||
db 0x3c,0x3c,0x24,0x24,0x24,0x11,0x11,0x11,0x00,0x00
|
||||
db 0x00,0x00,0x00,0x00,0xff,0xff,0xff,0x37,0x37,0x37
|
||||
db 0x5d,0x5d,0x5d,0x70,0x70,0x70,0x76,0x76,0x76,0xff
|
||||
db 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
|
||||
db 0xff,0x75,0x75,0x75,0x51,0x51,0x51,0x31,0x31,0x31
|
||||
db 0x19,0x19,0x19,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
||||
db 0x00,0x00,0x16,0x16,0x16,0x2d,0x2d,0x2d,0x49,0x49
|
||||
db 0x49,0x53,0x53,0x53,0x54,0x54,0x54,0xff,0xff,0xff
|
||||
db 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x78
|
||||
db 0x78,0x78,0x54,0x54,0x54,0x30,0x30,0x30,0x16,0x16
|
||||
db 0x16,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
||||
db 0x0f,0x0f,0x0f,0x1f,0x1f,0x1f,0x30,0x30,0x30,0x33
|
||||
db 0x33,0x33,0x33,0x33,0x33,0x3b,0x3b,0x3b,0xff,0xff
|
||||
db 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
|
||||
db 0x62,0x62,0x62,0x3b,0x3b,0x3b,0x1c,0x1c,0x1c,0x00
|
||||
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x08
|
||||
db 0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
||||
db 0x00,0x00,0x00,0x24,0x24,0x24,0xff,0xff,0xff,0xff
|
||||
db 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x6e,0x6e
|
||||
db 0x6e,0x48,0x48,0x48,0x25,0x25,0x25,0x0e,0x0e,0x0e
|
||||
db 0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x04,0x04,0x00
|
||||
db 0x00,0x00,0x0a,0x0a,0x0a,0x09,0x09,0x09,0x00,0x00
|
||||
db 0x00,0x00,0x00,0x00,0x29,0x29,0x29,0xff,0xff,0xff
|
||||
db 0xff,0xff,0xff,0x7c,0x7c,0x7c,0x71,0x71,0x71,0x50
|
||||
db 0x50,0x50,0x2b,0x2b,0x2b,0x00,0x00,0x00,0x00,0x00
|
||||
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
||||
db 0x00,0x00,0x00,0x02,0x02,0x02,0x04,0x04,0x04,0x00
|
||||
db 0x00,0x00,0x00,0x00,0x00,0x36,0x36,0x36,0x56,0x56
|
||||
db 0x56,0x69,0x69,0x69,0x64,0x64,0x64,0x4a,0x4a,0x4a
|
||||
db 0x28,0x28,0x28,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
||||
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
||||
db 0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x05,0x05,0x05
|
||||
db 0x00,0x00,0x00,0x21,0x21,0x21,0x39,0x39,0x39,0x49
|
||||
db 0x49,0x49,0x48,0x48,0x48,0x35,0x35,0x35,0x1d,0x1d
|
||||
db 0x1d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
||||
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
||||
db 0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x00,0x00
|
||||
db 0x00,0x00,0x00,0x00,0x1d,0x1d,0x1d,0x27,0x27,0x27
|
||||
db 0x27,0x27,0x27,0x1d,0x1d,0x1d,0x0f,0x0f,0x0f,0x06
|
||||
db 0x06,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
||||
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
||||
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
||||
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
||||
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
||||
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
||||
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
||||
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
||||
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
||||
db 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
||||
db 0x00,0x00,0x00,0x00
|
||||
|
||||
endg
|
388
kernel/tags/kolibri0.5.2.1/gui/skincode.inc
Normal file
@@ -0,0 +1,388 @@
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; WINDOW SKIN for MenuetOS ;;
|
||||
;; ;;
|
||||
;; entryway@bkg.lt ;;
|
||||
;; ;;
|
||||
;; Bugfixes & upgrades by ;;
|
||||
;; Samuel Rodriguez Perez ;;
|
||||
;; Xeoda@ciberirmandade.org ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
|
||||
|
||||
include "skindata.inc"
|
||||
|
||||
virtual at 0
|
||||
bmp_header:
|
||||
.type rw 1 ; "BM" signature
|
||||
.filesize rd 1 ; size of the file
|
||||
.reserved rd 1 ; zero
|
||||
.offbits rd 1 ; pointer to image data
|
||||
;----------------
|
||||
.headsize rd 1 ; usually 40 bytes for image header
|
||||
.width rd 1
|
||||
.height rd 1
|
||||
.planes rw 1 ; usually 1
|
||||
.bitcount rw 1 ; currently 24 bits/pixel (0x18)
|
||||
.compress rd 1 ; zero
|
||||
.sizeimage rd 1 ; x*y*(bitcount/8)
|
||||
.unused rd 4 ; these bits aren't used by MeOS
|
||||
bmp_data:
|
||||
end virtual
|
||||
|
||||
virtual at 0x778000
|
||||
_bmp_bpl dd ? ; bytes per line
|
||||
_bmp_dpl dd ? ; dwords per line
|
||||
_bmp_zb dd ? ; bytes filled by zeroes at the end of a scanline
|
||||
align 32
|
||||
raw_data:
|
||||
end virtual
|
||||
|
||||
bmp2raw:
|
||||
; esi = to bmp data (source)
|
||||
; edi = to raw data (destination)
|
||||
cmp [esi+bmp_header.type],'BM' ; check if bmp file is really loaded
|
||||
jne .finish
|
||||
mov edx,esi
|
||||
|
||||
mov eax,[edx+bmp_header.width]
|
||||
imul eax,3
|
||||
push eax
|
||||
test eax,11b
|
||||
jz @f
|
||||
add eax,4
|
||||
@@:
|
||||
shr eax,2
|
||||
mov [_bmp_dpl],eax
|
||||
shl eax,2
|
||||
mov [_bmp_bpl],eax
|
||||
pop ebx
|
||||
sub eax,ebx
|
||||
mov [_bmp_zb],eax
|
||||
|
||||
add esi,bmp_data
|
||||
mov eax,[_bmp_bpl]
|
||||
imul eax,[edx+bmp_header.height]
|
||||
add esi,eax
|
||||
mov ebx,[edx+bmp_header.height] ; ebx = y
|
||||
cld
|
||||
.y_begin:
|
||||
sub esi,[_bmp_bpl]
|
||||
push esi
|
||||
mov ecx,[_bmp_dpl]
|
||||
rep movsd
|
||||
pop esi
|
||||
sub edi,[_bmp_zb]
|
||||
dec ebx
|
||||
jne .y_begin
|
||||
|
||||
.finish:
|
||||
ret
|
||||
|
||||
|
||||
; BMP support by Ivan Poddubny
|
||||
; 1) load LEFT.BMP
|
||||
; a) _skinleftw = bmp_width
|
||||
; b) _skinleft = 0
|
||||
; c) _refleft = 0x778000
|
||||
; d) convert
|
||||
; 2) load BASE.BMP
|
||||
; a) _skinbasew = bmp_width
|
||||
; b) _skinbase = _skinleftw
|
||||
; c) _refbase = _refleft+sizeof(left_raw_converted)
|
||||
; d) convert
|
||||
; 3) load OPER.BMP
|
||||
; a) _skinoper = minus width from bmp file
|
||||
; b) _skinoperw = width from bmp file
|
||||
; c) _refoper = _refbase+sizeof(oper_raw_converted)
|
||||
; d) convert
|
||||
; 4) set height
|
||||
|
||||
load_bmp_file:
|
||||
; eax = pointer to filename
|
||||
mov ebx, 1
|
||||
or ecx, -1
|
||||
mov edx, 0x90000
|
||||
mov esi, 12
|
||||
call fileread
|
||||
ret
|
||||
|
||||
|
||||
load_default_skin:
|
||||
pushad
|
||||
mov eax, _fileleft
|
||||
call load_bmp_file
|
||||
mov eax, [0x90000+bmp_header.width]
|
||||
mov [_skinleftw], eax
|
||||
mov [_skinleft], 0
|
||||
mov edi, raw_data
|
||||
mov [_refleft], edi
|
||||
mov esi, 0x90000
|
||||
call bmp2raw
|
||||
mov eax, [_bmp_bpl]
|
||||
imul eax, [0x90000+bmp_header.height]
|
||||
push eax
|
||||
|
||||
mov eax, _filebase
|
||||
call load_bmp_file
|
||||
mov eax, [0x90000+bmp_header.width]
|
||||
mov [_skinbasew], eax
|
||||
mov eax, [_skinleftw]
|
||||
mov [_skinbase], eax
|
||||
pop eax
|
||||
add eax, [_refleft]
|
||||
; align to 32-byte boundary
|
||||
test eax, 11111b
|
||||
jz @f
|
||||
shr eax, 5
|
||||
inc eax
|
||||
shl eax, 5
|
||||
@@:
|
||||
; save base address
|
||||
mov [_refbase], eax
|
||||
; convert
|
||||
mov edi, eax
|
||||
mov esi, 0x90000
|
||||
call bmp2raw
|
||||
mov eax, [_bmp_bpl]
|
||||
imul eax, [0x90000+bmp_header.height]
|
||||
push eax
|
||||
|
||||
mov eax, _fileoper
|
||||
call load_bmp_file
|
||||
mov eax, [0x90000+bmp_header.width]
|
||||
mov [_skinoperw], eax
|
||||
neg eax
|
||||
mov [_skinoper], eax
|
||||
pop eax
|
||||
add eax, [_refbase]
|
||||
; align to 32-byte boundary
|
||||
test eax, 11111b
|
||||
jz @f
|
||||
shr eax, 5
|
||||
inc eax
|
||||
shl eax, 5
|
||||
@@:
|
||||
mov [_refoper], eax
|
||||
mov edi, eax
|
||||
mov esi, 0x90000
|
||||
call bmp2raw
|
||||
|
||||
|
||||
; mov eax, [0x90000+bmp_header.height]
|
||||
; imul eax, [0x90000+bmp_header.width]
|
||||
; imul eax, 3
|
||||
; add eax, raw_data ; now eax points to the last line of image
|
||||
|
||||
; mov ecx, [eax]
|
||||
; mov [_coloroutborder], ecx
|
||||
; mov [_colorborder], ecx
|
||||
; sub eax, 2*3
|
||||
; mov ecx, [eax]
|
||||
; mov [_colorframe], ecx
|
||||
|
||||
|
||||
mov eax, [0x90000+bmp_header.height]
|
||||
mov [_skinh], eax
|
||||
popad
|
||||
ret
|
||||
|
||||
|
||||
|
||||
drawwindow_IV:
|
||||
|
||||
pusha
|
||||
|
||||
push edx
|
||||
|
||||
mov edi,[esp] ; RECTANGLE
|
||||
|
||||
mov eax,[edi+0]
|
||||
shl eax,16
|
||||
mov ax,[edi+0]
|
||||
add ax,[edi+8]
|
||||
mov ebx,[edi+4]
|
||||
shl ebx,16
|
||||
mov bx,[edi+4]
|
||||
add bx,[edi+12]
|
||||
; mov esi,[edi+24]
|
||||
; shr esi,1
|
||||
; and esi,0x007f7f7f
|
||||
mov esi,[_coloroutborder]
|
||||
call draw_rectangle
|
||||
mov ecx,3
|
||||
_dw3l:
|
||||
add eax,1*65536-1
|
||||
add ebx,1*65536-1
|
||||
test ax,ax
|
||||
js no_skin_add_button
|
||||
test bx,bx
|
||||
js no_skin_add_button
|
||||
mov esi,[_colorframe] ;[edi+24]
|
||||
call draw_rectangle
|
||||
dec ecx
|
||||
jnz _dw3l
|
||||
mov esi,[_colorborder]
|
||||
add eax,1*65536-1
|
||||
add ebx,1*65536-1
|
||||
test ax,ax
|
||||
js no_skin_add_button
|
||||
test bx,bx
|
||||
js no_skin_add_button
|
||||
call draw_rectangle
|
||||
|
||||
mov esi,[esp]
|
||||
mov eax,[esi+8] ; window width
|
||||
mov edx,[_skinleft]
|
||||
shl edx,16
|
||||
mov ecx,[_skinleftw]
|
||||
shl ecx,16
|
||||
add ecx,[_skinh]
|
||||
mov ebx,[_refleft]
|
||||
call sys_putimage
|
||||
|
||||
mov esi,[esp]
|
||||
mov eax,[esi+8]
|
||||
sub eax,[_skinleftw]
|
||||
sub eax,[_skinoperw]
|
||||
cmp eax,[_skinbase]
|
||||
jng non_base
|
||||
xor edx,edx
|
||||
mov ebx,[_skinbasew]
|
||||
div ebx
|
||||
|
||||
inc eax
|
||||
|
||||
mov ebx,[_refbase]
|
||||
mov ecx,[_skinbasew]
|
||||
shl ecx,16
|
||||
add ecx,[_skinh]
|
||||
mov edx,[_skinbase]
|
||||
sub edx,[_skinbasew]
|
||||
shl edx,16
|
||||
baseskinloop:
|
||||
shr edx,16
|
||||
add edx,[_skinbasew]
|
||||
shl edx,16
|
||||
|
||||
push eax ebx ecx edx
|
||||
call sys_putimage
|
||||
pop edx ecx ebx eax
|
||||
|
||||
dec eax
|
||||
jnz baseskinloop
|
||||
non_base:
|
||||
|
||||
mov esi,[esp]
|
||||
mov edx,[esi+8]
|
||||
sub edx,[_skinoperw]
|
||||
inc edx
|
||||
shl edx,16
|
||||
mov ebx,[_refoper]
|
||||
mov ecx,[_skinoperw]
|
||||
shl ecx,16
|
||||
add ecx,[_skinh]
|
||||
call sys_putimage
|
||||
|
||||
mov esi,[esp]
|
||||
|
||||
mov edx,[esi+04] ; WORK AREA
|
||||
add edx,21+5
|
||||
mov ebx,[esi+04]
|
||||
add ebx,[esi+12]
|
||||
cmp edx,ebx
|
||||
jg _noinside2
|
||||
mov eax,5
|
||||
mov ebx,[_skinh]
|
||||
mov ecx,[esi+8]
|
||||
mov edx,[esi+12]
|
||||
sub ecx,4
|
||||
sub edx,4
|
||||
mov edi,[esi+16]
|
||||
call [drawbar]
|
||||
_noinside2:
|
||||
|
||||
mov edi,[0xfe88]
|
||||
movzx eax,word [edi]
|
||||
cmp eax,1000
|
||||
jge no_skin_add_button
|
||||
inc eax
|
||||
mov [edi],ax
|
||||
|
||||
shl eax,4
|
||||
add eax,edi
|
||||
|
||||
mov bx,[0x3000]
|
||||
mov [eax],bx
|
||||
|
||||
add eax,2 ; save button id number
|
||||
mov bx,1
|
||||
mov [eax],bx
|
||||
add eax,2 ; x start
|
||||
mov ebx,[esp]
|
||||
mov ebx,[ebx+8]
|
||||
cmp [_buttonCx],0
|
||||
jg _bCx_at_right
|
||||
mov ebx,[_buttonCw] ; ebx will be 0 in next instruction
|
||||
_bCx_at_right:
|
||||
sub ebx,[_buttonCw]
|
||||
sub ebx,[_buttonCx]
|
||||
mov [eax],bx
|
||||
add eax,2 ; x size
|
||||
mov ebx,[_buttonCw]
|
||||
mov [eax],bx
|
||||
add eax,2 ; y start
|
||||
mov ebx,[_buttonCy]
|
||||
mov [eax],bx
|
||||
add eax,2 ; y size
|
||||
mov ebx,[_buttonCh]
|
||||
mov [eax],bx
|
||||
|
||||
;* minimize button
|
||||
mov edi,[0xfe88]
|
||||
movzx eax,word [edi]
|
||||
cmp eax,1000
|
||||
jge no_skin_add_button
|
||||
inc eax
|
||||
mov [edi],ax
|
||||
|
||||
shl eax,4
|
||||
add eax,edi
|
||||
|
||||
mov bx,[0x3000]
|
||||
mov [eax],bx
|
||||
|
||||
add eax,2 ; save button id number
|
||||
mov bx,65535 ;999
|
||||
mov [eax],bx
|
||||
add eax,2 ; x start
|
||||
mov ebx,[esp]
|
||||
mov ebx,[ebx+8]
|
||||
cmp [_buttonMx],0
|
||||
jg _bMx_at_right
|
||||
mov ebx,[_buttonMw] ; ebx will be 0 in next instruction
|
||||
_bMx_at_right:
|
||||
sub ebx,[_buttonMw]
|
||||
sub ebx,[_buttonMx]
|
||||
mov [eax],bx
|
||||
add eax,2 ; x size
|
||||
mov ebx,[_buttonMw]
|
||||
mov [eax],bx
|
||||
add eax,2 ; y start
|
||||
mov ebx,[_buttonMy]
|
||||
mov [eax],bx
|
||||
add eax,2 ; y size
|
||||
mov ebx,[_buttonMh]
|
||||
mov [eax],bx
|
||||
;* minimize button
|
||||
|
||||
no_skin_add_button:
|
||||
|
||||
add esp,4
|
||||
popa
|
||||
ret
|
||||
|
||||
|
44
kernel/tags/kolibri0.5.2.1/gui/skindata.inc
Normal file
@@ -0,0 +1,44 @@
|
||||
;
|
||||
; WINDOW SKIN for MenuetOS
|
||||
; ivan-yar@bk.ru
|
||||
;
|
||||
|
||||
iglobal
|
||||
_skinh dd 22
|
||||
|
||||
_skinleftw dd 10
|
||||
|
||||
_skinbase dd 10
|
||||
_skinbasew dd 8
|
||||
|
||||
_skinoper dd -39 ;-21
|
||||
_skinoperw dd 39 ;21
|
||||
|
||||
_buttonCx dd 5 ; close
|
||||
_buttonCy dd 2
|
||||
_buttonCw dd 15
|
||||
_buttonCh dd 17
|
||||
|
||||
_buttonMx dd 23 ; minimize
|
||||
_buttonMy dd 2
|
||||
_buttonMw dd 15
|
||||
_buttonMh dd 17
|
||||
|
||||
|
||||
_colorframe dd 0x3a6cb6 ;0x586E93
|
||||
_colorborder dd 0x00081D
|
||||
_coloroutborder dd 0x00081D
|
||||
|
||||
_fileleft db 'LEFT.BMP '
|
||||
_filebase db 'BASE.BMP '
|
||||
_fileoper db 'OPER.BMP '
|
||||
endg
|
||||
|
||||
uglobal
|
||||
_refoper dd 0
|
||||
_refbase dd 0
|
||||
_refleft dd 0
|
||||
_skinleft dd 0
|
||||
_skinwinw dd 0
|
||||
endg
|
||||
|
1613
kernel/tags/kolibri0.5.2.1/gui/window.inc
Normal file
226
kernel/tags/kolibri0.5.2.1/hid/keyboard.inc
Normal file
@@ -0,0 +1,226 @@
|
||||
;// mike.dld [
|
||||
|
||||
VKEY_LSHIFT = 0000000000000001b
|
||||
VKEY_RSHIFT = 0000000000000010b
|
||||
VKEY_LCONTROL = 0000000000000100b
|
||||
VKEY_RCONTROL = 0000000000001000b
|
||||
VKEY_LALT = 0000000000010000b
|
||||
VKEY_RALT = 0000000000100000b
|
||||
VKEY_CAPSLOCK = 0000000001000000b
|
||||
VKEY_NUMLOCK = 0000000010000000b
|
||||
VKEY_SCRLOCK = 0000000100000000b
|
||||
|
||||
VKEY_SHIFT = 0000000000000011b
|
||||
VKEY_CONTROL = 0000000000001100b
|
||||
VKEY_ALT = 0000000000110000b
|
||||
|
||||
uglobal
|
||||
align 4
|
||||
kb_state dd 0
|
||||
ext_code db 0
|
||||
|
||||
keyboard_mode db 0
|
||||
keyboard_data db 0
|
||||
|
||||
altmouseb db 0
|
||||
ctrl_alt_del db 0
|
||||
|
||||
kb_lights db 0
|
||||
endg
|
||||
|
||||
align 4
|
||||
irq1:
|
||||
pushad
|
||||
push ds es
|
||||
mov ax, os_data
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
|
||||
movzx eax,word[0x3004] ; top window process
|
||||
movzx eax,word[0xC400+eax*2]
|
||||
shl eax,8
|
||||
mov al,[0x800B4+eax]
|
||||
mov [keyboard_mode],al
|
||||
|
||||
in al,0x60
|
||||
mov [keyboard_data],al
|
||||
|
||||
mov ch,al
|
||||
cmp al,0xE0
|
||||
je @f
|
||||
cmp al,0xE1
|
||||
jne .normal_code
|
||||
@@: mov [ext_code],al
|
||||
jmp .no_key.end
|
||||
.normal_code:
|
||||
mov cl,[ext_code]
|
||||
mov [ext_code],0
|
||||
and al,0x7F
|
||||
@@: cmp al,0x2A
|
||||
jne @f
|
||||
cmp cl,0xE0
|
||||
je .no_key.end
|
||||
mov eax,VKEY_LSHIFT
|
||||
jmp .no_key
|
||||
@@: cmp al,0x36
|
||||
jne @f
|
||||
cmp cl,0xE0
|
||||
je .no_key.end
|
||||
mov eax,VKEY_RSHIFT
|
||||
jmp .no_key
|
||||
@@: cmp al,0x38
|
||||
jne @f
|
||||
cmp cl,0xE0
|
||||
je .alt.r
|
||||
mov eax,VKEY_LALT
|
||||
jmp .no_key
|
||||
.alt.r:
|
||||
mov eax,VKEY_RALT
|
||||
jmp .no_key
|
||||
@@: cmp al,0x1D
|
||||
jne @f
|
||||
cmp cl,0
|
||||
jne .ctrl.r
|
||||
mov eax,VKEY_LCONTROL
|
||||
jmp .no_key
|
||||
.ctrl.r:
|
||||
cmp cl,0xE1
|
||||
jne .ctrl.r.2
|
||||
mov [ext_code],cl
|
||||
jmp .no_key.end
|
||||
.ctrl.r.2:
|
||||
mov eax,VKEY_RCONTROL
|
||||
jmp .no_key
|
||||
@@: cmp al,0x3A
|
||||
jne @f
|
||||
mov bl,4
|
||||
mov eax,VKEY_CAPSLOCK
|
||||
jmp .no_key.xor
|
||||
@@: cmp al,0x45
|
||||
jne @f
|
||||
cmp cl,0
|
||||
jne .no_key.end
|
||||
mov bl,2
|
||||
mov eax,VKEY_NUMLOCK
|
||||
jmp .no_key.xor
|
||||
@@: cmp al,0x46
|
||||
jne @f
|
||||
mov bl,1
|
||||
mov eax,VKEY_SCRLOCK
|
||||
jmp .no_key.xor
|
||||
@@:
|
||||
test ch,0x80
|
||||
jnz .no_key.end
|
||||
movzx eax,ch ; plain key
|
||||
mov bl,[keymap+eax]
|
||||
mov edx,[kb_state]
|
||||
test dl,VKEY_CONTROL ; ctrl alt del
|
||||
jz .noctrlaltdel
|
||||
test dl,VKEY_ALT
|
||||
jz .noctrlaltdel
|
||||
cmp bl,134+48
|
||||
jne .noctrlaltdel
|
||||
mov [ctrl_alt_del],1
|
||||
jmp .no_key.end
|
||||
.noctrlaltdel:
|
||||
test dl,VKEY_CONTROL ; ctrl on ?
|
||||
jz @f
|
||||
sub bl,0x60
|
||||
@@: test dl,VKEY_SHIFT ; shift on ?
|
||||
jz @f
|
||||
mov bl,[keymap_shift+eax]
|
||||
@@: test dl,VKEY_ALT ; alt on ?
|
||||
jz @f
|
||||
mov bl,[keymap_alt+eax]
|
||||
; alt mouse ?
|
||||
xor edx,edx
|
||||
cmp bl,178
|
||||
jnz .no_alt.up
|
||||
mov edx,5*65536
|
||||
jmp .mouse.change
|
||||
.no_alt.up:
|
||||
cmp bl,177
|
||||
jnz .no_alt.down
|
||||
mov edx,251*65536
|
||||
jmp .mouse.change
|
||||
.no_alt.down:
|
||||
cmp bl,176
|
||||
jnz .no_alt.left
|
||||
mov edx,251*256
|
||||
jmp .mouse.change
|
||||
.no_alt.left:
|
||||
cmp bl,179
|
||||
jnz .no_alt.right
|
||||
mov edx,5*256
|
||||
jmp .mouse.change
|
||||
.no_alt.right:
|
||||
cmp bl,' '
|
||||
jne @f
|
||||
xor [altmouseb],1
|
||||
.mouse.change:
|
||||
mov byte[0xF604],1; ps2 data
|
||||
mov byte[0xFB00],0; ps2 chunk count
|
||||
mov word[0x2E0000+4096*12],3; mouse data count
|
||||
mov dl,[altmouseb]
|
||||
mov [0x2E0000+4096*12+0x10],edx
|
||||
mov bl,0
|
||||
@@:
|
||||
cmp [keyboard_mode],0 ; return from keymap
|
||||
jne .no_key.end
|
||||
mov [keyboard_mode_sys],0
|
||||
cmp bl,0
|
||||
je .no_key.end
|
||||
movzx eax,byte[0xF400]
|
||||
cmp al,120
|
||||
jae .no_key.end
|
||||
inc al
|
||||
mov [0xF400],al
|
||||
mov [0xF400+eax],bl
|
||||
|
||||
jmp .no_key.end
|
||||
|
||||
.no_key:
|
||||
test ch,0x80
|
||||
jz .no_key.down
|
||||
not eax
|
||||
and [kb_state],eax
|
||||
jmp .no_key.end
|
||||
.no_key.xor:
|
||||
test ch,0x80
|
||||
jnz .no_key.end
|
||||
xor [kb_state],eax
|
||||
xor [kb_lights],bl
|
||||
call set_lights
|
||||
jmp .no_key.end
|
||||
.no_key.down:
|
||||
or [kb_state],eax
|
||||
.no_key.end:
|
||||
cmp [keyboard_mode],1 ; return scancode
|
||||
jne .no_scancode
|
||||
mov [keyboard_mode_sys],1
|
||||
movzx eax,byte[0xF400]
|
||||
cmp al,120
|
||||
jae .no_scancode
|
||||
inc al
|
||||
mov [0xF400],al
|
||||
mov [0xF400+eax],ch
|
||||
.no_scancode:
|
||||
|
||||
.exit.irq1:
|
||||
mov [check_idle_semaphore],5
|
||||
|
||||
mov al,0x20 ; ready for next irq
|
||||
out 0x20,al
|
||||
|
||||
pop es ds
|
||||
popad
|
||||
iret
|
||||
|
||||
set_lights:
|
||||
mov al,0xED
|
||||
call kb_write
|
||||
mov al,[kb_lights]
|
||||
call kb_write
|
||||
ret
|
||||
|
||||
;// mike.dld ]
|
191
kernel/tags/kolibri0.5.2.1/hid/set_dtc.inc
Normal file
@@ -0,0 +1,191 @@
|
||||
;setting date,time,clock and alarm-clock
|
||||
;add sys_settime at servetable as for ex. 22 fcn:
|
||||
; 22 - SETTING DATE TIME, CLOCK AND ALARM-CLOCK
|
||||
; ebx =0 - set time ecx - 00SSMMHH
|
||||
; ebx =1 - set date ecx=00DDMMYY
|
||||
; ebx =2 - set day of week ecx- 1-7
|
||||
; ebx =3 - set alarm-clock ecx - 00SSMMHH
|
||||
; out: 0 -Ok 1 -wrong format 2 -battery low
|
||||
sys_settime:
|
||||
mov ecx,eax
|
||||
cli
|
||||
mov al,0x0d
|
||||
out 0x70,al
|
||||
in al,0x71
|
||||
bt ax,7
|
||||
jnc bat_low
|
||||
cmp ecx,2 ;day of week
|
||||
jne nosetweek
|
||||
test ebx,ebx ;test day of week
|
||||
je wrongtime
|
||||
cmp ebx,7
|
||||
ja wrongtime
|
||||
mov dx,0x70
|
||||
call startstopclk
|
||||
dec edx
|
||||
mov al,6
|
||||
out dx,al
|
||||
inc edx
|
||||
mov al,bl
|
||||
out dx,al
|
||||
jmp endsettime
|
||||
nosetweek: ;set date
|
||||
cmp ecx,1
|
||||
jne nosetdate
|
||||
cmp bl,0x99 ;test year
|
||||
ja wrongtime
|
||||
shl ebx,4
|
||||
cmp bl,0x90
|
||||
ja wrongtime
|
||||
cmp bh,0x99 ;test month
|
||||
ja wrongtime
|
||||
shr ebx,4
|
||||
test bh,bh
|
||||
je wrongtime
|
||||
cmp bh,0x12
|
||||
ja wrongtime
|
||||
shl ebx,8
|
||||
bswap ebx ;ebx=00YYMMDD
|
||||
test bl,bl ;test day
|
||||
je wrongtime
|
||||
shl ebx,4
|
||||
cmp bl,0x90
|
||||
ja wrongtime
|
||||
shr ebx,4
|
||||
cmp bh,2 ;February
|
||||
jne testday
|
||||
cmp bl,0x29
|
||||
ja wrongtime
|
||||
jmp setdate
|
||||
testday:
|
||||
cmp bh,8
|
||||
jb testday1 ;Aug-Dec
|
||||
bt bx,8
|
||||
jnc days31
|
||||
jmp days30
|
||||
testday1:
|
||||
bt bx,8 ;Jan-Jul ex.Feb
|
||||
jnc days30
|
||||
days31:
|
||||
cmp bl,0x31
|
||||
ja wrongtime
|
||||
jmp setdate
|
||||
days30:
|
||||
cmp bl,0x30
|
||||
ja wrongtime
|
||||
setdate:
|
||||
mov dx,0x70
|
||||
call startstopclk
|
||||
dec edx
|
||||
mov al,7 ;set days
|
||||
out dx,al
|
||||
inc edx
|
||||
mov al,bl
|
||||
out dx,al
|
||||
dec edx
|
||||
mov al,8 ;set months
|
||||
out dx,al
|
||||
inc edx
|
||||
mov al,bh
|
||||
out dx,al
|
||||
dec edx
|
||||
mov al,9 ;set years
|
||||
out dx,al
|
||||
inc edx
|
||||
shr ebx,8
|
||||
mov al,bh
|
||||
out dx,al
|
||||
jmp endsettime
|
||||
nosetdate: ;set time or alarm-clock
|
||||
cmp ecx,3
|
||||
ja wrongtime
|
||||
cmp bl,0x23
|
||||
ja wrongtime
|
||||
cmp bh,0x59
|
||||
ja wrongtime
|
||||
shl ebx,4
|
||||
cmp bl,0x90
|
||||
ja wrongtime
|
||||
cmp bh,0x92
|
||||
ja wrongtime
|
||||
shl ebx,4
|
||||
bswap ebx ;00HHMMSS
|
||||
cmp bl,0x59
|
||||
ja wrongtime
|
||||
shl ebx,4
|
||||
cmp bl,0x90
|
||||
ja wrongtime
|
||||
shr ebx,4
|
||||
mov dx,0x70
|
||||
call startstopclk
|
||||
dec edx
|
||||
cmp ecx,3
|
||||
je setalarm
|
||||
xor eax,eax ;al=0-set seconds
|
||||
out dx,al
|
||||
inc edx
|
||||
mov al,bl
|
||||
out dx,al
|
||||
dec edx
|
||||
mov al,2 ;set minutes
|
||||
out dx,al
|
||||
inc edx
|
||||
mov al,bh
|
||||
out dx,al
|
||||
dec edx
|
||||
mov al,4 ;set hours
|
||||
out dx,al
|
||||
inc edx
|
||||
shr ebx,8
|
||||
mov al,bh
|
||||
out dx,al
|
||||
jmp endsettime
|
||||
setalarm:
|
||||
mov al,1 ;set seconds for al.
|
||||
out dx,al
|
||||
inc edx
|
||||
mov al,bl
|
||||
out dx,al
|
||||
dec edx
|
||||
mov al,3 ;set minutes for al.
|
||||
out dx,al
|
||||
inc edx
|
||||
mov al,bh
|
||||
out dx,al
|
||||
dec edx
|
||||
mov al,5 ;set hours for al.
|
||||
out dx,al
|
||||
inc edx
|
||||
shr ebx,8
|
||||
mov al,bh
|
||||
out dx,al
|
||||
dec edx
|
||||
mov al,0x0b ;enable irq's
|
||||
out dx,al
|
||||
inc dx
|
||||
in al,dx
|
||||
bts ax,5 ;set bit 5
|
||||
out dx,al
|
||||
endsettime:
|
||||
dec edx
|
||||
call startstopclk
|
||||
sti
|
||||
mov [esp+36],dword 0
|
||||
ret
|
||||
bat_low:
|
||||
sti
|
||||
mov [esp+36],dword 2
|
||||
ret
|
||||
wrongtime:
|
||||
sti
|
||||
mov [esp+36],dword 1
|
||||
ret
|
||||
|
||||
startstopclk:
|
||||
mov al,0x0b
|
||||
out dx,al
|
||||
inc dx
|
||||
in al,dx
|
||||
btc ax,7
|
||||
out dx,al
|
||||
ret
|
5571
kernel/tags/kolibri0.5.2.1/kernel.asm
Normal file
31
kernel/tags/kolibri0.5.2.1/kernel16.inc
Normal file
@@ -0,0 +1,31 @@
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; KERNEL16.INC ;;
|
||||
;; ;;
|
||||
;; Included 16 bit kernel files for MenuetOS ;;
|
||||
;; ;;
|
||||
;; This file is kept separate as it will be easier to ;;
|
||||
;; maintain and compile with an automated SETUP program ;;
|
||||
;; in the future. ;;
|
||||
;; ;;
|
||||
;; Copyright Ville Turjanmaa, see file COPYING for details. ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
|
||||
;% +include
|
||||
|
||||
;!!!
|
||||
if lang eq en
|
||||
include "boot/booteng.inc" ; english system boot messages
|
||||
else
|
||||
include "boot/bootru.inc" ; russian system boot messages
|
||||
;!!!
|
||||
end if
|
||||
include "boot/ru.inc" ; Russian font
|
||||
|
||||
include "boot/bootcode.inc" ; 16 bit system boot code
|
||||
|
||||
include "bus/pci/pci16.inc"
|
||||
|
||||
;% -include
|
104
kernel/tags/kolibri0.5.2.1/kernel32.inc
Normal file
@@ -0,0 +1,104 @@
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; KERNEL32.INC ;;
|
||||
;; ;;
|
||||
;; Included 32 bit kernel files for MenuetOS ;;
|
||||
;; ;;
|
||||
;; This file is kept separate as it will be easier to ;;
|
||||
;; maintain and compile with an automated SETUP program ;;
|
||||
;; in the future. ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
; structure definition helper
|
||||
macro struct name, [arg]
|
||||
{
|
||||
common
|
||||
name@struct fix name
|
||||
struc name arg {
|
||||
}
|
||||
|
||||
macro struct_helper name
|
||||
{
|
||||
virtual at 0
|
||||
name name
|
||||
sizeof.#name = $ - name
|
||||
name equ sizeof.#name
|
||||
end virtual
|
||||
}
|
||||
|
||||
ends fix } struct_helper name@struct
|
||||
|
||||
|
||||
; Core functions
|
||||
include "core/sync.inc"
|
||||
include "core/sys32.inc" ; process management
|
||||
include "core/sched.inc" ; process scheduling
|
||||
include "core/syscall.inc" ; system call
|
||||
include "core/mem.inc" ; high-level memory management
|
||||
include "core/newproce.inc" ;new process management
|
||||
include "core/physmem.inc" ; access to physical memory for applications
|
||||
include "core/sync.inc" ; macros for synhronization objects
|
||||
|
||||
; GUI stuff
|
||||
include "gui/window.inc"
|
||||
include "gui/event.inc"
|
||||
include "gui/font.inc"
|
||||
include "gui/button.inc"
|
||||
|
||||
; shutdown
|
||||
|
||||
include "boot/shutdown.inc" ; shutdown or restart
|
||||
|
||||
; file system
|
||||
|
||||
include "fs/fs.inc" ; syscall
|
||||
include "fs/fat32.inc" ; read / write for fat32 filesystem
|
||||
include "fs/fat12.inc" ; read / write for fat12 filesystem
|
||||
include "blkdev/rd.inc" ; ramdisk read /write
|
||||
|
||||
; sound
|
||||
|
||||
include "sound/sb16.inc" ; playback for Sound Blaster 16
|
||||
include "sound/playnote.inc" ; player Note for Speaker PC
|
||||
|
||||
; display
|
||||
|
||||
include "video/vesa12.inc" ; Vesa 1.2 functions
|
||||
include "video/vesa20.inc" ; Vesa 2.0 functions
|
||||
include "video/vga.inc" ; VGA 16 color functions
|
||||
|
||||
; Network Interface & TCPIP Stack
|
||||
|
||||
include "network/stack.inc"
|
||||
|
||||
; Mouse pointer
|
||||
|
||||
include "gui/mouse.inc"
|
||||
|
||||
; Window skinning
|
||||
|
||||
include "gui/skincode.inc"
|
||||
|
||||
; Pci functions
|
||||
|
||||
include "bus/pci/pci32.inc"
|
||||
|
||||
; Floppy drive controller
|
||||
|
||||
include "blkdev/fdc.inc"
|
||||
include "blkdev/flp_drv.inc"
|
||||
|
||||
; CD drive controller
|
||||
|
||||
include "blkdev/cdrom.inc"
|
||||
|
||||
; Character devices
|
||||
|
||||
include "hid/keyboard.inc"
|
||||
|
||||
; setting date,time,clock and alarm-clock
|
||||
|
||||
include "hid/set_dtc.inc"
|
||||
|
||||
;% -include
|
50
kernel/tags/kolibri0.5.2.1/kglobals.inc
Normal file
@@ -0,0 +1,50 @@
|
||||
;------------------------------------------------------------------
|
||||
; use "iglobal" for inserting initialized global data definitions.
|
||||
;------------------------------------------------------------------
|
||||
macro iglobal {
|
||||
IGlobals equ IGlobals,
|
||||
macro __IGlobalBlock { }
|
||||
|
||||
;-------------------------------------------------------------
|
||||
; use 'uglobal' for inserting uninitialized global definitions.
|
||||
; even when you define some data values, these variables
|
||||
; will be stored as uninitialized data.
|
||||
;-------------------------------------------------------------
|
||||
macro uglobal {
|
||||
UGlobals equ UGlobals,
|
||||
macro __UGlobalBlock { }
|
||||
|
||||
endg fix } ; Use endg for ending iglobal and uglobal blocks.
|
||||
|
||||
macro IncludeIGlobals{
|
||||
macro IGlobals dummy,[n] \{ __IGlobalBlock
|
||||
purge __IGlobalBlock \}
|
||||
match I, IGlobals \{ I \} }
|
||||
|
||||
|
||||
macro IncludeUGlobals{
|
||||
macro UGlobals dummy,[n] \{
|
||||
\common
|
||||
\local begin, size
|
||||
begin = $
|
||||
virtual at $
|
||||
\forward
|
||||
__UGlobalBlock
|
||||
purge __UGlobalBlock
|
||||
\common
|
||||
size = $ - begin
|
||||
end virtual
|
||||
rb size
|
||||
\}
|
||||
match U, UGlobals \{ U \} }
|
||||
|
||||
macro IncludeAllGlobals {
|
||||
IncludeIGlobals
|
||||
IncludeUGlobals
|
||||
}
|
||||
|
||||
iglobal
|
||||
endg
|
||||
|
||||
uglobal
|
||||
endg
|
16
kernel/tags/kolibri0.5.2.1/makefile
Normal file
@@ -0,0 +1,16 @@
|
||||
FASM=./fasm
|
||||
KSRC=kernel.asm
|
||||
KOUT=kernel.mnt
|
||||
|
||||
en: kernel.asm
|
||||
rm -f lang.inc
|
||||
echo lang fix en > lang.inc
|
||||
$(FASM) $(KSRC) $(KOUT)
|
||||
ru: kernel.asm
|
||||
rm -f lang.inc
|
||||
echo lang fix ru > lang.inc
|
||||
$(FASM) $(KSRC) $(KOUT)
|
||||
|
||||
clean:
|
||||
rm -f $(KOUT)
|
||||
rm -f lang.inc
|