diff --git a/API.md b/API.md deleted file mode 100755 index 63371c4..0000000 --- a/API.md +++ /dev/null @@ -1,97 +0,0 @@ -Liste exhaustive des APIs supportée par cos -78 fonctions - -Drive.sys : Gestionnaires FAT,FIT et partition -Interruption 48h (Disquette uniquement) -fonctions 00h readsector - 01h writesector - 02h verifysector - 03h loadfatway - 04h loadfile - 05h compressrle - 06h decompressrle -lpt.sys : Gestionnaires port parallèle -Interruption 0Dh (LPT1) ou 0Fh (LPT2) -fonctions 00h getlptin - 01h getlptout - 02h getlptinout - 03h setlptin - 04h setlptout - 05h setlptinout - 06h getlpt - 07h getfirstlpt - 08h setemettor - 09h setreceptor - 0Ah settimeout - 0Bh gettimeout - 0Ch receivelpt - 0Dh sendlpt - 0Eh receivelptblock - 0Fh sendlptblock - 10h receivecommand - 11h sendcommand -mouse.sys : Gestionnaires souris -Interruption 74h (PS/2) -fonctions 00h cmdmouse - 01h cmdmouse2 - 02h detectmouse - 03h getmouse - 04h getmousescreen - 05h configmouse -pic8259a.sys : Gestionnaires contrôleur d'interruption programmable -Interruption 50h (Maître et esclave) -fonctions 00h enableirq - 01h disableirq - 02h readmaskirq - 03h readirr - 04h readisr - 05h installhandler - 06h replacehandler - 07h getint - 08h setint - 09h seteoi -video.sys : Gestionnaires de la carte video -Interruption 47h (VGA) -fonctions 00h setvideomode - 01h getvideomode - 02h cleartext - 03h changefont - 04h loadfont - 05h space - 06h line - 07h showchar - 08h showint - 09h showsigned - 0Ah showhex - 0Bh showbin - 0Ch showstring - 0Dh showstring0 - 0Eh showcharat - 0Fh showintat - 10h showsignedat - 11h showhexat - 12h showbinat - 13h showstringat - 14h showstring0at - 15h setcolor - 16h getcolor - 17h scrolldown - 18h getxy - 19h setxy - 1Ah savescreen - 1Bh restorescreen - 1Ch page2to1 - 1Dh page1to2 - 1Eh xchgPages - 1Fh savepage1 - 20h changelineattr - 21h waitretrace - 22h getinfos - 23h loadbmp - 24h showbmp - 25h clearscr - 26h savedac - 27h restoredac - 28h savestate - 29h restorestate - \ No newline at end of file diff --git a/INFORMATIONS.md b/INFORMATIONS.md old mode 100755 new mode 100644 index 67732ea..b6af644 --- a/INFORMATIONS.md +++ b/INFORMATIONS.md @@ -1,53 +1,268 @@ - < COS2000 the new operating system > - - -I. Présentation - - COS2000, par définition, est système d'exploitation. Celui-ci prend la direction des opérations à partir - du moment où le PC est mis sous tension (Après le BIOS). Il gère tous les périphériques rattachés au PC et -offre aux programmeurs les moyens de développer des applications compatibles en fournissant des APIs -(Application Programming Interface). COS2000 est basé sur un concept particulier qui est d'offrir aux -programmeurs un maximum de fonctions intégrées pour faciliter le travail des programmeurs et réduire la -taille des programmes. - -II. Comment l'installer ? - - Pour installer COS2000 : - - - Insérez une disquette 1.44 Mo vierge ou inutile dans votre lecteur. - - Lancez le programme SETUP.COM situé dans le dossier de COS2000. - - Si celui-ci ne détecte pas d'erreur, COS2000 est installé ! - - Pour lancer COS2000 : - - - Insérez la disquette où COS2000 est installé. - - Veillez que dans le BIOS vous puissiez démarrer à partir de A:. - - Redémarrer votre ordinateur et vous serez sur COS2000. - - Il est possible de télécharger une version plus récente de COS2000 à : - - https://github.com/dahut87/cos2000v1 - -III. Mode d'emploi - - Le COS MENU LOADER est le premier logiciel qui est lancé au démarrage. A partir de celui-ci, vous pouvez -visionner tout les fichiers présents sur votre disquette et éventuellement les exécuter s'ils possèdent -l'extension EXE . Pour cela, il suffit de sélectionner avec la ligne en surbrillance le programme à exécuter -en utilisant les flèches de direction. Pour exécuter le programmer, pressez la touche "Entrée". - - A partir du COS MENU LOADER on peut lancer un interpréteur de commandes . Celui-ci s'appelle PROMPT.EXE. -Une fois dans l'interpréteur de commande, vous pouvez tout aussi bien lancer des logiciels en saisissant leurs -noms après "COS>". - -En plus des logiciels, l'interpréteur de commandes peut exécuter 6 commandes : - - EXIT Quitte l'interpréteur - VERSION Donne la version de COS2000 - CLS Efface l'écran - REBOOT Redémarre le PC - COMMAND Donne la liste des commandes disponibles - MODE [mode] Permet de changer de mode vidéo. [mode] doit être un entier compris entre 1 et 9. les - modes au delà de 4 sont des modes graphiques à texte émulé. Il est déconseillé de les - utiliser car il est parfois impossible de revenir aux modes texte. - -Les possibilités de COS2000 sont aujourd'hui très limitées car il est en cours de développement. +![logo](https://github.com/dahut87/cos2000v1/raw/master/graphisme/logo.png) +## Documentation d'origine (importée) + +COS 2000 +Compatible Operating System + + + + Présentation + Comment l’installer + Mode d’emploi + Faire un programme pour COS + Liste des APIs + En cas de problème + + mailto:nicolas@palon.fr + + +Présentation + + COS2000, par définition, est système d'exploitation. Celui-ci prend la direction des opérations à partir du moment où le PC est mis sous tension (Après le BIOS). Il gère tous les périphériques rattachés au PC et offre aux programmeurs les moyens de développer des applications compatibles en fournissant des APIs (Application Programming Interface). COS2000 est basé sur un concept particulier qui est d'offrir aux programmeurs un maximum de fonctions intégrées pour faciliter le travail des programmeurs et réduire la taille des programmes. + +Comment l'installer ? + + Pour installer COS2000 : + + Sous dos/windows + + Insérez une disquette 1.44 Mo vierge ou inutile dans votre lecteur. + Lancez le programme SETUP.COM situé dans le dossier de COS2000. +- Si celui ci ne détecte pas d'erreur, COS2000 est installé ! + + Sous Linux + + Insérez une disquette 1.44 Mo vierge ou inutile dans votre lecteur. + Lancez le programme SETUP.SH situé dans le dossier de COS2000. +- Si celui ci ne détecte pas d'erreur, COS2000 est installé ! + + Pour lancer COS2000 : + + Insérez la disquette où COS2000 est installé. + Veillez que dans le BIOS vous puissiez démarrer à partir de A:. + Redémarrer votre ordinateur et vous serez sur COS2000. + + + +Mode d'emploi + + L’interpréteur de commande COS est le premier logiciel qui est lancé au démarrage. A partir de celui-ci vous pouvez exécuter quelques commandes ou logiciels. + +En plus des logiciels, l'interpréteur de commandes peut exécuter 6 commandes : + + QUIT + Quitte l'interpréteur. + + VERS + Donne la version de COS2000. + + EFFAC + Efface l'écran. + + REDEM + Redémarre le PC. + + CMDS + Donne la liste des commandes disponibles. + + MODE [mode] +Permet de changer de mode vidéo. [mode] doit être un entier compris entre 1 et 9. les modes au delà de 4 sont des modes graphiques à texte émulé. Il est déconseillé de les utiliser car il est parfois impossible de revenir aux modes texte. + + LIRE + Permet de lire un support disquette 1.44 Mo au format FAT12. + + CH + Change le dossier actuel vers celui spécifié. + + VOIR + Permet de lister le contenu du dossier actuel. + + +Faire un programme pour COS + + Toute contribution à COS 2000 en terme de programme est la bienvenue, un répertoire « contribs » contiendra les programmes des différents contributeurs. Aucune modification a ceux-ci ne sera faire sans l’accord explicite de l’auteur. Pour une contribution écrivez moi a l’adresse mailto:nicolas@palon.fr. + +Pour l’instant il n’y a aucun formatage particulier du code à respecter pour faire un programme pour COS 2000. Il faut pour l’instant seulement un point d’entrée en 0100h comme un .COM de dos, 64 Ko sont donc disponible au programme, la pile utilisé est celle du système d’exploitation, c’est donc le seul segment qui ne sera pas initialisé comme les autres. + + + + + + + + + +Pour clore le programme il suffit de faire un retour far. +Exemple avec un Hello Word. + + Avec tasm + +.model tiny ;model tiny (.com) +.486 ;Pour processeur 80486 +Smart ;Optimisations +.code ;Segment de code + +org 0100h ;Point d’entré en 0100h + +start: + mov ah,0Dh + mov si,offset msg + int 47h ;Afficher le texte pointé par DS:SI (Showstring0) + xor ax,ax + int 16h ;Attendre l’appuie sur une touche + db 0CBH ;retour far + +msg db ‘Hello World’,0 +end start + + Avec nasm + +[bits 16] ;16 bits +[org 0x0100] ;Point d’entré en 0100h +section .text ;Segment de code + +start: + mov ah,0x0D + mov si,msg + int 0x47 ;Afficher le texte pointé par DS:SI (Showstring0) + xor ax,ax + int 0x16 ;Attendre l’appuie sur une touche + retf ;retour far + +msg db ‘Hello World’,0 + + + Comme vous pouvez le constater l’appel des APIs de Cos se réalise par le biais d’interruptions logiciels dont voici la liste. + +Liste des APIs + +disque.sys : Gestionnaires FAT12 et Disquette +Interruption 48h (Disquette uniquement) + +00h readsector + 01h writesector + 02h verifysector + 03h initdrive + 04h loadfile + 05h compressrle + 06h decompressrle + 07h findfirstfile + 08h getfreespace + 09h searchfile + 0Ah getname + 0Bh getserial + 0Ch changedir + 0Dh readcluster + 0Eh writecluster + 0Fh getdir + +port.sys : Gestionnaires port parallèle +Interruption 0Dh (LPT1) ou 0Fh (LPT2) + +00h getlptin + 01h getlptout + 02h getlptinout + 03h setlptin + 04h setlptout + 05h setlptinout + 06h getlpt + 07h getfirstlpt + 08h setemettor + 09h setreceptor + 0Ah settimeout + 0Bh gettimeout + 0Ch receivelpt + 0Dh sendlpt + 0Eh receivelptblock + 0Fh sendlptblock + 10h receivecommand + 11h sendcommand + +souris.sys : Gestionnaires souris +Interruption 74h (PS/2) + +00h cmdmouse + 01h cmdmouse2 + 02h detectmouse + 03h getmouse + 04h getmousescreen + 05h configmouse + +8259a.sys : Gestionnaires contrôleur d'interruption programmable +Interruption 50h (Maître et esclave) + +00h enableirq + 01h disableirq + 02h readmaskirq + 03h readirr + 04h readisr + 05h installhandler + 06h replacehandler + 07h getint + 08h setint + 09h seteoi + +video.sys : Gestionnaires de la carte vidéo +Interruption 47h (VGA) + +00h setvideomode + 01h getvideomode + 02h cleartext + 03h changefont + 04h loadfont + 05h space + 06h line + 07h showchar + 08h showint + 09h showsigned + 0Ah showhex + 0Bh showbin + 0Ch showstring + 0Dh showstring0 + 0Eh showcharat + 0Fh showintat + 10h showsignedat + 11h showhexat + 12h showbinat + 13h showstringat + 14h showstring0at + 15h setcolor + 16h getcolor + 17h scrolldown + 18h getxy + 19h setxy + 1Ah savescreen + 1Bh restorescreen + 1Ch page2to1 + 1Dh page1to2 + 1Eh xchgPages + 1Fh savepage1 + 20h changelineattr + 21h waitretrace + 22h getinfos + 23h loadbmp + 24h showbmp + 25h clearscr + 26h savedac + 27h restoredac + 28h savestate + 29h restorestate + 30h enablescroll + 31h disablescroll + 32h showdate + 33h showtime + 34h showname + 35h showattr + 36h showsize + +Pour l’instant je n’ai pas fait de guide détaillé de l’utilisation des fonctions de COS… A venir + +Les possibilités de COS2000 sont aujourd'hui très limitées car il est en cours de développement. + +En cas de problèmes + + Si des bugs surviennent ou si COS2000 ne veut pas s'installer, veuillez s'il vous plaît m'envoyer un E Mail à : + + mailto:nicolas@palon.fr + +COS2000 n'exploite pas les disques durs, il est donc impossible qu'il altère de quelque manière que ce soit vos données !!!!!!!!!!!!! diff --git a/LICENSE.md b/LICENSE.md old mode 100755 new mode 100644 index 7d1f860..01a7a80 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,342 +1,675 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. - - +### GNU GENERAL PUBLIC LICENSE + +Version 3, 29 June 2007 + +Copyright (C) 2007 Free Software Foundation, Inc. + + +Everyone is permitted to copy and distribute verbatim copies of this +license document, but changing it is not allowed. + +### Preamble + +The GNU General Public License is a free, copyleft license for +software and other kinds of works. + +The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom +to share and change all versions of a program--to make sure it remains +free software for all its users. We, the Free Software Foundation, use +the GNU General Public License for most of our software; it applies +also to any other work released this way by its authors. You can apply +it to your programs, too. + +When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + +To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you +have certain responsibilities if you distribute copies of the +software, or if you modify it: responsibilities to respect the freedom +of others. + +For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + +Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + +For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + +Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the +manufacturer can do so. This is fundamentally incompatible with the +aim of protecting users' freedom to change the software. The +systematic pattern of such abuse occurs in the area of products for +individuals to use, which is precisely where it is most unacceptable. +Therefore, we have designed this version of the GPL to prohibit the +practice for those products. If such problems arise substantially in +other domains, we stand ready to extend this provision to those +domains in future versions of the GPL, as needed to protect the +freedom of users. + +Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish +to avoid the special danger that patents applied to a free program +could make it effectively proprietary. To prevent this, the GPL +assures that patents cannot be used to render the program non-free. + +The precise terms and conditions for copying, distribution and +modification follow. + +### TERMS AND CONDITIONS + +#### 0. Definitions. + +"This License" refers to version 3 of the GNU General Public License. + +"Copyright" also means copyright-like laws that apply to other kinds +of works, such as semiconductor masks. + +"The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + +To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of +an exact copy. The resulting work is called a "modified version" of +the earlier work or a work "based on" the earlier work. + +A "covered work" means either the unmodified Program or a work based +on the Program. + +To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + +To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user +through a computer network, with no transfer of a copy, is not +conveying. + +An interactive user interface displays "Appropriate Legal Notices" to +the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + +#### 1. Source Code. + +The "source code" for a work means the preferred form of the work for +making modifications to it. "Object code" means any non-source form of +a work. + +A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + +The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + +The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + +The Corresponding Source need not include anything that users can +regenerate automatically from other parts of the Corresponding Source. + +The Corresponding Source for a work in source code form is that same +work. + +#### 2. Basic Permissions. + +All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + +You may make, run and propagate covered works that you do not convey, +without conditions so long as your license otherwise remains in force. +You may convey covered works to others for the sole purpose of having +them make modifications exclusively for you, or provide you with +facilities for running those works, provided that you comply with the +terms of this License in conveying all material for which you do not +control copyright. Those thus making or running the covered works for +you must do so exclusively on your behalf, under your direction and +control, on terms that prohibit them from making any copies of your +copyrighted material outside their relationship with you. + +Conveying under any other circumstances is permitted solely under the +conditions stated below. Sublicensing is not allowed; section 10 makes +it unnecessary. + +#### 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + +No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + +When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such +circumvention is effected by exercising rights under this License with +respect to the covered work, and you disclaim any intention to limit +operation or modification of the work as a means of enforcing, against +the work's users, your or third parties' legal rights to forbid +circumvention of technological measures. + +#### 4. Conveying Verbatim Copies. + +You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + +You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + +#### 5. Conveying Modified Source Versions. + +You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these +conditions: + +- a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. +- b) The work must carry prominent notices stating that it is + released under this License and any conditions added under + section 7. This requirement modifies the requirement in section 4 + to "keep intact all notices". +- c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. +- d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + +A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + +#### 6. Conveying Non-Source Forms. + +You may convey a covered work in object code form under the terms of +sections 4 and 5, provided that you also convey the machine-readable +Corresponding Source under the terms of this License, in one of these +ways: + +- a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. +- b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the Corresponding + Source from a network server at no charge. +- c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. +- d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. +- e) Convey the object code using peer-to-peer transmission, + provided you inform other peers where the object code and + Corresponding Source of the work are being offered to the general + public at no charge under subsection 6d. + +A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + +A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, +family, or household purposes, or (2) anything designed or sold for +incorporation into a dwelling. In determining whether a product is a +consumer product, doubtful cases shall be resolved in favor of +coverage. For a particular product received by a particular user, +"normally used" refers to a typical or common use of that class of +product, regardless of the status of the particular user or of the way +in which the particular user actually uses, or expects or is expected +to use, the product. A product is a consumer product regardless of +whether the product has substantial commercial, industrial or +non-consumer uses, unless such uses represent the only significant +mode of use of the product. + +"Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to +install and execute modified versions of a covered work in that User +Product from a modified version of its Corresponding Source. The +information must suffice to ensure that the continued functioning of +the modified object code is in no case prevented or interfered with +solely because modification has been made. + +If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + +The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or +updates for a work that has been modified or installed by the +recipient, or for the User Product in which it has been modified or +installed. Access to a network may be denied when the modification +itself materially and adversely affects the operation of the network +or violates the rules and protocols for communication across the +network. + +Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + +#### 7. Additional Terms. + +"Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + +When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + +Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders +of that material) supplement the terms of this License with terms: + +- a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or +- b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or +- c) Prohibiting misrepresentation of the origin of that material, + or requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or +- d) Limiting the use for publicity purposes of names of licensors + or authors of the material; or +- e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or +- f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions + of it) with contractual assumptions of liability to the recipient, + for any liability that these contractual assumptions directly + impose on those licensors and authors. + +All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + +If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + +Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; the +above requirements apply either way. + +#### 8. Termination. + +You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + +However, if you cease all violation of this License, then your license +from a particular copyright holder is reinstated (a) provisionally, +unless and until the copyright holder explicitly and finally +terminates your license, and (b) permanently, if the copyright holder +fails to notify you of the violation by some reasonable means prior to +60 days after the cessation. + +Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + +Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + +#### 9. Acceptance Not Required for Having Copies. + +You are not required to accept this License in order to receive or run +a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + +#### 10. Automatic Licensing of Downstream Recipients. + +Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + +An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + +You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + +#### 11. Patents. + +A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + +A contributor's "essential patent claims" are all patent claims owned +or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + +Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + +In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + +If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + +If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + +A patent license is "discriminatory" if it does not include within the +scope of its coverage, prohibits the exercise of, or is conditioned on +the non-exercise of one or more of the rights that are specifically +granted under this License. You may not convey a covered work if you +are a party to an arrangement with a third party that is in the +business of distributing software, under which you make payment to the +third party based on the extent of your activity of conveying the +work, and under which the third party grants, to any of the parties +who would receive the covered work from you, a discriminatory patent +license (a) in connection with copies of the covered work conveyed by +you (or copies made from those copies), or (b) primarily for and in +connection with specific products or compilations that contain the +covered work, unless you entered into that arrangement, or that patent +license was granted, prior to 28 March 2007. + +Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + +#### 12. No Surrender of Others' Freedom. + +If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under +this License and any other pertinent obligations, then as a +consequence you may not convey it at all. For example, if you agree to +terms that obligate you to collect a royalty for further conveying +from those to whom you convey the Program, the only way you could +satisfy both those terms and this License would be to refrain entirely +from conveying the Program. + +#### 13. Use with the GNU Affero General Public License. + +Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + +#### 14. Revised Versions of this License. + +The Free Software Foundation may publish revised and/or new versions +of the GNU General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in +detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies that a certain numbered version of the GNU General Public +License "or any later version" applies to it, you have the option of +following the terms and conditions either of that numbered version or +of any later version published by the Free Software Foundation. If the +Program does not specify a version number of the GNU General Public +License, you may choose any version ever published by the Free +Software Foundation. + +If the Program specifies that a proxy can decide which future versions +of the GNU General Public License can be used, that proxy's public +statement of acceptance of a version permanently authorizes you to +choose that version for the Program. + +Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + +#### 15. Disclaimer of Warranty. + +THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT +WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND +PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE +DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR +CORRECTION. + +#### 16. Limitation of Liability. + +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR +CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT +NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR +LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM +TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER +PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +#### 17. Interpretation of Sections 15 and 16. + +If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + +END OF TERMS AND CONDITIONS + +### How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these +terms. + +To do so, attach the following notices to the program. It is safest to +attach them to the start of each source file to most effectively state +the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper +mail. + +If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands \`show w' and \`show c' should show the +appropriate parts of the General Public License. Of course, your +program's commands might be different; for a GUI interface, you would +use an "about box". + +You should also get your employer (if you work as a programmer) or +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. For more information on this, and how to apply and follow +the GNU GPL, see . + +The GNU General Public License does not permit incorporating your +program into proprietary programs. If your program is a subroutine +library, you may consider it more useful to permit linking proprietary +applications with the library. If this is what you want to do, use the +GNU Lesser General Public License instead of this License. But first, +please read . \ No newline at end of file diff --git a/MAKEFILE b/MAKEFILE new file mode 100644 index 0000000..590d8df --- /dev/null +++ b/MAKEFILE @@ -0,0 +1,52 @@ +all: + cd commande + make + cd .. + + cd programs + make + cd .. + + cd noyau + make + cd .. + + cd contribs + make + cd .. + + cd install + make + cd .. + +copy: + make all + copy commande\*.exe ..\data + copy programs\*.exe ..\data + copy programs\*.rip ..\data + copy noyau\*.sys ..\data + rem copy noyau\*.bin ..\data + copy contribs\*.exe ..\data + copy install\*.com ..\ + make clean + +clean: + cd commande + make clean + cd .. + + cd programs + make clean + cd .. + + cd noyau + make clean + cd .. + + cd contribs + make clean + cd .. + + cd install + make clean + cd .. diff --git a/commande/MAKEFILE b/commande/MAKEFILE new file mode 100644 index 0000000..cb18b34 --- /dev/null +++ b/commande/MAKEFILE @@ -0,0 +1,17 @@ +lnk_boot = tlink /x +asm= tasm /t/m5/zi +lnk= tlink /x/t + +all: commande.exe + +commande.exe: commande.asm str0.asm + $(asm) commande + $(lnk) commande + ren commande.com commande.exe + +clean: + del *.obj + del *.exe + del *.com + del *.sys + del *.err diff --git a/commande/asm.bat b/commande/asm.bat deleted file mode 100755 index 9466a7b..0000000 --- a/commande/asm.bat +++ /dev/null @@ -1,54 +0,0 @@ -@echo off - -echo Assembling file %1... -..\util\tasm %1.asm /m5/x/t -if errorlevel 1 goto end -if "%1"=="boot" goto boot -echo Linking file %1... -..\util\tlink %1.obj /x/t -if errorlevel 1 goto end -echo Copying file %1... -if "%1"=="video" goto video -if "%1"=="lpt" goto system -if "%1"=="keyboard" goto system -if "%1"=="mouse" goto system -if "%1"=="pic8259a" goto system -if "%1"=="timer" goto system -if "%1"=="drive" goto system -if "%1"=="joystick" goto system -if "%1"=="system" goto system -if "%1"=="setup" goto setup -copy %1.com ..\data\%1.exe>nul -goto end - -:boot -echo Linking file %1... -..\util\tlink %1.obj /x -if errorlevel 1 goto end -echo Copying file %1... -..\util\exe2boot %1.exe -copy %1.bin ..\data\%1.bin>nul -goto end - -:video -type thin8x8.fnt>>%1.com -:system -copy %1.com ..\data\%1.sys>nul -goto end -:setup -copy %1.com ..\%1.com>nul -goto end - -:end -if not exist *.bin goto exes -del *.bin -:exes -if not exist *.exe goto coms -del *.exe -:coms -if not exist *.com goto objs -del *.com -:objs -if not exist *.obj goto nobjs -del *.obj -:nobjs diff --git a/commande/clean.bat b/commande/clean.bat deleted file mode 100755 index 687f4b0..0000000 --- a/commande/clean.bat +++ /dev/null @@ -1,3 +0,0 @@ -@echo off -echo nettoyage en cours... -del ..\data\*.* >nul diff --git a/commande/prompt.asm b/commande/commande.asm old mode 100755 new mode 100644 similarity index 62% rename from commande/prompt.asm rename to commande/commande.asm index 09a3c83..fc49c52 --- a/commande/prompt.asm +++ b/commande/commande.asm @@ -1,265 +1,449 @@ -.model tiny -.486 -smart -.code - -org 0100h - -start: - mov ah,2 - int 47h - mov ah,6 - int 47h - mov ah,6 - int 47h - mov ah,42 - int 47h - mov ah,13 - mov si,offset msg - int 47h - xor bp,bp - mov dl,' ' - call setdelimiter0 -replay: - mov ah,6 - int 47h -noret: - mov ah,6 - int 47h - mov ah,13 - mov si,offset prompt - int 47h - mov di,offset buffer -waitchar: - mov ax,0 - int 16h - cmp ah,59 - jne norr - cmp bp,0 - je waitchar - mov ah,13 - mov si,cs:[bp-8] - int 47h - push cs - pop es - call copy0 - call getlength0 - add di,cx - jmp waitchar -norr: - cmp al,0Dh - je entere - cmp di,offset buffer+256 - je waitchar - mov [di],al - inc di - mov dl,al - mov ah,7 - int 47h - jmp waitchar -entere: - mov byte ptr [di],0 - mov si,offset buffer - cmp si,di - je noret - mov ah,6 - int 47h - push cs - pop es - mov di,offset buffer2 - xor cx,cx - call getitem0 - mov si,di - call uppercase0 - mov bx,offset commands - xor bp,bp -tre: - mov di,[bx] - add bx,8 - cmp di,0 - je error - push cs - pop es - call evalue0 - cmp dx,bp - jb noadd - mov bp,dx - mov ax,bx - noadd: - call cmpstr0 - jne tre - mov si,offset buffer - mov di,offset buffer2 - call copy0 - mov si,di - call uppercase0 - xor cx,cx - inc cx - call getpointeritem0 - cmp byte ptr [di-1],0 - jne nopod - mov byte ptr [di],0 -nopod: - mov si,di - mov di,[bx-4] - call checksyntax0 - jc errorprec - mov bx,[bx-6] - call bx - jmp replay -error: - mov bp,ax - push cs - pop es - mov dl,'.' - call searchchar0 - je noaddext - mov di,offset buffer - mov si,offset extcom - call concat0 -noaddext: - mov si,offset buffer - push cs - mov ax,offset arrive - push ax - mov di,offset vga - mov ah,40 - int 47h - mov ax,6000h - mov es,ax - push ax - mov di,0100h - push di - mov ah,4 - int 48h - jc reallyerror - push es - push es - push es - pop ds - pop fs - pop gs - push 7202h - popf - db 0CBh - arrive: - push cs - push cs - push cs - push cs - pop ds - pop es - pop fs - pop gs - mov si,offset vga - mov ah,41 - int 47h - xor bp,bp - jmp replay -reallyerror: - pop ax - pop ax - pop ax - pop ax - mov ah,13 - mov si,offset Error_Syntax - int 47h - mov ah,13 - mov si,cs:[bp-8] - int 47h - jmp replay -errorprec: - mov ah,13 - mov si,offset derror - int 47h - jmp replay - -Code_Exit: - pop ax - db 0CBh - -Code_Version: - mov ah,13 - mov si,offset Version_Text - int 47h - ret - -Version_Text db 'Cos 2000 version 2.0.1B by Nico',0 - -Code_Cls: - mov ah,2 - int 47h - ret - -Code_Reboot: - push 0FFFFh - push 00000h - db 0CBH - -Code_Command: - mov bx,offset commands -showalls: - mov si,[bx] - add bx,8 - cmp si,0 - je endoff - mov ah,13 - int 47h - mov ah,6 - int 47h - jmp showalls - endoff: - ret - -Code_Mode: - mov cx,0 - call gettypeditem0 - mov ah,0 - mov al,dl - and al,1111b - int 47h - mov ah,2 - int 47h - ret - -extcom db '.EXE',0 - -commands dw Str_Exit ,Code_Exit ,Syn_Exit ,Help_Exit - dw Str_Version,Code_Version,Syn_Version,Help_Version - dw Str_Cls ,Code_Cls ,Syn_Cls ,Help_Cls - dw Str_Reboot ,Code_Reboot ,Syn_Reboot ,Help_Reboot - dw Str_Command,Code_Command,Syn_Command,Help_Command - dw Str_Mode ,Code_Mode ,Syn_Mode ,Help_Mode - dw 0 - -Str_Exit db 'EXIT',0 -Str_Version db 'VERSION',0 -Str_Cls db 'CLS',0 -Str_Reboot db 'REBOOT',0 -Str_Command db 'COMMAND',0 -Str_Mode db 'MODE',0 -Syn_Exit db 0 -Syn_Version db 0 -Syn_Cls db 0 -Syn_Reboot db 0 -Syn_Command db 0 -Syn_Mode db 'FFH',0 -Help_Exit db 0 -Help_Version db 0 -Help_Cls db 0 -Help_Reboot db 0 -Help_Command db 0 -Help_Mode db 0 - -derror db 'Syntax error',0 -Error_Syntax db 'Command or executable doesn''t exist ! F1 for ',0 -prompt db 'COS>',0 -msg db 'Cos command interpretor V1.0',0 - - include str0.asm - -buffer equ $ -buffer2 equ $+256 -vga equ $+512 - -end start +.model tiny +.486 +smart +.code + +org 0100h + +include ..\include\fat.h + +start: + push cs + push cs + push cs + push cs + pop ds + pop es + pop fs + pop gs + mov ah,21 + mov cl,7 + int 47h + mov ah,3 + int 48h + mov ax,0002 + int 47h + mov ah,2 + int 47h + mov ah,6 + int 47h + mov ah,6 + int 47h + mov ah,42 + int 47h + mov ah,13 + mov si,offset msg + int 47h + xor bp,bp + mov dl,' ' + call setdelimiter0 +replay: + mov ah,6 + int 47h +noret: + mov ah,6 + int 47h + mov ah,16 + mov di,offset dir + int 48h + mov si,di + mov ah,13 + int 47h + mov si,offset prompt + int 47h + mov di,offset buffer +waitchar: + mov ax,0 + int 16h + cmp ah,59 + jne norr + cmp bp,0 + je waitchar + mov ah,13 + mov si,cs:[bp-8] + int 47h + push cs + pop es + call copy0 + call getlength0 + add di,cx + jmp waitchar +norr: + cmp al,0Dh + je entere + cmp di,offset buffer+256 + je waitchar + mov [di],al + inc di + mov dl,al + mov ah,7 + int 47h + jmp waitchar +entere: + mov byte ptr [di],0 + mov si,offset buffer + cmp si,di + je noret + mov ah,6 + int 47h + push cs + pop es + mov di,offset buffer2 + xor cx,cx + call getitem0 + mov si,di + call uppercase0 + mov bx,offset commands + xor bp,bp +tre: + mov di,[bx] + add bx,8 + cmp di,0 + je error + push cs + pop es + call evalue0 + cmp dx,bp + jb noadd + mov bp,dx + mov ax,bx + noadd: + call cmpstr0 + jne tre + mov si,offset buffer + mov di,offset buffer2 + call copy0 + mov si,di + call uppercase0 + xor cx,cx + inc cx + call getpointeritem0 + cmp byte ptr [di-1],0 + jne nopod + mov byte ptr [di],0 +nopod: + mov si,di + mov di,[bx-4] + call checksyntax0 + jc errorprec + mov bx,[bx-6] + call bx + jmp replay +error: + mov bp,ax + push cs + pop es + mov dl,'.' + call searchchar0 + je noaddext + mov di,offset buffer + mov si,offset extcom + call concat0 +noaddext: + mov si,offset buffer + push cs + mov ax,offset arrive + push ax + mov di,offset vga + mov ah,40 + int 47h + mov ax,9000h + mov es,ax + push ax + mov di,0100h + push di + mov ah,4 + int 48h + jc reallyerror + push es + push es + push es + pop ds + pop fs + pop gs + push 7202h + popf + db 0CBh + arrive: + push cs + push cs + push cs + push cs + pop ds + pop es + pop fs + pop gs + mov si,offset vga + mov ah,41 + int 47h + xor bp,bp + jmp replay +reallyerror: + pop ax + pop ax + pop ax + pop ax + mov ah,13 + mov si,offset Error_Syntax + int 47h + mov ah,13 + mov si,cs:[bp-8] + int 47h + jmp replay +errorprec: + mov ah,13 + mov si,offset derror + int 47h + jmp replay + +Code_Exit: + pop ax + db 0CBh + +Code_Version: + mov ah,13 + mov si,offset Version_Text + int 47h + ret + +Version_Text db 'Cos 2000 version 3.0.2Fr par Nico',0 + +Code_Cls: + mov ah,2 + int 47h + ret + +Code_Reboot: + push 0FFFFh + push 00000h + db 0CBH + +Code_Command: + mov bx,offset commands +showalls: + mov si,[bx] + add bx,8 + cmp si,0 + je endoff + mov ah,13 + int 47h + mov ah,6 + int 47h + jmp showalls + endoff: + ret + +Code_Mode: + mov cx,0 + call gettypeditem0 + mov ah,0 + mov al,dl + and al,1111b + int 47h + mov ah,2 + int 47h + ret + +present db 'Le volume insere est nomme ',0 +present2 db ', Numero de serie : ',0 +nomdisque db 13 dup (0) +Code_Dir: +mov si,offset present +mov ah,13 +int 47h +mov ah,11 +mov di,offset nomdisque +int 48h +mov si,di +mov ah,13 +int 47h +mov si,offset present2 +mov ah,13 +int 47h +mov ah,12 +int 48h +mov ah,10 +mov cx,32 +int 47h +mov ah,6 +int 47h +mov ah,6 +int 47h +xor ebp,ebp +mov di,offset bufferentry +mov si,di +mov ah,7 +int 48h +jc nofiles +go: +mov ah,46 +int 47h +mov ah,05 +int 47h +int 47h +int 47h +mov ah,44 +mov dx,[si+Entries.FileDateCrea] +int 47h +mov ah,05 +int 47h +int 47h +int 47h +mov ah,45 +mov dx,[si+Entries.FileTimeCrea] +int 47h +mov ah,05 +int 47h +int 47h +int 47h +mov ah,44 +mov dx,[si+Entries.FileDate] +int 47h +mov ah,05 +int 47h +int 47h +int 47h +mov ah,45 +mov dx,[si+Entries.FileTime] +int 47h +mov ah,05 +int 47h +int 47h +int 47h +mov ah,48 +mov edx,[si+Entries.FileSize] +int 47h +mov ah,05 +int 47h +int 47h +int 47h +mov ah,47 +mov dl,[si+Entries.FileAttr] +int 47h +mov ah,6 +int 47h +inc bp +mov ah,8 +int 48h +jnc go +nofiles: +mov edx,ebp +mov ah,6 +int 47h +mov ah,8 +int 47h +mov si,offset filess +mov ah,13 +int 47h +ret +bufferentry db 32 dup (0) +filess db ' Fichier(s) au total',0 + +changing db 'Changement de repertoire vers ',0 +code_cd: + mov cx,0 + call gettypeditem0 + push si + mov si,offset changing + mov ah,13 + int 47h + pop si + int 47h + mov ah,6 + int 47h + mov si,di + mov ah,13 + int 48h + jnc okchange + mov si,offset errorchanging + mov ah,13 + int 47h +okchange: + ret +errorchanging db 'Impossible d''atteindre ce dossier',0 + +code_refresh: + mov ah,3 + int 48h + jnc okrefresh + mov si,offset errorrefreshing + mov ah,13 + int 47h +ret +okrefresh: +mov si,offset present +mov ah,13 +int 47h +mov ah,11 +mov di,offset nomdisque +int 48h +mov si,di +mov ah,13 +int 47h +mov si,offset present2 +mov ah,13 +int 47h +mov ah,12 +int 48h +mov ah,10 +mov cx,32 +int 47h +mov ah,6 +int 47h + ret +errorrefreshing db 'Impossible de lire le support',0 + +extcom db '.EXE',0 + +commands dw Str_Exit ,Code_Exit ,Syn_Exit ,Help_Exit + dw Str_Version,Code_Version,Syn_Version,Help_Version + dw Str_Cls ,Code_Cls ,Syn_Cls ,Help_Cls + dw Str_Reboot ,Code_Reboot ,Syn_Reboot ,Help_Reboot + dw Str_Command,Code_Command,Syn_Command,Help_Command + dw Str_Mode ,Code_Mode ,Syn_Mode ,Help_Mode + dw Str_Dir ,Code_Dir ,Syn_Dir ,Help_Dir + dw Str_refresh ,Code_refresh ,Syn_refresh ,Help_refresh + dw Str_cd ,Code_cd ,Syn_cd ,Help_cd + dw 0 + +Str_Exit db 'QUIT',0 +Str_Version db 'VERS',0 +Str_Cls db 'EFFAC',0 +Str_Reboot db 'REDEM',0 +Str_Command db 'CMDS',0 +Str_Mode db 'MODE',0 +Str_Dir db 'VOIR',0 +Str_refresh db 'LIRE',0 +Str_cd db 'CH',0 +Syn_Exit db 0 +Syn_Version db 0 +Syn_Cls db 0 +Syn_Reboot db 0 +Syn_Command db 0 +Syn_Mode db 'FFH',0 +Syn_Dir db 0 +Syn_refresh db 0 +Syn_cd db '@',0 +Help_Exit db 0 +Help_Version db 0 +Help_Cls db 0 +Help_Reboot db 0 +Help_Command db 0 +Help_Mode db 0 +Help_Dir db 0 +Help_refresh db 0 +Help_cd db 0 +derror db 'Erreur de Syntaxe !',0 +Error_Syntax db 'La commande ou l''executable n''existe pas ! F1 pour ',0 +prompt db '>',0 +msg db 'Interpreteur de commande COS V1.1',0 + + include str0.asm + +dir equ $ +buffer equ $+128 +buffer2 equ $+128+512 +vga equ $+128+512+512 + + +end start diff --git a/commande/debog.bat b/commande/debog.bat deleted file mode 100755 index aedbb4e..0000000 --- a/commande/debog.bat +++ /dev/null @@ -1,2 +0,0 @@ -@echo off -..\util\td %1 diff --git a/commande/str0.asm b/commande/str0.asm old mode 100755 new mode 100644 index f9bf7fd..ddbc0c8 --- a/commande/str0.asm +++ b/commande/str0.asm @@ -1,845 +1,857 @@ -;Librairie qui prend en charge le format de STR ASCIIZ -;# nombre 9 -;@ str 8 -;& file 7 - -;Renvoie carry si la syntaxe de ds:si n'est pas respect‚ par rapport a es:di -CheckSyntax0: - push ax bx dx bp si di ds es - push es di - push cs - pop es - mov di,offset temp2 - call copy0 - mov si,di - push cs - pop ds - pop di es - call getdelimiter0 - mov bp,dx - mov dl,' ' - call setdelimiter0 - call compressdelimiter0 - call uppercase0 - call getnbitems0 - ;call xch - ;mov ax,cx - ;call getnbitem0 - ;call xch - ;cmp ax,cx - ;call xch - ;jne notequalatall - mov bx,cx - xor cx,cx -itemer: - call whatisitem0 - mov dx,ax - call xch - call whatisitem0 - call xch - cmp ax,dx - jne prob - cmp al,6 - jb equal - call cmpitems0 - je equal -prob: - cmp dl,4 - ja nosize - cmp al,8 - je equal - cmp al,4 - jne notequalatall - cmp dh,ah - ja notequalatall - jmp equal -nosize: - cmp al,7 - jne noname - cmp ah,0 - jne notequalatall - jmp equal -noname: - cmp al,8 - je equal - jmp notequalatall -equal: - inc cx - cmp cx,bx - jne itemer - cld -ackno: - mov dx,bp - call setdelimiter0 - pop es ds di si bp dx bx ax - ret -notequalatall: - stc - jmp ackno -xch: - push ds - push es - pop ds - pop es - xchg si,di - ret - -temp2 db 256 dup (0) - -;Compare les ‚l‚ments cx de deux chaine ds:si et es:di -Cmpitems0: - push cx dx si di - push cx di - call getpointeritem0 - mov si,di - xor cx,cx - inc cx - call getpointeritem0 - mov dx,di - sub dx,si - dec cx - pop di cx - push ds si - push es - pop ds - mov si,di - call getpointeritem0 - pop si ds - mov cx,dx - rep cmpsb - pop di si dx cx - ret - - - -;Renvoie l'‚l‚ment cx de ds:si dans edx si nb et dans es:di si str ou name -gettypeditem0: - push bx cx si - call getpointeritem0 - mov si,di - xor cx,cx - inc cl - call getpointeritem0 - mov bx,di - dec bx - mov cl,0 - xchg cl,ds:[bx] - call gettyped0 - xchg cl,ds:[bx] - pop si cx bx - ret - -;Renvoie ds:si dans edx si nb et dans es:di si str ou name -gettyped0: - push ax - call whatis0 - cmp al,5 - jb number - cmp al,6 - je pointer - push ds - pop es - call getpointeritem0 - jmp endofGettypeditem0 -number: - mov edx,cs:lastnumber - jmp endofgettypeditem0 -pointer: - call str0toadress -endofgettypeditem0: - pop ax - ret - -;Renvoie dans ax le type de la str0 point‚e par ds:si ‚l‚ment cx -whatisitem0: - push bx cx si di - call getpointeritem0 - mov si,di - xor cx,cx - inc cl - call getpointeritem0 - mov bx,di - dec bx - mov cl,0 - xchg cl,ds:[bx] - call whatis0 - xchg cl,ds:[bx] - pop di si cx bx - ret - -;Renvoie dans ax le type de la str0 point‚e par ds:si -;High Low -;0 variable 4 hex -;1 byte 3 dec -;2 word 2 oct -;3 3 octets 1 bin -;4 dword 5 adresse -;5 5 octets 6 name -;6 ... 7 str -whatis0: - push bx cx edx - mov cl,2 - call str0isbase - jnc finbase - mov cl,8 - call str0isbase - jnc finbase - mov cl,10 - call str0isbase - jnc finbase - mov cl,16 - call str0isbase - jc testadress -finbase: - mov bx,cx - xor ch,ch - mov al,cs:[bx+offset basenn-2] - call str0toint - mov cs:Lastnumber,edx - cmp edx,0000FFFFh - ja bits32 - cmp dx,00FFh - ja bits16 - mov ah,1 - jmp endofwhat -bits16: - mov ah,2 - jmp endofwhat -bits32: - mov ah,3 - jmp endofwhat -testadress: - call str0isadress - jc testname - mov ax,0005h - jmp endofwhat -testname: - call str0isname - jc testvarstr - mov al,07h - call getlength0 - cmp byte ptr [si],'&' - jne real - mov cl,0 -real: - mov ah,cl - jmp endofwhat -testvarstr: - cmp byte ptr [si],'@' - jne testnumber - mov al,08h - call getlength0 - mov ah,cl - jmp endofwhat -testnumber: - cmp byte ptr [si],'#' - jne isstr - call getlength0 - cmp cl,1 - ja isstr - mov ax,0009h - jmp endofwhat -isstr: - mov al,06h - call getlength0 - dec cl - mov ah,cl -endofwhat: - pop edx cx bx - ret - -Lastnumber dd 0 - -;Renvoie non carry si la str ds:si point‚e peut ˆtre une adresse -str0isadress: - ;push - stc - ;pop - ret - -;Renvoie en es:di le pointeur str0 ds:si -Str0toAdress: - ;push - stc - ;pop - ret - -;Renvoie non carry si la str ds:si point‚e peut ˆtre un nom de fichier -str0isname: - push ax si di -isname: - mov al,[si] - inc si - cmp al,0 - je itsok - mov di,offset non -verify: - mov ah,[di] - inc di - cmp ah,0FFh - je isname - cmp ah,al - jne verify - stc - jmp itsdead -itsok: - clc -itsdead: - pop di si ax - ret - -non db '/<>|@#',01,0FFh - -;Renvoie non carry si le texte point‚ par si est de la base cl -str0isbase: - push ax cx si di es - push cs - pop es - mov ah,cl -isstrbase: - mov al,[si] - cmp al,0 - je okbase - mov cl,ah - xor ch,ch - mov di,cx - cmp al,es:[di-2+offset basen] - je verifbase - xor ch,ch - inc cl - mov di,offset base - cld - repne scasb - cmp cx,0 - je nobase - inc si - jmp isstrbase -okbase: - clc -endbase: - pop es di si cx ax - ret -verifbase: - cmp byte ptr [si+1],0 - je okbase -nobase: - stc - jmp endbase - -temp dw 0 - -;Converti un str de base cl en int dans edx -str0toint: - push eax bx ecx si edi ebp es - push cs - pop es - mov ah,cl - mov cs:temp,si -gotos: - cmp byte ptr [si+1], 0 - je oklo - inc si - jmp gotos -oklo: - mov edi,1 - xor ebp,ebp - mov bl,cl -baseto: - cmp si,cs:temp - jb endbaseto - mov al,[si] - xor ecx,ecx - mov cl,bl - inc cl - push di - mov di,offset base - cld - repne scasb - pop di - jne noop - sub cl,bl - neg cl - mov eax,edi - mul ecx - add ebp,eax - mov eax,edi - mov cl,bl - mul ecx - mov edi,eax -noop: - dec si - jmp baseto -endbaseto: - mov edx,ebp - pop es ebp edi si ecx bx eax -ret -base db '0123456789ABCDEF' -basen db 'B O D H' -basenn db 1,0,0,0,0,0,2,0,3,0,0,0,0,0,4 - -;Renvoie en es:di la partie de cx caractŠres a partir de la gauche de ds:si -Left0: - push ax cx si di - cld - rep movsb - mov al,0 - stosb - pop di si cx ax - ret - -;Renvoie en es:di la partie de cx caractŠres a partir de la droite de ds:si -Right0: - push ax cx dx si di - mov dx,cx - call getlength0 - add si,cx - sub si,dx - mov cx,dx - cld - rep movsb - mov al,0 - stosb - pop di si dx cx ax - ret - -;Renvoie en es:di la partie de cx caractŠres a partir de la position bx de ds:si -middle0: - push ax cx si di - add si,bx - cld - rep movsb - mov al,0 - stosb - pop di si cx ax - ret - -;Rempli de cx caractŠres dl a partir de la position bx de ds:si -Fill0: - push ax bx cx si di es - push ds - pop es - add si,bx - mov al,dl - mov di,si - cld - rep stosb - pop es di si cx bx ax - ret - -;Remplace tout les caractŠres al de ds:si par des caractŠres dl -ReplaceAllchar0: - push ax cx di es - call GetLength0 - push ds - pop es - mov di,si -findandchange: - repne scasb - cmp cx,0 - je endofchange - mov es:[di-1],dl - jmp findandchange -endofchange: - pop es di cx ax - ret - - -;Recherche un caractŠre dl dans la chaŒne ds:si -SearchChar0: - push ax cx di es - call GetLength0 - push ds - pop es - mov di,si - mov al,dl - repne scasb - pop es di cx ax - ret - -;Inverse la chaine point‚e en ds:si -invert0: - push ax cx si di es - call GetLength0 - push ds - pop es - mov di,si - add di,cx - dec di -revert: - mov al,[si] - xchg al,es:[di] - mov [si],al - inc si - dec di - cmp si,di - je finishinvert - dec di - cmp si,di - je finishinvert - inc di - jmp revert -finishinvert: - pop es di si cx ax - ret - -;Compares 2 chaines de caractŠres DS:SI et ES:DI zerof si non equal -cmpstr0: - push cx dx si di - call GetLength0 - mov dx,cx - push ds si - push es - pop ds - mov si,di - call GetLength0 - pop si ds - cmp cx,dx - jne NotEqual - repe cmpsb -NotEqual: - pop di si dx cx - ret - -;Compares 2 chaines de caractŠres DS:SI et ES:DI zerof si non equal et renvoie le nb de caractŠre egaux dans dx -evalue0: - push cx si di - push ds si - push es - pop ds - mov si,di - call GetLength0 - pop si ds - mov dx,cx - repe cmpsb - pushf - sub dx,cx - popf - pop di si cx - ret - - -;Insert une chaine ds:si en es:di a partir du caractŠre cx -insert0: - push cx di si - add di,cx - call getlength0 - push si di ds - push es - pop ds - mov si,di - add di,cx - call copy20 - pop ds di si - cld - inc di - rep movsb - pop si di cx - ret - -;Detruit CX caractŠres a partir du caractŠre BX de DS:SI -delete0: - push cx dx si di es - push ds - pop es - mov dx,cx - call getlength0 - sub cx,dx - sub cx,bx - inc cx - add si,bx - mov di,si - add si,dx - cld - rep movsb - pop es di si dx cx - ret - -;Copie une chaine de ds:si en es:di -Copy0: - push ax cx si di - call GetLength0 - cld - rep movsb - mov al,0 - stosb - pop di si cx ax - ret - -;Copie une chaine de ds:si en es:di -Copy20: - push ax cx si di - call GetLength0 - cld - add si,cx - add di,cx - inc cx - std - rep movsb - pop di si cx ax - ret - -;ConcatŠne le chaine ds:si avec es:di -Concat0: - push ax cx dx si di - call GetLength0 - mov dx,cx - xchg si,di - push ds - push es - pop ds - call GetLength0 - pop ds - xchg si,di - add di,cx - mov cx,dx - cld - rep movsb - mov al,0 - stosb - pop di si dx cx ax - ret - -;Met DL comme d‚limiteur par d‚faut -SetDelimiter0: - mov cs:delim,dl - ret - -;Renvoie le d‚limiteur par d‚faut dans dl -GetDelimiter0: - mov dl,cs:delim - ret -delim db 0 - -;D‚truit les d‚limiteur qui sont cons‚cutifs dans ds:si -CompressDelimiter0: - push ax dx si di es - call Getlength0 - push ds - pop es - mov di,si - mov al,cs:delim - xor dx,dx -Compressitems: - repne scasb - inc dx -againcomp: - cmp [di],al - jne nosup - mov si,di - mov bx,0 - push cx - mov cx,1 - call delete0 - pop cx - jmp againcomp -nosup: - cmp cx,0 - jne compressitems - mov cx,dx - pop es di si dx ax - ret - -;Met le nombre d'‚l‚ments … cx -Setnbitems0: - push ax cx dx di es - mov dx,cx - call Getnbitems0 - cmp cx,dx - je noadjust - ja subsome - push ds - pop es - mov di,si - sub cx,dx - neg cx - push cx - call getlength0 - add di,cx - pop cx - mov al,cs:delim - mov ah,'a' - rep stosw - mov al,0 - stosb - jmp noadjust -subsome: - mov cx,dx - call GetPointeritem0 - dec di - mov byte ptr [di],0 -noadjust: - pop es di dx cx - ret - -;Renvoie la taille dx de l'‚l‚ment cx -Getitemsize: - push cx di - call getpointeritem0 - mov dx,di - inc cx - call getpointeritem0 - sub dx,di - neg dx - dec dx - pop di cx - ret - -;Renvoie en es:di l'‚l‚ment cx de ds:si -Getitem0: - push si di cx ax - push di - call getPointeritem0 - call getitemsize - mov si,di - pop di - mov cx,dx - rep movsb - mov al,0 - stosb - pop ax cx di si - ret - -;renvoi un pointeur di sur l'‚l‚ment cx de ds:si -GetPointeritem0: - push ax bx cx dx es - mov bx,cx - call Getlength0 - push ds - pop es - mov di,si - mov al,cs:delim - xor dx,dx -Countnbitems: - cmp bx,dx - je finishpointer - repne scasb - inc dx - cmp cx,0 - jne countnbitems - inc di -finishpointer: - pop es dx cx bx ax - ret - -;Renvoie le nombre d'‚l‚ments cx de ds:si -GetNbitems0: - push ax dx di es - call Getlength0 - push ds - pop es - mov di,si - mov al,cs:delim - xor dx,dx -Countitems: - repne scasb - inc dx - cmp cx,0 - jne countitems - mov cx,dx - pop es di dx ax - ret - -;renvoie la taille en octets CX de la chaine point‚e en ds:si -GetLength0: - push ax di es - push ds - pop es - mov di,si - mov al,0 - mov cx,0FFFFh - cld - repne scasb - neg cx - dec cx - dec cx - pop es di ax - ret - -;Met la taille en octets de la chaine point‚e ds:si a CX -SetLength0: - push bx - mov bx,cx - mov byte ptr [si+bx],0 - pop bx - ret - -;met en majuscule la chaine ds:si -UpperCase0: - push si ax -UpperCase: - mov al,ds:[si] - inc si - cmp al,0 - je EndUpperCase - cmp al,'a' - jb UpperCase - cmp al,'z' - ja UpperCase - sub byte ptr [si-1],'a'-'A' - jmp UpperCase -EndUpperCase: - clc - pop ax si - ret - -;met en majuscule la premiŠre lettre chaine ds:si -OneCase0: - push ax -OneUpperCase: - mov al,ds:[si] - cmp al,'a' - jb OneEndUpperCase - cmp al,'z' - ja OneEndUpperCase - sub byte ptr [si],'a'-'A' -OneEndUpperCase: - clc - pop ax - ret - -;met en minuscule la chaine ds:si -LowerCase0: - push si ax -LowerCase: - mov al,ds:[si] - inc si - cmp al,0 - je EndLowerCase - cmp al,'A' - jb LowerCase - cmp al,'Z' - ja LowerCase - add byte ptr [si-1],'a'-'A' - jmp LowerCase -EndLowerCase: - clc - pop ax si - ret - -;Inverse la casse la chaine ds:si -InvertCase0: - push si ax -InvertCase: - mov al,ds:[si] - inc si - cmp al,0 - je EndInvertCase - cmp al,'A' - jb InvertCase - cmp al,'Z' - jbe GoInvertCase - cmp al,'a' - jb InvertCase - cmp al,'z' - ja InvertCase - sub byte ptr [si-1],'a'-'A' - jmp InvertCase -GoInvertCase: - add byte ptr [si-1],'a'-'A' - jmp InvertCase -EndInvertCase: - clc - pop ax si - ret - - +;Librairie qui prend en charge le format de STR ASCIIZ +;# nombre 8 +;@ str 7 +;& nom 6 + +;High Low +;0 variable 4 hex +;1 byte 3 dec +;2 word 2 oct +;3 3 octets 1 bin +;4 dword 5 adresse +;5 5 octets 6 nom +;6 ... 7 str + ; 8 nombre + + +;Renvoie carry si la syntaxe de ds:si n'est pas respect‚ par rapport a es:di +CheckSyntax0: + push ax bx dx bp si di ds es + push es di + push cs + pop es + mov di,offset temp2 + call copy0 + mov si,di + push cs + pop ds + pop di es + call getdelimiter0 + mov bp,dx + mov dl,' ' + call setdelimiter0 + call compressdelimiter0 + call uppercase0 + call getnbitems0 + ;call xch + ;mov ax,cx + ;call getnbitem0 + ;call xch + ;cmp ax,cx + ;call xch + ;jne notequalatall + mov bx,cx + xor cx,cx +itemer: + call whatisitem0 + mov dx,ax + call xch + call whatisitem0 + call xch + cmp ax,dx + jne prob + cmp al,6 + jb equal + call cmpitems0 + je equal +prob: + cmp dl,4 + ja nosize + cmp al,8 + je equal + cmp al,4 + jne notequalatall + cmp dh,ah + ja notequalatall + jmp equal +nosize: + cmp al,7 + jne noname + cmp ah,0 + jne notequalatall + jmp equal +noname: + cmp al,8 + je equal + jmp notequalatall +equal: + inc cx + cmp cx,bx + jne itemer + cld +ackno: + mov dx,bp + call setdelimiter0 + pop es ds di si bp dx bx ax + ret +notequalatall: + stc + jmp ackno +xch: + push ds + push es + pop ds + pop es + xchg si,di + ret + +temp2 db 256 dup (0) + +;Compare les ‚l‚ments cx de deux chaine ds:si et es:di +Cmpitems0: + push cx dx si di + push cx di + call getpointeritem0 + mov si,di + xor cx,cx + inc cx + call getpointeritem0 + mov dx,di + sub dx,si + dec cx + pop di cx + push ds si + push es + pop ds + mov si,di + call getpointeritem0 + pop si ds + mov cx,dx + rep cmpsb + pop di si dx cx + ret + + + +;Renvoie l'‚l‚ment cx de ds:si dans edx si nb et dans es:di si str ou name +gettypeditem0: + push bx cx si + call getpointeritem0 + mov si,di + xor cx,cx + inc cl + call getpointeritem0 + mov bx,di + dec bx + mov cl,0 + xchg cl,ds:[bx] + call gettyped0 + xchg cl,ds:[bx] + pop si cx bx + ret + +;Renvoie ds:si dans edx si nb et dans es:di si str ou name +gettyped0: + push ax + call whatis0 + cmp al,5 + jb number + cmp al,6 + je pointer + push ds + pop es + call getpointeritem0 + jmp endofGettypeditem0 +number: + mov edx,cs:lastnumber + jmp endofgettypeditem0 +pointer: + call str0toadress +endofgettypeditem0: + pop ax + ret + +;Renvoie dans ax le type de la str0 point‚e par ds:si ‚l‚ment cx +whatisitem0: + push bx cx si di + call getpointeritem0 + mov si,di + xor cx,cx + inc cl + call getpointeritem0 + mov bx,di + dec bx + mov cl,0 + xchg cl,ds:[bx] + call whatis0 + xchg cl,ds:[bx] + pop di si cx bx + ret + +;Renvoie dans ax le type de la str0 point‚e par ds:si +;High Low +;0 variable 4 hex +;1 byte 3 dec +;2 word 2 oct +;3 3 octets 1 bin +;4 dword 5 adresse +;5 5 octets 6 name +;6 ... 7 str +whatis0: + push bx cx edx + mov cl,2 + call str0isbase + jnc finbase + mov cl,8 + call str0isbase + jnc finbase + mov cl,10 + call str0isbase + jnc finbase + mov cl,16 + call str0isbase + jc testadress +finbase: + mov bx,cx + xor ch,ch + mov al,cs:[bx+offset basenn-2] + call str0toint + mov cs:Lastnumber,edx + cmp edx,0000FFFFh + ja bits32 + cmp dx,00FFh + ja bits16 + mov ah,1 + jmp endofwhat +bits16: + mov ah,2 + jmp endofwhat +bits32: + mov ah,3 + jmp endofwhat +testadress: + call str0isadress + jc testname + mov ax,0005h + jmp endofwhat +testname: + ;call str0isname + ;jc testvarstr + ;jnc isok + ;mov al,06h + cmp byte ptr [si],'&' + jne testvarstr + mov al,06h + call getlength0 + dec cl + mov ah,cl + jmp endofwhat +testvarstr: + cmp byte ptr [si],'@' + jne testnumber + mov al,07h + call getlength0 + dec cl + mov ah,cl + jmp endofwhat +testnumber: + cmp byte ptr [si],'#' + jne isstr + mov al,8 + call getlength0 + dec cl + mov ah,cl + jmp endofwhat +isstr: + mov al,07h + call getlength0 + mov ah,cl +endofwhat: + pop edx cx bx + ret + +Lastnumber dd 0 + +;Renvoie non carry si la str ds:si point‚e peut ˆtre une adresse +str0isadress: + ;push + stc + ;pop + ret + +;Renvoie en es:di le pointeur str0 ds:si +Str0toAdress: + ;push + stc + ;pop + ret + +;Renvoie non carry si la str ds:si point‚e peut ˆtre un nom de fichier +str0isname: + push ax si di +isname: + mov al,[si] + inc si + cmp al,0 + je itsok + mov di,offset non +verify: + mov ah,[di] + inc di + cmp ah,0FFh + je isname + cmp ah,al + jne verify + stc + jmp itsdead +itsok: + clc +itsdead: + pop di si ax + ret + +non db '/<>|"?*:\',01,0FFh + +;Renvoie non carry si le texte point‚ par si est de la base cl +str0isbase: + push ax cx si di es + push cs + pop es + mov ah,cl +isstrbase: + mov al,[si] + cmp al,0 + je okbase + mov cl,ah + xor ch,ch + mov di,cx + cmp al,es:[di-2+offset basen] + je verifbase + xor ch,ch + inc cl + mov di,offset base + cld + repne scasb + cmp cx,0 + je nobase + inc si + jmp isstrbase +okbase: + clc +endbase: + pop es di si cx ax + ret +verifbase: + cmp byte ptr [si+1],0 + je okbase +nobase: + stc + jmp endbase + +temp dw 0 + +;Converti un str de base cl en int dans edx +str0toint: + push eax bx ecx si edi ebp es + push cs + pop es + mov ah,cl + mov cs:temp,si +gotos: + cmp byte ptr [si+1], 0 + je oklo + inc si + jmp gotos +oklo: + mov edi,1 + xor ebp,ebp + mov bl,cl +baseto: + cmp si,cs:temp + jb endbaseto + mov al,[si] + xor ecx,ecx + mov cl,bl + inc cl + push di + mov di,offset base + cld + repne scasb + pop di + jne noop + sub cl,bl + neg cl + mov eax,edi + mul ecx + add ebp,eax + mov eax,edi + mov cl,bl + mul ecx + mov edi,eax +noop: + dec si + jmp baseto +endbaseto: + mov edx,ebp + pop es ebp edi si ecx bx eax +ret +base db '0123456789ABCDEF' +basen db 'B O D H' +basenn db 1,0,0,0,0,0,2,0,3,0,0,0,0,0,4 + +;Renvoie en es:di la partie de cx caractŠres a partir de la gauche de ds:si +Left0: + push ax cx si di + cld + rep movsb + mov al,0 + stosb + pop di si cx ax + ret + +;Renvoie en es:di la partie de cx caractŠres a partir de la droite de ds:si +Right0: + push ax cx dx si di + mov dx,cx + call getlength0 + add si,cx + sub si,dx + mov cx,dx + cld + rep movsb + mov al,0 + stosb + pop di si dx cx ax + ret + +;Renvoie en es:di la partie de cx caractŠres a partir de la position bx de ds:si +middle0: + push ax cx si di + add si,bx + cld + rep movsb + mov al,0 + stosb + pop di si cx ax + ret + +;Rempli de cx caractŠres dl a partir de la position bx de ds:si +Fill0: + push ax bx cx si di es + push ds + pop es + add si,bx + mov al,dl + mov di,si + cld + rep stosb + pop es di si cx bx ax + ret + +;Remplace tout les caractŠres al de ds:si par des caractŠres dl +ReplaceAllchar0: + push ax cx di es + call GetLength0 + push ds + pop es + mov di,si +findandchange: + repne scasb + cmp cx,0 + je endofchange + mov es:[di-1],dl + jmp findandchange +endofchange: + pop es di cx ax + ret + + +;Recherche un caractŠre dl dans la chaŒne ds:si +SearchChar0: + push ax cx di es + call GetLength0 + push ds + pop es + mov di,si + mov al,dl + repne scasb + pop es di cx ax + ret + +;Inverse la chaine point‚e en ds:si +invert0: + push ax cx si di es + call GetLength0 + push ds + pop es + mov di,si + add di,cx + dec di +revert: + mov al,[si] + xchg al,es:[di] + mov [si],al + inc si + dec di + cmp si,di + je finishinvert + dec di + cmp si,di + je finishinvert + inc di + jmp revert +finishinvert: + pop es di si cx ax + ret + +;Compares 2 chaines de caractŠres DS:SI et ES:DI zerof si non equal +cmpstr0: + push cx dx si di + call GetLength0 + mov dx,cx + push ds si + push es + pop ds + mov si,di + call GetLength0 + pop si ds + cmp cx,dx + jne NotEqual + repe cmpsb +NotEqual: + pop di si dx cx + ret + +;Compares 2 chaines de caractŠres DS:SI et ES:DI zerof si non equal et renvoie le nb de caractŠre egaux dans dx +evalue0: + push cx si di + push ds si + push es + pop ds + mov si,di + call GetLength0 + pop si ds + mov dx,cx + repe cmpsb + pushf + sub dx,cx + popf + pop di si cx + ret + + +;Insert une chaine ds:si en es:di a partir du caractŠre cx +insert0: + push cx di si + add di,cx + call getlength0 + push si di ds + push es + pop ds + mov si,di + add di,cx + call copy20 + pop ds di si + cld + inc di + rep movsb + pop si di cx + ret + +;Detruit CX caractŠres a partir du caractŠre BX de DS:SI +delete0: + push cx dx si di es + push ds + pop es + mov dx,cx + call getlength0 + sub cx,dx + sub cx,bx + inc cx + add si,bx + mov di,si + add si,dx + cld + rep movsb + pop es di si dx cx + ret + +;Copie une chaine de ds:si en es:di +Copy0: + push ax cx si di + call GetLength0 + cld + rep movsb + mov al,0 + stosb + pop di si cx ax + ret + +;Copie une chaine de ds:si en es:di +Copy20: + push ax cx si di + call GetLength0 + cld + add si,cx + add di,cx + inc cx + std + rep movsb + pop di si cx ax + ret + +;ConcatŠne le chaine ds:si avec es:di +Concat0: + push ax cx dx si di + call GetLength0 + mov dx,cx + xchg si,di + push ds + push es + pop ds + call GetLength0 + pop ds + xchg si,di + add di,cx + mov cx,dx + cld + rep movsb + mov al,0 + stosb + pop di si dx cx ax + ret + +;Met DL comme d‚limiteur par d‚faut +SetDelimiter0: + mov cs:delim,dl + ret + +;Renvoie le d‚limiteur par d‚faut dans dl +GetDelimiter0: + mov dl,cs:delim + ret +delim db 0 + +;D‚truit les d‚limiteur qui sont cons‚cutifs dans ds:si +CompressDelimiter0: + push ax dx si di es + call Getlength0 + push ds + pop es + mov di,si + mov al,cs:delim + xor dx,dx +Compressitems: + repne scasb + inc dx +againcomp: + cmp [di],al + jne nosup + mov si,di + mov bx,0 + push cx + mov cx,1 + call delete0 + pop cx + jmp againcomp +nosup: + cmp cx,0 + jne compressitems + mov cx,dx + pop es di si dx ax + ret + +;Met le nombre d'‚l‚ments … cx +Setnbitems0: + push ax cx dx di es + mov dx,cx + call Getnbitems0 + cmp cx,dx + je noadjust + ja subsome + push ds + pop es + mov di,si + sub cx,dx + neg cx + push cx + call getlength0 + add di,cx + pop cx + mov al,cs:delim + mov ah,'a' + rep stosw + mov al,0 + stosb + jmp noadjust +subsome: + mov cx,dx + call GetPointeritem0 + dec di + mov byte ptr [di],0 +noadjust: + pop es di dx cx + ret + +;Renvoie la taille dx de l'‚l‚ment cx +Getitemsize: + push cx di + call getpointeritem0 + mov dx,di + inc cx + call getpointeritem0 + sub dx,di + neg dx + dec dx + pop di cx + ret + +;Renvoie en es:di l'‚l‚ment cx de ds:si +Getitem0: + push si di cx ax + push di + call getPointeritem0 + call getitemsize + mov si,di + pop di + mov cx,dx + rep movsb + mov al,0 + stosb + pop ax cx di si + ret + +;renvoi un pointeur di sur l'‚l‚ment cx de ds:si +GetPointeritem0: + push ax bx cx dx es + mov bx,cx + call Getlength0 + push ds + pop es + mov di,si + mov al,cs:delim + xor dx,dx +Countnbitems: + cmp bx,dx + je finishpointer + repne scasb + inc dx + cmp cx,0 + jne countnbitems + inc di +finishpointer: + pop es dx cx bx ax + ret + +;Renvoie le nombre d'‚l‚ments cx de ds:si +GetNbitems0: + push ax dx di es + call Getlength0 + push ds + pop es + mov di,si + mov al,cs:delim + xor dx,dx +Countitems: + repne scasb + inc dx + cmp cx,0 + jne countitems + mov cx,dx + pop es di dx ax + ret + +;renvoie la taille en octets CX de la chaine point‚e en ds:si +GetLength0: + push ax di es + push ds + pop es + mov di,si + mov al,0 + mov cx,0FFFFh + cld + repne scasb + neg cx + dec cx + dec cx + pop es di ax + ret + +;Met la taille en octets de la chaine point‚e ds:si a CX +SetLength0: + push bx + mov bx,cx + mov byte ptr [si+bx],0 + pop bx + ret + +;met en majuscule la chaine ds:si +UpperCase0: + push si ax +UpperCase: + mov al,ds:[si] + inc si + cmp al,0 + je EndUpperCase + cmp al,'a' + jb UpperCase + cmp al,'z' + ja UpperCase + sub byte ptr [si-1],'a'-'A' + jmp UpperCase +EndUpperCase: + clc + pop ax si + ret + +;met en majuscule la premiŠre lettre chaine ds:si +OneCase0: + push ax +OneUpperCase: + mov al,ds:[si] + cmp al,'a' + jb OneEndUpperCase + cmp al,'z' + ja OneEndUpperCase + sub byte ptr [si],'a'-'A' +OneEndUpperCase: + clc + pop ax + ret + +;met en minuscule la chaine ds:si +LowerCase0: + push si ax +LowerCase: + mov al,ds:[si] + inc si + cmp al,0 + je EndLowerCase + cmp al,'A' + jb LowerCase + cmp al,'Z' + ja LowerCase + add byte ptr [si-1],'a'-'A' + jmp LowerCase +EndLowerCase: + clc + pop ax si + ret + +;Inverse la casse la chaine ds:si +InvertCase0: + push si ax +InvertCase: + mov al,ds:[si] + inc si + cmp al,0 + je EndInvertCase + cmp al,'A' + jb InvertCase + cmp al,'Z' + jbe GoInvertCase + cmp al,'a' + jb InvertCase + cmp al,'z' + ja InvertCase + sub byte ptr [si-1],'a'-'A' + jmp InvertCase +GoInvertCase: + add byte ptr [si-1],'a'-'A' + jmp InvertCase +EndInvertCase: + clc + pop ax si + ret + + diff --git a/commande/test.asm b/commande/test.asm new file mode 100644 index 0000000..ffa5585 --- /dev/null +++ b/commande/test.asm @@ -0,0 +1,25 @@ +.model tiny +.486 +smart +.code + +org 0100h + +start: +mov si,offset essai +call whatis0 + + + mov si,offset pop1 + mov di,offset pop2 + call checksyntax0 +ret + +essai db '#',0 +pop1 db 'essai 0FFh',0 +pop2 db 'ESSAI 012H',0 + include str0.asm + + + +end start diff --git a/commande/write.bat b/commande/write.bat deleted file mode 100755 index 808b110..0000000 --- a/commande/write.bat +++ /dev/null @@ -1,4 +0,0 @@ -@echo off -cd .. -setup -cd sources diff --git a/contribs/MAKEFILE b/contribs/MAKEFILE new file mode 100644 index 0000000..a870e27 --- /dev/null +++ b/contribs/MAKEFILE @@ -0,0 +1,20 @@ +lnk_boot = tlink /x +asm= tasm /t/m5/zi +lnk= tlink /x/t + +all: ex-tasm.exe ex-nasm.exe + +ex-tasm.exe: ex-tasm.asm + $(asm) ex-tasm + $(lnk) ex-tasm + ren ex-tasm.com ex-tasm.exe + +ex-nasm.exe: ex-nasm.asm + nasm ex-nasm.asm -o ex-nasm.exe + +clean: + del *.obj + del *.exe + del *.com + del *.sys + del *.err diff --git a/contribs/ex-nasm.asm b/contribs/ex-nasm.asm new file mode 100644 index 0000000..dca5112 --- /dev/null +++ b/contribs/ex-nasm.asm @@ -0,0 +1,14 @@ +[bits 16] ;16 bits +[org 0x0100] ;Point d'entré en 0100h +section .text ;Segment de code + +start: + mov ah,0x0D + mov si,msg + int 0x47 ;Afficher le texte (Showstring0) + xor ax,ax + int 0x16 ;Attendre l'appuie sur une touche + retf ;retour far + +msg db 'Hello World',0 + diff --git a/contribs/ex-tasm.asm b/contribs/ex-tasm.asm new file mode 100644 index 0000000..56d894f --- /dev/null +++ b/contribs/ex-tasm.asm @@ -0,0 +1,19 @@ +.model tiny ;model tiny (.com) +.486 ;Pour processeur 80486 +Smart ;Optimisations +.code ;Segment de code + +org 0100h ;Point d'entré en 0100h + +start: + mov ah,0Dh + mov si,offset msg + int 47h ;Afficher le texte (Showstring0) + xor ax,ax + int 16h ;Attendre l'appuie sur une touche + db 0CBH ;retour far + +msg db 'Hello World',0 + +end start + diff --git a/include/bmp.h b/include/bmp.h new file mode 100644 index 0000000..955fe25 --- /dev/null +++ b/include/bmp.h @@ -0,0 +1,40 @@ +BMP_File struc +BMP_FileType db 'BM' +BMP_FileSize dd ? ; taille du fichier +BMP_Reserved dd 0 ; toujours 0 +BMP_BitMapOffset dd ? ; offset de l'image +BMP_HeaderSize dd ? ; taille de l'entete en octects +BMP_Width dd ? ; largeur en pixels de l'image +BMP_Height dd ? ; hauteur en pixels de l'image +BMP_Planes dw 1 ; nombre de plan utilisés +BMP_BitsPerPixel dw ? ; nombre de bits par pixels +BMP_Compression dd ? ; méthode de compression +BMP_SizeOfBitMap dd ? ; taille de l'image en octects +BMP_HorzResolution dd ? ; resolution horizontale en pixels par mètre +BMP_VertResolution dd ? ; resolution verticale en pixels par mètre +BMP_ColorsUsed dd ? ; nombre de couleur dans la palette si 0: palette entière si BitPerPixel<=8 +BMP_ColorsImportant dd ? ; nombre de couleurs importantes masques pour les modes de plus de 8 bits par pixels +BMP_RedMask dd ? +BMP_GreenMask dd ? +BMP_BlueMask dd ? +BMP_AlphaMask dd ? +BMP_ColorSpaceType dd ? +BMP_RedX dd ? +BMP_RedY dd ? +BMP_RedZ dd ? +BMP_GreenX dd ? +BMP_GreenY dd ? +BMP_GreenZ dd ? +BMP_BlueX dd ? +BMP_BlueY dd ? +BMP_BlueZ dd ? +BMP_GammaRed dd ? +BMP_GammaGreen dd ? +BMP_GammeBlue dd ? +BMP_file ends + +;BMP_Compression peut prendre les valeurs suivantes: +BMP_COMP_UNCOMP equ 0 ; pas de compression +BMP_COMP_RLE8 equ 1 ; 8-bit run length encoding +BMP_COMP_RLE4 equ 2 ; 4-bit tun length encoding +BMP_COMP_BFE equ 3 ; bitfields encoding diff --git a/include/fat.h b/include/fat.h new file mode 100644 index 0000000..4c89a7d --- /dev/null +++ b/include/fat.h @@ -0,0 +1,58 @@ +Free equ 0 +True equ 1 +False equ 0 + +DPT struc +StepRate&HeadUnload db 0DFh ;Vitesse de progression & mont‚e de la tˆte +DMAFlag&HeadLoad db 002h ;Etat Dma et temps de descente de la tˆte +DelayMotorOff db 025h ;Temps avant extinction moteur +BytePerSector db 002h ;Taille des secteurs +SectorPerTracks db 000h ;Nombre de secteur par piste +InterSectGapLength db 01Bh ;Taille du GAP3 en lecture/‚criture +DataLength db 0FFh ;Longueur du transfert de donn‚es +InterSectGapLengthF db 054h ;Taille du GAP3 en formatage +FormatByte db 0F6h ;Octet de formatage +HeadSettlingTime db 000h ;Temps de repos des tˆtes +DelayMotorNormSpeed db 008h ;Temps de mont‚e en vitesse du moteur +DPT ends + +Entries Struc +FileName db 8 dup (0) +FilExt db 3 dup (0) +FileAttr db 0 +FileReserved db 0 +FileTimeCreaMs db 0 ;(*10 ms) +FileTimeCrea dw 0 +FileDateCrea dw 0 +FileDateAcc dw 0 +FileNotused dw 0 +FileTime dw 0 +FileDate dw 0 +FileGroup dw 0 +FileSize dd 0 +Entries Ends + +BootSector Struc +jumper db 0,0,0 +Vendor db 'COS2000A' ;Fabricant + n°série Formatage +SectorSize dw 512 ;octet/secteur +SectorsPerCluster db 1 ;secteur/cluster +ReservedSectors dw 1 ;secteur reserv‚ +FatsPerDrive db 2 ;nb de copie de la FAT +DirectorySize dw 224 ;taille rep racine +SectorsPerDrive dw 2880 ;nb secteur du volume si < 32 még +MédiaDescriptor db 0F0h ;Descripteur de média +SectorsPerFat dw 9 ;secteur/FAT +SectorsPerTrack dw 18 ;secteur/piste +HeadsPerDrive dw 2 ;nb de tˆteb de lecture/écriture +HiddenSectorsH dw 0 ;nombre de secteur cach‚s +HiddenSectorsL dw 0 ; +SectorPerDisk2 dd 0 ;Nombre secteur du volume si > 32 Mo+20h ; the number of sectors +BootDrive db 0 ;Lecteur de d‚marrage +ReservedForNT db 0 ;NA +BootSign db 29h ;boot signature 29h +SerialNumber dd 01020304h ;no de serie +DriveName db 'COS2000 ' ;nom de volume +TypeOffAt db 'FAT16 ' ;FAT +bootcode db 453 dup (0) +BootSector ends diff --git a/include/pci.h b/include/pci.h new file mode 100644 index 0000000..380875e --- /dev/null +++ b/include/pci.h @@ -0,0 +1,19 @@ +pci Struc +vendor dw 0 ;vendor ID (read-only), FFFFh returned if requested device non-existent +device dw 0 ;device ID (read-only) +command dw 0 ;command register +status dw 0 ;status register +revision db 0 ;revision ID +interface db 0 ;programming interface +subclass db 0 ;sub-class +class db 0 ;class code +cache db 0 ;cache line size +timer db 0 ;latency timer +typed db 0 ;header type + ;bits 6-0: header format + ;00h other + ;01h PCI-to-PCI bridge + ;02h PCI-to-CardBus bridge + ;bit 7: multi-function device +result db 0 ;Built-In Self-Test result +pci Ends diff --git a/include/pol8x16.inc b/include/pol8x16.inc new file mode 100644 index 0000000..bd946e6 --- /dev/null +++ b/include/pol8x16.inc @@ -0,0 +1,256 @@ + DB 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 07Eh, 081h, 0A5h, 081h, 081h, 0BDh, 099h, 081h, 07Eh, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 07Eh, 0FFh, 0DBh, 0FFh, 0FFh, 0C3h, 0E7h, 0FFh, 07Eh, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 036h, 07Fh, 07Fh, 07Fh, 07Fh, 03Eh, 01Ch, 008h, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 008h, 01Ch, 03Eh, 07Fh, 03Eh, 01Ch, 008h, 000h, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 018h, 03Ch, 03Ch, 0E7h, 0E7h, 0E7h, 018h, 018h, 03Ch, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 018h, 03Ch, 07Eh, 0FFh, 0FFh, 07Eh, 018h, 018h, 03Ch, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 000h, 000h, 018h, 03Ch, 03Ch, 018h, 000h, 000h, 000h, 000h, 000h, 000h, 000h + DB 0FFh, 0FFh, 0FFh, 0FFh, 0FFh, 0E7h, 0C3h, 0C3h, 0E7h, 0FFh, 0FFh, 0FFh, 0FFh, 0FFh, 000h, 000h + DB 000h, 000h, 000h, 000h, 03Ch, 066h, 042h, 042h, 066h, 03Ch, 000h, 000h, 000h, 000h, 000h, 000h + DB 0FFh, 0FFh, 0FFh, 0FFh, 0C3h, 099h, 0BDh, 0BDh, 099h, 0C3h, 0FFh, 0FFh, 0FFh, 0FFh, 000h, 000h + DB 000h, 000h, 00Fh, 007h, 00Dh, 019h, 03Ch, 066h, 066h, 066h, 03Ch, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 03Ch, 066h, 066h, 066h, 03Ch, 018h, 07Eh, 018h, 018h, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 03Fh, 033h, 03Fh, 030h, 030h, 030h, 070h, 0F0h, 0E0h, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 07Fh, 063h, 07Fh, 063h, 063h, 063h, 067h, 0E7h, 0E6h, 0C0h, 000h, 000h, 000h, 000h + DB 000h, 000h, 018h, 018h, 0DBh, 03Ch, 0E7h, 03Ch, 0DBh, 018h, 018h, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 040h, 060h, 070h, 07Ch, 07Fh, 07Ch, 070h, 060h, 040h, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 001h, 003h, 007h, 01Fh, 07Fh, 01Fh, 007h, 003h, 001h, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 018h, 03Ch, 07Eh, 018h, 018h, 018h, 07Eh, 03Ch, 018h, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 033h, 033h, 033h, 033h, 033h, 033h, 000h, 033h, 033h, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 07Fh, 0DBh, 0DBh, 0DBh, 07Bh, 01Bh, 01Bh, 01Bh, 01Bh, 000h, 000h, 000h, 000h, 000h + DB 000h, 03Eh, 063h, 030h, 01Ch, 036h, 063h, 063h, 036h, 01Ch, 006h, 063h, 03Eh, 000h, 000h, 000h + DB 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 07Fh, 07Fh, 07Fh, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 018h, 03Ch, 07Eh, 018h, 018h, 018h, 07Eh, 03Ch, 018h, 07Eh, 000h, 000h, 000h, 000h + DB 000h, 000h, 018h, 03Ch, 07Eh, 018h, 018h, 018h, 018h, 018h, 018h, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 018h, 018h, 018h, 018h, 018h, 018h, 07Eh, 03Ch, 018h, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 000h, 00Ch, 006h, 07Fh, 006h, 00Ch, 000h, 000h, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 000h, 018h, 030h, 07Fh, 030h, 018h, 000h, 000h, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 000h, 000h, 060h, 060h, 060h, 07Fh, 000h, 000h, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 000h, 024h, 066h, 0FFh, 066h, 024h, 000h, 000h, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 008h, 01Ch, 01Ch, 03Eh, 03Eh, 07Fh, 07Fh, 000h, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 07Fh, 07Fh, 03Eh, 03Eh, 01Ch, 01Ch, 008h, 000h, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h + DB 000h, 010h, 010h, 010h, 010h, 010h, 010h, 010h, 000h, 000h, 010h, 010h, 000h, 000h, 000h, 000h + DB 000h, 024h, 024h, 024h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h + DB 000h, 042h, 042h, 042h, 0FFh, 042h, 042h, 042h, 0FFh, 042h, 042h, 042h, 000h, 000h, 000h, 000h + DB 000h, 010h, 07Eh, 090h, 090h, 090h, 07Ch, 012h, 012h, 012h, 0FCh, 010h, 000h, 000h, 000h, 000h + DB 000h, 000h, 061h, 091h, 092h, 064h, 008h, 010h, 026h, 049h, 089h, 086h, 000h, 000h, 000h, 000h + DB 000h, 070h, 088h, 088h, 088h, 050h, 060h, 091h, 08Ah, 084h, 04Ah, 031h, 000h, 000h, 000h, 000h + DB 000h, 018h, 018h, 010h, 020h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h + DB 000h, 006h, 018h, 020h, 040h, 040h, 040h, 040h, 040h, 020h, 018h, 006h, 000h, 000h, 000h, 000h + DB 000h, 060h, 018h, 004h, 002h, 002h, 002h, 002h, 002h, 004h, 018h, 060h, 000h, 000h, 000h, 000h + DB 000h, 000h, 010h, 092h, 054h, 038h, 0FEh, 038h, 054h, 092h, 010h, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 010h, 010h, 010h, 0FEh, 010h, 010h, 010h, 000h, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 018h, 018h, 010h, 020h, 000h, 000h + DB 000h, 000h, 000h, 000h, 000h, 000h, 0FEh, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 018h, 018h, 000h, 000h, 000h, 000h + DB 000h, 000h, 001h, 001h, 002h, 004h, 008h, 010h, 020h, 040h, 080h, 080h, 000h, 000h, 000h, 000h + DB 000h, 03Ch, 042h, 083h, 085h, 089h, 091h, 0A1h, 0C1h, 081h, 042h, 03Ch, 000h, 000h, 000h, 000h + DB 000h, 010h, 030h, 050h, 010h, 010h, 010h, 010h, 010h, 010h, 010h, 07Ch, 000h, 000h, 000h, 000h + DB 000h, 03Ch, 042h, 081h, 001h, 002h, 03Ch, 040h, 080h, 080h, 080h, 0FFh, 000h, 000h, 000h, 000h + DB 000h, 03Ch, 042h, 081h, 001h, 002h, 03Ch, 002h, 001h, 081h, 042h, 03Ch, 000h, 000h, 000h, 000h + DB 000h, 002h, 006h, 00Ah, 012h, 022h, 042h, 082h, 0FFh, 002h, 002h, 002h, 000h, 000h, 000h, 000h + DB 000h, 0FFh, 080h, 080h, 080h, 0FCh, 002h, 001h, 001h, 081h, 042h, 03Ch, 000h, 000h, 000h, 000h + DB 000h, 03Ch, 042h, 081h, 080h, 0BCh, 0C2h, 081h, 081h, 081h, 042h, 03Ch, 000h, 000h, 000h, 000h + DB 000h, 0FFh, 081h, 001h, 002h, 004h, 008h, 010h, 010h, 010h, 010h, 010h, 000h, 000h, 000h, 000h + DB 000h, 03Ch, 042h, 081h, 081h, 042h, 03Ch, 042h, 081h, 081h, 042h, 03Ch, 000h, 000h, 000h, 000h + DB 000h, 03Ch, 042h, 081h, 081h, 043h, 03Dh, 001h, 001h, 081h, 042h, 03Ch, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 000h, 000h, 018h, 018h, 000h, 000h, 000h, 018h, 018h, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 000h, 000h, 018h, 018h, 000h, 000h, 000h, 018h, 018h, 010h, 020h, 000h, 000h + DB 000h, 002h, 004h, 008h, 010h, 020h, 040h, 020h, 010h, 008h, 004h, 002h, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 000h, 0FEh, 000h, 000h, 000h, 0FEh, 000h, 000h, 000h, 000h, 000h, 000h, 000h + DB 000h, 040h, 020h, 010h, 008h, 004h, 002h, 004h, 008h, 010h, 020h, 040h, 000h, 000h, 000h, 000h + DB 000h, 038h, 044h, 082h, 082h, 004h, 008h, 010h, 010h, 000h, 010h, 010h, 000h, 000h, 000h, 000h + DB 000h, 03Ch, 042h, 081h, 099h, 0A5h, 0A5h, 0A5h, 09Eh, 080h, 041h, 03Eh, 000h, 000h, 000h, 000h + DB 000h, 018h, 024h, 042h, 081h, 081h, 0FFh, 081h, 081h, 081h, 081h, 081h, 000h, 000h, 000h, 000h + DB 000h, 0FCh, 042h, 041h, 041h, 042h, 07Ch, 042h, 041h, 041h, 042h, 0FCh, 000h, 000h, 000h, 000h + DB 000h, 03Ch, 042h, 081h, 081h, 080h, 080h, 080h, 080h, 081h, 042h, 03Ch, 000h, 000h, 000h, 000h + DB 000h, 0FCh, 042h, 041h, 041h, 041h, 041h, 041h, 041h, 041h, 042h, 0FCh, 000h, 000h, 000h, 000h + DB 000h, 0FFh, 080h, 080h, 080h, 080h, 0FCh, 080h, 080h, 080h, 080h, 0FFh, 000h, 000h, 000h, 000h + DB 000h, 0FFh, 080h, 080h, 080h, 080h, 0FCh, 080h, 080h, 080h, 080h, 080h, 000h, 000h, 000h, 000h + DB 000h, 03Ch, 042h, 081h, 081h, 080h, 09Fh, 081h, 081h, 081h, 042h, 03Ch, 000h, 000h, 000h, 000h + DB 000h, 081h, 081h, 081h, 081h, 081h, 0FFh, 081h, 081h, 081h, 081h, 081h, 000h, 000h, 000h, 000h + DB 000h, 038h, 010h, 010h, 010h, 010h, 010h, 010h, 010h, 010h, 010h, 038h, 000h, 000h, 000h, 000h + DB 000h, 007h, 002h, 002h, 002h, 002h, 002h, 002h, 082h, 082h, 044h, 038h, 000h, 000h, 000h, 000h + DB 000h, 081h, 082h, 084h, 088h, 090h, 0E0h, 090h, 088h, 084h, 082h, 081h, 000h, 000h, 000h, 000h + DB 000h, 080h, 080h, 080h, 080h, 080h, 080h, 080h, 080h, 080h, 080h, 0FFh, 000h, 000h, 000h, 000h + DB 000h, 081h, 0C3h, 0A5h, 099h, 099h, 081h, 081h, 081h, 081h, 081h, 081h, 000h, 000h, 000h, 000h + DB 000h, 081h, 0C1h, 0A1h, 091h, 089h, 085h, 083h, 081h, 081h, 081h, 081h, 000h, 000h, 000h, 000h + DB 000h, 03Ch, 042h, 081h, 081h, 081h, 081h, 081h, 081h, 081h, 042h, 03Ch, 000h, 000h, 000h, 000h + DB 000h, 0FCh, 082h, 081h, 081h, 082h, 0FCh, 080h, 080h, 080h, 080h, 080h, 000h, 000h, 000h, 000h + DB 000h, 03Ch, 042h, 081h, 081h, 081h, 081h, 081h, 089h, 085h, 042h, 03Dh, 000h, 000h, 000h, 000h + DB 000h, 0FCh, 082h, 081h, 081h, 082h, 0FCh, 090h, 088h, 084h, 082h, 081h, 000h, 000h, 000h, 000h + DB 000h, 03Ch, 042h, 081h, 080h, 040h, 03Ch, 002h, 001h, 081h, 042h, 03Ch, 000h, 000h, 000h, 000h + DB 000h, 0FEh, 092h, 010h, 010h, 010h, 010h, 010h, 010h, 010h, 010h, 010h, 000h, 000h, 000h, 000h + DB 000h, 081h, 081h, 081h, 081h, 081h, 081h, 081h, 081h, 081h, 042h, 03Ch, 000h, 000h, 000h, 000h + DB 000h, 081h, 081h, 081h, 081h, 081h, 042h, 042h, 024h, 024h, 018h, 018h, 000h, 000h, 000h, 000h + DB 000h, 081h, 081h, 081h, 081h, 081h, 081h, 099h, 099h, 0A5h, 0A5h, 042h, 000h, 000h, 000h, 000h + DB 000h, 081h, 081h, 081h, 042h, 024h, 018h, 024h, 042h, 081h, 081h, 081h, 000h, 000h, 000h, 000h + DB 000h, 082h, 082h, 082h, 082h, 044h, 028h, 010h, 010h, 010h, 010h, 010h, 000h, 000h, 000h, 000h + DB 000h, 0FFh, 001h, 001h, 002h, 004h, 018h, 020h, 040h, 080h, 080h, 0FFh, 000h, 000h, 000h, 000h + DB 000h, 07Eh, 040h, 040h, 040h, 040h, 040h, 040h, 040h, 040h, 040h, 07Eh, 000h, 000h, 000h, 000h + DB 000h, 000h, 080h, 080h, 040h, 020h, 010h, 008h, 004h, 002h, 001h, 001h, 000h, 000h, 000h, 000h + DB 000h, 07Eh, 002h, 002h, 002h, 002h, 002h, 002h, 002h, 002h, 002h, 07Eh, 000h, 000h, 000h, 000h + DB 000h, 018h, 024h, 042h, 081h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 0FFh, 000h, 000h, 000h + DB 000h, 008h, 004h, 002h, 001h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 000h, 000h, 07Ch, 002h, 002h, 07Eh, 082h, 082h, 07Dh, 000h, 000h, 000h, 000h + DB 000h, 080h, 080h, 080h, 080h, 0BCh, 0C2h, 081h, 081h, 081h, 0C2h, 0BCh, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 000h, 000h, 03Ch, 042h, 080h, 080h, 080h, 042h, 03Ch, 000h, 000h, 000h, 000h + DB 000h, 001h, 001h, 001h, 001h, 03Dh, 043h, 081h, 081h, 081h, 043h, 03Dh, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 000h, 000h, 03Ch, 042h, 081h, 0FFh, 080h, 040h, 03Eh, 000h, 000h, 000h, 000h + DB 000h, 00Eh, 011h, 010h, 010h, 0FEh, 010h, 010h, 010h, 010h, 010h, 010h, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 000h, 000h, 03Dh, 043h, 081h, 081h, 043h, 03Dh, 001h, 002h, 07Ch, 000h, 000h + DB 000h, 080h, 080h, 080h, 080h, 0BCh, 0C2h, 081h, 081h, 081h, 081h, 081h, 000h, 000h, 000h, 000h + DB 000h, 000h, 008h, 008h, 000h, 038h, 008h, 008h, 008h, 008h, 008h, 03Eh, 000h, 000h, 000h, 000h + DB 000h, 000h, 002h, 002h, 000h, 006h, 002h, 002h, 002h, 002h, 002h, 082h, 044h, 038h, 000h, 000h + DB 000h, 080h, 080h, 080h, 080h, 082h, 084h, 088h, 090h, 0A8h, 0C4h, 082h, 000h, 000h, 000h, 000h + DB 038h, 008h, 008h, 008h, 008h, 008h, 008h, 008h, 008h, 008h, 008h, 03Eh, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 000h, 000h, 0ECh, 092h, 092h, 092h, 092h, 092h, 092h, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 000h, 000h, 0B8h, 0C4h, 082h, 082h, 082h, 082h, 082h, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 000h, 000h, 03Ch, 042h, 081h, 081h, 081h, 042h, 03Ch, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 000h, 000h, 0BCh, 0C2h, 081h, 081h, 081h, 0C2h, 0BCh, 080h, 080h, 000h, 000h + DB 000h, 000h, 000h, 000h, 000h, 03Dh, 043h, 081h, 081h, 081h, 043h, 03Dh, 001h, 001h, 000h, 000h + DB 000h, 000h, 000h, 000h, 000h, 0BEh, 0C1h, 080h, 080h, 080h, 080h, 080h, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 000h, 000h, 07Eh, 081h, 080h, 07Eh, 001h, 081h, 07Eh, 000h, 000h, 000h, 000h + DB 010h, 010h, 010h, 010h, 010h, 0FEh, 010h, 010h, 010h, 010h, 011h, 00Eh, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 000h, 000h, 081h, 081h, 081h, 081h, 081h, 043h, 03Dh, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 000h, 000h, 081h, 081h, 081h, 081h, 042h, 024h, 018h, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 000h, 000h, 082h, 082h, 092h, 092h, 092h, 0AAh, 044h, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 000h, 000h, 081h, 042h, 024h, 018h, 024h, 042h, 081h, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 000h, 000h, 081h, 081h, 081h, 081h, 043h, 03Dh, 001h, 002h, 07Ch, 000h, 000h + DB 000h, 000h, 000h, 000h, 000h, 0FFh, 002h, 004h, 018h, 020h, 040h, 0FFh, 000h, 000h, 000h, 000h + DB 000h, 004h, 008h, 010h, 010h, 010h, 020h, 010h, 010h, 010h, 008h, 004h, 000h, 000h, 000h, 000h + DB 000h, 010h, 010h, 010h, 010h, 000h, 000h, 010h, 010h, 010h, 010h, 000h, 000h, 000h, 000h, 000h + DB 000h, 040h, 020h, 010h, 010h, 010h, 008h, 010h, 010h, 010h, 020h, 040h, 000h, 000h, 000h, 000h + DB 000h, 000h, 070h, 099h, 00Eh, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 000h, 008h, 01Ch, 036h, 063h, 063h, 07Fh, 000h, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 01Eh, 033h, 061h, 060h, 060h, 061h, 033h, 01Eh, 006h, 003h, 03Eh, 000h, 000h, 000h + DB 000h, 000h, 066h, 066h, 000h, 066h, 066h, 066h, 066h, 066h, 03Bh, 000h, 000h, 000h, 000h, 000h + DB 000h, 006h, 00Ch, 018h, 000h, 03Eh, 063h, 07Fh, 060h, 063h, 03Eh, 000h, 000h, 000h, 000h, 000h + DB 000h, 008h, 01Ch, 036h, 000h, 03Ch, 006h, 03Eh, 066h, 066h, 03Bh, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 066h, 066h, 000h, 03Ch, 006h, 03Eh, 066h, 066h, 03Bh, 000h, 000h, 000h, 000h, 000h + DB 000h, 030h, 018h, 00Ch, 000h, 03Ch, 006h, 03Eh, 066h, 066h, 03Bh, 000h, 000h, 000h, 000h, 000h + DB 000h, 01Ch, 036h, 01Ch, 000h, 03Ch, 006h, 03Eh, 066h, 066h, 03Bh, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 000h, 03Ch, 066h, 060h, 066h, 03Ch, 00Ch, 006h, 03Ch, 000h, 000h, 000h, 000h + DB 000h, 008h, 01Ch, 036h, 000h, 03Eh, 063h, 07Fh, 060h, 063h, 03Eh, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 066h, 066h, 000h, 03Eh, 063h, 07Fh, 060h, 063h, 03Eh, 000h, 000h, 000h, 000h, 000h + DB 000h, 030h, 018h, 00Ch, 000h, 03Eh, 063h, 07Fh, 060h, 063h, 03Eh, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 066h, 066h, 000h, 038h, 018h, 018h, 018h, 018h, 03Ch, 000h, 000h, 000h, 000h, 000h + DB 000h, 018h, 03Ch, 066h, 000h, 038h, 018h, 018h, 018h, 018h, 03Ch, 000h, 000h, 000h, 000h, 000h + DB 000h, 060h, 030h, 018h, 000h, 038h, 018h, 018h, 018h, 018h, 03Ch, 000h, 000h, 000h, 000h, 000h + DB 000h, 063h, 063h, 008h, 01Ch, 036h, 063h, 063h, 07Fh, 063h, 063h, 000h, 000h, 000h, 000h, 000h + DB 01Ch, 036h, 01Ch, 000h, 01Ch, 036h, 063h, 063h, 07Fh, 063h, 063h, 000h, 000h, 000h, 000h, 000h + DB 00Ch, 018h, 030h, 000h, 07Fh, 033h, 030h, 03Eh, 030h, 033h, 07Fh, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 000h, 06Eh, 03Bh, 01Bh, 07Eh, 0D8h, 0DCh, 077h, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 01Fh, 036h, 066h, 066h, 07Fh, 066h, 066h, 066h, 067h, 000h, 000h, 000h, 000h, 000h + DB 000h, 008h, 01Ch, 036h, 000h, 03Eh, 063h, 063h, 063h, 063h, 03Eh, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 063h, 063h, 000h, 03Eh, 063h, 063h, 063h, 063h, 03Eh, 000h, 000h, 000h, 000h, 000h + DB 000h, 030h, 018h, 00Ch, 000h, 03Eh, 063h, 063h, 063h, 063h, 03Eh, 000h, 000h, 000h, 000h, 000h + DB 000h, 018h, 03Ch, 066h, 000h, 066h, 066h, 066h, 066h, 066h, 03Bh, 000h, 000h, 000h, 000h, 000h + DB 000h, 030h, 018h, 00Ch, 000h, 066h, 066h, 066h, 066h, 066h, 03Bh, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 063h, 063h, 000h, 063h, 063h, 063h, 063h, 03Fh, 003h, 006h, 03Ch, 000h, 000h, 000h + DB 000h, 063h, 063h, 01Ch, 036h, 063h, 063h, 063h, 063h, 036h, 01Ch, 000h, 000h, 000h, 000h, 000h + DB 000h, 063h, 063h, 000h, 063h, 063h, 063h, 063h, 063h, 063h, 03Eh, 000h, 000h, 000h, 000h, 000h + DB 000h, 018h, 018h, 07Eh, 0C3h, 0C0h, 0C0h, 0C3h, 07Eh, 018h, 018h, 000h, 000h, 000h, 000h, 000h + DB 000h, 01Ch, 036h, 032h, 030h, 078h, 030h, 030h, 030h, 073h, 07Eh, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 0C3h, 066h, 03Ch, 018h, 0FFh, 018h, 0FFh, 018h, 018h, 000h, 000h, 000h, 000h, 000h + DB 000h, 0FCh, 066h, 066h, 07Ch, 062h, 066h, 06Fh, 066h, 066h, 0F3h, 000h, 000h, 000h, 000h, 000h + DB 000h, 00Eh, 01Bh, 018h, 018h, 018h, 07Eh, 018h, 018h, 018h, 018h, 0D8h, 070h, 000h, 000h, 000h + DB 000h, 00Ch, 018h, 030h, 000h, 03Ch, 006h, 03Eh, 066h, 066h, 03Bh, 000h, 000h, 000h, 000h, 000h + DB 000h, 00Ch, 018h, 030h, 000h, 038h, 018h, 018h, 018h, 018h, 03Ch, 000h, 000h, 000h, 000h, 000h + DB 000h, 00Ch, 018h, 030h, 000h, 03Eh, 063h, 063h, 063h, 063h, 03Eh, 000h, 000h, 000h, 000h, 000h + DB 000h, 00Ch, 018h, 030h, 000h, 066h, 066h, 066h, 066h, 066h, 03Bh, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 03Bh, 06Eh, 000h, 06Eh, 033h, 033h, 033h, 033h, 033h, 000h, 000h, 000h, 000h, 000h + DB 03Bh, 06Eh, 000h, 063h, 073h, 07Bh, 07Fh, 06Fh, 067h, 063h, 063h, 000h, 000h, 000h, 000h, 000h + DB 000h, 03Ch, 06Ch, 06Ch, 03Eh, 000h, 07Eh, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h + DB 000h, 038h, 06Ch, 06Ch, 038h, 000h, 07Ch, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 018h, 018h, 000h, 018h, 018h, 030h, 063h, 063h, 03Eh, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 000h, 000h, 000h, 07Fh, 060h, 060h, 060h, 000h, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 000h, 000h, 000h, 07Fh, 003h, 003h, 003h, 000h, 000h, 000h, 000h, 000h, 000h + DB 000h, 060h, 0E0h, 063h, 066h, 06Ch, 018h, 030h, 06Eh, 0C3h, 006h, 00Ch, 01Fh, 000h, 000h, 000h + DB 000h, 060h, 0E0h, 063h, 066h, 06Ch, 018h, 033h, 067h, 0CFh, 01Fh, 003h, 003h, 000h, 000h, 000h + DB 000h, 000h, 018h, 018h, 000h, 018h, 018h, 03Ch, 03Ch, 03Ch, 018h, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 000h, 01Bh, 036h, 06Ch, 036h, 01Bh, 000h, 000h, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 000h, 06Ch, 036h, 01Bh, 036h, 06Ch, 000h, 000h, 000h, 000h, 000h, 000h, 000h + DB 011h, 044h, 011h, 044h, 011h, 044h, 011h, 044h, 011h, 044h, 011h, 044h, 011h, 044h, 000h, 000h + DB 055h, 0AAh, 055h, 0AAh, 055h, 0AAh, 055h, 0AAh, 055h, 0AAh, 055h, 0AAh, 055h, 0AAh, 000h, 000h + DB 0DDh, 077h, 0DDh, 077h, 0DDh, 077h, 0DDh, 077h, 0DDh, 077h, 0DDh, 077h, 0DDh, 077h, 000h, 000h + DB 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 000h, 000h + DB 018h, 018h, 018h, 018h, 018h, 018h, 018h, 0F8h, 018h, 018h, 018h, 018h, 018h, 018h, 000h, 000h + DB 018h, 018h, 018h, 018h, 018h, 0F8h, 018h, 0F8h, 018h, 018h, 018h, 018h, 018h, 018h, 000h, 000h + DB 036h, 036h, 036h, 036h, 036h, 036h, 036h, 0F6h, 036h, 036h, 036h, 036h, 036h, 036h, 000h, 000h + DB 000h, 000h, 000h, 000h, 000h, 000h, 000h, 0FEh, 036h, 036h, 036h, 036h, 036h, 036h, 000h, 000h + DB 000h, 000h, 000h, 000h, 000h, 0F8h, 018h, 0F8h, 018h, 018h, 018h, 018h, 018h, 018h, 000h, 000h + DB 036h, 036h, 036h, 036h, 036h, 0F6h, 006h, 0F6h, 036h, 036h, 036h, 036h, 036h, 036h, 000h, 000h + DB 036h, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 036h, 000h, 000h + DB 000h, 000h, 000h, 000h, 000h, 0FEh, 006h, 0F6h, 036h, 036h, 036h, 036h, 036h, 036h, 000h, 000h + DB 036h, 036h, 036h, 036h, 036h, 0F6h, 006h, 0FEh, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h + DB 036h, 036h, 036h, 036h, 036h, 036h, 036h, 0FEh, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h + DB 018h, 018h, 018h, 018h, 018h, 0F8h, 018h, 0F8h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 000h, 000h, 000h, 000h, 0F8h, 018h, 018h, 018h, 018h, 018h, 018h, 000h, 000h + DB 018h, 018h, 018h, 018h, 018h, 018h, 018h, 01Fh, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h + DB 018h, 018h, 018h, 018h, 018h, 018h, 018h, 0FFh, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 000h, 000h, 000h, 000h, 0FFh, 018h, 018h, 018h, 018h, 018h, 018h, 000h, 000h + DB 018h, 018h, 018h, 018h, 018h, 018h, 018h, 01Fh, 018h, 018h, 018h, 018h, 018h, 018h, 000h, 000h + DB 000h, 000h, 000h, 000h, 000h, 000h, 000h, 0FFh, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h + DB 018h, 018h, 018h, 018h, 018h, 018h, 018h, 0FFh, 018h, 018h, 018h, 018h, 018h, 018h, 000h, 000h + DB 018h, 018h, 018h, 018h, 018h, 01Fh, 018h, 01Fh, 018h, 018h, 018h, 018h, 018h, 018h, 000h, 000h + DB 036h, 036h, 036h, 036h, 036h, 036h, 036h, 037h, 036h, 036h, 036h, 036h, 036h, 036h, 000h, 000h + DB 036h, 036h, 036h, 036h, 036h, 037h, 030h, 03Fh, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 000h, 000h, 03Fh, 030h, 037h, 036h, 036h, 036h, 036h, 036h, 036h, 000h, 000h + DB 036h, 036h, 036h, 036h, 036h, 0F7h, 000h, 0FFh, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 000h, 000h, 0FFh, 000h, 0F7h, 036h, 036h, 036h, 036h, 036h, 036h, 000h, 000h + DB 036h, 036h, 036h, 036h, 036h, 037h, 030h, 037h, 036h, 036h, 036h, 036h, 036h, 036h, 000h, 000h + DB 000h, 000h, 000h, 000h, 000h, 0FFh, 000h, 0FFh, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h + DB 036h, 036h, 036h, 036h, 036h, 0F7h, 000h, 0F7h, 036h, 036h, 036h, 036h, 036h, 036h, 000h, 000h + DB 018h, 018h, 018h, 018h, 018h, 0FFh, 000h, 0FFh, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h + DB 036h, 036h, 036h, 036h, 036h, 036h, 036h, 0FFh, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 000h, 000h, 0FFh, 000h, 0FFh, 018h, 018h, 018h, 018h, 018h, 018h, 000h, 000h + DB 000h, 000h, 000h, 000h, 000h, 000h, 000h, 0FFh, 036h, 036h, 036h, 036h, 036h, 036h, 000h, 000h + DB 036h, 036h, 036h, 036h, 036h, 036h, 036h, 03Fh, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h + DB 018h, 018h, 018h, 018h, 018h, 01Fh, 018h, 01Fh, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 000h, 000h, 01Fh, 018h, 01Fh, 018h, 018h, 018h, 018h, 018h, 018h, 000h, 000h + DB 000h, 000h, 000h, 000h, 000h, 000h, 000h, 03Fh, 036h, 036h, 036h, 036h, 036h, 036h, 000h, 000h + DB 036h, 036h, 036h, 036h, 036h, 036h, 036h, 0FFh, 036h, 036h, 036h, 036h, 036h, 036h, 000h, 000h + DB 018h, 018h, 018h, 018h, 018h, 0FFh, 018h, 0FFh, 018h, 018h, 018h, 018h, 018h, 018h, 000h, 000h + DB 018h, 018h, 018h, 018h, 018h, 018h, 018h, 0F8h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 000h, 000h, 000h, 000h, 01Fh, 018h, 018h, 018h, 018h, 018h, 018h, 000h, 000h + DB 0FFh, 0FFh, 0FFh, 0FFh, 0FFh, 0FFh, 0FFh, 0FFh, 0FFh, 0FFh, 0FFh, 0FFh, 0FFh, 0FFh, 000h, 000h + DB 000h, 000h, 000h, 000h, 000h, 000h, 000h, 0FFh, 0FFh, 0FFh, 0FFh, 0FFh, 0FFh, 0FFh, 000h, 000h + DB 0F0h, 0F0h, 0F0h, 0F0h, 0F0h, 0F0h, 0F0h, 0F0h, 0F0h, 0F0h, 0F0h, 0F0h, 0F0h, 0F0h, 000h, 000h + DB 00Fh, 00Fh, 00Fh, 00Fh, 00Fh, 00Fh, 00Fh, 00Fh, 00Fh, 00Fh, 00Fh, 00Fh, 00Fh, 00Fh, 000h, 000h + DB 0FFh, 0FFh, 0FFh, 0FFh, 0FFh, 0FFh, 0FFh, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 000h, 000h, 03Bh, 06Eh, 06Ch, 06Ch, 06Eh, 03Bh, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 000h, 03Eh, 063h, 07Eh, 063h, 063h, 07Eh, 060h, 060h, 020h, 000h, 000h, 000h + DB 000h, 000h, 07Fh, 063h, 063h, 060h, 060h, 060h, 060h, 060h, 060h, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 000h, 07Fh, 036h, 036h, 036h, 036h, 036h, 036h, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 07Fh, 063h, 030h, 018h, 00Ch, 018h, 030h, 063h, 07Fh, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 000h, 000h, 03Fh, 06Ch, 06Ch, 06Ch, 06Ch, 038h, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 000h, 033h, 033h, 033h, 033h, 03Eh, 030h, 030h, 060h, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 000h, 03Bh, 06Eh, 00Ch, 00Ch, 00Ch, 00Ch, 00Ch, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 07Eh, 018h, 03Ch, 066h, 066h, 066h, 03Ch, 018h, 07Eh, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 01Ch, 036h, 063h, 063h, 07Fh, 063h, 063h, 036h, 01Ch, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 01Ch, 036h, 063h, 063h, 063h, 036h, 036h, 036h, 077h, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 01Eh, 030h, 018h, 00Ch, 03Eh, 066h, 066h, 066h, 03Ch, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 000h, 000h, 07Eh, 0DBh, 0DBh, 07Eh, 000h, 000h, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 003h, 006h, 07Eh, 0DBh, 0DBh, 0F3h, 07Eh, 060h, 0C0h, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 01Ch, 030h, 060h, 060h, 07Ch, 060h, 060h, 030h, 01Ch, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 03Eh, 063h, 063h, 063h, 063h, 063h, 063h, 063h, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 07Fh, 000h, 000h, 07Fh, 000h, 000h, 07Fh, 000h, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 018h, 018h, 018h, 0FFh, 018h, 018h, 018h, 000h, 0FFh, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 030h, 018h, 00Ch, 006h, 00Ch, 018h, 030h, 000h, 07Eh, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 00Ch, 018h, 030h, 060h, 030h, 018h, 00Ch, 000h, 07Eh, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 00Eh, 01Bh, 01Bh, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 000h, 000h + DB 018h, 018h, 018h, 018h, 018h, 018h, 018h, 018h, 0D8h, 0D8h, 070h, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 018h, 018h, 000h, 000h, 0FFh, 000h, 000h, 018h, 018h, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 000h, 03Bh, 06Eh, 000h, 03Bh, 06Eh, 000h, 000h, 000h, 000h, 000h, 000h, 000h + DB 000h, 038h, 06Ch, 06Ch, 038h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 000h, 000h, 000h, 018h, 018h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 000h, 000h, 000h, 000h, 018h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h + DB 000h, 00Fh, 00Ch, 00Ch, 00Ch, 00Ch, 00Ch, 0ECh, 06Ch, 03Ch, 01Ch, 000h, 000h, 000h, 000h, 000h + DB 000h, 0D8h, 06Ch, 06Ch, 06Ch, 06Ch, 06Ch, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h + DB 000h, 070h, 0D8h, 030h, 060h, 0C8h, 0F8h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 000h, 03Eh, 03Eh, 03Eh, 03Eh, 03Eh, 03Eh, 000h, 000h, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h diff --git a/include/pol8x8.inc b/include/pol8x8.inc new file mode 100644 index 0000000..7d5f4c0 --- /dev/null +++ b/include/pol8x8.inc @@ -0,0 +1,128 @@ + DB 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 07Eh, 081h, 0A5h, 081h, 0BDh, 099h, 081h, 07Eh + DB 07Eh, 0FFh, 0DBh, 0FFh, 0C3h, 0E7h, 0FFh, 07Eh, 06Ch, 0FEh, 0FEh, 0FEh, 07Ch, 038h, 010h, 000h + DB 010h, 038h, 07Ch, 0FEh, 07Ch, 038h, 010h, 000h, 038h, 07Ch, 038h, 0FEh, 0FEh, 07Ch, 038h, 07Ch + DB 010h, 010h, 038h, 07Ch, 0FEh, 07Ch, 038h, 07Ch, 000h, 000h, 018h, 03Ch, 03Ch, 018h, 000h, 000h + DB 0FFh, 0FFh, 0E7h, 0C3h, 0C3h, 0E7h, 0FFh, 0FFh, 000h, 03Ch, 066h, 042h, 042h, 066h, 03Ch, 000h + DB 0FFh, 0C3h, 099h, 0BDh, 0BDh, 099h, 0C3h, 0FFh, 00Fh, 007h, 00Fh, 07Dh, 0CCh, 0CCh, 0CCh, 078h + DB 03Ch, 066h, 066h, 066h, 03Ch, 018h, 07Eh, 018h, 03Fh, 033h, 03Fh, 030h, 030h, 070h, 0F0h, 0E0h + DB 07Fh, 063h, 07Fh, 063h, 063h, 067h, 0E6h, 0C0h, 099h, 05Ah, 03Ch, 0E7h, 0E7h, 03Ch, 05Ah, 099h + DB 080h, 0E0h, 0F8h, 0FEh, 0F8h, 0E0h, 080h, 000h, 002h, 00Eh, 03Eh, 0FEh, 03Eh, 00Eh, 002h, 000h + DB 018h, 03Ch, 07Eh, 018h, 018h, 07Eh, 03Ch, 018h, 066h, 066h, 066h, 066h, 066h, 000h, 066h, 000h + DB 07Fh, 0DBh, 0DBh, 07Bh, 01Bh, 01Bh, 01Bh, 000h, 03Eh, 063h, 038h, 06Ch, 06Ch, 038h, 0CCh, 078h + DB 000h, 000h, 000h, 000h, 07Eh, 07Eh, 07Eh, 000h, 018h, 03Ch, 07Eh, 018h, 07Eh, 03Ch, 018h, 0FFh + DB 018h, 03Ch, 07Eh, 018h, 018h, 018h, 018h, 000h, 018h, 018h, 018h, 018h, 07Eh, 03Ch, 018h, 000h + DB 000h, 018h, 00Ch, 0FEh, 00Ch, 018h, 000h, 000h, 000h, 030h, 060h, 0FEh, 060h, 030h, 000h, 000h + DB 000h, 000h, 0C0h, 0C0h, 0C0h, 0FEh, 000h, 000h, 000h, 024h, 066h, 0FFh, 066h, 024h, 000h, 000h + DB 000h, 018h, 03Ch, 07Eh, 0FFh, 0FFh, 000h, 000h, 000h, 0FFh, 0FFh, 07Eh, 03Ch, 018h, 000h, 000h + DB 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 040h, 040h, 040h, 040h, 040h, 000h, 040h, 000h + DB 090h, 090h, 000h, 000h, 000h, 000h, 000h, 000h, 050h, 050h, 0F8h, 050h, 0F8h, 050h, 050h, 000h + DB 020h, 078h, 0A0h, 070h, 028h, 0F0h, 020h, 000h, 0C8h, 0C8h, 010h, 020h, 040h, 098h, 098h, 000h + DB 070h, 088h, 050h, 020h, 054h, 088h, 074h, 000h, 060h, 020h, 040h, 000h, 000h, 000h, 000h, 000h + DB 020h, 040h, 080h, 080h, 080h, 040h, 020h, 000h, 020h, 010h, 008h, 008h, 008h, 010h, 020h, 000h + DB 000h, 020h, 0A8h, 070h, 070h, 0A8h, 020h, 000h, 000h, 000h, 020h, 020h, 0F8h, 020h, 020h, 000h + DB 000h, 000h, 000h, 000h, 000h, 060h, 020h, 040h, 000h, 000h, 000h, 000h, 0F8h, 000h, 000h, 000h + DB 000h, 000h, 000h, 000h, 000h, 060h, 060h, 000h, 002h, 004h, 008h, 010h, 020h, 040h, 080h, 000h + DB 070h, 088h, 098h, 0A8h, 0C8h, 088h, 070h, 000h, 040h, 0C0h, 040h, 040h, 040h, 040h, 0E0h, 000h + DB 070h, 088h, 008h, 010h, 020h, 040h, 0F8h, 000h, 070h, 088h, 008h, 010h, 008h, 088h, 070h, 000h + DB 008h, 018h, 028h, 048h, 0FCh, 008h, 008h, 000h, 0F8h, 080h, 080h, 0F0h, 008h, 088h, 070h, 000h + DB 020h, 040h, 080h, 0F0h, 088h, 088h, 070h, 000h, 0F8h, 008h, 010h, 020h, 040h, 040h, 040h, 000h + DB 070h, 088h, 088h, 070h, 088h, 088h, 070h, 000h, 070h, 088h, 088h, 078h, 008h, 008h, 070h, 000h + DB 000h, 000h, 060h, 060h, 000h, 060h, 060h, 000h, 000h, 000h, 060h, 060h, 000h, 060h, 060h, 020h + DB 010h, 020h, 040h, 080h, 040h, 020h, 010h, 000h, 000h, 000h, 0F8h, 000h, 0F8h, 000h, 000h, 000h + DB 080h, 040h, 020h, 010h, 020h, 040h, 080h, 000h, 078h, 084h, 004h, 008h, 010h, 000h, 010h, 000h + DB 070h, 088h, 088h, 0A8h, 0B8h, 080h, 078h, 000h, 020h, 050h, 088h, 088h, 0F8h, 088h, 088h, 000h + DB 0F0h, 088h, 088h, 0F0h, 088h, 088h, 0F0h, 000h, 070h, 088h, 080h, 080h, 080h, 088h, 070h, 000h + DB 0F0h, 088h, 088h, 088h, 088h, 088h, 0F0h, 000h, 0F8h, 080h, 080h, 0E0h, 080h, 080h, 0F8h, 000h + DB 0F8h, 080h, 080h, 0E0h, 080h, 080h, 080h, 000h, 070h, 088h, 080h, 080h, 098h, 088h, 078h, 000h + DB 088h, 088h, 088h, 0F8h, 088h, 088h, 088h, 000h, 0E0h, 040h, 040h, 040h, 040h, 040h, 0E0h, 000h + DB 038h, 010h, 010h, 010h, 010h, 090h, 060h, 000h, 088h, 090h, 0A0h, 0C0h, 0A0h, 090h, 088h, 000h + DB 080h, 080h, 080h, 080h, 080h, 080h, 0F8h, 000h, 082h, 0C6h, 0AAh, 092h, 082h, 082h, 082h, 000h + DB 084h, 0C4h, 0A4h, 094h, 08Ch, 084h, 084h, 000h, 070h, 088h, 088h, 088h, 088h, 088h, 070h, 000h + DB 0F0h, 088h, 088h, 0F0h, 080h, 080h, 080h, 000h, 070h, 088h, 088h, 088h, 0A8h, 090h, 068h, 000h + DB 0F0h, 088h, 088h, 0F0h, 0A0h, 090h, 088h, 000h, 070h, 088h, 080h, 070h, 008h, 088h, 070h, 000h + DB 0F8h, 020h, 020h, 020h, 020h, 020h, 020h, 000h, 088h, 088h, 088h, 088h, 088h, 088h, 070h, 000h + DB 088h, 088h, 088h, 050h, 050h, 020h, 020h, 000h, 082h, 082h, 082h, 082h, 092h, 092h, 06Ch, 000h + DB 088h, 088h, 050h, 020h, 050h, 088h, 088h, 000h, 088h, 088h, 088h, 050h, 020h, 020h, 020h, 000h + DB 0F8h, 008h, 010h, 020h, 040h, 080h, 0F8h, 000h, 0E0h, 080h, 080h, 080h, 080h, 080h, 0E0h, 000h + DB 080h, 040h, 020h, 010h, 008h, 004h, 002h, 000h, 0E0h, 020h, 020h, 020h, 020h, 020h, 0E0h, 000h + DB 020h, 050h, 088h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 0F8h, 000h + DB 040h, 020h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 070h, 008h, 078h, 088h, 074h, 000h + DB 080h, 080h, 0B0h, 0C8h, 088h, 0C8h, 0B0h, 000h, 000h, 000h, 070h, 088h, 080h, 088h, 070h, 000h + DB 008h, 008h, 068h, 098h, 088h, 098h, 068h, 000h, 000h, 000h, 070h, 088h, 0F8h, 080h, 070h, 000h + DB 030h, 048h, 040h, 0E0h, 040h, 040h, 040h, 000h, 000h, 000h, 034h, 048h, 048h, 038h, 008h, 030h + DB 080h, 080h, 0B0h, 0C8h, 088h, 088h, 088h, 000h, 020h, 000h, 060h, 020h, 020h, 020h, 070h, 000h + DB 010h, 000h, 030h, 010h, 010h, 010h, 090h, 060h, 080h, 080h, 088h, 090h, 0A0h, 0D0h, 088h, 000h + DB 0C0h, 040h, 040h, 040h, 040h, 040h, 0E0h, 000h, 000h, 000h, 0ECh, 092h, 092h, 092h, 092h, 000h + DB 000h, 000h, 0B0h, 0C8h, 088h, 088h, 088h, 000h, 000h, 000h, 070h, 088h, 088h, 088h, 070h, 000h + DB 000h, 000h, 0B0h, 0C8h, 0C8h, 0B0h, 080h, 080h, 000h, 000h, 068h, 098h, 098h, 068h, 008h, 008h + DB 000h, 000h, 0B0h, 0C8h, 080h, 080h, 080h, 000h, 000h, 000h, 078h, 080h, 070h, 008h, 0F0h, 000h + DB 040h, 040h, 0E0h, 040h, 040h, 050h, 020h, 000h, 000h, 000h, 088h, 088h, 088h, 098h, 068h, 000h + DB 000h, 000h, 088h, 088h, 088h, 050h, 020h, 000h, 000h, 000h, 082h, 082h, 092h, 092h, 06Ch, 000h + DB 000h, 000h, 088h, 050h, 020h, 050h, 088h, 000h, 000h, 000h, 088h, 088h, 098h, 068h, 008h, 070h + DB 000h, 000h, 0F8h, 010h, 020h, 040h, 0F8h, 000h, 010h, 020h, 020h, 040h, 020h, 020h, 010h, 000h + DB 040h, 040h, 040h, 000h, 040h, 040h, 040h, 000h, 040h, 020h, 020h, 010h, 020h, 020h, 040h, 000h + DB 076h, 0DCh, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 010h, 038h, 06Ch, 0C6h, 0C6h, 0FEh, 000h + DB 03Eh, 060h, 0C0h, 060h, 03Eh, 008h, 004h, 018h, 000h, 048h, 000h, 0CCh, 0CCh, 0CCh, 0CCh, 076h + DB 018h, 020h, 000h, 078h, 0CCh, 0FCh, 0C0h, 078h, 010h, 028h, 000h, 078h, 00Ch, 07Ch, 0CCh, 076h + DB 000h, 048h, 000h, 078h, 00Ch, 07Ch, 0CCh, 076h, 030h, 008h, 000h, 078h, 00Ch, 07Ch, 0CCh, 076h + DB 048h, 030h, 000h, 078h, 00Ch, 07Ch, 0CCh, 076h, 078h, 0CCh, 0C0h, 0CCh, 078h, 010h, 008h, 030h + DB 030h, 048h, 084h, 078h, 0CCh, 0FCh, 0C0h, 078h, 000h, 048h, 000h, 078h, 0CCh, 0FCh, 0C0h, 078h + DB 030h, 008h, 000h, 078h, 0CCh, 0FCh, 0C0h, 078h, 000h, 048h, 000h, 030h, 030h, 030h, 030h, 030h + DB 030h, 048h, 000h, 030h, 030h, 030h, 030h, 030h, 060h, 010h, 000h, 030h, 030h, 030h, 030h, 030h + DB 048h, 000h, 030h, 078h, 0CCh, 0CCh, 0FCh, 0CCh, 030h, 048h, 030h, 048h, 084h, 0FCh, 084h, 084h + DB 018h, 020h, 000h, 0F8h, 080h, 0F0h, 080h, 0F8h, 000h, 000h, 000h, 066h, 019h, 077h, 088h, 077h + DB 000h, 000h, 000h, 00Fh, 014h, 03Eh, 044h, 087h, 030h, 048h, 084h, 078h, 0CCh, 0CCh, 0CCh, 078h + DB 000h, 048h, 000h, 078h, 0CCh, 0CCh, 0CCh, 078h, 060h, 010h, 000h, 078h, 0CCh, 0CCh, 0CCh, 078h + DB 030h, 048h, 084h, 000h, 0CCh, 0CCh, 0CCh, 076h, 060h, 010h, 000h, 0CCh, 0CCh, 0CCh, 0CCh, 076h + DB 048h, 000h, 0CCh, 0CCh, 0CCh, 07Ch, 00Ch, 0F8h, 044h, 000h, 038h, 06Ch, 0C6h, 0C6h, 06Ch, 038h + DB 024h, 000h, 066h, 066h, 066h, 066h, 066h, 03Ch, 000h, 008h, 01Ch, 028h, 028h, 01Ch, 008h, 000h + DB 01Ch, 022h, 020h, 070h, 020h, 022h, 05Ch, 000h, 044h, 028h, 010h, 010h, 038h, 010h, 038h, 010h + DB 0F0h, 088h, 08Ah, 0F7h, 082h, 082h, 083h, 000h, 006h, 008h, 008h, 03Ch, 010h, 010h, 060h, 000h + DB 018h, 020h, 000h, 078h, 00Ch, 07Ch, 0CCh, 076h, 018h, 020h, 000h, 030h, 030h, 030h, 030h, 030h + DB 018h, 020h, 000h, 078h, 0CCh, 0CCh, 0CCh, 078h, 018h, 020h, 000h, 0CCh, 0CCh, 0CCh, 0CCh, 076h + DB 080h, 078h, 004h, 0F8h, 0CCh, 0CCh, 0CCh, 0CCh, 080h, 07Eh, 001h, 0C6h, 0E6h, 0D6h, 0CEh, 0C6h + DB 000h, 078h, 00Ch, 07Ch, 0CCh, 076h, 000h, 0FEh, 000h, 078h, 0CCh, 0CCh, 0CCh, 078h, 000h, 0FCh + DB 000h, 000h, 018h, 018h, 030h, 060h, 066h, 03Ch, 0FFh, 080h, 080h, 080h, 000h, 000h, 000h, 000h + DB 0FFh, 001h, 001h, 001h, 000h, 000h, 000h, 000h, 040h, 0C4h, 048h, 050h, 026h, 049h, 082h, 007h + DB 040h, 0C4h, 048h, 050h, 026h, 04Ah, 09Fh, 002h, 000h, 030h, 000h, 030h, 030h, 030h, 030h, 030h + DB 000h, 012h, 024h, 048h, 090h, 048h, 024h, 012h, 000h, 048h, 024h, 012h, 009h, 012h, 024h, 048h + DB 049h, 000h, 092h, 000h, 049h, 000h, 092h, 000h, 06Dh, 000h, 0B6h, 000h, 06Dh, 000h, 0B6h, 000h + DB 0AAh, 055h, 0AAh, 055h, 0AAh, 055h, 0AAh, 055h, 010h, 010h, 010h, 010h, 010h, 010h, 010h, 010h + DB 010h, 010h, 010h, 010h, 0F0h, 010h, 010h, 010h, 010h, 010h, 010h, 0F0h, 010h, 0F0h, 010h, 010h + DB 028h, 028h, 028h, 028h, 0E8h, 028h, 028h, 028h, 000h, 000h, 000h, 000h, 0F8h, 028h, 028h, 028h + DB 000h, 000h, 000h, 0F0h, 010h, 0F0h, 010h, 010h, 028h, 028h, 028h, 0E8h, 008h, 0E8h, 028h, 028h + DB 028h, 028h, 028h, 028h, 028h, 028h, 028h, 028h, 000h, 000h, 000h, 0F8h, 008h, 0E8h, 028h, 028h + DB 028h, 028h, 028h, 0E8h, 008h, 0F8h, 000h, 000h, 028h, 028h, 028h, 028h, 0F8h, 000h, 000h, 000h + DB 010h, 010h, 010h, 0F0h, 010h, 0F0h, 000h, 000h, 000h, 000h, 000h, 000h, 0F0h, 010h, 010h, 010h + DB 010h, 010h, 010h, 010h, 01Fh, 000h, 000h, 000h, 010h, 010h, 010h, 010h, 0FFh, 000h, 000h, 000h + DB 000h, 000h, 000h, 000h, 0FFh, 010h, 010h, 010h, 010h, 010h, 010h, 010h, 01Fh, 010h, 010h, 010h + DB 000h, 000h, 000h, 000h, 0FFh, 000h, 000h, 000h, 010h, 010h, 010h, 010h, 0FFh, 010h, 010h, 010h + DB 010h, 010h, 010h, 01Fh, 010h, 01Fh, 010h, 010h, 028h, 028h, 028h, 028h, 03Fh, 028h, 028h, 028h + DB 028h, 028h, 028h, 02Fh, 020h, 03Fh, 000h, 000h, 000h, 000h, 000h, 03Fh, 020h, 02Fh, 028h, 028h + DB 028h, 028h, 028h, 0EFh, 000h, 0FFh, 000h, 000h, 000h, 000h, 000h, 0FFh, 000h, 0EFh, 028h, 028h + DB 028h, 028h, 028h, 02Fh, 020h, 02Fh, 028h, 028h, 000h, 000h, 000h, 0FFh, 000h, 0FFh, 000h, 000h + DB 028h, 028h, 028h, 0EFh, 000h, 0EFh, 028h, 028h, 010h, 010h, 010h, 0FFh, 000h, 0FFh, 000h, 000h + DB 028h, 028h, 028h, 028h, 0FFh, 000h, 000h, 000h, 000h, 000h, 000h, 0FFh, 000h, 0FFh, 010h, 010h + DB 000h, 000h, 000h, 000h, 0FFh, 028h, 028h, 028h, 028h, 028h, 028h, 028h, 03Fh, 000h, 000h, 000h + DB 010h, 010h, 010h, 01Fh, 010h, 01Fh, 000h, 000h, 000h, 000h, 000h, 01Fh, 010h, 01Fh, 010h, 010h + DB 000h, 000h, 000h, 000h, 03Fh, 028h, 028h, 028h, 028h, 028h, 028h, 028h, 0FFh, 028h, 028h, 028h + DB 010h, 010h, 010h, 0FFh, 010h, 0FFh, 010h, 010h, 010h, 010h, 010h, 010h, 0F0h, 000h, 000h, 000h + DB 000h, 000h, 000h, 000h, 01Fh, 010h, 010h, 010h, 0FFh, 0FFh, 0FFh, 0FFh, 0FFh, 0FFh, 0FFh, 0FFh + DB 000h, 000h, 000h, 000h, 0FFh, 0FFh, 0FFh, 000h, 0E0h, 0E0h, 0E0h, 0E0h, 0E0h, 0E0h, 0E0h, 0E0h + DB 007h, 007h, 007h, 007h, 007h, 007h, 007h, 007h, 0FFh, 0FFh, 0FFh, 0FFh, 000h, 000h, 000h, 000h + DB 000h, 000h, 000h, 002h, 034h, 04Ch, 04Ch, 032h, 000h, 05Ch, 022h, 022h, 03Ch, 044h, 044h, 078h + DB 07Eh, 042h, 042h, 040h, 040h, 040h, 040h, 040h, 000h, 000h, 002h, 07Ch, 0A8h, 028h, 028h, 044h + DB 000h, 07Eh, 061h, 030h, 018h, 008h, 010h, 020h, 000h, 000h, 008h, 07Fh, 088h, 088h, 088h, 070h + DB 000h, 000h, 000h, 022h, 044h, 044h, 07Ah, 080h, 000h, 000h, 000h, 07Ch, 010h, 010h, 010h, 010h + DB 000h, 01Ch, 008h, 03Eh, 041h, 041h, 041h, 03Eh, 000h, 000h, 038h, 044h, 044h, 07Ch, 044h, 044h + DB 03Ch, 066h, 0C3h, 0C3h, 0C3h, 066h, 024h, 066h, 00Ch, 010h, 008h, 01Ch, 022h, 022h, 022h, 01Ch + DB 000h, 000h, 000h, 000h, 06Ch, 092h, 092h, 06Ch, 000h, 001h, 01Ah, 026h, 02Ah, 032h, 02Ch, 040h + DB 000h, 018h, 020h, 020h, 030h, 020h, 020h, 018h, 000h, 03Ch, 042h, 042h, 042h, 042h, 042h, 042h + DB 000h, 000h, 07Eh, 000h, 07Eh, 000h, 07Eh, 000h, 000h, 008h, 008h, 03Eh, 008h, 008h, 000h, 03Eh + DB 000h, 010h, 008h, 004h, 008h, 010h, 000h, 03Eh, 000h, 004h, 008h, 010h, 008h, 004h, 000h, 03Eh + DB 000h, 006h, 009h, 009h, 008h, 008h, 008h, 000h, 000h, 000h, 008h, 008h, 008h, 048h, 048h, 030h + DB 000h, 000h, 008h, 000h, 03Eh, 000h, 008h, 000h, 000h, 060h, 092h, 00Ch, 060h, 092h, 00Ch, 000h + DB 060h, 090h, 060h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 030h, 078h, 030h, 000h, 000h + DB 000h, 000h, 000h, 000h, 020h, 000h, 000h, 000h, 000h, 003h, 004h, 004h, 0C8h, 028h, 010h, 000h + DB 000h, 000h, 000h, 07Ch, 042h, 042h, 042h, 000h, 018h, 024h, 008h, 010h, 03Ch, 000h, 000h, 000h + DB 000h, 000h, 000h, 03Eh, 03Eh, 03Eh, 03Eh, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h diff --git a/install/MAKEFILE b/install/MAKEFILE new file mode 100644 index 0000000..b37e0e8 --- /dev/null +++ b/install/MAKEFILE @@ -0,0 +1,16 @@ +lnk_boot = tlink /x +asm= tasm /t/m5/zi +lnk= tlink /x/t + +all: setup.com + +setup.com: setup.asm + $(asm) setup + $(lnk) setup + +clean: + del *.obj + del *.exe + del *.com + del *.sys + del *.err diff --git a/install/setup.asm b/install/setup.asm old mode 100755 new mode 100644 index 8bc1bb8..a84cf33 --- a/install/setup.asm +++ b/install/setup.asm @@ -1,456 +1,164 @@ -.model tiny -.486 -smart -.code - -org 0100h - -ent equ 32h - -start: -jmp CopyCOS - -DiskSectorsPerTrack dw 18 -DiskTracksPerHead dw 80 -DiskHeads dw 2 - -Message db 0Dh,0Ah,'COS 2000b installation program (Celyn Operating System) !!',0Dh,0Ah,'Written By Nico',0Ah,0Dh,'Site online HTTP://WWW.MULTIMANIA.COM/COS2000',0Dh,0AH,'Copyright 2000',0Dh,0AH,'Please insert a floppy disk and press a key...',0Dh,0AH,'Be careful! All the disk is going to be deleted',0Dh,0AH,'$' -Message2 db 0Dh,0AH,'Create boot sector$' -systfile db 0Dh,0AH,'Creating file allocation table 16 bits$' -systfile2 db 0Dh,0AH,'Creating file information table 32 bytes$' -systfile3 db 0Dh,0AH,'Creating operating system files',0Dh,0Ah,'$' -systfile4 db 0D,0Ah,'Creating system tools',0Dh,0Ah,'$' -Errormsg db 0Dh,0AH,0Dh,0AH,'Installing error, please contact me at COS2000@MULTIMANIA.COM !',0Dh,0AH,'$' -Ok db 0Dh,0AH,0Dh,0AH,'The boot sector and the system files had been succefully copied.',0Dh,0AH, 'To try COS reboot with this system disk',0Dh,0AH,'$' -files db '*.*',0 -tools db '*.exe',0 -allboot db 0dh,0ah -boot db 'boot.bin',0,' $' -retu db 0Dh,0AH,'$' -dat db 'data',0 -dat2 db '..',0 -dta db 43 dup (0) - -copycos: - mov ah,4ah - mov bx,1000h - int 21h - jc error - mov ah,48h - mov bx,65536/16 - int 21h - jc error - mov fs,ax -mov ah,3Bh -mov dx,offset dat -int 21h -mov ah,9 -mov dx,offset message -int 21h -jc error -mov ax,0 -int 16h -mov ah,9 -mov dx,offset systfile -int 21h -jc error -mov cx,12 -mov bx,offset fat -erase: -call writesector -jc error -dec cx -jnz erase -mov ah,9 -mov dx,offset message2 -int 21h -jc error -mov dx,Offset allboot -int 21h -jc error -mov dx,offset boot -call addfile -jc error -mov ax,0F0FFh -mov cx,14 -mov di,offset fat -cld -rep stosw -mov bx,offset fat -mov cx,1 -call writesector -jc error -mov ah,9 -mov dx,offset systfile2 -int 21h -jc error -mov eax,0 -mov cx,512/4 -mov di,offset fat -cld -rep stosd -mov bx,offset fat -mov cx,13 -call writesector -jc error -mov ah,1Ah -mov dx,offset dta -int 21h -jc error -mov ah,4eh -xor cx,cx -mov dx,offset files -int 21h -mov ah,9 -mov dx,offset systfile3 -int 21h -jc error -allfile: -mov di,offset dta+43 -mov byte ptr [di],'$' -mov ah,9 -mov si,offset dta+30 -mov cl,13 -call uppercasemem -mov dx,si -cmp dword ptr [si],'toob' -clc -je allfilesend -int 21h -jc error -call addfile -jc error -call makefit -jc error -mov ah,9 -mov dx,offset retu -int 21h -jc error -mov di,offset dta+30 -mov al,0 -mov cl,13 -cld -rep stosb -allfilesend: -mov ah,4fh -int 21h -jnc allfile -mov ah,9 -mov dx,Offset ok -int 21h -mov ah,3Bh -mov dx,offset dat2 -int 21h -ret - -error: -mov ah,3Bh -mov dx,offset dat2 -int 21h -mov ah,9 -mov dx,offset errormsg -int 21h -ret - -addfile: -push ax bx dx si di bp ds es -mov cx,1 -mov bx,offset fat -call readsector -jc error2 -mov ax,3D00h -int 21h -jc error2 -mov cs:temp,ax -mov bx,ax -mov ax,4202h -xor cx,cx -xor dx,dx -int 21h -jc error2 -cmp dx,0 -jne error2 -cmp ax,0 -je error2 -sub ax,1 -shr ax,9 -inc ax -mov bp,ax -mov ax,4200h -xor cx,cx -xor dx,dx -int 21h -jc error2 -push fs -pop ds -push fs -pop es -mov ah,3fh -mov cx,0FFFFh -xor dx,dx -int 21h -push cs -pop ds -jc error2 -mov si,-2 -mov di,0 -xor bx,bx -fats: -add si,2 -cmp si,512 -jz error2 -cmp WORD PTR [si+offset fat],0h -jne fats -mov ax,si -shr ax,1 -cmp di,0 -jne nonew -mov entrie,ax -jmp new -nonew: -mov [offset fat+di],ax -new: -mov di,si -mov cx,ax -call writesector -jc error2 -add bx,512 -dec bp -jnz fats -mov word ptr [offset fat+di],0FFFFh -mov bx,offset fat -mov cx,1 -push cs -pop es -call writesector -mov cx,entrie -end1: -mov ah,3eh -mov bx,cs:temp -int 21h -errorend: -pop es ds bp di si dx bx ax -ret -entrie dw 0 -error2: -mov ah,3eh -mov bx,cs:temp -int 21h -stc -jmp errorend -temp dw 0 - -makefit: -push bx cx si di bp -mov ax,cx -mov bx,offset fat -mov cx,13 -retry: -call readsector -jc error3 -xor si,si -findfit: -cmp byte ptr [si+bx],0 -je finishfit -add si,32 -cmp si,512 -jb findfit -inc cx -jmp retry -finishfit: -mov di,si -add di,bx -mov si,dx -call asciiztofit -jc error3 -mov [di+26],ax -call writesector -jc error3 -end3: -pop bp di si cx bx -ret -error3: -stc -jmp end3 - -WriteSector: -push cx dx si - mov AX, CX - xor DX, DX - div DiskSectorsPerTrack - mov CL, DL ;{ Set the sector } - and CL, 63 ;{ Top two bits are bits 8&9 of the cylinder } - xor DX, DX - div DiskTracksPerHead - mov CH, DL ;{ Set the track bits 0-7 } - mov AL, DH - ror AL, 1 - ror AL, 1 - and AL, 11000000b - or CL, AL ;{ Set bits 8&9 of track } - xor DX, DX - div DiskHeads - mov DH, DL ;{ Set the head } - inc CL - mov SI, 4 -TryAgain: - mov AL, 1 - mov DL, 0 - mov AH, 3 - int 13h - jnc Done - dec SI - jnz TryAgain -Done: - jc enddd - mov cl, AH - mov ah,9 - mov dx,offset sign - int 21h - cmp cl,0 - enddd: - pop si dx cx -ret - -ReadSector: -push ax cx dx si - mov AX, CX - xor DX, DX - div cs:DiskSectorsPerTrack - mov CL, DL ;{ Set the sector } - and CL, 63 ;{ Top two bits are bits 8&9 of the cylinder } - xor DX, DX - div cs:DiskTracksPerHead - mov CH, DL ;{ Set the track bits 0-7 } - mov AL, DH - ror AL, 1 - ror AL, 1 - and AL, 11000000b - or CL, AL ;{ Set bits 8&9 of track } - xor dX, DX - div cs:DiskHeads - mov DH, DL ;{ Set the head } - inc CL - mov SI, 4 -TryAgain2: - mov AL, 1 - mov DL, 0 - mov AH, 2 - int 13h - jnc Done2 - dec SI - jnz TryAgain2 -Done2: - pop si dx cx ax -ret - -;->name ds:si ->es:di -AsciiZtoFit: -push ax bx cx dx si di ds es -xor bx,bx -mov dx,di -noextens: -mov al,[si+bx] -cmp al,'.' -je extens -call Issystchar -jc errortranslate -mov es:[di],al -inc di -inc bx -cmp bx,namesize ;(.) -jne noextens -erro: -stc -jmp errortranslate -extens: -add si,bx -inc si -sub bx,namesize -neg bx -mov al,0 -mov cx,bx -cld -rep stosb -xor bx,bx -wasextens: -mov al,[si+bx] -cmp al,0 -je endextens -call Issystchar -jc errortranslate -mov es:[di],al -inc di -inc bx -cmp bx,extsize -jne wasextens -jmp erro -endextens: -sub bx,extsize -neg bx -mov al,0 -mov cx,bx -cld -rep stosb -mov si,dx -mov di,dx -push es -pop ds -mov cx,extsize+namesize -call uppercaseMEM -clc -endtranslate: -pop es ds di si dx cx bx ax -ret -errortranslate: -stc -jmp endtranslate - -;Carry si al = caractŠre systŠme -isSystchar: -push di -mov di,offset exeptchar -isexcept: -cmp al,cs:[di] -je nogood -inc di -cmp byte ptr cs:[di],0 -jne isexcept -endanal: -pop di -ret -exeptchar db '/\<>:|.',01,0,0 -nogood: -stc -jmp endanal - -;Transforme les x caractŠres de la mem en ds:si en maj -uppercaseMEM: -push si di cx ax -mov di,si -uppercaser: -mov al,ds:[si] -inc si -cmp al,'A' -jb nonmaj -cmp al,'Z' -ja nonmaj -add al,'a'-'A' -nonmaj: -mov es:[di],al -inc di -dec cx -jnz uppercaser -enduppercase: -clc -pop ax cx di si -ret - -namesize equ 12 -extsize equ 5 - -sign db '.$' -fat DB 512 dup (0) -buffer db 0 - -end start +.model tiny +.486 +smart +.code + +org 0100h + +ent equ 32h + +start: +jmp CopyCOS + +Message db 0Dh,0Ah,'COS 2000 V3.02Fr programme d''installation',0Dh,0AH,'Inserez une disquette formatee et appuyez sur entre...',0Dh,0AH,'Attention le contenu de celle ci peut etre altere !!!',0Dh,0AH,'$' +Message2 db 0Dh,0AH,'Creation du secteur de demarrage...',0Dh,0Ah,'$' +Message3 db 0Dh,0AH,'Copie des fichiers systeme...',0Dh,0Ah,'$' +Errormsg db 0Dh,0AH,'Erreur d''installation, contactez moi a COS2000@MULTIMANIA.COM !',0Dh,0AH,'$' +Ok db 0Dh,0AH,'COS2000 a été correctement installé, veuillez redemarrer votre PC',0Dh,0AH,'$' +files db '*.*',0 +boot db 'boot.bin',0 +dat db 'data',0 +retu db 0Dh,0AH,'$' +dta db 43 dup (0) + +copycos: + mov ah,9 + mov dx,offset message + int 21h + xor ax,ax + int 16h + mov ah,4ah + mov bx,1000h + int 21h + jc error + mov ah,48h + mov bx,65536/16 + int 21h + jc error + mov fs,ax + mov ah,3Bh + mov dx,offset dat + int 21h + jc error + mov ah,1Ah + mov dx,offset dta + int 21h + jc error + mov ah,4eh + xor cx,cx + mov dx,offset files + int 21h + jc error + mov ah,09 + mov dx,offset message3 + int 21h +allfile: + mov byte ptr [offset dta+43],'$' + mov ah,9 + mov dx,offset dta+30 + int 21h + push dx + mov ah,09 + mov dx,offset retu + int 21h + pop dx + mov ax,3D00h + int 21h + jc error + mov bx,ax + mov ax,4202h + xor cx,cx + xor dx,dx + int 21h + jc error + cmp dx,0 + jne error + cmp ax,0 + je error + mov bp,ax + mov ax,4200h + xor cx,cx + xor dx,dx + int 21h + jc error + push fs + pop ds + mov ah,3fh + mov cx,0FFFFh + xor dx,dx + int 21h + push cs + pop ds + jc error + mov ah,3eh + int 21h + jc error + mov ah,3ch + push cs + pop es + mov di,offset dta+30-3 + mov word ptr [di],":a" + mov byte ptr [di+2],"\" + xor cx,cx + mov dx,di + int 21h + jc error + mov bx,ax + push fs + pop ds + xor dx,dx + mov ah,40h + mov cx,bp + int 21h + push cs + pop ds + jc error + mov ah,3eh + int 21h + jc error + mov ah,4fh + int 21h + jnc allfile + mov ah,09 + mov dx,offset message2 + int 21h + mov ax,3D00h + mov dx,offset boot + int 21h + jc error + push fs + pop ds + mov ah,3fh + mov cx,000FFh + xor dx,dx + int 21h + push cs + pop ds + jc error + mov ah,3eh + int 21h + jc error + push fs + pop es + mov ax,0301h + mov dx,0 + mov cx,0001h + xor bx,bx + int 13h + mov ah,09 + mov dx,offset Ok + int 21h + xor ax,ax + int 16h + ret + + +error: + mov ah,09 + mov dx,offset errormsg + int 21h + xor ax,ax + int 16h + ret + +end start diff --git a/noyau/8237.asm b/noyau/8237.asm new file mode 100644 index 0000000..c03dcb1 --- /dev/null +++ b/noyau/8237.asm @@ -0,0 +1,266 @@ +;**************************************************************** +; * +; Periph‚rique : DMA * +; Plages Entr‚es-Sorties : 0000-000F * +; 00C0-00DF * +; 0080-0090 * +; (0094-009F) * +; Plages M‚moires : AUCUNES * +; * +DmaRead equ 044h ;I/O to memory, no autoinit, increment, single mode +DmaWrite equ 048h ;Memory to I/O, no autoinit, increment, single mode + +;Lecture des bits du registre d'‚tat (08, D0 ) +STATUS_REQ3 = 80h ;Bit actif: le canal DMA concern‚ +STATUS_REQ2 = 40h ;re‡oit une requˆte DMA +STATUS_REQ1 = 20h ;Request +STATUS_REQ0 = 10h +STATUS_TC3 = 08h ;Bit actif: Un transfert DMA a ‚t‚ +STATUS_TC2 = 04h ;ex‚cut‚ depuis la derniŠre lecture +STATUS_TC1 = 02h ;du registre d'‚tat. +STATUS_TC0 = 01h ;Terminal Count + +;Ecriture des bits du registre de commande (08, D0) +COMMAND_DACKLEVEL = 80h ;Bit 7 actif: ligne DMA Acknowledge HIGH active +COMMAND_DREQLEVEL = 40h ;Bit 6 actif: ligne REQ Acknowledge LOW active +COMMAND_EXTWRITE = 20h ;Bit 5 actif: EXTENDED Write,sinon LATE Write +COMMAND_FIXEDPRI = 10h ;Bit 4 actif: priorit‚ constante +COMMAND_COMPRESS = 08h ;Bit 3 actif: compression +COMMAND_INACTIVE = 04h ;Bit 2 actif: contr“leur d‚sactiv‚ +COMMAND_ADH0 = 02h ;Bit 1 actif: Adress Hold pour canal 0/4 d‚sactiv‚ +COMMAND_MEM2MEM = 01h ;Bit 0 actif: m‚moire/m‚moire, sinon m‚moire/p‚riph‚rie + +;Ecriture des bits du registre de requˆte ( 09, D2 ) +REQUEST_RESERVED = 0F8h ;R‚glage des bits r‚serv‚s =0 +REQUEST_SET = 04h ;D‚finir requˆte DMA +REQUEST_CLR = 00h ;Supprimer requˆte DMA +REQUEST_MSK = 03h ;Indiquer le canal dans les deux bits du bas + +;Ecriture des bits du registre de masquage de canal ( 0A, D4 ) +CHANNEL_RESERVED = 0F8h ;R‚glage des bits r‚serv‚s =0 +CHANNEL_SET = 04h ;Masquer/verrouiller canal DMA +CHANNEL_CLR = 00h ;Lib‚rer canal DMA +CHANNEL_MSK = 03h ;Indiquer le canal dans les deux bits du bas + +;Ecriture des bits du registre de mode (0B,D6) +MODE_DEMAND = 00h ;Transf‚rer … la demande +MODE_SINGLE = 40h ;Transf‚rer valeurs uniques +MODE_BLOCK = 80h ;Transf‚rer en bloc +MODE_CASCADE = 0C0h ;Transf‚rer en cascade +MODE_DECREMENT = 20h ;D‚cr‚menter +MODE_AUTOINIT = 10h ;Autoinitialisation vers la fin +MODE_VERIFY = 00h ;V‚rifier +MODE_WRITE = 04h ;Ecrire dans la m‚moire +MODE_READ = 08h ;Lire depuis la m‚moire +MODE_INVALID = 0Ch ;Incorrect +MODE_CHANNELMSK = 03h ;Indiquer le canal dans les deux bits du bas + +;Ports du DMA esclave + +DmaStatusS dw 08h ;R SLAVE Registre d'‚tat +DmaCommandS dw 08h ;W SLAVE Registre de commande +DmaRequestS dw 09h ;W SLAVE Ex‚cuter requˆte DMA +DmachMaskS dw 0ah ;W SLAVE Masquer canaux +DmaModeS dw 0bh ;W SLAVE Mode de transfert +DmaFlipFlopS dw 0ch ;W SLAVE Flipflop adr/compteur +DmaTempS dw 0dh ;R SLAVE Reset du contr“leur +DmaClearS dw 0dh ;R SLAVE Registre temporaire +DmaMaskClrS dw 0eh ;R SLAVE Lib‚rer canaux +DmaMaskS dw 0fh ;R SLAVE Masquer canaux + +;Ports du DMA esclave + +DmaStatusM dw 0D0h ;R MASTER Registre d'‚tat +DmaCommandM dw 0D0h ;W MASTER Registre de commande +DmaRequestM dw 0D2h ;W MASTER Ex‚cuter requˆte DMA +DmaMaskM dw 0D4h ;W MASTER Masquer canaux +DmaModeM dw 0D6h ;W MASTER Mode de transfert +DmaFlipFlopM dw 0D8h ;W MASTER Flipflop adr/compteur +DmaTempM dw 0DAh ;R MASTER Reset du contr“leur +DmaClearM dw 0DAh ;R MASTER Registre temporaire +DmaMaskClrM dw 0DCh ;R MASTER Lib‚rer canaux +DmaMaskM2 dw 0DEh ;R MASTER Masquer canaux + +DmaAdress db 00h ;DMA address register 0 + db 002h ;DMA address register 1 + db 004h ;DMA address register 2 + db 006h ;DMA address register 3 + db 0c0h ;DMA address register 4 + db 0c4h ;DMA address register 5 + db 0c8h ;DMA address register 6 + db 0cch ;DMA address register 7 + +DmaCount db 001h ;DMA count registers 0 + db 003h ;DMA count registers 1 + db 005h ;DMA count registers 2 + db 007h ;DMA count registers 3 + db 0c2h ;DMA count registers 4 + db 0c6h ;DMA count registers 5 + db 0cah ;DMA count registers 6 + db 0ceh ;DMA count registers 7 + +DmaPage db 087h ;DMA page registers 0 + db 083h ;DMA page registers 1 + db 081h ;DMA page registers 2 + db 082h ;DMA page registers 3 + db 08fh ;DMA page registers 4 + db 08bh ;DMA page registers 5 + db 089h ;DMA page registers 6 + db 08ah ;DMA page registers 7 + +;verouille le canal AL +DisableDma: + push ax dx + cmp al, 4 + jae MasterDisableDma + mov dx, DmaMaskS + or al, 00000100b + out dx, al + jmp EndDisableDma +MasterDisableDma: + mov dx, DmaMaskS + and al, 00000011b + or al, 00000100b + out dx, al +EndDisableDma: + pop dx ax + ret + +;déverouille le canal AL +EnableDma: + push ax dx + cmp al, 4 + jae MasterDisableDma + mov dx, DmaMaskS + out dx, al + jmp EndEnableDma +MasterEnableDma: + mov dx, DmaMaskS + and al, 00000011b + out dx, al +EndEnableDma: + pop dx ax + ret + +;Efface le FlipFlop canal AL +ClrDmaFlipFlop: + push ax dx + cmp al, 4 + jae MasterClrFlipFlopDma + mov dx,DmaFlipFlopS + xor ax, ax + out dx, al + jmp EndClrFlipFlopDma +MasterClrFlipFlopDma: + mov dx,DmaFlipFlopM + xor ax, ax + out dx, al +EndClrFlipFlopDma: + pop dx ax + ret + +;Met le mode du canal al à ah +SetDmaMode: + push ax dx + cmp al, 4 + jae MasterSetDmaMode + mov dx,DmaModeS + or al, ah + out dx, al + jmp EndSetDmaMode +MasterSetDmaMode: + mov dx,DmaModeM + and al, 00000011b + or al, ah + out dx, al +EndSetDmaMode: + pop dx ax + ret + + +;Met le page du canal al a ah +SetDmaPage: + push ax bx dx si + cmp al, 4 + jae MasterSetDmaPage + mov si, offset DmaPage + xor dh, dh + xor bh, bh + mov bl, al + mov dl, cs:[si+bx] + xchg al, ah + out dx, al + jmp EndSetDmaPage +MasterSetDmaPage: +EndSetDmaPage: + pop si dx bx ax + ret + +;Met l'adresse du canal al a DS:BX +SetDmaAdress: + push ax bx cx dx si + push ax + mov ax, ds + and ax, 0000111111111111b + shl ax,4 + add bx, ax + mov ax, ds + and ax, 1111000000000000b + shr ax, 4 + mov cx,ax + pop ax + push ax + add ax,cx + call SetDmaPage + pop ax + call ClrDmaFlipFlop + mov si, offset DmaAdress + xor dh, dh + push bx + xor bh, bh + mov bl, al + mov dl, byte ptr cs:[si+bx] + pop bx + cmp al, 4 + jae MasterSetDmaAddress + mov al, bh + out dx, al + mov al, bl + out dx, al + jmp EndSetDmaAddress +MasterSetDmaAddress: + mov al, bh + out dx, al + call ClrDmaFlipFlop + mov al, bl + out dx, al +EndSetDmaAddress: + pop si dx cx bx ax + ret + +;Spécifie au controleur DMA le nombre d'octets à transférer dans CX +SetDmaCount: + push ax bx dx si + call ClrDmaFlipFlop + mov si, offset DmaCount + xor dh, dh + xor bh, bh + mov bl, al + mov dl, byte ptr cs:[si+bx] + cmp al, 4 + jae MasterSetDmaCount + mov al, ch + out dx, al + mov al, cl + out dx, al + jmp EndSetDmaCount +MasterSetDmaCount: + mov al, ch + out dx, al + call ClrDmaFlipFlop + mov al, cl + out dx, al +EndSetDmaCount: + pop si dx bx ax + ret + diff --git a/noyau/pic8259a.asm b/noyau/8259a.asm old mode 100755 new mode 100644 similarity index 94% rename from noyau/pic8259a.asm rename to noyau/8259a.asm index 7fcf64c..1c05847 --- a/noyau/pic8259a.asm +++ b/noyau/8259a.asm @@ -1,241 +1,241 @@ -.model tiny -.486 -smart -.code -org 0100h -start: -jmp tsr -db 'PIC8259A' -Tsr: -cli -cmp ax,1234h -jne nomore -mov ax,4321h -jmp itsok -nomore: -push bx -mov bl,ah -xor bh,bh -shl bx,1 -mov bx,cs:[bx].tables -mov cs:current,bx -pop bx -call cs:current -itsok: -jnc noerror -push bp -mov bp,sp -or byte ptr [bp+6],1b -pop bp -mov ax,cs -shl eax,16 -mov ax,cs:current -jmp endofint -noerror: -push bp -mov bp,sp -and byte ptr [bp+6],0FEh -pop bp -endofint: -sti -iret -current dw 0 -tables dw enableirq - dw disableirq - dw readmaskirq - dw readirr - dw readisr - dw installhandler - dw replacehandler - dw getint - dw setint - dw seteoi - -;Adresses de port du contr“leur IRQ - MASTERPIC = 020h ;Adresse de base du PIC maŒtre - SLAVEPIC = 0A0h ;Adresse de base du PIC esclave - IRQMASK = 001h ;Offset sur port de masquage - -;Commandes IRQ OCW2 - DISABLEROTATION = 000h ;Desactiver la rotation de priorités en mode EOI automatique - EOI = 020h ;End of Interrupt non sp‚cifi‚ - COMMANDEOI = 060h ;Commande EOI particulière - ENABLEROTATION = 080h ;Activer la rotation de priorités en mode EOI automatique - ROTATIONNOSPEC = 0A0h ;Rotation des priorités en mode EOI automatique - SETPRIORITY = 0C0h ;Definir la priorité - ROTATIONSPEC = 0E0h ;Rotation des priorités en mode EOI spécifié - -;Position des vecteurs d'interruptions - MASTERFIRSTVECTOR = 008h ;Vecteurs logiciels des interruptions - SLAVEFIRSTVECTOR = 070h ;‚lectroniques - -;OCW3 codes registres - IRR = 002h ;Interrupt Request Register - ISR = 003h ;In Service Register -;OCW3 et modes - OCW3 = 008h ;OCW3 - POLLING = 004h ;Polling bit - - -ISR = 0Bh ; Pas d'op‚ration, pas de Poll, lire ISR OCW3 -IRR = 0Ah ; Pas d'op‚ration, pas de Poll, lire IRR - - -;Autorise une interruption ‚lectronique -;Entr‚e : AL - Num‚ro de l'interruption (0-15) … autoriser 0-7 = MASTERPIC , 8-15 = SLAVEPIC -EnableIRQ: -push ax cx dx -mov dx,MASTERPIC+IRQMASK -cmp al,7 -jbe master -mov dx,SLAVEPIC+IRQMASK -master: -mov cl,al -and cl,7 -mov al,1 -shl al,cl -not al -mov ah,al -in al,dx -and al,ah -out dx,al -pop dx cx ax -ret - -;Desactive une interruption ‚lectronique -;Entr‚e : AL - Num‚ro de l'interruption (0-15) … desactiver 0-7 = MASTERPIC , 8-15 = SLAVEPIC -DisableIRQ: -push ax cx dx -mov dx,MASTERPIC+IRQMASK -cmp al,7 -jbe master2 -mov dx,SLAVEPIC+IRQMASK -master2: -mov cl,al -and cl,7 -mov al,1 -shl al,cl -mov ah,al -in al,dx -or al,ah -out dx,al -pop dx cx ax -ret - -;Signale "End Of Interrupt" de l'interruption al -SetEOI: -push ax dx -cmp al,7 -jbe master3 -mov al,EOI -out SLAVEPIC,al -master3: -mov al,EOI -out MASTERPIC,al -pop dx ax -ret - -;Lit les masques d'un contr“leur IRQ dans al, 0 master ou slave 1 ds bh -ReadmaskIrq: -push dx -mov dx,MASTERPIC+ IRQMASK -cmp bh,0 -jne Master5 -mov dx,SLAVEPIC+ IRQMASK -master5: -in al,dx -pop dx -ret - -;Lit le registre d'‚tat d'un contr“leur IRQ dans al, 0 master ou slave 1 ds bh -ReadISR: -push dx -mov dx,MASTERPIC -cmp bh,0 -jne Master6 -mov dx,SLAVEPIC -master6: -mov al,isr -out dx,al -in al,dx -pop dx -ret - -;Lit le registre d'‚tat d'un contr“leur IRQ dans al, 0 master ou slave 1 ds bh -ReadIRR: -push dx -mov dx,MASTERPIC -cmp bh,0 -jne Master7 -mov dx,SLAVEPIC -master7: -mov al,irr -out dx,al -in al,dx -pop dx -ret - -;remplace le handler pointer par ds:si en bx:100h interruption ax -replacehandler: -push ax bx cx si di ds es -mov es,bx -mov di,0100h -mov ah,4 -int 48h -jc reph -mov bx,ax -call getint -mov es:[102h],si -mov es:[104h],ds -call setint -reph: -pop es ds di si cx bx ax -ret - -;install le handler pointer par ds:si en bx:100h interruption ax -installhandler: -push bx cx di es -mov es,bx -mov di,100h -mov ah,4 -int 48h -jc inh -mov bx,ax -call setint -inh: -pop es di cx bx -ret - -;met es:di le handle de l'int al -setint: -push ax bx ds -call disableirq -cli -xor ah,ah -mov bx,ax -shl bx,2 -xor ax,ax -mov ds,ax -mov ds:[bx],di -mov ds:[bx+2],es -pop ds bx ax -sti -call enableirq -ret - -;met ds:si le handle de l'int al -getint: -push ax bx es -xor ah,ah -mov bx,ax -shl bx,2 -xor ax,ax -mov es,ax -mov si,es:[bx] -mov ds,es:[bx+2] -pop es bx ax -ret - - -end start - +.model tiny +.486 +smart +.code +org 0100h +start: +jmp tsr +db 'PIC8259A' +Tsr: +cli +cmp ax,1234h +jne nomore +mov ax,4321h +jmp itsok +nomore: +push bx +mov bl,ah +xor bh,bh +shl bx,1 +mov bx,cs:[bx].tables +mov cs:current,bx +pop bx +call cs:current +itsok: +jnc noerror +push bp +mov bp,sp +or byte ptr [bp+6],1b +pop bp +mov ax,cs +shl eax,16 +mov ax,cs:current +jmp endofint +noerror: +push bp +mov bp,sp +and byte ptr [bp+6],0FEh +pop bp +endofint: +sti +iret +current dw 0 +tables dw enableirq + dw disableirq + dw readmaskirq + dw readirr + dw readisr + dw installhandler + dw replacehandler + dw getint + dw setint + dw seteoi + +;Adresses de port du contr“leur IRQ + MASTERPIC = 020h ;Adresse de base du PIC maŒtre + SLAVEPIC = 0A0h ;Adresse de base du PIC esclave + IRQMASK = 001h ;Offset sur port de masquage + +;Commandes IRQ OCW2 + DISABLEROTATION = 000h ;Desactiver la rotation de priorités en mode EOI automatique + EOI = 020h ;End of Interrupt non sp‚cifi‚ + COMMANDEOI = 060h ;Commande EOI particulière + ENABLEROTATION = 080h ;Activer la rotation de priorités en mode EOI automatique + ROTATIONNOSPEC = 0A0h ;Rotation des priorités en mode EOI automatique + SETPRIORITY = 0C0h ;Definir la priorité + ROTATIONSPEC = 0E0h ;Rotation des priorités en mode EOI spécifié + +;Position des vecteurs d'interruptions + MASTERFIRSTVECTOR = 008h ;Vecteurs logiciels des interruptions + SLAVEFIRSTVECTOR = 070h ;‚lectroniques + +;OCW3 codes registres + IRR = 002h ;Interrupt Request Register + ISR = 003h ;In Service Register +;OCW3 et modes + OCW3 = 008h ;OCW3 + POLLING = 004h ;Polling bit + + +ISR = 0Bh ; Pas d'op‚ration, pas de Poll, lire ISR OCW3 +IRR = 0Ah ; Pas d'op‚ration, pas de Poll, lire IRR + + +;Autorise une interruption ‚lectronique +;Entr‚e : AL - Num‚ro de l'interruption (0-15) … autoriser 0-7 = MASTERPIC , 8-15 = SLAVEPIC +EnableIRQ: +push ax cx dx +mov dx,MASTERPIC+IRQMASK +cmp al,7 +jbe master +mov dx,SLAVEPIC+IRQMASK +master: +mov cl,al +and cl,7 +mov al,1 +shl al,cl +not al +mov ah,al +in al,dx +and al,ah +out dx,al +pop dx cx ax +ret + +;Desactive une interruption ‚lectronique +;Entr‚e : AL - Num‚ro de l'interruption (0-15) … desactiver 0-7 = MASTERPIC , 8-15 = SLAVEPIC +DisableIRQ: +push ax cx dx +mov dx,MASTERPIC+IRQMASK +cmp al,7 +jbe master2 +mov dx,SLAVEPIC+IRQMASK +master2: +mov cl,al +and cl,7 +mov al,1 +shl al,cl +mov ah,al +in al,dx +or al,ah +out dx,al +pop dx cx ax +ret + +;Signale "End Of Interrupt" de l'interruption al +SetEOI: +push ax dx +cmp al,7 +jbe master3 +mov al,EOI +out SLAVEPIC,al +master3: +mov al,EOI +out MASTERPIC,al +pop dx ax +ret + +;Lit les masques d'un contr“leur IRQ dans al, 0 master ou slave 1 ds bh +ReadmaskIrq: +push dx +mov dx,MASTERPIC+ IRQMASK +cmp bh,0 +jne Master5 +mov dx,SLAVEPIC+ IRQMASK +master5: +in al,dx +pop dx +ret + +;Lit le registre d'‚tat d'un contr“leur IRQ dans al, 0 master ou slave 1 ds bh +ReadISR: +push dx +mov dx,MASTERPIC +cmp bh,0 +jne Master6 +mov dx,SLAVEPIC +master6: +mov al,isr +out dx,al +in al,dx +pop dx +ret + +;Lit le registre d'‚tat d'un contr“leur IRQ dans al, 0 master ou slave 1 ds bh +ReadIRR: +push dx +mov dx,MASTERPIC +cmp bh,0 +jne Master7 +mov dx,SLAVEPIC +master7: +mov al,irr +out dx,al +in al,dx +pop dx +ret + +;remplace le handler pointer par ds:si en bx:100h interruption ax +replacehandler: +push ax bx cx si di ds es +mov es,bx +mov di,0100h +mov ah,4 +int 48h +jc reph +mov bx,ax +call getint +mov es:[102h],si +mov es:[104h],ds +call setint +reph: +pop es ds di si cx bx ax +ret + +;install le handler pointer par ds:si en bx:100h interruption ax +installhandler: +push bx cx di es +mov es,bx +mov di,100h +mov ah,4 +int 48h +jc inh +mov bx,ax +call setint +inh: +pop es di cx bx +ret + +;met es:di le handle de l'int al +setint: +push ax bx ds +call disableirq +cli +xor ah,ah +mov bx,ax +shl bx,2 +xor ax,ax +mov ds,ax +mov ds:[bx],di +mov ds:[bx+2],es +pop ds bx ax +sti +call enableirq +ret + +;met ds:si le handle de l'int al +getint: +push ax bx es +xor ah,ah +mov bx,ax +shl bx,2 +xor ax,ax +mov es,ax +mov si,es:[bx] +mov ds,es:[bx+2] +pop es bx ax +ret + + +end start + diff --git a/noyau/MAKEFILE b/noyau/MAKEFILE new file mode 100644 index 0000000..884139f --- /dev/null +++ b/noyau/MAKEFILE @@ -0,0 +1,67 @@ +lnk_boot = tlink /x +asm= tasm /t/m5/zi +lnk= tlink /x/t + +all: boot.bin clavier.sys 8259a.sys disque.sys heure.sys horloge.sys manette.sys port.sys souris.sys systeme.sys video.sys + +boot.bin: boot.asm + $(asm) boot + $(lnk_boot) boot + exe2boot boot.exe boot.bin + +clavier.sys: clavier.asm + $(asm) clavier + $(lnk) clavier + ren clavier.com clavier.sys + +8259a.sys: 8259a.asm + $(asm) 8259a + $(lnk) 8259a + ren 8259a.com 8259a.sys + +disque.sys: disque.asm + $(asm) disque + $(lnk) disque + ren disque.com disque.sys + +heure.sys: heure.asm + $(asm) heure + $(lnk) heure + ren heure.com heure.sys + +horloge.sys: horloge.asm + $(asm) horloge + $(lnk) horloge + ren horloge.com horloge.sys + +manette.sys: manette.asm + $(asm) manette + $(lnk) manette + ren manette.com manette.sys + +port.sys: port.asm + $(asm) port + $(lnk) port + ren port.com port.sys + +souris.sys: souris.asm + $(asm) souris + $(lnk) souris + ren souris.com souris.sys + +systeme.sys: systeme.asm + $(asm) systeme + $(lnk) systeme + ren systeme.com systeme.sys + +video.sys: video.asm + $(asm) video + $(lnk) video + ren video.com video.sys + +clean: + del *.obj + del *.exe + del *.com + del *.sys + del *.err diff --git a/noyau/asm.bat b/noyau/asm.bat deleted file mode 100755 index 0f3cfb8..0000000 --- a/noyau/asm.bat +++ /dev/null @@ -1,55 +0,0 @@ -@echo off - -echo Assembling file %1... -..\util\tasm %1.asm /m5/x/t -if errorlevel 1 goto end -if "%1"=="boot" goto boot -echo Linking file %1... -..\util\tlink %1.obj /x/t -if errorlevel 1 goto end -echo Copying file %1... -if "%1"=="video" goto video -if "%1"=="lpt" goto system -if "%1"=="keyboard" goto system -if "%1"=="mouse" goto system -if "%1"=="pic8259a" goto system -if "%1"=="timer" goto system -if "%1"=="drive" goto system -if "%1"=="joystick" goto system -if "%1"=="system" goto system -if "%1"=="setup" goto setup -if "%1"=="hours" goto system -copy %1.com ..\data\%1.exe>nul -goto end - -:boot -echo Linking file %1... -..\util\tlink %1.obj /x -if errorlevel 1 goto end -echo Copying file %1... -..\util\exe2boot %1.exe -copy %1.bin ..\data\%1.bin>nul -goto end - -:video -type thin8x8.fnt>>%1.com -:system -copy %1.com ..\data\%1.sys>nul -goto end -:setup -copy %1.com ..\%1.com>nul -goto end - -:end -if not exist *.bin goto exes -del *.bin -:exes -if not exist *.exe goto coms -del *.exe -:coms -if not exist *.com goto objs -del *.com -:objs -if not exist *.obj goto nobjs -del *.obj -:nobjs diff --git a/noyau/asmsys.bat b/noyau/asmsys.bat deleted file mode 100755 index 9bb00a9..0000000 --- a/noyau/asmsys.bat +++ /dev/null @@ -1,11 +0,0 @@ -@echo off -call asm video -call asm system -call asm lpt -call asm keyboard -call asm pic8259a -call asm timer -call asm drive -call asm mouse -call asm joystick -call asm boot \ No newline at end of file diff --git a/noyau/boot.asm b/noyau/boot.asm old mode 100755 new mode 100644 index 438a180..750e592 --- a/noyau/boot.asm +++ b/noyau/boot.asm @@ -1,219 +1,221 @@ -boots segment -.386 -org 7C00h -;org 100h -assume cs:boots,ds:boots - -start: -jmp boot - - -bootdb db 'COS2000A' ;Fabricant + n°série Formatage -sizec dw 512 ;octet/secteur - db 1 ;secteur/cluster -reserv dw 1 ;secteur reserv‚ -nbfat db 1 ;nb de copie de la FAT -nbfit dw 25 ;taille rep racine -allclu dw 2880 ;nb secteur du volume si < 32 még - db 0F0h ;Descripteur de média -fatsize dw 12 ;secteur/FAT -nbtrack dw 18 ;secteur/piste -head dw 2 ;nb de tˆteb de lecture/écriture -hidden dd 0 ;nombre de secteur cach‚s - dd 0 ;si nbsecteur = 0 nbsect ; the number of sectors -bootdrv db 0 ;Lecteur de d‚marrage - db 0 ;NA -bootsig db 29h ;boot signature 29h - dd 01020304h ;no de serie -pope db 'COS2000 ' ;nom de volume - db 'FAT16 ' ;FAT -specialboot: - -errorloading db 'It''s not a COS disk!',0dh,0ah,0 -okloading db 'COS search system',0Dh,0ah,0 -syst db 'Ok',0dh,0ah,0 -dot db '.',0 -carry db 0dh,0ah,0 -Sys db 'system',0,0,0,0,0,0 -sys2 db 'sys',0 - -errorboot: - mov si,offset errorloading - call showstr - mov ah,0 - int 16h - int 19h -boot: - mov Bootdrv,dl - cli - mov ax,09000h - mov ss,ax - mov sp,0FFFFh - sti - p: - push cs - pop ds - xor ax,ax - int 13h - jc errorboot - mov si,offset okloading - call showstr - mov cx,nbtrack - les si,ds:[1Eh*4] - mov byte ptr es:[si+4], cl - mov byte ptr es:[si+9], 0Fh - xor ax,ax - mov al,NbFat - mov bx,FatSize - mul bx - mov cx,ax - add cx,word ptr [offset Hidden] - adc cx,word ptr [offset Hidden+2] - add cx,Reserv - mov word ptr [offset BootSig],cx - xor dx,dx - mov ax,allclu - div nbtrack - xor dx,dx - div head - mov word ptr [offset pope],ax - push cs - pop es - mov bx,offset buffer - mov si,bx - xor dx,dx -CheckRoot: -call readsector -jc errorboot -xor di,di -findnext: -cmp byte ptr [bx+di],0 -je errorboot -push si di cx -mov si,di -add si,bx -call showstr -mov ax,si -mov si,offset dot -call showstr -mov si,ax -add si,12 -call showstr -mov si,offset carry -call showstr -mov si,ax -mov di,offset sys -mov cx,12+4 -rep cmpsb -pop cx di si -je oksystem -add di,32 -inc dx -cmp dx,nbfit -ja errorboot -cmp di,sizec -jb findnext -inc cx -jmp Checkroot -oksystem: -mov si,offset syst -call showstr -mov cx,[di+BX+26] -mov bx,200h -mov es,bx -push bx -mov bx,0100h -push bx -mov si,offset dot -fatagain: -cmp cx,0FFF0h -jae finishload -call readsector -jc errorboot -call showstr -add bx,sizec -call getfat -jnc fatagain -finishload: -push es -push es -push es -pop ds -pop fs -pop gs -push 7202h -popf -db 0CBh - - - -;<-cx nøsecteur ->cx code FAT -getfat: -push es bx -mov ax,cx -xor dx,dx -div sizec -mov cx,ax -add cx,reserv -mov bx,offset buffer -push cs -pop es -call readsector -jc errorgetfat -shl dx,1 -add bx,dx -mov cx,[bx] -errorgetfat: -pop bx es -ret - -ReadSector: -push ax cx dx si - mov AX, CX - xor DX, DX - div nbtrack - mov CL, DL ;{ Set the sector } - and CL, 63 ;{ Top two bits are bits 8&9 of the cylinder } - xor DX, DX - div word ptr pope - mov CH, DL ;{ Set the track bits 0-7 } - mov AL, DH - ror AL, 1 - ror AL, 1 - and AL, 11000000b - or CL, AL ;{ Set bits 8&9 of track } - xor dX, DX - div head - mov DH, DL ;{ Set the head } - inc CL - mov SI, 4 -TryAgain: - mov AX,0201h - mov DL, bootdrv - int 13h - jnc Done - dec SI - jnz TryAgain -Done: - pop si dx cx ax -ret - -showstr: - push ax bx si -again: - lodsb - or al,al - jz fin - mov ah,0Eh - mov bx,07h - int 10h - jmp again - fin: - pop si bx ax - ret - - -Buffer equ $ -boots ends -end start - +boots segment +.386 +org 7C00h +;org 100h +assume cs:boots,ds:boots + +start: +jmp boot + +bootdb db 'COS2000A' ;Fabricant + n°série Formatage +sizec dw 512 ;octet/secteur + db 1 ;secteur/cluster +reserv dw 1 ;secteur reserv‚ +nbfat db 2 ;nb de copie de la FAT +nbfit dw 224 ;taille rep racine +allclu dw 2880 ;nb secteur du volume si < 32 még + db 0F0h ;Descripteur de média +fatsize dw 9 ;secteur/FAT +nbtrack dw 18 ;secteur/piste +head dw 2 ;nb de tˆteb de lecture/écriture +hidden dd 0 ;nombre de secteur cach‚s + dd 0 ;si nbsecteur = 0 nbsect ; the number of sectors +bootdrv db 0 ;Lecteur de d‚marrage +bootsig db 0 ;NA + db 29h ;boot signature 29h +bootsig2 dd 01020304h ;no de serie +pope db 'COS2000 ' ;nom de volume + db 'FAT12 ' ;FAT +specialboot: + +errorloading db ' Erreur !!',0dh,0ah,0 +okloading db 'Recherche noyau',0Dh,0ah,' - system.sys',0 +syst db ' Ok',0dh,0ah,'Chargement',0 +dot db '.',0 +Sys db 'SYSTEME SYS' + +errorboot: + mov si,offset errorloading + call showstr + mov ah,0 + int 16h + int 19h +boot: + mov Bootdrv,dl + cli + mov ax,09000h + mov ss,ax + mov sp,0FFFFh + sti + +boot2: + push cs + push cs + pop es + pop ds + xor ax,ax + int 13h + jc errorboot + mov si,offset okloading + call showstr + mov cx,Reserv + add cx,word ptr [offset Hidden] + adc cx,word ptr [offset Hidden+2] + push cx + mov bx,fatsize + mov di,offset bufferfat +readfat: + call readsector + inc cx + add di,sizec + dec bx + jnz readfat + pop cx + xor ax,ax + mov al,NbFat + mov bx,FatSize + mul bx + add cx,ax + mov ax,32 + mul nbfit + div sizec + add ax,cx + sub ax,2 + mov word ptr [offset bootsig],ax + xor dx,dx +CheckRoot: + mov di,offset buffer + call readsector + jc errorboot + xor bx,bx +findnext: + cmp byte ptr [di],0 + je errorboot + cmp byte ptr [di],0E5h + je no + cmp byte ptr [di],041h + je no + mov si,offset dot + call showstr + push di cx + mov si,offset sys + mov cx,11 + rep cmpsb + pop cx di + je oksystem +no: + add di,32 + add bx,32 + inc dx + cmp dx,nbfit + ja errorboot + cmp bx,sizec + jb findnext + inc cx + jmp Checkroot +oksystem: + mov si,offset syst + call showstr + mov cx,[di+26] + mov ax,0900h + mov es,ax + push es + mov di,100h + push di + mov si,offset dot + xor ax,ax +fatagain: + cmp cx,0FF0h + jae finishload + push cx + add cx,word ptr [offset bootsig] + call readsector + pop cx + jc errorboot + inc ax + call showstr + add di,sizec + call getfat + jnc fatagain +finishload: + db 0CBh + +;=============READSECTOR (Fonction 01H)=============== +;Lit le secteur CX et le met en es:di +;-> AH=1 +;<- Flag Carry si erreur +;===================================================== +ReadSector: + push ax bx cx dx si + mov ax,cx + xor dx,dx + div nbtrack + inc dl + mov bl,dl + xor dx,dx + div head + mov dh, 0 + xchg dl,dh + mov cx,ax + xchg cl,ch + shl cl,6 + or cl, bl + mov bx,di + mov SI, 4 + mov AL, 1 +TryAgain: + mov AH, 2 + int 13h + jnc Done + dec SI + jnz TryAgain +Done: + pop si dx cx bx ax +ret + +getfat: + push ax bx dx di + mov di,offset bufferfat + mov ax,cx + mov bx,ax + and bx,0000000000000001b + shr ax,1 + mov cx,3 + mul cx + add di,ax + cmp bx,0h + jnz evenfat +oddfat: + mov dx,[di] + and dx,0FFFh + mov cx,dx + jmp endfat +evenfat: + mov dx,[di+1] + and dx,0FFF0h + shr dx,4 + mov cx,dx +endfat: + pop di dx bx ax + ret + +showstr: + push ax bx si +again: + lodsb + or al,al + jz fin + mov ah,0Eh + mov bx,07h + int 10h + jmp again + fin: + pop si bx ax + ret + +Buffer equ $ +BufferFat equ $+2048 + +boots ends +end start + diff --git a/noyau/keyboard.asm b/noyau/clavier.asm old mode 100755 new mode 100644 similarity index 91% rename from noyau/keyboard.asm rename to noyau/clavier.asm index 636fb52..cbc6cbc --- a/noyau/keyboard.asm +++ b/noyau/clavier.asm @@ -1,208 +1,218 @@ -.model tiny -.486 -smart -.code - -org 0100h - -start: - -jmp tsr -offsets dd 0 -db 'KEYBOARD' -tsr: - pushf - db 2eh,0ffh,1eh - dw offsets - cli - mov cs:feax,eax - in al,60h - cmp cs:isstate,1 - jne nostate - cmp al,57 - jne endof - mov cs:isstate,0 - jmp endof - nostate: - cmp al,87 - je F11 - cmp al,88 - je F12 - endof: - mov eax,cs:feax - sti - iret - isstate db 0 - infos db 40 dup (0) - -F11: - push ax di es - push cs - pop es - mov di,offset infos - mov ah,34 - int 47h - mov al,cs:[di+7] - inc al - cmp al,9 - jbe notabove - mov al,0 -notabove: - mov ah,0 - int 47h - pop es di ax - jmp endof - - -f12: - mov cs:isstate,1 - pop word ptr cs:fip - pop word ptr cs:fcs - pop dword ptr cs:ffl - mov cs:fesp,esp - push ds es - pusha - push word ptr cs:fip - push gs - push fs - push ss - push es - push ds - push word ptr cs:fcs - push dword ptr cs:fesp - push ebp - push edi - push esi - push edx - push ecx - push ebx - push eax - push dword ptr cs:ffl - push cs - push cs - pop es - pop ds - mov ah,26 - int 47h - mov ah,2 - int 47h - mov ah,21 - mov cl,4 - int 47h - mov ah,13 - mov si,offset reg - int 47h - mov ah,6 - int 47h - mov ah,21 - mov cl,7 - int 47h - mov ah,13 - mov si,offset fla - int 47h - pop edx - mov cx,32 - mov ah,11 - int 47h - mov ah,5 - int 47h - mov ah,10 - int 47h - mov si,offset regs - mov bx,8+7 - mov ah,21 - mov cl,6 - int 47h -showallREG: - mov ah,6 - int 47h - cmp bx,8 - jb nodr - pop edx - mov cx,32 - jmp popo - nodr: - mov ah,21 - mov cl,1 - int 47h - xor edx,edx - pop dx - mov cx,16 - popo: - mov ah,13 - int 47h - mov ah,10 - int 47h - mov ah,5 - int 47h - push si - mov si,offset gr - mov ah,13 - int 47h - mov ah,8 - int 47h - mov si,offset dr - mov ah,13 - int 47h - pop si - add si,5 - dec bx - jnz showallreg - mov ah,34 - mov di,offset infos - int 47h - mov ah,25 - mov bl,cs:infos - xor bh,bh - dec bl - int 47h - mov si,offset app - mov ah,13 - int 47h - mov ah,32 - mov bl,cs:infos - xor bh,bh - mov di,ax - dec di - mov cl,116 - int 47h - pop es ds - sti - waitt: - cmp cs:isstate,0 - jne waitt - mov ah,27 - int 47h - popa - pop es ds - push dword ptr cs:ffl - push word ptr cs:fcs - push word ptr cs:fip - jmp endof - -reg db ' State of registers',0 -fla db 'Eflags:',0 -regs db 'EAX:',0 - db 'EBX:',0 - db 'ECX:',0 - db 'EDX:',0 - db 'ESI:',0 - db 'EDI:',0 - db 'EBP:',0 - db 'ESP:',0 - db ' CS:',0 - db ' DS:',0 - db ' ES:',0 - db ' FS:',0 - db ' GS:',0 - db ' SS:',0 - db ' IP:',0 -gr db '(',0 -dr db ')',0 -app db 'Press space to quit...',0 -ffl dd 0 -fcs dw 0 -fip dw 0 -fesp dd 0 -feax dd 0 -end start +.model tiny +.486 +smart +.code + +org 0100h + +start: + +jmp tsr +offsets dd 0 +db 'KEYBOARD' +tsr: + pushf + db 2eh,0ffh,1eh + dw offsets + cli + mov cs:feax,eax + in al,60h + cmp cs:isstate,1 + jne nostate + cmp al,57 + jne endof + mov cs:isstate,0 + jmp endof + nostate: + cmp al,68 + je F10 + cmp al,87 + je F11 + cmp al,88 + je F12 + endof: + mov eax,cs:feax + sti + iret + isstate db 0 + infos db 40 dup (0) + +F10: + mov ax,6000h + push ax + mov di,0100h + push di +sti + db 0CBh + +F11: + push ax di es + push cs + pop es + mov di,offset infos + mov ah,34 + int 47h + mov al,cs:[di+7] + inc al + cmp al,9 + jbe notabove + mov al,0 +notabove: + mov ah,0 + int 47h + pop es di ax + jmp endof + + +f12: + mov cs:isstate,1 + pop word ptr cs:fip + pop word ptr cs:fcs + pop dword ptr cs:ffl + mov cs:fesp,esp + push ds es + pusha + push word ptr cs:fip + push gs + push fs + push ss + push es + push ds + push word ptr cs:fcs + push dword ptr cs:fesp + push ebp + push edi + push esi + push edx + push ecx + push ebx + push eax + push dword ptr cs:ffl + push cs + push cs + pop es + pop ds + mov ah,26 + int 47h + mov ah,2 + int 47h + mov ah,21 + mov cl,4 + int 47h + mov ah,13 + mov si,offset reg + int 47h + mov ah,6 + int 47h + mov ah,21 + mov cl,7 + int 47h + mov ah,13 + mov si,offset fla + int 47h + pop edx + mov cx,32 + mov ah,11 + int 47h + mov ah,5 + int 47h + mov ah,10 + int 47h + mov si,offset regs + mov bx,8+7 + mov ah,21 + mov cl,6 + int 47h +showallREG: + mov ah,6 + int 47h + cmp bx,8 + jb nodr + pop edx + mov cx,32 + jmp popo + nodr: + mov ah,21 + mov cl,1 + int 47h + xor edx,edx + pop dx + mov cx,16 + popo: + mov ah,13 + int 47h + mov ah,10 + int 47h + mov ah,5 + int 47h + push si + mov si,offset gr + mov ah,13 + int 47h + mov ah,8 + int 47h + mov si,offset dr + mov ah,13 + int 47h + pop si + add si,5 + dec bx + jnz showallreg + mov ah,34 + mov di,offset infos + int 47h + mov ah,25 + mov bl,cs:infos + xor bh,bh + dec bl + int 47h + mov si,offset app + mov ah,13 + int 47h + mov ah,32 + mov bl,cs:infos + xor bh,bh + mov di,ax + dec di + mov cl,116 + int 47h + pop es ds + sti + waitt: + cmp cs:isstate,0 + jne waitt + mov ah,27 + int 47h + popa + pop es ds + push dword ptr cs:ffl + push word ptr cs:fcs + push word ptr cs:fip + jmp endof + +reg db ' Etats des registres',0 +fla db 'Eflags:',0 +regs db 'EAX:',0 + db 'EBX:',0 + db 'ECX:',0 + db 'EDX:',0 + db 'ESI:',0 + db 'EDI:',0 + db 'EBP:',0 + db 'ESP:',0 + db ' CS:',0 + db ' DS:',0 + db ' ES:',0 + db ' FS:',0 + db ' GS:',0 + db ' SS:',0 + db ' IP:',0 +gr db '(',0 +dr db ')',0 +app db 'Appuyez sur espace pour quitter...',0 +ffl dd 0 +fcs dw 0 +fip dw 0 +fesp dd 0 +feax dd 0 +end start diff --git a/noyau/clean.bat b/noyau/clean.bat deleted file mode 100755 index 687f4b0..0000000 --- a/noyau/clean.bat +++ /dev/null @@ -1,3 +0,0 @@ -@echo off -echo nettoyage en cours... -del ..\data\*.* >nul diff --git a/noyau/debog.bat b/noyau/debog.bat deleted file mode 100755 index aedbb4e..0000000 --- a/noyau/debog.bat +++ /dev/null @@ -1,2 +0,0 @@ -@echo off -..\util\td %1 diff --git a/noyau/disque.asm b/noyau/disque.asm new file mode 100644 index 0000000..e842a0b --- /dev/null +++ b/noyau/disque.asm @@ -0,0 +1,964 @@ +.model tiny +.486 +smart +.code + +org 0100h + +include ..\include\fat.h + +start: + jmp tsr ;Saute à la routine résidente +names db 'DRIVE' ;Nom drivers +id dw 1234h ;Identifiant drivers +Tsr: + cli ;Désactive interruptions logiciellement + cmp ax,cs:ID ;Compare si test de chargement + jne nomore ;Si pas test alors on continu + rol ax,3*4 ;Rotation de 3 chiffre de l'ID pour montrer que le drivers est chargé + jmp itsok ;On termine l'int avec notre code d'ID preuve du bon chargement de VIDEO +nomore: + cmp ah,maxfunc + jbe noerrorint + stc + jmp itsok +noerrorint: + clc + push bx + mov bl,ah ;On calcule d'aprés le n° de fonction + xor bh,bh ;quel sera l'entrée dans la table indexée + shl bx,1 ;des adresses fonctions. + mov bx,cs:[bx+tables] ;On récupère cette adresse depuis la table + mov cs:current,bx ;On la stocke temporairement pour obtenir les registres d'origine + pop bx + clc + call cs:current ;Puis on execute la fonction +itsok: + push bp + mov bp,sp ;On prend sp dans bp pour adresser la pile + jnc noerror ;La fonction appelée a renvoyer une erreur : Flag CARRY ? + or byte ptr [bp+6],1b;Si oui on le retranscrit sur le registre FLAG qui sera dépilé lors du IRET + ;xor eax,eax + ;mov ax,cs ;On récupère le segment et l'offset puis en renvoie l'adresse physique + ;shl eax,4 ;de l'erreur. + ;add ax,cs:current + jmp endofint ;on termine l'int +noerror: + and byte ptr [bp+6],0FEh;Si pas d'erreur on efface le Bit CARRY du FLAG qui sera dépilé lors du IRET +endofint: + pop bp + sti ;On réactive les interruptions logiciellement + iret ;Puis on retourne au programme appelant. + +current dw 0 ;Mot temporaire qui contient l'adresse de la fonction appelée +tables dw readsector + dw writesector + dw verifysector2 + dw initdrive + dw loadfile + dw compressrle + dw decompressrle + dw FindFirstfile + dw Findnextfile + dw GetFreeSpace + dw Searchfile + dw Getname + dw Getserial + dw changedir + dw readcluster + dw writecluster + dw getdir + +maxfunc equ 24 + +;DPT disquette +mydpt DPT ? + +;Secteur de boot +myboot bootSector ? + +;Données Calculée +clustersize dw 0 +TracksPerHead dw 0 +DriveSize dd 0 +AdressBoot dw 0 +AdressFat dw 0 +AdressParent dw 0 +AdressData dw 0 +AddingValue dw 0 +CurrentDir dw 0 ;En cluster +CurrentDirStr db 128 dup (0) + +;Pour recherches +EntryPlace dw 0 ;En octet +AdressDirectory dw 0 ;En cluster +firstsearch dw 1 ;Premiere requete ? + +getfat: + push ax bx dx si + mov ax,cx + mov bx,ax + and bx,0000000000000001b + shr ax,1 + mov cx,3 + mul cx + mov si,offset bufferfat + add si,ax + cmp bx,0h + jnz evenfat +oddfat: + mov dx,cs:[si] + and dx,0FFFh + mov cx,dx + jmp endfat +evenfat: + mov dx,cs:[si+1] + and dx,0FFF0h + shr dx,4 + mov cx,dx +endfat: + cmp dx,0FF0h + jbe nocarry + stc + pop si dx bx ax + ret +nocarry: + clc + pop si dx bx ax + ret + +;============loadfile (Fonction 4)=============== +;Charge le fichier ds:si en es:di ->ecx taille +;-> AH=4 +;<- Flag Carry si erreur +;===================================================== +loadfile: + push eax bx di + push es di + push cs + pop es + mov di,offset tempfit + call searchfile + pop di es + jne errorload + jc errorload + mov cx,cs:tempfit.FileGroup + mov eax,cs:tempfit.FileSize + call loadway + jc errorload + clc + mov ecx,eax + pop di bx eax + ret +errorload: + stc + mov ecx,0 + pop di bx eax + ret + +tempfit db 32 dup (0) + +;=============SearchFile (Fonction 10)=============== +;Renvois dans ES:DI la fit du fichier DS:SI et non equal si pas existant +;-> AH=10 +;<- Flag Carry si erreur +;===================================================== +SearchFile: + push ax cx ds si di es + call uppercase + push ds si + call findfirstfilez + push ds + pop es + mov di,si + pop si ds + jc errorsearch + jmp founded +nextsearch: + push ds si + call findnextfilez + push ds + pop es + mov di,si + pop si ds +founded: + cmp byte ptr cs:[di],0 + je notgood + cmp byte ptr cs:[di+FileAttr],0Fh + je nextsearch + call cmpnames + jc nextsearch +okfound: + push cs + pop ds + mov si,di + pop es di + push di es + mov cx,32 + rep movsb + clc + pop es di si ds cx ax + ret +notgood: + cmp si,0FF5h + pop es di si ds cx ax + ret +errorsearch: + stc + pop es di si ds cx ax + ret + +;Transforme la chaine ds:si en maj +uppercase: + push si ax + mov di,si +uppercaser: + mov al,ds:[si] + cmp al,0 + je enduppercase + cmp al,'a' + jb nonmaj + cmp al,'z' + ja nonmaj + sub al,'a'-'A' + mov ds:[si],al +nonmaj: + inc si + jmp uppercaser +enduppercase: + clc + pop ax si + ret + +;Compare le nom ds:si '.' avec es:di +CmpNames: + push ax cx si di + mov cx,8 + repe cmpsb + jne nequal + inc si +nequal: + cmp byte ptr [si-1],'.' + jne trynoext + mov al,' ' + rep scasb + mov cx,3 + rep cmpsb + jne notequal + cmp byte ptr [si],0 + jne notequal + cmp cx,0 + jl notequal +itok: + pop di si cx ax + ret +trynoext: + cmp byte ptr [si-1],0 + jne notequal + jmp itok +notequal: + stc + pop di si cx ax + ret + +;charge le fichier de de groupe CX et de taille eax +LoadWay: + push eax bx dx si di ecx ds es + cmp eax,0 + je Zeroload + rol eax,16 + mov dx,ax + ror eax,16 + div cs:clusterSize + mov bx,ax + cmp bx,1 + jb adjustlast +Loadfat: + call readcluster + jc noway + add di,cs:clusterSize + call getfat + dec bx + jnz loadfat +AdjustLast: + push es di + push cs + pop es + mov di,offset bufferread + mov si,di + call Readcluster + pop di es + jc noway + mov cx,dx + push cs + pop ds + rep movsb +zeroload: + clc + pop es ds ecx di si dx bx eax + ret +noway: + stc + pop es ds ebp di si dx bx eax + ret + +;=============INITDRIVE (Fonction 04H)=============== +;Initialise le lecteur pour une utilisation ultérieure +;-> AH=4 +;<- Flag Carry si erreur +;===================================================== +InitDrive: + push eax bx cx edx di ds es + push cs + pop ds + push cs + pop es + mov di,3 +againtry: + xor ax,ax + mov dx,0000h + int 13h + mov bx,offset myboot + mov ax,0201h + mov cx,0001h + mov dx,0000h + int 13h + jnc oknoagaintry + dec di + jnz againtry +oknoagaintry: + mov cs:lastseg,0 + mov cs:lastoff,0 + mov cs:LastRead,0 + mov ax,myboot.sectorsize + mov bl,myboot.SectorsPerCluster + xor bh,bh + mul bx + mov clustersize,ax + mov bx,myboot.HiddenSectorsL + adc bx,myboot.HiddenSectorsH + mov AdressBoot,bx + add bx,myboot.ReservedSectors + mov AdressFat,bx + xor ax,ax + mov al,myboot.FatsPerDrive + mul myboot.SectorsPerFat + add bx,ax + mov AdressParent,bx + mov AdressDirectory,bx + mov ax,32 + mul myboot.DirectorySize + div myboot.SectorSize + add bx,ax + mov AdressData,bx + sub bx,2 + mov AddingValue,bx + mov ax,myboot.SectorsPerDrive + div myboot.SectorsPerTrack + xor dx,dx + div myboot.HeadsPerDrive + mov TracksPerHead,ax + xor eax,eax + mov ax,myboot.SectorsPerDrive + sub ax,AdressData + mul myboot.SectorSize + shl edx,16 + add edx,eax + mov DriveSize,edx + mov CurrentDir,0 + mov EntryPlace,0 + mov adressdirectory,0 + mov firstsearch,1 + mov currentdirstr,0 + mov di,offset bufferfat + mov dx,myboot.SectorsPerFat + mov cx,AdressFat +SeeFat: + call readsector + jc ErrorInit + add di,myboot.SectorSize + inc cx + dec dx + jnz seefat + clc + pop es ds di edx cx bx eax + ret +ErrorInit: + stc + pop es ds di edx cx bx eax + ret + +;=============FindFirstFile (Fonction 7)============== +;Renvois dans ES:DI un bloc d'info +;-> AH=7 +;<- Flag Carry si erreur +;===================================================== +FindFirstFile: + push cx ds di si + call FindFirstFileZ + mov cx,32 + rep movsb + pop si di ds cx + ret + +FindFirstFileZ: + push cx + mov cx,cs:CurrentDir + mov cs:AdressDirectory,cx + xor cx,cx + mov cs:EntryPlace,cx + mov cs:firstsearch,1 + call findnextfileZ + pop cx + ret + +;=============FindnextFile (Fonction 8)============== +;Renvois dans ES:DI un bloc d'info +;-> AH=8 +;<- Flag Carry si erreur +;===================================================== +;Renvois dans ES:DI un bloc d'info +FindnextFile: + push cx ds di si + call FindnextFileZ + mov cx,32 + rep movsb + pop si di ds cx + ret + +;fait pointer ds:si sur la prochaine entrée du repertoire courant +FindnextFileZ: + push ax bx cx es di + push cs + pop ds + mov cx,cs:AdressDirectory + mov bx,cs:Entryplace +FindnextFileagain: + cmp cs:firstsearch,1 + je first + add bx,32 + cmp bx,cs:clusterSize + jb nopop +first: + mov di,offset bufferentry + push cs + pop es + mov bx,0 + cmp cs:currentdir,0 + jne notrootdir + cmp cs:firstsearch,1 + je noaddfirst1 + inc cx +noaddfirst1: + add cx,cs:adressparent + mov al,myboot.sectorspercluster +readroot: + call readsector + jc notwell + add di,myboot.sectorsize + dec al + jnz readroot + sub cx,cs:adressparent + jmp nopop +notrootdir: + cmp cs:firstsearch,1 + je noaddfirst2 + call getfat +noaddfirst2: + jc notwell + call readcluster + jc notwell +nopop: + mov cs:firstsearch,0 + mov si,offset bufferentry + add si,bx + cmp byte ptr cs:[si],0 + je notwell + mov cs:entryplace,bx + mov cs:AdressDirectory,cx + cmp byte ptr cs:[si],0E5h + je findnextfileagain + cmp byte ptr cs:[si+fileattr],28h + je findnextfileagain + cmp byte ptr cs:[si+fileattr],0Fh + je findnextfileagain + clc + pop di es cx bx ax + ret +notwell: + stc + pop di es cx bx ax + ret + +;=============GetFreeSpace (Fonction 09H)=============== +;Renvoie en EDX l'espace disque libre du volume +;-> AH=9 +;<- Flag Carry si erreur +;===================================================== +GetFreeSpace: + push eax + xor eax,eax + call getsector + mul cs:myboot.SectorSize + shl edx,16 + add edx,eax + pop eax + ret + +;ax=défectueux bx=libre +GetSector: + push cx dx + mov dx,cs:myboot.SectorsPerDrive + sub dx,cs:AddingValue + xor ax,ax + xor bx,bx + mov cx,0 +goget: + push cx + call getfat + cmp cx,0FF7h + jne notdefect + inc bx +notdefect: + cmp cx,0 + jne notfree + inc ax +notfree: + pop cx + inc cx + dec dx + jnz goget + pop dx cx + ret +errorfree: + stc + pop dx cx + ret + + +;=============READCLUSTER (Fonction 14)=============== +;Lit le secteur CX et le met en es:di +;-> AH=14 +;<- Flag Carry si erreur +;===================================================== +readcluster: + push ax bx cx dx di + mov ax,cx + mov bl,cs:myboot.sectorspercluster + xor bh,bh + mul bx + mov cx,ax + add cx,cs:addingvalue +readsectors: + call readsector + jc errorreadincluster + add di,cs:myboot.sectorsize + inc cx + dec bl + jnz readsectors + clc + pop di dx cx bx ax + ret +errorreadincluster: + stc + pop di dx cx bx ax + ret + +;=============WRITECLUSTER (Fonction 15)=============== +;Ecrit le cluster CX et le met en es:di +;-> AH=14 +;<- Flag Carry si erreur +;===================================================== +writecluster: + push ax bx cx dx si + mov ax,cx + mov bl,cs:myboot.sectorspercluster + xor bh,bh + mul cx + mov cx,ax + add cx,cs:addingvalue +writesectors: + call writesector + jc errorwriteincluster + add si,cs:myboot.sectorsize + inc cx + dec bx + jnz writesectors + clc + pop si dx cx bx ax + ret +errorwriteincluster: + stc + pop si dx cx bx ax + ret + +;=============READSECTOR (Fonction 01H)=============== +;Lit le secteur CX et le met en es:di +;-> AH=1 +;<- Flag Carry si erreur +;===================================================== +ReadSector: + push ax bx cx dx si + cmp cx,cs:lastread + jne gom + mov ax,es + cmp cs:lastseg,ax + jne gom + cmp di,cs:lastoff + jne gom + jmp done +gom: + mov cs:lastseg,ax + mov cs:lastoff,di + mov cs:LastRead,cx + mov ax,cx + xor dx,dx + div cs:myboot.SectorsPerTrack + inc dl + mov bl,dl + xor dx,dx + div cs:myboot.HeadsPerDrive + mov dh,cs:myboot.bootdrive + xchg dl,dh + mov cx,ax + xchg cl,ch + shl cl,6 + or cl,bl + mov bx,di + mov SI,4 + mov AL,1 +TryAgain: + mov AH, 2 + int 13h + jnc Done + dec SI + jnz TryAgain +Done: + pop si dx cx bx ax +ret + +lastread dw 0 +lastseg dw 0 +lastoff dw 0 + +;=============WRITESECTOR (Fonction 02H)============== +;Ecrit le secteur CX pointé par ds:si +;-> AH=2 +;<- Flag Carry si erreur +;===================================================== +WriteSector: + push ax bx cx dx si es + cmp cs:Lastread,cx + jne nodestruct + mov cs:Lastread,0ffffh +nodestruct: + push ds + pop es + mov ax,cx + xor dx,dx + div cs:myboot.SectorsPerTrack + inc dl + mov bl,dl + xor dx,dx + div cs:myboot.HeadsPerDrive + mov dh,cs:myboot.BootDrive + xchg dl,dh + mov cx,ax + xchg cl,ch + shl cl,6 + or cl, bl + mov bx,si + mov SI, 4 + mov AL,1 +TryAgains: + mov AH, 3 + int 13h + jnc Dones + dec SI + jnz TryAgains +Dones: + pop es si dx cx bx ax +ret + +;=============Getname (Fonction 11)============== +;Renvoie le nom en ES:DI +;-> AH=11 +;<- Flag Carry si erreur +;===================================================== +getname: + push ax cx dx si di ds es + push cs + pop ds + mov dx,di + mov si,offset myboot.DriveName + mov cx,11 + rep movsb + mov al,' ' + mov di,dx + mov cx,11 + repne scasb + mov byte ptr es:[di],0 + pop es ds di si dx cx ax + ret + +;=============Getserial (Fonction 12)============== +;Renvoie le numéro de serie en EDX +;-> AH=12 +;<- Flag Carry si erreur +;===================================================== +getserial: + mov edx,cs:myboot.serialnumber + ret + +;=============VERIFYSECTOR (Fonction 03H)============== +;Vérifie le secteur CX +;-> AH=3 +;<- Flag Carry si erreur, Flag Equal si secteurs égaux +;===================================================== +VerifySector: + push bx cx si di ds es + push cs + pop es + push cs + pop ds + mov bx,offset bufferread + call ReadSector + jc errorverify + call inverse + call WriteSector + jc errorverify + mov bx,offset bufferwrite + call ReadSector + call inverse + jc errorverify + mov bx,offset bufferread + call inverse + call WriteSector + jc errorverify + mov cx,cs:myboot.SectorSize + shr cx,2 + mov si,offset bufferread + mov di,offset bufferwrite + cld + rep cmpsd +errorverify: + pop es ds di si cx bx + ret + +Inverse: + mov si,cs:myboot.sectorsize + shr si,2 +invert: + shl si,2 + not dword ptr [bx+si-4] + shr si,2 + dec si + jnz invert + ret + +VerifySector2: + call verifysector + jne nook + or byte ptr [bp+6],10b +nook: + ret + +;=============DecompressRle (Fonction 05H)============== +;decompress ds:si en es:di taille bp d‚compress‚ cx compress‚ +;-> AH=5 +;<- Flag Carry si erreur, Flag Equal si secteurs égaux +;===================================================== +DecompressRle: + push cx dx si di + mov dx,cx + mov bp,di +decompression: + mov eax,[si] + cmp al,'/' + jne nocomp + cmp si,07FFFh-6 + jae thenen + mov ecx,eax + ror ecx,16 + cmp cl,'*' + jne nocomp + cmp byte ptr [si+4],'/' + jne nocomp + mov al,ch + mov cl,ah + xor ah,ah + xor ch,ch + rep stosb + add si,5 + sub dx,5 + jnz decompression + jmp thenen +nocomp: + mov es:[di],al + inc si + inc di + dec dx + jnz decompression +thenen: + mov ax,dx + sub bp,di + neg bp + clc + pop di si dx cx + ret + +;=============CompressRle (Fonction 06H)============== +;compress ds:si en es:di taille cx d‚compress‚ BP compress‚ +;-> AH=6 +;<- Flag Carry si erreur, Flag Equal si secteurs égaux +;===================================================== +CompressRle: + push ax bx cx dx si di ds es + mov bp,di + xchg si,di + push es + push ds + pop es + pop ds + mov dx,cx + ;mov bp,cx +againcomp: + mov bx,di + mov al,es:[di] + mov cx,dx + cmp ch,0 + je poo + mov cl,0ffh + ;mov cx,bp + ;sub cx,di + ;mov ah,cl +poo: + mov ah,cl + inc di + xor ch,ch + repe scasb + sub cl,ah + neg cl + cmp cl,6 + jbe nocomp2 + mov dword ptr [si],' * /' + mov byte ptr [si+4],'/' + mov [si+1],cl + mov [si+3],al + add si,5 + dec di + xor ch,ch + sub dx,cx + jnz againcomp + jmp fini +nocomp2: + mov [si],al + inc si + inc bx + mov di,bx + dec dx + jnz againcomp +fini: + sub bp,si + neg bp + clc + pop es ds di si dx cx bx ax + ret + +;=============Changedir (Fonction 13)============== +;Change le repertoire courant a DS:SI +;-> AH=13 +;<- Flag Carry si erreur, Flag Equal si secteurs égaux +;===================================================== +Changedir: + push ax cx dx si di ds es + push cs + pop es + ;cmp [si],005Ch ;'\',0 (root dir) + mov di,offset tempdir + call searchfile + jc noch + mov cx,cs:tempdir.Filegroup + mov cs:CurrentDir,cx + mov cs:EntryPlace,0 + mov cs:adressdirectory,cx + mov cs:firstsearch,1 + cmp cs:[di],' ..' + jne notback + cmp cs:[di],' .' + je theend + mov di,offset currentdirstr + mov cx,128 + mov al,0 + repne scasb + mov al,'\' + std + repne scasb + cld + inc di + mov byte ptr es:[di],0 + jmp theend +notback: + mov di,offset currentdirstr + mov cx,128 + mov al,0 + repne scasb + dec di + mov al,'\' + stosb + mov dx,di + push ds + pop es + mov di,si + mov cx,128 + mov al,0 + repne scasb + sub cx,128 + neg cx + push cs + pop es + mov di,dx + rep movsb +theend: + pop es ds di si dx cx ax + clc + ret +noch: + pop es ds di si dx cx ax + stc + ret + +tempdir db 32 dup (0) + +;=============getdir (Fonction 16)============== +;Recupere le repertoire courant a ES:DI +;-> AH=16 +;<- Flag Carry si erreur +;===================================================== +getdir: + push ax cx si di ds es + push es di + push cs + pop es + mov di,offset currentdirstr + mov cx,128 + mov al,0 + repne scasb + sub cx,128 + neg cx + pop di es + push cs + pop ds + mov si,offset currentdirstr + rep movsb + pop es ds di si cx ax + clc + ret + + +bufferread equ $ +bufferwrite equ $+2048 +bufferentry equ $+2048+2048 +bufferFat equ $+2048+2048+2048 + +end start diff --git a/noyau/drive.asm b/noyau/drive.asm deleted file mode 100755 index 798fb8e..0000000 --- a/noyau/drive.asm +++ /dev/null @@ -1,505 +0,0 @@ -.model tiny -.486 -smart -.code - -org 0100h - - -start: -jmp tsr -db 'DRIVE' -Tsr: -cli -cmp ax,1234h -jne nomore -mov ax,4321h -jmp itsok -nomore: -push bx -mov bl,ah -xor bh,bh -shl bx,1 -mov bx,cs:[bx].tables -mov cs:current,bx -pop bx -call cs:current -itsok: -jnc noerror -push bp -mov bp,sp -or byte ptr [bp+6],1b -pop bp -mov ax,cs -shl eax,16 -mov ax,cs:current -jmp endofint -noerror: -push bp -mov bp,sp -and byte ptr [bp+6],0FEh -pop bp -endofint: -sti -iret -current dw 0 -tables dw readsector - dw writesector - dw verifysector2 - dw loadfatway - dw loadfile - dw compressrle - dw decompressrle - -;cx entr‚e -> fatway chemin -getfatway: -push bx cx -mov bx,offset fatway -fatagain: -mov cs:[bx],cx -add bx,2 -cmp cx,0FFF0h -jae finishload -call getfat -jnc fatagain -finishload: -pop cx bx -ret - -;Charge le fichier de chemin cx -> taille dx -loadfatway: -push ax bx cx di -call getfatway -jc endload -mov di,offset fatway -xor dx,dx -loadagain: -mov cx,cs:[di] -cmp cx,0FFF0h -jae endload -add di,2 -mov al,1 -call readsector -jc endload -add bx,cs:sizec -add dx,cs:sizec -jmp loadagain -endload: -pop di cx bx ax -ret - - -;<-cx nøsecteur ->cx code FAT -getfat: -push es ax bx dx -push cs -pop ds -push cs -pop es -mov ax,cx -xor dx,dx -div sizec -mov cx,ax -add cx,reserv -mov bx,offset buffer -call readsector -jc errorgetfat -shl dx,1 -add bx,dx -mov cx,[bx] -errorgetfat: -pop dx bx ax es -ret - -ReadSector: -push ax cx dx si - cmp al,1 - je pr - cmp cx,cs:lastread - je done - pr: - mov cs:LastRead,cx - mov AX, CX - xor DX, DX - div cs:DiskSectorsPerTrack - mov CL, DL ;{ Set the sector } - and CL, 63 ;{ Top two bits are bits 8&9 of the cylinder } - xor DX, DX - div cs:DiskTracksPerHead - mov CH, DL ;{ Set the track bits 0-7 } - mov AL, DH - ror AL, 1 - ror AL, 1 - and AL, 11000000b - or CL, AL ;{ Set bits 8&9 of track } - xor dX, DX - div cs:DiskHeads - mov DH, DL ;{ Set the head } - inc CL - mov SI, 4 -TryAgain: - mov AL, 1 - mov DL, 0 - mov AH, 2 - int 13h - jnc Done - dec SI - jnz TryAgain - mov word ptr cs:lastread,0ffffh -Done: - pop si dx cx ax -ret - -WriteSector: -push ax cx dx si - cmp cs:Lastread,cx - jne nodestruct - mov cs:Lastread,0ffffh - nodestruct: - mov AX, CX - xor DX, DX - div cs:DiskSectorsPerTrack - mov CL, DL ;{ Set the sector } - and CL, 63 ;{ Top two bits are bits 8&9 of the cylinder } - xor DX, DX - div cs:DiskTracksPerHead - mov CH, DL ;{ Set the track bits 0-7 } - mov AL, DH - ror AL, 1 - ror AL, 1 - and AL, 11000000b - or CL, AL ;{ Set bits 8&9 of track } - xor DX, DX - div cs:DiskHeads - mov DH, DL ;{ Set the head } - inc CL - mov SI, 4 -TryAgain2: - mov AL, 1 - mov DL, 0 - mov AH, 3 - int 13h - jnc Done2 - dec SI - jnz TryAgain2 -Done2: - pop si dx cx ax -ret - -Lastread dw 0FFFFh - -Inverse: -mov si,512/4 -invert: -shl si,2 -not dword ptr [bx+si-4] -shr si,2 -dec si -jnz invert -ret - -VerifySector: -push bx cx si di ds es -push cs -pop es -push cs -pop ds -mov bx,offset buffer -call ReadSector -jc errorverify -call inverse -call WriteSector -jc errorverify -mov bx,offset buffer2 -call ReadSector -call inverse -jc errorverify -mov bx,offset buffer -call inverse -call WriteSector -jc errorverify -mov cx,512/4 -mov si,offset buffer -mov di,offset buffer2 -cld -rep cmpsd -errorverify: -pop es ds di si cx bx -ret - -VerifySector2: -call verifysector -jne nook -or byte ptr [bp+6],10b -nook: -ret - -;Charge le fichier Ds:si en es:di taille-> cx -loadfile: -push bx -call searchfile -jc errorloadfile -mov bx,di -call loadfatway -jc errorloadfile -mov cx,dx -errorloadfile: -pop bx -ret - -;Recherche le fichier et retourne sont path et en cx sont debut -Searchfile: -push ax bx dx si di ds es -push cs -pop es -xor dx,dx -mov di,offset temp -call asciiztofit -push cs -pop ds -mov cx,13 -check: -mov al,1 -mov bx,offset buffer -call readsector -jc errorboot -xor di,di -findnext: -cmp byte ptr [bx+di],0 -je errorboot -push si di cx -mov si,di -add si,bx -mov di,offset temp -mov cx,12+4 -cld -rep cmpsb -pop cx di si -je oksystem -add di,32 -inc dx -cmp dx,nbfit -ja errorboot -cmp di,sizec -jb findnext -inc cx -jmp Check -oksystem: -mov cx,[di+BX+26] -cld -jmp goodboot -errorboot: -stc -goodboot: -pop es ds di si dx bx ax -ret - -;->name ds:si ->es:di -AsciiZtoFit: -push ax bx cx dx si di ds es -xor bx,bx -mov dx,di -noextens: -mov al,[si+bx] -cmp al,'.' -je extens -call Issystchar -jc errortranslate -mov es:[di],al -inc di -inc bx -cmp bx,namesize ;(.) -jne noextens -erro: -stc -jmp errortranslate -extens: -add si,bx -inc si -sub bx,namesize -neg bx -mov al,0 -mov cx,bx -cld -rep stosb -xor bx,bx -wasextens: -mov al,[si+bx] -cmp al,0 -je endextens -call Issystchar -jc errortranslate -mov es:[di],al -inc di -inc bx -cmp bx,extsize -jne wasextens -jmp erro -endextens: -sub bx,extsize -neg bx -mov al,0 -mov cx,bx -cld -rep stosb -mov si,dx -mov di,dx -push es -pop ds -mov cx,extsize+namesize -call uppercaseMEM -clc -endtranslate: -pop es ds di si dx cx bx ax -ret -errortranslate: -stc -jmp endtranslate - -;Carry si al = caractŠre systŠme -isSystchar: -push di -mov di,offset exeptchar -isexcept: -cmp al,cs:[di] -je nogood -inc di -cmp byte ptr cs:[di],0 -jne isexcept -endanal: -clc -pop di -ret -nogood: -stc -jmp endanal - -;Transforme les x caractŠres de la mem en ds:si en maj -uppercaseMEM: -push si di cx ax -mov di,si -uppercaser: -mov al,ds:[si] -inc si -cmp al,'A' -jb nonmaj -cmp al,'Z' -ja nonmaj -add al,'a'-'A' -nonmaj: -mov es:[di],al -inc di -dec cx -jnz uppercaser -enduppercase: -clc -pop ax cx di si -ret - -;decompress ds:si en es:di taille bp d‚compress‚ cx compress‚ -DecompressRle: -push cx dx si di -mov dx,cx -mov bp,di -decompression: -mov eax,[si] -cmp al,'/' -jne nocomp -cmp si,07FFFh-6 -jae thenen -mov ecx,eax -ror ecx,16 -cmp cl,'*' -jne nocomp -cmp byte ptr [si+4],'/' -jne nocomp -mov al,ch -mov cl,ah -xor ah,ah -xor ch,ch -rep stosb -add si,5 -sub dx,5 -jnz decompression -jmp thenen -nocomp: -mov es:[di],al -inc si -inc di -dec dx -jnz decompression -thenen: -mov ax,dx -sub bp,di -neg bp -pop di si dx cx -ret - -;compress ds:si en es:di taille cx d‚compress‚ BP compress‚ -CompressRle: -push ax bx cx dx si di ds es -mov bp,di -xchg si,di -push es -push ds -pop es -pop ds -mov dx,cx -;mov bp,cx -againcomp: -mov bx,di -mov al,es:[di] -mov cx,dx -cmp ch,0 -je poo -mov cl,0ffh -;mov cx,bp -;sub cx,di -;mov ah,cl -poo: -mov ah,cl -inc di -xor ch,ch -repe scasb -sub cl,ah -neg cl -cmp cl,6 -jbe nocomp2 -mov dword ptr [si],' * /' -mov byte ptr [si+4],'/' -mov [si+1],cl -mov [si+3],al -add si,5 -dec di -xor ch,ch -sub dx,cx -jnz againcomp -jmp fini -nocomp2: -mov [si],al -inc si -inc bx -mov di,bx -dec dx -jnz againcomp -fini: -sub bp,si -neg bp -pop es ds di si dx cx bx ax -ret - -nbfit equ 255 -namesize equ 12 -extsize equ 5 -exeptchar db '/\<>:|.',01,0,0 -temp db 12+5+1+90 dup (0) -DiskSectorsPerTrack dw 18 -DiskTracksPerHead dw 80 -DiskHeads dw 2 -sizec dw 512 -reserv dw 1 -buffer equ $ -buffer2 equ $+512 -fatway equ $+512 - -end start diff --git a/noyau/font/2_hebrew.fnt b/noyau/font/2_hebrew.fnt new file mode 100644 index 0000000..9e668d6 Binary files /dev/null and b/noyau/font/2_hebrew.fnt differ diff --git a/noyau/font/8x11snsf.fnt b/noyau/font/8x11snsf.fnt new file mode 100644 index 0000000..d409f71 Binary files /dev/null and b/noyau/font/8x11snsf.fnt differ diff --git a/noyau/font/ad&d.fnt b/noyau/font/ad&d.fnt new file mode 100644 index 0000000..c8008de Binary files /dev/null and b/noyau/font/ad&d.fnt differ diff --git a/noyau/font/antique.fnt b/noyau/font/antique.fnt new file mode 100644 index 0000000..fe1aa68 Binary files /dev/null and b/noyau/font/antique.fnt differ diff --git a/noyau/font/applicat.fnt b/noyau/font/applicat.fnt new file mode 100644 index 0000000..b77b2dd Binary files /dev/null and b/noyau/font/applicat.fnt differ diff --git a/noyau/font/backward.fnt b/noyau/font/backward.fnt new file mode 100644 index 0000000..2c971a7 Binary files /dev/null and b/noyau/font/backward.fnt differ diff --git a/noyau/font/bigserif.fnt b/noyau/font/bigserif.fnt new file mode 100644 index 0000000..55a358c Binary files /dev/null and b/noyau/font/bigserif.fnt differ diff --git a/noyau/font/blcksnsf.fnt b/noyau/font/blcksnsf.fnt new file mode 100644 index 0000000..1e4e53e Binary files /dev/null and b/noyau/font/blcksnsf.fnt differ diff --git a/noyau/font/block.fnt b/noyau/font/block.fnt new file mode 100644 index 0000000..0ba23fe Binary files /dev/null and b/noyau/font/block.fnt differ diff --git a/noyau/font/bold.fnt b/noyau/font/bold.fnt new file mode 100644 index 0000000..1ccfa59 Binary files /dev/null and b/noyau/font/bold.fnt differ diff --git a/noyau/font/breeze.fnt b/noyau/font/breeze.fnt new file mode 100644 index 0000000..96ecb0d Binary files /dev/null and b/noyau/font/breeze.fnt differ diff --git a/noyau/font/broadway.fnt b/noyau/font/broadway.fnt new file mode 100644 index 0000000..0c053eb Binary files /dev/null and b/noyau/font/broadway.fnt differ diff --git a/noyau/font/comp.fnt b/noyau/font/comp.fnt new file mode 100644 index 0000000..6862665 Binary files /dev/null and b/noyau/font/comp.fnt differ diff --git a/noyau/font/computer.fnt b/noyau/font/computer.fnt new file mode 100644 index 0000000..a763ae7 Binary files /dev/null and b/noyau/font/computer.fnt differ diff --git a/noyau/font/courier.fnt b/noyau/font/courier.fnt new file mode 100644 index 0000000..dacd3a7 Binary files /dev/null and b/noyau/font/courier.fnt differ diff --git a/noyau/font/cyrillic.fnt b/noyau/font/cyrillic.fnt new file mode 100644 index 0000000..421fc97 Binary files /dev/null and b/noyau/font/cyrillic.fnt differ diff --git a/noyau/font/dblmtx14.fnt b/noyau/font/dblmtx14.fnt new file mode 100644 index 0000000..6a3a99b Binary files /dev/null and b/noyau/font/dblmtx14.fnt differ diff --git a/noyau/font/dblmtx16.fnt b/noyau/font/dblmtx16.fnt new file mode 100644 index 0000000..112e6f9 Binary files /dev/null and b/noyau/font/dblmtx16.fnt differ diff --git a/noyau/font/finnish.fnt b/noyau/font/finnish.fnt new file mode 100644 index 0000000..8da1c96 Binary files /dev/null and b/noyau/font/finnish.fnt differ diff --git a/noyau/font/font1!!!.dat b/noyau/font/font1!!!.dat new file mode 100644 index 0000000..792f46e Binary files /dev/null and b/noyau/font/font1!!!.dat differ diff --git a/noyau/font/font2!!!.dat b/noyau/font/font2!!!.dat new file mode 100644 index 0000000..ea44254 Binary files /dev/null and b/noyau/font/font2!!!.dat differ diff --git a/noyau/font/font3!!!.dat b/noyau/font/font3!!!.dat new file mode 100644 index 0000000..c07df6d Binary files /dev/null and b/noyau/font/font3!!!.dat differ diff --git a/noyau/font/font4!!!.dat b/noyau/font/font4!!!.dat new file mode 100644 index 0000000..29d8980 Binary files /dev/null and b/noyau/font/font4!!!.dat differ diff --git a/noyau/font/frankfrt.fnt b/noyau/font/frankfrt.fnt new file mode 100644 index 0000000..6123f78 Binary files /dev/null and b/noyau/font/frankfrt.fnt differ diff --git a/noyau/font/fresno.fnt b/noyau/font/fresno.fnt new file mode 100644 index 0000000..842ab5c Binary files /dev/null and b/noyau/font/fresno.fnt differ diff --git a/noyau/font/future.fnt b/noyau/font/future.fnt new file mode 100644 index 0000000..1fb73cd Binary files /dev/null and b/noyau/font/future.fnt differ diff --git a/noyau/font/greek.fnt b/noyau/font/greek.fnt new file mode 100644 index 0000000..510a288 Binary files /dev/null and b/noyau/font/greek.fnt differ diff --git a/noyau/font/hebrew.fnt b/noyau/font/hebrew.fnt new file mode 100644 index 0000000..9e668d6 Binary files /dev/null and b/noyau/font/hebrew.fnt differ diff --git a/noyau/font/hollow.fnt b/noyau/font/hollow.fnt new file mode 100644 index 0000000..0a49678 Binary files /dev/null and b/noyau/font/hollow.fnt differ diff --git a/noyau/font/hylas.fnt b/noyau/font/hylas.fnt new file mode 100644 index 0000000..fdfd940 Binary files /dev/null and b/noyau/font/hylas.fnt differ diff --git a/noyau/font/inverted.fnt b/noyau/font/inverted.fnt new file mode 100644 index 0000000..1ff13cd Binary files /dev/null and b/noyau/font/inverted.fnt differ diff --git a/noyau/font/italic.fnt b/noyau/font/italic.fnt new file mode 100644 index 0000000..2ebc096 Binary files /dev/null and b/noyau/font/italic.fnt differ diff --git a/noyau/font/italics.fnt b/noyau/font/italics.fnt new file mode 100644 index 0000000..ddb95d8 Binary files /dev/null and b/noyau/font/italics.fnt differ diff --git a/noyau/font/itt.fnt b/noyau/font/itt.fnt new file mode 100644 index 0000000..2992c0c Binary files /dev/null and b/noyau/font/itt.fnt differ diff --git a/noyau/font/lcd.fnt b/noyau/font/lcd.fnt new file mode 100644 index 0000000..aefe346 Binary files /dev/null and b/noyau/font/lcd.fnt differ diff --git a/noyau/font/mechanix.fnt b/noyau/font/mechanix.fnt new file mode 100644 index 0000000..3207764 Binary files /dev/null and b/noyau/font/mechanix.fnt differ diff --git a/noyau/font/medieval.fnt b/noyau/font/medieval.fnt new file mode 100644 index 0000000..680613a Binary files /dev/null and b/noyau/font/medieval.fnt differ diff --git a/noyau/font/modern-1.fnt b/noyau/font/modern-1.fnt new file mode 100644 index 0000000..79f69dc Binary files /dev/null and b/noyau/font/modern-1.fnt differ diff --git a/noyau/font/norway.fnt b/noyau/font/norway.fnt new file mode 100644 index 0000000..103b729 Binary files /dev/null and b/noyau/font/norway.fnt differ diff --git a/noyau/font/norway2.fnt b/noyau/font/norway2.fnt new file mode 100644 index 0000000..7c17bf6 Binary files /dev/null and b/noyau/font/norway2.fnt differ diff --git a/noyau/thin8x8.fnt b/noyau/font/old8x8.fnt old mode 100755 new mode 100644 similarity index 100% rename from noyau/thin8x8.fnt rename to noyau/font/old8x8.fnt diff --git a/noyau/font/oldeng.fnt b/noyau/font/oldeng.fnt new file mode 100644 index 0000000..14e12a6 Binary files /dev/null and b/noyau/font/oldeng.fnt differ diff --git a/noyau/font/roman.fnt b/noyau/font/roman.fnt new file mode 100644 index 0000000..f7266c1 Binary files /dev/null and b/noyau/font/roman.fnt differ diff --git a/noyau/font/sanserif.fnt b/noyau/font/sanserif.fnt new file mode 100644 index 0000000..8392323 Binary files /dev/null and b/noyau/font/sanserif.fnt differ diff --git a/noyau/font/script.fnt b/noyau/font/script.fnt new file mode 100644 index 0000000..65b073f Binary files /dev/null and b/noyau/font/script.fnt differ diff --git a/noyau/font/standard.fnt b/noyau/font/standard.fnt new file mode 100644 index 0000000..00e69f4 Binary files /dev/null and b/noyau/font/standard.fnt differ diff --git a/noyau/font/stretch.fnt b/noyau/font/stretch.fnt new file mode 100644 index 0000000..e619be7 Binary files /dev/null and b/noyau/font/stretch.fnt differ diff --git a/noyau/font/thai.fnt b/noyau/font/thai.fnt new file mode 100644 index 0000000..b275bd8 Binary files /dev/null and b/noyau/font/thai.fnt differ diff --git a/noyau/font/thin.fnt b/noyau/font/thin.fnt new file mode 100644 index 0000000..22061e5 Binary files /dev/null and b/noyau/font/thin.fnt differ diff --git a/noyau/format.asm b/noyau/format.asm new file mode 100644 index 0000000..62b8d30 --- /dev/null +++ b/noyau/format.asm @@ -0,0 +1,911 @@ +.model tiny +.486 +smart +.code + +org 0100h + +start: + jmp tsr ;Saute à la routine résidente +names db 'FORMAT' ;Nom drivers +id dw 1234h ;Identifiant drivers +Tsr: + cli ;Désactive interruptions logiciellement + cmp ax,cs:ID ;Compare si test de chargement + jne nomore ;Si pas test alors on continu + rol ax,3*4 ;Rotation de 3 chiffre de l'ID pour montrer que le drivers est chargé + jmp itsok ;On termine l'int avec notre code d'ID preuve du bon chargement de VIDEO +nomore: + cmp ah,maxfunc + jbe noerrorint + stc + jmp itsok + noerrorint: + clc + push bx + mov bl,ah ;On calcule d'aprés le n° de fonction + xor bh,bh ;quel sera l'entrée dans la table indexée + shl bx,1 ;des adresses fonctions. + mov bx,cs:[bx+tables] ;On récupère cette adresse depuis la table + mov cs:current,bx ;On la stocke temporairement pour obtenir les registres d'origine + pop bx + clc + call cs:current ;Puis on execute la fonction +itsok: + push bp + mov bp,sp ;On prend sp dans bp pour adresser la pile + jnc noerror ;La fonction appelée a renvoyer une erreur : Flag CARRY ? + or byte ptr [bp+6],1b;Si oui on le retranscrit sur le registre FLAG qui sera dépilé lors du IRET + ;xor eax,eax + ;mov ax,cs ;On récupère le segment et l'offset puis en renvoie l'adresse physique + ;shl eax,4 ;de l'erreur. + ;add ax,cs:current + ;jmp endofint ;on termine l'int +noerror: + and byte ptr [bp+6],0FEh;Si pas d'erreur on efface le Bit CARRY du FLAG qui sera dépilé lors du IRET +endofint: + pop bp + sti ;On réactive les interruptions logiciellement + iret ;Puis on retourne au programme appelant. + +current dw 0 ;Mot temporaire qui contient l'adresse de la fonction appelée +tables dw setvideomode ;Table qui contient les adresses de toutes les fonctions de VIDEO (WORD) + + +;Librairie qui prend en charge le format de STR ASCIIZ +;# nombre 8 +;@ str 7 +;& nom 6 + +;High Low +;0 variable 4 hex +;1 byte 3 dec +;2 word 2 oct +;3 3 octets 1 bin +;4 dword 5 adresse +;5 5 octets 6 nom +;6 ... 7 str + ; 8 nombre + + +;Renvoie carry si la syntaxe de ds:si n'est pas respect‚ par rapport a es:di +CheckSyntax0: + push ax bx dx bp si di ds es + push es di + push cs + pop es + mov di,offset temp2 + call copy0 + mov si,di + push cs + pop ds + pop di es + call getdelimiter0 + mov bp,dx + mov dl,' ' + call setdelimiter0 + call compressdelimiter0 + call uppercase0 + call getnbitems0 + ;call xch + ;mov ax,cx + ;call getnbitem0 + ;call xch + ;cmp ax,cx + ;call xch + ;jne notequalatall + mov bx,cx + xor cx,cx +itemer: + call whatisitem0 + mov dx,ax + call xch + call whatisitem0 + call xch + cmp ax,dx + jne prob + cmp al,6 + jb equal + call cmpitems0 + je equal +prob: + cmp dl,4 + ja nosize + cmp al,8 + je equal + cmp al,4 + jne notequalatall + cmp dh,ah + ja notequalatall + jmp equal +nosize: + cmp al,7 + jne noname + cmp ah,0 + jne notequalatall + jmp equal +noname: + cmp al,8 + je equal + jmp notequalatall +equal: + inc cx + cmp cx,bx + jne itemer + cld +ackno: + mov dx,bp + call setdelimiter0 + pop es ds di si bp dx bx ax + ret +notequalatall: + stc + jmp ackno +xch: + push ds + push es + pop ds + pop es + xchg si,di + ret + +temp2 db 256 dup (0) + +;Compare les ‚l‚ments cx de deux chaine ds:si et es:di +Cmpitems0: + push cx dx si di + push cx di + call getpointeritem0 + mov si,di + xor cx,cx + inc cx + call getpointeritem0 + mov dx,di + sub dx,si + dec cx + pop di cx + push ds si + push es + pop ds + mov si,di + call getpointeritem0 + pop si ds + mov cx,dx + rep cmpsb + pop di si dx cx + ret + + + +;Renvoie l'‚l‚ment cx de ds:si dans edx si nb et dans es:di si str ou name +gettypeditem0: + push bx cx si + call getpointeritem0 + mov si,di + xor cx,cx + inc cl + call getpointeritem0 + mov bx,di + dec bx + mov cl,0 + xchg cl,ds:[bx] + call gettyped0 + xchg cl,ds:[bx] + pop si cx bx + ret + +;Renvoie ds:si dans edx si nb et dans es:di si str ou name +gettyped0: + push ax + call whatis0 + cmp al,5 + jb number + cmp al,6 + je pointer + push ds + pop es + call getpointeritem0 + jmp endofGettypeditem0 +number: + mov edx,cs:lastnumber + jmp endofgettypeditem0 +pointer: + call str0toadress +endofgettypeditem0: + pop ax + ret + +;Renvoie dans ax le type de la str0 point‚e par ds:si ‚l‚ment cx +whatisitem0: + push bx cx si di + call getpointeritem0 + mov si,di + xor cx,cx + inc cl + call getpointeritem0 + mov bx,di + dec bx + mov cl,0 + xchg cl,ds:[bx] + call whatis0 + xchg cl,ds:[bx] + pop di si cx bx + ret + +;Renvoie dans ax le type de la str0 point‚e par ds:si +;High Low +;0 variable 4 hex +;1 byte 3 dec +;2 word 2 oct +;3 3 octets 1 bin +;4 dword 5 adresse +;5 5 octets 6 name +;6 ... 7 str +whatis0: + push bx cx edx + mov cl,2 + call str0isbase + jnc finbase + mov cl,8 + call str0isbase + jnc finbase + mov cl,10 + call str0isbase + jnc finbase + mov cl,16 + call str0isbase + jc testadress +finbase: + mov bx,cx + xor ch,ch + mov al,cs:[bx+offset basenn-2] + call str0toint + mov cs:Lastnumber,edx + cmp edx,0000FFFFh + ja bits32 + cmp dx,00FFh + ja bits16 + mov ah,1 + jmp endofwhat +bits16: + mov ah,2 + jmp endofwhat +bits32: + mov ah,3 + jmp endofwhat +testadress: + call str0isadress + jc testname + mov ax,0005h + jmp endofwhat +testname: + ;call str0isname + ;jc testvarstr + ;jnc isok + ;mov al,06h + cmp byte ptr [si],'&' + jne testvarstr + mov al,06h + call getlength0 + dec cl + mov ah,cl + jmp endofwhat +testvarstr: + cmp byte ptr [si],'@' + jne testnumber + mov al,07h + call getlength0 + dec cl + mov ah,cl + jmp endofwhat +testnumber: + cmp byte ptr [si],'#' + jne isstr + mov al,8 + call getlength0 + dec cl + mov ah,cl + jmp endofwhat +isstr: + mov al,07h + call getlength0 + mov ah,cl +endofwhat: + pop edx cx bx + ret + +Lastnumber dd 0 + +;Renvoie non carry si la str ds:si point‚e peut ˆtre une adresse +str0isadress: + ;push + stc + ;pop + ret + +;Renvoie en es:di le pointeur str0 ds:si +Str0toAdress: + ;push + stc + ;pop + ret + +;Renvoie non carry si la str ds:si point‚e peut ˆtre un nom de fichier +str0isname: + push ax si di +isname: + mov al,[si] + inc si + cmp al,0 + je itsok + mov di,offset non +verify: + mov ah,[di] + inc di + cmp ah,0FFh + je isname + cmp ah,al + jne verify + stc + jmp itsdead +itsok: + clc +itsdead: + pop di si ax + ret + +non db '/<>|"?*:\',01,0FFh + +;Renvoie non carry si le texte point‚ par si est de la base cl +str0isbase: + push ax cx si di es + push cs + pop es + mov ah,cl +isstrbase: + mov al,[si] + cmp al,0 + je okbase + mov cl,ah + xor ch,ch + mov di,cx + cmp al,es:[di-2+offset basen] + je verifbase + xor ch,ch + inc cl + mov di,offset base + cld + repne scasb + cmp cx,0 + je nobase + inc si + jmp isstrbase +okbase: + clc +endbase: + pop es di si cx ax + ret +verifbase: + cmp byte ptr [si+1],0 + je okbase +nobase: + stc + jmp endbase + +temp dw 0 + +;Converti un str de base cl en int dans edx +str0toint: + push eax bx ecx si edi ebp es + push cs + pop es + mov ah,cl + mov cs:temp,si +gotos: + cmp byte ptr [si+1], 0 + je oklo + inc si + jmp gotos +oklo: + mov edi,1 + xor ebp,ebp + mov bl,cl +baseto: + cmp si,cs:temp + jb endbaseto + mov al,[si] + xor ecx,ecx + mov cl,bl + inc cl + push di + mov di,offset base + cld + repne scasb + pop di + jne noop + sub cl,bl + neg cl + mov eax,edi + mul ecx + add ebp,eax + mov eax,edi + mov cl,bl + mul ecx + mov edi,eax +noop: + dec si + jmp baseto +endbaseto: + mov edx,ebp + pop es ebp edi si ecx bx eax +ret +base db '0123456789ABCDEF' +basen db 'B O D H' +basenn db 1,0,0,0,0,0,2,0,3,0,0,0,0,0,4 + +;Renvoie en es:di la partie de cx caractŠres a partir de la gauche de ds:si +Left0: + push ax cx si di + cld + rep movsb + mov al,0 + stosb + pop di si cx ax + ret + +;Renvoie en es:di la partie de cx caractŠres a partir de la droite de ds:si +Right0: + push ax cx dx si di + mov dx,cx + call getlength0 + add si,cx + sub si,dx + mov cx,dx + cld + rep movsb + mov al,0 + stosb + pop di si dx cx ax + ret + +;Renvoie en es:di la partie de cx caractŠres a partir de la position bx de ds:si +middle0: + push ax cx si di + add si,bx + cld + rep movsb + mov al,0 + stosb + pop di si cx ax + ret + +;Rempli de cx caractŠres dl a partir de la position bx de ds:si +Fill0: + push ax bx cx si di es + push ds + pop es + add si,bx + mov al,dl + mov di,si + cld + rep stosb + pop es di si cx bx ax + ret + +;Remplace tout les caractŠres al de ds:si par des caractŠres dl +ReplaceAllchar0: + push ax cx di es + call GetLength0 + push ds + pop es + mov di,si +findandchange: + repne scasb + cmp cx,0 + je endofchange + mov es:[di-1],dl + jmp findandchange +endofchange: + pop es di cx ax + ret + + +;Recherche un caractŠre dl dans la chaŒne ds:si +SearchChar0: + push ax cx di es + call GetLength0 + push ds + pop es + mov di,si + mov al,dl + repne scasb + pop es di cx ax + ret + +;Inverse la chaine point‚e en ds:si +invert0: + push ax cx si di es + call GetLength0 + push ds + pop es + mov di,si + add di,cx + dec di +revert: + mov al,[si] + xchg al,es:[di] + mov [si],al + inc si + dec di + cmp si,di + je finishinvert + dec di + cmp si,di + je finishinvert + inc di + jmp revert +finishinvert: + pop es di si cx ax + ret + +;Compares 2 chaines de caractŠres DS:SI et ES:DI zerof si non equal +cmpstr0: + push cx dx si di + call GetLength0 + mov dx,cx + push ds si + push es + pop ds + mov si,di + call GetLength0 + pop si ds + cmp cx,dx + jne NotEqual + repe cmpsb +NotEqual: + pop di si dx cx + ret + +;Compares 2 chaines de caractŠres DS:SI et ES:DI zerof si non equal et renvoie le nb de caractŠre egaux dans dx +evalue0: + push cx si di + push ds si + push es + pop ds + mov si,di + call GetLength0 + pop si ds + mov dx,cx + repe cmpsb + pushf + sub dx,cx + popf + pop di si cx + ret + + +;Insert une chaine ds:si en es:di a partir du caractŠre cx +insert0: + push cx di si + add di,cx + call getlength0 + push si di ds + push es + pop ds + mov si,di + add di,cx + call copy20 + pop ds di si + cld + inc di + rep movsb + pop si di cx + ret + +;Detruit CX caractŠres a partir du caractŠre BX de DS:SI +delete0: + push cx dx si di es + push ds + pop es + mov dx,cx + call getlength0 + sub cx,dx + sub cx,bx + inc cx + add si,bx + mov di,si + add si,dx + cld + rep movsb + pop es di si dx cx + ret + +;Copie une chaine de ds:si en es:di +Copy0: + push ax cx si di + call GetLength0 + cld + rep movsb + mov al,0 + stosb + pop di si cx ax + ret + +;Copie une chaine de ds:si en es:di +Copy20: + push ax cx si di + call GetLength0 + cld + add si,cx + add di,cx + inc cx + std + rep movsb + pop di si cx ax + ret + +;ConcatŠne le chaine ds:si avec es:di +Concat0: + push ax cx dx si di + call GetLength0 + mov dx,cx + xchg si,di + push ds + push es + pop ds + call GetLength0 + pop ds + xchg si,di + add di,cx + mov cx,dx + cld + rep movsb + mov al,0 + stosb + pop di si dx cx ax + ret + +;Met DL comme d‚limiteur par d‚faut +SetDelimiter0: + mov cs:delim,dl + ret + +;Renvoie le d‚limiteur par d‚faut dans dl +GetDelimiter0: + mov dl,cs:delim + ret +delim db 0 + +;D‚truit les d‚limiteur qui sont cons‚cutifs dans ds:si +CompressDelimiter0: + push ax dx si di es + call Getlength0 + push ds + pop es + mov di,si + mov al,cs:delim + xor dx,dx +Compressitems: + repne scasb + inc dx +againcomp: + cmp [di],al + jne nosup + mov si,di + mov bx,0 + push cx + mov cx,1 + call delete0 + pop cx + jmp againcomp +nosup: + cmp cx,0 + jne compressitems + mov cx,dx + pop es di si dx ax + ret + +;Met le nombre d'‚l‚ments … cx +Setnbitems0: + push ax cx dx di es + mov dx,cx + call Getnbitems0 + cmp cx,dx + je noadjust + ja subsome + push ds + pop es + mov di,si + sub cx,dx + neg cx + push cx + call getlength0 + add di,cx + pop cx + mov al,cs:delim + mov ah,'a' + rep stosw + mov al,0 + stosb + jmp noadjust +subsome: + mov cx,dx + call GetPointeritem0 + dec di + mov byte ptr [di],0 +noadjust: + pop es di dx cx + ret + +;Renvoie la taille dx de l'‚l‚ment cx +Getitemsize: + push cx di + call getpointeritem0 + mov dx,di + inc cx + call getpointeritem0 + sub dx,di + neg dx + dec dx + pop di cx + ret + +;Renvoie en es:di l'‚l‚ment cx de ds:si +Getitem0: + push si di cx ax + push di + call getPointeritem0 + call getitemsize + mov si,di + pop di + mov cx,dx + rep movsb + mov al,0 + stosb + pop ax cx di si + ret + +;renvoi un pointeur di sur l'‚l‚ment cx de ds:si +GetPointeritem0: + push ax bx cx dx es + mov bx,cx + call Getlength0 + push ds + pop es + mov di,si + mov al,cs:delim + xor dx,dx +Countnbitems: + cmp bx,dx + je finishpointer + repne scasb + inc dx + cmp cx,0 + jne countnbitems + inc di +finishpointer: + pop es dx cx bx ax + ret + +;Renvoie le nombre d'‚l‚ments cx de ds:si +GetNbitems0: + push ax dx di es + call Getlength0 + push ds + pop es + mov di,si + mov al,cs:delim + xor dx,dx +Countitems: + repne scasb + inc dx + cmp cx,0 + jne countitems + mov cx,dx + pop es di dx ax + ret + +;renvoie la taille en octets CX de la chaine point‚e en ds:si +GetLength0: + push ax di es + push ds + pop es + mov di,si + mov al,0 + mov cx,0FFFFh + cld + repne scasb + neg cx + dec cx + dec cx + pop es di ax + ret + +;Met la taille en octets de la chaine point‚e ds:si a CX +SetLength0: + push bx + mov bx,cx + mov byte ptr [si+bx],0 + pop bx + ret + +;met en majuscule la chaine ds:si +UpperCase0: + push si ax +UpperCase: + mov al,ds:[si] + inc si + cmp al,0 + je EndUpperCase + cmp al,'a' + jb UpperCase + cmp al,'z' + ja UpperCase + sub byte ptr [si-1],'a'-'A' + jmp UpperCase +EndUpperCase: + clc + pop ax si + ret + +;met en majuscule la premiŠre lettre chaine ds:si +OneCase0: + push ax +OneUpperCase: + mov al,ds:[si] + cmp al,'a' + jb OneEndUpperCase + cmp al,'z' + ja OneEndUpperCase + sub byte ptr [si],'a'-'A' +OneEndUpperCase: + clc + pop ax + ret + +;met en minuscule la chaine ds:si +LowerCase0: + push si ax +LowerCase: + mov al,ds:[si] + inc si + cmp al,0 + je EndLowerCase + cmp al,'A' + jb LowerCase + cmp al,'Z' + ja LowerCase + add byte ptr [si-1],'a'-'A' + jmp LowerCase +EndLowerCase: + clc + pop ax si + ret + +;Inverse la casse la chaine ds:si +InvertCase0: + push si ax +InvertCase: + mov al,ds:[si] + inc si + cmp al,0 + je EndInvertCase + cmp al,'A' + jb InvertCase + cmp al,'Z' + jbe GoInvertCase + cmp al,'a' + jb InvertCase + cmp al,'z' + ja InvertCase + sub byte ptr [si-1],'a'-'A' + jmp InvertCase +GoInvertCase: + add byte ptr [si-1],'a'-'A' + jmp InvertCase +EndInvertCase: + clc + pop ax si + ret + +end start diff --git a/noyau/hours.asm b/noyau/heure.asm old mode 100755 new mode 100644 similarity index 94% rename from noyau/hours.asm rename to noyau/heure.asm index b3daa5e..f4c547e --- a/noyau/hours.asm +++ b/noyau/heure.asm @@ -1,81 +1,81 @@ -.model tiny -.486 -smart -.code - -org 0100h - -start: - -jmp tsr -offsets dd 0 -db 'HOURS' -tsr: - pushf - db 2eh,0ffh,1eh - dw offsets - cli - pusha - push ds es - push cs - push cs - pop ds - pop es - mov ah,22h - mov di,offset infos - int 47h - mov bl,[infos+1] - xor bh,bh - sub bl,8 - mov di,bx - shl di,1 - mov dx,71h - xor eax,eax - mov cx,0B800h - mov es,cx - mov cl,4 - mov bp,8 -show: - dec dx - mov al,cl - out dx,al - inc dx - in al,dx - call showbcd - cmp cl,0 - je finic - mov byte ptr es:[di],':' - add di,2 - sub cl,2 - jmp show -finic: - pop es ds - popa - sti - iret - - -;==============================Affiche le nombre nb hexa en EDX============== -Showbcd: - push ax bx cx edx - mov edx,eax - mov cx,bp - sub cx,32 - neg cx - shl edx,cl - mov ax,bp - shr ax,2 -bcdaize: - rol edx,4 - mov bx,dx - and bx,0fh - add bl,'0' - mov es:[di],bl - add di,2 - dec al - jnz bcdaize - pop edx cx bx ax - ret -infos db 40 dup (0) - -end start +.model tiny +.486 +smart +.code + +org 0100h + +start: + +jmp tsr +offsets dd 0 +db 'HOURS' +tsr: + pushf + db 2eh,0ffh,1eh + dw offsets + cli + pusha + push ds es + push cs + push cs + pop ds + pop es + mov ah,22h + mov di,offset infos + int 47h + mov bl,[infos+1] + xor bh,bh + sub bl,8 + mov di,bx + shl di,1 + mov dx,71h + xor eax,eax + mov cx,0B800h + mov es,cx + mov cl,4 + mov bp,8 +show: + dec dx + mov al,cl + out dx,al + inc dx + in al,dx + call showbcd + cmp cl,0 + je finic + mov byte ptr es:[di],':' + add di,2 + sub cl,2 + jmp show +finic: + pop es ds + popa + sti + iret + + +;==============================Affiche le nombre nb hexa en EDX============== +Showbcd: + push ax bx cx edx + mov edx,eax + mov cx,bp + sub cx,32 + neg cx + shl edx,cl + mov ax,bp + shr ax,2 +bcdaize: + rol edx,4 + mov bx,dx + and bx,0fh + add bl,'0' + mov es:[di],bl + add di,2 + dec al + jnz bcdaize + pop edx cx bx ax + ret +infos db 40 dup (0) + +end start diff --git a/noyau/timer.asm b/noyau/horloge.asm old mode 100755 new mode 100644 similarity index 93% rename from noyau/timer.asm rename to noyau/horloge.asm index d631dd7..8ff0505 --- a/noyau/timer.asm +++ b/noyau/horloge.asm @@ -1,32 +1,32 @@ -.model tiny -.486 -smart -.code - -org 0100h - -start: - -jmp tsr -offsets dd 0 -db 'TIMER' -tsr: - pushf - db 2eh,0ffh,1eh - dw offsets - cli - push ax bx es - mov bx,cs:compteur - inc bx - and bx,11b - mov cs:compteur,bx - mov bx,cs:[offset fig+bx] - mov ax,0B800h - mov es,ax - mov es:[0],bl - pop es bx ax - sti - iret -compteur dw 0 -fig db 'Ä\³/' -end start +.model tiny +.486 +smart +.code + +org 0100h + +start: + +jmp tsr +offsets dd 0 +db 'TIMER' +tsr: + pushf + db 2eh,0ffh,1eh + dw offsets + cli + push ax bx es + mov bx,cs:compteur + inc bx + and bx,11b + mov cs:compteur,bx + mov bx,cs:[offset fig+bx] + mov ax,0B800h + mov es,ax + mov es:[0],bl + pop es bx ax + sti + iret +compteur dw 0 +fig db 'Ä\³/' +end start diff --git a/noyau/joystick.asm b/noyau/manette.asm old mode 100755 new mode 100644 similarity index 94% rename from noyau/joystick.asm rename to noyau/manette.asm index 9d96bd2..fe5c6ef --- a/noyau/joystick.asm +++ b/noyau/manette.asm @@ -1,298 +1,298 @@ -.model tiny -.486 -smart -.code -org 0100h -start: -jmp tsr -drv db 'JOYSTICK',0 -Tsr: -cli -cmp ax,1234h -jne nomore -mov ax,4321h -jmp itsok -nomore: -push bx -cmp byte ptr cs:isact,1 -je nottest -mov cs:isact,1 -jmp react -mov bl,ah -xor bh,bh -shl bx,1 -mov bx,cs:[bx].tables -mov cs:current,bx -pop bx -call cs:current -itsok: -jnc noerror -push bp -mov bp,sp -or byte ptr [bp+6],1b -pop bp -mov ax,cs -shl eax,16 -mov ax,cs:current -jmp endofint -noerror: -push bp -mov bp,sp -and byte ptr [bp+6],0FEh -pop bp -endofint: -mov cs:isact,0 -sti -iret -nottest: -pop bx -jmp endofint -current dw 0 -tables dw 0;detectjoystick - ;dw getjoystick - ;dw getjoystickscreen - ;dw configjoystick -isact db 0 - -;envoie en bx,cx les coordonn‚es et en dl les boutons -getjoystick: -push ax cx -mov bx,cs:rx -mov cx,cs:ry -mov al,cs:button -not al -mov cl,4 -shr al,cl -mov dl,al -pop cx ax -ret - -;envoie en di les coordonn‚es ecran et en dl les boutons -getjoystickscreen: -push ax cx -mov di,cs:xy -mov al,cs:button -not al -mov cl,4 -shr al,cl -mov dl,al -pop cx ax -ret -db 'button' -Button db 0 -db 'rx' -rx dw 0 -db 'ry' -ry dw 0 -db 'vx' -VX db 0 -db 'vy' -VY db 0 -db 'x' -X dw 7FFFh -db 'y' -Y dw 7FFFh -speed db 6 -spherex db 0 -spherey db 0 -db 'count' -count db 0 -db 'error' -error db 0 -xy dw 0 -old db 0 - -calibrate db 0 -db 'ticks' -ticks dw 0 -db 'state' -state db 0 -db 'connard' -connard db 1 -connard2 db 1 -;Gestionnaire de joystick -react: - push ax bx cx dx si di bp ds es - push cs - pop ds - mov dx,201h - cmp error, 1 - je gest1 - cmp count,1 - je gest1 - cmp count,2 - je gest2 -gest1: - mov error,0 - mov count,2 - call getticks - mov ticks,ax - out dx,al - in al,dx - and al,00000011b - mov state,al - jmp endgest -gest2: -not connard - call getticks - sub ax,ticks - cmp ax,1FF0h - jb nofinish - mov error,1 - jmp endgest -nofinish: - mov bx,ax - in al,dx - and al,00000011b - cmp state,al - je endgest - xchg state,al - xor al,state - mov cl,4 - or bx,bx - js noadj - shr bx,cl -noadj: - test al,1 - je isy - mov VX,bl - jmp wasx -isy: - test al,2 - je endgest - mov VY,bl -wasx: -mov connard2,0fh - mov count,1 -endgest: - in al,dx - not al - mov cl,4 - shr al,cl - mov button,al - push cs - pop es - mov di,offset infos - mov ah,34 - int 47h - mov cl,speed - movsx bx,VY - shl bx,cl - cmp spherey,0 - jne nolimity - xor ah,ah - mov al,[di] - cmp byte ptr [di+7],4 - jbe text4 - shl ax,3 -text4: - dec ax - cmp bx,0 - jg decy - cmp ry,ax - jae noaddy - jmp nolimity -decy: - cmp ry,0 - je noaddy -nolimity: - sub y,bx -noaddy: - movsx bx,VX - shl bx,cl - cmp spherex,0 - jne nolimitx - xor ah,ah - mov al,[di+1] - cmp byte ptr [di+7],4 - jbe text5 - shl ax,3 -text5: - dec ax - cmp bx,0 - jl decx - cmp rx,ax - jae noaddx - jmp nolimitx -decx: - cmp rx,0 - je noaddx -nolimitx: - add x,bx -noaddx: - mov ax,x - mov bx,0FFFFh - xor ch,ch - mov cl,[di+1] - cmp byte ptr [di+7],4 - jbe text1 - shl cx,3 -text1: - mul cx - div bx - mov rx,ax - mov ax,y - xor ch,ch - mov cl,[di] - cmp byte ptr [di+7],4 - jbe text2 - shl cx,3 -text2: - mul cx - div bx - mov ry,ax - xor ch,ch - mov cl,[di+1] - cmp byte ptr [di+7],4 - jbe text3 - shl cx,3 -text3: - mul cx - add ax,rx - cmp byte ptr [di+7],4 - mov di,ax - jbe textpoint - mov ax,0A000h - mov es,ax - jmp graphpoint -textpoint: - mov ax,0B800h - mov es,ax - shl di,1 - inc di -graphpoint: - mov bx,xy - cmp byte ptr es:[bx],070h - jne waschanged - mov al,old - mov byte ptr es:[bx],al -waschanged: - mov xy,di - mov al,es:[di] - mov old,al - mov byte ptr es:[di],070h - mov al, 20h - out 0a0h, al - out 20h, al -errormouse: - pop es ds bp di si dx cx bx ax - mov cs:isact,0 - pop bx - iret - infos db 40 dup (0) - - -getticks: -mov al,0 -out 43h,al -jmp wait1 -wait1: -in al,40h -mov ah,al -jmp wait2 -wait2: -in al,40h -xchg ah,al -ret - -end start +.model tiny +.486 +smart +.code +org 0100h +start: +jmp tsr +drv db 'JOYSTICK',0 +Tsr: +cli +cmp ax,1234h +jne nomore +mov ax,4321h +jmp itsok +nomore: +push bx +cmp byte ptr cs:isact,1 +je nottest +mov cs:isact,1 +jmp react +mov bl,ah +xor bh,bh +shl bx,1 +mov bx,cs:[bx].tables +mov cs:current,bx +pop bx +call cs:current +itsok: +jnc noerror +push bp +mov bp,sp +or byte ptr [bp+6],1b +pop bp +mov ax,cs +shl eax,16 +mov ax,cs:current +jmp endofint +noerror: +push bp +mov bp,sp +and byte ptr [bp+6],0FEh +pop bp +endofint: +mov cs:isact,0 +sti +iret +nottest: +pop bx +jmp endofint +current dw 0 +tables dw 0;detectjoystick + ;dw getjoystick + ;dw getjoystickscreen + ;dw configjoystick +isact db 0 + +;envoie en bx,cx les coordonn‚es et en dl les boutons +getjoystick: +push ax cx +mov bx,cs:rx +mov cx,cs:ry +mov al,cs:button +not al +mov cl,4 +shr al,cl +mov dl,al +pop cx ax +ret + +;envoie en di les coordonn‚es ecran et en dl les boutons +getjoystickscreen: +push ax cx +mov di,cs:xy +mov al,cs:button +not al +mov cl,4 +shr al,cl +mov dl,al +pop cx ax +ret +db 'button' +Button db 0 +db 'rx' +rx dw 0 +db 'ry' +ry dw 0 +db 'vx' +VX db 0 +db 'vy' +VY db 0 +db 'x' +X dw 7FFFh +db 'y' +Y dw 7FFFh +speed db 6 +spherex db 0 +spherey db 0 +db 'count' +count db 0 +db 'error' +error db 0 +xy dw 0 +old db 0 + +calibrate db 0 +db 'ticks' +ticks dw 0 +db 'state' +state db 0 +db 'connard' +connard db 1 +connard2 db 1 +;Gestionnaire de joystick +react: + push ax bx cx dx si di bp ds es + push cs + pop ds + mov dx,201h + cmp error, 1 + je gest1 + cmp count,1 + je gest1 + cmp count,2 + je gest2 +gest1: + mov error,0 + mov count,2 + call getticks + mov ticks,ax + out dx,al + in al,dx + and al,00000011b + mov state,al + jmp endgest +gest2: +not connard + call getticks + sub ax,ticks + cmp ax,1FF0h + jb nofinish + mov error,1 + jmp endgest +nofinish: + mov bx,ax + in al,dx + and al,00000011b + cmp state,al + je endgest + xchg state,al + xor al,state + mov cl,4 + or bx,bx + js noadj + shr bx,cl +noadj: + test al,1 + je isy + mov VX,bl + jmp wasx +isy: + test al,2 + je endgest + mov VY,bl +wasx: +mov connard2,0fh + mov count,1 +endgest: + in al,dx + not al + mov cl,4 + shr al,cl + mov button,al + push cs + pop es + mov di,offset infos + mov ah,34 + int 47h + mov cl,speed + movsx bx,VY + shl bx,cl + cmp spherey,0 + jne nolimity + xor ah,ah + mov al,[di] + cmp byte ptr [di+7],4 + jbe text4 + shl ax,3 +text4: + dec ax + cmp bx,0 + jg decy + cmp ry,ax + jae noaddy + jmp nolimity +decy: + cmp ry,0 + je noaddy +nolimity: + sub y,bx +noaddy: + movsx bx,VX + shl bx,cl + cmp spherex,0 + jne nolimitx + xor ah,ah + mov al,[di+1] + cmp byte ptr [di+7],4 + jbe text5 + shl ax,3 +text5: + dec ax + cmp bx,0 + jl decx + cmp rx,ax + jae noaddx + jmp nolimitx +decx: + cmp rx,0 + je noaddx +nolimitx: + add x,bx +noaddx: + mov ax,x + mov bx,0FFFFh + xor ch,ch + mov cl,[di+1] + cmp byte ptr [di+7],4 + jbe text1 + shl cx,3 +text1: + mul cx + div bx + mov rx,ax + mov ax,y + xor ch,ch + mov cl,[di] + cmp byte ptr [di+7],4 + jbe text2 + shl cx,3 +text2: + mul cx + div bx + mov ry,ax + xor ch,ch + mov cl,[di+1] + cmp byte ptr [di+7],4 + jbe text3 + shl cx,3 +text3: + mul cx + add ax,rx + cmp byte ptr [di+7],4 + mov di,ax + jbe textpoint + mov ax,0A000h + mov es,ax + jmp graphpoint +textpoint: + mov ax,0B800h + mov es,ax + shl di,1 + inc di +graphpoint: + mov bx,xy + cmp byte ptr es:[bx],070h + jne waschanged + mov al,old + mov byte ptr es:[bx],al +waschanged: + mov xy,di + mov al,es:[di] + mov old,al + mov byte ptr es:[di],070h + mov al, 20h + out 0a0h, al + out 20h, al +errormouse: + pop es ds bp di si dx cx bx ax + mov cs:isact,0 + pop bx + iret + infos db 40 dup (0) + + +getticks: +mov al,0 +out 43h,al +jmp wait1 +wait1: +in al,40h +mov ah,al +jmp wait2 +wait2: +in al,40h +xchg ah,al +ret + +end start diff --git a/noyau/mcb.asm b/noyau/mcb.asm new file mode 100644 index 0000000..22dac0d --- /dev/null +++ b/noyau/mcb.asm @@ -0,0 +1,119 @@ +FirstMB dw 0 + +;Initialise les blocs de mémoire +MBinit: + push ax cx es + mov ax,gs + mov cs:Firstmb,ax + dec ax + mov es,ax + mov cx,0A000h + sub cx,ax + dec cx + mov es:[MB.Reference],Free + mov es:[MB.Sizes],cx + mov es:[MB.Check],'NH' + mov es:[MB.IsNotLast],False + clc + pop es cx ax + ret +notforfree: + stc + pop es cx ax + ret + +;Libère le bloc de mémoire GS +MBFree: + push bx es + mov bx,gs + dec bx + mov es,bx + cmp es:[MB.Check],'NH' + je notforfree + mov es:[MB.IsResident],0 + mov es:[MB.Reference],Free + mov dword ptr es:[MB.Names],'eerF' + mov dword ptr es:[MB.Names+4],0 + pop es bx + ret + +;Creér un bloc de nom ds:si de taille cx (octets) -> n°segement dans GS +MBCreate: + push ax bx cx dx si di es + shr cx,4 + inc cx + mov bx,cs:firstmb + dec bx +searchfree: + mov es,bx + cmp es:[MB.Check],'NH' + jne wasntgood + cmp es:[MB.IsNotLast],True + sete dl + cmp es:[MB.Reference],Free + je weregood + cmp dl,False + je wasntgood +notsogood: + inc bx + add bx,es:[MB.Sizes] + jmp searchfree +weregood: + mov ax,es:[MB.Sizes] + cmp cx,ax + ja notsogood + mov es:[MB.IsNotLast],True + mov es:[MB.Reference],cs + mov es:[MB.IsResident],False + mov es:[MB.Sizes],cx + mov di,MB.Names + push ax cx + mov cx,8 +loops: + mov dh,[si] + inc si + dec cx + jz endofloops + cmp dh,0 + je endofloops + mov es:[di],dh + inc di + jmp loops +endofloops: + inc cx + mov al,0 + rep stosb + pop cx ax + mov word ptr es:[MB.Check],'NH' + sub ax,cx + dec ax + js nofree + inc bx + mov gs,bx + add bx,cx + mov es,bx + mov es:[MB.IsNotLast],dl + mov es:[MB.IsResident],False + mov es:[MB.Reference],Free + mov es:[MB.Sizes],ax + mov dword ptr es:[MB.Names],'eerF' + mov dword ptr es:[MB.Names+4],0 + mov es:[MB.Check],'NH' +nofree: + clc + pop es di si dx cx bx ax + ret +wasntgood: + stc + pop es di si dx cx bx ax + ret + +;Rend le segment GS résident +MBresident: + push bx es + mov bx,gs + dec bx + mov es,bx + mov es:[MB.IsResident],True + pop es bx + ret diff --git a/noyau/old8x8.fnt b/noyau/old8x8.fnt deleted file mode 100755 index 9fd96cd..0000000 Binary files a/noyau/old8x8.fnt and /dev/null differ diff --git a/noyau/lpt.asm b/noyau/port.asm old mode 100755 new mode 100644 similarity index 92% rename from noyau/lpt.asm rename to noyau/port.asm index 3ab87ec..2e185f7 --- a/noyau/lpt.asm +++ b/noyau/port.asm @@ -1,699 +1,699 @@ -.model tiny -.486 -smart -.code -org 0100h -start: -jmp tsr -drv db 'LPT ',0 -Tsr: -cli -cmp ax,1234h -jne nomore -mov ax,4321h -jmp itsok -nomore: -push bx ax -mov ah,4 -mov bh,1 -int 50h -mov bl,al -pop ax -cmp byte ptr cs:isact,1 -je nottest -mov cs:isact,1 -cmp bl,80h -jae react -mov bl,ah -xor bh,bh -shl bx,1 -mov bx,cs:[bx].tables -mov cs:current,bx -pop bx -call cs:current -itsok: -jnc noerror -push bp -mov bp,sp -or byte ptr [bp+6],1b -pop bp -mov ax,cs -shl eax,16 -mov ax,cs:current -jmp endofint -noerror: -push bp -mov bp,sp -and byte ptr [bp+6],0FEh -pop bp -endofint: -mov cs:isact,0 -sti -iret -nottest: -pop bx -jmp endofint -current dw 0 -tables dw getlptin - dw getlptout - dw getlptinout - dw setlptin - dw setlptout - dw setlptinout - dw getlpt - dw getfirstlpt - dw setemettor - dw setreceptor - dw settimeout - dw gettimeout - dw receivelpt - dw sendlpt - dw receivelptblock - dw sendlptblock - dw receivecommand - dw sendcommand - -react: -push ds es -mov cs:isact,1 -pushad -push cs -pop ds -push cs -pop es -cmp byte ptr never,1 -je oknever -mov bl,[drv+3] -sub bl,'0' -xor bh,bh -call getlpt -dec bl -shl bl,1 -mov al,7 -sub al,bl -mov ah,40 -mov di,offset video -int 47h -push ax -mov ah,01h -int 50h -mov ah,21 -mov cl,4 -int 47h -sti -mov al,0111b -call setlptout -call setreceptor -call initlpt -jc errorie -mov cx,0 -mov ah,20 -mov bx,1012h -mov si,offset initok -int 47h -cmp byte ptr always,1 -je yes -mov ah,20 -mov bx,1010h -mov si,offset mdd -int 47h -mov ah,13 -mov si,offset drv -int 47h -mov ah,6 -int 47h -mov ah,20 -mov bx,1011h -mov si,offset msg -int 47h -waitkey: -mov ax,0 -int 16h -cmp al,'n' -je no -cmp al,'N' -je no -cmp al,'Y' -je yes -cmp al,'y' -je yes -cmp al,'e' -je nev -cmp al,'E' -je nev -cmp al,'a' -je alw -cmp al,'A' -je alw -jmp waitkey -yes: -call receivecommand -jc errortimeout -no: -mov al,0111b -call setlptout -cli -mov ah,41 -mov si,offset video -int 47h -pop ax -mov ah,00h -int 50h -mov ah,09h -int 50h -oknever: -popad -pop es ds -mov cs:isact,0 -pop bx -jmp endofint -errorie: -mov si,offset inits -jmp show -errortimeout: -mov si,offset timeouts -show: -mov ah,20 -mov bx,1012h -int 47h -mov ax,0 -int 16h -jmp no -nev: -mov byte ptr never,1 -jmp no -alw: -mov byte ptr always,1 -jmp yes -initok db 'Initialisation is realised !',0 -inits db 'Error on initialisation',0 -timeouts db 'Connection lost or timeout complete !!',0 -mdd db 'Connection demand on ',0 -msg db 'Accept connection ? (Y)es (N)o n(E)ver (A)lways',0 -isact db 0 -always db 0 -never db 0 - -;envois une commande al -sendcommand: -push ax bx cx di -mov bl,al -xor bh,bh -shl bx,1 -add bx,offset cmde -call cs:[bx] -pop di cx bx ax -ret -cmde dw nothing - dw getram - -;recupŠre la ram en ds:si de cx distant caractŠres en es:di local -getram: -push ax bx cx ds -mov bx,offset command -mov cs:[bx+2],ds -mov cs:[bx],si -mov cs:[bx+4],cx -push cs -pop ds -mov si,bx -mov cx,6 -call sendlptblock -jc endofget -call receivelptblock -endofget: -pop ds cx bx ax -ret - -;Re‡ois une commande et l'execute -Receivecommand: -push ax bx cx di ds es -push cs -pop es -push cs -pop ds -mov di,offset command -call receivelptblock -jc endofno -mov bl,al -xor bh,bh -shl bx,1 -add bx,offset cmd -call cs:[bx] -clc -endofno: -pop es ds di cx bx ax -ret - -command db 25 dup (0) -cmd dw nothings - dw sendram - dw receiveram - dw sendreg - dw receivereg - dw sendport - dw receiveport - dw letexecute -nothings: -ret - -letexecute: -push ds es fs gs -pushad -push cs -push offset suite -mov ax,es:[di+2] -mov ds,ax -mov es,ax -mov fs,ax -mov gs,ax -push ax -mov ax,es:[di] -push ax -DB 0CBh -suite: -popad -pop gs fs es ds -ret - -Sendram: -push ax cx si ds -mov si,es:[di] -mov ax,es:[di+2] -mov ds,ax -mov cx,es:[di+4] -call sendlptblock -pop ds si cx ax -ret - -receiveram: -sendreg: -receivereg: - -sendport: -push ax cx dx si -mov dx,es:[di] -in ax,dx -mov cx,2 -mov si,offset tempblock -mov ds:[si],ax -call sendlptblock -pop si dx cx ax -ret - -receiveport: -push ax dx -mov dx,es:[di] -mov ax,es:[di+2] -out dx,ax -pop dx ax -ret - -tempblock db 25 dup (0) - -;---------Segment Adress----------- -Bios equ 040h -;---------Offset Adress------------ -Lptadr equ 008h -Timer equ 06Ch -;---------Constant----------------- -onesec equ 18 -tensec equ 182 -Ack equ 00 -Nack equ 0FFh -maxtry equ 10 - -Initlpt: -push ax ecx -call StartTimer -cmp cs:emettor,0 -je receptinit -mov al,10000b -call SetLptOut -waitinit1: -call EndTimer -cmp cx,cs:timeout -ja errorinit -call getlptIn -cmp al,00000b -jnz waitinit1 -jmp endinit -receptinit: -call EndTimer -cmp cx,cs:timeout -ja errorinit -call getlptIn -cmp al,00000b -jnz receptinit -mov al,10000b -call SetLptOut -endinit: -clc -pop ecx ax -ret -errorinit: -stc -pop ecx ax -ret - - -;-Envoie DL (dh) JNE si problŠme JNC error timeout -Sendlpt: -push ax bx ecx -call StartTimer -mov dh,dl -mov al,dl -and al,0Fh -call SetLptOut -waitSend: -call EndTimer -cmp cx,cs:timeout -ja errorsend -call getlptIn -bt ax,4 -jnc waitsend -and al,0Fh -mov bl,al -call StartTimer ;///// -mov al,dh -shr al,4 -or al,10000b -call SetLptOut -waitSend2: -call EndTimer -cmp cx,cs:timeout -ja errorsend -call getlptIn -bt ax,4 -jc waitsend2 -and al,0Fh -shl al,4 -add bl,al -cmp dl,bl -pop ecx bx ax -clc -ret -errorsend: -pop ecx bx ax -stc -ret - - -;-Re‡ois DL (dh) -Receivelpt: -push ax bx ecx -call StartTimer -waitreceive: -call EndTimer -cmp cx,cs:timeout -ja errorreceive -call getlptIn -bt ax,4 -jnc waitreceive -and al,0Fh -mov dl,al -call SetLptOut -call StartTimer ;///// -waitreceive2: -call EndTimer -cmp cx,cs:timeout -ja errorreceive -call getlptIn -bt ax,4 -jc waitreceive2 -and al,0Fh -mov dh,al -shl dh,4 -add dl,dh -or al,10000b -call SetlptOut -clc -pop ecx bx ax -ret -errorreceive: -stc -pop ecx bx ax -ret - -;-AX -SetTimeout: -mov cs:Timeout,dx -ret - -timeout dw tensec - -getTimeout: -mov dx,cs:Timeout -ret - -SetEmettor: -mov cs:Emettor,1 -ret - -Emettor db 0 - -SetReceptor: -mov cs:Emettor,0 -ret - -;->bx Nøport->Adresse dx -GetLpt: -push ax bx ds -mov ax,bios -mov ds,ax -dec bx -shl bx,1 -mov dx,ds:[Lptadr+bx] -mov cs:lpt,dx -pop ds bx ax -ret -lpt dw 0 - -;->bx Nøport->Adresse dx -GetFirstLpt: -push ax ds -mov ax,bios -mov ds,ax -xor bx,bx -findlpt: -mov dx,ds:[Lptadr+bx] -cmp dx,0 -jne oklpt -add bx,2 -cmp bx,4 -jbe findlpt -oklpt: -mov cs:lpt,dx -pop ds ax -ret - -;-> -StartTimer: -push ax ecx ds -mov ax,Bios -mov ds,ax -mov ecx,ds:[timer] -mov cs:times,ecx -pop ds ecx ax -ret -times dd 0 - -;->Ecx time elapsed -EndTimer: -push ax ds -mov ax,Bios -mov ds,ax -mov ecx,ds:[timer] -sub ecx,cs:times -pop ds ax -ret - -;-> -GetLptOut: -push dx -mov dx,cs:lpt -in al,dx -pop dx -ret - -GetLptIn: -push dx -mov dx,cs:lpt -inc dx -in al,dx -shr al,3 -pop dx -ret - -GetLptInOut: -push dx -mov dx,cs:lpt -add dx,2 -in al,dx -and al,11111b -pop dx -ret - -SetLptOut: -push dx -mov dx,cs:lpt -out dx,al -pop dx -ret - -SetLptIn: -push dx -mov dx,cs:lpt -inc dx -out dx,al -pop dx -ret - -SetLptInOut: -push dx -mov dx,cs:lpt -add dx,2 -out dx,al -pop dx -ret - -;R‚alise un checksum 8 bits sur donn‚es DS:SI, nb CX r‚sultat dans dl -Checksum8: -push cx si -check: -add dl,[si] -inc si -dec cx -jnz check -pop si cx -ret - -;DS:SI pointeur sur donn‚es, CX nombres de donn‚es, AL token -SendLptBlock: -push ax bx cx edx si edi bp -mov dx,cx -shl edx,16 -mov dh,al -call checksum8 -mov edi,edx -xor dh,dh -mov bp,dx -mov ah,maxtry -retry: -mov bl,4 -xor al,al -header: -mov dx,di -call sendlpt -setne al -jc outt -rol edi,8 -dec bl -jnz header -cmp al,0 -jne notgood -mov dl,ACK -jmp allsend -notgood: -mov dl,NACK -allsend: -call sendlpt -setne al -jc outt -cmp al,0 -je okheader -dec ah -jnz retry -jmp outt -okheader: -cmp cx,0 -je endoftrans -mov di,maxtry -retry2: -mov bx,cx -xor ax,ax -body: -mov dl,[si+bx-1] -add ah,dl -call sendlpt -setne al -jc outt -dec bx -jnz body -cmp al,0 -jne notgood2 -mov dl,ACK -jmp allisend -notgood2: -mov dl,NACK -allisend: -call sendlpt -setne al -jc outt -cmp al,0 -je endoftrans -dec di -jnz retry2 -outt: -stc -endoftrans: -mov al,ah -xor ah,ah -cmp bp,ax -pop bp edi si edx cx bx ax -ret - -;Receptionne en es:di les donn‚es au nombres de CX token AL (AH) (ECX) -receiveLptBlock: -push bx dx si bp -mov ah,maxtry -retrye: -mov bl,4 -headere: -call receivelpt -jc outte -mov cl,dl -rol ecx,8 -dec bl -jnz headere -call receivelpt -jc outte -cmp dl,ACK -je okheadere -dec ah -jnz retrye -jmp outte -okheadere: -mov al,ch -xor ch,ch -mov bp,cx -rol ecx,16 -cmp cx,0 -je endoftranse -mov si,maxtry -retrye2: -mov bx,cx -xor ah,ah -bodye: -call receivelpt -jc outte -mov es:[di+bx-1],dl -add ah,dl -dec bx -jnz bodye -call receivelpt -jc outte -cmp dl,ACK -je endoftranse -dec si -jnz retrye2 -outte: -stc -endoftranse: -mov bl,ah -xor bh,bh -cmp bp,bx -pop bp si dx bx -ret -video db 0 -end start +.model tiny +.486 +smart +.code +org 0100h +start: +jmp tsr +drv db 'LPT ',0 +Tsr: +cli +cmp ax,1234h +jne nomore +mov ax,4321h +jmp itsok +nomore: +push bx ax +mov ah,4 +mov bh,1 +int 50h +mov bl,al +pop ax +cmp byte ptr cs:isact,1 +je nottest +mov cs:isact,1 +cmp bl,80h +jae react +mov bl,ah +xor bh,bh +shl bx,1 +mov bx,cs:[bx].tables +mov cs:current,bx +pop bx +call cs:current +itsok: +jnc noerror +push bp +mov bp,sp +or byte ptr [bp+6],1b +pop bp +mov ax,cs +shl eax,16 +mov ax,cs:current +jmp endofint +noerror: +push bp +mov bp,sp +and byte ptr [bp+6],0FEh +pop bp +endofint: +mov cs:isact,0 +sti +iret +nottest: +pop bx +jmp endofint +current dw 0 +tables dw getlptin + dw getlptout + dw getlptinout + dw setlptin + dw setlptout + dw setlptinout + dw getlpt + dw getfirstlpt + dw setemettor + dw setreceptor + dw settimeout + dw gettimeout + dw receivelpt + dw sendlpt + dw receivelptblock + dw sendlptblock + dw receivecommand + dw sendcommand + +react: +push ds es +mov cs:isact,1 +pushad +push cs +pop ds +push cs +pop es +cmp byte ptr never,1 +je oknever +mov bl,[drv+3] +sub bl,'0' +xor bh,bh +call getlpt +dec bl +shl bl,1 +mov al,7 +sub al,bl +mov ah,40 +mov di,offset video +int 47h +push ax +mov ah,01h +int 50h +mov ah,21 +mov cl,4 +int 47h +sti +mov al,0111b +call setlptout +call setreceptor +call initlpt +jc errorie +mov cx,0 +mov ah,20 +mov bx,1012h +mov si,offset initok +int 47h +cmp byte ptr always,1 +je yes +mov ah,20 +mov bx,1010h +mov si,offset mdd +int 47h +mov ah,13 +mov si,offset drv +int 47h +mov ah,6 +int 47h +mov ah,20 +mov bx,1011h +mov si,offset msg +int 47h +waitkey: +mov ax,0 +int 16h +cmp al,'n' +je no +cmp al,'N' +je no +cmp al,'Y' +je yes +cmp al,'y' +je yes +cmp al,'e' +je nev +cmp al,'E' +je nev +cmp al,'a' +je alw +cmp al,'A' +je alw +jmp waitkey +yes: +call receivecommand +jc errortimeout +no: +mov al,0111b +call setlptout +cli +mov ah,41 +mov si,offset video +int 47h +pop ax +mov ah,00h +int 50h +mov ah,09h +int 50h +oknever: +popad +pop es ds +mov cs:isact,0 +pop bx +jmp endofint +errorie: +mov si,offset inits +jmp show +errortimeout: +mov si,offset timeouts +show: +mov ah,20 +mov bx,1012h +int 47h +mov ax,0 +int 16h +jmp no +nev: +mov byte ptr never,1 +jmp no +alw: +mov byte ptr always,1 +jmp yes +initok db 'Initialisation is realised !',0 +inits db 'Error on initialisation',0 +timeouts db 'Connection lost or timeout complete !!',0 +mdd db 'Connection demand on ',0 +msg db 'Accept connection ? (Y)es (N)o n(E)ver (A)lways',0 +isact db 0 +always db 0 +never db 0 + +;envois une commande al +sendcommand: +push ax bx cx di +mov bl,al +xor bh,bh +shl bx,1 +add bx,offset cmde +call cs:[bx] +pop di cx bx ax +ret +cmde dw nothing + dw getram + +;recupŠre la ram en ds:si de cx distant caractŠres en es:di local +getram: +push ax bx cx ds +mov bx,offset command +mov cs:[bx+2],ds +mov cs:[bx],si +mov cs:[bx+4],cx +push cs +pop ds +mov si,bx +mov cx,6 +call sendlptblock +jc endofget +call receivelptblock +endofget: +pop ds cx bx ax +ret + +;Re‡ois une commande et l'execute +Receivecommand: +push ax bx cx di ds es +push cs +pop es +push cs +pop ds +mov di,offset command +call receivelptblock +jc endofno +mov bl,al +xor bh,bh +shl bx,1 +add bx,offset cmd +call cs:[bx] +clc +endofno: +pop es ds di cx bx ax +ret + +command db 25 dup (0) +cmd dw nothings + dw sendram + dw receiveram + dw sendreg + dw receivereg + dw sendport + dw receiveport + dw letexecute +nothings: +ret + +letexecute: +push ds es fs gs +pushad +push cs +push offset suite +mov ax,es:[di+2] +mov ds,ax +mov es,ax +mov fs,ax +mov gs,ax +push ax +mov ax,es:[di] +push ax +DB 0CBh +suite: +popad +pop gs fs es ds +ret + +Sendram: +push ax cx si ds +mov si,es:[di] +mov ax,es:[di+2] +mov ds,ax +mov cx,es:[di+4] +call sendlptblock +pop ds si cx ax +ret + +receiveram: +sendreg: +receivereg: + +sendport: +push ax cx dx si +mov dx,es:[di] +in ax,dx +mov cx,2 +mov si,offset tempblock +mov ds:[si],ax +call sendlptblock +pop si dx cx ax +ret + +receiveport: +push ax dx +mov dx,es:[di] +mov ax,es:[di+2] +out dx,ax +pop dx ax +ret + +tempblock db 25 dup (0) + +;---------Segment Adress----------- +Bios equ 040h +;---------Offset Adress------------ +Lptadr equ 008h +Timer equ 06Ch +;---------Constant----------------- +onesec equ 18 +tensec equ 182 +Ack equ 00 +Nack equ 0FFh +maxtry equ 10 + +Initlpt: +push ax ecx +call StartTimer +cmp cs:emettor,0 +je receptinit +mov al,10000b +call SetLptOut +waitinit1: +call EndTimer +cmp cx,cs:timeout +ja errorinit +call getlptIn +cmp al,00000b +jnz waitinit1 +jmp endinit +receptinit: +call EndTimer +cmp cx,cs:timeout +ja errorinit +call getlptIn +cmp al,00000b +jnz receptinit +mov al,10000b +call SetLptOut +endinit: +clc +pop ecx ax +ret +errorinit: +stc +pop ecx ax +ret + + +;-Envoie DL (dh) JNE si problŠme JNC error timeout +Sendlpt: +push ax bx ecx +call StartTimer +mov dh,dl +mov al,dl +and al,0Fh +call SetLptOut +waitSend: +call EndTimer +cmp cx,cs:timeout +ja errorsend +call getlptIn +bt ax,4 +jnc waitsend +and al,0Fh +mov bl,al +call StartTimer ;///// +mov al,dh +shr al,4 +or al,10000b +call SetLptOut +waitSend2: +call EndTimer +cmp cx,cs:timeout +ja errorsend +call getlptIn +bt ax,4 +jc waitsend2 +and al,0Fh +shl al,4 +add bl,al +cmp dl,bl +pop ecx bx ax +clc +ret +errorsend: +pop ecx bx ax +stc +ret + + +;-Re‡ois DL (dh) +Receivelpt: +push ax bx ecx +call StartTimer +waitreceive: +call EndTimer +cmp cx,cs:timeout +ja errorreceive +call getlptIn +bt ax,4 +jnc waitreceive +and al,0Fh +mov dl,al +call SetLptOut +call StartTimer ;///// +waitreceive2: +call EndTimer +cmp cx,cs:timeout +ja errorreceive +call getlptIn +bt ax,4 +jc waitreceive2 +and al,0Fh +mov dh,al +shl dh,4 +add dl,dh +or al,10000b +call SetlptOut +clc +pop ecx bx ax +ret +errorreceive: +stc +pop ecx bx ax +ret + +;-AX +SetTimeout: +mov cs:Timeout,dx +ret + +timeout dw tensec + +getTimeout: +mov dx,cs:Timeout +ret + +SetEmettor: +mov cs:Emettor,1 +ret + +Emettor db 0 + +SetReceptor: +mov cs:Emettor,0 +ret + +;->bx Nøport->Adresse dx +GetLpt: +push ax bx ds +mov ax,bios +mov ds,ax +dec bx +shl bx,1 +mov dx,ds:[Lptadr+bx] +mov cs:lpt,dx +pop ds bx ax +ret +lpt dw 0 + +;->bx Nøport->Adresse dx +GetFirstLpt: +push ax ds +mov ax,bios +mov ds,ax +xor bx,bx +findlpt: +mov dx,ds:[Lptadr+bx] +cmp dx,0 +jne oklpt +add bx,2 +cmp bx,4 +jbe findlpt +oklpt: +mov cs:lpt,dx +pop ds ax +ret + +;-> +StartTimer: +push ax ecx ds +mov ax,Bios +mov ds,ax +mov ecx,ds:[timer] +mov cs:times,ecx +pop ds ecx ax +ret +times dd 0 + +;->Ecx time elapsed +EndTimer: +push ax ds +mov ax,Bios +mov ds,ax +mov ecx,ds:[timer] +sub ecx,cs:times +pop ds ax +ret + +;-> +GetLptOut: +push dx +mov dx,cs:lpt +in al,dx +pop dx +ret + +GetLptIn: +push dx +mov dx,cs:lpt +inc dx +in al,dx +shr al,3 +pop dx +ret + +GetLptInOut: +push dx +mov dx,cs:lpt +add dx,2 +in al,dx +and al,11111b +pop dx +ret + +SetLptOut: +push dx +mov dx,cs:lpt +out dx,al +pop dx +ret + +SetLptIn: +push dx +mov dx,cs:lpt +inc dx +out dx,al +pop dx +ret + +SetLptInOut: +push dx +mov dx,cs:lpt +add dx,2 +out dx,al +pop dx +ret + +;R‚alise un checksum 8 bits sur donn‚es DS:SI, nb CX r‚sultat dans dl +Checksum8: +push cx si +check: +add dl,[si] +inc si +dec cx +jnz check +pop si cx +ret + +;DS:SI pointeur sur donn‚es, CX nombres de donn‚es, AL token +SendLptBlock: +push ax bx cx edx si edi bp +mov dx,cx +shl edx,16 +mov dh,al +call checksum8 +mov edi,edx +xor dh,dh +mov bp,dx +mov ah,maxtry +retry: +mov bl,4 +xor al,al +header: +mov dx,di +call sendlpt +setne al +jc outt +rol edi,8 +dec bl +jnz header +cmp al,0 +jne notgood +mov dl,ACK +jmp allsend +notgood: +mov dl,NACK +allsend: +call sendlpt +setne al +jc outt +cmp al,0 +je okheader +dec ah +jnz retry +jmp outt +okheader: +cmp cx,0 +je endoftrans +mov di,maxtry +retry2: +mov bx,cx +xor ax,ax +body: +mov dl,[si+bx-1] +add ah,dl +call sendlpt +setne al +jc outt +dec bx +jnz body +cmp al,0 +jne notgood2 +mov dl,ACK +jmp allisend +notgood2: +mov dl,NACK +allisend: +call sendlpt +setne al +jc outt +cmp al,0 +je endoftrans +dec di +jnz retry2 +outt: +stc +endoftrans: +mov al,ah +xor ah,ah +cmp bp,ax +pop bp edi si edx cx bx ax +ret + +;Receptionne en es:di les donn‚es au nombres de CX token AL (AH) (ECX) +receiveLptBlock: +push bx dx si bp +mov ah,maxtry +retrye: +mov bl,4 +headere: +call receivelpt +jc outte +mov cl,dl +rol ecx,8 +dec bl +jnz headere +call receivelpt +jc outte +cmp dl,ACK +je okheadere +dec ah +jnz retrye +jmp outte +okheadere: +mov al,ch +xor ch,ch +mov bp,cx +rol ecx,16 +cmp cx,0 +je endoftranse +mov si,maxtry +retrye2: +mov bx,cx +xor ah,ah +bodye: +call receivelpt +jc outte +mov es:[di+bx-1],dl +add ah,dl +dec bx +jnz bodye +call receivelpt +jc outte +cmp dl,ACK +je endoftranse +dec si +jnz retrye2 +outte: +stc +endoftranse: +mov bl,ah +xor bh,bh +cmp bp,bx +pop bp si dx bx +ret +video db 0 +end start diff --git a/noyau/mouse.asm b/noyau/souris.asm old mode 100755 new mode 100644 similarity index 95% rename from noyau/mouse.asm rename to noyau/souris.asm index b2e8a19..c639cfa --- a/noyau/mouse.asm +++ b/noyau/souris.asm @@ -1,327 +1,327 @@ -.model tiny -.486 -smart -.code -org 0100h -start: -jmp tsr -drv db 'MOUSE',0 -Tsr: -cli -cmp ax,1234h -jne nomore -mov ax,4321h -jmp itsok -nomore: -push bx ax -mov ah,4 -mov bh,0 -int 50h -mov bl,al -pop ax -cmp byte ptr cs:isact,1 -je nottest -mov cs:isact,1 -and bl,10000b -cmp bl,16 -jae react -mov bl,ah -xor bh,bh -shl bx,1 -mov bx,cs:[bx].tables -mov cs:current,bx -pop bx -call cs:current -itsok: -jnc noerror -push bp -mov bp,sp -or byte ptr [bp+6],1b -pop bp -mov ax,cs -shl eax,16 -mov ax,cs:current -jmp endofint -noerror: -push bp -mov bp,sp -and byte ptr [bp+6],0FEh -pop bp -endofint: -mov cs:isact,0 -sti -iret -nottest: -pop bx -jmp endofint -current dw 0 -tables dw cmdmouse - dw cmdmouse2 - dw detectmouse - dw getmouse - dw getmousescreen - dw configmouse - -isact db 0 - -;Envoie une commande AL … la souris via controleur clavier -cmdmouse: - push ax -videbuff1: - in al, 64h - and al, 10b - jne videbuff1 - mov al, 00d4h - out 64h, al -videbuff2: - in al, 64h - and al, 10b - jne videbuff2 - pop ax - out 60h, al - in al, 60h - ret - -;Envoie une commande2 AL … la souris via controleur clavier carry=nomouse -cmdmouse2: - push ax -videbuff21: - in al, 64h - and al, 10b - jne videbuff21 - mov al, 0060h - out 64h, al -videbuff22: - in al, 64h - and al, 10b - jne videbuff22 - pop ax - out 60h, al - in al, 60h - ret - -Detectmouse: - push ax cx - mov al, 0a8h ;AUX enable - out 64h, al - mov al, 0f3h ;Set sample - call cmdmouse - mov al, 100 ;Set sample - call cmdmouse - mov al, 0e8h ;Set resolution - call cmdmouse - mov al, 01 ;Set resolution - call cmdmouse - mov al, 0e7h ;Set scale 2:1 - call cmdmouse - mov al, 0f4h ;Enable device - call cmdmouse - mov al, 47h ;Interruption ON - call cmdmouse2 - mov cx, 1024 -testmouse: - in al, 60h ;Lecture du port de donn‚es - cmp al, 250 ;Test si il y a une souris - je okmouse - dec cx - jnz testmouse - stc - jmp endoftest -okmouse: - clc -endoftest: - pop cx ax - ret - -;envoie en bx,cx les coordonn‚es et en dl les boutons -getmouse: -mov bx,cs:rx -mov cx,cs:ry -mov dl,cs:button -sub dl,8 -and dl,0Fh -clc -ret - -;envoie en di les coordonn‚es ecran et en dl les boutons -getmousescreen: -mov di,cs:xy -mov dl,cs:button -sub dl,8 -and dl,0Fh -clc -ret - - -;configure la rapidit‚ dans cl et dans ah,al sphŠre x et y -Configmouse: -mov cs:speed,cl -mov cs:spherex,ah -mov cs:spherey,al -ret - -Button db 0 -rx dw 0 -ry dw 0 -VX db 0 -VY db 0 -X dw 7FFFh -Y dw 7FFFh -speed db 6 -spherex db 0 -spherey db 0 -count db 0 -error db 0 -xy dw 0 -old db 0 -;Gestionnaire de souris PS/2 -react: - push ax bx cx dx di ds es - push cs - pop ds - in al, 60h - cmp error, 1 - je gest1 - cmp count, 1 - je gest1 - cmp count, 2 - je gest2 - cmp count, 3 - je gest3 - -gest1: - mov count, 2 - mov Button, al - and al, 00001000b - cmp al, 8 - je gest1end - mov error, 1 - jmp gest1end2 -gest1end: - mov error, 0 -gest1end2: - mov count, 2 - jmp endgest -gest2: - mov count, 3 - mov VX, al - jmp endgest -gest3: - mov count, 1 - mov VY, al - jmp endgest -endgest: - cmp error,1 - je errormouse - push cs - pop es - mov di,offset infos - mov ah,34 - int 47h - mov cl,speed - movsx bx,VY - shl bx,cl - cmp spherey,0 - jne nolimity - xor ah,ah - mov al,[di] - cmp byte ptr [di+7],4 - jbe text4 - shl ax,3 -text4: - dec ax - cmp bx,0 - jg decy - cmp ry,ax - jae noaddy - jmp nolimity -decy: - cmp ry,0 - je noaddy -nolimity: - sub y,bx -noaddy: - movsx bx,VX - shl bx,cl - cmp spherex,0 - jne nolimitx - xor ah,ah - mov al,[di+1] - cmp byte ptr [di+7],4 - jbe text5 - shl ax,3 -text5: - dec ax - cmp bx,0 - jl decx - cmp rx,ax - jae noaddx - jmp nolimitx -decx: - cmp rx,0 - je noaddx -nolimitx: - add x,bx -noaddx: - mov ax,x - mov bx,0FFFFh - xor ch,ch - mov cl,[di+1] - cmp byte ptr [di+7],4 - jbe text1 - shl cx,3 -text1: - mul cx - div bx - mov rx,ax - mov ax,y - xor ch,ch - mov cl,[di] - cmp byte ptr [di+7],4 - jbe text2 - shl cx,3 -text2: - mul cx - div bx - mov ry,ax - xor ch,ch - mov cl,[di+1] - cmp byte ptr [di+7],4 - jbe text3 - shl cx,3 -text3: - mul cx - add ax,rx - cmp byte ptr [di+7],4 - mov di,ax - jbe textpoint - mov ax,0A000h - mov es,ax - jmp graphpoint -textpoint: - mov ax,0B800h - mov es,ax - shl di,1 - inc di -graphpoint: - mov bx,xy - cmp byte ptr es:[bx],070h - jne waschanged - mov al,old - mov byte ptr es:[bx],al -waschanged: - mov xy,di - mov al,es:[di] - mov old,al - mov byte ptr es:[di],070h - mov al, 20h - out 0a0h, al - out 20h, al -errormouse: - pop es ds di dx cx bx ax - mov cs:isact,0 - pop bx - iret - infos db 40 dup (0) - -end start +.model tiny +.486 +smart +.code +org 0100h +start: +jmp tsr +drv db 'MOUSE',0 +Tsr: +cli +cmp ax,1234h +jne nomore +mov ax,4321h +jmp itsok +nomore: +push bx ax +mov ah,4 +mov bh,0 +int 50h +mov bl,al +pop ax +cmp byte ptr cs:isact,1 +je nottest +mov cs:isact,1 +and bl,10000b +cmp bl,16 +jae react +mov bl,ah +xor bh,bh +shl bx,1 +mov bx,cs:[bx].tables +mov cs:current,bx +pop bx +call cs:current +itsok: +jnc noerror +push bp +mov bp,sp +or byte ptr [bp+6],1b +pop bp +mov ax,cs +shl eax,16 +mov ax,cs:current +jmp endofint +noerror: +push bp +mov bp,sp +and byte ptr [bp+6],0FEh +pop bp +endofint: +mov cs:isact,0 +sti +iret +nottest: +pop bx +jmp endofint +current dw 0 +tables dw cmdmouse + dw cmdmouse2 + dw detectmouse + dw getmouse + dw getmousescreen + dw configmouse + +isact db 0 + +;Envoie une commande AL … la souris via controleur clavier +cmdmouse: + push ax +videbuff1: + in al, 64h + and al, 10b + jne videbuff1 + mov al, 00d4h + out 64h, al +videbuff2: + in al, 64h + and al, 10b + jne videbuff2 + pop ax + out 60h, al + in al, 60h + ret + +;Envoie une commande2 AL … la souris via controleur clavier carry=nomouse +cmdmouse2: + push ax +videbuff21: + in al, 64h + and al, 10b + jne videbuff21 + mov al, 0060h + out 64h, al +videbuff22: + in al, 64h + and al, 10b + jne videbuff22 + pop ax + out 60h, al + in al, 60h + ret + +Detectmouse: + push ax cx + mov al, 0a8h ;AUX enable + out 64h, al + mov al, 0f3h ;Set sample + call cmdmouse + mov al, 100 ;Set sample + call cmdmouse + mov al, 0e8h ;Set resolution + call cmdmouse + mov al, 01 ;Set resolution + call cmdmouse + mov al, 0e7h ;Set scale 2:1 + call cmdmouse + mov al, 0f4h ;Enable device + call cmdmouse + mov al, 47h ;Interruption ON + call cmdmouse2 + mov cx, 1024 +testmouse: + in al, 60h ;Lecture du port de donn‚es + cmp al, 250 ;Test si il y a une souris + je okmouse + dec cx + jnz testmouse + stc + jmp endoftest +okmouse: + clc +endoftest: + pop cx ax + ret + +;envoie en bx,cx les coordonn‚es et en dl les boutons +getmouse: +mov bx,cs:rx +mov cx,cs:ry +mov dl,cs:button +sub dl,8 +and dl,0Fh +clc +ret + +;envoie en di les coordonn‚es ecran et en dl les boutons +getmousescreen: +mov di,cs:xy +mov dl,cs:button +sub dl,8 +and dl,0Fh +clc +ret + + +;configure la rapidit‚ dans cl et dans ah,al sphŠre x et y +Configmouse: +mov cs:speed,cl +mov cs:spherex,ah +mov cs:spherey,al +ret + +Button db 0 +rx dw 0 +ry dw 0 +VX db 0 +VY db 0 +X dw 7FFFh +Y dw 7FFFh +speed db 6 +spherex db 0 +spherey db 0 +count db 0 +error db 0 +xy dw 0 +old db 0 +;Gestionnaire de souris PS/2 +react: + push ax bx cx dx di ds es + push cs + pop ds + in al, 60h + cmp error, 1 + je gest1 + cmp count, 1 + je gest1 + cmp count, 2 + je gest2 + cmp count, 3 + je gest3 + +gest1: + mov count, 2 + mov Button, al + and al, 00001000b + cmp al, 8 + je gest1end + mov error, 1 + jmp gest1end2 +gest1end: + mov error, 0 +gest1end2: + mov count, 2 + jmp endgest +gest2: + mov count, 3 + mov VX, al + jmp endgest +gest3: + mov count, 1 + mov VY, al + jmp endgest +endgest: + cmp error,1 + je errormouse + push cs + pop es + mov di,offset infos + mov ah,34 + int 47h + mov cl,speed + movsx bx,VY + shl bx,cl + cmp spherey,0 + jne nolimity + xor ah,ah + mov al,[di] + cmp byte ptr [di+7],4 + jbe text4 + shl ax,3 +text4: + dec ax + cmp bx,0 + jg decy + cmp ry,ax + jae noaddy + jmp nolimity +decy: + cmp ry,0 + je noaddy +nolimity: + sub y,bx +noaddy: + movsx bx,VX + shl bx,cl + cmp spherex,0 + jne nolimitx + xor ah,ah + mov al,[di+1] + cmp byte ptr [di+7],4 + jbe text5 + shl ax,3 +text5: + dec ax + cmp bx,0 + jl decx + cmp rx,ax + jae noaddx + jmp nolimitx +decx: + cmp rx,0 + je noaddx +nolimitx: + add x,bx +noaddx: + mov ax,x + mov bx,0FFFFh + xor ch,ch + mov cl,[di+1] + cmp byte ptr [di+7],4 + jbe text1 + shl cx,3 +text1: + mul cx + div bx + mov rx,ax + mov ax,y + xor ch,ch + mov cl,[di] + cmp byte ptr [di+7],4 + jbe text2 + shl cx,3 +text2: + mul cx + div bx + mov ry,ax + xor ch,ch + mov cl,[di+1] + cmp byte ptr [di+7],4 + jbe text3 + shl cx,3 +text3: + mul cx + add ax,rx + cmp byte ptr [di+7],4 + mov di,ax + jbe textpoint + mov ax,0A000h + mov es,ax + jmp graphpoint +textpoint: + mov ax,0B800h + mov es,ax + shl di,1 + inc di +graphpoint: + mov bx,xy + cmp byte ptr es:[bx],070h + jne waschanged + mov al,old + mov byte ptr es:[bx],al +waschanged: + mov xy,di + mov al,es:[di] + mov old,al + mov byte ptr es:[di],070h + mov al, 20h + out 0a0h, al + out 20h, al +errormouse: + pop es ds di dx cx bx ax + mov cs:isact,0 + pop bx + iret + infos db 40 dup (0) + +end start diff --git a/noyau/system.asm b/noyau/system.asm deleted file mode 100755 index 9680cde..0000000 --- a/noyau/system.asm +++ /dev/null @@ -1,676 +0,0 @@ -.model tiny -.486 -smart -.code - -org 0100h - -start: -mov si,offset video -mov bx,400h -mov ax,47h -call installhandler -jc erroron -mov si,offset timer -mov bx,900h -mov ax,8h -call replacehandler -jc erroron -mov si,offset pic -mov bx,950h -mov ax,50h -call installhandler -jc erroron -mov si,offset drive -mov bx,1020h -mov ax,48h -call installhandler -jc erroron -mov si,offset keyboard -mov bx,1400h -mov ax,9h -call replacehandler -jc erroron -mov ax,40h -mov es,ax -mov dx,es:[8] -cmp dx,0 -je nolpt1 -mov al,0FFh -add dx,2 -out dx,al -mov si,offset lpt -mov bx,1500h -mov ax,0Fh -call installhandler -jc erroron -mov es,bx -sub al,8 -xor ah,ah -int 50h -mov byte ptr es:[105h],'1' -nolpt1: -push es -mov ax,40h -mov es,ax -mov dx,es:[10] -pop es -cmp dx,0 -je nolpt2 -mov al,0FFh -add dx,2 -out dx,al -mov si,offset lpt -mov bx,1700h -mov ax,0Dh -call installhandler -jc erroron -sub al,8 -xor ah,ah -int 50h -mov es,bx -mov byte ptr es:[105h],'2' -nolpt2: -mov si,offset mouse -mov bx,1900h -mov ax,74h -call installhandler -jc erroron -mov ax,0012 -int 50h -mov ah,2 -int 74h -;mov si,offset joystick -;mov bx,2700h -;mov ax,08h -;call replacehandler -mov si,offset hours -mov bx,2900h -mov ax,08h -call replacehandler - -start2: -push cs -push cs -pop ds -pop es -mov ah,21 -mov cl,7 -int 47h -mov ax,0002 -int 47h -mov ah,2 -int 47h -mov ah,25 -mov bx,0 -int 47h -mov ah,13 -mov si,offset msg1 -int 47h -mov ah,6 -int 47h -int 47h -mov ah,13 -mov si,offset prompt -int 47h -mov ah,6 -int 47h -xor di,di -mov ax,0001h -mov bx,offset buffer -mov cx,13 -int 48h -xor bp,bp -showall: -cmp byte ptr [bx+di],0 -je endof2 -mov al,[bx+di+12] -mov byte ptr [bx+di+12],0 -mov si,bx -add si,di -mov ah,13 -int 47h -mov si,offset spaces -int 47h -mov [bx+di+12],al -mov byte ptr [bx+di+12+5],0 -mov si,bx -add si,di -add si,12 -int 47h -mov ah,6 -int 47h -add di,32 -inc bp -jmp showall -endof2: -mov ah,21 -mov cl,112 -int 47h -mov ah,13 -mov si,offset menu -int 47h -mov xx,1 -mov xxold,2 -call Select -endof: -mov ax,0 -int 16h - cmp ah,50h - jne tre1 - cmp xx,bp - je endof - inc xx - call select - jmp endof -tre1: - cmp ah,48h - jne tre2 - cmp xx,1 - je endof - dec xx - call select - jmp endof -tre2: - cmp al,0Dh - jne tre3 - mov di,xx - dec di - shl di,5 - mov dx,[di+bx+26] - cmp [di+bx+12],00657865h ;EXE - jne tre3 - mov ah,6 - int 47h - int 47h - mov ah,21 - mov cl,7 - int 47h - mov ah,13 - mov si,offset msg2 - int 47h - mov cx,dx - call executefatway -tre3: - cmp ah,59 - jne tre4 - mov lastread,0FFFFh - jmp start2 -tre4: - cmp ah,67 - jne endof - mov ax,0001 - int 47h - mov ah,2 - int 47h - mov ah,21 - mov cl,4 - int 47h - mov ah,13 - mov si,offset msg3 - int 47h - mov ax,0 - int 16h - mov ax,40h - mov ds,ax - mov bx,1234h - mov ds:[072h],bx - push 0FFFFh - push 0000h - db 0CBh - -executefatway: - push cs - mov bx,offset start2 - push bx - mov bx,03000h - mov es,bx - push bx - mov bx,0100h - push bx - call loadfatway - push es - push es - push es - pop ds - pop fs - pop gs - push 7202h - popf - db 0CBh - -;selectionne la ligne xx -Select: -push ax di -mov di,xxold -mov al,7 -add di,2 -mov ah,32 -int 47h -mov ax,xx -mov xxold,ax -mov di,xx -mov ah,32 -mov al,112 -add di,2 -int 47h -pop di ax -ret - -xx dw 1 -xxold dw 0 -menu db 'F1 Read disk F2 Read file F9 Quit F11 Change video F12 Debug ',0 -msg1 db ' Cos 2000 menu loader release 1.0',0 -msg2 db 'The program is loading',0 -msg3 db ' Cos will restart your computer, eject the floppy disk and press a key',0 -prompt db '>',0 -spaces db ' ',0 -dot db '.',0 - -;cx entr‚e -> fatway chemin -getfatway: -push bx cx -mov bx,offset fatway -fatagain: -mov cs:[bx],cx -add bx,2 -cmp cx,0FFF0h -jae finishload -call getfat -jnc fatagain -finishload: -pop cx bx -ret - -;Charge le fichier de chemin cx -> taille dx -loadfatway: -push ax bx cx di -call getfatway -jc endload -mov di,offset fatway -mov si,offset dot -mov ah,13 -xor dx,dx -loadagain: -mov cx,cs:[di] -cmp cx,0FFF0h -jae endload -add di,2 -call readsector -jc endload -add bx,cs:sizec -add dx,cs:sizec -jmp loadagain -endload: -pop di cx bx ax -ret - - -sizec dw 512 -reserv dw 1 - -;<-cx nøsecteur ->cx code FAT -getfat: -push es ax bx dx -push cs -pop ds -push cs -pop es -mov ax,cx -xor dx,dx -div sizec -mov cx,ax -add cx,reserv -mov bx,offset buffer -call readsector -jc errorgetfat -shl dx,1 -add bx,dx -mov cx,[bx] -errorgetfat: -pop dx bx ax es -ret - -ReadSector: -push ax cx dx si - cmp cx,cs:lastread - je done - mov cs:LastRead,cx - mov AX, CX - xor DX, DX - div cs:DiskSectorsPerTrack - mov CL, DL ;{ Set the sector } - and CL, 63 ;{ Top two bits are bits 8&9 of the cylinder } - xor DX, DX - div cs:DiskTracksPerHead - mov CH, DL ;{ Set the track bits 0-7 } - mov AL, DH - ror AL, 1 - ror AL, 1 - and AL, 11000000b - or CL, AL ;{ Set bits 8&9 of track } - xor dX, DX - div cs:DiskHeads - mov DH, DL ;{ Set the head } - inc CL - mov SI, 4 -TryAgain: - mov AL, 1 - mov DL, 0 - mov AH, 2 - int 13h - jnc Done - dec SI - jnz TryAgain -mov word ptr cs:lastread,0ffffh -Done: - pop si dx cx ax -ret - -WriteSector: -push ax cx dx si - cmp cs:Lastread,cx - jne nodestruct - mov cs:Lastread,0ffffh - nodestruct: - mov AX, CX - xor DX, DX - div cs:DiskSectorsPerTrack - mov CL, DL ;{ Set the sector } - and CL, 63 ;{ Top two bits are bits 8&9 of the cylinder } - xor DX, DX - div cs:DiskTracksPerHead - mov CH, DL ;{ Set the track bits 0-7 } - mov AL, DH - ror AL, 1 - ror AL, 1 - and AL, 11000000b - or CL, AL ;{ Set bits 8&9 of track } - xor DX, DX - div cs:DiskHeads - mov DH, DL ;{ Set the head } - inc CL - mov SI, 4 -TryAgain2: - mov AL, 1 - mov DL, 0 - mov AH, 3 - int 13h - jnc Done2 - dec SI - jnz TryAgain2 -Done2: - pop si dx cx ax -ret - -Lastread dw 0FFFFh - -;remplace le handler pointer par ds:si en bx:100h interruption ax -replacehandler: -push ax bx cx si di ds es -mov es,bx -mov di,0100h -call loadfile -jc reph -mov bx,ax -call getint -mov es:[102h],si -mov es:[104h],ds -call setint -reph: -pop es ds di si cx bx ax -ret - -;install le handler pointer par ds:si en bx:100h interruption ax -installhandler: -push bx cx di es -mov es,bx -mov di,100h -call loadfile -jc insh -mov bx,ax -call setint -insh: -pop es di cx bx -ret - -;Charge le fichier Ds:si en es:di taille-> cx -loadfile: -push bx -call searchfile -jc errorloadfile -mov bx,di -call loadfatway -jc errorloadfile -mov cx,dx -errorloadfile: -pop bx -ret - -;met es:di le handle de l'int bx -setint: -push ax bx ds -cli -shl bx,2 -xor ax,ax -mov ds,ax -mov ds:[bx],di -mov ds:[bx+2],es -pop ds bx ax -sti -ret - -;met ds:si le handle de l'int bx -getint: -push ax bx es -shl bx,2 -xor ax,ax -mov es,ax -mov si,es:[bx] -mov ds,es:[bx+2] -pop es bx ax -ret - -;Recherche le fichier et retourne sont path et en cx sont debut -Searchfile: -push ax bx dx si di ds es -push cs -pop es -xor dx,dx -mov di,offset temp -call asciiztofit -push cs -pop ds -mov cx,13 -check: -mov bx,offset buffer -call readsector -jc errorboot -xor di,di -findnext: -cmp byte ptr [bx+di],0 -je errorboot -push si di cx -mov si,di -add si,bx -mov di,offset temp -mov cx,12+4 -cld -rep cmpsb -pop cx di si -je oksystem -add di,32 -inc dx -cmp dx,nbfit -ja errorboot -cmp di,sizec -jb findnext -inc cx -jmp Check -oksystem: -mov cx,[di+BX+26] -cld -jmp goodboot -errorboot: -stc -goodboot: -pop es ds di si dx bx ax -ret - -;->name ds:si ->es:di -AsciiZtoFit: -push ax bx cx dx si di ds es -xor bx,bx -mov dx,di -noextens: -mov al,[si+bx] -cmp al,'.' -je extens -call Issystchar -jc errortranslate -mov es:[di],al -inc di -inc bx -cmp bx,namesize ;(.) -jne noextens -erro: -stc -jmp errortranslate -extens: -add si,bx -inc si -sub bx,namesize -neg bx -mov al,0 -mov cx,bx -cld -rep stosb -xor bx,bx -wasextens: -mov al,[si+bx] -cmp al,0 -je endextens -call Issystchar -jc errortranslate -mov es:[di],al -inc di -inc bx -cmp bx,extsize -jne wasextens -jmp erro -endextens: -sub bx,extsize -neg bx -mov al,0 -mov cx,bx -cld -rep stosb -mov si,dx -mov di,dx -push es -pop ds -mov cx,extsize+namesize -call uppercaseMEM -clc -endtranslate: -pop es ds di si dx cx bx ax -ret -errortranslate: -stc -jmp endtranslate - -;Carry si al = caractŠre systŠme -isSystchar: -push di -mov di,offset exeptchar -isexcept: -cmp al,cs:[di] -je nogood -inc di -cmp byte ptr cs:[di],0 -jne isexcept -endanal: -clc -pop di -ret -nogood: -stc -jmp endanal - -;Transforme les x caractŠres de la mem en ds:si en maj -uppercaseMEM: -push si di cx ax -mov di,si -uppercaser: -mov al,ds:[si] -inc si -cmp al,'A' -jb nonmaj -cmp al,'Z' -ja nonmaj -add al,'a'-'A' -nonmaj: -mov es:[di],al -inc di -dec cx -jnz uppercaser -enduppercase: -clc -pop ax cx di si -ret - -erroron: -push cs -pop ds -xor edx,edx -mov dx,ax -mov ax,0001h -int 47h -mov ah,6 -int 47h -mov ah,6 -int 47h -mov ah,13 -mov si,offset errormsg -int 47h -mov ah,10 -mov cx,16 -int 47h -mov ah,6 -int 47h -mov ah,6 -int 47h -mov ah,13 -mov si,offset errormsg2 -int 47h -mov ax,0 -int 16h -push 0FFFFh -push 0 -db 0CBh - -errormsg db 'Error with drivers loading on interrupt nø',0 -errormsg2 db 'Press a key to restart...',0 -namesize equ 12 -extsize equ 5 -nbfit equ 255 -hours db 'hours.sys',0 -joystick db 'joystick.sys',0 -mouse db 'mouse.sys',0 -pic db 'pic8259a.sys',0 -drive db 'drive.sys',0 -timer db 'timer.sys',0 -lpt db 'lpt.sys',0 -video db 'video.sys',0 -keyboard db 'keyboard.sys',0 -temp db 12+5+1 dup (0) -exeptchar db '/\<>:|.',01,0,0 -DiskSectorsPerTrack dw 18 -DiskTracksPerHead dw 80 -DiskHeads dw 2 - -fatway equ $ - -buffer equ $+3000 - -end start diff --git a/noyau/systeme.asm b/noyau/systeme.asm new file mode 100644 index 0000000..b9624ea --- /dev/null +++ b/noyau/systeme.asm @@ -0,0 +1,897 @@ +.model tiny +.486 +smart +.code + +org 0100h + +include ..\include\fat.h + +start: +push cs +push cs +push cs +push cs +pop ds +pop es +pop fs +pop gs + ;xor ax,ax + ;mov ds,ax + ;mov si,7C00h +mov si,offset eepop + mov di,offset myboot + mov cx,type bootsector + push cs + pop es + rep movsb +jmp noone + +eepop db 0,0,0 +bootdb db 'COS2000A' ;Fabricant + n°série Formatage +sizec dw 512 ;octet/secteur + db 1 ;secteur/cluster +reserv dw 1 ;secteur reserv‚ +nbfat db 2 ;nb de copie de la FAT +nbfit dw 224 ;taille rep racine +allclu dw 2880 ;nb secteur du volume si < 32 még + db 0F0h ;Descripteur de média +fatsize dw 9 ;secteur/FAT +nbtrack dw 18 ;secteur/piste +head dw 2 ;nb de tˆteb de lecture/écriture +hidden dd 0 ;nombre de secteur cach‚s + dd 0 ;si nbsecteur = 0 nbsect ; the number of sectors +bootdrv db 0 ;Lecteur de d‚marrage +bootsig db 0 ;NA + db 29h ;boot signature 29h +bootsig2 dd 01020304h ;no de serie +pope db 'COS2000 ' ;nom de volume + db 'FAT12 ' ;FAT + + + xor ax,ax + mov es,ax + mov di,1Eh*4 + lds si,es:[di] + mov es:[di],cs + mov word ptr es:[di],offset myDPT + push cs + pop es + mov cx,type DPT + rep movsb + mov ax,cs:[Bootsector.SectorsPerTrack] + mov es:[DPT.SectorPerTracks],al +noone: + push cs + push cs + push cs + push cs + pop ds + pop es + pop fs + pop gs + + call InitDrive + + mov si,offset premice + mov bx,7 + call showstr + mov si,offset next + call showstr + mov si,offset conf + call showstr + mov al,0 + mov cx,2000 + mov di,offset loadinglist + rep stosb + mov di,offset loadinglist + call loadfile + jc noconfread + + mov si,offset debut + mov bx,7 + call showstr + mov bx,500h + xor cx,cx + mov si,offset loadinglist +suiteloading: + call readline + jc noconfload + push bx si + mov bl,7 + mov si,offset next + call showstr + pop si bx + call showstr + mov dx,bx + push bx si + mov bx,7 + mov si,offset address + call showstr + mov cx,16 + call showhex + mov si,offset addressend + call showstr + xor bp,bp + mov dx,ax + cmp ax,8h + jb noadder + cmp ax,10h + ja noadder + mov bp,1 + sub dx,8 + jmp haveirq +noadder: + cmp ax,70h + jb noadd + cmp ax,78h + ja noadd + mov bp,1 + sub dx,68h +haveirq: + mov si,offset irqs + call showstr + mov cx,4 + call showhex + mov si,offset irqsend + call showstr +noadd: + pop si bx + cmp bp,1 + jne install + call replacehandler + jmp suites +install: + call installhandler +suites: + jc nohandlerload + add bx,0F00h + inc cx + call nextline + jnz suiteloading + + mov si,offset fini + mov bl,7 + call showstr + mov si,offset next + call showstr + mov si,offset prompt + call showstr + mov ax,6000h + mov es,ax + push ax + mov di,0100h + push di + call loadfile + jc nopromptload + push 7202h + popf + push es + push es + push es + pop ds + pop fs + pop gs + db 0CBh + +nopromptload: + mov si,offset prompte + mov bl,4 + call showstr + jmp erroron + +nohandlerload: + mov si,offset handlere + mov bl,4 + call showstr + jmp erroron + +noconfread: + mov si,offset confee + mov bl,4 + call showstr + jmp erroron + +noconfload: + mov di,si + mov si,offset confe + mov bl,4 + call showstr + mov dx,cx + mov cx,16 + call showhex + mov si,offset confe2 + mov bl,3 + call showstr + mov dx,di + mov cx,16 + call showhex + +erroron: + push cs + pop ds + mov si,offset erreur + mov bl,4 + call showstr + mov ax,0 + int 16h + push 0FFFFh + push 0 + db 0CBh + +address db ' [',0 +addressend db ':0100] ',0 +irqs db ' (IRQ ',0 +irqsend db ')',0 +prompt db 'commande.exe',0 +conf db 'systeme.ini',0 +premice db 0Dh,0Ah,'Chargement du fichier de configuration:',0 +debut db 0Dh,0Ah,'Chargement des pilotes systeme:',0 +fini db 0Dh,0Ah,'Chargement de l''interpreteur de commande:',0 +next db 0Dh,0Ah,' - ',0 +prompte db 0Dh,0Ah,'Erreur lors du chargement de l''interpreteur',0 +handlere db 0Dh,0Ah,'Erreur lors du chargement des pilotes',0 +confe db 0Dh,0Ah,'Erreur dans le fichier de configuration a la ligne ',0 +confee db 0Dh,0Ah,'Erreur de lecture du fichier de configuration',0 +confe2 db ' caractere ',0 +erreur db 0Dh,0Ah,'Pressez une touche pour redemarrer...',0 + +;==positionne si sur l'entrée suivante de la loading liste jusqu'a equal +nextline: +push ax cx di +mov di,si +mov al,0Ah +mov cx,20 +repnz scasb +mov si,di +cmp byte ptr [di],0 +pop di cx ax +ret + +;==Lit la loading list et initialise SI(Fichier) BX(adresse) AX(interruption) +readline: +push cx dx di es +push ds +pop es +;Voir taille de la ligne -> DX +mov di,si +mov al,0Dh +mov cx,20 +repne scasb +sub cx,20 +neg cx +mov dx,cx +;N° interruption ?? +mov di,si +mov al,'(' +repne scasb +jne noaddr +;Non, je recherche l'int positionnement parenthese de fin +mov al,')' +repne scasb +jne errorlist +;Je lit l'interruption dans DL +xor dl,dl +xor cx,cx +dec di +readingint: +dec di +mov al,[di] +cmp al,'(' +je finishint +call eval +jc errorlist +shl ax,cl +add dl,al +add cx,4 +cmp cx,8 +ja errorlist +jmp readingint +noaddr: +dec di +mov dl,0 +finishint: +;mise d'un 0 a la fin du nom +mov byte ptr [di],0 +mov al,dl +pop es di dx cx +clc +ret +errorlist: +sub di,si +mov si,di +pop es di dx cx +stc +ret + + +;return carry si pas hexa pour al et renvoie dans al la valeur décimale +eval: +push si +xor si,si +searchex: +cmp al,cs:[si+offset hexas] +je endsearchex +inc si +cmp si,15 +jbe searchex +pop si +stc +ret +endsearchex: +mov ax,si +pop si +clc +ret + +hexas db '0123456789ABCDEF',0 + +;==============================Affiche le nombre nb hexa en EDX de taille CX et couleur BL============== +ShowHex: + push ax bx cx edx si di + mov di,cx + sub cx,32 + neg cx + shl edx,cl + shr di,2 + mov ah,0Eh + and bx,1111b +Hexaize: + rol edx,4 + mov si,dx + and si,1111b + mov al,[si+offset tab] + int 10h + dec di + jnz Hexaize + pop di si edx cx bx ax + ret +Tab db '0123456789ABCDEF' + +;==============================Affiche une chaine DS:SI de couleur BL============== +showstr: + push ax bx si +again: + lodsb + or al,al + jz fin + mov ah,0Eh + and bx,1111b + int 10h + jmp again + fin: + pop si bx ax + ret + +;================================================ +;Routine de gestion de handler +;================================================ + +;remplace le handler pointer par ds:si en bx:100h interruption ax +replacehandler: +push ax bx cx si di ds es +mov es,bx +mov di,0100h +call loadfile +jc reph +mov bx,ax +call getint +mov es:[102h],si +mov es:[104h],ds +call setint +reph: +pop es ds di si cx bx ax +ret + +;install le handler pointer par ds:si en bx:100h interruption ax +installhandler: +push bx cx di es +mov es,bx +mov di,100h +call loadfile +jc insh +mov bx,ax +call setint +insh: +pop es di cx bx +ret + +;met es:di le handle de l'int bx +setint: +push ax bx ds +cli +shl bx,2 +xor ax,ax +mov ds,ax +mov ds:[bx],di +mov ds:[bx+2],es +pop ds bx ax +sti +ret + +;met ds:si le handle de l'int bx +getint: +push ax bx es +shl bx,2 +xor ax,ax +mov es,ax +mov si,es:[bx] +mov ds,es:[bx+2] +pop es bx ax +ret + +;================================================ +;Routine de gestion de systeme de fichier FAT12 +;================================================ + +;DPT disquette +mydpt DPT ? + +;Secteur de boot +myboot bootSector ? + +;Données Calculée +clustersize dw 0 +TracksPerHead dw 0 +DriveSize dd 0 +AdressBoot dw 0 +AdressFat dw 0 +AdressParent dw 0 +AdressData dw 0 +AddingValue dw 0 +CurrentDir dw 0 ;En cluster +CurrentDirStr db 128 dup (0) + +;Pour recherches +EntryPlace dw 0 ;En octet +AdressDirectory dw 0 ;En cluster +firstsearch dw 1 ;Premiere requete ? + +getfat: + push ax bx dx si + mov ax,cx + mov bx,ax + and bx,0000000000000001b + shr ax,1 + mov cx,3 + mul cx + mov si,offset bufferfat + add si,ax + cmp bx,0h + jnz evenfat +oddfat: + mov dx,cs:[si] + and dx,0FFFh + mov cx,dx + jmp endfat +evenfat: + mov dx,cs:[si+1] + and dx,0FFF0h + shr dx,4 + mov cx,dx +endfat: + cmp dx,0FF0h + jbe nocarry + stc + pop si dx bx ax + ret +nocarry: + clc + pop si dx bx ax + ret + +;============loadfile (Fonction 4)=============== +;Charge le fichier ds:si en es:di ->ecx taille +;-> AH=4 +;<- Flag Carry si erreur +;===================================================== +loadfile: + push eax bx di + push es di + push cs + pop es + mov di,offset tempfit + call searchfile + pop di es + jne errorload + jc errorload + mov cx,cs:tempfit.FileGroup + mov eax,cs:tempfit.FileSize + call loadway + jc errorload + clc + ;mov ecx,eax + pop di bx eax + ret +errorload: + stc + mov ecx,0 + pop di bx eax + ret + +tempfit db 32 dup (0) + +;=============SearchFile (Fonction 10)=============== +;Renvois dans ES:DI la fit du fichier DS:SI et non equal si pas existant +;-> AH=10 +;<- Flag Carry si erreur +;===================================================== +SearchFile: + push ax cx ds si di es + call uppercase + push ds si + call findfirstfilez + push ds + pop es + mov di,si + pop si ds + jc errorsearch + jmp founded +nextsearch: + push ds si + call findnextfilez + push ds + pop es + mov di,si + pop si ds +founded: + cmp byte ptr cs:[di],0 + je notgood + cmp byte ptr cs:[di+FileAttr],0Fh + je nextsearch + call cmpnames + jc nextsearch +okfound: + push cs + pop ds + mov si,di + pop es di + push di es + mov cx,32 + rep movsb + clc + pop es di si ds cx ax + ret +notgood: + cmp si,0FF5h + pop es di si ds cx ax + ret +errorsearch: + stc + pop es di si ds cx ax + ret + +;Transforme la chaine ds:si en maj +uppercase: + push si ax + mov di,si +uppercaser: + mov al,ds:[si] + cmp al,0 + je enduppercase + cmp al,'a' + jb nonmaj + cmp al,'z' + ja nonmaj + sub al,'a'-'A' + mov ds:[si],al +nonmaj: + inc si + jmp uppercaser +enduppercase: + clc + pop ax si + ret + +;Compare le nom ds:si '.' avec es:di +CmpNames: + push ax cx si di + mov cx,8 + repe cmpsb + jne nequal + inc si +nequal: + cmp byte ptr [si-1],'.' + jne trynoext + mov al,' ' + rep scasb + mov cx,3 + rep cmpsb + jne notequal + cmp byte ptr [si],0 + jne notequal + cmp cx,0 + jl notequal +itok: + pop di si cx ax + ret +trynoext: + cmp byte ptr [si-1],0 + jne notequal + jmp itok +notequal: + stc + pop di si cx ax + ret + +;charge le fichier de de groupe CX et de taille eax +LoadWay: + push eax bx dx si di ecx ds es + cmp eax,0 + je Zeroload + rol eax,16 + mov dx,ax + ror eax,16 + div cs:clusterSize + mov bx,ax + cmp bx,1 + jb adjustlast +Loadfat: + call readcluster + jc noway + add di,cs:clusterSize + call getfat + dec bx + jnz loadfat +AdjustLast: + push es di + push cs + pop es + mov di,offset bufferread + mov si,di + call Readcluster + pop di es + jc noway + mov cx,dx + push cs + pop ds + rep movsb +zeroload: + clc + pop es ds ecx di si dx bx eax + ret +noway: + stc + pop es ds ebp di si dx bx eax + ret + +;=============INITDRIVE (Fonction 04H)=============== +;Initialise le lecteur pour une utilisation ultérieure +;-> AH=4 +;<- Flag Carry si erreur +;===================================================== +InitDrive: + push eax bx cx edx di ds es + push cs + pop ds + push cs + pop es + mov cs:lastseg,0 + mov cs:lastoff,0 + mov cs:LastRead,0 + mov ax,myboot.sectorsize + mov bl,myboot.SectorsPerCluster + xor bh,bh + mul bx + mov clustersize,ax + mov bx,myboot.HiddenSectorsL + adc bx,myboot.HiddenSectorsH + mov AdressBoot,bx + add bx,myboot.ReservedSectors + mov AdressFat,bx + xor ax,ax + mov al,myboot.FatsPerDrive + mul myboot.SectorsPerFat + add bx,ax + mov AdressParent,bx + mov AdressDirectory,bx + mov ax,32 + mul myboot.DirectorySize + div myboot.SectorSize + add bx,ax + mov AdressData,bx + sub bx,2 + mov AddingValue,bx + mov ax,myboot.SectorsPerDrive + div myboot.SectorsPerTrack + xor dx,dx + div myboot.HeadsPerDrive + mov TracksPerHead,ax + xor eax,eax + mov ax,myboot.SectorsPerDrive + sub ax,AdressData + mul myboot.SectorSize + shl edx,16 + add edx,eax + mov DriveSize,edx + mov CurrentDir,0 + mov EntryPlace,0 + mov adressdirectory,0 + mov firstsearch,1 + mov currentdirstr,0 + mov di,offset bufferfat + mov dx,myboot.SectorsPerFat + mov cx,AdressFat +SeeFat: + call readsector + jc ErrorInit + add di,myboot.SectorSize + inc cx + dec dx + jnz seefat + clc + pop es ds di edx cx bx eax + ret +ErrorInit: + stc + pop es ds di edx cx bx eax + ret + +;=============FindFirstFile (Fonction 7)============== +;Renvois dans ES:DI un bloc d'info +;-> AH=7 +;<- Flag Carry si erreur +;===================================================== +FindFirstFileZ: + push cx + mov cx,cs:CurrentDir + mov cs:AdressDirectory,cx + xor cx,cx + mov cs:EntryPlace,cx + mov cs:firstsearch,1 + call findnextfileZ + pop cx + ret + +;=============FindnextFile (Fonction 8)============== +;Renvois dans ES:DI un bloc d'info +;-> AH=8 +;<- Flag Carry si erreur +;===================================================== +;fait pointer ds:si sur la prochaine entrée du repertoire courant +FindnextFileZ: + push ax bx cx es di + push cs + pop ds + mov cx,cs:AdressDirectory + mov bx,cs:Entryplace +FindnextFileagain: + cmp cs:firstsearch,1 + je first + add bx,32 + cmp bx,cs:clusterSize + jb nopop +first: + mov di,offset bufferentry + push cs + pop es + mov bx,0 + cmp cs:currentdir,0 + jne notrootdir + cmp cs:firstsearch,1 + je noaddfirst1 + inc cx +noaddfirst1: + add cx,cs:adressparent + mov al,myboot.sectorspercluster +readroot: + call readsector + jc notwell + add di,myboot.sectorsize + dec al + jnz readroot + sub cx,cs:adressparent + jmp nopop +notrootdir: + cmp cs:firstsearch,1 + je noaddfirst2 + call getfat +noaddfirst2: + jc notwell + call readcluster + jc notwell +nopop: + mov cs:firstsearch,0 + mov si,offset bufferentry + add si,bx + cmp byte ptr cs:[si],0 + je notwell + mov cs:entryplace,bx + mov cs:AdressDirectory,cx + cmp byte ptr cs:[si],0E5h + je findnextfileagain + cmp byte ptr cs:[si+fileattr],28h + je findnextfileagain + cmp byte ptr cs:[si+fileattr],0Fh + je findnextfileagain + clc + pop di es cx bx ax + ret +notwell: + stc + pop di es cx bx ax + ret + + +;=============READCLUSTER (Fonction 14)=============== +;Lit le secteur CX et le met en es:di +;-> AH=14 +;<- Flag Carry si erreur +;===================================================== +readcluster: + push ax bx cx dx di + mov ax,cx + mov bl,cs:myboot.sectorspercluster + xor bh,bh + mul bx + mov cx,ax + add cx,cs:addingvalue +readsectors: + call readsector + jc errorreadincluster + add di,cs:myboot.sectorsize + inc cx + dec bl + jnz readsectors + clc + pop di dx cx bx ax + ret +errorreadincluster: + stc + pop di dx cx bx ax + ret + +;=============READSECTOR (Fonction 01H)=============== +;Lit le secteur CX et le met en es:di +;-> AH=1 +;<- Flag Carry si erreur +;===================================================== +ReadSector: + push ax bx cx dx si + cmp cx,cs:lastread + jne gom + mov ax,es + cmp cs:lastseg,ax + jne gom + cmp di,cs:lastoff + jne gom + jmp done +gom: + mov cs:lastseg,ax + mov cs:lastoff,di + mov cs:LastRead,cx + mov ax,cx + xor dx,dx + div cs:myboot.SectorsPerTrack + inc dl + mov bl,dl + xor dx,dx + div cs:myboot.HeadsPerDrive + mov dh,cs:myboot.bootdrive + xchg dl,dh + mov cx,ax + xchg cl,ch + shl cl,6 + or cl,bl + mov bx,di + mov SI,4 + mov AL,1 +TryAgain: + mov AH, 2 + int 13h + jnc Done + dec SI + jnz TryAgain +Done: + pop si dx cx bx ax +ret + +lastread dw 0 +lastseg dw 0 +lastoff dw 0 + +bufferread equ $ +bufferFat equ $+2048 +bufferentry equ $+2048+2048 +loadinglist equ $+2048+2048+2048 +end start diff --git a/noyau/systeme.ini b/noyau/systeme.ini new file mode 100644 index 0000000..0b7f37e --- /dev/null +++ b/noyau/systeme.ini @@ -0,0 +1,7 @@ +video.sys(47) +horloge.sys(8) +8259a.sys(50) +disque.sys(48) +souris.sys(74) +clavier.sys(9) +heure.sys(8) \ No newline at end of file diff --git a/noyau/video.asm b/noyau/video.asm old mode 100755 new mode 100644 index 48c3e95..a1f3b37 --- a/noyau/video.asm +++ b/noyau/video.asm @@ -1,1560 +1,1821 @@ -.model tiny -.486 -smart -.code - -org 0100h - -start: - jmp tsr ;Saute à la routine résidente -names db 'VIDEO' ;Nom drivers -id dw 1234h ;Identifiant drivers -Tsr: - cli ;Désactive interruptions logiciellement - cmp ax,cs:ID ;Compare si test de chargement - jne nomore ;Si pas test alors on continu - rol ax,3*4 ;Rotation de 3 chiffre de l'ID pour montrer que le drivers est chargé - jmp itsok ;On termine l'int avec notre code d'ID preuve du bon chargement de VIDEO -nomore: - cmp ah,maxfunc - jbe noerrorint - stc - jmp itsok - noerrorint: - clc - push bx - mov bl,ah ;On calcule d'aprés le n° de fonction - xor bh,bh ;quel sera l'entrée dans la table indexée - shl bx,1 ;des adresses fonctions. - mov bx,cs:[bx+tables] ;On récupère cette adresse depuis la table - mov cs:current,bx ;On la stocke temporairement pour obtenir les registres d'origine - pop bx - clc - call cs:current ;Puis on execute la fonction -itsok: - push bp - mov bp,sp ;On prend sp dans bp pour adresser la pile - jnc noerror ;La fonction appelée a renvoyer une erreur : Flag CARRY ? - or byte ptr [bp+6],1b;Si oui on le retranscrit sur le registre FLAG qui sera dépilé lors du IRET - ;xor eax,eax - ;mov ax,cs ;On récupère le segment et l'offset puis en renvoie l'adresse physique - ;shl eax,4 ;de l'erreur. - ;add ax,cs:current - ;jmp endofint ;on termine l'int -noerror: - and byte ptr [bp+6],0FEh;Si pas d'erreur on efface le Bit CARRY du FLAG qui sera dépilé lors du IRET -endofint: - pop bp - sti ;On réactive les interruptions logiciellement - iret ;Puis on retourne au programme appelant. - -current dw 0 ;Mot temporaire qui contient l'adresse de la fonction appelée -tables dw setvideomode ;Table qui contient les adresses de toutes les fonctions de VIDEO (WORD) - dw getvideomode - dw clearscreen - dw setfont - dw loadfont - dw showspace - dw showline - dw showchar - dw showint - dw showsigned - dw showhex - dw showbin - dw showstring - dw showstring0 - dw showcharat - dw showintat - dw showsignedat - dw showhexat - dw showbinat - dw showstringat - dw showstring0at - dw setcolor - dw getcolor - dw scrolldown - dw getxy - dw setxy2 - dw savescreen - dw restorescreen - dw page2to1 - dw page1to2 - dw xchgPages - dw savepage1 - dw changelineattr - dw waitretrace - dw getvgainfos - dw loadbmppalet - dw showbmp - dw viewbmp - dw savedac - dw restoredac - dw savestate - dw restorestate - dw enablescroll - dw disablescroll - -;================================Table des modes videos (64 BYTES) ============================================ -;40*25 16 couleurs -mode0 DB 67H,00H, 03H,08H,03H,00H,02H - DB 2DH,27H,28H,90H,2BH,0A0H,0BFH,01FH,00H,4FH,0DH,0EH,00H,00H,00H,00H - DB 9CH,8EH,8FH,14H,1FH,96H,0B9H,0A3H,0FFH - DB 00H,00H,00H,00H,00H,10H,0EH,00H,0FFH - DB 00H,01H,02H,03H,04H,05H,14H,07H,38H,39H,3AH,3BH,3CH,3DH,3EH,3FH - DB 0CH,00H,0FH,08H,00H - DB 40,25 - -;80*25 16 couleurs -mode1 DB 67H,00H, 03H,00H,03H,00H,02H - DB 5FH,4FH,50H,82H,55H,81H,0BFH,1FH,00H,4FH,0DH,0EH,00H,00H,00H,00H - DB 9CH,0EH,8FH,28H,1FH,96H,0B9H,0A3h,0FFH - DB 00H,00H,00H,00H,00H,10H,0EH,00H,0FFH - DB 00H,01H,02H,03H,04H,05H,14H,07H,38H,39H,3AH,3BH,3CH,3DH,3EH,3FH - DB 0CH,00H,0FH,08H,00H - DB 80,25 - -;80*50 16 couleurs -mode2 DB 63H, 00H, 03H,01H,03H,01H,02H - DB 5FH,4FH,50H,82H,55H,81H,0BFH,1FH,00H,47H,06H,07H,00H,00H,00H - DB 00H,9CH,8EH,8FH,28H,1FH,96H,0B9H,0A3H,0FFH - DB 00H,00H,00H,00H,00H,10H,0EH,00H,0FFH - DB 00H,01H,02H,03H,04H,05H,14H,07H,10H,11H,3AH,3BH,3CH,3DH,3EH,3FH - DB 0CH,00H,0FH,00H,00H - DB 80,50 - -;100*50 16 couleurs -mode3 DB 067H,00H,03H,01H,03H,01H,02H - DB 70H,63H,64H,85H,68H,84H,0BFH,1FH,00H,47H,06H,07H,00H,00H,00H - DB 00H,9Ch,08EH,8FH,32H,1FH,96H,0B9H,0A3H,0FFH - DB 00H,00H,00H,00H,00H,10H,0EH,00H,0FFH - DB 00H,01H,02H,03H,04H,05H,14H,07H,10H,11H,3AH,3BH,3CH,3DH,3EH,3FH - DB 0CH,00H,0FH,00H,00H - DB 100,50 - -;100*60 16 couleurs -mode4 DB 0A7H,00H,03H,01H,03H,01H,02H - DB 70H,63H,64H,85H,68H,84H,0FFH,1FH,00H,47H,06H,07H,00H,00H,00H - DB 00H,0E7H,8EH,0DFH,32H,1FH,0DFH,0E5H,0A3H,0FFH - DB 00H,00H,00H,00H,00H,10H,0EH,00H,0FFH - DB 00H,01H,02H,03H,04H,05H,14H,07H,10H,11H,3AH,3BH,3CH,3DH,3EH,3FH - DB 0CH,00H,0FH,00H,00H - DB 100,60 - -;320*200 256 couleurs -mode5 DB 63H, 00H, 03H,01H,0FH,00H,06H - DB 5FH,4FH,50H,82H,54H,80H,0BFH,1FH,00H,41H,00H,00H,00H,00H,00H,00H - DB 9CH,0EH,8FH,28H,00H,96H,0B9H,0E3H,0FFH - DB 00H,00H,00H,00H,00H,40H,05H,0FH,0FFH - DB 00H,01H,02H,03H,04H,05H,06H,07H,08H,09H,0AH,0BH,0CH,0DH,0EH,0FH - DB 41H,00H,0FH,00H,00H - DB 40,25 - -;320*400 256 couleurs -mode6 DB 063H, 00H, 03H,01H,0FH,00H,06H - DB 5FH,4FH,50H,82H,54H,80H,0BFH,1FH,00H,40H,00H,00H,00H,00H,00H,00H - DB 9CH,8EH,8FH,28H,00H,96H,0B9H,0E3H,0FFH - DB 00H,00H,00H,00H,00H,40H,05H,0FH,0FFH - DB 00H,01H,02H,03H,04H,05H,06H,07H,08H,09H,0AH,0BH,0CH,0DH,0EH,0FH - DB 41H,00H,0FH,00H,00H - DB 40,50 - -;320*480 256 couleurs -mode7 DB 0E3H, 00H, 03H,01H,0FH,00H,06H - DB 5FH,4FH,50H,82H,54H,80H,0BH,3EH,00H,40H,00H,00H,00H,00H,00H,00H - DB 0EAH,0ACH,0DFH,28H,00H,0E7H,06H,0E3H,0FFH - DB 00H,00H,00H,00H,00H,40H,05H,0FH,0FFH - DB 00H,01H,02H,03H,04h,05H,06H,07H,08H,09H,0AH,0BH,0CH,0DH,0EH,0FH - DB 41H,00H,0FH,00H,00H - DB 40,60 - -;360*480 256 couleurs -mode8 DB 0E7H, 00H, 03H,01H,0FH,00H,06H - DB 6BH,59H,5AH,8EH,5EH,8AH,0DH,3EH,00H,40H,00H,00H,00H,00H,00H,00H - DB 0EAH,0ACH,0DFH,2DH,00H,0E7H,06H,0E3H,0FFH - DB 00H,00H,00H,00H,00H,40H,05H,0FH,0FFH - DB 00H,01H,02H,03H,04h,05H,06H,07H,08H,09H,0AH,0BH,0CH,0DH,0EH,0FH - DB 41H,00H,0FH,00H,00H - DB 45,60 - -;400*600 256 couleurs -mode9 DB 0E7H, 00H, 03H,01H,0FH,00H,06H - DB 74h,63h,64h,97h,68h,95h,86h,0F0h,00h,60h,00h,00h,00h,00h,00h,00h - DB 5Bh,8Dh,57h,32h,00h,60h,80h,0E3h,0FFh - DB 00H,00H,00H,00H,00H,40H,05H,0FH,0FFH - DB 00H,01H,02H,03H,04h,05H,06H,07H,08H,09H,0AH,0BH,0CH,0DH,0EH,0FH - DB 41H,00H,0FH,00H,00H - DB 50,75 - -DATABLOCKSIZE equ 40 -DATABLOCK equ $ -;============================================DATABLOCK========================================================= -lines db 0 -columns db 0 -x db 0 -y db 0 -xy dw 0 -colors db 7 -mode db 0FFh -pagesize dw 0 -pages db 0 -font db 0 -graphic db 0 -xg dw 0 -yg dw 0 -style dw 0 -nbpage db 0 -pagesshowed db 0 -plane db 0 -xyg dw 0 -linesize dw 0 -adress dw 0 -base dw 0 -scrolling db 1 - -;=======================================Equivalence pour la clarté du code======================================== -Sequencer equ 03C4h -misc equ 03C2h -CCRT equ 03D4h -Attribs equ 03C0h -graphics equ 03CEh -statut equ 03DAh - -maxfunc equ 43 -maxmode equ 9 -planesize equ 64000 -;============================================Fonctions de l'int VIDEO=========================================== - -;=============ENABLESCROLLING (Fonction 02AH)========= -;Autorise le d‚filement -;-> AH=42 -;<- -;===================================================== - EnableScroll: - mov cs:scrolling,1 - ret - -;=============DISABLESCROLLING (Fonction 2Bh)========= -;D‚sactive le d‚filement -;-> AH=43 -;<- -;==============================================x======= -DisableScroll: - mov cs:scrolling,0 - ret - -;=============SetVideoMode (Fonction 00h)========= -;Fixe le mode vidéo courant a AL -;-> AH=0, AL mode d'écran -;<- Carry if error -;================================================= -setvideomode: - push ax cx dx di - cmp al,maxmode - ja errorsetvideomode - cmp cs:mode,0FFh - jne noinit - call initvideo -noinit: - mov cs:mode,al - xor ah,ah - mov di,ax - shl di,6 - add di,offset mode0 - mov dx,misc - mov al,cs:[di] - out dx,al - inc di - mov dx,statut - mov al,cs:[di] - out dx,al - inc di - mov dx,sequencer - xor ax,ax -initsequencer: - mov ah,cs:[di] - out dx,ax - inc al - inc di - cmp al,4 - jbe initsequencer - mov ax,0E11h - mov dx,ccrt - out dx,ax - xor ax,ax -initcrt: - mov ah,cs:[di] - out dx,ax - inc al - inc di - cmp al,24 - jbe initcrt - mov dx,graphics - xor ax,ax -initgraphic: - mov ah,cs:[di] - out dx,ax - inc al - inc di - cmp al,8 - jbe initgraphic - mov dx,statut - in al,dx - mov dx,attribs - xor ax,ax -initattribs: - mov ah,cs:[di] - push ax - in ax,dx - pop ax - out dx,al - xchg ah,al - out dx,al - xchg ah,al - inc al - inc di - cmp al,20 - jbe initattribs - mov al,20h - out dx,al - mov al,cs:[di] - mov cs:columns,al - mov ah,cs:[di+1] - mov cs:lines,ah - mul ah - shl ax,1 - cmp cs:mode,5 - setae cs:graphics - jb istext - shl ax,3 -istext: - mov cs:pagesize,ax - mov ax,planesize - xor dx,dx - div cs:pagesize - mov cs:nbpage,al - mov al,cs:[di-36] - xor ah,ah - shl ax,2 - mov cl,cs:graphics - shr ax,cl - mov cs:linesize,ax - mov ax,cs:[di-43] - mov cs:adress,ax - mov cs:base,ax - mov cs:pages,0 - pop di dx cx ax - ret -errorsetvideomode: - pop di dx cx ax - ret - -initvideo: - push bx cx si ds -;xor bx,bx -;mov ds,bx -;lds si,ds:[43h*4] - push cs - pop ds - mov si,offset font8x8 - mov cl,8 - mov bl,1 - call loadfont - mov cs:pagesize,64000 - call clearscreen - pop ds si cx bx - ret - -;=============GetVideoMode (Fonction 01h)========= -;Renvoie le mode vidéo courant dans AL -;-> AH=1 -;<- AL mode d'écran -;================================================= -getvideomode: - mov al,cs:mode - ret - -;=============CLEARSCREEN (Fonction 02h)========= -;Efface l'ecran graphique ou texte -;-> AH=2 -;<- -;================================================ -clearscreen: - push eax cx dx di es - mov cx,cs:pagesize - mov di,cs:adress - shr cx,2 - cmp byte ptr cs:graphics,1 - jne erasetext - mov ax,0A000h - mov es,ax -erasegraph: - mov ah,0 -gogot: - push ax cx - mov cl,ah - mov ah,1 - shl ah,cl - mov al,2 - mov dx,sequencer - out dx,ax - pop cx ax - push si di cx eax - mov eax,00000000h - rep stosd - pop eax cx di si - inc ah - cmp ah,3 - jbe gogot - jmp enderase -erasetext: - mov ax,0B800h - mov es,ax - mov eax,07200720h - cld - rep stosd -enderase: - mov cs:x,0 - mov cs:y,0 - mov cs:xg,0 - mov cs:yg,0 - mov cs:xy,0 - mov cs:xyg,0 - mov cs:plane,0 - pop es di dx cx eax - ret - - -;=============SetFont (Fonction 03h)========= -;Active la font cl parmi les 8 -;-> AH=3, CL n° font -;<- Carry if error -;============================================ -setfont: - push ax cx dx - cmp cl,7 - ja errorsetfont - mov cs:font,cl - mov ah,cl - and cl,11b - and ah,0100b - shl ah,2 - add ah,cl - mov dx,sequencer - mov al,3 - out dx,ax - pop dx cx ax - ret -errorsetfont: - pop dx cx ax - ret - -;=============GetFont (Fonction 0xh)========= -;Récupère le n° de la font active -;-> AH=x -;<- CL n° font, Carry if error -;============================================ -Getfont: - push ax cx dx - cmp cl,7 - ja errorgetfont - mov cs:font,cl - mov ah,cl - and cl,11b - and ah,0100b - shl ah,2 - add ah,cl - mov dx,sequencer - mov al,3 - out dx,ax - pop dx cx ax - ret -errorgetfont: - stc - pop dx cx ax - ret - -;=============LoadFont (Fonction 04h)========== -;Charge une police pointée par ds:si dans la carte vidéo sous n°font BL, taille police dans CL -;-> AH=4, BL n°font, DS:SI pointeur vers Font, CL taille police -;<- Carry if error -;=========================================== -loadfont: - push ax bx cx dx si di es - cmp bl,7 - ja errorloadfont - xor di,di - cli - mov dx,sequencer -doseq: - mov ax,cs:[di+offset reg1] - out dx,ax - inc di - inc di - cmp di,6 - jbe doseq - mov dx,graphics -doseq2: - mov ax,cs:[di+offset reg1] - out dx,ax - inc di - inc di - cmp di,6+6 - jbe doseq2 - sti - mov ax,0A000h - mov es,ax - mov dx,256 - mov al,0 - xor bh,bh - cmp bl,4 - jb isless - sub bl,4 - shl bl,1 - inc bl - jmp okmake -isless: - shl bl,1 -okmake: - mov di,bx - shl di,13 - mov bh,cl - mov bl,cl - sub bl,32 - neg bl - xor cx,cx - cld -popz: - mov cl,bh - rep movsb - mov cl,bl - rep stosb - dec dx - jnz popz - xor di,di - mov dx,sequencer -doseqs: - mov ax,cs:[di+offset reg2] - out dx,ax - inc di - inc di - cmp di,6 - jbe doseqs - mov dx,graphics -doseqs2: - mov ax,cs:[di+offset reg2] - out dx,ax - inc di - inc di - cmp di,6+6 - jbe doseqs2 - pop es di si dx cx bx ax - ret -errorloadfont: - stc - pop es di si dx cx bx ax - ret -reg2 dw 0100h, 0302h, 0304h, 0300h - dw 0004h, 1005h, 0E06h -reg1 dw 0100h, 0402h, 0704h, 0300h - dw 0204h, 0005h, 0406h - -;==========SHOWSPACE (Fonction 05h)=========== -;met un espace aprés le curseur -;-> AH=5 -;<- -;============================================= -showspace: - push cx - mov cl,' ' - mov ch,cs:colors - call charout - clc - pop cx - ret - -;==========SHOWLINE (Fonction 06h)=============== -;remet le curseur text a la ligne avec un retour chariot -;-> AH=6 -;<- -;================================================ -showline: - push bx cx - mov bl,cs:y - xor bh,bh - mov cl,cs:lines - sub cl,2 - cmp bl,cl - jne scro - dec bl - mov cx,1 - cmp byte ptr cs:graphics,0 - je okscro - mov cx,8 -okscro: - call scrolldown -scro: - inc bl - call setxy2 - pop cx bx - ret - -;==========SHOWCHAR (Fonction 07h)=========== -;met un caractère de code ASCII DL aprés le curseur -;-> AH=7, DL code ASCII du caractère -;<- -;============================================ -showchar: - push cx - mov cl,dl - mov ch,cs:colors - call charout - pop cx - ret - -;==========SHOWINT (Fonction 08h)=========== -;Affiche un entier EDX aprés le curseur -;-> AH=8, EDX un entier -;<- -;=========================================== -ShowInt: - push eax bx cx edx esi - xor cx,cx - mov eax,edx - mov esi,10 - mov bx,offset showbuffer+27 -decint: - xor edx,edx - div esi - add dl,'0' - inc cx - mov cs:[bx],dl - dec bx - cmp ax,0 - jne decint - mov ax,cx - mov ch,cs:colors -showinteger: - inc bx - mov cl,cs:[bx] - call charout - dec ax - jnz showinteger - pop esi edx cx bx eax - ret - -showbuffer db 35 dup (0FFh) - -;==========SHOWSIGNED (Fonction 09h)=========== -;Affiche un entier EDX de taille CX aprés le curseur -;-> AH=9, EDX un entier, CX la taille -;<- -;============================================== -Showsigned: - push ebx edx - mov ebx,edx - xor edx,edx - cmp cx,8 - ja signed16 - mov dl,bl - cmp dl,7Fh - jbe notsigned - neg dl - jmp showminus -signed16: - cmp cx,16 - ja signed32 - mov dx,bx - cmp dx,7FFFh - jbe notsigned - neg dx - jmp showminus -signed32: - mov edx,ebx - cmp edx,7FFFFFFFh - jbe notsigned - neg edx -showminus: - push dx - mov dl,'-' - call showchar - pop dx -notsigned: - call showint - pop edx ebx - ret - -;==========SHOWHEX (Fonction 0Ah)=========== -;Affiche un nombre hexadécimal EDX de taille CX aprés le curseur -;-> AH=10, EDX un entier, CX la taille -;<- -;=========================================== -ShowHex: - push ax bx cx edx - mov ax,cx - shr ax,2 - sub cx,32 - neg cx - shl edx,cl - mov ch,cs:colors -Hexaize: - rol edx,4 - mov bx,dx - and bx,0fh - mov cl,cs:[bx+offset Tab] - call charout - dec al - jnz Hexaize - pop edx cx bx ax - ret -Tab db '0123456789ABCDEF' - -;==========SHOWBIN (Fonction 0Bh)=========== -;Affiche un nombre binaire EDX de taille CX aprés le curseur -;-> AH=11, EDX un entier, CX la taille -;<- -;=========================================== -Showbin: - push ax cx edx - mov ax,cx - sub cx,32 - neg cx - shl edx,cl - mov ch,cs:colors -binaize: - rol edx,1 - mov cl,'0' - adc cl,0 - call charout - dec al - jnz binaize - pop edx cx ax - ret - -;==========SHOWBCD (Fonction 0xh)=========== -;Affiche un nombre en BCD EDX de taille CX aprés le curseur -;-> AH=x, EDX un entier, CX la taille -;<- -;=========================================== -ShowBCD: - push ax cx edx - mov ax,cx - shr ax,2 - sub cx,32 - neg cx - shl edx,cl - mov ch,cs:colors -BCDaize: - rol edx,4 - mov cl,dl - and cl,0fh - add cl,'0' - call charout - dec al - jnz BCDaize - pop edx cx ax - ret - -;==========SHOWSTRING (Fonction 0Ch)=========== -;Affiche une chaine de caractère pointée par DS:SI aprés le curseur -;-> AH=12, DS:SI pointeur chaine type pascal -;<- -;============================================== -showstring: - push bx cx si - mov bl,[si] - mov ch,cs:colors -strinaize: - inc si - mov cl,[si] - call charout - dec bl - jnz strinaize - pop si cx bx - ret - -;==========SHOWSTRING0 (Fonction 0Dh)=========== -;Affiche une chaine de caractère pointée par DS:SI aprés le curseur -;-> AH=13, DS:SI pointeur chaine type zéro terminal -;<- -;=============================================== -showstring0: - push cx si - mov ch,cs:colors -strinaize0: - mov cl,[si] - cmp cl,0 - je no0 - call charout - inc si - jmp strinaize0 -no0: - pop si cx - ret - -;==========SHOWCHARAT (Fonction 0Eh)=========== -;met un caractère de code ASCII DL en (x;y) (BH;BL) -;-> AH=14, DL code ASCII du caractère, BH coordonnées x, BL coordonnées y -;<- -;============================================== -showcharat: - push es di - call setxy - call showchar - pop di es - ret - -;==========SHOWINTAT (Fonction 0Fh)=========== -;Affiche un entier EDX en (x;y) (BH;BL) -;-> AH=15, EDX entier, BH coordonnées x, BL coordonnées y -;<- -;============================================== -showintat: - push es di - call setxy - call showint - pop di es - ret - -;==========SHOWSIGNEDAT (Fonction 10h)=========== -;Affiche un entier EDX de taille CX aprés le curseur en (x;y) (BH;BL) -;-> AH=16, EDX entier, BH coordonnées x, BL coordonnées y -;<- -;============================================== -showsignedat: - push es di - call setxy - call showsigned - pop di es - ret - -;==========SHOWHEXAT (Fonction 11h)=========== -;Affiche un nombre hexadécimal EDX de taille CX en (x;y) (BH;BL) -;-> AH=17, EDX un entier, CX la taille, BH coordonnées x, BL coordonnées y -;<- -;============================================== -showhexat: - push es di - call setxy - call showhex - pop di es - ret - -;==========SHOWBINAT (Fonction 012h)=========== -;Affiche un nombre binaire EDX de taille CX en (x;y) (BH;BL) -;-> AH=18, EDX un entier, CX la taille, BH coordonnées x, BL coordonnées y -;<- -;============================================= -showbinat: - push es di - call setxy - call showbin - pop di es - ret - -;==========SHOWSTRINGAT (Fonction 13h)=========== -;Affiche une chaine de caractère pointée par DS:SI en (x;y) (BH;BL) -;-> AH=19, DS:SI pointeur chaine type pascal, BH coordonnées x, BL coordonnées y -;<- -;================================================ -showstringat: - push es di - call setxy - call showstring - pop di es - ret - -;==========SHOWSTRING0AT (Fonction 14h)=========== -;Affiche une chaine de caractère pointée par DS:SI en (x;y) (BH;BL) -;-> AH=20, DS:SI pointeur chaine type zéro terminal, BH coordonnées x, BL coordonnées y -;<- -;================================================= -showstring0at: - push es di - call setxy - call showstring0 - pop di es - ret - -;==========SETCOLOR (Fonction 15h)========= -;Change les attributs du texte a CL -;-> AH=21 ,CL couleur -;<- -;========================================= -setcolor: - mov cs:colors,CL - ret - -;==========GETCOLOR (Fonction 16h)========= -;Récupère les attributs du texte dans CL -;-> AH=22 -;<- CL couleur -;========================================= -getcolor: - mov cl,cs:colors - ret - -;==========SETSTYLE (Fonction xh)========= -;Change le style du texte a CL -;-> AH=x ,CX style -;<- -;========================================= -setstyle: - mov cs:style,CX - ret - -;==========GETSTYLE (Fonction xh)========= -;Récupère le style du texte dans CL -;-> AH=x -;<- CX style -;========================================= -getstyle: - mov cx,cs:style - ret - -;==========SCROLLDOWN (Fonction 17h)========= -;defile de cx lines vers le bas -;-> AH=23, CX lines à défiler vers le bas -;<- -;============================= -scrolldown: - push ax cx dx si di ds es - cmp cs:scrolling,0 - je graphp - mov ax,cx - mul cs:linesize - mov si,ax - mov cx,cs:pagesize - sub cx,si - mov di,cs:adress - cld - cmp byte ptr cs:graphics,1 - jne textp - mov ax,0A000h - mov es,ax - mov ds,ax - shr cx,2 -transfert: - mov ah,0 -gogo: - push ax cx - mov cl,ah - mov ah,1 - shl ah,cl - mov al,2 - mov dx,sequencer - out dx,ax - pop cx ax - mov al,4 - mov dx,graphics - out dx,ax - push si di cx - rep movsd - pop cx di si - inc ah - cmp ah,3 - jbe gogo - jmp graphp -textp: - mov ax,0B800h - mov es,ax - mov ds,ax - rep movsb -graphp: - pop es ds di si dx cx ax - ret - -;==========GETXY (Fonction 18h)========= -;Change les coordonnées du curseur a X:BH,Y:BL -;-> AH=24 -;<- BH coordonnées x, BL coordonnées y -;============================= -getxy: - mov bh,cs:x - mov bl,cs:y - ret - -;==========SETXY (Fonction 19h)========= -;Change les coordonnées du curseur a X:BH,Y:BL -;-> AH=25, BH coordonnées x, BL coordonnées y -;<- -;===================================== -setxy: - push ax bx cx dx - mov cs:x,bh - mov cs:y,bl - mov al,bl - mov bl,bh - xor bh,bh - mov di,cs:adress - add di,bx - mul cs:columns - add di,ax - shl di,1 - mov cs:xy,di - cmp byte ptr cs:graphics,1 - jne oktext - mov bl,cs:x - mov cl,cs:y - xor bh,bh - xor ch,ch - shl bx,3 - shl cx,3 - call setxyg - jmp endofsetxy -oktext: - mov ax,0B800h - mov es,ax -endofsetxy: - pop dx cx bx ax - ret - -setxy2: - push es di - call setxy - pop di es - ret - -;==========SETXYG (Fonction 0xh)========= -;Change les coordonnées du curseur graphique a X:BX,Y:CX -;-> AH=x, BX coordonnées x, CX coordonnées y -;<- ES:DI pointeur sur pixel avec plan de bit ajusté -;====================================== -setxyg: - push ax bx cx dx - mov cs:xg,bx - mov cs:yg,cx - mov ax,cx - mov cl,bl - mul cs:linesize - shr bx,2 - add ax,bx - mov di,ax - and cl,3 - mov ah,1 - shl ah,cl - mov al,2 - mov dx, 3c4h - out dx,ax - mov cs:plane,cl - mov cs:xyg,di - mov ax,0A000h - mov es,ax - pop dx cx bx ax - ret - -;==========SHOWPIXEL (Fonction 0xh)========= -;Affiche un pixel de couleur AL en X:BX,Y:CX -;-> AH=x, BX coordonnées x, CX coordonnées y, AL couleur -;<- -;========================================= -showpixel: - push ax bx cx dx di bp es - mov bp,ax - mov ax,cx - mov cl,bl - mul cs:linesize - shr bx,2 - add ax,bx - mov di,ax - add di,cs:adress - and cl,3 - mov ah,1 - shl ah,cl - mov al,2 - mov dx,sequencer - out dx,ax - mov bx,0A000h - mov es,bx - mov ax,bp - mov es:[di],al - pop es bp di dx cx bx ax - ret - -;==========SHOWPIXEL (Fonction 0xh)========= -;Récupère en al la couleur du pixel de coordonnées X:BX,Y:CX -;-> AH=x, BX coordonnées x, CX coordonnées y, AL couleur -;<- -;========================================= -getpixel: - push ax bx cx dx di bp es - mov bp,ax - mov ax,cx - mov cl,bl - mul cs:linesize - shr bx,2 - add ax,bx - mov di,ax - add di,cs:adress - and cl,3 - mov ah,cl - mov al,4 - mov dx,graphics - out dx,ax - mov bx,0A000h - mov es,bx - mov ax,bp - - mov al,es:[di] - pop es bp di dx cx bx ax - ret - -;==========LOADBMPPALET (Fonction 0xh)========= -;Charge la palette du BMP pointée par DS:SI -;-> AH=x, DS:SI BMP -;<- -;============================================= -loadbmppalet: - push ax bx cx dx - mov bx,0400h+36h-4 - mov cx,100h - mov dx, 3c8h -paletteload: - mov al, cl - dec al - out dx, al - inc dx - mov al,[bx+si+2] - shr al,2 - out dx, al - mov al,[bx+si+1] - shr al,2 - out dx, al - mov al,[bx+si] - shr al,2 - out dx, al - sub bx,4 - dec dx - dec cl - jnz paletteload - pop dx cx bx ax - ret - -;==========VIEWBMP (Fonction 0xh)========= -;Affiche le BMP pointée par DS:SI en X:BX, Y:CX avec la préparation de la palette -;<- AH=x, DS:SI BMP, BX coordonnées X, CX coordonnées Y -;-> -;========================================= -viewbmp: - call loadbmppalet - call showbmp - ret - -;==========SHOWBMP (Fonction 0xh)========= -;Affiche le BMP pointée par DS:SI en X:BX, Y:CX -;<- AH=x, DS:SI BMP, BX coordonnées X, CX coordonnées Y -;-> -;========================================= -showbmp: - push ax bx cx dx - mov cs:xc,bx - mov cs:yc,cx - xor cx,cx - xor bx,bx - xor dx,dx -bouclette: - mov al,[si+bx+436h] - push bx cx - sub cx,cs:yc - neg cx - mov bx,dx - add bx,cs:xc - call showpixel - pop cx bx - inc bx - inc dx - cmp dx,[si+offset BMP_width] - jb bouclette - xor dx,dx - inc cx - cmp cx,[si+offset BMP_height] - jb bouclette - pop dx cx bx ax - ret -xc dw 0 -yc dw 0 - -;==========GETVGAINFO (Fonction 0xh)========= -;Renvoie un bloc de donnée en ES:DI sur l'état de la carte graphique -;<- AH=x, ES:DI pointeur -;-> -;============================================= -Getvgainfos: - push cx si di ds - push cs - pop ds - mov cx,datablocksize - mov si,offset datablock - cld - rep movsb - pop ds di si cx - ret - -;==========WAITRETRACE (Fonction 0xh)========= -;Synchronisation avec la retrace verticale -;<- AH=x -;-> -;============================================= -waitretrace: - push ax dx - mov dx,3DAh -waitr: - in al,dx - test al,8 - jz waitr - pop dx ax - ret - -;Ecrit le caractère ASCII CL attribut CH aprés le curseur, en le mettant à jours -charout: - push ax bx cx dx di es - cmp byte ptr cs:graphics,1 - jne textaccess - mov dx,cx - mov di,dx - and di,11111111b - shl di,3 - add di,offset font8x8 - xor bx,bx - xor cx,cx - mov ah,cs:[di] -bouclet: - mov al,dh - rol ah,1 - jc colored - shr al,4 - bt word ptr cs:style,0 - jc transparent -colored: - and al,1111b - push bx cx - add cx,cs:yg - add bx,cs:xg - call showpixel - pop cx bx -transparent: - inc bx - cmp bx,8 - jb bouclet - xor bx,bx - inc di - mov ah,cs:[di] - inc cx - cmp cx,8 - jb bouclet - add cs:xg,8 - mov cx,cs:linesize - shl cx,2 - cmp cs:xg,cx - jb adjusttext - mov cs:xg,0 - add cs:yg,8 - jmp adjusttext -textaccess: - mov ax,0B800h - mov es,ax - mov di,cs:xy - mov es:[di],cx - add cs:xy,2 -adjusttext: - inc cs:x - mov cl,cs:columns - cmp cs:x,cl - jb noadjusted - call showline -noadjusted: - ;mov dx,3D4h - ;mov al,0Eh - ;mov di,offset xy - ;mov ah,cs:[di] - ;out dx,ax - ;mov ah,cs:[di+1] - ;dec al - ;out dx,ax - pop es di dx cx bx ax - ret - - - - - - -;===================================sauve l'ecran rapidement================ -SaveScreen: - push cx si di ds es - mov cx,0B800H - mov ds,cx - push cs - pop es - mov cx,cs:pagesize - shr cx,2 - xor si,si - mov di,offset Copy2 - cld - rep movsd - pop es ds di si cx - ret - -;===================================sauve l'ecran rapidement en es:di================ -SaveScreento: - push cx si di ds - mov cx,0B800H - mov ds,cx - mov cx,cs:pagesize - shr cx,2 - xor si,si - cld - rep movsd - pop ds di si cx - ret - -;===================================sauve l'ecran rapidement================ -Savepage1: - push cx si di ds es - mov cx,0B800H - mov ds,cx - push cs - pop es - mov cx,cs:pagesize - shr cx,2 - xor si,si - mov di,offset Copy - cld - rep movsd - pop es ds di si cx - ret - -;===================================sauve l'ecran rapidement================ -RestoreScreen: - push cx si di ds es - mov cx,0B800H - mov es,cx - push cs - pop ds - mov cx,cs:pagesize - shr cx,2 - mov si,offset Copy2 - xor di,di - cld - rep movsd - pop es ds di si cx - ret - -;===================================restore l'ecran rapidement de ds:si================ -RestoreScreenfrom: - push cx si di ds es - mov cx,0B800H - mov es,cx - mov cx,cs:pagesize - shr cx,2 - xor di,di - cld - rep movsd - pop es ds di si cx - ret - -;===============================Page2to1============================ -Page2to1: - push cx si di ds es - mov cx,0B800H - mov es,cx - mov ds,cx - mov cx,cs:pagesize - shr cx,2 - mov si,4000 - xor di,di - cld - rep movsd - pop es ds di si cx - ret - -;===============================Page1to2============================ -Page1to2: - push cx si di ds es - mov cx,0B800H - mov es,cx - mov ds,cx - mov cx,cs:pagesize - shr cx,2 - mov di,4000 - xor si,si - cld - rep movsd - pop ds es di si cx - ret - -;===============================xchgPages============================ -xchgPages: - push cx si di ds es - call savepage1 - call page2to1 - mov cx,0B800H - mov es,cx - push cs - pop ds - mov cx,cs:pagesize - shr cx,2 - mov si,offset Copy - mov di,4000 - rep movsd - pop es ds di si cx - ret - -;Sauve l'‚tat de la carte en es:di -savestate: -push cx si di ds -push cs -pop ds -mov cx,datablocksize -mov si,offset lines -cld -rep movsb -call savescreento -pop ds di si cx -ret - -;R‚cupŠre l'‚tat de la carte en ds:si -restorestate: -push ax cx si di es -mov al,[si+7] -cmp cs:mode,al -je nochangemode -mov ah,0 -call setvideomode -nochangemode: -push cs -pop es -mov cx,datablocksize -mov di,offset lines -cld -rep movsb -call restorescreenfrom -pop es di si cx ax -ret - -;sauve le DAC -savedac: -push ax cx dx di -mov dx,3C7h -xor ax,ax -out dx,al -mov cx,256*3 -inc dx -inc dx -mov di,offset dac -save: -in al,dx -mov cs:[di],al -inc di -dec cx -jne save -pop di dx cx ax -ret - -;restore le DAC -restoredac: -push ax cx dx si -xor ax,ax -cli -mov dx,3DAh -in al,dx -mov dx,0 -out dx,al -mov dx,3C8h -out dx,al -mov cx,256*3 -mov si,offset dac -save2: -mov al,cs:[si] -inc si -out dx,al -dec cx -jne save2 -mov dx,3DAh -in al,dx -mov dx,32 -out dx,al -pop si dx cx ax -ret - -;couleur al pour ligne di -changelineattr: -push ax bx di es -mov bx,ax -mov ax,0B800h -mov es,ax -mov ax,di -mul cs:columns -mov di,ax -shl di,1 -mov al,cs:columns -inc di -popep: -mov es:[di],bl -add di,2 -dec al -jnz popep -pop es di bx ax -ret - - - - - - - - - - - - - - - - -BMP_File struc -BMP_FileType db 'BM' -BMP_FileSize dd ? ; taille du fichier -BMP_Reserved dd 0 ; toujours 0 -BMP_BitMapOffset dd ? ; offset de l'image -BMP_HeaderSize dd ? ; taille de l'entete en octects -BMP_Width dd ? ; largeur en pixels de l'image -BMP_Height dd ? ; hauteur en pixels de l'image -BMP_Planes dw 1 ; nombre de plan utilisés -BMP_BitsPerPixel dw ? ; nombre de bits par pixels -BMP_Compression dd ? ; méthode de compression -BMP_SizeOfBitMap dd ? ; taille de l'image en octects -BMP_HorzResolution dd ? ; resolution horizontale en pixels par mètre -BMP_VertResolution dd ? ; resolution verticale en pixels par mètre -BMP_ColorsUsed dd ? ; nombre de couleur dans la palette si 0: palette entière si BitPerPixel<=8 -BMP_ColorsImportant dd ? ; nombre de couleurs importantes masques pour les modes de plus de 8 bits par pixels -BMP_RedMask dd ? -BMP_GreenMask dd ? -BMP_BlueMask dd ? -BMP_AlphaMask dd ? -BMP_ColorSpaceType dd ? -BMP_RedX dd ? -BMP_RedY dd ? -BMP_RedZ dd ? -BMP_GreenX dd ? -BMP_GreenY dd ? -BMP_GreenZ dd ? -BMP_BlueX dd ? -BMP_BlueY dd ? -BMP_BlueZ dd ? -BMP_GammaRed dd ? -BMP_GammaGreen dd ? -BMP_GammeBlue dd ? -BMP_file ends - -;BMP_Compression peut prendre les valeurs suivantes: -BMP_COMP_UNCOMP equ 0 ; pas de compression -BMP_COMP_RLE8 equ 1 ; 8-bit run length encoding -BMP_COMP_RLE4 equ 2 ; 4-bit tun length encoding -BMP_COMP_BFE equ 3 ; bitfields encoding - - -font8x8 equ $ -copy equ $+3000 -copy2 equ $+8000 -dac equ $+16000 -end start +.model tiny +.486 +smart +.code + +org 0100h + +include ..\include\bmp.h + +start: + jmp tsr ;Saute à la routine résidente +names db 'VIDEO' ;Nom drivers +id dw 1234h ;Identifiant drivers +Tsr: + cli ;Désactive interruptions logiciellement + cmp ax,cs:ID ;Compare si test de chargement + jne nomore ;Si pas test alors on continu + rol ax,3*4 ;Rotation de 3 chiffre de l'ID pour montrer que le drivers est chargé + jmp itsok ;On termine l'int avec notre code d'ID preuve du bon chargement de VIDEO +nomore: + cmp ah,maxfunc + jbe noerrorint + stc + jmp itsok + noerrorint: + clc + push bx + mov bl,ah ;On calcule d'aprés le n° de fonction + xor bh,bh ;quel sera l'entrée dans la table indexée + shl bx,1 ;des adresses fonctions. + mov bx,cs:[bx+tables] ;On récupère cette adresse depuis la table + mov cs:current,bx ;On la stocke temporairement pour obtenir les registres d'origine + pop bx + clc + call cs:current ;Puis on execute la fonction +itsok: + push bp + mov bp,sp ;On prend sp dans bp pour adresser la pile + jnc noerror ;La fonction appelée a renvoyer une erreur : Flag CARRY ? + or byte ptr [bp+6],1b;Si oui on le retranscrit sur le registre FLAG qui sera dépilé lors du IRET + ;xor eax,eax + ;mov ax,cs ;On récupère le segment et l'offset puis en renvoie l'adresse physique + ;shl eax,4 ;de l'erreur. + ;add ax,cs:current + ;jmp endofint ;on termine l'int +noerror: + and byte ptr [bp+6],0FEh;Si pas d'erreur on efface le Bit CARRY du FLAG qui sera dépilé lors du IRET +endofint: + pop bp + sti ;On réactive les interruptions logiciellement + iret ;Puis on retourne au programme appelant. + +current dw 0 ;Mot temporaire qui contient l'adresse de la fonction appelée +tables dw setvideomode ;Table qui contient les adresses de toutes les fonctions de VIDEO (WORD) + dw getvideomode + dw clearscreen + dw setfont + dw loadfont + dw showspace + dw showline + dw showchar + dw showint + dw showsigned + dw showhex + dw showbin + dw showstring + dw showstring0 + dw showcharat + dw showintat + dw showsignedat + dw showhexat + dw showbinat + dw showstringat + dw showstring0at + dw setcolor + dw getcolor + dw scrolldown + dw getxy + dw setxy2 + dw savescreen + dw restorescreen + dw page2to1 + dw page1to2 + dw xchgPages + dw savepage1 + dw changelineattr + dw waitretrace + dw getvgainfos + dw loadbmppalet + dw showbmp + dw viewbmp + dw savedac + dw restoredac + dw savestate + dw restorestate + dw enablescroll + dw disablescroll + dw showdate + dw showtime + dw showname + dw showattr + dw showsize + +;================================Table des modes videos (64 BYTES) ============================================ +;40*25 16 couleurs +mode0 DB 67H,00H, 03H,08H,03H,00H,02H + DB 2DH,27H,28H,90H,2BH,0A0H,0BFH,01FH,00H,4FH,0DH,0EH,00H,00H,00H,00H + DB 9CH,8EH,8FH,14H,1FH,96H,0B9H,0A3H,0FFH + DB 00H,00H,00H,00H,00H,10H,0EH,00H,0FFH + DB 00H,01H,02H,03H,04H,05H,14H,07H,38H,39H,3AH,3BH,3CH,3DH,3EH,3FH + DB 0CH,00H,0FH,08H,00H + DB 40,25 + +;80*25 16 couleurs +mode1 DB 67H,00H, 03H,00H,03H,00H,02H + DB 5FH,4FH,50H,82H,55H,81H,0BFH,1FH,00H,4FH,0DH,0EH,00H,00H,00H,00H + DB 9CH,0EH,8FH,28H,1FH,96H,0B9H,0A3h,0FFH + DB 00H,00H,00H,00H,00H,10H,0EH,00H,0FFH + DB 00H,01H,02H,03H,04H,05H,14H,07H,38H,39H,3AH,3BH,3CH,3DH,3EH,3FH + DB 0CH,00H,0FH,08H,00H + DB 80,25 + +;80*50 16 couleurs +mode2 DB 63H, 00H, 03H,01H,03H,01H,02H + DB 5FH,4FH,50H,82H,55H,81H,0BFH,1FH,00H,47H,06H,07H,00H,00H,00H + DB 00H,9CH,8EH,8FH,28H,1FH,96H,0B9H,0A3H,0FFH + DB 00H,00H,00H,00H,00H,10H,0EH,00H,0FFH + DB 00H,01H,02H,03H,04H,05H,14H,07H,10H,11H,3AH,3BH,3CH,3DH,3EH,3FH + DB 0CH,00H,0FH,00H,00H + DB 80,50 + +;100*50 16 couleurs +mode3 DB 067H,00H,03H,01H,03H,01H,02H + DB 70H,63H,64H,85H,68H,84H,0BFH,1FH,00H,47H,06H,07H,00H,00H,00H + DB 00H,9Ch,08EH,8FH,32H,1FH,96H,0B9H,0A3H,0FFH + DB 00H,00H,00H,00H,00H,10H,0EH,00H,0FFH + DB 00H,01H,02H,03H,04H,05H,14H,07H,10H,11H,3AH,3BH,3CH,3DH,3EH,3FH + DB 0CH,00H,0FH,00H,00H + DB 100,50 + +;100*60 16 couleurs +mode4 DB 0A7H,00H,03H,01H,03H,01H,02H + DB 70H,63H,64H,85H,68H,84H,0FFH,1FH,00H,47H,06H,07H,00H,00H,00H + DB 00H,0E7H,8EH,0DFH,32H,1FH,0DFH,0E5H,0A3H,0FFH + DB 00H,00H,00H,00H,00H,10H,0EH,00H,0FFH + DB 00H,01H,02H,03H,04H,05H,14H,07H,10H,11H,3AH,3BH,3CH,3DH,3EH,3FH + DB 0CH,00H,0FH,00H,00H + DB 100,60 + +;320*200 256 couleurs +mode5 DB 63H, 00H, 03H,01H,0FH,00H,06H + DB 5FH,4FH,50H,82H,54H,80H,0BFH,1FH,00H,41H,00H,00H,00H,00H,00H,00H + DB 9CH,0EH,8FH,28H,00H,96H,0B9H,0E3H,0FFH + DB 00H,00H,00H,00H,00H,40H,05H,0FH,0FFH + DB 00H,01H,02H,03H,04H,05H,06H,07H,08H,09H,0AH,0BH,0CH,0DH,0EH,0FH + DB 41H,00H,0FH,00H,00H + DB 40,25 + +;320*400 256 couleurs +mode6 DB 063H, 00H, 03H,01H,0FH,00H,06H + DB 5FH,4FH,50H,82H,54H,80H,0BFH,1FH,00H,40H,00H,00H,00H,00H,00H,00H + DB 9CH,8EH,8FH,28H,00H,96H,0B9H,0E3H,0FFH + DB 00H,00H,00H,00H,00H,40H,05H,0FH,0FFH + DB 00H,01H,02H,03H,04H,05H,06H,07H,08H,09H,0AH,0BH,0CH,0DH,0EH,0FH + DB 41H,00H,0FH,00H,00H + DB 40,50 + +;320*480 256 couleurs +mode7 DB 0E3H, 00H, 03H,01H,0FH,00H,06H + DB 5FH,4FH,50H,82H,54H,80H,0BH,3EH,00H,40H,00H,00H,00H,00H,00H,00H + DB 0EAH,0ACH,0DFH,28H,00H,0E7H,06H,0E3H,0FFH + DB 00H,00H,00H,00H,00H,40H,05H,0FH,0FFH + DB 00H,01H,02H,03H,04h,05H,06H,07H,08H,09H,0AH,0BH,0CH,0DH,0EH,0FH + DB 41H,00H,0FH,00H,00H + DB 40,60 + +;360*480 256 couleurs +mode8 DB 0E7H, 00H, 03H,01H,0FH,00H,06H + DB 6BH,59H,5AH,8EH,5EH,8AH,0DH,3EH,00H,40H,00H,00H,00H,00H,00H,00H + DB 0EAH,0ACH,0DFH,2DH,00H,0E7H,06H,0E3H,0FFH + DB 00H,00H,00H,00H,00H,40H,05H,0FH,0FFH + DB 00H,01H,02H,03H,04h,05H,06H,07H,08H,09H,0AH,0BH,0CH,0DH,0EH,0FH + DB 41H,00H,0FH,00H,00H + DB 45,60 + +;400*600 256 couleurs +mode9 DB 0E7H, 00H, 03H,01H,0FH,00H,06H + DB 74h,63h,64h,97h,68h,95h,86h,0F0h,00h,60h,00h,00h,00h,00h,00h,00h + DB 5Bh,8Dh,57h,32h,00h,60h,80h,0E3h,0FFh + DB 00H,00H,00H,00H,00H,40H,05H,0FH,0FFH + DB 00H,01H,02H,03H,04h,05H,06H,07H,08H,09H,0AH,0BH,0CH,0DH,0EH,0FH + DB 41H,00H,0FH,00H,00H + DB 50,75 + +DATABLOCKSIZE equ 40 +DATABLOCK equ $ +;============================================DATABLOCK========================================================= +lines db 0 +columns db 0 +x db 0 +y db 0 +xy dw 0 +colors db 7 +mode db 0FFh +pagesize dw 0 +pages db 0 +font db 0 +graphic db 0 +xg dw 0 +yg dw 0 +style dw 0 +nbpage db 0 +pagesshowed db 0 +plane db 0 +xyg dw 0 +linesize dw 0 +adress dw 0 +base dw 0 +scrolling db 1 + +;=======================================Equivalence pour la clarté du code======================================== +Sequencer equ 03C4h +misc equ 03C2h +CCRT equ 03D4h +Attribs equ 03C0h +graphics equ 03CEh +statut equ 03DAh + +maxfunc equ 48 +maxmode equ 9 +planesize equ 64000 +;============================================Fonctions de l'int VIDEO=========================================== + +;=============ENABLESCROLLING (Fonction 02AH)========= +;Autorise le d‚filement +;-> AH=42 +;<- +;===================================================== + EnableScroll: + mov cs:scrolling,1 + ret + +;=============DISABLESCROLLING (Fonction 2Bh)========= +;D‚sactive le d‚filement +;-> AH=43 +;<- +;===================================================== +DisableScroll: + mov cs:scrolling,0 + ret + +;================SHOWDATE (Fonction 2Ch)============== +;Affiche la date contenu en DX +;-> AH=44 +;<- +;===================================================== +ShowDate: + push ax cx edx + mov ax,dx + mov cx,2 + xor edx,edx + mov dx,ax + and dx,11111b + call showfixint + mov dl,'/' + call showchar + mov dx,ax + shr dx,5 + and dx,111b + call showfixint + mov dl,'/' + call showchar + mov dx,ax + shr dx,8 + and dx,11111111b + add dx,1956 + mov cx,4 + call showfixint + pop edx cx ax + ret + +;================SHOWTIME (Fonction 2Dh)============== +;Affiche l'heure contenu en DX +;-> AH=45 +;<- +;===================================================== +ShowTime: + push ax cx edx + mov ax,dx + mov cx,2 + xor edx,edx + mov dx,ax + shr dx,11 + and dx,11111b + call showfixint + mov dl,':' + call showchar + mov dx,ax + shr dx,5 + and dx,111111b + call showfixint + mov dl,':' + call showchar + mov dx,ax + and dx,11111b + shl dx,1 + call showfixint + pop edx cx ax + ret + +;================SHOWNAME (Fonction 2Eh)============== +;Affiche le nom pointé par SI +;-> AH=46 +;<- +;===================================================== +ShowName: + push cx dx si + xor cx,cx +showthename: + mov dl,ds:[si] + call showchar + inc si + inc cx + cmp cx,8 + jne suiteaname + mov dl,' ' + call showchar +suiteaname: + cmp cx,8+3 + jb showthename + pop si dx cx + ret + +;================SHOWATTR (Fonction 2Fh)============== +;Affiche les attributs spécifié par DL +;-> AH=47 +;<- +;===================================================== +ShowAttr: + push dx + mov al,dl + + test al,00000001b + je noreadonly + mov dl,'L' + jmp readonly +noreadonly: + mov dl,'-' +readonly: + call showchar + + test al,00000010b + je nohidden + mov dl,'C' + jmp hidden +nohidden: + mov dl,'-' +hidden: + call showchar + + test al,00000100b + je nosystem + mov dl,'S' + jmp system +nosystem: + mov dl,'-' +system: + call showchar + + test al,00100000b + je noarchive + mov dl,'A' + jmp archive +noarchive: + mov dl,'-' +archive: + call showchar + + test al,00010000b + je nodirectory + mov dl,'R' + jmp directory +nodirectory: + mov dl,'-' +directory: + call showchar + + pop dx + ret + +;================SHOWSIZE (Fonction 30h)============== +;Affiche le nom pointé par DI +;-> AH=48 +;<- +;===================================================== +ShowSize: + push cx edx si ds + push cs + pop ds + mov cx,4 + cmp edx,1073741824 + ja giga + cmp edx,1048576*9 + ja mega + cmp edx,1024*9 + ja kilo + call showintR + mov si,offset unit + call showstring0 + jmp finsize +kilo: + shr edx,10 + call showintR + mov si,offset unitkilo + call showstring0 + jmp finsize +mega: + shr edx,20 + call showintR + mov si,offset unitmega + call showstring0 + jmp finsize +giga: + shr edx,30 + call showintR + mov si,offset unitgiga + call showstring0 +finsize: + pop ds si edx cx + ret + +unit db ' o ',0 +unitkilo db ' ko',0 +unitmega db ' mo',0 +unitgiga db ' go',0 + +;=============SetVideoMode (Fonction 00h)========= +;Fixe le mode vidéo courant a AL +;-> AH=0, AL mode d'écran +;<- Carry if error +;================================================= +setvideomode: + push ax cx dx di + cmp al,maxmode + ja errorsetvideomode + cmp cs:mode,5h + jb nographic + cmp al,5h + jae nographic + call initvideo +nographic: + cmp cs:mode,0FFh + jne noinit + call initvideo +noinit: + mov cs:mode,al + xor ah,ah + mov di,ax + shl di,6 + add di,offset mode0 + mov dx,misc + mov al,cs:[di] + out dx,al + inc di + mov dx,statut + mov al,cs:[di] + out dx,al + inc di + mov dx,sequencer + xor ax,ax +initsequencer: + mov ah,cs:[di] + out dx,ax + inc al + inc di + cmp al,4 + jbe initsequencer + mov ax,0E11h + mov dx,ccrt + out dx,ax + xor ax,ax +initcrt: + mov ah,cs:[di] + out dx,ax + inc al + inc di + cmp al,24 + jbe initcrt + mov dx,graphics + xor ax,ax +initgraphic: + mov ah,cs:[di] + out dx,ax + inc al + inc di + cmp al,8 + jbe initgraphic + mov dx,statut + in al,dx + mov dx,attribs + xor ax,ax +initattribs: + mov ah,cs:[di] + push ax + in ax,dx + pop ax + out dx,al + xchg ah,al + out dx,al + xchg ah,al + inc al + inc di + cmp al,20 + jbe initattribs + mov al,20h + out dx,al + mov al,cs:[di] + mov cs:columns,al + mov ah,cs:[di+1] + mov cs:lines,ah + mul ah + shl ax,1 + cmp cs:mode,5 + setae cs:graphics + jb istext + shl ax,3 +istext: + mov cs:pagesize,ax + mov ax,planesize + xor dx,dx + div cs:pagesize + mov cs:nbpage,al + mov al,cs:[di-36] + xor ah,ah + shl ax,2 + mov cl,cs:graphics + shr ax,cl + mov cs:linesize,ax + mov ax,cs:[di-43] + mov cs:adress,ax + mov cs:base,ax + mov cs:pages,0 + pop di dx cx ax + ret +errorsetvideomode: + pop di dx cx ax + ret + +initvideo: + push bx cx si ds +;xor bx,bx +;mov ds,bx +;lds si,ds:[43h*4] + push cs + pop ds + mov si,offset font8x8 + mov cl,8 + mov bl,1 + call loadfont + mov si,offset font8x16 + mov cl,16 + mov bl,0 + call loadfont + mov cs:pagesize,64000 + call clearscreen + pop ds si cx bx + ret + +;=============GetVideoMode (Fonction 01h)========= +;Renvoie le mode vidéo courant dans AL +;-> AH=1 +;<- AL mode d'écran +;================================================= +getvideomode: + mov al,cs:mode + ret + +;=============CLEARSCREEN (Fonction 02h)========= +;Efface l'ecran graphique ou texte +;-> AH=2 +;<- +;================================================ +clearscreen: + push eax cx dx di es + mov cx,cs:pagesize + mov di,cs:adress + shr cx,2 + cmp byte ptr cs:graphics,1 + jne erasetext + mov ax,0A000h + mov es,ax +erasegraph: + mov ah,0 +gogot: + push ax cx + mov cl,ah + mov ah,1 + shl ah,cl + mov al,2 + mov dx,sequencer + out dx,ax + pop cx ax + push si di cx eax + mov eax,00000000h + rep stosd + pop eax cx di si + inc ah + cmp ah,3 + jbe gogot + jmp enderase +erasetext: + mov ax,0B800h + mov es,ax + mov eax,07200720h + cld + rep stosd +enderase: + mov cs:x,0 + mov cs:y,0 + mov cs:xg,0 + mov cs:yg,0 + mov cs:xy,0 + mov cs:xyg,0 + mov cs:plane,0 + pop es di dx cx eax + ret + + +;=============SetFont (Fonction 03h)========= +;Active la font cl parmi les 8 +;-> AH=3, CL n° font +;<- Carry if error +;============================================ +setfont: + push ax cx dx + cmp cl,7 + ja errorsetfont + mov cs:font,cl + mov ah,cl + and cl,11b + and ah,0100b + shl ah,2 + add ah,cl + mov dx,sequencer + mov al,3 + out dx,ax + pop dx cx ax + ret +errorsetfont: + pop dx cx ax + ret + +;=============GetFont (Fonction 0xh)========= +;Récupère le n° de la font active +;-> AH=x +;<- CL n° font, Carry if error +;============================================ +Getfont: + push ax cx dx + cmp cl,7 + ja errorgetfont + mov cs:font,cl + mov ah,cl + and cl,11b + and ah,0100b + shl ah,2 + add ah,cl + mov dx,sequencer + mov al,3 + out dx,ax + pop dx cx ax + ret +errorgetfont: + stc + pop dx cx ax + ret + +;=============LoadFont (Fonction 04h)========== +;Charge une police pointée par ds:si dans la carte vidéo sous n°font BL, taille police dans CL +;-> AH=4, BL n°font, DS:SI pointeur vers Font, CL taille police +;<- Carry if error +;=========================================== +loadfont: + push ax bx cx dx si di es + cmp bl,7 + ja errorloadfont + xor di,di + cli + mov dx,sequencer +doseq: + mov ax,cs:[di+offset reg1] + out dx,ax + inc di + inc di + cmp di,6 + jbe doseq + mov dx,graphics +doseq2: + mov ax,cs:[di+offset reg1] + out dx,ax + inc di + inc di + cmp di,6+6 + jbe doseq2 + sti + mov ax,0A000h + mov es,ax + mov dx,256 + mov al,0 + xor bh,bh + cmp bl,4 + jb isless + sub bl,4 + shl bl,1 + inc bl + jmp okmake +isless: + shl bl,1 +okmake: + mov di,bx + shl di,13 + mov bh,cl + mov bl,cl + sub bl,32 + neg bl + xor cx,cx + cld +popz: + mov cl,bh + rep movsb + mov cl,bl + rep stosb + dec dx + jnz popz + xor di,di + mov dx,sequencer +doseqs: + mov ax,cs:[di+offset reg2] + out dx,ax + inc di + inc di + cmp di,6 + jbe doseqs + mov dx,graphics +doseqs2: + mov ax,cs:[di+offset reg2] + out dx,ax + inc di + inc di + cmp di,6+6 + jbe doseqs2 + pop es di si dx cx bx ax + ret +errorloadfont: + stc + pop es di si dx cx bx ax + ret + +reg2 dw 0100h, 0302h, 0304h, 0300h + dw 0004h, 1005h, 0E06h +reg1 dw 0100h, 0402h, 0704h, 0300h + dw 0204h, 0005h, 0406h + +;==========SHOWSPACE (Fonction 05h)=========== +;met un espace aprés le curseur +;-> AH=5 +;<- +;============================================= +showspace: + push cx + mov cl,' ' + mov ch,cs:colors + call charout + clc + pop cx + ret + +;==========SHOWLINE (Fonction 06h)=============== +;remet le curseur text a la ligne avec un retour chariot +;-> AH=6 +;<- +;================================================ +showline: + push bx cx + mov bl,cs:y + xor bh,bh + mov cl,cs:lines + sub cl,2 + cmp bl,cl + jne scro + dec bl + mov cx,1 + cmp byte ptr cs:graphics,0 + je okscro + mov cx,8 +okscro: + call scrolldown +scro: + inc bl + call setxy2 + pop cx bx + ret + +;==========SHOWCHAR (Fonction 07h)=========== +;met un caractère de code ASCII DL aprés le curseur +;-> AH=7, DL code ASCII du caractère +;<- +;============================================ +showchar: + push cx + mov cl,dl + mov ch,cs:colors + call charout + pop cx + ret + +;==========SHOWINT (Fonction 08h)=========== +;Affiche un entier EDX aprés le curseur +;-> AH=8, EDX un entier +;<- +;=========================================== +ShowInt: + push eax bx cx edx esi + xor cx,cx + mov eax,edx + mov esi,10 + mov bx,offset showbuffer+27 +decint: + xor edx,edx + div esi + add dl,'0' + inc cx + mov cs:[bx],dl + dec bx + cmp ax,0 + jne decint + mov ax,cx + mov ch,cs:colors +showinteger: + inc bx + mov cl,cs:[bx] + call charout + dec ax + jnz showinteger + pop esi edx cx bx eax + ret + +showbuffer db 35 dup (0FFh) + +;==========SHOWFIXINT (Fonction h)=========== +;Affiche un entier EDX aprés le curseur de taille cx +;-> AH=8, EDX un entier et al="cara" +;<- +;=========================================== +ShowfixInt: + push eax bx cx edx esi di + mov di,cx + xor cx,cx + mov eax,edx + mov esi,10 + mov bx,offset showbuffer+27 +decint2: + xor edx,edx + div esi + add dl,'0' + inc cx + mov cs:[bx],dl + dec bx + cmp cx,di + jae nomuch + cmp ax,0 + jne decint2 + mov ax,di + xchg cx,di + sub cx,di +rego: + mov byte ptr cs:[bx],'0' + dec bx + dec cx + jnz rego + jmp finishim +nomuch: + mov ax,di +finishim: + mov ch,cs:colors +showinteger2: + inc bx + mov cl,cs:[bx] + call charout + dec ax + jnz showinteger2 + pop di esi edx cx bx eax + ret + +;==========SHOWINTR (Fonction h)=========== +;Affiche un entier EDX aprés le curseur de taille cx +;-> AH=8, EDX un entier +;<- +;=========================================== +ShowIntR: + push eax bx cx edx esi di + mov di,cx + xor cx,cx + mov eax,edx + mov esi,10 + mov bx,offset showbuffer+27 +decint3: + xor edx,edx + div esi + add dl,'0' + inc cx + mov cs:[bx],dl + dec bx + cmp cx,di + jae nomuch + cmp ax,0 + jne decint3 + mov ax,di + xchg cx,di + sub cx,di +rego2: + mov byte ptr cs:[bx],' ' + dec bx + dec cx + jnz rego2 + jmp finishim2 +nomuch2: + mov ax,di +finishim2: + mov ch,cs:colors +showinteger3: + inc bx + mov cl,cs:[bx] + call charout + dec ax + jnz showinteger3 + pop di esi edx cx bx eax + ret + +;==========SHOWSIGNED (Fonction 09h)=========== +;Affiche un entier EDX de taille CX aprés le curseur +;-> AH=9, EDX un entier, CX la taille +;<- +;============================================== +Showsigned: + push ebx edx + mov ebx,edx + xor edx,edx + cmp cx,8 + ja signed16 + mov dl,bl + cmp dl,7Fh + jbe notsigned + neg dl + jmp showminus +signed16: + cmp cx,16 + ja signed32 + mov dx,bx + cmp dx,7FFFh + jbe notsigned + neg dx + jmp showminus +signed32: + mov edx,ebx + cmp edx,7FFFFFFFh + jbe notsigned + neg edx +showminus: + push dx + mov dl,'-' + call showchar + pop dx +notsigned: + call showint + pop edx ebx + ret + +;==========SHOWHEX (Fonction 0Ah)=========== +;Affiche un nombre hexadécimal EDX de taille CX aprés le curseur +;-> AH=10, EDX un entier, CX la taille +;<- +;=========================================== +ShowHex: + push ax bx cx edx + mov ax,cx + shr ax,2 + sub cx,32 + neg cx + shl edx,cl + mov ch,cs:colors +Hexaize: + rol edx,4 + mov bx,dx + and bx,0fh + mov cl,cs:[bx+offset Tab] + call charout + dec al + jnz Hexaize + pop edx cx bx ax + ret + +Tab db '0123456789ABCDEF' + +;==========SHOWBIN (Fonction 0Bh)=========== +;Affiche un nombre binaire EDX de taille CX aprés le curseur +;-> AH=11, EDX un entier, CX la taille +;<- +;=========================================== +Showbin: + push ax cx edx + mov ax,cx + sub cx,32 + neg cx + shl edx,cl + mov ch,cs:colors +binaize: + rol edx,1 + mov cl,'0' + adc cl,0 + call charout + dec al + jnz binaize + pop edx cx ax + ret + +;==========SHOWBCD (Fonction 0xh)=========== +;Affiche un nombre en BCD EDX de taille CX aprés le curseur +;-> AH=x, EDX un entier, CX la taille +;<- +;=========================================== +ShowBCD: + push ax cx edx + mov ax,cx + shr ax,2 + sub cx,32 + neg cx + shl edx,cl + mov ch,cs:colors +BCDaize: + rol edx,4 + mov cl,dl + and cl,0fh + add cl,'0' + call charout + dec al + jnz BCDaize + pop edx cx ax + ret + +;==========SHOWSTRING (Fonction 0Ch)=========== +;Affiche une chaine de caractère pointée par DS:SI aprés le curseur +;-> AH=12, DS:SI pointeur chaine type pascal +;<- +;============================================== +showstring: + push bx cx si + mov bl,[si] + mov ch,cs:colors +strinaize: + inc si + mov cl,[si] + call charout + dec bl + jnz strinaize + pop si cx bx + ret + +;==========SHOWSTRING0 (Fonction 0Dh)=========== +;Affiche une chaine de caractère pointée par DS:SI aprés le curseur +;-> AH=13, DS:SI pointeur chaine type zéro terminal +;<- +;=============================================== +showstring0: + push cx si + mov ch,cs:colors +strinaize0: + mov cl,[si] + cmp cl,0 + je no0 + call charout + inc si + jmp strinaize0 +no0: + pop si cx + ret + +;==========SHOWCHARAT (Fonction 0Eh)=========== +;met un caractère de code ASCII DL en (x;y) (BH;BL) +;-> AH=14, DL code ASCII du caractère, BH coordonnées x, BL coordonnées y +;<- +;============================================== +showcharat: + push es di + call setxy + call showchar + pop di es + ret + +;==========SHOWINTAT (Fonction 0Fh)=========== +;Affiche un entier EDX en (x;y) (BH;BL) +;-> AH=15, EDX entier, BH coordonnées x, BL coordonnées y +;<- +;============================================== +showintat: + push es di + call setxy + call showint + pop di es + ret + +;==========SHOWSIGNEDAT (Fonction 10h)=========== +;Affiche un entier EDX de taille CX aprés le curseur en (x;y) (BH;BL) +;-> AH=16, EDX entier, BH coordonnées x, BL coordonnées y +;<- +;============================================== +showsignedat: + push es di + call setxy + call showsigned + pop di es + ret + +;==========SHOWHEXAT (Fonction 11h)=========== +;Affiche un nombre hexadécimal EDX de taille CX en (x;y) (BH;BL) +;-> AH=17, EDX un entier, CX la taille, BH coordonnées x, BL coordonnées y +;<- +;============================================== +showhexat: + push es di + call setxy + call showhex + pop di es + ret + +;==========SHOWBINAT (Fonction 012h)=========== +;Affiche un nombre binaire EDX de taille CX en (x;y) (BH;BL) +;-> AH=18, EDX un entier, CX la taille, BH coordonnées x, BL coordonnées y +;<- +;============================================= +showbinat: + push es di + call setxy + call showbin + pop di es + ret + +;==========SHOWSTRINGAT (Fonction 13h)=========== +;Affiche une chaine de caractère pointée par DS:SI en (x;y) (BH;BL) +;-> AH=19, DS:SI pointeur chaine type pascal, BH coordonnées x, BL coordonnées y +;<- +;================================================ +showstringat: + push es di + call setxy + call showstring + pop di es + ret + +;==========SHOWSTRING0AT (Fonction 14h)=========== +;Affiche une chaine de caractère pointée par DS:SI en (x;y) (BH;BL) +;-> AH=20, DS:SI pointeur chaine type zéro terminal, BH coordonnées x, BL coordonnées y +;<- +;================================================= +showstring0at: + push es di + call setxy + call showstring0 + pop di es + ret + +;==========SETCOLOR (Fonction 15h)========= +;Change les attributs du texte a CL +;-> AH=21 ,CL couleur +;<- +;========================================= +setcolor: + mov cs:colors,CL + ret + +;==========GETCOLOR (Fonction 16h)========= +;Récupère les attributs du texte dans CL +;-> AH=22 +;<- CL couleur +;========================================= +getcolor: + mov cl,cs:colors + ret + +;==========SETSTYLE (Fonction xh)========= +;Change le style du texte a CL +;-> AH=x ,CX style +;<- +;========================================= +setstyle: + mov cs:style,CX + ret + +;==========GETSTYLE (Fonction xh)========= +;Récupère le style du texte dans CL +;-> AH=x +;<- CX style +;========================================= +getstyle: + mov cx,cs:style + ret + +;==========SCROLLDOWN (Fonction 17h)========= +;defile de cx lines vers le bas +;-> AH=23, CX lines à défiler vers le bas +;<- +;============================= +scrolldown: + push ax cx dx si di ds es + cmp cs:scrolling,0 + je graphp + mov ax,cx + mul cs:linesize + mov si,ax + mov cx,cs:pagesize + sub cx,si + mov di,cs:adress + cld + cmp byte ptr cs:graphics,1 + jne textp + mov ax,0A000h + mov es,ax + mov ds,ax + shr cx,2 +transfert: + mov ah,0 +gogo: + push ax cx + mov cl,ah + mov ah,1 + shl ah,cl + mov al,2 + mov dx,sequencer + out dx,ax + pop cx ax + mov al,4 + mov dx,graphics + out dx,ax + push si di cx + rep movsd + pop cx di si + inc ah + cmp ah,3 + jbe gogo + jmp graphp +textp: + mov ax,0B800h + mov es,ax + mov ds,ax + rep movsb +graphp: + pop es ds di si dx cx ax + ret + +;==========GETXY (Fonction 18h)========= +;Change les coordonnées du curseur a X:BH,Y:BL +;-> AH=24 +;<- BH coordonnées x, BL coordonnées y +;============================= +getxy: + mov bh,cs:x + mov bl,cs:y + ret + +;==========SETXY (Fonction 19h)========= +;Change les coordonnées du curseur a X:BH,Y:BL +;-> AH=25, BH coordonnées x, BL coordonnées y +;<- +;===================================== +setxy: + push ax bx cx dx + mov cs:x,bh + mov cs:y,bl + mov al,bl + mov bl,bh + xor bh,bh + mov di,cs:adress + add di,bx + mul cs:columns + add di,ax + shl di,1 + mov cs:xy,di + cmp byte ptr cs:graphics,1 + jne oktext + mov bl,cs:x + mov cl,cs:y + xor bh,bh + xor ch,ch + shl bx,3 + shl cx,3 + call setxyg + jmp endofsetxy +oktext: + mov ax,0B800h + mov es,ax +endofsetxy: + pop dx cx bx ax + ret + +setxy2: + push es di + call setxy + pop di es + ret + +;==========SETXYG (Fonction 0xh)========= +;Change les coordonnées du curseur graphique a X:BX,Y:CX +;-> AH=x, BX coordonnées x, CX coordonnées y +;<- ES:DI pointeur sur pixel avec plan de bit ajusté +;====================================== +setxyg: + push ax bx cx dx + mov cs:xg,bx + mov cs:yg,cx + mov ax,cx + mov cl,bl + mul cs:linesize + shr bx,2 + add ax,bx + mov di,ax + and cl,3 + mov ah,1 + shl ah,cl + mov al,2 + mov dx, 3c4h + out dx,ax + mov cs:plane,cl + mov cs:xyg,di + mov ax,0A000h + mov es,ax + pop dx cx bx ax + ret + +;==========SHOWPIXEL (Fonction 0xh)========= +;Affiche un pixel de couleur AL en X:BX,Y:CX +;-> AH=x, BX coordonnées x, CX coordonnées y, AL couleur +;<- +;========================================= +showpixel: + push ax bx cx dx di bp es + mov bp,ax + mov ax,cx + mov cl,bl + mul cs:linesize + shr bx,2 + add ax,bx + mov di,ax + add di,cs:adress + and cl,3 + mov ah,1 + shl ah,cl + mov al,2 + mov dx,sequencer + out dx,ax + mov bx,0A000h + mov es,bx + mov ax,bp + mov es:[di],al + pop es bp di dx cx bx ax + ret + +;==========SHOWPIXEL (Fonction 0xh)========= +;Récupère en al la couleur du pixel de coordonnées X:BX,Y:CX +;-> AH=x, BX coordonnées x, CX coordonnées y, AL couleur +;<- +;========================================= +getpixel: + push ax bx cx dx di bp es + mov bp,ax + mov ax,cx + mov cl,bl + mul cs:linesize + shr bx,2 + add ax,bx + mov di,ax + add di,cs:adress + and cl,3 + mov ah,cl + mov al,4 + mov dx,graphics + out dx,ax + mov bx,0A000h + mov es,bx + mov ax,bp + + mov al,es:[di] + pop es bp di dx cx bx ax + ret + +;==========LOADBMPPALET (Fonction 0xh)========= +;Charge la palette du BMP pointée par DS:SI +;-> AH=x, DS:SI BMP +;<- +;============================================= +loadbmppalet: + push ax bx cx dx + mov bx,0400h+36h-4 + mov cx,100h + mov dx, 3c8h +paletteload: + mov al, cl + dec al + out dx, al + inc dx + mov al,[bx+si+2] + shr al,2 + out dx, al + mov al,[bx+si+1] + shr al,2 + out dx, al + mov al,[bx+si] + shr al,2 + out dx, al + sub bx,4 + dec dx + dec cl + jnz paletteload + pop dx cx bx ax + ret + +;==========VIEWBMP (Fonction 0xh)========= +;Affiche le BMP pointée par DS:SI en X:BX, Y:CX avec la préparation de la palette +;<- AH=x, DS:SI BMP, BX coordonnées X, CX coordonnées Y +;-> +;========================================= +viewbmp: + call loadbmppalet + call showbmp + ret + +;==========SHOWBMP (Fonction 0xh)========= +;Affiche le BMP pointée par DS:SI en X:BX, Y:CX +;<- AH=x, DS:SI BMP, BX coordonnées X, CX coordonnées Y +;-> +;========================================= +showbmp: + push ax bx cx dx + cmp word ptr ds:[si+BMP_file.BMP_FileType],"MB" + jne errorshowing + mov cs:xc,bx + mov cs:yc,cx + xor cx,cx + xor bx,bx + xor dx,dx +bouclette: + mov al,[si+bx+436h] + push bx cx + sub cx,cs:yc + neg cx + mov bx,dx + add bx,cs:xc + call showpixel + pop cx bx + inc bx + inc dx + cmp dx,[si+offset BMP_File.BMP_width] + jb bouclette + xor dx,dx + inc cx + cmp cx,[si+offset BMP_File.BMP_height] + jb bouclette + clc + pop dx cx bx ax + ret + +errorshowing: + stc + pop dx cx bx ax + ret + +xc dw 0 +yc dw 0 + +;==========GETVGAINFO (Fonction 0xh)========= +;Renvoie un bloc de donnée en ES:DI sur l'état de la carte graphique +;<- AH=x, ES:DI pointeur +;-> +;============================================= +Getvgainfos: + push cx si di ds + push cs + pop ds + mov cx,datablocksize + mov si,offset datablock + cld + rep movsb + pop ds di si cx + ret + +;==========WAITRETRACE (Fonction 0xh)========= +;Synchronisation avec la retrace verticale +;<- AH=x +;-> +;============================================= +waitretrace: + push ax dx + mov dx,3DAh +waitr: + in al,dx + test al,8 + jz waitr + pop dx ax + ret + +;Ecrit le caractère ASCII CL attribut CH aprés le curseur, en le mettant à jours +charout: + push ax bx cx dx di es + cmp byte ptr cs:graphics,1 + jne textaccess + mov dx,cx + mov di,dx + and di,11111111b + shl di,3 + add di,offset font8x8 + xor bx,bx + xor cx,cx + mov ah,cs:[di] +bouclet: + mov al,dh + rol ah,1 + jc colored + shr al,4 + bt word ptr cs:style,0 + jc transparent +colored: + and al,1111b + push bx cx + add cx,cs:yg + add bx,cs:xg + call showpixel + pop cx bx +transparent: + inc bx + cmp bx,8 + jb bouclet + xor bx,bx + inc di + mov ah,cs:[di] + inc cx + cmp cx,8 + jb bouclet + add cs:xg,8 + mov cx,cs:linesize + shl cx,2 + cmp cs:xg,cx + jb adjusttext + mov cs:xg,0 + add cs:yg,8 + jmp adjusttext +textaccess: + mov ax,0B800h + mov es,ax + mov di,cs:xy + mov es:[di],cx + add cs:xy,2 +adjusttext: + inc cs:x + mov cl,cs:columns + cmp cs:x,cl + jb noadjusted + call showline +noadjusted: + ;mov dx,3D4h + ;mov al,0Eh + ;mov di,offset xy + ;mov ah,cs:[di] + ;out dx,ax + ;mov ah,cs:[di+1] + ;dec al + ;out dx,ax + pop es di dx cx bx ax + ret + + + + + + +;===================================sauve l'ecran rapidement================ +SaveScreen: + push cx si di ds es + mov cx,0B800H + mov ds,cx + push cs + pop es + mov cx,cs:pagesize + shr cx,2 + xor si,si + mov di,offset Copy2 + cld + rep movsd + pop es ds di si cx + ret + +;===================================sauve l'ecran rapidement en es:di================ +SaveScreento: + push cx si di ds + mov cx,0B800H + mov ds,cx + mov cx,cs:pagesize + shr cx,2 + xor si,si + cld + rep movsd + pop ds di si cx + ret + +;===================================sauve l'ecran rapidement================ +Savepage1: + push cx si di ds es + mov cx,0B800H + mov ds,cx + push cs + pop es + mov cx,cs:pagesize + shr cx,2 + xor si,si + mov di,offset Copy + cld + rep movsd + pop es ds di si cx + ret + +;===================================sauve l'ecran rapidement================ +RestoreScreen: + push cx si di ds es + mov cx,0B800H + mov es,cx + push cs + pop ds + mov cx,cs:pagesize + shr cx,2 + mov si,offset Copy2 + xor di,di + cld + rep movsd + pop es ds di si cx + ret + +;===================================restore l'ecran rapidement de ds:si================ +RestoreScreenfrom: + push cx si di ds es + mov cx,0B800H + mov es,cx + mov cx,cs:pagesize + shr cx,2 + xor di,di + cld + rep movsd + pop es ds di si cx + ret + +;===============================Page2to1============================ +Page2to1: + push cx si di ds es + mov cx,0B800H + mov es,cx + mov ds,cx + mov cx,cs:pagesize + shr cx,2 + mov si,4000 + xor di,di + cld + rep movsd + pop es ds di si cx + ret + +;===============================Page1to2============================ +Page1to2: + push cx si di ds es + mov cx,0B800H + mov es,cx + mov ds,cx + mov cx,cs:pagesize + shr cx,2 + mov di,4000 + xor si,si + cld + rep movsd + pop ds es di si cx + ret + +;===============================xchgPages============================ +xchgPages: + push cx si di ds es + call savepage1 + call page2to1 + mov cx,0B800H + mov es,cx + push cs + pop ds + mov cx,cs:pagesize + shr cx,2 + mov si,offset Copy + mov di,4000 + rep movsd + pop es ds di si cx + ret + +;Sauve l'‚tat de la carte en es:di +savestate: +push cx si di ds +push cs +pop ds +mov cx,datablocksize +mov si,offset lines +cld +rep movsb +call savescreento +pop ds di si cx +ret + +;R‚cupŠre l'‚tat de la carte en ds:si +restorestate: +push ax cx si di es +mov al,[si+7] +cmp cs:mode,al +je nochangemode +mov ah,0 +call setvideomode +nochangemode: +push cs +pop es +mov cx,datablocksize +mov di,offset lines +cld +rep movsb +call restorescreenfrom +pop es di si cx ax +ret + +;sauve le DAC +savedac: +push ax cx dx di +mov dx,3C7h +mov cx,256 +mov di,offset dac +save: +mov al,cl +dec al +out dx,al +inc dx +inc dx +in al,dx +mov cs:[di],al +inc di +in al,dx +mov cs:[di],al +inc di +in al,dx +mov cs:[di],al +inc di +dec dx +dec dx +dec cx +jne save +pop di dx cx ax +ret + +;restore le DAC +restoredac: +push ax cx dx si +xor ax,ax +mov dx,3C8h +mov cx,256 +mov si,offset dac +save2: +mov al,cl +dec al +out dx,al +inc dx +mov al,cs:[si] +inc si +out dx,al +mov al,cs:[si] +inc si +out dx,al +mov al,cs:[si] +inc si +out dx,al +dec dx +dec cx +jne save2 +pop si dx cx ax +ret + +;couleur al pour ligne di A SUPPRIMER +changelineattr: +push ax bx di es +mov bx,ax +mov ax,0B800h +mov es,ax +mov ax,di +mul cs:columns +mov di,ax +shl di,1 +mov al,cs:columns +inc di +popep: +mov es:[di],bl +add di,2 +dec al +jnz popep +pop es di bx ax +ret + +font8x8: +include ..\include\pol8x8.inc +font8x16: +include ..\include\pol8x16.inc + +copy equ $ +copy2 equ $+8192 +dac equ $+8192+8192 + +end start diff --git a/noyau/write.bat b/noyau/write.bat deleted file mode 100755 index 808b110..0000000 --- a/noyau/write.bat +++ /dev/null @@ -1,4 +0,0 @@ -@echo off -cd .. -setup -cd sources diff --git a/outils/exe2boot.asm b/outils/exe2boot.asm deleted file mode 100755 index 0946581..0000000 --- a/outils/exe2boot.asm +++ /dev/null @@ -1,67 +0,0 @@ -.model tiny -.486 -smart -.code - -org 0100h - - -start: -jmp transform -NameBoot db 'Boot.exe',0 -nameboot2 db 'Boot.bin',0 -buffer db 510 dup (0) - dw 0AA55h -message db 0ah,0dh,'Transformation of boot.com to boot.bin...',0ah,0dh,'By Nico',0ah,0dh,'Copyright 2000',0ah,0dh,'$' -ok db 0ah,0dh,'The transformation was done succefully !',0ah,0dh,'$' -errormsg db 0ah,0dh,'Some errors has been detected !',0ah,0dh,'$' -transform: -mov ah,09 -mov dx,offset message -int 21h -mov ax,3D00h -mov dx,offset nameboot -int 21h -jc error -mov bx,ax -mov ax,4202h -xor cx,cx -xor dx,dx -int 21h -jc error -cmp dx,0 -jne error -mov ax,4200h -xor cx,cx -mov dx,7E00h -int 21h -jc error -mov ah,3fh -mov cx,512 -mov dx,offset buffer -int 21h -jc error -mov ah,3eh -int 21h -jc error -mov ah,3ch -xor cx,cx -mov dx,offset nameboot2 -int 21h -jc error -mov ah,40h -mov cx,512 -mov dx,offset buffer -int 21h -jc error -mov ah,09 -mov dx,offset ok -int 21h -ret -error: -mov ah,09 -mov dx,offset errormsg -int 21h -ret - -end start diff --git a/outils/rip.asm b/outils/rip.asm deleted file mode 100755 index acefad7..0000000 --- a/outils/rip.asm +++ /dev/null @@ -1,108 +0,0 @@ -net segment - -org 0100h -assume cs:net,ds:net - -start: -jmp deb -taille dw 0 -signe db 'rip' -signe2 db 64 dup (0) -p1 db '@' -p2 db '@' -min db 4 -deb: -mov BL,DS:[0080h] -xor BH,BH -or BX,BX -mov byte ptr [0081h+BX],00h -mov AX,3D02h -mov DX,0082H -int 21h -mov bx,ax -mov ah,3fh -mov cx,0ffffh -mov dx,offset data -int 21h -mov taille,ax -mov ah,3eh -int 21h -mov si,82h -mov di,offset signe2 -mov cx,64 -rep movsb -mov di,offset signe2 -mov cx,64 -mov al,2eh -repne scasb -push di -mov si,di -mov di,offset data -add di,taille -mov cx,3 -rep movsb -mov ax,di -pop di -mov cx,3 -mov si,offset signe -rep movsb -mov di,ax -mov cx,taille -mov si,offset data -mov dx,1 -boucle: -lodsb -cmp al,[si] -jne pas -inc dl -loop boucle -jmp fin -pas: -cmp dl,min -jb suite -cmp dl,1 -jne go -suite: -mov bx,cx -mov cx,dx -rep stosb -mov cx,bx -mov dl,1 -loop boucle -jmp fin -go: -mov ah,al -mov al,p1 -stosb -mov al,dl -stosb -mov al,ah -stosb -mov al,p2 -stosb -mov dl,1 -loop boucle -fin: -mov ah,3ch -mov cx,0 -mov dx,offset signe2 -int 21h -mov bx,ax -mov ah,40h -mov cx,di -sub cx,offset data -sub cx,taille -mov dx,offset data -add dx,taille -int 21h -mov ah,3eh -int 21h -mov ah,41h -mov dx,82h -int 21h -ret -data db 0 -net ends -end start - -net \ No newline at end of file diff --git a/outils/unrip.asm b/outils/unrip.asm deleted file mode 100755 index 02d1f64..0000000 --- a/outils/unrip.asm +++ /dev/null @@ -1,88 +0,0 @@ -net segment - -org 0100h -assume cs:net,ds:net - -start: -jmp deb -taille dw 0 -signe2 db 64 dup (0) -p1 db '@' -p2 db '@' -deb: -mov BL,DS:[0080h] -xor BH,BH -or BX,BX -mov byte ptr [0081h+BX],00h -mov AX,3D02h -mov DX,0082H -int 21h -mov bx,ax -mov ah,3fh -mov cx,0ffffh -mov dx,offset data -int 21h -mov taille,ax -mov ah,3eh -int 21h -mov si,82h -mov di,offset signe2 -mov cx,64 -rep movsb -mov di,offset signe2 -mov cx,64 -mov al,2eh -repne scasb -mov si,offset data -mov cx,3 -rep movsb -mov cx,taille -mov di,offset data -add di,taille -mov dx,1 -boucle: -lodsb -cmp al,p1 -je pas -suite: -stosb -loop boucle -jmp fin -pas: -mov al,p2 -cmp [si+2],al -jne suite -lodsb -mov bx,cx -mov cl,al -xor ch,ch -lodsb -rep stosb -mov cx,bx -sub cx,3 -inc si -loop boucle -fin: -mov ah,3ch -mov cx,0 -mov dx,offset signe2 -int 21h -mov bx,ax -mov ah,40h -mov cx,di -sub cx,offset data -sub cx,taille -mov dx,offset data -add dx,taille -int 21h -mov ah,3eh -int 21h -mov ah,41h -mov dx,82h -int 21h -ret -data db 0 -net ends -end start - -net \ No newline at end of file diff --git a/programs/MAKEFILE b/programs/MAKEFILE new file mode 100644 index 0000000..dde9824 --- /dev/null +++ b/programs/MAKEFILE @@ -0,0 +1,57 @@ +lnk_boot = tlink /x +asm= tasm /t/m5/zi +lnk= tlink /x/t + +all: detect.exe editeur.exe gestion.exe logo.exe pmode.exe souris.exe test.exe verifier.exe volume.exe + +detect.exe: detect.asm + $(asm) detect + $(lnk) detect + ren detect.com detect.exe + +editeur.exe: editeur.asm + $(asm) editeur + $(lnk) editeur + ren editeur.com editeur.exe + +gestion.exe: gestion.asm + $(asm) gestion + $(lnk) gestion + ren gestion.com gestion.exe + +logo.exe: logo.asm + $(asm) logo + $(lnk) logo + ren logo.com logo.exe + +pmode.exe: pmode.asm + $(asm) pmode + $(lnk) pmode + ren pmode.com pmode.exe + +souris.exe: souris.asm + $(asm) souris + $(lnk) souris + ren souris.com souris.exe + +test.exe: test.asm + $(asm) test + $(lnk) test + ren test.com test.exe + +verifier.exe: verifier.asm + $(asm) verifier + $(lnk) verifier + ren verifier.com verifier.exe + +volume.exe: volume.asm + $(asm) volume + $(lnk) volume + ren volume.com volume.exe + +clean: + del *.obj + del *.exe + del *.com + del *.sys + del *.err diff --git a/programs/asm.bat b/programs/asm.bat deleted file mode 100755 index 9466a7b..0000000 --- a/programs/asm.bat +++ /dev/null @@ -1,54 +0,0 @@ -@echo off - -echo Assembling file %1... -..\util\tasm %1.asm /m5/x/t -if errorlevel 1 goto end -if "%1"=="boot" goto boot -echo Linking file %1... -..\util\tlink %1.obj /x/t -if errorlevel 1 goto end -echo Copying file %1... -if "%1"=="video" goto video -if "%1"=="lpt" goto system -if "%1"=="keyboard" goto system -if "%1"=="mouse" goto system -if "%1"=="pic8259a" goto system -if "%1"=="timer" goto system -if "%1"=="drive" goto system -if "%1"=="joystick" goto system -if "%1"=="system" goto system -if "%1"=="setup" goto setup -copy %1.com ..\data\%1.exe>nul -goto end - -:boot -echo Linking file %1... -..\util\tlink %1.obj /x -if errorlevel 1 goto end -echo Copying file %1... -..\util\exe2boot %1.exe -copy %1.bin ..\data\%1.bin>nul -goto end - -:video -type thin8x8.fnt>>%1.com -:system -copy %1.com ..\data\%1.sys>nul -goto end -:setup -copy %1.com ..\%1.com>nul -goto end - -:end -if not exist *.bin goto exes -del *.bin -:exes -if not exist *.exe goto coms -del *.exe -:coms -if not exist *.com goto objs -del *.com -:objs -if not exist *.obj goto nobjs -del *.obj -:nobjs diff --git a/programs/clean.bat b/programs/clean.bat deleted file mode 100755 index 687f4b0..0000000 --- a/programs/clean.bat +++ /dev/null @@ -1,3 +0,0 @@ -@echo off -echo nettoyage en cours... -del ..\data\*.* >nul diff --git a/programs/cos.bmp b/programs/cos.bmp deleted file mode 100755 index c5a0890..0000000 Binary files a/programs/cos.bmp and /dev/null differ diff --git a/programs/cos.rip b/programs/cos.rip old mode 100755 new mode 100644 diff --git a/programs/debog.bat b/programs/debog.bat deleted file mode 100755 index aedbb4e..0000000 --- a/programs/debog.bat +++ /dev/null @@ -1,2 +0,0 @@ -@echo off -..\util\td %1 diff --git a/programs/detect.asm b/programs/detect.asm new file mode 100644 index 0000000..875b608 --- /dev/null +++ b/programs/detect.asm @@ -0,0 +1,606 @@ +.model tiny +.486 +smart +.code + +org 0100h + +include ..\include\pci.h + +start: +call cleartext + +call getpciinfos +mov pciversion,bx +mov nbbus,cl +mov pcitype,al + +mov si,offset msg +call showstring0 +call line + +mov si,offset pcivers +call showstring0 +xor edx,edx +mov dx,bx +xchg dl,dh +mov cx,8 +call showhex +mov si,offset poin +call showstring0 +shr dx,8 +call showhex +mov si,offset pcivers2 +call showstring0 +call line + +mov si,offset nbbuses +call showstring0 +xor edx,edx +mov dl,nbbus +inc dl +call showint +call line + +mov si,offset typesof +call showstring0 +mov di,offset types +mov bx,7 +mov al,pcitype +vote: +bt ax,bx +jnc nowas +shl bx,1 +mov si,[di+bx] +call showstring0 +mov si,offset spac +call showstring0 +shr bx,1 +nowas: +dec bx +jns vote +call line + +xor ax,ax +xor cx,cx +mov di,offset infos +search: +call Getallfunctionsinfos +jc stopthis + +push cx di +mov si,offset msg1 +call showstring0 +mov cx,16 +xor edx,edx +mov dx,[di+pci.device] +call showhex +mov si,offset msg2 +call showstring0 +mov dx,[di+pci.vendor] +call showhex +mov si,offset msg3 +call showstring0 +mov cl,[di+pci.class] +mov ch,[di+pci.subclass] +mov di,offset temp +call getpciclass +mov si,di +call showstring0 +mov si,offset poin +call showstring0 +mov di,offset temp +call getpcisubclass +mov si,di +call showstring0 +call line +pop di cx + +jmp noerror +noerror: +inc ch +cmp ch,7 +jbe search +stopthis: +xor ch,ch +inc cl +cmp cl,31 +jbe search +xor cl,cl +inc al +cmp al,16 +jbe search +ret + +msg3 db ' Classe:',0 +msg1 db 'Peripherique :',0 +msg2 db ' Constructeur :',0 +msg db 'COS2000 hardware detecteur V1.1',0 +pcivers db 'BIOS PCI version ',0 +pcivers2 db ' a ete detecte !',0 +nbbuses db 'Nombre de bus : ',0 +typesof db 'Caracterisques PCI: ',0 +poin db '.',0 +virg db ', ',0 +spac db ' ',0 +temp db 128 dup (0) + +types dw config1 + dw config2 + dw poin + dw poin + dw config3 + dw config4 + dw poin + dw poin + +config1 db 'Config Mechanism 1',0 +config2 db 'Config Mechanism 2',0 +config3 db 'Special Cycle Mechanism 1',0 +config4 db 'Special Cycle Mechanism 2',0 + +PciVersion dw 0 +Nbbus db 0 +PciType db 0 +infos db 256 dup (0) + +;fonction 0-7 bus 0-255 device 0-31 + +;renvoie en es:di de classe cl +getpciclass: +push ax cx si di ds es +push es +push di +mov di,cx +and di,0FFh +shl di,1 +mov di,[offset classes+di] +mov cx,0FFh +mov al,0 +push cs +pop es +repne scasb +sub cx,0FFh +neg cx +sub di,cx +mov si,di +push cs +pop ds +pop di +pop es +rep movsb +pop es ds di si cx ax +ret + +;renvoie en es:di la sous-classe de ch et de classe cl +getpcisubclass: +push ax cx si di ds es +push es +push di +mov di,cx +and di,0FFh +shl di,1 +mov di,[offset classesd+di] +xchg ch,cl +xor ch,ch +cmp cx,80h +jne suiteac +mov di,offset divers +jmp found +suiteac: +shl cx,1 +add di,cx +mov di,[di] +found: +mov cx,0FFh +mov al,0 +push cs +pop es +repne scasb +sub cx,0FFh +neg cx +sub di,cx +mov si,di +push cs +pop ds +pop di +pop es +rep movsb +pop es ds di si cx ax +ret +divers db 'divers',0 + +classes: +dw offset class0 +dw offset class1 +dw offset class2 +dw offset class3 +dw offset class4 +dw offset class5 +dw offset class6 +dw offset class7 +dw offset class8 +dw offset class9 +dw offset class10 +dw offset class11 +dw offset class12 +class0 db 'Ancien',0 +class1 db 'Stockage',0 +class2 db 'Reseau',0 +class3 db 'Affichage',0 +class4 db 'Multimedia',0 +class5 db 'Memoire',0 +class6 db 'Pont',0 +class7 db 'Communication',0 +class8 db 'Systeme',0 +class9 db 'Acquisition',0 +class10 db 'Dock',0 +class11 db 'Processeur',0 +class12 db 'Bus serie',0 + +;Classes et sous classes +classesd: +dw offset class0d +dw offset class1d +dw offset class2d +dw offset class3d +dw offset class4d +dw offset class5d +dw offset class6d +dw offset class7d +dw offset class8d +dw offset class9d +dw offset class10d +dw offset class11d +dw offset class12d + +class0d: +dw offset subclass00 +dw offset subclass01 +subclass00 db 'divers',0 +subclass01 db 'vga',0 + +class1d: +dw offset subclass10 +dw offset subclass11 +dw offset subclass12 +dw offset subclass13 +subclass10 db 'scsi',0 +subclass11 db 'ide',0 +subclass12 db 'disquette',0 +subclass13 db 'ipi',0 + +class2d: +dw offset subclass20 +dw offset subclass21 +dw offset subclass22 +subclass20 db 'ethernet',0 +subclass21 db 'token ring',0 +subclass22 db 'fddi',0 + +class3d: +dw offset subclass30 +dw offset subclass31 +subclass30 db 'vga',0 +subclass31 db 'xga',0 + +class4d: +dw offset subclass40 +dw offset subclass41 +subclass40 db 'video',0 +subclass41 db 'audio',0 + +class5d: +dw offset subclass50 +dw offset subclass51 +subclass50 db 'ram',0 +subclass51 db 'flash',0 + +class6d: +dw offset subclass60 +dw offset subclass61 +dw offset subclass62 +dw offset subclass63 +dw offset subclass64 +dw offset subclass65 +dw offset subclass66 +dw offset subclass67 +subclass60 db 'hote',0 +subclass61 db 'isa',0 +subclass62 db 'eisa',0 +subclass63 db 'mc',0 +subclass64 db 'pci',0 +subclass65 db 'pcmcia',0 +subclass66 db 'nubus',0 +subclass67 db 'cardbus',0 + +class7d: +dw offset subclass70 +dw offset subclass71 +subclass70 db 'serie',0 +subclass71 db 'parallele',0 + +class8d: +dw offset subclass80 +dw offset subclass81 +dw offset subclass82 +subclass80 db 'pic 8259a',0 +subclass81 db 'dma 8237',0 +subclass82 db 'tim 8254',0 + +class9d: +dw offset subclass90 +dw offset subclass91 +dw offset subclass92 +subclass90 db 'clavier',0 +subclass91 db 'stylo',0 +subclass92 db 'souris',0 + +class10d: +dw offset subclass100 +subclass100 db 'station',0 + +class11d: +dw offset subclass110 +dw offset subclass111 +dw offset subclass112 +dw offset subclass113 +dw offset subclass114 +subclass110 db '386',0 +subclass111 db '486',0 +subclass112 db 'pentium',0 +subclass113 db 'alpha',0 +subclass114 db 'coprocesseur',0 + +class12d: +dw offset subclass120 +dw offset subclass121 +dw offset subclass122 +dw offset subclass123 +subclass120 db 'firewire',0 +subclass121 db 'access',0 +subclass122 db 'ssa',0 +subclass123 db 'usb',0 + +;bx pci version, cl nbbus, al pci type +getPciInfos: + push dx + mov ax,0B101h + xor edi,edi + mov edx," PCI" + int 1Ah + jc ErrorPci + cmp dx,04350h + jne ErrorPci + clc + pop dx + ret +errorpci: + stc + pop dx + ret + +;al=bus bl=index cl=deviceid ch=func->dl +getfunctioninfo: + push eax bx cx + mov ah,80h + shl eax,16 + mov ah,cl + shl ah,3 + or ah,ch + mov al,bl + and al,0fch + mov dx,0cf8h + out dx,eax + mov dx,0CFCh + and bl,3 + or dl,bl + in al,dx + mov dl,al + pop cx bx eax + ret + +;al=bus cl=deviceid ch=func es:di +Getallfunctionsinfos: + push ax bx dx di + xor bl,bl +goinfos: + call getfunctioninfo + inc bl + cmp bl,2 + ja notzarb + cmp dl,0FFh + je notexist +notzarb: + mov es:[di],dl + inc di + cmp bl,255 + jb goinfos + pop di + push di + cmp word ptr [di],0000h + je notexist + clc + pop di dx bx ax + ret +notexist: + stc + pop di dx bx ax + ret + +;=============CLEAR========= +;Efface l'ecran texte +;-> +;<- +;============================= +cleartext: +push es eax cx di +xor di,di +mov ax,0b800h +mov es,ax +mov eax,07200720h +mov cx,cs:pagesize +shr cx,2 +cld +rep stosd +mov cs:xy,0 +mov cs:x,0 +mov cs:y,0 +pop di cx eax es +ret + + +;==========LINE========= +;remet le curseur a la ligne +;-> +;<- +;============================= +line: +push bx cx di es +mov bh,cs:x +mov bl,cs:y +xor bh,bh +mov cl,cs:lines +dec cl +dec cl +cmp bl,cl +jne scro +dec bl +mov cl,1 +call scrolldown +scro: +inc bl +call setxy +pop es di cx bx +ret + +;==========SETXY========= +;Change les coordonnées du curseur a X:AH,Y:AL +;-> AX +;<- es di +;============================= +setxy: +push ax bx dx +mov cs:x,bh +mov cs:y,bl +mov al,bl +mov bl,bh +xor bh,bh +mov di,bx +mul cs:columns +add di,ax +shl di,1 +mov cs:xy,di +mov ax,0B800h +mov es,ax +pop dx bx ax +ret + +;==========SCROLLDOWN========= +;defile de cx lines vers le bas +;-> CX +;<- +;============================= +scrolldown: +push ax cx dx si di ds es +mov si,0B800h +mov es,si +mov ds,si +mov ax,cx +mul cs:columns +shl ax,1 +mov si,ax +mov cx,cs:pagesize +sub cx,si +xor di,di +cld +rep movsb +pop es ds di si dx cx ax +ret + + +;===================================Afficher un int EDX a l'‚cran en ah,al================ +ShowInt: + push eax bx cx edx esi di es ds + mov di,cs:xy + mov cx,0B800h + mov es,cx + xor cx,cx + mov eax,edx + mov esi,10 + mov bx,offset showbuffer+27 +decint3: + xor edx,edx + div esi + add dl,'0' + mov dh,7 + sub bx,2 + add cx,2 + mov cs:[bx],dx + cmp ax,0 + jne decint3 + mov si,bx + push cs + pop ds + cld + rep movsb + mov cs:xy,di + pop ds es di esi edx cx bx eax +ret + +;================Affiche la chaine 0 de caractŠre contenue dans ds:si +showstring0: + push es cx si di + mov di,cs:xy + mov cx,0B800h + mov es,cx + mov ch,cs:colors +strinaize0: + mov cl,[si] + cmp cl,0 + je no0 + mov es:[di],cx + add di,2 + inc si + jmp strinaize0 + no0: + mov cs:xy,di + pop di si cx es + ret + +;==============================Affiche le nombre nb hexa en EDX============== +ShowHex: + push es ax bx cx edx di + mov di,cs:xy + mov bx,0B800h + mov es,bx + mov ax,cx + sub cx,32 + neg cx + shl edx,cl + mov ch,cs:colors + shr ax,2 +Hexaize: + rol edx,4 + mov bx,dx + and bx,0fh + mov cl,cs:[bx+offset Tab] + mov es:[di],cx + add di,2 + dec al + jnz Hexaize + mov cs:xy,di + pop di edx cx bx ax es + ret + +Tab db '0123456789ABCDEF' +x db 0 +y db 0 +xy dw 0 +pagesize dw 80*25*2 +lines db 25 +columns db 80 +colors db 7 +showbuffer db 35 dup (0FFh) + +end start diff --git a/programs/editor.asm b/programs/editeur.asm old mode 100755 new mode 100644 similarity index 91% rename from programs/editor.asm rename to programs/editeur.asm index 9608987..1afa5f6 --- a/programs/editor.asm +++ b/programs/editeur.asm @@ -1,393 +1,394 @@ -.model tiny -.386c -.code -org 0100h - - -start: - mov ax,0305h - mov bx,0008h - int 16h - mov ax,0002 - int 47H - mov ah,2 - int 47h - xor ebp,ebp - xor ax,ax - mov fs,ax - mov ah,43 - int 47h -Adres: - mov di,offset infos - mov ah,34 - int 47h - dec byte ptr [di] - mov al,[di+1] - sub al,16 - mov bl,al - shr al,2 - mov [di+1],al - and bl,11b - mov [di+2],bl - mov al,[di+7] - cmp al,oldmode - je noinit - mov ah,2 - int 47h - mov oldmode,al - noinit: - mov bx,0 - mov ah,25 - int 47h - mov bh,infos - mov edi,ebp - mov ah,21 - mov cl,7 - int 47h -lines: - mov edx,edi - shr edx,4*4 - shl edx,4*3 - mov cx,16 - mov ah,10 - int 47h - mov si,offset dep - mov ah,13 - int 47h - mov dx,di - mov ah,10 - int 47h - mov ah,13 - mov si,offset spaces - int 47h - mov ah,5 - int 47h - mov al,infos+1 - mov cl,7 - mov ah,21 - int 47h - mov esi,edi -doaline: - mov edx,edi - shr edx,4*4 - shl edx,4*3 - mov fs,dx - mov dl,fs:[di] - mov ah,10 - mov cl,8 - int 47h - mov ah,5 - int 47h - inc edi - dec al - jnz doaline - mov edi,esi - mov si,offset spaces - mov ah,13 - int 47h - mov al,infos+1 - mov ah,21 - mov cl,7 - int 47h -doaline2: - mov edx,edi - shr edx,4*4 - shl edx,4*3 - mov fs,dx - mov dl,fs:[di] - mov ah,7 - int 47h - inc edi - dec al - jnz doaline2 - dec bh - je outes - cmp byte ptr infos+2,0 - je lines - mov ah,6 - int 47h - jmp lines -outes: - mov ah,21 - mov cl,112 - int 47h - mov bh,0 - mov bl,infos - mov si,offset menu - mov ah,14h - int 47h - waitkey: - mov ax,0 - int 16h - cmp ax,3B00h - jne suit - inc ebp - jmp adres - suit: - cmp ax,3C00h - jne suit2 - dec ebp - jmp adres - suit2: - cmp ax,3D00h - jne suit3 - add ebp,24*16 - jmp adres - suit3: - cmp ax,3E00h - jne suit4 - sub ebp,24*16 - jmp adres - suit4: - cmp ax,3F00h - jne suit5 - add ebp,010000h - jmp adres - suit5: - cmp ax,4000h - jne suit6 - sub ebp,010000h - jmp adres - suit6: - cmp ax,4100h - jne suit7 - mov ah,21 - mov cl,116 - int 47h - mov dword ptr [pope],'TIDE' - mov bl,infos - xor bh,bh - mov si,offset menu - mov ah,14h - int 47h - mov ah,21 - mov cl,7 - int 47h - mov ax,0B800h - mov es,ax - mov xxyy2,3 - mov xxyy,3 - call calc1 - call calc2 -waitst: - mov ax,0 - int 16h - cmp ah,41h - jne tre - mov dword ptr [pope],' EUV' - push cs - pop es - jmp adres -tre: - cmp al,0 - jne write - cmp ah,48h - jne tre1 - cmp yy,0 - je waitst - dec yy - jmp cursor -tre1: - cmp ah,50h - jne tre2 - mov al,infos - dec al - xor ah,ah - cmp yy,ax - je waitst - inc yy - jmp cursor -tre2: - cmp ah,4Dh - jne tre4 - cmp xx,15 - je waitst - inc xx - jmp cursor -tre4: - cmp ah,4Bh - jne waitst - cmp xx,0 - je waitst - dec xx - jmp cursor -write: - call AsciiHex2dec - cmp cl,15 - ja waitst - call calc1 - call calc2 - mov edi,es:[bx-1] - mov dx,es:[si-1] - mov byte ptr es:[bx],0112 - mov es:[bx-1],al -writs: - mov ax,0 - int 16H - mov ch,cl - call AsciiHex2dec - cmp cl,15 - ja writs - shl ch,4 - add ch,cl - mov es:[bx+1],al - mov es:[si-1],ch - mov ax,bx - call calc3 - mov gs:[bx],ch - pusha - popa - mov cl,gs:[bx] - cmp ch,cl - je no - push si ax - mov ah,25 - mov bl,infos - xor bh,bh - int 47h - mov ah,21 - mov cl,117 - int 47h - mov si,offset msg - mov ah,13 - int 47h - mov ax,0 - int 16h - mov bl,infos - xor bh,bh - mov ah,25 - int 47h - mov ah,21 - mov cl,116 - int 47h - mov ah,13 - mov si,offset menu - int 47h - pop bx si - mov es:[bx-1],edi - mov es:[si-1],dx - no: - - inc xx - cmp xx,16 - jne pasde - inc yy - mov xx,0h - pasde: - call calc1 - call calc2 - jmp waitst - -cursor: - call calc1 - call calc2 - jmp waitst - suit7: - cmp ax,4200h - jne adres - mov ah,27 - int 47h - db 0CBH ; +++++++ - ret - -calc1: - push ax dx si - mov ax,xx - mov dx,xx - shl ax,2 - shl dx,1 - add ax,dx - add ax,27 - mov bx,YY - mov dx,yy - shl bx,5 - shl dx,7 - add bx,dx - add bx,ax - mov byte ptr es:[bx],112 - mov byte ptr es:[bx+2],112 - mov si,xxyy - mov byte ptr es:[si],07 - mov byte ptr es:[si+2],07 - mov xxyy,bx - pop si dx ax - ret - -calc2: - push ax bx dx - mov si,YY - mov dx,yy - shl si,5 - shl dx,7 - add si,dx - mov dx,xx - shl dx,1 - add si,dx - add si,129 - mov byte ptr es:[si],112 - mov bx,xxyy2 - mov byte ptr es:[bx],07 - mov xxyy2,si - pop dx bx ax - ret - -calc3: - push dx - xor ebx,ebx - mov bx,xx - mov dx,yy - shl dx,4 - add bx,dx - add ebx,ebp - mov edx,ebx - shr edx,4*4 - shl edx,4*3 - mov gs,dx - pop dx - ret - - asciihex2dec: - cmp al,'a' - jb nomin - cmp al,'f' - ja nomin - sub al,'a'-'A' - jmp ismaj - nomin: - cmp al,'A' - jb nomaj - cmp al,'F' - ja nomaj - ismaj: - mov cl,al - sub cl,'A'-10 - jmp endt - nomaj: - mov cl,al - sub cl,'0' - endt: - ret - -dep db ':',0 -sect dw 0 -xx dw 0 -yy dw 0 -xxyy dw 3 -xxyy2 dw 3 -msg db 'Error : Unchangeable area (ROM) press a key to continu ',0 -menu db 'Top F1, Bottom F2, Offset F3&F4, Segment F5&F6, Mode F7, Quit F8 MODE ' -pope db 'VUE ',0 -spaces db ' ³ ',0 - -showbuffer db 35 dup (0FFh) -oldmode db 0 -infos db 40 dup (0) -end start - - - - - - - - +.model tiny +.386c +.code +org 0100h + + +start: + mov ax,0305h + mov bx,0008h + int 16h + mov ax,0002 + int 47H + mov ah,2 + int 47h + xor ebp,ebp + xor ax,ax + mov fs,ax + mov ah,43 + int 47h +Adres: + mov di,offset infos + mov ah,34 + int 47h + dec byte ptr [di] + mov al,[di+1] + sub al,16 + mov bl,al + shr al,2 + mov [di+1],al + and bl,11b + mov [di+2],bl + mov al,[di+7] + cmp al,oldmode + je noinit + mov ah,2 + int 47h + mov oldmode,al + noinit: + mov bx,0 + mov ah,25 + int 47h + mov bh,infos + mov edi,ebp + mov ah,21 + mov cl,7 + int 47h +lines: + mov edx,edi + shr edx,4*4 + shl edx,4*3 + mov cx,16 + mov ah,10 + int 47h + mov si,offset dep + mov ah,13 + int 47h + mov dx,di + mov ah,10 + int 47h + mov ah,13 + mov si,offset spaces + int 47h + mov ah,5 + int 47h + mov al,infos+1 + mov cl,7 + mov ah,21 + int 47h + mov esi,edi +doaline: + mov edx,edi + shr edx,4*4 + shl edx,4*3 + mov fs,dx + mov dl,fs:[di] + mov ah,10 + mov cl,8 + int 47h + mov ah,5 + int 47h + inc edi + dec al + jnz doaline + mov edi,esi + mov si,offset spaces + mov ah,13 + int 47h + mov al,infos+1 + mov ah,21 + mov cl,7 + int 47h +doaline2: + mov edx,edi + shr edx,4*4 + shl edx,4*3 + mov fs,dx + mov dl,fs:[di] + mov ah,7 + int 47h + inc edi + dec al + jnz doaline2 + dec bh + je outes + cmp byte ptr infos+2,0 + je lines + mov ah,6 + int 47h + jmp lines +outes: + mov ah,21 + mov cl,112 + int 47h + mov bh,0 + mov bl,infos + mov si,offset menu + mov ah,14h + int 47h + waitkey: + mov ax,0 + int 16h + cmp ax,3B00h + jne suit + inc ebp + jmp adres + suit: + cmp ax,3C00h + jne suit2 + dec ebp + jmp adres + suit2: + cmp ax,3D00h + jne suit3 + add ebp,24*16 + jmp adres + suit3: + cmp ax,3E00h + jne suit4 + sub ebp,24*16 + jmp adres + suit4: + cmp ax,3F00h + jne suit5 + add ebp,010000h + jmp adres + suit5: + cmp ax,4000h + jne suit6 + sub ebp,010000h + jmp adres + suit6: + cmp ax,4100h + jne suit7 + mov ah,21 + mov cl,116 + int 47h + mov dword ptr [pope],'TIDE' + mov bl,infos + xor bh,bh + mov si,offset menu + mov ah,14h + int 47h + mov ah,21 + mov cl,7 + int 47h + mov ax,0B800h + mov es,ax + mov xxyy2,3 + mov xxyy,3 + call calc1 + call calc2 +waitst: + mov ax,0 + int 16h + cmp ah,41h + jne tre + mov dword ptr [pope],' EUV' + push cs + pop es + jmp adres +tre: + cmp al,0 + jne write + cmp ah,48h + jne tre1 + cmp yy,0 + je waitst + dec yy + jmp cursor +tre1: + cmp ah,50h + jne tre2 + mov al,infos + dec al + xor ah,ah + cmp yy,ax + je waitst + inc yy + jmp cursor +tre2: + cmp ah,4Dh + jne tre4 + cmp xx,15 + je waitst + inc xx + jmp cursor +tre4: + cmp ah,4Bh + jne waitst + cmp xx,0 + je waitst + dec xx + jmp cursor +write: + call AsciiHex2dec + cmp cl,15 + ja waitst + call calc1 + call calc2 + mov edi,es:[bx-1] + mov dx,es:[si-1] + mov byte ptr es:[bx],0112 + mov es:[bx-1],al +writs: + mov ax,0 + int 16H + mov ch,cl + call AsciiHex2dec + cmp cl,15 + ja writs + shl ch,4 + add ch,cl + mov es:[bx+1],al + mov es:[si-1],ch + mov ax,bx + call calc3 + mov gs:[bx],ch + pusha + popa + mov cl,gs:[bx] + cmp ch,cl + je no + push si ax + mov ah,25 + mov bl,infos + xor bh,bh + int 47h + mov ah,21 + mov cl,117 + int 47h + mov si,offset msg + mov ah,13 + int 47h + mov ax,0 + int 16h + mov bl,infos + xor bh,bh + mov ah,25 + int 47h + mov ah,21 + mov cl,116 + int 47h + mov ah,13 + mov si,offset menu + int 47h + pop bx si + mov es:[bx-1],edi + mov es:[si-1],dx + no: + + inc xx + cmp xx,16 + jne pasde + inc yy + mov xx,0h + pasde: + call calc1 + call calc2 + jmp waitst + +cursor: + call calc1 + call calc2 + jmp waitst + suit7: + cmp ax,4200h + jne adres + mov ah,27 + int 47h + db 0CBH ; +++++++ + ret + +calc1: + push ax dx si + mov ax,xx + mov dx,xx + shl ax,2 + shl dx,1 + add ax,dx + add ax,27 + mov bx,YY + mov dx,yy + shl bx,5 + shl dx,7 + add bx,dx + add bx,ax + mov byte ptr es:[bx],112 + mov byte ptr es:[bx+2],112 + mov si,xxyy + mov byte ptr es:[si],07 + mov byte ptr es:[si+2],07 + mov xxyy,bx + pop si dx ax + ret + +calc2: + push ax bx dx + mov si,YY + mov dx,yy + shl si,5 + shl dx,7 + add si,dx + mov dx,xx + shl dx,1 + add si,dx + add si,129 + mov byte ptr es:[si],112 + mov bx,xxyy2 + mov byte ptr es:[bx],07 + mov xxyy2,si + pop dx bx ax + ret + +calc3: + push dx + xor ebx,ebx + mov bx,xx + mov dx,yy + shl dx,4 + add bx,dx + add ebx,ebp + mov edx,ebx + shr edx,4*4 + shl edx,4*3 + mov gs,dx + pop dx + ret + + asciihex2dec: + cmp al,'a' + jb nomin + cmp al,'f' + ja nomin + sub al,'a'-'A' + jmp ismaj + nomin: + cmp al,'A' + jb nomaj + cmp al,'F' + ja nomaj + ismaj: + mov cl,al + sub cl,'A'-10 + jmp endt + nomaj: + mov cl,al + sub cl,'0' + endt: + ret + +dep db ':',0 +sect dw 0 +xx dw 0 +yy dw 0 +xxyy dw 3 +xxyy2 dw 3 + +msg db 'Erreur : zone non modifiable (ROM) pressez une touche pour continuer ',0 +menu db 'haut/bas [F1/2] Offset [F3/4] Segment [F5/6] Mode F7, Quitter F8 MODE ' +pope db 'VUE ',0 +spaces db ' ³ ',0 + +showbuffer db 35 dup (0FFh) +oldmode db 0 +infos db 40 dup (0) +end start + + + + + + + + diff --git a/programs/gestion.asm b/programs/gestion.asm new file mode 100644 index 0000000..d729164 --- /dev/null +++ b/programs/gestion.asm @@ -0,0 +1,194 @@ +.model tiny +.486 +smart +.code + +org 0100h + +include ..\include\fat.h + +start: +mov ah,2 +int 47h +mov ah,25 +mov bx,0 +int 47h +mov ah,21 +mov cl,70h +int 47h +mov ah,13 +mov si,offset msg1 +int 47h +mov ah,21 +mov cl,7 +int 47h +mov ah,13 +mov si,offset prompt +int 47h +mov ah,13 +mov si,offset infos +int 47h +mov ah,13 +mov si,offset prompt +int 47h +mov ah,3 +int 48h +xor bp,bp +mov di,offset bufferentry +mov si,di +mov ah,7 +int 48h +jc nofiles +go: +test [si+Entries.FileAttr],00010000b +je notdirectory +mov ah,21 +mov cl,4 +int 47h +jmp notall +notdirectory: +cmp [si+Entries.FilExt],'E' +jne notexe +cmp [si+Entries.FilExt+1],'X' +jne notexe +cmp [si+Entries.FilExt+2],'E' +jne notexe +mov ah,21 +mov cl,5 +int 47h +jmp notall +notexe: +cmp [si+Entries.FilExt],'S' +jne notsys +cmp [si+Entries.FilExt+1],'Y' +jne notsys +cmp [si+Entries.FilExt+2],'S' +jne notsys +mov ah,21 +mov cl,0Ah +int 47h +jmp notall +notsys: +mov ah,21 +mov cl,7h +int 47h +notall: +mov ah,46 +int 47h +mov ah,05 +int 47h +int 47h +int 47h +mov ah,44 +mov dx,[si+Entries.FileDateCrea] +int 47h +mov ah,05 +int 47h +int 47h +int 47h +mov ah,45 +mov dx,[si+Entries.FileTimeCrea] +int 47h +mov ah,05 +int 47h +int 47h +int 47h +mov ah,44 +mov dx,[si+Entries.FileDate] +int 47h +mov ah,05 +int 47h +int 47h +int 47h +mov ah,45 +mov dx,[si+Entries.FileTime] +int 47h +mov ah,05 +int 47h +int 47h +int 47h +mov ah,48 +mov edx,[si+Entries.FileSize] +int 47h +mov ah,05 +int 47h +int 47h +int 47h +mov ah,47 +mov dl,[si+Entries.FileAttr] +int 47h +mov ah,6 +int 47h +inc bp +mov ah,8 +int 48h +jnc go +nofiles: +mov ah,21 +mov cl,70h +int 47h +mov ah,13 +mov si,offset menu +int 47h +mov xx,1 +mov xxold,2 +call Select +endof: +mov ax,0 +int 16h + cmp ah,50h + jne tre1 + cmp xx,bp + je endof + inc xx + call select + jmp endof +tre1: + cmp ah,48h + jne tre2 + cmp xx,1 + je endof + dec xx + call select + jmp endof +tre2: + cmp al,0Dh + jne tre3 +tre3: + cmp ah,59 + jne tre4 + jmp start +tre4: + cmp ah,67 + jne endof + db 0CBh + +;selectionne la ligne xx +Select: +push ax di +mov di,xxold +mov al,7 +add di,3 +mov ah,32 +int 47h +mov ax,xx +mov xxold,ax +mov di,xx +mov ah,32 +mov al,112 +add di,3 +int 47h +pop di ax +ret + +xx dw 1 +xxold dw 0 +menu db '[F1] Lire disque [F9] Quitter ',0 +msg1 db ' Gestionnaire de fichier Version 1.0 ',0 +msg2 db 'Programme en cours de chargement',0 +prompt db '--------------------------------------------------------------------------------',0 +infos db 'Nom Ext. Date creation Date modification Taille Attributs',0 + +bufferentry equ $ + +end start diff --git a/programs/logo.asm b/programs/logo.asm old mode 100755 new mode 100644 index 255295b..0b40be1 --- a/programs/logo.asm +++ b/programs/logo.asm @@ -1,46 +1,82 @@ -.model tiny -.386c -.code -org 0100h - - -start: -mov si,offset logo -mov ah,4 -xor di,di -mov bx,6000h -mov es,bx -int 48h -push es -pop ds -mov bx,5000h -mov es,bx -xor si,si -xor di,di -mov ah,6 -int 48h -push es -pop ds -mov ax,0009h -int 47h -mov ah,38 -int 47h -mov ah,35 -int 47h -mov ah,37 -int 47h -mov ah,2 -int 47h -mov cx,400 -mov bx,40 -mov ah,36 -int 47h -mov ax,0 -int 16h -mov ah,39 -int 47h -mov ax,0004 -int 47h -db 0CBH -logo db 'cos.rip',0 -end start +.model tiny +.386c +.code +org 0100h + + +start: +mov si,offset logo +mov ah,4 +xor di,di +mov bx,8000h +mov es,bx +int 48h +jc problem + +push es +pop ds +mov bx,7000h +mov es,bx +xor si,si +xor di,di +mov ah,6 +int 48h +jc problem2 + +push es +pop ds +xor si,si + +mov ax,0008h +int 47h +mov ah,38 +int 47h +mov ah,2 +int 47h +mov cx,300 +mov bx,30 +mov ah,37 +int 47h +mov ah,15h +mov cl,11 +int 47h +push cs +pop ds +mov ah,13 +mov si,offset poper +int 47h +mov ax,0 +int 16h +mov ah,39 +int 47h +mov ax,0004 +int 47h +db 0CBH + +problem: +push cs +pop ds +mov ah,13 +mov si,offset error +int 47h +mov ax,0 +int 16h +db 0CBh + +problem2: +push cs +pop ds +mov ah,13 +mov si,offset error2 +int 47h +mov ax,0 +int 16h +db 0CBh + +poper db 'COS2000 en mode graphique',0 +logo db 'cos.rip',0 +ok1 db 'Chargement de l''image OK',0 +ok2 db 'Decompression de l''image OK',0 +error db 'Une erreur est apparue lors du chargement de l''image',0 +error2 db 'Une erreur est apparue lors de la decompression de l''image',0 +end start diff --git a/programs/lpt/com.asm b/programs/lpt/com.asm old mode 100755 new mode 100644 index d9b7f42..4c83399 --- a/programs/lpt/com.asm +++ b/programs/lpt/com.asm @@ -1,471 +1,471 @@ -.model tiny -.486 -smart -.code -org 0100h -start: -;call setemettor -call getfirstlpt -call initlpt -call receivecommand -ret - - - -gogo db 'Salut' -gotoz db 23 dup (0) - -;Re‡ois une commande et l'execute -Receivecommand: -push ax bx cx di es -push cs -pop es -mov di,offset command -call receivelptblock -mov bl,al -xor bh,bh -shl bx,1 -add bx,offset cmd -call [bx] -pop es di cx ax -ret -command db 25 dup (0) -cmd dw nothings - dw sendram - -nothings: -ret - -Sendram: -push ax cx si ds -mov ax,es:[di] -mov si,ax -mov ax,es:[di+2] -mov ds,ax -mov cx,es:[di+2] -call sendlptblock -pop ds si cx ax -ret - - -;---------Segment Adress----------- -Bios equ 040h -;---------Offset Adress------------ -Lptadr equ 008h -Timer equ 06Ch -;---------Constant----------------- -onesec equ 18 -tensec equ 182 -Ack equ 00 -Nack equ 0FFh -maxtry equ 10 -tokenstart equ 0 -tokennext equ 1 -tokenstop equ 2 -tokenbad equ 3 -tokenresend equ 4 - - -Initlpt: -push ax ecx -call StartTimer -cmp emettor,0 -je receptinit -mov al,10000b -call SetLptOut -waitinit1: -call EndTimer -cmp cx,cs:timeout -ja errorinit -call getlptIn -cmp al,00000b -jnz waitinit1 -jmp endinit -receptinit: -call EndTimer -cmp cx,cs:timeout -ja errorinit -call getlptIn -cmp al,00000b -jnz receptinit -mov al,10000b -call SetLptOut -endinit: -clc -pop ecx ax -ret -errorinit: -stc -pop ecx ax -ret - - -;-Envoie DL (dh) JNE si problŠme JNC error timeout -Sendlpt: -push ax bx ecx -call StartTimer -mov dh,dl -mov al,dl -and al,0Fh -call SetLptOut -waitSend: -call EndTimer -cmp cx,cs:timeout -ja errorsend -call getlptIn -bt ax,4 -jnc waitsend -and al,0Fh -mov bl,al -call StartTimer ;///// -mov al,dh -shr al,4 -or al,10000b -call SetLptOut -waitSend2: -call EndTimer -cmp cx,cs:timeout -ja errorsend -call getlptIn -bt ax,4 -jc waitsend2 -and al,0Fh -shl al,4 -add bl,al -cmp dl,bl -pop ecx bx ax -clc -ret -errorsend: -pop ecx bx ax -stc -ret - - -;-Re‡ois DL (dh) -Receivelpt: -push ax bx ecx -call StartTimer -waitreceive: -call EndTimer -cmp cx,cs:timeout -ja errorreceive -call getlptIn -bt ax,4 -jnc waitreceive -and al,0Fh -mov dl,al -call SetLptOut -call StartTimer ;///// -waitreceive2: -call EndTimer -cmp cx,cs:timeout -ja errorreceive -call getlptIn -bt ax,4 -jc waitreceive2 -and al,0Fh -mov dh,al -shl dh,4 -add dl,dh -or al,10000b -call SetlptOut -clc -pop ecx bx ax -ret -errorreceive: -stc -pop ecx bx ax -ret - -;-AX -SetTimeout: -mov cs:Timeout,ax -ret - -timeout dw tensec - -getTimeout: -mov ax,cs:Timeout -ret - -SetEmettor: -mov cs:Emettor,1 -ret - -Emettor db 0 - -SetReceptor: -mov cs:Emettor,0 -ret - -;->bx Nøport->Adresse dx -GetLpt: -push ax bx ds -mov ax,bios -mov ds,ax -dec bx -shl bx,1 -mov dx,ds:[Lptadr+bx] -mov cs:lpt,dx -pop ds bx ax -ret -lpt dw 0 - -;->bx Nøport->Adresse dx -GetFirstLpt: -push ax ds -mov ax,bios -mov ds,ax -xor bx,bx -findlpt: -mov dx,ds:[Lptadr+bx] -cmp dx,0 -jne oklpt -add bx,2 -cmp bx,4 -jbe findlpt -oklpt: -mov cs:lpt,dx -pop ds ax -ret - -;-> -StartTimer: -push ax ecx ds -mov ax,Bios -mov ds,ax -mov ecx,ds:[timer] -mov times,ecx -pop ds ecx ax -ret -times dd 0 - -;->Ecx time elapsed -EndTimer: -push ax ds -mov ax,Bios -mov ds,ax -mov ecx,ds:[timer] -sub ecx,times -mov ecx,0 -pop ds ax -ret - -;-> -GetLptOut: -push dx -mov dx,lpt -in al,dx -pop dx -ret - -GetLptIn: -push dx -mov dx,lpt -inc dx -in al,dx -shr al,3 -pop dx -ret - -GetLptInOut: -push dx -mov dx,lpt -add dx,2 -in al,dx -and al,11111b -pop dx -ret - -SetLptOut: -push dx -mov dx,lpt -out dx,al -pop dx -ret - -SetLptIn: -push dx -mov dx,lpt -inc dx -out dx,al -pop dx -ret - -SetLptInOut: -push dx -mov dx,lpt -add dx,2 -out dx,al -pop dx -ret - -;R‚alise un checksum 8 bits sur donn‚es DS:SI, nb CX r‚sultat dans dl -Checksum8: -push cx si -check: -add dl,[si] -inc si -dec cx -jnz check -pop si cx -ret - -;DS:SI pointeur sur donn‚es, CX nombres de donn‚es, AL token -SendLptBlock: -push ax bx cx edx si edi bp -mov dx,cx -shl edx,16 -mov dh,al -call checksum8 -mov edi,edx -xor dh,dh -mov bp,dx -mov ah,maxtry -retry: -mov bl,4 -xor al,al -header: -mov dx,di -call sendlpt -setne al -jc outt -rol edi,8 -dec bl -jnz header -cmp al,0 -jne notgood -mov dl,ACK -jmp allsend -notgood: -mov dl,NACK -allsend: -call sendlpt -setne al -jc outt -cmp al,0 -je okheader -dec ah -jnz retry -jmp outt -okheader: -cmp cx,0 -je endoftrans -mov di,maxtry -retry2: -mov bx,cx -xor ax,ax -body: -mov dl,[si+bx-1] -add ah,dl -call sendlpt -setne al -jc outt -dec bx -jnz body -cmp al,0 -jne notgood2 -mov dl,ACK -jmp allisend -notgood2: -mov dl,NACK -allisend: -call sendlpt -setne al -jc outt -cmp al,0 -je endoftrans -dec di -jnz retry2 -outt: -stc -endoftrans: -mov al,ah -xor ah,ah -cmp bp,ax -pop bp edi si edx cx bx ax -ret - -;Receptionne en es:di les donn‚es au nombres de CX token AL (AH) (ECX) -receiveLptBlock: -push ax bx dx si bp -mov ah,maxtry -retrye: -mov bl,4 -headere: -call receivelpt -jc outte -mov cl,dl -rol ecx,8 -dec bl -jnz headere -call receivelpt -jc outte -cmp dl,ACK -je okheadere -dec ah -jnz retrye -jmp outte -okheadere: -mov al,ch -xor ch,ch -mov bp,cx -rol ecx,16 -cmp cx,0 -je endoftranse -mov si,maxtry -retrye2: -mov bx,cx -xor ah,ah -bodye: -call receivelpt -jc outte -mov es:[di+bx-1],dl -add ah,dl -dec bx -jnz bodye -call receivelpt -jc outte -cmp dl,ACK -je endoftranse -dec si -jnz retrye2 -outte: -stc -endoftranse: -mov bl,ah -xor bh,bh -cmp bp,bx -pop bp si dx bx ax -ret - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -end start; +.model tiny +.486 +smart +.code +org 0100h +start: +;call setemettor +call getfirstlpt +call initlpt +call receivecommand +ret + + + +gogo db 'Salut' +gotoz db 23 dup (0) + +;Re‡ois une commande et l'execute +Receivecommand: +push ax bx cx di es +push cs +pop es +mov di,offset command +call receivelptblock +mov bl,al +xor bh,bh +shl bx,1 +add bx,offset cmd +call [bx] +pop es di cx ax +ret +command db 25 dup (0) +cmd dw nothings + dw sendram + +nothings: +ret + +Sendram: +push ax cx si ds +mov ax,es:[di] +mov si,ax +mov ax,es:[di+2] +mov ds,ax +mov cx,es:[di+2] +call sendlptblock +pop ds si cx ax +ret + + +;---------Segment Adress----------- +Bios equ 040h +;---------Offset Adress------------ +Lptadr equ 008h +Timer equ 06Ch +;---------Constant----------------- +onesec equ 18 +tensec equ 182 +Ack equ 00 +Nack equ 0FFh +maxtry equ 10 +tokenstart equ 0 +tokennext equ 1 +tokenstop equ 2 +tokenbad equ 3 +tokenresend equ 4 + + +Initlpt: +push ax ecx +call StartTimer +cmp emettor,0 +je receptinit +mov al,10000b +call SetLptOut +waitinit1: +call EndTimer +cmp cx,cs:timeout +ja errorinit +call getlptIn +cmp al,00000b +jnz waitinit1 +jmp endinit +receptinit: +call EndTimer +cmp cx,cs:timeout +ja errorinit +call getlptIn +cmp al,00000b +jnz receptinit +mov al,10000b +call SetLptOut +endinit: +clc +pop ecx ax +ret +errorinit: +stc +pop ecx ax +ret + + +;-Envoie DL (dh) JNE si problŠme JNC error timeout +Sendlpt: +push ax bx ecx +call StartTimer +mov dh,dl +mov al,dl +and al,0Fh +call SetLptOut +waitSend: +call EndTimer +cmp cx,cs:timeout +ja errorsend +call getlptIn +bt ax,4 +jnc waitsend +and al,0Fh +mov bl,al +call StartTimer ;///// +mov al,dh +shr al,4 +or al,10000b +call SetLptOut +waitSend2: +call EndTimer +cmp cx,cs:timeout +ja errorsend +call getlptIn +bt ax,4 +jc waitsend2 +and al,0Fh +shl al,4 +add bl,al +cmp dl,bl +pop ecx bx ax +clc +ret +errorsend: +pop ecx bx ax +stc +ret + + +;-Re‡ois DL (dh) +Receivelpt: +push ax bx ecx +call StartTimer +waitreceive: +call EndTimer +cmp cx,cs:timeout +ja errorreceive +call getlptIn +bt ax,4 +jnc waitreceive +and al,0Fh +mov dl,al +call SetLptOut +call StartTimer ;///// +waitreceive2: +call EndTimer +cmp cx,cs:timeout +ja errorreceive +call getlptIn +bt ax,4 +jc waitreceive2 +and al,0Fh +mov dh,al +shl dh,4 +add dl,dh +or al,10000b +call SetlptOut +clc +pop ecx bx ax +ret +errorreceive: +stc +pop ecx bx ax +ret + +;-AX +SetTimeout: +mov cs:Timeout,ax +ret + +timeout dw tensec + +getTimeout: +mov ax,cs:Timeout +ret + +SetEmettor: +mov cs:Emettor,1 +ret + +Emettor db 0 + +SetReceptor: +mov cs:Emettor,0 +ret + +;->bx Nøport->Adresse dx +GetLpt: +push ax bx ds +mov ax,bios +mov ds,ax +dec bx +shl bx,1 +mov dx,ds:[Lptadr+bx] +mov cs:lpt,dx +pop ds bx ax +ret +lpt dw 0 + +;->bx Nøport->Adresse dx +GetFirstLpt: +push ax ds +mov ax,bios +mov ds,ax +xor bx,bx +findlpt: +mov dx,ds:[Lptadr+bx] +cmp dx,0 +jne oklpt +add bx,2 +cmp bx,4 +jbe findlpt +oklpt: +mov cs:lpt,dx +pop ds ax +ret + +;-> +StartTimer: +push ax ecx ds +mov ax,Bios +mov ds,ax +mov ecx,ds:[timer] +mov times,ecx +pop ds ecx ax +ret +times dd 0 + +;->Ecx time elapsed +EndTimer: +push ax ds +mov ax,Bios +mov ds,ax +mov ecx,ds:[timer] +sub ecx,times +mov ecx,0 +pop ds ax +ret + +;-> +GetLptOut: +push dx +mov dx,lpt +in al,dx +pop dx +ret + +GetLptIn: +push dx +mov dx,lpt +inc dx +in al,dx +shr al,3 +pop dx +ret + +GetLptInOut: +push dx +mov dx,lpt +add dx,2 +in al,dx +and al,11111b +pop dx +ret + +SetLptOut: +push dx +mov dx,lpt +out dx,al +pop dx +ret + +SetLptIn: +push dx +mov dx,lpt +inc dx +out dx,al +pop dx +ret + +SetLptInOut: +push dx +mov dx,lpt +add dx,2 +out dx,al +pop dx +ret + +;R‚alise un checksum 8 bits sur donn‚es DS:SI, nb CX r‚sultat dans dl +Checksum8: +push cx si +check: +add dl,[si] +inc si +dec cx +jnz check +pop si cx +ret + +;DS:SI pointeur sur donn‚es, CX nombres de donn‚es, AL token +SendLptBlock: +push ax bx cx edx si edi bp +mov dx,cx +shl edx,16 +mov dh,al +call checksum8 +mov edi,edx +xor dh,dh +mov bp,dx +mov ah,maxtry +retry: +mov bl,4 +xor al,al +header: +mov dx,di +call sendlpt +setne al +jc outt +rol edi,8 +dec bl +jnz header +cmp al,0 +jne notgood +mov dl,ACK +jmp allsend +notgood: +mov dl,NACK +allsend: +call sendlpt +setne al +jc outt +cmp al,0 +je okheader +dec ah +jnz retry +jmp outt +okheader: +cmp cx,0 +je endoftrans +mov di,maxtry +retry2: +mov bx,cx +xor ax,ax +body: +mov dl,[si+bx-1] +add ah,dl +call sendlpt +setne al +jc outt +dec bx +jnz body +cmp al,0 +jne notgood2 +mov dl,ACK +jmp allisend +notgood2: +mov dl,NACK +allisend: +call sendlpt +setne al +jc outt +cmp al,0 +je endoftrans +dec di +jnz retry2 +outt: +stc +endoftrans: +mov al,ah +xor ah,ah +cmp bp,ax +pop bp edi si edx cx bx ax +ret + +;Receptionne en es:di les donn‚es au nombres de CX token AL (AH) (ECX) +receiveLptBlock: +push ax bx dx si bp +mov ah,maxtry +retrye: +mov bl,4 +headere: +call receivelpt +jc outte +mov cl,dl +rol ecx,8 +dec bl +jnz headere +call receivelpt +jc outte +cmp dl,ACK +je okheadere +dec ah +jnz retrye +jmp outte +okheadere: +mov al,ch +xor ch,ch +mov bp,cx +rol ecx,16 +cmp cx,0 +je endoftranse +mov si,maxtry +retrye2: +mov bx,cx +xor ah,ah +bodye: +call receivelpt +jc outte +mov es:[di+bx-1],dl +add ah,dl +dec bx +jnz bodye +call receivelpt +jc outte +cmp dl,ACK +je endoftranse +dec si +jnz retrye2 +outte: +stc +endoftranse: +mov bl,ah +xor bh,bh +cmp bp,bx +pop bp si dx bx ax +ret + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +end start; diff --git a/programs/lpt/project1.dpr b/programs/lpt/project1.dpr old mode 100755 new mode 100644 index e4396d5..a771b7e --- a/programs/lpt/project1.dpr +++ b/programs/lpt/project1.dpr @@ -1,12 +1,12 @@ -program Project1; - -uses - Forms, - Unit1 in 'UNIT1.PAS' {Form1}; - -{$R *.RES} - -begin - Application.CreateForm(TForm1, Form1); - Application.Run; -end. +program Project1; + +uses + Forms, + Unit1 in 'UNIT1.PAS' {Form1}; + +{$R *.RES} + +begin + Application.CreateForm(TForm1, Form1); + Application.Run; +end. diff --git a/programs/lpt/project1.opt b/programs/lpt/project1.opt old mode 100755 new mode 100644 index 8aea239..8ebc76c --- a/programs/lpt/project1.opt +++ b/programs/lpt/project1.opt @@ -1,34 +1,34 @@ -[Compiler] -A=1 -B=0 -D=1 -F=0 -I=1 -K=1 -L=1 -P=1 -Q=0 -R=0 -S=1 -T=0 -U=1 -V=1 -W=0 -X=1 -Y=1 - -[Linker] -MapFile=0 -LinkBuffer=0 -DebugInfo=0 -OptimizeExe=0 -StackSize=16384 -HeapSize=8192 - -[Directories] -OutputDir= -SearchPath= -Conditionals= - -[Parameters] -RunParams= +[Compiler] +A=1 +B=0 +D=1 +F=0 +I=1 +K=1 +L=1 +P=1 +Q=0 +R=0 +S=1 +T=0 +U=1 +V=1 +W=0 +X=1 +Y=1 + +[Linker] +MapFile=0 +LinkBuffer=0 +DebugInfo=0 +OptimizeExe=0 +StackSize=16384 +HeapSize=8192 + +[Directories] +OutputDir= +SearchPath= +Conditionals= + +[Parameters] +RunParams= diff --git a/programs/lpt/project1.res b/programs/lpt/project1.res old mode 100755 new mode 100644 diff --git a/programs/lpt/unit1.dcu b/programs/lpt/unit1.dcu old mode 100755 new mode 100644 diff --git a/programs/lpt/unit1.dfm b/programs/lpt/unit1.dfm old mode 100755 new mode 100644 diff --git a/programs/lpt/unit1.pas b/programs/lpt/unit1.pas old mode 100755 new mode 100644 index 9546011..d3a6687 --- a/programs/lpt/unit1.pas +++ b/programs/lpt/unit1.pas @@ -1,517 +1,517 @@ -unit Unit1; - -interface - -uses - SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls, - Forms, Dialogs, StdCtrls, Grids, Outline, DirOutln, FileCtrl, Buttons, - Gauges, ExtCtrls, Spin, Mask; - -type - TForm1 = class(TForm) - DriveComboBox1: TDriveComboBox; - FilterComboBox1: TFilterComboBox; - FileListBox1: TFileListBox; - DirectoryListBox1: TDirectoryListBox; - SpeedButton1: TSpeedButton; - SpeedButton2: TSpeedButton; - Memo1: TMemo; - Memo2: TMemo; - Memo3: TMemo; - SpeedButton3: TSpeedButton; - SpeedButton4: TSpeedButton; - Gauge1: TGauge; - SpeedButton5: TSpeedButton; - SpeedButton6: TSpeedButton; - SpinButton1: TSpinButton; - MaskEdit1: TMaskEdit; - SpeedButton8: TSpeedButton; - SpinButton2: TSpinButton; - okm: TCheckBox; - Label1: TLabel; - procedure FormActivate(Sender: TObject); - procedure SpinButton1DownClick(Sender: TObject); - procedure SpinButton1UpClick(Sender: TObject); - procedure showadress(Sender: TObject); - procedure SpeedButton6Click(Sender: TObject); - procedure SpeedButton8Click(Sender: TObject); - procedure MaskEdit1Change(Sender: TObject); - procedure SpinButton2DownClick(Sender: TObject); - procedure SpinButton2UpClick(Sender: TObject); - procedure SpeedButton3Click(Sender: TObject); - procedure Memo2Click(Sender: TObject); - - private - { Private-déclarations } - public - { Public-déclarations } - end; - -const UNESEC = 1000; - DIXSEC = 4000; - ACK = $00; - NAK = $FF; - MAXTRY = 5; - -type DBloc = array[ 1..15534 ] of byte; -type BHEADER = record - case boolean of - true : ( Checksum:byte; - Lenb : byte; - Lenh : byte; - Token : byte; - - ); - false : ( Champ : array[ 0..3 ] of byte ); - end; - -var - Form1: TForm1; - Inlpt : word; - Outlpt : word; - times : longint; - Block : DBLOC; - adress :longint; - errors: boolean; - reste:integer; - pop:boolean; - -implementation - -{$R *.DFM} - -function Getlpt( Number : integer ) : boolean; -begin - Outlpt := MemW[ $0040: 6 + Number * 2 ]; - if ( Outlpt <> 0 ) then - begin - Inlpt := Outlpt + 1; - Getlpt := TRUE; - end - else - Getlpt := FALSE; -end; - -function getfirstlpt:byte; -var i:integer; -begin -i:=1; - while (not(getlpt(i)) or (i>4)) do inc(i); - if (getlpt(i)=false) then i:=0; - getfirstlpt:= i; -end; - -function getb:byte; -begin - getb:=port[inlpt] and $F8 -end; - -procedure putb(what:byte); -begin - port[outlpt]:=what; -end; - -procedure starttimer; -begin - times:=GetTickCount; -end; - -function endtimer:longint; -begin - endtimer:=getTickCount-times; -end; - -function Initlpt( Emetteur : boolean ) : boolean; -begin - errors:=false; - putb($10); - putb($18); - putb($10); - starttimer; - if ( Emetteur ) then - begin - while ( ( GetB <> $00 ) and ( Endtimer <= DIXSEC ) ) do; - end - else - begin - while ( ( GetB <> $00 ) and ( Endtimer <= DIXSEC ) ) do; - PutB( $10 ); - end; - Initlpt := ( Endtimer <= DIXSEC ); -end; - -function sendlpt( Wert : byte ) : boolean; -var Retour : byte; -label fin; -begin -if errors then goto fin; - Starttimer; - PutB( Wert and $0F ); - while ( ( ( GetB and 128 ) = 0 ) and ( Endtimer <= DIXSEC )) do; - if ( Endtimer > DIXSEC ) then - begin - errors:=true; - goto fin; - end; - Retour := ( GetB shr 3 ) and $0F; - Starttimer; - PutB( ( Wert shr 4 ) or $10 ); - while ( ( ( GetB and 128 ) <> 0 ) and ( Endtimer <= DIXSEC ) ) do - if ( Endtimer > DIXSEC ) then - begin - errors:=true; - goto fin; - end; - Retour := Retour or ( ( GetB shl 1 ) and $F0 ); - fin: - sendlpt := ( Wert = Retour ); -end; - -function receivelpt : byte; -var LoNib, - HiNib : byte; -label fin; -begin - if errors then goto fin; - Starttimer; - while ( ( ( GetB and 128 ) = 0 ) and ( Endtimer <= DIXSEC )) do; - if ( Endtimer > DIXSEC ) then - begin - errors:=true; - goto fin; - end; - LoNib := ( GetB shr 3 ) and $0F; - PutB( LoNib ); - Starttimer; - while ( ( ( GetB and 128 ) <> 0 ) and ( Endtimer <= DIXSEC ) ) do; - if ( Endtimer > DIXSEC ) then - begin - errors:=true; - goto fin; - end; - HiNib := ( GetB shl 1 ) and $F0; - PutB( ( HiNib shr 4 ) or $10 ); - fin: - receivelpt := ( LoNib or HiNib ); -end; - -function checksum8(Nombre:word;Dptr : pointer):byte ; -var donnees : ^DBloc ; - i:word; - ch:byte; -begin -ch:=0; -donnees:=dptr; - for i:=1 to Nombre do ch:=ch + Donnees^[ i ]; - checksum8:=ch; - end; - -function SendlptBlock( Token : byte; - Nombre : word; - Dptr : pointer ):boolean; -var header : BHEADER; - ok : boolean; - i : word; - trys : word; - Donnees : ^DBloc; - label fin; -begin - form1.gauge1.visible:=true; - header.Token := Token; - header.Lenb := (Nombre and $FF00) shr 8; - header.Lenh := Nombre and $FF; - header.Checksum:=checksum8(nombre,Dptr); - trys := MAXTRY; - repeat - ok := TRUE; - for i := 0 to 3 do - ok := ok and sendlpt( Header.Champ[ i ] ); - if ( ok ) then - ok := ok and sendlpt( ACK ) - else - ok := ok and sendlpt( NAK ); - if ( not ok ) then - dec( trys ); - until ( ( ok ) or ( trys = 0 ) or (errors)); - if ( (trys = 0) or (errors)) then - begin - goto fin; - SendlptBlock:=false; - end; - if ( Nombre > 0 ) then - begin - Donnees := DPTR; - trys := MAXTRY; - repeat - ok := TRUE; - for i := Nombre downto 1 do - begin - ok := ok and sendlpt( Donnees^[ i ] ); - reste:=trunc(100-i/nombre*100); - form1.gauge1.progress:=reste - end; - if ( ok ) then - ok := ok and sendlpt( ACK ) - else - ok := ok and sendlpt( NAK ); - if ( not ok ) then - dec( trys ); - until ( ( ok ) or ( trys = 0 ) or (errors)); - if ( (trys = 0) or (errors)) then - begin - goto fin; - SendlptBlock:=false; - end; - end; - SendlptBlock:=true; - fin: - form1.gauge1.visible:=false; -end; - -function ReceivelptBlock( var Token : byte; - var Len : word; - Dptr : pointer ):boolean; -var header : BHEADER; - ok : boolean; - i : word; - trys : word; - EscapeStatus : boolean; - ByteBuffer : byte; - Donnees : ^DBloc; - label fin,good; -begin - form1.gauge1.visible:=true; - trys := MAXTRY; - repeat - for i:= 0 to 3 do - Header.Champ[ i ] := receivelpt; - ByteBuffer := receivelpt; - if ( ByteBuffer <> ACK ) then - dec( trys ); - until ( ( trys = 0 ) or ( ByteBuffer = ACK ) or (errors)); - if ( (trys = 0) or (errors)) then - begin - goto fin; - receivelptblock:=false; - end; - Token := Header.Token; - Len := Header.Lenh+(Header.Lenb shl 8); - if ( Len > 0 ) then - begin - Donnees := Dptr; - trys := MAXTRY; - repeat - for i := len downto 1 do - begin - Donnees^[ i ] := receivelpt; - reste:=trunc(100-i/len*100); - form1.gauge1.progress:=reste - end; - ByteBuffer := receivelpt; - if ( ByteBuffer <> ACK ) then - dec( trys ); - until ( ( trys = 0 ) or ( ByteBuffer = ACK ) ); - if ( trys = 0 ) then - begin - goto fin; - receivelptblock:=false; - end; - end; - receivelptblock:=true; - fin: - form1.gauge1.visible:=false; -end; - - -function Sendfile(name:string):boolean; -var lus:word; -Fichier:file; -begin -assign( Fichier, Name ); -reset( Fichier, 1 ); -Blockread( Fichier, Block, 15000, Lus ); -if lus>0 then -Sendfile:=SendlptBlock( 1, Lus, @Block ) -else -Sendfile:=false; -end; - -procedure TForm1.FormActivate(Sender: TObject); -begin -adress:=0; -showadress(sender); -Memo2Click(Sender); -SpeedButton8Click(Sender); -pop:=true; -end; - -procedure TForm1.SpinButton1DownClick(Sender: TObject); -begin -if (adress>0) and okm.checked then -begin -dec(adress); -SpeedButton6Click(Sender); -end; -end; - -procedure TForm1.SpinButton1UpClick(Sender: TObject); -begin -if (adress<65536*16) and okm.checked then -begin -inc(adress); -SpeedButton6Click(Sender); -end; -end; - -function hextoint(hex:string;n:word):longint; -var -resu,exp:longint; -i:word; -begin - hex :=UpperCase(hex); - resu:=0; - exp:=1; - for i:=n downto 1 do - begin - resu:=resu+(Pos(hex[i],'0123456789ABCDEF')-1)*(exp); - exp:=exp*16 - end; - hextoint:=resu; - end ; - - function adresstoint(hex:string):longint; -begin -adresstoint:=hextoint(Copy(hex, 1, 4),4)shl 4 + hextoint(Copy(hex, length(hex)-3, 4),4) -end; - -procedure TForm1.showadress(Sender: TObject); -var i,j,adh,adl:word; -adress2:longint; -old,old2:string; -begin -memo1.clear; -memo2.clear; -memo3.clear; -for i:=0 to 29 do -begin -adress2:=adress+i*16; -adl:=adress2 and $FFFF; -adh:=(adress2 and $F0000) shr 4; -memo1.lines.add(IntToHex(adh,4)+':'+IntToHex(adl,4)) ; -old:=''; -old2:=''; -for j:=1 to 16 do -begin -old:=old+inttohex(block[i*16+j],2); -if block[i*16+j]=0 then -old2:=old2+'.' -else -old2:=old2+char(block[i*16+j]) ; -if j mod 2=0 then old:=old+' '; -end; -memo2.lines.add(old) ; -memo3.lines.add(old2) ; -end -end; - -procedure TForm1.SpeedButton8Click(Sender: TObject); -begin -if getfirstlpt=0 then showmessage('Pas de port parallèle détecté'); -errors:=false; -end; - -procedure TForm1.SpeedButton6Click(Sender: TObject); -var adl,adh,good:word; -tok:byte; -ok:boolean; -begin -if (inlpt=0) then SpeedButton8Click(sender); -if ((inlpt<>0) and (initlpt(true))) then -begin - adl:=adress and $FFFF; - adh:=(adress and $F0000) shr 4; -Block[1]:=lo(adl); -Block[2]:= hi(adl); -Block[3]:= lo(adh); -Block[4]:= hi(adh); -Block[5]:= lo(512); -Block[6]:= hi(512) ; -ok:=false; -if SendlptBlock( 1,6,@Block) then ok:=receivelptBlock(tok,good ,@Block); {demande de RAM} -if not(ok) or errors then Showmessage('Erreur de transmission !!!!!!!!!!'); -showadress(sender); -end -else -Showmessage('Pas de PC distant'); -putb($08); -errors:=false; -end; - -procedure TForm1.MaskEdit1Change(Sender: TObject); -begin -if pop then -begin -adress:=adresstoint(maskedit1.text); -if okm.checked=true then SpeedButton6Click(sender); -showadress(sender); -end; -end; - -procedure TForm1.SpinButton2DownClick(Sender: TObject); -begin - if (adress+16*30<=65536*16) and okm.checked then - begin - adress:=adress+16*30; -SpeedButton6Click(Sender); -end; -end; - -procedure TForm1.SpinButton2UpClick(Sender: TObject); -begin - if (adress-16*30>=0) and okm.checked then - begin - adress:=adress-16*30; -SpeedButton6Click(Sender); -end; -end; -procedure TForm1.SpeedButton3Click(Sender: TObject); -var adl,adh,good:word; -adress2:longint; -tok:byte; -ok:boolean; -begin -if (inlpt=0) then SpeedButton8Click(sender); -if ((inlpt<>0) and (initlpt(true))) then -begin - adress2 :=adresstoint(maskedit1.text); - adl:=adress2 and $FFFF; - adh:=(adress2 and $F0000) shr 4; -Block[1]:=lo(adl); -Block[2]:= hi(adl); -Block[3]:= lo(adh); -Block[4]:= hi(adh); -ok:=SendlptBlock( 7,4,@Block); -if not(ok) or errors then Showmessage('Erreur de transmission !!!!!!!!!!'); -end -else -Showmessage('Pas de PC distant'); -putb($18); -errors:=false; -end; -procedure TForm1.Memo2Click(Sender: TObject); -var ligne,col,pos,adl,adh:word; -adress2:longint; -begin - ligne:=memo2.selstart div 42; - col:= (trunc((memo2.selstart mod 42+1) / 2.5)); - pos:=16*ligne+col; - label1.caption:=inttostr(ligne)+':'+inttostr(col)+':'+inttostr(pos); - adress2:=pos+adress; - adl:=adress2 and $FFFF; - adh:=(adress2 and $F0000) shr 4; - pop:=false; - maskedit1.text:=inttohex(adh,4)+':'+inttohex(adl,4); - pop:=true; -end; - -end. +unit Unit1; + +interface + +uses + SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls, + Forms, Dialogs, StdCtrls, Grids, Outline, DirOutln, FileCtrl, Buttons, + Gauges, ExtCtrls, Spin, Mask; + +type + TForm1 = class(TForm) + DriveComboBox1: TDriveComboBox; + FilterComboBox1: TFilterComboBox; + FileListBox1: TFileListBox; + DirectoryListBox1: TDirectoryListBox; + SpeedButton1: TSpeedButton; + SpeedButton2: TSpeedButton; + Memo1: TMemo; + Memo2: TMemo; + Memo3: TMemo; + SpeedButton3: TSpeedButton; + SpeedButton4: TSpeedButton; + Gauge1: TGauge; + SpeedButton5: TSpeedButton; + SpeedButton6: TSpeedButton; + SpinButton1: TSpinButton; + MaskEdit1: TMaskEdit; + SpeedButton8: TSpeedButton; + SpinButton2: TSpinButton; + okm: TCheckBox; + Label1: TLabel; + procedure FormActivate(Sender: TObject); + procedure SpinButton1DownClick(Sender: TObject); + procedure SpinButton1UpClick(Sender: TObject); + procedure showadress(Sender: TObject); + procedure SpeedButton6Click(Sender: TObject); + procedure SpeedButton8Click(Sender: TObject); + procedure MaskEdit1Change(Sender: TObject); + procedure SpinButton2DownClick(Sender: TObject); + procedure SpinButton2UpClick(Sender: TObject); + procedure SpeedButton3Click(Sender: TObject); + procedure Memo2Click(Sender: TObject); + + private + { Private-déclarations } + public + { Public-déclarations } + end; + +const UNESEC = 1000; + DIXSEC = 4000; + ACK = $00; + NAK = $FF; + MAXTRY = 5; + +type DBloc = array[ 1..15534 ] of byte; +type BHEADER = record + case boolean of + true : ( Checksum:byte; + Lenb : byte; + Lenh : byte; + Token : byte; + + ); + false : ( Champ : array[ 0..3 ] of byte ); + end; + +var + Form1: TForm1; + Inlpt : word; + Outlpt : word; + times : longint; + Block : DBLOC; + adress :longint; + errors: boolean; + reste:integer; + pop:boolean; + +implementation + +{$R *.DFM} + +function Getlpt( Number : integer ) : boolean; +begin + Outlpt := MemW[ $0040: 6 + Number * 2 ]; + if ( Outlpt <> 0 ) then + begin + Inlpt := Outlpt + 1; + Getlpt := TRUE; + end + else + Getlpt := FALSE; +end; + +function getfirstlpt:byte; +var i:integer; +begin +i:=1; + while (not(getlpt(i)) or (i>4)) do inc(i); + if (getlpt(i)=false) then i:=0; + getfirstlpt:= i; +end; + +function getb:byte; +begin + getb:=port[inlpt] and $F8 +end; + +procedure putb(what:byte); +begin + port[outlpt]:=what; +end; + +procedure starttimer; +begin + times:=GetTickCount; +end; + +function endtimer:longint; +begin + endtimer:=getTickCount-times; +end; + +function Initlpt( Emetteur : boolean ) : boolean; +begin + errors:=false; + putb($10); + putb($18); + putb($10); + starttimer; + if ( Emetteur ) then + begin + while ( ( GetB <> $00 ) and ( Endtimer <= DIXSEC ) ) do; + end + else + begin + while ( ( GetB <> $00 ) and ( Endtimer <= DIXSEC ) ) do; + PutB( $10 ); + end; + Initlpt := ( Endtimer <= DIXSEC ); +end; + +function sendlpt( Wert : byte ) : boolean; +var Retour : byte; +label fin; +begin +if errors then goto fin; + Starttimer; + PutB( Wert and $0F ); + while ( ( ( GetB and 128 ) = 0 ) and ( Endtimer <= DIXSEC )) do; + if ( Endtimer > DIXSEC ) then + begin + errors:=true; + goto fin; + end; + Retour := ( GetB shr 3 ) and $0F; + Starttimer; + PutB( ( Wert shr 4 ) or $10 ); + while ( ( ( GetB and 128 ) <> 0 ) and ( Endtimer <= DIXSEC ) ) do + if ( Endtimer > DIXSEC ) then + begin + errors:=true; + goto fin; + end; + Retour := Retour or ( ( GetB shl 1 ) and $F0 ); + fin: + sendlpt := ( Wert = Retour ); +end; + +function receivelpt : byte; +var LoNib, + HiNib : byte; +label fin; +begin + if errors then goto fin; + Starttimer; + while ( ( ( GetB and 128 ) = 0 ) and ( Endtimer <= DIXSEC )) do; + if ( Endtimer > DIXSEC ) then + begin + errors:=true; + goto fin; + end; + LoNib := ( GetB shr 3 ) and $0F; + PutB( LoNib ); + Starttimer; + while ( ( ( GetB and 128 ) <> 0 ) and ( Endtimer <= DIXSEC ) ) do; + if ( Endtimer > DIXSEC ) then + begin + errors:=true; + goto fin; + end; + HiNib := ( GetB shl 1 ) and $F0; + PutB( ( HiNib shr 4 ) or $10 ); + fin: + receivelpt := ( LoNib or HiNib ); +end; + +function checksum8(Nombre:word;Dptr : pointer):byte ; +var donnees : ^DBloc ; + i:word; + ch:byte; +begin +ch:=0; +donnees:=dptr; + for i:=1 to Nombre do ch:=ch + Donnees^[ i ]; + checksum8:=ch; + end; + +function SendlptBlock( Token : byte; + Nombre : word; + Dptr : pointer ):boolean; +var header : BHEADER; + ok : boolean; + i : word; + trys : word; + Donnees : ^DBloc; + label fin; +begin + form1.gauge1.visible:=true; + header.Token := Token; + header.Lenb := (Nombre and $FF00) shr 8; + header.Lenh := Nombre and $FF; + header.Checksum:=checksum8(nombre,Dptr); + trys := MAXTRY; + repeat + ok := TRUE; + for i := 0 to 3 do + ok := ok and sendlpt( Header.Champ[ i ] ); + if ( ok ) then + ok := ok and sendlpt( ACK ) + else + ok := ok and sendlpt( NAK ); + if ( not ok ) then + dec( trys ); + until ( ( ok ) or ( trys = 0 ) or (errors)); + if ( (trys = 0) or (errors)) then + begin + goto fin; + SendlptBlock:=false; + end; + if ( Nombre > 0 ) then + begin + Donnees := DPTR; + trys := MAXTRY; + repeat + ok := TRUE; + for i := Nombre downto 1 do + begin + ok := ok and sendlpt( Donnees^[ i ] ); + reste:=trunc(100-i/nombre*100); + form1.gauge1.progress:=reste + end; + if ( ok ) then + ok := ok and sendlpt( ACK ) + else + ok := ok and sendlpt( NAK ); + if ( not ok ) then + dec( trys ); + until ( ( ok ) or ( trys = 0 ) or (errors)); + if ( (trys = 0) or (errors)) then + begin + goto fin; + SendlptBlock:=false; + end; + end; + SendlptBlock:=true; + fin: + form1.gauge1.visible:=false; +end; + +function ReceivelptBlock( var Token : byte; + var Len : word; + Dptr : pointer ):boolean; +var header : BHEADER; + ok : boolean; + i : word; + trys : word; + EscapeStatus : boolean; + ByteBuffer : byte; + Donnees : ^DBloc; + label fin,good; +begin + form1.gauge1.visible:=true; + trys := MAXTRY; + repeat + for i:= 0 to 3 do + Header.Champ[ i ] := receivelpt; + ByteBuffer := receivelpt; + if ( ByteBuffer <> ACK ) then + dec( trys ); + until ( ( trys = 0 ) or ( ByteBuffer = ACK ) or (errors)); + if ( (trys = 0) or (errors)) then + begin + goto fin; + receivelptblock:=false; + end; + Token := Header.Token; + Len := Header.Lenh+(Header.Lenb shl 8); + if ( Len > 0 ) then + begin + Donnees := Dptr; + trys := MAXTRY; + repeat + for i := len downto 1 do + begin + Donnees^[ i ] := receivelpt; + reste:=trunc(100-i/len*100); + form1.gauge1.progress:=reste + end; + ByteBuffer := receivelpt; + if ( ByteBuffer <> ACK ) then + dec( trys ); + until ( ( trys = 0 ) or ( ByteBuffer = ACK ) ); + if ( trys = 0 ) then + begin + goto fin; + receivelptblock:=false; + end; + end; + receivelptblock:=true; + fin: + form1.gauge1.visible:=false; +end; + + +function Sendfile(name:string):boolean; +var lus:word; +Fichier:file; +begin +assign( Fichier, Name ); +reset( Fichier, 1 ); +Blockread( Fichier, Block, 15000, Lus ); +if lus>0 then +Sendfile:=SendlptBlock( 1, Lus, @Block ) +else +Sendfile:=false; +end; + +procedure TForm1.FormActivate(Sender: TObject); +begin +adress:=0; +showadress(sender); +Memo2Click(Sender); +SpeedButton8Click(Sender); +pop:=true; +end; + +procedure TForm1.SpinButton1DownClick(Sender: TObject); +begin +if (adress>0) and okm.checked then +begin +dec(adress); +SpeedButton6Click(Sender); +end; +end; + +procedure TForm1.SpinButton1UpClick(Sender: TObject); +begin +if (adress<65536*16) and okm.checked then +begin +inc(adress); +SpeedButton6Click(Sender); +end; +end; + +function hextoint(hex:string;n:word):longint; +var +resu,exp:longint; +i:word; +begin + hex :=UpperCase(hex); + resu:=0; + exp:=1; + for i:=n downto 1 do + begin + resu:=resu+(Pos(hex[i],'0123456789ABCDEF')-1)*(exp); + exp:=exp*16 + end; + hextoint:=resu; + end ; + + function adresstoint(hex:string):longint; +begin +adresstoint:=hextoint(Copy(hex, 1, 4),4)shl 4 + hextoint(Copy(hex, length(hex)-3, 4),4) +end; + +procedure TForm1.showadress(Sender: TObject); +var i,j,adh,adl:word; +adress2:longint; +old,old2:string; +begin +memo1.clear; +memo2.clear; +memo3.clear; +for i:=0 to 29 do +begin +adress2:=adress+i*16; +adl:=adress2 and $FFFF; +adh:=(adress2 and $F0000) shr 4; +memo1.lines.add(IntToHex(adh,4)+':'+IntToHex(adl,4)) ; +old:=''; +old2:=''; +for j:=1 to 16 do +begin +old:=old+inttohex(block[i*16+j],2); +if block[i*16+j]=0 then +old2:=old2+'.' +else +old2:=old2+char(block[i*16+j]) ; +if j mod 2=0 then old:=old+' '; +end; +memo2.lines.add(old) ; +memo3.lines.add(old2) ; +end +end; + +procedure TForm1.SpeedButton8Click(Sender: TObject); +begin +if getfirstlpt=0 then showmessage('Pas de port parallèle détecté'); +errors:=false; +end; + +procedure TForm1.SpeedButton6Click(Sender: TObject); +var adl,adh,good:word; +tok:byte; +ok:boolean; +begin +if (inlpt=0) then SpeedButton8Click(sender); +if ((inlpt<>0) and (initlpt(true))) then +begin + adl:=adress and $FFFF; + adh:=(adress and $F0000) shr 4; +Block[1]:=lo(adl); +Block[2]:= hi(adl); +Block[3]:= lo(adh); +Block[4]:= hi(adh); +Block[5]:= lo(512); +Block[6]:= hi(512) ; +ok:=false; +if SendlptBlock( 1,6,@Block) then ok:=receivelptBlock(tok,good ,@Block); {demande de RAM} +if not(ok) or errors then Showmessage('Erreur de transmission !!!!!!!!!!'); +showadress(sender); +end +else +Showmessage('Pas de PC distant'); +putb($08); +errors:=false; +end; + +procedure TForm1.MaskEdit1Change(Sender: TObject); +begin +if pop then +begin +adress:=adresstoint(maskedit1.text); +if okm.checked=true then SpeedButton6Click(sender); +showadress(sender); +end; +end; + +procedure TForm1.SpinButton2DownClick(Sender: TObject); +begin + if (adress+16*30<=65536*16) and okm.checked then + begin + adress:=adress+16*30; +SpeedButton6Click(Sender); +end; +end; + +procedure TForm1.SpinButton2UpClick(Sender: TObject); +begin + if (adress-16*30>=0) and okm.checked then + begin + adress:=adress-16*30; +SpeedButton6Click(Sender); +end; +end; +procedure TForm1.SpeedButton3Click(Sender: TObject); +var adl,adh,good:word; +adress2:longint; +tok:byte; +ok:boolean; +begin +if (inlpt=0) then SpeedButton8Click(sender); +if ((inlpt<>0) and (initlpt(true))) then +begin + adress2 :=adresstoint(maskedit1.text); + adl:=adress2 and $FFFF; + adh:=(adress2 and $F0000) shr 4; +Block[1]:=lo(adl); +Block[2]:= hi(adl); +Block[3]:= lo(adh); +Block[4]:= hi(adh); +ok:=SendlptBlock( 7,4,@Block); +if not(ok) or errors then Showmessage('Erreur de transmission !!!!!!!!!!'); +end +else +Showmessage('Pas de PC distant'); +putb($18); +errors:=false; +end; +procedure TForm1.Memo2Click(Sender: TObject); +var ligne,col,pos,adl,adh:word; +adress2:longint; +begin + ligne:=memo2.selstart div 42; + col:= (trunc((memo2.selstart mod 42+1) / 2.5)); + pos:=16*ligne+col; + label1.caption:=inttostr(ligne)+':'+inttostr(col)+':'+inttostr(pos); + adress2:=pos+adress; + adl:=adress2 and $FFFF; + adh:=(adress2 and $F0000) shr 4; + pop:=false; + maskedit1.text:=inttohex(adh,4)+':'+inttohex(adl,4); + pop:=true; +end; + +end. diff --git a/programs/mous.asm b/programs/mous.asm deleted file mode 100755 index 785a328..0000000 --- a/programs/mous.asm +++ /dev/null @@ -1,41 +0,0 @@ -.model tiny -.486 -smart -.code - -org 0100h - -start: -mov ax,6 -int 47h -mov ax,0a000h -mov es,ax -mov ds,ax -xor di,di -mov cx,0ffffh/4 -mov eax,0 -rep stosd -mov ax,0c40h -boucle: -mov ah,4 -int 74h -mov byte ptr es:[di],0FFh -mov si,0 -mov di,0 -mov cx,0ffffh -reboucle: -mov al,[si] -inc si -cmp al,0 -je suite -dec al -suite: -mov es:[di],al -inc di -dec cx -jnz reboucle -cmp dl,2 -jne boucle -db 0CBh - -end start diff --git a/programs/pmode.asm b/programs/pmode.asm old mode 100755 new mode 100644 index fc1625f..23b82e4 --- a/programs/pmode.asm +++ b/programs/pmode.asm @@ -1,15 +1,15 @@ -.model tiny -.486p -smart -.code - -org 0100h - -start: -mov eax,cr0 -or al,1 -mov cr0,eax - -db 0CBh - -end start +.model tiny +.486p +smart +.code + +org 0100h + +start: +mov eax,cr0 +or al,1 +mov cr0,eax + +db 0CBh + +end start diff --git a/programs/souris.asm b/programs/souris.asm new file mode 100644 index 0000000..2890412 --- /dev/null +++ b/programs/souris.asm @@ -0,0 +1,13 @@ +.model tiny +.486 +smart +.code + +org 0100h + +start: +mov ah,2 +int 74h +db 0CBh + +end start diff --git a/programs/test.asm b/programs/test.asm old mode 100755 new mode 100644 index 33ea3ee..49bbc1d --- a/programs/test.asm +++ b/programs/test.asm @@ -1,332 +1,373 @@ -.model tiny -.486 -smart -.code -org 0100h - - -start: -mov ah,26 -int 47h -mov ax,0001 -int 47h -mov ah,2 -int 47h - -mov si,offset text1 ;titre -mov ah,13 -int 47h -mov ah,6 -int 47h -int 47h - -mov ah,21 -mov cl,3 -int 47h -mov ah,13 -mov si,offset text2 -int 47h -mov ah,6 -int 47h -mov edx,2612182686 -mov ah,8 -int 47h -mov ah,6 -int 47h -mov edx,7576534 -mov ah,8 -int 47h -mov ah,6 -int 47h - -mov ah,21 -mov cl,4 -int 47h -mov si,offset text3 -mov ah,13 -int 47h -mov ah,6 -int 47h -mov edx,-6876253 -mov cx,32 -mov ah,9 -int 47h -mov ah,6 -int 47h -mov edx,-311212323 -mov cx,32 -mov ah,9 -int 47h -mov ah,6 -int 47h - -mov ah,21 -mov cl,5 -int 47h -mov ah,13 -mov si,offset text4 -int 47h -mov ah,6 -int 47h -mov edx,0892325457 -mov cx,16 -mov ah,10 -int 47h -mov ah,6 -int 47h -mov edx,0236514 -mov ah,10 -mov cx,32 -int 47h -mov ah,6 -int 47h - -mov ah,21 -mov cl,6 -int 47h -mov ah,13 -mov si,offset text5 -int 47h -mov ah,6 -int 47h -mov edx,3762182686 -mov ah,11 -mov cx,32 -int 47h -mov ah,6 -int 47h -mov edx,2182686 -mov ah,11 -mov cx,16 -int 47h -mov ah,6 -int 47h - -mov ah,21 -mov cl,7 -int 47h -mov ah,13 -mov si,offset text6 -int 47h -mov ah,6 -int 47h -mov dl,'h' -mov ah,7 -int 47h -mov ah,6 -int 47h -mov dl,'@' -mov ah,7 -int 47h -mov ah,6 -int 47h - -mov ah,21 -mov cl,8 -int 47h -mov ah,13 -mov si,offset text7 -int 47h -mov ah,6 -int 47h -mov si,offset textt -mov ah,13 -int 47h -mov ah,6 -int 47h -mov si,offset texttt -mov ah,13 -int 47h - -mov ax,0 -int 16h - -mov ah,2 -int 47h -mov ah,30 -int 47h -mov ah,2 -int 47h - -mov ah,21 -mov cl,5 -int 47h -mov cx,200 -go1: -mov ah,30 -int 47h -mov ah,33 -int 47 -mov ah,20 -xor bh,bh -inc bl -mov si,offset text8 -int 47h -call put -mov ah,30 -int 47h -mov ah,33 -int 47h -dec cx -jnz go1 - -mov ah,21 -mov cl,7 -int 47h -mov cx,200 -go2: -mov si,offset text9 -mov ah,30 -int 47h -mov ah,33 -int 47h -mov ah,6 -int 47h -mov ah,13 -int 47h -call put -mov ah,30 -int 47h -mov ah,33 -int 47h -dec cx -jnz go2 - -mov ah,21 -mov cl,9 -int 47h -mov cx,200 -go3: -mov si,offset text10 -mov ah,30 -int 47h -mov ah,33 -int 47h -xor bh,bh -inc bl -mov ah,20 -int 47h -call put -mov ah,30 -int 47h -mov ah,33 -int 47h -dec cx -jnz go3 - -mov ah,30 -int 47h -mov ah,2 -int 47h -mov bx,040Dh -mov si,offset texte1 -mov ah,20 -int 47h -mov si,offset texte2 -inc bl -mov ah,20 -int 47h -mov ah,30 -int 47h -mov ah,2 -int 47h -mov ah,30 -int 47h - -mov cl,12 -mov ah,21 -int 47h -mov bp,255 -xor edx,edx -go4: -mov ah,30 -int 47h -mov ah,33 -int 47h -inc edx -mov ah,11 -mov cx,16 -int 47h -mov ah,6 -int 47h -mov ah,30 -int 47h -mov ah,33 -int 47h -dec bp -jnz go4 -mov ah,27 -int 47h -xor bx,bx -mov si,offset texte3 -mov ah,20 -int 47h -mov ax,0 -int 16h -db 0CBh - -put: -call random -mov di,dx -and di,4096-2 -mov si,offset text11 -call showstring2 -ret - -Random: -push ax -MOV AX,cs:[RandSeed] -MOV DX,8405h -MUL DX -INC AX -MOV cs:[RandSeed],AX -pop ax -ret - -randseed dw 1234h - -Randomize: -push ax cx dx -mov ah,0 -int 1ah -mov cs:randseed,dx -pop dx cx ax -ret - -texttt db 'Texte',0 -textt db 'Divers',0 -text1 db ' D‚monstration de l''utilisation de la bibliothŠque VIDEO',0 -text2 db 'Nombre entier :',0 -text3 db 'Nombre sign‚ :',0 -text4 db 'Nombre h‚xad‚cimal :',0 -text5 db 'Nombre binaire :',0 -text6 db 'CaractŠres :',0 -text7 db 'Texte :',0 -text8 db 'Scrolling Scrolling Scrolling Scrolling Scrolling Scrolling Scrolling Scrolling',0 -text9 db 'Vertical Vertical Vertical Vertical Vertical Vertical Vertical Vertical',0 -text10 db 'Rapide Rapide Rapide Rapide Rapide Rapide Rapide Rapide',0 -text11 db 'Echange rapide de pages Vid‚o',0 -texte1 db 'Routine d''affichage Ultra Rapide Agissant sur le Mat‚riel',0 -texte2 db 'Possibilit‚ de r‚aliser des effets de superposition',0 -texte3 db 'Sauvegarde et restauration de l''ecran',0 - -showstring2: - push es bx cx si di - add di,4000 - mov bx,0B800h - mov es,bx - mov bl,[si] - mov ch,3 -strinaize4: - inc si - mov cl,[si] - mov es:[di],cx - add di,2 - dec bl - jnz strinaize4 - pop di si cx bx es - ret - - - -end start +.model tiny +.486 +smart +.code +org 0100h + + +start: +mov ah,26 +int 47h +mov ax,0001 +int 47h +mov ah,2 +int 47h + +mov si,offset text1 ;titre +mov ah,13 +int 47h +mov ah,6 +int 47h +int 47h + +mov ah,21 +mov cl,3 +int 47h +mov ah,13 +mov si,offset text2 +int 47h +mov ah,6 +int 47h +mov edx,2612182686 +mov ah,8 +int 47h +mov ah,6 +int 47h +mov edx,7576534 +mov ah,8 +int 47h +mov ah,6 +int 47h + +mov ah,21 +mov cl,4 +int 47h +mov si,offset text3 +mov ah,13 +int 47h +mov ah,6 +int 47h +mov edx,-6876253 +mov cx,32 +mov ah,9 +int 47h +mov ah,6 +int 47h +mov edx,-311212323 +mov cx,32 +mov ah,9 +int 47h +mov ah,6 +int 47h + +mov ah,21 +mov cl,5 +int 47h +mov ah,13 +mov si,offset text4 +int 47h +mov ah,6 +int 47h +mov edx,0892325457 +mov cx,16 +mov ah,10 +int 47h +mov ah,6 +int 47h +mov edx,0236514 +mov ah,10 +mov cx,32 +int 47h +mov ah,6 +int 47h + +mov ah,21 +mov cl,6 +int 47h +mov ah,13 +mov si,offset text5 +int 47h +mov ah,6 +int 47h +mov edx,3762182686 +mov ah,11 +mov cx,32 +int 47h +mov ah,6 +int 47h +mov edx,2182686 +mov ah,11 +mov cx,16 +int 47h +mov ah,6 +int 47h + +mov ah,21 +mov cl,7 +int 47h +mov ah,13 +mov si,offset text6 +int 47h +mov ah,6 +int 47h +mov dl,'h' +mov ah,7 +int 47h +mov ah,6 +int 47h +mov dl,'@' +mov ah,7 +int 47h +mov ah,6 +int 47h + +mov ah,21 +mov cl,8 +int 47h +mov ah,13 +mov si,offset text7 +int 47h +mov ah,6 +int 47h +mov si,offset textt +mov ah,13 +int 47h +mov ah,6 +int 47h +mov si,offset texttt +mov ah,13 +int 47h +mov ah,6 +int 47h + +mov ah,21 +mov cl,9 +int 47h +mov ah,13 +mov si,offset text71 +int 47h +mov ah,6 +int 47h +mov dx,0BF30h +mov ah,44 +int 47h +mov ah,6 +int 47h +mov dx,0B0B6h +mov ah,44 +int 47h +mov ah,6 +int 47h + +mov ah,13 +mov si,offset text72 +int 47h +mov ah,6 +int 47h +mov edx,8601h +mov ah,45 +int 47h +mov ah,6 +int 47h +mov dx,0B0B6h +mov ah,45 +int 47h +mov ah,6 +int 47h + + + +mov ax,0 +int 16h + +mov ah,2 +int 47h +mov ah,30 +int 47h +mov ah,2 +int 47h + +mov ah,21 +mov cl,5 +int 47h +mov cx,200 +go1: +mov ah,30 +int 47h +mov ah,33 +int 47 +mov ah,20 +xor bh,bh +inc bl +mov si,offset text8 +int 47h +call put +mov ah,30 +int 47h +mov ah,33 +int 47h +dec cx +jnz go1 + +mov ah,21 +mov cl,7 +int 47h +mov cx,200 +go2: +mov si,offset text9 +mov ah,30 +int 47h +mov ah,33 +int 47h +mov ah,6 +int 47h +mov ah,13 +int 47h +call put +mov ah,30 +int 47h +mov ah,33 +int 47h +dec cx +jnz go2 + +mov ah,21 +mov cl,9 +int 47h +mov cx,200 +go3: +mov si,offset text10 +mov ah,30 +int 47h +mov ah,33 +int 47h +xor bh,bh +inc bl +mov ah,20 +int 47h +call put +mov ah,30 +int 47h +mov ah,33 +int 47h +dec cx +jnz go3 + +mov ah,30 +int 47h +mov ah,2 +int 47h +mov bx,040Dh +mov si,offset texte1 +mov ah,20 +int 47h +mov si,offset texte2 +inc bl +mov ah,20 +int 47h +mov ah,30 +int 47h +mov ah,2 +int 47h +mov ah,30 +int 47h + +mov cl,12 +mov ah,21 +int 47h +mov bp,255 +xor edx,edx +go4: +mov ah,30 +int 47h +mov ah,33 +int 47h +inc edx +mov ah,11 +mov cx,16 +int 47h +mov ah,6 +int 47h +mov ah,30 +int 47h +mov ah,33 +int 47h +dec bp +jnz go4 +mov ah,27 +int 47h +xor bx,bx +mov si,offset texte3 +mov ah,20 +int 47h +mov ax,0 +int 16h +db 0CBh + +put: +call random +mov di,dx +and di,4096-2 +mov si,offset text11 +call showstring2 +ret + +Random: +push ax +MOV AX,cs:[RandSeed] +MOV DX,8405h +MUL DX +INC AX +MOV cs:[RandSeed],AX +pop ax +ret + +randseed dw 1234h + +Randomize: +push ax cx dx +mov ah,0 +int 1ah +mov cs:randseed,dx +pop dx cx ax +ret + +texttt db 'Texte',0 +textt db 'Divers',0 +text1 db ' D‚monstration de l''utilisation de la bibliothŠque VIDEO',0 +text2 db 'Nombre entier :',0 +text3 db 'Nombre sign‚ :',0 +text4 db 'Nombre h‚xad‚cimal :',0 +text5 db 'Nombre binaire :',0 +text6 db 'CaractŠres :',0 +text7 db 'Texte :',0 +text71 db 'Date :',0 +text72 db 'Heure :',0 +text8 db 'Scrolling Scrolling Scrolling Scrolling Scrolling Scrolling Scrolling Scrolling',0 +text9 db 'Vertical Vertical Vertical Vertical Vertical Vertical Vertical Vertical',0 +text10 db 'Rapide Rapide Rapide Rapide Rapide Rapide Rapide Rapide',0 +text11 db 'Echange rapide de pages Vid‚o',0 +texte1 db 'Routine d''affichage Ultra Rapide Agissant sur le Mat‚riel',0 +texte2 db 'Possibilit‚ de r‚aliser des effets de superposition',0 +texte3 db 'Sauvegarde et restauration de l''ecran',0 + +showstring2: + push es bx cx si di + add di,4000 + mov bx,0B800h + mov es,bx + mov bl,[si] + mov ch,3 +strinaize4: + inc si + mov cl,[si] + mov es:[di],cx + add di,2 + dec bl + jnz strinaize4 + pop di si cx bx es + ret + + + +end start diff --git a/programs/verif.asm b/programs/verifier.asm old mode 100755 new mode 100644 similarity index 82% rename from programs/verif.asm rename to programs/verifier.asm index 3250883..8443dd3 --- a/programs/verif.asm +++ b/programs/verifier.asm @@ -1,151 +1,151 @@ -.model tiny -.386c -.code -org 0100h - - -start: - mov ax,0002 - int 47H - mov ah,26 - int 47H -replay: - mov ah,2 - int 47h -mov ah,21 -mov cl,7 -int 47h - xor di,di - xor cx,cx - mov ah,20 - mov bx,1D00h - mov si,offset Msg - int 47h - mov ah,20 - mov bx,0231h - mov si,offset msgapp - int 47h -VerifAll: - mov ah,1 - int 16h - cmp al,32 - je enend - mov ax,cx - mov si,100 - mul si - mov si,2880 - div si - xor edx,edx - mov dx,ax - mov ah,15 - mov bx,0A14h - int 47h - mov ah,13 - mov si,offset po - int 47h - mov ah,15 - mov dx,cx - mov bx,0A10h - int 47h - mov ah,13 - mov si,offset Msg2 - int 47h - mov ah,8 - mov edx,0 - mov dx,di - int 47h - mov ah,13 - mov si,offset Msg3 - int 47h - call gauge - mov ah,2 - int 48h - jc errors - je noprob - inc di - noprob: - inc cx - cmp cx,2880 - jnz verifall - enend: - cmp di,0 - je noatall -mov bx,0E09h -mov ah,20 -mov si,offset error2 -int 47h - jmp someof - noatall: -mov bx,0E09h -mov ah,20 -mov si,offset noerror -int 47h - someof: - mov ah,0 - int 16h - mov ah,27 - int 47h - db 0CBH - errors: -mov ah,21 -mov cl,4 -int 47h -mov bx,0D09h -mov ah,20 -mov si,offset errore -int 47h -mov ah,0 -int 16h -jmp replay - - - -errore db 'Error IO with floppy drive, insert a disk and Press a key',0 -noerror db 'No defectuous Cluster, Press a key to Quit',0 -error2 db 'This disk is bad, Press a key to Quit',0 -po db ' %',0 -msgapp db '',0 -msg db '- Disk Surface Test -',0 -msg2 db ' cluster tested. ',0 -msg3 db ' defectuous cluster.',0 -;->Increment CX -gauge: -push ax bx cx dx si ds -push cs -pop ds -mov ax,cx -mul sizes -div max -mov dx,ax -mov bl,oldvalue -xor bh,bh -mov byte ptr [offset gaugetxt+bx],'Û' -cmp bx,0 -jnz nono2 -mov ah,21 -mov cl,8 -int 47h -mov bx,xy -mov ah,20 -mov si,offset gaugetxt -int 47h -mov ah,21 -mov cl,7 -int 47h -nono2: -mov bx,dx -xor bh,bh -mov byte ptr [offset gaugetxt+bx],0 -mov oldvalue,bl -mov bx,xy -mov ah,20 -mov si,offset gaugetxt -int 47h -pop ds si dx cx bx ax -ret -oldvalue db 0 -max dw 2880 -sizes dw 50 -xy dw 0A12h -gaugetxt db 'ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ',0 -End Start +.model tiny +.386c +.code +org 0100h + + +start: + mov ax,0002 + int 47H + mov ah,26 + int 47H +replay: + mov ah,2 + int 47h +mov ah,21 +mov cl,7 +int 47h + xor di,di + xor cx,cx + mov ah,20 + mov bx,1D00h + mov si,offset Msg + int 47h + mov ah,20 + mov bx,0231h + mov si,offset msgapp + int 47h +VerifAll: + mov ah,1 + int 16h + cmp al,32 + je enend + mov ax,cx + mov si,100 + mul si + mov si,2880 + div si + xor edx,edx + mov dx,ax + mov ah,15 + mov bx,0A14h + int 47h + mov ah,13 + mov si,offset po + int 47h + mov ah,15 + mov dx,cx + mov bx,0A10h + int 47h + mov ah,13 + mov si,offset Msg2 + int 47h + mov ah,8 + mov edx,0 + mov dx,di + int 47h + mov ah,13 + mov si,offset Msg3 + int 47h + call gauge + mov ah,2 + int 48h + jc errors + je noprob + inc di + noprob: + inc cx + cmp cx,2880 + jnz verifall + enend: + cmp di,0 + je noatall +mov bx,0E09h +mov ah,20 +mov si,offset error2 +int 47h + jmp someof + noatall: +mov bx,0E09h +mov ah,20 +mov si,offset noerror +int 47h + someof: + mov ah,0 + int 16h + mov ah,27 + int 47h + db 0CBH + errors: +mov ah,21 +mov cl,4 +int 47h +mov bx,0D09h +mov ah,20 +mov si,offset errore +int 47h +mov ah,0 +int 16h +jmp replay + + + +errore db 'Erreur avec le lecteur de disquette !',0 +noerror db 'Pas de secteurs defectueux, appuyez sur une touche pour continuer',0 +error2 db 'Le disque est defectueux, appuyez sur une touche pour quitter',0 +po db ' %',0 +msgapp db '',0 +msg db '- Test de surface du disque -',0 +msg2 db ' cluster tested. ',0 +msg3 db ' cluster defectueux. ',0 +;->Increment CX +gauge: +push ax bx cx dx si ds +push cs +pop ds +mov ax,cx +mul sizes +div max +mov dx,ax +mov bl,oldvalue +xor bh,bh +mov byte ptr [offset gaugetxt+bx],'Û' +cmp bx,0 +jnz nono2 +mov ah,21 +mov cl,8 +int 47h +mov bx,xy +mov ah,20 +mov si,offset gaugetxt +int 47h +mov ah,21 +mov cl,7 +int 47h +nono2: +mov bx,dx +xor bh,bh +mov byte ptr [offset gaugetxt+bx],0 +mov oldvalue,bl +mov bx,xy +mov ah,20 +mov si,offset gaugetxt +int 47h +pop ds si dx cx bx ax +ret +oldvalue db 0 +max dw 2880 +sizes dw 50 +xy dw 0A12h +gaugetxt db 'ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ',0 +End Start diff --git a/programs/disk.asm b/programs/volume.asm old mode 100755 new mode 100644 similarity index 89% rename from programs/disk.asm rename to programs/volume.asm index 291b624..518deeb --- a/programs/disk.asm +++ b/programs/volume.asm @@ -1,387 +1,387 @@ -.model tiny -.386c -.code -org 0100h - - -start: - mov ax,0305h - mov bx,0008h - int 16h - mov ax,0002 - int 47H - mov ah,2 - int 47h - mov ah,43 - int 47h - xor bp,bp -Adres: - mov di,offset infos - mov ah,34 - int 47h - dec infos - push cs - pop es - mov cx,sect - mov bx,offset buffer - mov ax,0001h - int 48h - jnc noerror - errtr: - mov ah,25 - mov bl,infos - xor bh,bh - int 47h - mov ah,21 - mov cl,116 - int 47h - mov ah,13 - mov si,offset errordisk - int 47h - mov ax,0 - int 16h - noerror: - adres2: - mov di,offset infos - mov ah,34 - int 47h - dec byte ptr [di] - mov al,[di+1] - sub al,16 - mov bl,al - shr al,2 - mov [di+1],al - and bl,11b - mov [di+2],bl - mov al,[di+7] - cmp al,oldmode - je noinit - mov ah,2 - int 47h - mov oldmode,al - noinit: - mov bx,0 - mov ah,25 - int 47h - mov bh,infos - mov di,bp - mov ah,21 - mov cl,7 - int 47h -lines: - mov dx,sect - mov cx,16 - mov ah,10 - int 47h - mov si,offset dep - mov ah,13 - int 47h - mov dx,di - mov ah,10 - int 47h - mov ah,13 - mov si,offset spaces - int 47h - mov ah,5 - int 47h - mov al,infos+1 - mov cl,7 - mov ah,21 - int 47h - mov si,di -doaline: - mov dl,[di+offset buffer] - mov ah,10 - mov cl,8 - int 47h - mov ah,5 - int 47h - inc di - dec al - jnz doaline - mov di,si - mov si,offset spaces - mov ah,13 - int 47h - mov al,infos+1 - mov ah,21 - mov cl,7 - int 47h -doaline2: - mov dl,[di+offset buffer] - mov ah,7 - int 47h - inc di - dec al - jnz doaline2 - dec bh - je outes - cmp byte ptr infos+2,0 - je lines - mov ah,6 - int 47h - jmp lines -outes: - mov ah,21 - mov cl,112 - int 47h - mov bh,0 - mov bl,infos - mov si,offset menu - mov ah,14h - int 47h - waitkey: - mov ax,0 - int 16h - cmp ax,3B00h - jne suit - cmp bp,8*16 - jae waitkey - add bp,16 - jmp adres2 - suit: - cmp ax,3C00h - jne suit2 - cmp bp,0 - je waitkey - sub bp,16 - jmp adres2 - suit2: - cmp ax,3D00h - jne suit3 - cmp sect,2880 - ja waitkey - inc sect - jmp adres - suit3: - cmp ax,3E00h - jne suit4 - cmp sect,0 - je waitkey - dec sect - jmp adres - suit4: - cmp ax,3F00h - jne suit5 - jmp adres2 - suit5: - cmp ax,4000h - jne suit6 - mov cx,sect - mov bx,offset buffer - mov ah,1 - int 48h - jnc waitkey - jmp errtr - suit6: - cmp ax,4100h - jne suit7 - mov dword ptr [pope],'TIDE' - mov bl,infos - xor bh,bh - mov ah,25 - int 47h - mov ah,21 - mov cl,116 - int 47h - mov si,offset menu - mov ah,13 - int 47h - mov ah,21 - mov cl,7 - int 47h - mov ax,0B800h - mov es,ax - mov xxyy2,3 - mov xxyy,3 - call calc1 - call calc2 -waitst: - mov ax,0 - int 16h - cmp ah,41h - jne tre - mov dword ptr [pope],'WEIV' - push cs - pop es - mov cx,sect - mov bx,offset buffer - mov ah,1 - int 48h - jnc adres - jmp errtr -tre: - cmp al,0 - jne write - cmp ah,48h - jne tre1 - cmp yy,0 - je waitst - dec yy - jmp cursor -tre1: - cmp ah,50h - jne tre2 - mov al,infos - dec al - xor ah,ah - cmp yy,ax - je waitst - inc yy - jmp cursor -tre2: - cmp ah,4Dh - jne tre4 - cmp xx,15 - je waitst - inc xx - jmp cursor -tre4: - cmp ah,4Bh - jne waitst - cmp xx,0 - je waitst - dec xx - jmp cursor -write: - call AsciiHex2dec - cmp cl,15 - ja waitst - call calc1 - call calc2 - mov byte ptr es:[bx],0112 - mov es:[bx-1],al -writs: - mov ax,0 - int 16H - mov ch,cl - call AsciiHex2dec - cmp cl,15 - ja writs - shl ch,4 - add ch,cl - mov es:[bx+1],al - mov es:[si-1],ch - mov ax,bx - call calc3 - mov [bx],ch - inc xx - cmp xx,16 - jne pasde - inc yy - mov xx,0h - pasde: - call calc1 - call calc2 - jmp waitst - -cursor: - call calc1 - call calc2 - jmp waitst - suit7: - cmp ax,4200h - jne adres2 - db 0CBH - ret - -calc1: - push ax dx si - mov ax,xx - mov dx,xx - shl ax,2 - shl dx,1 - add ax,dx - add ax,25 - mov bx,YY - mov dx,yy - shl bx,5 - shl dx,7 - add bx,dx - add bx,ax - mov byte ptr es:[bx],112 - mov byte ptr es:[bx+2],112 - mov si,xxyy - mov byte ptr es:[si],07 - mov byte ptr es:[si+2],07 - mov xxyy,bx - pop si dx ax - ret - -calc2: - push ax bx dx - mov si,YY - mov dx,yy - shl si,5 - shl dx,7 - add si,dx - mov dx,xx - shl dx,1 - add si,dx - add si,127 - mov byte ptr es:[si],112 - mov bx,xxyy2 - mov byte ptr es:[bx],07 - mov xxyy2,si - pop dx bx ax - ret - -calc3: - push dx - xor bx,bx - mov bx,xx - mov dx,yy - shl dx,4 - add bx,dx - add bx,bp - add bx,offset buffer - pop dx - ret - - asciihex2dec: - cmp al,'a' - jb nomin - cmp al,'f' - ja nomin - sub al,'a'-'A' - jmp ismaj - nomin: - cmp al,'A' - jb nomaj - cmp al,'F' - ja nomaj - ismaj: - mov cl,al - sub cl,'A'-10 - jmp endt - nomaj: - mov cl,al - sub cl,'0' - endt: - ret - -dep db ':',0 -sect dw 0 -xx dw 0 -yy dw 0 -xxyy dw 3 -xxyy2 dw 3 -errordisk db 'An error has occured on drive A:, press a key to continu ',0 -menu db 'Bottom F1, Top F2, Sectors F3&F4, Load/Save F5&F6, Mode F7, Quit F8 MODE ' -pope db 'VIEW',0 -spaces db ' ³ ',0 - -showbuffer db 35 dup (0FFh) -oldmode db 0 -infos db 10 dup (0) -buffer equ $ - -end start - - - - - - - - +.model tiny +.386c +.code +org 0100h + + +start: + mov ax,0305h + mov bx,0008h + int 16h + mov ax,0002 + int 47H + mov ah,2 + int 47h + mov ah,43 + int 47h + xor bp,bp +Adres: + mov di,offset infos + mov ah,34 + int 47h + dec infos + push cs + pop es + mov cx,sect + mov di,offset buffer + mov ax,0001h + int 48h + jnc noerror + errtr: + mov ah,25 + mov bl,infos + xor bh,bh + int 47h + mov ah,21 + mov cl,116 + int 47h + mov ah,13 + mov si,offset errordisk + int 47h + mov ax,0 + int 16h + noerror: + adres2: + mov di,offset infos + mov ah,34 + int 47h + dec byte ptr [di] + mov al,[di+1] + sub al,16 + mov bl,al + shr al,2 + mov [di+1],al + and bl,11b + mov [di+2],bl + mov al,[di+7] + cmp al,oldmode + je noinit + mov ah,2 + int 47h + mov oldmode,al + noinit: + mov bx,0 + mov ah,25 + int 47h + mov bh,infos + mov di,bp + mov ah,21 + mov cl,7 + int 47h +lines: + mov dx,sect + mov cx,16 + mov ah,10 + int 47h + mov si,offset dep + mov ah,13 + int 47h + mov dx,di + mov ah,10 + int 47h + mov ah,13 + mov si,offset spaces + int 47h + mov ah,5 + int 47h + mov al,infos+1 + mov cl,7 + mov ah,21 + int 47h + mov si,di +doaline: + mov dl,[di+offset buffer] + mov ah,10 + mov cl,8 + int 47h + mov ah,5 + int 47h + inc di + dec al + jnz doaline + mov di,si + mov si,offset spaces + mov ah,13 + int 47h + mov al,infos+1 + mov ah,21 + mov cl,7 + int 47h +doaline2: + mov dl,[di+offset buffer] + mov ah,7 + int 47h + inc di + dec al + jnz doaline2 + dec bh + je outes + cmp byte ptr infos+2,0 + je lines + mov ah,6 + int 47h + jmp lines +outes: + mov ah,21 + mov cl,112 + int 47h + mov bh,0 + mov bl,infos + mov si,offset menu + mov ah,14h + int 47h + waitkey: + mov ax,0 + int 16h + cmp ax,3B00h + jne suit + cmp bp,8*16 + jae waitkey + add bp,16 + jmp adres2 + suit: + cmp ax,3C00h + jne suit2 + cmp bp,0 + je waitkey + sub bp,16 + jmp adres2 + suit2: + cmp ax,3D00h + jne suit3 + cmp sect,2880 + ja waitkey + inc sect + jmp adres + suit3: + cmp ax,3E00h + jne suit4 + cmp sect,0 + je waitkey + dec sect + jmp adres + suit4: + cmp ax,3F00h + jne suit5 + jmp adres2 + suit5: + cmp ax,4000h + jne suit6 + mov cx,sect + mov di,offset buffer + mov ah,1 + int 48h + jnc waitkey + jmp errtr + suit6: + cmp ax,4100h + jne suit7 + mov dword ptr [pope],'TIDE' + mov bl,infos + xor bh,bh + mov ah,25 + int 47h + mov ah,21 + mov cl,116 + int 47h + mov si,offset menu + mov ah,13 + int 47h + mov ah,21 + mov cl,7 + int 47h + mov ax,0B800h + mov es,ax + mov xxyy2,3 + mov xxyy,3 + call calc1 + call calc2 +waitst: + mov ax,0 + int 16h + cmp ah,41h + jne tre + mov dword ptr [pope],'WEIV' + push cs + pop es + mov cx,sect + mov bx,offset buffer + mov ah,1 + int 48h + jnc adres + jmp errtr +tre: + cmp al,0 + jne write + cmp ah,48h + jne tre1 + cmp yy,0 + je waitst + dec yy + jmp cursor +tre1: + cmp ah,50h + jne tre2 + mov al,infos + dec al + xor ah,ah + cmp yy,ax + je waitst + inc yy + jmp cursor +tre2: + cmp ah,4Dh + jne tre4 + cmp xx,15 + je waitst + inc xx + jmp cursor +tre4: + cmp ah,4Bh + jne waitst + cmp xx,0 + je waitst + dec xx + jmp cursor +write: + call AsciiHex2dec + cmp cl,15 + ja waitst + call calc1 + call calc2 + mov byte ptr es:[bx],0112 + mov es:[bx-1],al +writs: + mov ax,0 + int 16H + mov ch,cl + call AsciiHex2dec + cmp cl,15 + ja writs + shl ch,4 + add ch,cl + mov es:[bx+1],al + mov es:[si-1],ch + mov ax,bx + call calc3 + mov [bx],ch + inc xx + cmp xx,16 + jne pasde + inc yy + mov xx,0h + pasde: + call calc1 + call calc2 + jmp waitst + +cursor: + call calc1 + call calc2 + jmp waitst + suit7: + cmp ax,4200h + jne adres2 + db 0CBH + ret + +calc1: + push ax dx si + mov ax,xx + mov dx,xx + shl ax,2 + shl dx,1 + add ax,dx + add ax,25 + mov bx,YY + mov dx,yy + shl bx,5 + shl dx,7 + add bx,dx + add bx,ax + mov byte ptr es:[bx],112 + mov byte ptr es:[bx+2],112 + mov si,xxyy + mov byte ptr es:[si],07 + mov byte ptr es:[si+2],07 + mov xxyy,bx + pop si dx ax + ret + +calc2: + push ax bx dx + mov si,YY + mov dx,yy + shl si,5 + shl dx,7 + add si,dx + mov dx,xx + shl dx,1 + add si,dx + add si,127 + mov byte ptr es:[si],112 + mov bx,xxyy2 + mov byte ptr es:[bx],07 + mov xxyy2,si + pop dx bx ax + ret + +calc3: + push dx + xor bx,bx + mov bx,xx + mov dx,yy + shl dx,4 + add bx,dx + add bx,bp + add bx,offset buffer + pop dx + ret + + asciihex2dec: + cmp al,'a' + jb nomin + cmp al,'f' + ja nomin + sub al,'a'-'A' + jmp ismaj + nomin: + cmp al,'A' + jb nomaj + cmp al,'F' + ja nomaj + ismaj: + mov cl,al + sub cl,'A'-10 + jmp endt + nomaj: + mov cl,al + sub cl,'0' + endt: + ret + +dep db ':',0 +sect dw 0 +xx dw 0 +yy dw 0 +xxyy dw 3 +xxyy2 dw 3 +errordisk db 'Une erreur est apparue sur le lecteur, appuyez sur une touche ',0 +menu db 'Haut&Bas [F1/2] Secteur [F3/4] Charger/Sauver [F5/6] Mode [F7] Quit. [F8] ' +pope db 'VIEW',0 +spaces db ' ³ ',0 + +showbuffer db 35 dup (0FFh) +oldmode db 0 +infos db 40 dup (0) +buffer equ $ + +end start + + + + + + + + diff --git a/programs/write.bat b/programs/write.bat deleted file mode 100755 index 808b110..0000000 --- a/programs/write.bat +++ /dev/null @@ -1,4 +0,0 @@ -@echo off -cd .. -setup -cd sources