From 9732d45b9fdd38a1069faf3e5cb0aa4a626f5da9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Hord=C3=A9?= Date: Sun, 1 Jul 2001 22:48:10 +0200 Subject: [PATCH] =?UTF-8?q?refactor:=20rangement=20des=20sources=20dans=20?= =?UTF-8?q?diff=C3=A9rents=20r=C3=A9pertoires.=20Gestion=20de=20joystick.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- API.md | 97 ++ INFORMATIONS.md | 36 + clean.bat | 1 - asm.bat => commande/asm.bat | 9 +- commande/clean.bat | 3 + commande/debog.bat | 2 + prompt.asm => commande/prompt.asm | 4 +- setup.asm => commande/setup.asm | 16 +- str0.asm => commande/str0.asm | 0 write.bat => commande/write.bat | 0 debog.bat | 2 - noyau/asm.bat | 55 + asmsys.bat => noyau/asmsys.bat | 2 + boot.asm => noyau/boot.asm | 0 noyau/clean.bat | 3 + noyau/debog.bat | 2 + drive.asm => noyau/drive.asm | 5 +- noyau/hours.asm | 81 ++ noyau/joystick.asm | 298 +++++ keyboard.asm => noyau/keyboard.asm | 10 +- lpt.asm => noyau/lpt.asm | 0 mouse.asm => noyau/mouse.asm | 61 +- thin8x8.fnt => noyau/old8x8.fnt | Bin pic8259a.asm => noyau/pic8259a.asm | 12 +- system.asm => noyau/system.asm | 234 ++-- noyau/thin8x8.fnt | Bin 0 -> 2048 bytes noyau/timer.asm | 32 + noyau/video.asm | 1560 +++++++++++++++++++++++++++ noyau/write.bat | 4 + exe2boot.asm => outils/exe2boot.asm | 0 rip.asm => outils/rip.asm | 0 unrip.asm => outils/unrip.asm | 0 programs/asm.bat | 54 + programs/clean.bat | 3 + programs/debog.bat | 2 + disk.asm => programs/disk.asm | 27 +- editor.asm => programs/editor.asm | 39 +- logo.asm => programs/logo.asm | 8 +- programs/mous.asm | 41 + pmode.asm => programs/pmode.asm | 0 test.asm => programs/test.asm | 2 + verif.asm => programs/verif.asm | 0 programs/write.bat | 4 + timer.asm | 91 -- video.asm | 1412 ------------------------ 45 files changed, 2560 insertions(+), 1652 deletions(-) create mode 100755 API.md create mode 100755 INFORMATIONS.md delete mode 100755 clean.bat rename asm.bat => commande/asm.bat (82%) create mode 100755 commande/clean.bat create mode 100755 commande/debog.bat rename prompt.asm => commande/prompt.asm (94%) rename setup.asm => commande/setup.asm (91%) rename str0.asm => commande/str0.asm (100%) rename write.bat => commande/write.bat (100%) delete mode 100755 debog.bat create mode 100755 noyau/asm.bat rename asmsys.bat => noyau/asmsys.bat (76%) rename boot.asm => noyau/boot.asm (100%) create mode 100755 noyau/clean.bat create mode 100755 noyau/debog.bat rename drive.asm => noyau/drive.asm (92%) create mode 100755 noyau/hours.asm create mode 100755 noyau/joystick.asm rename keyboard.asm => noyau/keyboard.asm (90%) rename lpt.asm => noyau/lpt.asm (100%) rename mouse.asm => noyau/mouse.asm (81%) rename thin8x8.fnt => noyau/old8x8.fnt (100%) rename pic8259a.asm => noyau/pic8259a.asm (92%) rename system.asm => noyau/system.asm (81%) create mode 100755 noyau/thin8x8.fnt create mode 100755 noyau/timer.asm create mode 100755 noyau/video.asm create mode 100755 noyau/write.bat rename exe2boot.asm => outils/exe2boot.asm (100%) rename rip.asm => outils/rip.asm (100%) rename unrip.asm => outils/unrip.asm (100%) create mode 100755 programs/asm.bat create mode 100755 programs/clean.bat create mode 100755 programs/debog.bat rename disk.asm => programs/disk.asm (89%) rename editor.asm => programs/editor.asm (88%) rename logo.asm => programs/logo.asm (83%) create mode 100755 programs/mous.asm rename pmode.asm => programs/pmode.asm (100%) rename test.asm => programs/test.asm (91%) rename verif.asm => programs/verif.asm (100%) create mode 100755 programs/write.bat delete mode 100755 timer.asm delete mode 100755 video.asm diff --git a/API.md b/API.md new file mode 100755 index 0000000..63371c4 --- /dev/null +++ b/API.md @@ -0,0 +1,97 @@ +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 new file mode 100755 index 0000000..505a30f --- /dev/null +++ b/INFORMATIONS.md @@ -0,0 +1,36 @@ + < COS2000 the new operating system > + + +I. Présentation + + COS2000, par définition est système d'exploitation, celui prend la direction des opérations à partir du moment où le PC est mis sous tension (Aprés le BIOS). Celui gére tous les périphériques rattaché au PC et offre aux programmeur les moyens de développer des applications compatibles : les APIs. COS2000 est basé sur un concept particulier qui est d'offrir au programmeur un maximum de fonctions intégrés pour faciliter le travail des programmeurs et réduire la taille des programmes. + + +II. Mode d'emploi + +Pour installer COS2000 : + - Insérez une disquette 1.44 Mo dans votre lecteur. + - Lancez le programme Setup.com. + - 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. + +Pour utiliser COS2000 : + + 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 s'il possèdent l'extension EXE, ils peuvent être exécutés. +Pour cela il suffit de sélectionner avec la ligne en surbrillance le programme à executer en utilisant les flêches de directions, pour éxecuter le programmer presser la touche "Entrée". +A partir du COS MENU LOADER on peut lancer un interpréteur de commandes . Celui s'appelle PROMPT.EXE. +Une fois dans l'interpréteur de commande vous pouvez tout aussi bien lancer des logiciels en saissisant leurs noms après "COS>". + +En plus des logiciels, l'interpréteur de commande 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 nombre 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. diff --git a/clean.bat b/clean.bat deleted file mode 100755 index 200b0c1..0000000 --- a/clean.bat +++ /dev/null @@ -1 +0,0 @@ -del ..\data\*.exe diff --git a/asm.bat b/commande/asm.bat similarity index 82% rename from asm.bat rename to commande/asm.bat index daef462..9466a7b 100755 --- a/asm.bat +++ b/commande/asm.bat @@ -1,11 +1,11 @@ @echo off echo Assembling file %1... -util\tasm %1.asm /m5/x/t +..\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 +..\util\tlink %1.obj /x/t if errorlevel 1 goto end echo Copying file %1... if "%1"=="video" goto video @@ -15,6 +15,7 @@ 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 @@ -22,10 +23,10 @@ goto end :boot echo Linking file %1... -util\tlink %1.obj /x +..\util\tlink %1.obj /x if errorlevel 1 goto end echo Copying file %1... -util\exe2boot %1.exe +..\util\exe2boot %1.exe copy %1.bin ..\data\%1.bin>nul goto end diff --git a/commande/clean.bat b/commande/clean.bat new file mode 100755 index 0000000..687f4b0 --- /dev/null +++ b/commande/clean.bat @@ -0,0 +1,3 @@ +@echo off +echo nettoyage en cours... +del ..\data\*.* >nul diff --git a/commande/debog.bat b/commande/debog.bat new file mode 100755 index 0000000..aedbb4e --- /dev/null +++ b/commande/debog.bat @@ -0,0 +1,2 @@ +@echo off +..\util\td %1 diff --git a/prompt.asm b/commande/prompt.asm similarity index 94% rename from prompt.asm rename to commande/prompt.asm index c503c29..09a3c83 100755 --- a/prompt.asm +++ b/commande/prompt.asm @@ -12,6 +12,8 @@ start: int 47h mov ah,6 int 47h + mov ah,42 + int 47h mov ah,13 mov si,offset msg int 47h @@ -182,7 +184,7 @@ Code_Version: int 47h ret -Version_Text db 'Cos 2000 version 1.1.1B by Nico',0 +Version_Text db 'Cos 2000 version 2.0.1B by Nico',0 Code_Cls: mov ah,2 diff --git a/setup.asm b/commande/setup.asm similarity index 91% rename from setup.asm rename to commande/setup.asm index b44f3d0..8bc1bb8 100755 --- a/setup.asm +++ b/commande/setup.asm @@ -70,6 +70,7 @@ int 21h jc error mov dx,offset boot call addfile +jc error mov ax,0F0FFh mov cx,14 mov di,offset fat @@ -112,6 +113,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 @@ -127,6 +131,7 @@ mov al,0 mov cl,13 cld rep stosb +allfilesend: mov ah,4fh int 21h jnc allfile @@ -223,12 +228,16 @@ 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 end1 +jmp errorend temp dw 0 makefit: @@ -236,6 +245,7 @@ push bx cx si di bp mov ax,cx mov bx,offset fat mov cx,13 +retry: call readsector jc error3 xor si,si @@ -245,7 +255,8 @@ je finishfit add si,32 cmp si,512 jb findfit -jmp error3 +inc cx +jmp retry finishfit: mov di,si add di,bx @@ -253,7 +264,6 @@ mov si,dx call asciiztofit jc error3 mov [di+26],ax -mov cx,13 call writesector jc error3 end3: diff --git a/str0.asm b/commande/str0.asm similarity index 100% rename from str0.asm rename to commande/str0.asm diff --git a/write.bat b/commande/write.bat similarity index 100% rename from write.bat rename to commande/write.bat diff --git a/debog.bat b/debog.bat deleted file mode 100755 index 3530e81..0000000 --- a/debog.bat +++ /dev/null @@ -1,2 +0,0 @@ -@echo off -util\td %1 diff --git a/noyau/asm.bat b/noyau/asm.bat new file mode 100755 index 0000000..0f3cfb8 --- /dev/null +++ b/noyau/asm.bat @@ -0,0 +1,55 @@ +@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/asmsys.bat b/noyau/asmsys.bat similarity index 76% rename from asmsys.bat rename to noyau/asmsys.bat index e18c01e..9bb00a9 100755 --- a/asmsys.bat +++ b/noyau/asmsys.bat @@ -7,3 +7,5 @@ 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/boot.asm b/noyau/boot.asm similarity index 100% rename from boot.asm rename to noyau/boot.asm diff --git a/noyau/clean.bat b/noyau/clean.bat new file mode 100755 index 0000000..687f4b0 --- /dev/null +++ b/noyau/clean.bat @@ -0,0 +1,3 @@ +@echo off +echo nettoyage en cours... +del ..\data\*.* >nul diff --git a/noyau/debog.bat b/noyau/debog.bat new file mode 100755 index 0000000..aedbb4e --- /dev/null +++ b/noyau/debog.bat @@ -0,0 +1,2 @@ +@echo off +..\util\td %1 diff --git a/drive.asm b/noyau/drive.asm similarity index 92% rename from drive.asm rename to noyau/drive.asm index 39204df..798fb8e 100755 --- a/drive.asm +++ b/noyau/drive.asm @@ -241,6 +241,7 @@ call searchfile jc errorloadfile mov bx,di call loadfatway +jc errorloadfile mov cx,dx errorloadfile: pop bx @@ -248,7 +249,7 @@ ret ;Recherche le fichier et retourne sont path et en cx sont debut Searchfile: -push bx dx si di ds es +push ax bx dx si di ds es push cs pop es xor dx,dx @@ -290,7 +291,7 @@ jmp goodboot errorboot: stc goodboot: -pop es ds di si dx bx +pop es ds di si dx bx ax ret ;->name ds:si ->es:di diff --git a/noyau/hours.asm b/noyau/hours.asm new file mode 100755 index 0000000..b3daa5e --- /dev/null +++ b/noyau/hours.asm @@ -0,0 +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 diff --git a/noyau/joystick.asm b/noyau/joystick.asm new file mode 100755 index 0000000..9d96bd2 --- /dev/null +++ b/noyau/joystick.asm @@ -0,0 +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 diff --git a/keyboard.asm b/noyau/keyboard.asm similarity index 90% rename from keyboard.asm rename to noyau/keyboard.asm index 2c959d5..636fb52 100755 --- a/keyboard.asm +++ b/noyau/keyboard.asm @@ -33,7 +33,7 @@ tsr: sti iret isstate db 0 - infos db 10 dup (0) + infos db 40 dup (0) F11: push ax di es @@ -42,9 +42,13 @@ F11: mov di,offset infos mov ah,34 int 47h - mov al,cs:infos+7 + mov al,cs:[di+7] inc al - and ax,111b + cmp al,9 + jbe notabove + mov al,0 +notabove: + mov ah,0 int 47h pop es di ax jmp endof diff --git a/lpt.asm b/noyau/lpt.asm similarity index 100% rename from lpt.asm rename to noyau/lpt.asm diff --git a/mouse.asm b/noyau/mouse.asm similarity index 81% rename from mouse.asm rename to noyau/mouse.asm index 67ad649..b2e8a19 100755 --- a/mouse.asm +++ b/noyau/mouse.asm @@ -146,7 +146,6 @@ ret ;envoie en di les coordonn‚es ecran et en dl les boutons getmousescreen: mov di,cs:xy -mov cx,cs:ry mov dl,cs:button sub dl,8 and dl,0Fh @@ -166,15 +165,15 @@ rx dw 0 ry dw 0 VX db 0 VY db 0 -X dw 0 -Y dw 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 dw 0 +old db 0 ;Gestionnaire de souris PS/2 react: push ax bx cx dx di ds es @@ -224,8 +223,12 @@ endgest: shl bx,cl cmp spherey,0 jne nolimity - mov al,[di] 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 @@ -242,8 +245,12 @@ noaddy: shl bx,cl cmp spherex,0 jne nolimitx + xor ah,ah mov al,[di+1] - xor ah,ah + cmp byte ptr [di+7],4 + jbe text5 + shl ax,3 +text5: dec ax cmp bx,0 jl decx @@ -260,27 +267,53 @@ noaddx: 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 - mul byte ptr [di+1] + xor ch,ch + mov cl,[di+1] + cmp byte ptr [di+7],4 + jbe text3 + shl cx,3 +text3: + mul cx add ax,rx - shl ax,1 + 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 - mov ax,old - mov word ptr es:[bx],ax + cmp byte ptr es:[bx],070h + jne waschanged + mov al,old + mov byte ptr es:[bx],al +waschanged: mov xy,di - mov ax,es:[di] - mov old,ax - mov word ptr es:[di],0FF70h + mov al,es:[di] + mov old,al + mov byte ptr es:[di],070h mov al, 20h out 0a0h, al out 20h, al @@ -289,6 +322,6 @@ errormouse: mov cs:isact,0 pop bx iret - infos db 10 dup (0) + infos db 40 dup (0) end start diff --git a/thin8x8.fnt b/noyau/old8x8.fnt similarity index 100% rename from thin8x8.fnt rename to noyau/old8x8.fnt diff --git a/pic8259a.asm b/noyau/pic8259a.asm similarity index 92% rename from pic8259a.asm rename to noyau/pic8259a.asm index a8e5474..7fcf64c 100755 --- a/pic8259a.asm +++ b/noyau/pic8259a.asm @@ -177,29 +177,33 @@ ret ;remplace le handler pointer par ds:si en bx:100h interruption ax replacehandler: -push ax bx si di ds es +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 -pop es ds di si bx ax +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 di es +push bx cx di es mov es,bx mov di,100h mov ah,4 int 48h +jc inh mov bx,ax call setint -pop es di bx +inh: +pop es di cx bx ret ;met es:di le handle de l'int al diff --git a/system.asm b/noyau/system.asm similarity index 81% rename from system.asm rename to noyau/system.asm index 48f9285..9680cde 100755 --- a/system.asm +++ b/noyau/system.asm @@ -10,22 +10,27 @@ 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] @@ -38,6 +43,7 @@ mov si,offset lpt mov bx,1500h mov ax,0Fh call installhandler +jc erroron mov es,bx sub al,8 xor ah,ah @@ -58,6 +64,7 @@ mov si,offset lpt mov bx,1700h mov ax,0Dh call installhandler +jc erroron sub al,8 xor ah,ah int 50h @@ -68,19 +75,19 @@ mov si,offset mouse mov bx,1900h mov ax,74h call installhandler +jc erroron mov ax,0012 int 50h -;mov ah, 00010000b -;not ah -;in al, 0a1h -;and al, ah -;out 0a1h, al 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 @@ -231,65 +238,6 @@ executefatway: push 7202h popf db 0CBh - -;cx entr‚e -> fatway chemin -getfatway: -push bx cx es -mov bx,offset fatway -fatagain: -mov cs:[bx],cx -add bx,2 -cmp cx,0FFF0h -jae finishload -call getfat -jnc fatagain -finishload: -pop es cx bx -ret - -loadfatway: -push ax bx cx di -call getfatway -jc endload -mov di,offset fatway -mov si,offset dot -mov ah,13 -loadagain: -mov cx,cs:[di] -cmp cx,0FFF0h -jae endload -add di,2 -call readsector -jc endload -int 47h -add bx,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 -mov ax,cx -xor dx,dx -div cs:sizec -mov cx,ax -add cx,cs:reserv -mov bx,offset buffer -push cs -pop es -call readsector -jc errorgetfat -shl dx,1 -add bx,dx -mov cx,cs:[bx] -errorgetfat: -pop dx bx ax es -ret ;selectionne la ligne xx Select: @@ -318,7 +266,70 @@ msg3 db ' Cos will restart your computer, eject the floppy disk and press a key' 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 @@ -396,38 +407,45 @@ Lastread dw 0FFFFh ;remplace le handler pointer par ds:si en bx:100h interruption ax replacehandler: -push ax bx si di ds es +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 -pop es ds di si bx ax +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 di es +push bx cx di es mov es,bx mov di,100h call loadfile +jc insh mov bx,ax call setint -pop es di bx +insh: +pop es di cx bx ret - -;Charge le fichier Ds:si en es:di +;Charge le fichier Ds:si en es:di taille-> cx loadfile: -push bx cx +push bx call searchfile +jc errorloadfile mov bx,di call loadfatway -pop cx bx -ret +jc errorloadfile +mov cx,dx +errorloadfile: +pop bx +ret ;met es:di le handle de l'int bx setint: @@ -453,17 +471,19 @@ mov ds,es:[bx+2] pop es bx ax ret -;Recherchele fichier et retourne sont path et en cx sont debut +;Recherche le fichier et retourne sont path et en cx sont debut Searchfile: -push bx dx si di ds es -xor dx,dx +push ax bx dx si di ds es push cs pop es +xor dx,dx mov di,offset temp -mov bx,offset buffer call asciiztofit +push cs +pop ds mov cx,13 check: +mov bx,offset buffer call readsector jc errorboot xor di,di @@ -475,6 +495,7 @@ mov si,di add si,bx mov di,offset temp mov cx,12+4 +cld rep cmpsb pop cx di si je oksystem @@ -488,8 +509,12 @@ inc cx jmp Check oksystem: mov cx,[di+BX+26] +cld +jmp goodboot errorboot: -pop es ds di si dx bx +stc +goodboot: +pop es ds di si dx bx ax ret ;->name ds:si ->es:di @@ -565,9 +590,9 @@ inc di cmp byte ptr cs:[di],0 jne isexcept endanal: -pop di +clc +pop di ret -exeptchar db '/\<>:|.',01,0,0 nogood: stc jmp endanal @@ -594,11 +619,43 @@ 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 - - +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 @@ -607,7 +664,7 @@ 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 @@ -615,4 +672,5 @@ DiskHeads dw 2 fatway equ $ buffer equ $+3000 + end start diff --git a/noyau/thin8x8.fnt b/noyau/thin8x8.fnt new file mode 100755 index 0000000000000000000000000000000000000000..6d72f9c51ae7f8057770f299f5afe26fe72a2162 GIT binary patch literal 2048 zcmZWqziT5$6n?naG>gup8nE#}xGL3PgS?nQ2G?oRq{+q(lOt^5N?DT0*fQZrks_^& zE3R;Je?hJ=EEuL*T#5rbjsih$LU1Lk5VQH-n~kr?TS?!(w{PC>eIiQaCl`~;^NIJ} zO?P$Q`6|Zfigj8qoM7RK7^mw6^UA@v z$<56V8yg!m`U;lJE634#??n%4o#-n?3IrZu6I(O*ntVH_u7BUwa_}hfEg`D}=IK)*hIbNc1+q!%?E32_Zyow5m zGovia5X-FO0?b9qaS{C;r_(9$7WR2SIAb1X@Qw|Ny)E$LWZyR~Tanf)t%sY?Ll_bV zjv;>xq~s6e0x-`LutJkRQ`?>fN*yaTz!(S-GZ4}E7OG5Kh`@8!AkDmPd;7UcdAhSy zk3b2v>QN_zpQiD7;m(pica-a+`}4N1hdV0}fPtI^h63DTU@&jc2Pz$#rM#g2WFu50dkI(Mf<_4PxEdETqQR=+)! zYp|h=dVdW6DIe?%iI4MVKdQHndU30{Xw#)Qfo-4&`k*P~!^&BWXeptlv z@vX~z@Tf=fKOFAreO97Y)K!$*;mtgS%W^9xq}moac8kv zVIBfD9-~$XQE_-T*tfiC44H$3mJ&j!mJ$aM$KCbBBEE%4lF 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 diff --git a/noyau/write.bat b/noyau/write.bat new file mode 100755 index 0000000..808b110 --- /dev/null +++ b/noyau/write.bat @@ -0,0 +1,4 @@ +@echo off +cd .. +setup +cd sources diff --git a/exe2boot.asm b/outils/exe2boot.asm similarity index 100% rename from exe2boot.asm rename to outils/exe2boot.asm diff --git a/rip.asm b/outils/rip.asm similarity index 100% rename from rip.asm rename to outils/rip.asm diff --git a/unrip.asm b/outils/unrip.asm similarity index 100% rename from unrip.asm rename to outils/unrip.asm diff --git a/programs/asm.bat b/programs/asm.bat new file mode 100755 index 0000000..9466a7b --- /dev/null +++ b/programs/asm.bat @@ -0,0 +1,54 @@ +@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 new file mode 100755 index 0000000..687f4b0 --- /dev/null +++ b/programs/clean.bat @@ -0,0 +1,3 @@ +@echo off +echo nettoyage en cours... +del ..\data\*.* >nul diff --git a/programs/debog.bat b/programs/debog.bat new file mode 100755 index 0000000..aedbb4e --- /dev/null +++ b/programs/debog.bat @@ -0,0 +1,2 @@ +@echo off +..\util\td %1 diff --git a/disk.asm b/programs/disk.asm similarity index 89% rename from disk.asm rename to programs/disk.asm index e0b4ca3..291b624 100755 --- a/disk.asm +++ b/programs/disk.asm @@ -10,10 +10,10 @@ start: int 16h mov ax,0002 int 47H - mov ah,26 - int 47H mov ah,2 int 47h + mov ah,43 + int 47h xor bp,bp Adres: mov di,offset infos @@ -45,6 +45,14 @@ 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 @@ -52,7 +60,6 @@ Adres: int 47h mov oldmode,al noinit: - dec infos mov bx,0 mov ah,25 int 47h @@ -77,7 +84,7 @@ lines: int 47h mov ah,5 int 47h - mov al,16 + mov al,infos+1 mov cl,7 mov ah,21 int 47h @@ -96,7 +103,7 @@ doaline: mov si,offset spaces mov ah,13 int 47h - mov al,16 + mov al,infos+1 mov ah,21 mov cl,7 int 47h @@ -109,6 +116,8 @@ doaline2: jnz doaline2 dec bh je outes + cmp byte ptr infos+2,0 + je lines mov ah,6 int 47h jmp lines @@ -116,8 +125,10 @@ outes: mov ah,21 mov cl,112 int 47h + mov bh,0 + mov bl,infos mov si,offset menu - mov ah,13 + mov ah,14h int 47h waitkey: mov ax,0 @@ -270,9 +281,7 @@ cursor: jmp waitst suit7: cmp ax,4200h - jne waitkey - mov ah,27 - int 47h + jne adres2 db 0CBH ret diff --git a/editor.asm b/programs/editor.asm similarity index 88% rename from editor.asm rename to programs/editor.asm index ad2b614..9608987 100755 --- a/editor.asm +++ b/programs/editor.asm @@ -10,18 +10,25 @@ start: int 16h mov ax,0002 int 47H - mov ah,26 - int 47H mov ah,2 int 47h xor ebp,ebp xor ax,ax - mov fs,ax + mov fs,ax + mov ah,43 + int 47h Adres: mov di,offset infos mov ah,34 int 47h - dec infos + 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 @@ -55,7 +62,7 @@ lines: int 47h mov ah,5 int 47h - mov al,16 + mov al,infos+1 mov cl,7 mov ah,21 int 47h @@ -78,7 +85,7 @@ doaline: mov si,offset spaces mov ah,13 int 47h - mov al,16 + mov al,infos+1 mov ah,21 mov cl,7 int 47h @@ -95,6 +102,8 @@ doaline2: jnz doaline2 dec bh je outes + cmp byte ptr infos+2,0 + je lines mov ah,6 int 47h jmp lines @@ -102,8 +111,10 @@ outes: mov ah,21 mov cl,112 int 47h + mov bh,0 + mov bl,infos mov si,offset menu - mov ah,13 + mov ah,14h int 47h waitkey: mov ax,0 @@ -140,16 +151,14 @@ outes: 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 dword ptr [pope],'TIDE' + mov bl,infos + xor bh,bh mov si,offset menu - mov ah,13 + mov ah,14h int 47h mov ah,21 mov cl,7 @@ -275,7 +284,7 @@ cursor: jmp waitst suit7: cmp ax,4200h - jne waitkey + jne adres mov ah,27 int 47h db 0CBH ; +++++++ @@ -372,7 +381,7 @@ spaces db ' showbuffer db 35 dup (0FFh) oldmode db 0 -infos db 10 dup (0) +infos db 40 dup (0) end start diff --git a/logo.asm b/programs/logo.asm similarity index 83% rename from logo.asm rename to programs/logo.asm index f20ec8f..255295b 100755 --- a/logo.asm +++ b/programs/logo.asm @@ -21,7 +21,7 @@ mov ah,6 int 48h push es pop ds -mov ax,0006h +mov ax,0009h int 47h mov ah,38 int 47h @@ -29,8 +29,10 @@ mov ah,35 int 47h mov ah,37 int 47h -xor cx,cx -xor bx,bx +mov ah,2 +int 47h +mov cx,400 +mov bx,40 mov ah,36 int 47h mov ax,0 diff --git a/programs/mous.asm b/programs/mous.asm new file mode 100755 index 0000000..785a328 --- /dev/null +++ b/programs/mous.asm @@ -0,0 +1,41 @@ +.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/pmode.asm b/programs/pmode.asm similarity index 100% rename from pmode.asm rename to programs/pmode.asm diff --git a/test.asm b/programs/test.asm similarity index 91% rename from test.asm rename to programs/test.asm index db759cc..33ea3ee 100755 --- a/test.asm +++ b/programs/test.asm @@ -48,11 +48,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 diff --git a/verif.asm b/programs/verif.asm similarity index 100% rename from verif.asm rename to programs/verif.asm diff --git a/programs/write.bat b/programs/write.bat new file mode 100755 index 0000000..808b110 --- /dev/null +++ b/programs/write.bat @@ -0,0 +1,4 @@ +@echo off +cd .. +setup +cd sources diff --git a/timer.asm b/timer.asm deleted file mode 100755 index ce6c0b0..0000000 --- a/timer.asm +++ /dev/null @@ -1,91 +0,0 @@ -.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 -push ds es -pusha -mov ax,40h -mov es,ax -mov ax,0B800h -mov ds,ax -mov word ptr dx,es:[8] - -in al,dx -mov di,158 -decompose: -mov cl,al -and cl,1 -cmp cl,1 -je un -mov byte ptr ds:[di],'0' -jmp errr -un: -mov byte ptr ds:[di],'1' -errr: -shr al,1 -dec di -dec di -cmp di,142 -jne decompose - -inc dx -in al,dx -mov di,318 -decompose2: -mov cl,al -and cl,1 -cmp cl,1 -je un2 -mov byte ptr ds:[di],'0' -jmp errr2 -un2: -mov byte ptr ds:[di],'1' -errr2: -cmp di,314 -jb errrr -mov byte ptr ds:[di],'X' -errrr: -shr al,1 -dec di -dec di -cmp di,302 -jne decompose2 -popa -pop es ds - - - - - - - - - - pop es bx ax - sti - iret - compteur dw 0 - fig db 'Ä\³/' -end start diff --git a/video.asm b/video.asm deleted file mode 100755 index 56c48b3..0000000 --- a/video.asm +++ /dev/null @@ -1,1412 +0,0 @@ -.model tiny -.486 -smart -.code - -org 0100h - -start: -jmp tsr -db 'VIDEO' -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 setvideomode - dw getvideomode - dw cleartext - dw changefont - dw loadfont - dw space - dw line - 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 getinfos - dw loadbmp - dw showbmp - dw clearscr - dw savedac - dw restoredac - dw savestate - dw restorestate - -;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 - -;Change la police a CL -changefont: -push ax cx dx -mov ah,cl -and cl,11b -and ah,0100b -shl ah,2 -add ah,cl -mov dx,3C4h -mov al,3 -out dx,ax -pop dx cx ax -ret - -;met la police BL … ds:si taille dans CL -loadfont: -push ax bx cx dx si di es -xor di,di -mov dx,3C4h -cli -doseq: -mov ax,cs:[di+offset reg1] -out dx,ax -inc di -inc di -cmp di,6 -jbe doseq -mov dx,3CEh -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,255 -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,3C4h -doseqs: -mov ax,cs:[di+offset reg2] -out dx,ax -inc di -inc di -cmp di,6 -jbe doseqs -mov dx,3CEh -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 -reg2 dw 0100h, 0302h, 0304h, 0300h - dw 0004h, 1005h, 0E06h -reg1 dw 0100h, 0402h, 0704h, 0300h - dw 0204h, 0005h, 0406h - -;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 16 couleurs -mode5 DB 63H,00H, 03H,09H,0FH,00H,06H - DB 2DH,27H,28H,90H,2BH,080H,0BFH,01FH,00H,0C0H,00H,00H,00H,00H,00H,00H - DB 9CH,8EH,8FH,14H,00H,96H,0B9H,0E3H,0FFH - DB 00H,00H,00H,00H,00H,00H,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*200 256 couleurs -mode6 DB 63H, 00H, 03H,01H,0FH,00H,0EH - DB 5FH,4FH,50H,82H,54H,80H,0BFH,1FH,00H,41H,00H,00H,00H,00H,00H,00H - DB 9CH,0EH,8FH,28H,40H,96H,0B9H,0A3H,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 00,00 - -;320*400 256 couleurs chain4 -mode7 DB 63H, 00H, 03H,01H,0FH,00H,0EH - DB 5FH,4FH,50H,82H,54H,80H,0BFH,1FH,00H,40H,00H,00H,00H,00H,00H,00H - DB 9CH,8EH,8FH,28H,40H,96H,0B9H,0A3H,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 00,00 - -;640*400 16 couleurs -mode8 DB 63H, 00H, 03H,01H,0FH,00H,0EH - DB 5FH,4FH,50H,82H,54H,80H,0BFH,1FH,00H,41H,00H,00H,00H,00H,00H,00H - DB 9CH,0EH,8FH,28H,40H,96H,0B9H,0A3H,0FFH - DB 00H,00H,00H,00H,00H,10H,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 00,00 - -;640*400 256 couleurs -mode9 DB 63H, 00H, 03H,01H,0FH,00H,0EH - DB 2DH,27H,27H,91H,2AH,9FH,0BFH,1FH,00H,0C0H,00H,00H,00H,00H,00H,00H - DB 9CH,0EH,8FH,50H,00H,8FH,0C0H,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 00,00 - - - -;==================================================== -;320*400 256 couleurs chain4 -mode7s DB 63H, 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 00,00 - -; -;=============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 - -;=============CLEAR========= -;Efface l'ecran texte -;-> -;<- -;============================= -clearpixel: -push es eax cx di -xor di,di -mov ax,0A000h -mov es,ax -mov eax,0h -mov cx,cs:pagesize -shr cx,2 -cld -rep stosd -pop di cx eax es -ret - -Sequencer equ 03C4h -misc equ 03C2h -CCRT equ 03D4h -Attribs equ 03C0h -graphic equ 03CEh -statut equ 3DAh - -initmode: -push bx cx si ds -;xor bx,bx -;mov ds,bx -;lds si,ds:[43h*4] -push cs -pop ds -mov si,offset font -mov cl,8 -mov bl,1 -call loadfont -pop ds si cx bx -ret - -;Renvoie le mode video dans al -getvideomode: -mov al,cs:mode -ret - -;====Met le mode video a al -setvideomode: -push ax dx di -cmp cs:mode,0FFh -jne noinit -call initmode -mov cs:pagesize,4000 -call cleartext -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,5 -jb 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,25 -jb initcrt -mov dx,graphic -xor ax,ax -initgraphic: -mov ah,cs:[di] -out dx,ax -inc al -inc di -cmp al,9 -jb 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,21 -jb initattribs -mov al,cs:[di] -mov cs:columns,al -mov ah,cs:[di+1] -mov cs:lines,ah -mul ah -shl ax,1 -mov cs:pagesize,ax -mov al,20h -out dx,al -pop di dx ax -ret - -;==========SPACE=========== -;met un espace apr‚s le curseur -;-> -;<- -;============================= -space: -push bx es -add cs:xy,2 -mov bx,0B800h -mov es,bx -mov bx,cs:xy -mov byte ptr es:[bx],' ' -pop es bx -ret - -;==========SHOWCHAR=========== -;met un caractŠre apr‚s le curseur -;-> dl -;<- -;============================= -showchar: -push dx bx es -mov bx,0B800h -mov es,bx -mov bx,cs:xy -mov dh,cs:colors -mov es:[bx],dx -add cs:xy,2 -pop es bx dx -ret - -;==========SHOWCHARAT=========== -;met un caractŠre apr‚s le curseur coord ah,al -;-> dl ah al -;<- -;============================= -showcharat: -push es di -call setxy -call showchar -pop di 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 - -;==========SETCOLOR========= -;Change les attributs du texte a CL -;-> CL -;<- -;============================= -setcolor: -mov cs:colors,CL -ret - -;==========GETCOLOR========= -;R‚cupŠre les attributs du texte dans CL -;-> -;<- CL -;============================= -getcolor: -mov cl,cs:colors -ret - -updatecursor: -push ax dx di -mov dx,3D4h -mov al,0Eh -mov di,offset xy -mov ah,cs:[di] -out dx,ax -mov ah,cs:[di+1] -inc al -out dx,ax -pop di dx 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 - -;==========GETXY========= -;Change les coordonnées du curseur a X:AL,Y:AH -;-> AX -;<- -;============================= -getxy: -mov bh,cs:x -mov bl,cs:y -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 - -setxy2: -push es di -call setxy -pop di es -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 - -;===================================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,cs:colors - 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 -showbuffer db 35 dup (0FFh) - -;===================================Afficher un int EDX a l'‚cran en ah,al================ -ShowIntat: -push es di - call setxy - call showint -pop di es -ret - -waitretrace: -push ax dx -mov dx,3DAh -waitr: -in al,dx -test al,8 -jz waitr -pop dx ax -ret - -nbexactbit: -push edx -xor cx,cx -viewnb: -inc cx -shr edx,1 -cmp edx,0 -jnz viewnb -pop edx -ret - -bittobyte: -push dx -adap: -mov dx,cx -and dx,3 -jz adapfin -add cx,1 -jmp adap -adapfin: -pop dx -ret - -Nbbit: -cmp edx,0FFh -jb ok1 -cmp edx,0FFFFh -jb ok2 -mov cx,32 -ret -ok1: -mov cx,8 -ret -ok2: -mov cx,16 -ret - -showhexat: -push es di - call setxy - call showhex -pop di es -ret - -showbinat: -push cx es di -call setxy -call showbin -pop di es cx -ret - -;==============================Affiche le nombre nb binaire en EDX============== -Showbin: - push es ax bx cx 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 -binaize: - rol edx,1 - mov cl,'0' - adc cl,0 - mov es:[di],cx - add di,2 - dec al - jnz binaize - mov cs:xy,di - pop di cx bx ax es - ret - -;==============================Affiche le nombre nb hexa en EDX============== -ShowHex: - push es ax bx cx 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 cx bx ax es - ret -Tab db '0123456789ABCDEF' - -;===================================Afficher un int EDX a l'‚cran en ah,al================ -Showsigned: -push ax ebx edx es -xor ebx,ebx -mov bl,cl -dec bl -bt edx,ebx -jnc pos -neg edx -mov ah,cs:colors -mov al,'-' -mov bx,0B800h -mov es,bx -mov bx,cs:xy -mov word ptr es:[bx],ax -add cs:xy,2 -pos: -call showint -pop es edx ebx ax -ret - -showsignedat: -push es di -call setxy -call showsigned -pop di es -ret - -;================Affiche la chaine de caractŠre contenue dans ds:si -showstring: - push es bx cx si di - mov di,cs:xy - mov bx,0B800h - mov es,bx - mov bl,[si] - mov ch,cs:colors -strinaize: - inc si - mov cl,[si] - mov es:[di],cx - add di,2 - dec bl - jnz strinaize - mov cs:xy,di - pop di si cx bx es - 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 - - -showstringat: -push es di -call setxy -call showstring -pop di es -ret - -showstring0at: -push es di -call setxy -call showstring0 -pop di es -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 - -;Retourne en es:di un bloc de donn‚es -Getinfos: -push cx si di ds -push cs -pop ds -mov cx,10 -mov si,offset lines -cld -rep movsb -pop ds di si cx -ret - - -clearscr: -push eax cx -mov cx,320*200/4 -mov eax,0 -rep movsd -pop cx eax - -loadbmp: -push ax bx cx dx ds -mov ax,ds:[18] -mov si,ax -shr ax,2 -and si,11b -cmp si,0 -je is4x -add ax,1 -is4x: -mov cs:sizeh,ax -mov ax,ds:[22] -mov cs:sizev,ax -mov di,0FFFFh-1024 -mov si,54 -mov cl, 0ffh -paletteload: -lodsb -shr al, 2 -mov [di+2], al -lodsb -shr al, 2 -mov [di+1], al -lodsb -shr al, 2 -mov [di+0], al -inc si -add di, 3 -dec cl -jnz paletteload -mov si,0FFFFh-1024 -mov dx, 3c8h -cld -mov cl, 0ffh -xor bx, bx -palettemake: -mov al, bl -out dx, al -inc dx -lodsb -out dx, al -lodsb -out dx, al -lodsb -out dx, al -dec dx -inc bl -dec cl -jnz palettemake -pop ds dx cx bx ax -ret -sizeh dw 0 -sizev dw 0 - -showbmp: -push ax bx cx dx si di ds es -mov dx,cs:sizev -add bx,dx -mov di,cx -mov ax,bx -shl ax,6 -shl bx,8 -add di,bx -add di,ax -mov bx,di -mov ax,0A000H -mov es,ax -mov si,1024+54 -mov ax,cs:sizeh -bouclebmp: -cmp di,64000 -jae nopp -cld -rep movsd -no: -mov cx,ax -sub bx,320 -mov di,bx -dec dx -jnz bouclebmp -fin: -pop es ds di si dx cx bx ax -ret -nopp: -shl cx,2 -add si,cx -jmp no - -fire: -push ax cx dx si di -xor si,si -xor di,di -mov cx,64000 -makefire: -xor ax,ax -mov al,[si] -add al,[si+321] -adc ah,0 -add al,[si-321] -adc ah,0 -add al,[si+320] -adc ah,0 -shr ax,2 -cmp al,191 -jb pp -mov al,191 -pp: -cmp al,0 -je p -dec ax -p: -mov es:[di],al -inc si -inc di -dec cx -jnz makefire -pop di si dx cx ax -ret - -fireflamme: -push ax cx dx si di -xor si,si -xor di,di -mov cx,64000 -makefire2: -xor ax,ax -mov al,[si] -add al,[si+1] -adc ah,0 -add al,[si-1] -adc ah,0 -add al,[si+320] -adc ah,0 -shr ax,2 -cmp al,191 -jb ppp -mov al,191 -ppp: -cmp al,0 -je pppp -dec ax -pppp: -mov es:[di],al -inc si -inc di -dec cx -jnz makefire2 -pop di si dx cx ax -ret - -gauss: -push ax cx dx si di -xor si,si -xor di,di -mov cx,64000 -makegauss: -xor ax,ax -mov al,[si+1] -add al,[si-1] -adc ah,0 -add al,[si+321] -adc ah,0 -add al,[si+320] -adc ah,0 -add al,[si+319] -adc ah,0 -add al,[si-321] -adc ah,0 -add al,[si-320] -adc ah,0 -add al,[si-319] -adc ah,0 -shr ax,3 -mov es:[di],al -inc si -inc di -dec cx -jnz makegauss -pop di si dx cx ax -ret - -lowgauss: -push ax cx dx si di -xor si,si -xor di,di -mov cx,64000 -makegausss: -xor ax,ax -mov al,[si+1] -add al,[si-1] -adc ah,0 -add al,[si+320] -adc ah,0 -add al,[si-320] -adc ah,0 -shr ax,2 -mov es:[di],al -inc si -inc di -dec cx -jnz makegausss -pop di si dx cx ax -ret - -firepalett: -push ax cx dx -mov dx,03C8h -xor ax,ax -out dx,al -inc dx -mov cx,64 -rouge1: -out dx,al -push ax -xor al,al -out dx,al -out dx,al -pop ax -inc ax -loop rouge1 -mov cx,64 -jaune1: -push ax -mov al,63 -out dx,al -pop ax -out dx,al -push ax -xor al,al -out dx,al -pop ax -inc ax -loop jaune1 -mov cx,63 -blanc1: -push ax -mov al,63 -out dx,al -out dx,al -pop ax -out dx,al -loop blanc1 -pop dx cx ax -ret - -allfirepalett: -push ax cx dx -mov dx,03C8h -xor ax,ax -out dx,al -inc dx -mov cx,64 -rouge: -push ax -shr ax,1 -out dx,al -xor al,al -out dx,al -out dx,al -pop ax -inc ax -loop rouge -mov cx,64 -rouge2: -push ax -shr ax,1 -out dx,al -xor al,al -out dx,al -out dx,al -pop ax -inc ax -loop rouge2 -mov cx,64 -Jaune: -push ax -mov al,63 -out dx,al -pop ax -out dx,al -push ax -xor al,al -out dx,al -pop ax -inc ax -loop jaune -mov cx,64 -blanc: -push ax -mov al,63 -out dx,al -out dx,al -pop ax -out dx,al -loop blanc -pop dx cx ax -ret - -gaussscreen: -push ax ds es -mov ax,0A000h -mov ds,ax -push fs -pop es -call gauss -push ds -pop es -push fs -pop ds -call Copyscreen -pop es ds ax -ret - -lowgaussscreen: -push ax ds es -mov ax,0A000h -mov ds,ax -push fs -pop es -call lowgauss -push ds -pop es -push fs -pop ds -call Copyscreen -pop es ds ax -ret - -firescreen: -push ax ds es -mov ax,0A000h -mov ds,ax -push fs -pop es -call fire -push ds -pop es -push fs -pop ds -call Copyscreen -pop es ds ax -ret - -copyscreen: -push si di cx -xor si,si -xor di,di -mov cx,64000/4 -rep movsd -pop cx di si -ret - -;Sauve l'‚tat de la carte en es:di -savestate: -push cx si di ds -push cs -pop ds -mov cx,10 -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 cx si di es -push cs -pop es -mov cx,10 -mov di,offset lines -cld -rep movsb -call restorescreenfrom -pop es di si cx -ret - -lines db 0 -columns db 0 -x db 0 -y db 0 -xy dw 0 -colors db 7 -mode db 0FFh -pagesize dw 0 -font equ $ -copy equ $+4000 -copy2 equ $+8000 -dac equ $+12000 -endofme equ $ +12768 - -end start