From 89b122da160072863947b14aba890fac30967d0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Hord=C3=A9?= Date: Tue, 13 Mar 2007 20:56:55 +0000 Subject: [PATCH] =?UTF-8?q?feat:=20mise=20=C3=A0=20jour=20du=20code=20pour?= =?UTF-8?q?=20compilation=20sur=20LZASM=20en=20stdcall?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MAKEFILE | 29 +- include/fat.h | 106 ++-- install/MAKEFILE | 18 +- install/setup.asm | 36 +- lib/MAKEFILE | 26 + lib/video.asm | 713 ++++++++++-------------- noyau/8259a.asm | 149 +---- noyau/MAKEFILE | 79 +-- noyau/boot.asm | 348 ++++++------ noyau/mcb.asm | 1207 +++++++++++++++++++++++------------------ noyau/video.asm | 1317 ++++++++++++++++++++++----------------------- 11 files changed, 1944 insertions(+), 2084 deletions(-) create mode 100644 lib/MAKEFILE diff --git a/MAKEFILE b/MAKEFILE index 8977b8f..51bd6de 100644 --- a/MAKEFILE +++ b/MAKEFILE @@ -1,9 +1,5 @@ all: - cd commande - make - cd .. - - cd programs + cd lib make cd .. @@ -11,31 +7,16 @@ all: make cd .. - cd contribs - make - cd .. - cd install make cd .. copy: make all - copy commande\*.exe ..\binaires\data - copy programs\*.com ..\binaires\data - copy programs\*.rip ..\binaires\data - copy noyau\*.sys ..\binaires\data - copy noyau\*.bin ..\binaires\data - copy contribs\*.com ..\binaires\data - copy install\*.com ..\binaires - make clean + clean: - cd commande - make clean - cd .. - - cd programs + cd lib make clean cd .. @@ -43,10 +24,6 @@ clean: make clean cd .. - cd contribs - make clean - cd .. - cd install make clean cd .. diff --git a/include/fat.h b/include/fat.h index 4c89a7d..f7f2edf 100644 --- a/include/fat.h +++ b/include/fat.h @@ -1,58 +1,52 @@ -Free equ 0 -True equ 1 -False equ 0 +struc dpt +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 +ends dpt -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 +struc entries +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 +ends entries -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 +struc bootinfo +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 +mediadescriptor 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 +ends bootinfo diff --git a/install/MAKEFILE b/install/MAKEFILE index b37e0e8..bee0406 100644 --- a/install/MAKEFILE +++ b/install/MAKEFILE @@ -1,16 +1,20 @@ -lnk_boot = tlink /x -asm= tasm /t/m5/zi -lnk= tlink /x/t +asm= lzasm +lnk= elink all: setup.com -setup.com: setup.asm - $(asm) setup - $(lnk) setup +setup.com: setup.obj + $(lnk) setup.obj setup.com + +setup.obj: + $(asm) setup.asm clean: del *.obj del *.exe + del *.bak + del *.lib del *.com + del *.bin del *.sys - del *.err + del *.err \ No newline at end of file diff --git a/install/setup.asm b/install/setup.asm index e55dd8d..949cb11 100644 --- a/install/setup.asm +++ b/install/setup.asm @@ -1,20 +1,21 @@ -.model tiny -.486 -smart -.code +model tiny,stdcall +p486 +locals +jumps +codeseg +option procalign:byte org 0100h ent equ 32h -start: -jmp CopyCOS +jmp copycos -Message db 0Dh,0Ah,'COS 2000 V1.2Fr 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 ete correctement installe, veuillez redemarrer votre PC',0Dh,0AH,'$' +message db 0Dh,0Ah,'COS 2000 V1.3.1BetaFr 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 ete correctement installe, veuillez redemarrer votre PC',0Dh,0AH,'$' files db '*.*',0 boot db 'boot.bin',0 dat db 'data',0 @@ -53,7 +54,7 @@ copycos: mov dx,offset message3 int 21h allfile: - mov byte ptr [offset dta+43],'$' + mov [byte ptr offset dta+43],'$' mov ah,9 mov dx,offset dta+30 int 21h @@ -97,8 +98,8 @@ allfile: push cs pop es mov di,offset dta+30-3 - mov word ptr [di],":a" - mov byte ptr [di+2],"\" + mov [word ptr di],":a" + mov [byte ptr di+2],"\" xor cx,cx mov dx,di int 21h @@ -118,7 +119,7 @@ allfile: jc error mov ah,4fh int 21h - jnc allfile + jnc allfile mov ah,09 mov dx,offset message2 int 21h @@ -146,7 +147,7 @@ allfile: xor bx,bx int 13h mov ah,09 - mov dx,offset Ok + mov dx,offset ok int 21h xor ax,ax int 16h @@ -160,5 +161,4 @@ error: xor ax,ax int 16h ret - -end start + diff --git a/lib/MAKEFILE b/lib/MAKEFILE new file mode 100644 index 0000000..a66c89b --- /dev/null +++ b/lib/MAKEFILE @@ -0,0 +1,26 @@ +asm= lzasm +lnk= elink + +all: detect.lib video.lib + +detect.lib: detect.obj + $(lnk) detect.obj detect.lib + +video.lib: video.obj + $(lnk) video.obj video.lib + +detect.obj: + $(asm) detect.asm + +video.obj: + $(asm) video.asm + +clean: + del *.obj + del *.exe + del *.bak + del *.lib + del *.com + del *.bin + del *.sys + del *.err \ No newline at end of file diff --git a/lib/video.asm b/lib/video.asm index 2af1806..c90b916 100644 --- a/lib/video.asm +++ b/lib/video.asm @@ -1,14 +1,15 @@ -.model tiny -.486 -smart +model tiny,stdcall +p486 locals -.code +jumps +codeseg +option procalign:byte + +include "..\include\mem.h" + org 0h -include ..\include\mem.h - -start: -header exe <,1,0,,,,offset exports,> +header exe <"CE",1,0,0,offset exports,offset imports,,> exports: db "print",0 @@ -25,20 +26,16 @@ exports: dw showsize db "showspace",0 dw showspace - db "showline",0 - dw showline - db "showchar",0 - dw showchar db "showint",0 - dw ShowInt - db "Showsigned",0 - dw Showsigned + dw showint + db "showsigned",0 + dw showsigned db "showhex",0 - dw ShowHex + dw showhex db "showbin",0 - dw Showbin + dw showbin db "showbcd",0 - dw ShowBCD + dw showbcd db "showstring",0 dw showstring db "showstring0",0 @@ -48,19 +45,40 @@ exports: db "showintl",0 dw showintl dw 0 + +imports: + db "VIDEO::addline",0 +addline dd 0 + db "VIDEO::setcolor",0 +setcolor dd 0 + db "VIDEO::getxy",0 +getxy dd 0 + db "VIDEO::setxy",0 +setxy dd 0 + db "VIDEO::setvideomode",0 +setvideomode dd 0 + db "VIDEO::setfont",0 +setfont dd 0 + db "VIDEO::clearscreen",0 +clearscreen dd 0 + db "VIDEO::enablescroll",0 +enablescroll dd 0 + db "VIDEO::disablescroll",0 +disablescroll dd 0 + db "VIDEO::showchar",0 +showchar dd 0 + dw 0 ;================PRINT============== ;Affiche la chaine %0 en utilisant les parametres de formatage %x....%x ;-> %0 %x ;<- ;=================================== -print PROC FAR - ARG pointer:word=taille - push bp - mov bp,sp +PROC print FAR + ARG @@pointer:word push ax bx cx si di xor di,di - mov si,[pointer] + mov si,[@@pointer] @@strinaize0: mov cl,[si] cmp cl,0 @@ -70,16 +88,17 @@ print PROC FAR cmp cl,'\' je @@special2 @@showit: - call charout + xor ch,ch + call [cs:showchar],cx,0FFFFh inc si jmp @@strinaize0 @@special: - cmp byte ptr [si+1],'%' + cmp [byte ptr si+1],'%' jne @@notshowit inc si jmp @@showit @@notshowit: - mov cl,byte ptr [si+1] + mov cl,[byte ptr si+1] cmp cl,'c' je @@showchar cmp cl,'u' @@ -114,20 +133,18 @@ print PROC FAR jmp @@no0 @@showchar: - cmp byte ptr [si+2],'M' + cmp [byte ptr si+2],'M' je @@showmultchar - push word ptr [offset pointer+di+2] - call showchar + call [cs:showchar],[word ptr @@pointer+di+2],0FFFFh add si,2 add di,2 jmp @@strinaize0 @@showmultchar: - mov cx,[offset pointer+di+2+2] + mov cx,[offset @@pointer+di+2+2] cmp cx,0 je @@nextfunc @@showcharx: - push word ptr [offset pointer+di+2] - call showchar + call [cs:showchar],[word ptr @@pointer+di+2],0FFFFh dec cx jnz @@showcharx @@nextfunc: @@ -136,27 +153,20 @@ print PROC FAR jmp @@strinaize0 @@showint: - push dword ptr [offset pointer+di+2] - call showint + call showint,[dword ptr @@pointer+di+2] add si,2 add di,4 jmp @@strinaize0 @@showfixint: - push dword ptr [offset pointer+di+2] - add di,4 - push word ptr [offset pointer+di+2] - add di,2 - call showintl + call showintl,[word ptr @@pointer+di+6],[dword ptr @@pointer+di+2] + add di,6 add si,2 jmp @@strinaize0 @@showintr: - push dword ptr [offset pointer+di+2] - add di,4 - push word ptr [offset pointer+di+2] - add di,2 - call showintr + call showintr,[word ptr @@pointer+di+6],[dword ptr @@pointer+di+2] + add di,6 add si,2 jmp @@strinaize0 @@ -176,36 +186,32 @@ print PROC FAR jmp @@strinaize0 @@showstring: - cmp byte ptr [si+2],'P' - je @@showstringpointer - push word ptr [offset pointer+di+2] - call showstring + cmp [byte ptr si+2],'P' + je @@showstring@@pointer + call showstring,[word ptr @@pointer+di+2] add si,2 add di,2 jmp @@strinaize0 -@@showstringpointer: +@@showstring@@pointer: push ds - mov ds,[offset pointer+di+2+2] - push word ptr [offset pointer+di+2] - call showstring + mov ds,[offset @@pointer+di+2+2] + call showstring,[word ptr @@pointer+di+2] add si,3 add di,4 pop ds jmp @@strinaize0 @@showstring0: - cmp byte ptr [si+2],'P' - je @@showstring0pointer - push word ptr [offset pointer+di+2] - call showstring0 + cmp [byte ptr si+2],'P' + je @@showstring0@@pointer + call showstring0,[word ptr offset @@pointer+di+2] add si,2 add di,2 jmp @@strinaize0 -@@showstring0pointer: +@@showstring0@@pointer: push ds - mov ds,[offset pointer+di+2+2] - push word ptr [offset pointer+di+2] - call showstring0 + mov ds,[offset @@pointer+di+2+2] + call showstring0,[word ptr offset @@pointer+di+2] add si,3 add di,4 pop ds @@ -217,49 +223,44 @@ print PROC FAR jmp @@strinaize0 @@showsize: - push dword ptr [offset pointer+di+2] - call showsize + call showsize,[dword ptr offset @@pointer+di+2] add si,2 add di,4 jmp @@strinaize0 @@showattr: - push word ptr [offset pointer+di+2] - call showattr + call showattr,[word ptr offset @@pointer+di+2] add si,2 add di,2 jmp @@strinaize0 @@showname: - push word ptr [offset pointer+di+2] - call showname + call showname,[word ptr offset @@pointer+di+2] add si,2 add di,2 jmp @@strinaize0 @@showtime: - push word ptr [offset pointer+di+2] - call showtime + call showtime,[word ptr offset @@pointer+di+2] add si,2 add di,2 jmp @@strinaize0 @@showdate: - push word ptr [offset pointer+di+2] - call showdate + call showdate,[word ptr offset @@pointer+di+2] add si,2 add di,2 jmp @@strinaize0 @@Chosesize: pop cx - push dword ptr [offset pointer+di+2] + push [dword ptr offset @@pointer+di+2] add di,4 - cmp byte ptr [si+2],'B' + cmp [byte ptr si+2],'B' je @@byte - cmp byte ptr [si+2],'W' + cmp [byte ptr si+2],'W' je @@word - cmp byte ptr [si+2],'D' + cmp [byte ptr si+2],'D' je @@dword dec si @@ -282,12 +283,12 @@ print PROC FAR retn @@special2: - cmp byte ptr [si+1],'\' + cmp [byte ptr si+1],'\' jne @@notshowit2 inc si jmp @@showit @@notshowit2: - mov cl,byte ptr [si+1] + mov cl,[byte ptr si+1] cmp cl,'l' je @@showline cmp cl,'g' @@ -314,29 +315,29 @@ print PROC FAR jmp @@no0 @@color: - mov cl,[si+2] - sub cl,'0' - shl cl,4 - add cl,[si+3] - sub cl,'0' - mov ah,21 - int 47h + mov al,[si+2] + sub al,'0' + shl al,4 + add al,[si+3] + sub al,'0' + xor ah,ah + call [cs:setcolor],ax add si,4 jmp @@strinaize0 @@gotox: - mov ah,24 - int 47h - mov ah,[si+2] - sub ah,'0' - mov bh,ah - shl bh,3 - add bh,ah - add bh,ah - add bh,[si+3] + mov bh,[si+2] sub bh,'0' - mov ah,25 - int 47h + mov bl,bh + shl bl,3 + add bl,bh + add bl,bh + add bl,[si+3] + sub bl,'0' + xor bh,bh + call [cs:getxy] + xor ah,ah + call [cs:setxy],bx,ax add si,4 jmp @@strinaize0 @@ -349,34 +350,32 @@ print PROC FAR add al,ah add al,[si+3] sub al,'0' - mov ah,0 - int 47h + xor ah,ah + call [cs:setvideomode] add si,4 jmp @@strinaize0 @@setfont: mov ah,[si+2] sub ah,'0' - mov cl,ah - shl cl,3 - add cl,ah - add cl,ah - add cl,[si+3] - sub cl,'0' - mov ah,3 - int 47h + mov al,ah + shl al,3 + add al,ah + add al,ah + add al,[si+3] + sub al,'0' + xor ah,ah + call [cs:setfont],ax add si,4 jmp @@strinaize0 @@showline: - mov ah,6 - int 47h + call [cs:addline] add si,2 jmp @@strinaize0 @@clearscreen: - mov ah,2 - int 47h + call [cs:clearscreen] add si,2 jmp @@strinaize0 @@ -393,35 +392,36 @@ print PROC FAR jmp @@strinaize0 @@enablescroll: - mov ah,42 - int 47h + call [cs:enablescroll] add si,2 jmp @@strinaize0 @@disablescroll: - mov ah,43 - int 47h + call [cs:disablescroll] add si,2 jmp @@strinaize0 @@goto: mov ah,[si+2] sub ah,'0' - mov bh,ah - shl bh,3 - add bh,ah - add bh,ah - add bh,[si+3] - sub bh,'0' + mov al,ah + shl al,3 + add al,ah + add al,ah + add al,[si+3] + sub al,'0' + xor ah,ah ; - mov ah,[si+5] - sub ah,'0' - mov bl,ah + mov bh,[si+5] + sub bh,'0' + mov bl,bh shl bl,3 - add bl,ah - add bl,ah + add bl,bh + add bl,bh add bl,[si+6] sub bl,'0' + xor bh,bh + call [cs:setxy],ax,bx mov ah,25 int 47h add si,7 @@ -429,312 +429,215 @@ print PROC FAR @@no0: add di,bp - add di,2 - mov ax,ss:[bp] ;BP - mov bx,ss:[bp+2] ;IP - mov cx,ss:[bp+4] ;CS - mov ss:[di],ax - mov ss:[di+2],bx - mov ss:[di+4],cx + mov ax,[ss:bp] ;BP + mov bx,[ss:bp+2] ;IP + mov cx,[ss:bp+4] ;CS + mov [ss:di],ax + mov [ss:di+2],bx + mov [ss:di+4],cx mov bp,di pop di si cx bx ax mov sp,bp - pop bp - retf + ret + +ENDP print -print ENDP -;================TESTS============== -;met dans DX le contenu de %0 -;-> %0 -;<- -;=================================== -tests PROC FAR - ARG date:word=taille - push bp - mov bp,sp - push ax cx edx - mov dx,[date] - pop edx cx ax - pop bp - retf taille -tests ENDP ;================SHOWDATE============== ;Affiche la date contenu en %0 ;-> %0 ;<- ;====================================== -ShowDate PROC FAR - ARG date:word=taille - push bp - mov bp,sp - push edx +PROC showdate FAR + ARG @dates:word + USES edx xor edx,edx - mov dx,[date] + mov dx,[@dates] and dx,11111b - push edx - push 2 - call showintl - push '/' - call showchar - mov dx,[date] + call showintl,2,edx + call [cs:showchar],'/',0FFFFh + mov dx,[@dates] shr dx,5 and dx,111b - push edx - push 2 - call showintl - push '/' - call showchar - mov dx,[date] + call showintl,2,edx + call [cs:showchar],'/',0FFFFh + mov dx,[@dates] shr dx,8 and dx,11111111b add dx,1956 - push edx - push 4 - call showintl - pop edx - pop bp - retf taille -ShowDate ENDP + call showintl,2,edx + ret +ENDP showdate ;================SHOWTIME============== ;Affiche l'heure contenu en %0 ;-> %0 ;<- ;====================================== -ShowTime PROC FAR - ARG time:word=taille - push bp - mov bp,sp - push edx +PROC showtime FAR + ARG @times:word + USES edx xor edx,edx - mov dx,[time] + mov dx,[@times] shr dx,11 and dx,11111b - push edx - push 2 - call showintl - push ':' - call showchar - mov dx,[time] + call showintl,2,edx + call [cs:showchar],':',0FFFFh + mov dx,[@times] shr dx,5 and dx,111111b - push edx - push 2 - call showintl - push ':' - call showchar - mov dx,[time] + call showintl,2,edx + call [cs:showchar],':',0FFFFh + mov dx,[@times] and dx,11111b shl dx,1 - push edx - push 2 - call showintl - pop edx - pop bp - retf taille -ShowTime ENDP + call showintl,2,edx + ret +ENDP showtime ;================SHOWNAME============== ;Affiche le nom pointé par ds:%0 ;-> ds:%0 ;<- ;====================================== -ShowName PROC FAR - ARG thename:word=taille - push bp - mov bp,sp - push cx si - mov si,[thename] +PROC showname FAR + ARG @thename:word + USES cx,si + mov si,[@thename] xor cx,cx @@showthename: - push word ptr ds:[si] - call showchar + call [cs:showchar],[word ptr ds:si],0FFFFh inc si inc cx cmp cx,8 jne @@suiteaname - push ' ' - call showchar + call [cs:showchar],' ',0FFFFh @@suiteaname: cmp cx,8+3 jb @@showthename - pop si cx - pop bp - retf taille -ShowName ENDP + ret +ENDP showname ;================SHOWATTR============== ;Affiche les attributs spécifié par %0 ;-> %0 ;<- ;====================================== -ShowAttr PROC FAR - ARG attr:word=taille - push bp - mov bp,sp - test [attr],00000001b +PROC showattr FAR + ARG @attr:word + push 0FFFFh + test [@attr],00000001b je @@noreadonly push 'L' jmp @@readonly @@noreadonly: push '-' @@readonly: - call showchar - test [attr],00000010b + call [cs:showchar] + push 0FFFFh + test [@attr],00000010b je @@nohidden push 'C' jmp @@hidden @@nohidden: push '-' @@hidden: - call showchar - test [attr],00000100b + call [cs:showchar] + push 0FFFFh + test [@attr],00000100b je @@nosystem push 'S' jmp @@system @@nosystem: push '-' @@system: - call showchar - test [attr],00100000b + call [cs:showchar] + push 0FFFFh + test [@attr],00100000b je @@noarchive push 'A' jmp @@archive @@noarchive: push '-' @@archive: - call showchar - test [attr],00010000b + call [cs:showchar] + push 0FFFFh + test [@attr],00010000b je @@nodirectory push 'R' jmp @@directory @@nodirectory: push '-' @@directory: - call showchar - pop bp - retf taille -ShowAttr ENDP + call [cs:showchar] + ret +ENDP showattr ;================SHOWSIZE============== ;Affiche le nom pointé par %0 ;-> %0 ;<- ;====================================== -ShowSize PROC FAR - ARG thesize:dword=taille - push bp - mov bp,sp - push edx ds +PROC showsize FAR + ARG @thesize:dword + USES edx,ds push cs pop ds - mov edx,[thesize] + mov edx,[@thesize] cmp edx,1073741824 ja @@giga cmp edx,1048576*9 ja @@mega cmp edx,1024*9 ja @@kilo - push edx - push 4 - call showintR - push offset unit - call showstring0 + call showintr,4,edx + call showstring0,offset unit jmp @@finsize @@kilo: shr edx,10 - push edx - push 4 - call showintR - push offset unitkilo - call showstring0 + call showintr,4,edx + call showstring0,offset unitkilo jmp @@finsize @@mega: shr edx,20 - push edx - push 4 - call showintR - push offset unitmega - call showstring0 + call showintr,4,edx + call showstring0,offset unitmega jmp @@finsize @@giga: shr edx,30 - push edx - push 4 - call showintR - push offset unitgiga - call showstring0 + call showintr,4,edx + call showstring0,offset unitgiga @@finsize: - pop ds edx - pop bp - retf taille + ret unit db ' o ',0 unitkilo db ' ko',0 unitmega db ' mo',0 unitgiga db ' go',0 -ShowSize ENDP +ENDP showsize ;==========SHOWSPACE=========== ;met un espace aprés le curseur ;-> ;<- ;============================== -showspace PROC FAR - push bp - mov bp,sp - push cx - mov cl,' ' - call charout +PROC showspace FAR + call [cs:showchar],' ',0FFFFh clc - pop cx - pop bp - retf -showspace ENDP + ret +ENDP showspace -;==========SHOWLINE=============== -;remet le curseur text a la ligne avec un retfour chariot -;-> -;<- -;================================= -showline PROC FAR - push ax - mov ah,06 - int 47h - pop ax - retf - showline ENDP - -;==========SHOWCHAR=========== -;met un caractère de code ASCII %0 aprés le curseur -;-> %0 -;<- -;============================= -showchar PROC FAR - ARG char:word=taille - push bp - mov bp,sp - push cx - mov cx,[char] - call charout - pop cx - pop bp - retf taille -showchar ENDP ;==========SHOWINT=========== ;Affiche un entier %0 aprés le curseur ;-> %0 ;<- ;============================ -ShowInt PROC FAR - ARG integer:dword=taille - push bp - mov bp,sp - push eax bx cx edx esi +PROC showint FAR + ARG @integer:dword + USES eax,bx,cx,edx,esi xor cx,cx - mov eax,[integer] + mov eax,[@integer] mov esi,10 mov bx,offset showbuffer+27 @@decint: @@ -742,37 +645,33 @@ ShowInt PROC FAR div esi add dl,'0' inc cx - mov cs:[bx],dl + mov [cs:bx],dl dec bx cmp ax,0 jne @@decint mov ax,cx @@showinteger: inc bx - mov cl,cs:[bx] - call charout + mov cl,[cs:bx] + call [cs:showchar],cx,0FFFFh dec ax jnz @@showinteger - pop esi edx cx bx eax - pop bp - retf taille + ret showbuffer db 50 dup (0FFh) -ShowInt ENDP +ENDP showint ;==========SHOWINTL=========== ;Affiche un entier %0 aprés le curseur de taille %1 caractère centré a gauche ;-> %0 un entier % taille en caractères ;<- ;=============================== -ShowIntL PROC FAR - ARG sizeofint:word,integer:dword=taille - push bp - mov bp,sp - push eax bx cx edx esi di - mov di,[sizeofint] +PROC showintl FAR + ARG @sizeofint:word,@integer:dword + USES eax,bx,cx,edx,esi,di + mov di,[@sizeofint] xor cx,cx - mov eax,[integer] + mov eax,[@integer] mov esi,10 mov bx,offset showbuffer+27 @@decint: @@ -780,7 +679,7 @@ ShowIntL PROC FAR div esi add dl,'0' inc cx - mov cs:[bx],dl + mov [cs:bx],dl dec bx cmp cx,di jae @@nomuch @@ -790,7 +689,7 @@ ShowIntL PROC FAR xchg cx,di sub cx,di @@rego: - mov byte ptr cs:[bx],'0' + mov [byte ptr cs:bx],'0' dec bx dec cx jnz @@rego @@ -800,28 +699,24 @@ ShowIntL PROC FAR @@finishim: @@showinteger: inc bx - mov cl,cs:[bx] - call charout + mov cl,[cs:bx] + call [cs:showchar],cx,0FFFFh dec ax jnz @@showinteger - pop di esi edx cx bx eax - pop bp - retf taille -showintl ENDP + ret +ENDP showintl ;==========SHOWINTR=========== ;Affiche un entier %0 aprés le curseur de taille %1 caractère centré a droite ;-> %0 un entier % taille en caractères ;<- ;=============================== -ShowIntR PROC FAR - ARG sizeofint:word,integer:dword=taille - push bp - mov bp,sp - push eax bx cx edx esi di - mov di,[sizeofint] +PROC showintr FAR + ARG @sizeofint:word,@integer:dword + USES eax,bx,cx,edx,esi,di + mov di,[@sizeofint] xor cx,cx - mov eax,[integer] + mov eax,[@integer] mov esi,10 mov bx,offset showbuffer+27 @@decint: @@ -829,7 +724,7 @@ ShowIntR PROC FAR div esi add dl,'0' inc cx - mov cs:[bx],dl + mov [cs:bx],dl dec bx cmp cx,di jae @@nomuch @@ -839,7 +734,7 @@ ShowIntR PROC FAR xchg cx,di sub cx,di @@rego: - mov byte ptr cs:[bx],' ' + mov [byte ptr cs:bx],' ' dec bx dec cx jnz @@rego @@ -849,27 +744,23 @@ ShowIntR PROC FAR @@finishim: @@showinteger: inc bx - mov cl,cs:[bx] - call charout + mov cl,[cs:bx] + call [cs:showchar],cx,0FFFFh dec ax jnz @@showinteger - pop di esi edx cx bx eax - pop bp - retf taille -ShowIntR ENDP + ret +ENDP showintr ;==========SHOWSIGNED=========== ;Affiche un entier %0 de taille %1 aprés le curseur ;-> %0 un entier, %1 la taille ;<- ;=============================== -Showsigned PROC FAR - ARG sizeofint:word,integer:dword=taille - push bp - mov bp,sp - push ebx cx edx - mov ebx,[integer] - mov cx,[sizeofint] +PROC showsigned FAR + ARG @sizeofint:word,@integer:dword=taille + USES ebx,cx,edx + mov ebx,[@integer] + mov cx,[@sizeofint] xor edx,edx cmp cx,1 ja @@signed16 @@ -892,89 +783,75 @@ Showsigned PROC FAR jbe @@notsigned neg edx @@showminus: - push '-' - call showchar + call [cs:showchar],'-',0FFFFh @@notsigned: - push edx - call showint - pop edx cx ebx - pop bp - retf taille -Showsigned ENDP + call showint,edx,0FFFFh + ret +ENDP showsigned ;==========SHOWHEX=========== ;Affiche un nombre hexadécimal %0 de taille %1 aprés le curseur ;-> %0 un entier, %1 la taille ;<- ;============================ -ShowHex PROC FAR - ARG sizeofint:word,integer:dword=taille - push bp - mov bp,sp - push ax bx cx edx - mov edx,[integer] - mov cx,[sizeofint] +PROC showhex FAR + ARG @sizeofint:word,@integer:dword=taille + USES ax,bx,cx,edx + mov edx,[@integer] + mov cx,[@sizeofint] + mov ax,cx shr ax,2 sub cx,32 neg cx shl edx,cl - mov ax,[sizeofint] - shr ax,2 @@Hexaize: rol edx,4 mov bx,dx and bx,0fh - mov cl,cs:[bx+offset Tab] - call charout + mov cl,[cs:bx+offset Tab] + call [cs:showchar],cx,0FFFFh dec al jnz @@Hexaize - pop edx cx bx ax - pop bp - retf taille + ret Tab db '0123456789ABCDEF' -ShowHex ENDP +ENDP showhex ;==========SHOWBIN=========== ;Affiche un nombre binaire %0 de taille %1 aprés le curseur ;-> %0 un entier, %1 la taille ;<- ;============================ -Showbin PROC FAR - ARG sizeofint:word,integer:dword=taille - push bp - mov bp,sp - push ax cx edx - mov edx,[integer] - mov cx,[sizeofint] +PROC showbin FAR + ARG @sizeofint:word,@integer:dword=taille + USES ax,cx,edx + mov edx,[@integer] + mov cx,[@sizeofint] sub cx,32 neg cx shl edx,cl - mov ax,[sizeofint] + mov ax,[@sizeofint] @@binaize: rol edx,1 mov cl,'0' adc cl,0 - call charout + call [cs:showchar],cx,0FFFFh dec al jnz @@binaize - pop edx cx ax - pop bp - retf taille -Showbin ENDP + ret +ENDP showbin ;==========SHOWBCD=========== ;Affiche un nombre en BCD %0 de taille %1 aprés le curseur ;-> %0 un entier, %1 la taille ;<- ;============================ -ShowBCD PROC FAR - ARG sizeofint:word,integer:dword=taille - push bp - mov bp,sp - push ax cx edx - mov edx,[integer] - mov ax,[sizeofint] +PROC showbcd FAR + ARG @sizeofint:word,@integer:dword + USES ax,cx,edx + mov edx,[@integer] + mov ax,[@sizeofint] + mov cx,ax shr ax,2 sub cx,32 neg cx @@ -984,69 +861,47 @@ ShowBCD PROC FAR mov cl,dl and cl,0fh add cl,'0' - call charout + call [cs:showchar],cx,0FFFFh dec al jnz @@BCDaize - pop edx cx ax - pop bp - retf taille -ShowBCD ENDP + ret +ENDP showbcd ;==========SHOWSTRING=========== ;Affiche une chaine de caractère pointée par ds:%1 aprés le curseur ;-> ds:%1 pointeur chaine type pascal ;<- ;=============================== -showstring PROC FAR - ARG pointer:word=taille - push bp - mov bp,sp - push bx cx si - mov si,[pointer] +PROC showstring FAR + ARG @pointer:word + USES bx,si + mov si,[@pointer] mov bl,[si] @@strinaize: inc si - mov cl,[si] - call charout + call [cs:showchar],[word ptr si],0FFFFh dec bl jnz @@strinaize - pop si cx bx - pop bp - retf taille -showstring ENDP + ret +ENDP showstring ;==========SHOWSTRING0=========== ;Affiche une chaine de caractère pointée par ds:%1 aprés le curseur ;-> ds:%1 pointeur chaine type zéro terminal ;<- ;================================ -showstring0 PROC FAR - ARG pointer:word=taille - push bp - mov bp,sp - push cx si - mov si,[pointer] +PROC showstring0 FAR + ARG @pointer:word + USES cx,si + mov si,[@pointer] @@strinaize0: mov cl,[si] cmp cl,0 je @@no0 - call charout + call [cs:showchar],cx,0FFFFh inc si jmp @@strinaize0 @@no0: - pop si cx - pop bp - retf taille -showstring0 ENDP - -;Envoie le caractère CL vers l'ecran -charout PROC NEAR - push ax dx - mov ah,7 - mov dl,cl - int 47h - pop dx ax ret -charout ENDP +ENDP showstring0 -end start diff --git a/noyau/8259a.asm b/noyau/8259a.asm index 46a3601..561719e 100644 --- a/noyau/8259a.asm +++ b/noyau/8259a.asm @@ -1,48 +1,11 @@ -.model tiny,StdCall -.486 -.code -Locals -jumps - -org 0h - -include ..\include\mem.h -include ..\include\bmp.h - -start: -header exe <,1,0,,,,offset exports,> - -exports: - db "enableirq",0 - dw enableirq - db "disableirq",0 - dw enableirq - db "readmaskirq",0 - dw readmaskirq - db "readirr",0 - dw readirr - db "readisr",0 - dw readisr - db "installhandler",0 - dw installhandler - db "replacehandler",0 - dw replacehandler - db "getint",0 - dw getint - db "setint",0 - dw setint - db "seteoi",0 - dw seteoi - dw 0 - ;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 + 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‚ + 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 @@ -50,24 +13,23 @@ exports: 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 + 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 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 - +IRR = 0Ah ; Pas d'op‚ration, pas de Poll, lire IRR ;Autorise une interruption ‚lectronique ;Entr‚e : %1 - Num‚ro de l'interruption (0-15) … autoriser 0-7 = MASTERPIC , 8-15 = SLAVEPIC -EnableIRQ PROC FAR +PROC enableirq FAR ARG @irq:word USES ax,cx,dx mov ax,[@irq] @@ -86,11 +48,11 @@ EnableIRQ PROC FAR and al,ah out dx,al ret -EnableIRQ endp +endp enableirq ;Desactive une interruption ‚lectronique ;Entr‚e : %0 - Num‚ro de l'interruption (0-15) … desactiver 0-7 = MASTERPIC , 8-15 = SLAVEPIC -DisableIRQ PROC FAR +PROC disableirq FAR ARG @irq:word USES ax,cx,dx mov ax,[@irq] @@ -109,11 +71,11 @@ DisableIRQ PROC FAR or al,ah out dx,al ret -DisableIRQ endp +endp disableirq ;Signale "End Of Interrupt" de l'interruption %0 -SetEOI PROC FAR +PROC seteoi FAR ARG @irq:word USES ax,dx mov ax,[@irq] @@ -125,11 +87,11 @@ SetEOI PROC FAR mov al,EOI out MASTERPIC,al ret -DisableIRQ endp +endp seteoi ;Lit les masques d'un contr“leur IRQ dans ax, 0 master ou slave 1 ds %1 -ReadmaskIrq PROC FAR +PROC readmaskirq FAR ARG @controleur:word USES bx,dx mov bx,[@controleur] @@ -142,10 +104,10 @@ ReadmaskIrq PROC FAR in al,dx pop dx ret -ReadmaskIrq endp +endp readmaskirq ;Lit le registre d'‚tat d'un contr“leur IRQ dans ax, 0 master ou slave 1 ds %1 -ReadISR PROC FAR +PROC readisr FAR ARG @controleur:word USES bx,dx mov bx,[@controleur] @@ -154,16 +116,16 @@ ReadISR PROC FAR jne @@master mov dx,SLAVEPIC @@master: - mov al,isr + mov al,ISR out dx,al xor ah,ah in al,dx ret -ReadISR endp +endp readisr ;Lit le registre d'‚tat d'un contr“leur IRQ dans al, 0 master ou slave 1 ds bh -ReadIRR PROC FAR +PROC readirr FAR ARG @controleur:word USES bx,dx mov bx,[@controleur] @@ -172,74 +134,9 @@ ReadIRR PROC FAR jne @@master mov dx,SLAVEPIC @@master: - mov al,irr + mov al,IRR out dx,al xor ah,ah in al,dx ret -ReadIRR endp - -;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 - +endp readirr \ No newline at end of file diff --git a/noyau/MAKEFILE b/noyau/MAKEFILE index dd47167..b328844 100644 --- a/noyau/MAKEFILE +++ b/noyau/MAKEFILE @@ -1,73 +1,36 @@ -lnk_boot = tlink /x -asm= tasm /t/m5/zi -lnk= tlink /x/t +asm= lzasm +lnk= elink -all: boot.bin clavier.sys 8259a.sys disque.sys heure.sys horloge.sys manette.sys port.sys souris.sys systeme.sys video.sys mcb.sys +all: systeme.sys boot.bin -boot.bin: boot.asm - $(asm) boot - $(lnk_boot) boot - exe2boot boot.exe boot.bin +systeme.sys: video.obj systeme.obj + $(lnk) systeme.obj systeme.sys -clavier.sys: clavier.asm - $(asm) clavier - $(lnk) clavier - ren clavier.com clavier.sys +systeme.obj: ../lib/detect.lib ../lib/video.lib video.sys + $(asm) systeme.asm -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 +video.sys: + $(lnk) video.obj video.sys -heure.sys: heure.asm - $(asm) heure - $(lnk) heure - ren heure.com heure.sys +boot.bin: boot.obj + $(lnk) boot.obj boot.bin /bs -horloge.sys: horloge.asm - $(asm) horloge - $(lnk) horloge - ren horloge.com horloge.sys +detect.obj: + $(asm) detect.asm -manette.sys: manette.asm - $(asm) manette - $(lnk) manette - ren manette.com manette.sys +video.obj: + $(asm) video.asm -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 - -mcb.sys: mcb.asm - $(asm) mcb - $(lnk) mcb - ren mcb.com mcb.sys +boot.obj: + $(asm) boot.asm clean: del *.obj del *.exe + del *.bak + del *.lib del *.com - del *.sys - del *.err del *.bin + del *.sys + del *.err \ No newline at end of file diff --git a/noyau/boot.asm b/noyau/boot.asm index 42655b9..4d1e41c 100644 --- a/noyau/boot.asm +++ b/noyau/boot.asm @@ -1,222 +1,216 @@ -boots segment -.386 -org 7C00h -assume cs:boots,ds:boots +model tiny,stdcall +p486 +locals +jumps +codeseg +option procalign:byte + +include "..\include\mem.h" +include "..\include\fat.h" +include "..\include\divers.h" + +org 7C00h -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: +bootsec bootinfo <"COS2000A",512,1,1,2,224,2880,0F0h,9,18,2,0,0,0,0,0,29h,01020304h,"COS2000 ","FAT12 "> + +errorloading db " [Erreur]",0dh,0ah,0 +okloading db "Recherche noyau ",0Dh,0ah," -" +sys db "SYSTEME SYS",0 +syst db " [ Ok ]",0dh,0ah,"Chargement ",0 +dot db ".",0 + -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 + mov si,offset errorloading + call showstr + mov ah,0 + int 16h + int 19h +boot: + mov [bootsec.bootdrive],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 + push cs + push cs + pop es + pop ds + xor ax,ax + mov dl,[bootsec.bootdrive] + int 13h + jc errorboot + mov si,offset okloading + call showstr + mov cx,[bootsec.reservedsectors] + add cx,[bootsec.hiddensectorsh] + adc cx,[bootsec.hiddensectorsl] + push cx + mov bx,[bootsec.sectorsperfat] + 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 + call readsector + jc errorboot + inc cx + add di,[bootsec.sectorsize] + dec bx + jnz readfat + pop cx + xor ax,ax + mov al,[bootsec.fatsperdrive] + mov bx,[bootsec.sectorsperfat] + mul bx + add cx,ax + mov ax,32 + mul [bootsec.directorysize] + div [bootsec.sectorsize] + add ax,cx + sub ax,2 + mov [word ptr bootsec.reservedfornt],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 + 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 + add di,32 + add bx,32 + inc dx + cmp dx,[bootsec.directorysize] + ja errorboot + cmp bx,[bootsec.sectorsize] + 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,000h - push di - mov si,offset dot - xor ax,ax + mov si,offset syst + call showstr + mov cx,[di+26] + mov ax,0900h + mov es,ax + push es + mov di,0000h + push 0010h + 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 + cmp cx,0FF0h + jae finishload + push cx + add cx,[word ptr bootsec.reservedfornt] + call readsector + pop cx + jc errorboot inc ax - call showstr - add di,sizec - call getfat - jnc fatagain + call showstr + add di,[bootsec.sectorsize] + call getfat + jnc fatagain finishload: - db 0CBh + retf ;=============READSECTOR (Fonction 01H)=============== ;Lit le secteur CX et le met en es:di ;-> AH=1 ;<- Flag Carry si erreur ;===================================================== -ReadSector: +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 + xor dx,dx + div [bootsec.sectorspertrack] + inc dl + mov bl,dl + xor dx,dx + div [bootsec.headsperdrive] + 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 + mov si, 4 + mov al, 1 +tryagain: + mov ah, 2 + mov dl,[bootsec.bootdrive] int 13h - jnc Done - dec SI - jnz TryAgain -Done: + jnc done + dec si + jnz tryagain +done: pop si dx cx bx ax -ret + ret + getfat: - push ax bx dx di - mov di,offset bufferfat + 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 + 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 + and dx,0FFFh + mov cx,dx + jmp endfat evenfat: - mov dx,[di+1] - and dx,0FFF0h - shr dx,4 - mov cx,dx + mov dx,[di+1] + and dx,0FFF0h + shr dx,4 + mov cx,dx endfat: - pop di dx bx ax + pop di dx bx ax ret + showstr: - push ax bx si + 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 + or al,al + jz fin + mov ah,0Eh + mov bx,07h + int 10h + jmp again +fin: + pop si bx ax ret + db 055h,0AAh -Buffer equ $ -BufferFat equ $+2048 +endof: -boots ends -end start +buffer equ offset endof+2048 +bufferfat equ offset endof+4096 diff --git a/noyau/mcb.asm b/noyau/mcb.asm index 6878f07..f27dc9e 100644 --- a/noyau/mcb.asm +++ b/noyau/mcb.asm @@ -1,562 +1,731 @@ -.model tiny -.486 -smart -.code -org 0h + db "biosprint",0 + dw biosprint + db "mbinit",0 + dw mbinit + db "mbcreate",0 + dw mbcreate + db "mbfree",0 + dw mbfree + db "mbclean",0 + dw mbclean + db "mbresident",0 + dw mbresident + db "mbnonresident",0 + dw mbnonresident + db "mbchown",0 + dw mbchown + db "mballoc",0 + dw mballoc + db "mbfind",0 + dw mbfind + db "mbfindsb",0 + dw mbfindsb + db "mbget",0 + dw mbget + db "mbloadfuncs",0 + dw mbloadfuncs + db "mbsearchfunc",0 + dw mbsearchfunc + db "bioswaitkey",0 + dw bioswaitkey + db "mbloadsection",0 + dw mbloadsection + db "enableirq",0 + dw enableirq + db "disableirq",0 + dw enableirq + db "readmaskirq",0 + dw readmaskirq + db "readirr",0 + dw readirr + db "readisr",0 + dw readisr + db "seteoi",0 + dw seteoi + dd 0 -include ..\include\mem.h -include ..\include\divers.h +include "8259a.asm" -start: -maxfunc equ 13 - - jmp tsr ;Saute à la routine résidente -nameed db 'MB' ;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 MBinit ;Table qui contient les adresses de toutes les fonctions de VIDEO (WORD) - dw MBFree - dw MBCreate - dw MBresident - dw MBGet - dw MBFind - dw MBChown - dw MBAlloc - dw MBclean - dw MBfindsb - dw MBnonresident - dw MBSearchfunc - dw MBLoadfuncs - ;dw MBdefrag - ;dw MBcopy - ;dw MBchname - -FirstMB dw 0 - -;Resouds les dépendances du bloc de mémoire GS -MBloadfuncs: - push ax bx ecx dx si di ds es gs - push gs - pop ds - cmp word ptr ds:[0],"EC" - ;jne notloaded - jne endofloading - mov si,ds:[exe.import] -loadfuncs: - cmp word ptr [si],0 - je endofloading - call MBSearchfunc - jnc toendoftext - mov bx,si -findend2: - inc bx - cmp byte ptr [bx], ':' - jne findend2 - mov byte ptr [bx],0 - mov ah,17 - int 48h - jc notloaded - mov byte ptr [bx],':' - call MBSearchfunc - jc notloaded -toendoftext: - mov al,[si] - cmp al,0 - je oktonext2 - inc si - jmp toendoftext -oktonext2: - inc si - mov [si],dx - mov [si+2],gs - add si,4 - jmp loadfuncs -endofloading: - clc - pop gs es ds di si dx ecx bx ax - ret -notloaded: - stc - pop gs es ds di si dx ecx bx ax - ret - - -;Recherche une fonction pointé par DS:SI en mémoire et renvoie son adresse en GS:DX -MBSearchfunc: - push bx si di - mov bx,si -findend: - inc bx - cmp byte ptr [bx], ':' - jne findend - mov byte ptr [bx],0 - call MBfind - mov byte ptr [bx],':' - jc notfoundattallthesb - cmp word ptr gs:[exe.checks],"EC" - jne notfoundattallthesb - mov di,gs:[exe.export] - inc bx - inc bx -functions: - cmp word ptr gs:[di],0 - je notfoundattallthesb - mov si,bx -cmpnamesfunc: - mov al,gs:[di] - cmp al,ds:[si] - jne notfoundthesb - cmp al,0 - je seemsok - inc si - inc di - jmp cmpnamesfunc -notfoundthesb: - mov al,gs:[di] - cmp al,0 - je oktonext - inc di - jmp notfoundthesb -oktonext: - inc di - inc di - inc di - jmp functions -seemsok: - mov dx,gs:[di+1] - clc - pop di si bx +;Affiche le nombre hexa dans %0[dword] +PROC biosprinth FAR + ARG @num:dword + USES ax,bx,cx,edx,si,di + mov edx,[@num] + mov ah,09h + mov di,8 +@@hexaize: + rol edx,4 + mov si,dx + and si,1111b + mov al,[cs:si+offset @@tab] + mov cx,1 + cmp al,32 + jb @@control + mov bx,7 + mov ah,09h + int 10h +@@control: + mov ah,0Eh + int 10h + dec di + jnz @@hexaize ret -notfoundattallthesb: - stc - pop di si bx +@@tab db '0123456789ABCDEF' +endp biosprinth + +;Affiche le texte ASCIIZ pointé par %0 +PROC biosprint FAR + ARG @pointer:word + USES ax,bx,cx,si + mov si,[@pointer] + mov cx,1 + mov bx,7 +@@again: + lodsb + or al,al + jz @@fin + cmp al,32 + jb @@control + mov ah,09h + int 10h +@@control: + mov ah,0Eh + int 10h + jmp @@again +@@fin: ret +endp biosprint + +;PROC flatmode FAR +; USES eax,bx,edx +; ; first, calculate the linear address of GDT +; xor edx,edx +; xor eax,eax +; mov dx,cs +; shl edx,4 +; add [dword ptr cs:offset @@gdt+2],edx ; store as GDT linear base addr +; ; now load the GDT into the GDTR +; lgdt [fword ptr cs:offset @@gdt] ; load GDT base (286-style 24-bit load) +; mov bx,1 * size descriptor ; point to first descriptor +; mov eax,cr0 ; prepare to enter protected mode +; or al,1 ; flip the PE bit +; cli ; turn off interrupts +; mov cr0,eax ; we're now in protected mode +; mov fs,bx ; load the FS segment register +; and al,0FEh ; clear the PE bit again +; mov cr0,eax ; back to real mode +; sti ; resume handling interrupts +; ret ; + +;@@gdt descriptor <@@gdtend - @@gdt - 1, @@gdt, 0, 0, 0, 0> ; the GDT itself +; descriptor <0ffffh, 0, 0, 091h, 0cfh, 0> ; 4G data segment +;@@gdtend: +;endp flatmode + +;Attend l'appuie sur une touche +PROC bioswaitkey FAR + xor ax,ax + int 16h + ret +endp bioswaitkey + +firstmb dw 0 -;Mise a nivo de la mémoire (jonction de blocs libre) -MBclean: - push ax bx dx es gs - mov bx,cs:firstmb - dec bx - dec bx - xor ax,ax - xor dx,dx -searchfree3: - mov gs,bx - cmp gs:[MB.Check],'NH' - jne erroronsearch - inc bx - inc bx - add bx,gs:[MB.Sizes] - cmp word ptr gs:[MB.Sizes],0 - je erroronsearch - cmp gs:[MB.Reference],Free - jne notfreeatall - cmp ax,0 - je notmeetafree - add dx,gs:[MB.Sizes] - mov word ptr gs:[MB.Check],0 - mov dword ptr gs:[MB.Names],0 - mov dword ptr gs:[MB.Names+4],0 - inc dx - inc dx - jmp nottrigered -notmeetafree: - xor dx,dx - mov ax,gs - jmp nottrigered -notfreeatall: - cmp ax,0 - je nottrigered +;Charge les sections du block %0 +PROC mbloadsection FAR + ARG @blocks:word + USES ax,bx,cx,si,di,ds,es + LOCAL @@toresov:word:60 + mov ax,[@blocks] + inc ax + inc ax + mov es,ax + mov ds,ax + cmp [word ptr 0],"EC" + jne @@notace + lea si,[@@toresov] + mov [word ptr ss:si],0FFFFh + mov bx,[ds:exe.sections] +@@loading: + cmp [dword ptr bx],0 + je @@finishloading + mov ax,bx + add ax,4 + call mbcreate,ax,[word ptr bx+2] + jc @@error + inc si + inc si + mov [ss:si],ax + push si + mov si,[bx] + xor di,di mov es,ax - add es:[MB.Sizes],dx - xor ax,ax -nottrigered: - cmp gs:[MB.IsNotLast],true - je searchfree3 - cmp ax,0 - je reallyfinish - mov es,ax - add es:[MB.Sizes],dx - mov es:[MB.IsNotLast],False -reallyfinish: - clc - pop gs es dx bx ax - ret -erroronsearch: - stc - pop gs es dx bx ax + mov cx,[bx+2] + cld + rep movsb + pop si + add bx,4 +@@gonext: + inc bx + cmp [byte ptr bx],0 + jne @@gonext + inc bx + jmp @@loading +@@finishloading: +pushad +xor eax,eax +mov ax,[word ptr ss:si] +call biosprinth,eax +popad + cmp [word ptr ss:si],0FFFFh + je @@finishdepands + call mbloadfuncs,[word ptr ss:si] + jc @@depandserror + dec si + dec si + jmp @@finishloading +@@finishdepands: ret - +@@notace: + stc + ret +@@error: + stc + ret +@@depandserror: + stc + ret +endp mbloadsection + ;Initialise les blocs de mémoire en prenant memorystart pour segment de base -MBinit: - push ax cx es - cmp cs:FirstMB,0 - jne notforfree - mov ax,memorystart - mov cs:Firstmb,ax - mov cx,0A000h - sub cx,ax - dec ax - dec ax - mov es,ax - cmp es:[MB.Check],'NH' - je notforfree - mov es:[MB.Reference],Free - mov es:[MB.Sizes],cx - mov es:[MB.Check],'NH' - mov dword ptr es:[MB.Names],'eerF' - mov dword ptr es:[MB.Names+4],0 - 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 ax bx es - mov bx,gs - mov ax,bx - dec bx - dec bx - mov es,bx - cmp es:[MB.Reference],Free - je wasfree - cmp es:[MB.IsResident],true - je wasfree - mov es:[MB.IsResident],false - mov es:[MB.Reference],Free - mov dword ptr es:[MB.Names],'eerF' - mov dword ptr es:[MB.Names+4],0 - mov bx,cs:firstmb - dec bx - dec bx -searchtofree: - mov gs,bx - cmp gs:[MB.Check],'NH' - jne wasfree - inc bx - inc bx - add bx,gs:[MB.Sizes] - cmp word ptr gs:[MB.Sizes],0 - je wasfree - cmp ax,gs:[MB.Reference] - jne nottofree - mov gs:[MB.IsResident],false - mov gs:[MB.Reference],Free - mov dword ptr gs:[MB.Names],'eerF' - mov dword ptr gs:[MB.Names+4],0 -nottofree: - cmp gs:[MB.IsNotLast],true - je searchtofree - call MBclean - pop es bx ax - ret -wasfree: - stc - pop es bx ax - ret - -;Change le proprietaire de GS a dx -MBChown: - push bx es - mov bx,gs - dec bx - dec bx - mov es,bx - cmp es:[MB.Reference],Free - je wasfree2 - mov es:[MB.Reference],dx - pop es bx - ret -wasfree2: - stc - pop es bx - ret - -;Alloue un bloc de CX caractere pour le process visé -> GS -MBAlloc: - push dx si bp ds - mov bp,sp - mov dx,ss:[bp+12] +PROC mbinit FAR + USES ax,cx,si,di,ds,es + cmp [cs:firstmb],0 + jne @@alreadyok push cs pop ds - mov si,offset data - call MBCreate - call MBChown - pop ds bp si dx + mov [cs:firstmb],memorystart + mov ax,memorystart-2 + mov es,ax + mov si,offset afree + xor di,di + mov cx,size mb + rep movsb + clc ret - -data db '/Data',0 +@@alreadyok: + stc + ret +endp mbinit -;Renvoie en GS le MB n° cx carry quand terminé -MBGet: - push bx dx - mov bx,cs:firstmb - dec bx - dec bx - xor dx,dx -searchfree2: - mov gs,bx - cmp gs:[MB.Check],'NH' - jne itsend - inc bx - inc bx - add bx,gs:[MB.Sizes] - cmp word ptr gs:[MB.Sizes],0 - je itsend - cmp dx,cx - je foundmcb - ja itsend - inc dx - cmp gs:[MB.IsNotLast],true - je searchfree2 -itsend: - stc - pop dx bx - ret -foundmcb: - clc - pop dx bx - ret - -;Renvoie en GS le MCB qui correspond a ds:si -MBFind: - push ax bx si di - mov bx,cs:firstmb - dec bx - dec bx - mov di,MB.Names -search: - mov gs,bx - cmp gs:[MB.Check],'NH' - jne itsend2 - inc bx - inc bx - add bx,gs:[MB.Sizes] - cmp word ptr gs:[MB.Sizes],0 - je itsend2 - push si di -cmpnames: - mov al,gs:[di] - cmp al,ds:[si] - jne ok - cmp al,0 - je ok - inc si - inc di - jmp cmpnames -ok: - pop di si - je foundmcb2 - cmp gs:[MB.IsNotLast],true - je search -itsend2: - stc - pop di si bx ax - ret -foundmcb2: - mov bx,gs - inc bx - inc bx - mov gs,bx - clc - pop di si bx ax - ret - -;Renvoie en GS le sous mcb qui correspond a ds:si et qui appartien a dx -MBFindsb: - push ax bx si di - mov bx,cs:firstmb - dec bx - dec bx - mov di,MB.Names -search2: - mov gs,bx - cmp gs:[MB.Check],'NH' - jne itsend3 - inc bx - inc bx - add bx,gs:[MB.Sizes] - cmp word ptr gs:[MB.Sizes],0 - je itsend3 - push si di -cmpnames2: - mov al,gs:[di] - cmp al,ds:[si] - jne ok2 - cmp al,0 - je ok2 - inc si - inc di - jmp cmpnames2 -ok2: - pop di si - jne notfoundmcb2 - cmp gs:[MB.Reference],dx - je foundmcb3 -notfoundmcb2: - cmp gs:[MB.IsNotLast],true - je search2 -itsend3: - stc - pop di si bx ax - ret -foundmcb3: - mov bx,gs - inc bx - inc bx - mov gs,bx - clc - pop di si bx ax - ret - -;Creér un bloc de nom ds:si de taille cx (octets) -> n°segment dans GS -MBCreate: - push bp - mov bp,sp - mov gs,ss:[bp+6] - push ax bx cx dx si di es +afree mb <"HN",0,0,0,0A000h-memorystart,"Libre"> + db 0 + +;Creér un bloc de nom %0 de taille %1 (octets) -> n°segment dans AX +PROC mbcreate FAR + ARG @blocks:word,@size:word + USES bx,cx,dx,si,di,ds,es + push gs + mov gs,[ss:bp+4] + mov cx,[@size] shr cx,4 inc cx - mov bx,cs:firstmb + mov bx,[cs:firstmb] dec bx dec bx - mov dl,1 -searchfree: - cmp dl,False - je wasntgood - mov es,bx - cmp es:[MB.Check],'NH' - jne wasntgood - cmp es:[MB.IsNotLast],True + mov dl,true +@@searchfree: + cmp dl,false + je @@notenougtmem + mov es,bx + cmp [word ptr es:mb.check],"NH" + jne @@memoryerror + cmp [es:mb.isnotlast],true sete dl - cmp es:[MB.Reference],Free - jne notsogood - mov ax,es:[MB.Sizes] + cmp [es:mb.reference],free + jne @@notsogood + mov ax,[es:mb.sizes] cmp cx,ax - ja notsogood - mov word ptr es:[MB.Check],'NH' - mov es:[MB.IsNotLast],True - mov es:[MB.Reference],gs - mov es:[MB.IsResident],False - mov di,MB.Names - push ax cx - mov cx,32 -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 + ja @@notsogood + ;mov [word ptr es:mb.check],"NH" + mov [es:mb.isnotlast],true + mov [es:mb.reference],gs + mov [es:mb.isresident],false + lea di,[es:mb.names] + push cx + mov cx,24/4 + push cs + pop ds + mov si,[@blocks] + cld + rep movsd + pop cx inc bx inc bx sub ax,cx cmp ax,0 - je nofree + je @@nofree dec ax dec ax - mov es:[MB.Sizes],cx + mov [es:mb.sizes],cx add cx,bx - mov es,cx - 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: - mov gs,bx + mov es,cx + mov si,offset afree + xor di,di + mov cx,size mb + cld + rep movsb + mov [es:mb.isnotlast],dl + mov [es:mb.sizes],ax +@@nofree: + mov ax,bx clc - pop es di si dx cx bx ax - pop bp + pop gs ret -wasntgood: +@@notsogood: + inc bx + inc bx + add bx,[es:mb.sizes] + jmp @@searchfree +@@memoryerror: stc - pop es di si dx cx bx ax - pop bp + pop gs ret -notsogood: - inc bx - inc bx - add bx,es:[MB.Sizes] - jmp searchfree +@@notenougtmem: + pop gs + stc + ret +endp mbcreate -;Rend le segment GS résident -MBresident: - push bx es - mov bx,gs +;Libère le bloc de mémoire %0 et ses sous blocs +PROC mbfree FAR + ARG @blocks:word + USES ax,bx,cx,si,di,ds,es + mov bx,[@blocks] + mov ax,bx + dec bx + dec bx + mov es,bx + cmp [word ptr es:mb.check],"NH" + jne @@memoryerror + cmp [es:mb.reference],free + je @@wasfree + cmp [es:mb.isresident],true + je @@wasresident + mov [es:mb.reference],free + push cs + pop ds + mov si,offset @@isfree + lea di,[es:mb.names] + mov cx,6 + cld + rep movsb + mov bx,[cs:firstmb] + dec bx + dec bx +@@searchtofree: + mov es,bx + cmp [word ptr es:mb.check],"NH" + jne @@memoryerror + inc bx + inc bx + add bx,[es:mb.sizes] + cmp [es:mb.sizes],0 + je @@nottofree + cmp ax,[es:mb.reference] + jne @@nottofree + mov [es:mb.isresident],false + mov [es:mb.reference],free + mov cx,6 + cld + rep movsb +@@nottofree: + cmp [es:mb.isnotlast],true + je @@searchtofree + call mbclean + ret +@@memoryerror: + stc + ret +@@wasfree: + stc + ret +@@wasresident: + stc + ret + +@@isfree db "libre",0 +endp mbfree + +;Mise a nivo de la mémoire (jonction de blocs libre) +PROC mbclean FAR + USES ax,bx,dx,es,gs + mov bx,[cs:firstmb] + dec bx + dec bx + xor ax,ax + xor dx,dx +@@searchfree: + mov gs,bx + cmp [word ptr gs:mb.check],"NH" + jne @@memoryerror + inc bx + inc bx + add bx,[gs:mb.sizes] + cmp [word ptr gs:mb.sizes],0 + je @@notenougtmem + cmp [gs:mb.reference],free + jne @@notfree + cmp ax,0 + je @@notmeetfree + add dx,[gs:mb.sizes] + mov [word ptr gs:mb.check],0 + mov [dword ptr gs:mb.names],0 + inc dx + inc dx + jmp @@nottrigered +@@notmeetfree: + xor dx,dx + mov ax,gs + jmp @@nottrigered +@@notfree: + cmp ax,0 + je @@nottrigered + mov es,ax + add [es:mb.sizes],dx + xor ax,ax +@@nottrigered: + cmp [gs:mb.isnotlast],true + je @@searchfree + cmp ax,0 + je @@reallyfinish + mov es,ax + add [es:mb.sizes],dx + mov [es:mb.isnotlast],false +@@reallyfinish: + clc + ret +@@notenougtmem: + stc + ret +@@memoryerror: + stc + ret +endp mbclean + +;Rend le segment %0 résident +PROC mbresident FAR + ARG @blocks:word + USES bx,es + mov bx,[@blocks] dec bx dec bx mov es,bx - mov es:[MB.IsResident],True - pop es bx + cmp [word ptr es:mb.check],"NH" + jne @@memoryerror + mov [es:mb.isresident],true ret +@@memoryerror: + stc + ret +endp mbresident -;Rend le segment GS résident -MBnonresident: - push bx es - mov bx,gs +;Rend le segment %0 non résident +PROC mbnonresident FAR + ARG @blocks:word + USES bx,es + mov bx,[@blocks] dec bx dec bx mov es,bx - mov es:[MB.IsResident],False - pop es bx + cmp [word ptr es:mb.check],"NH" + jne @@memoryerror + mov [es:mb.isresident],false ret +@@memoryerror: + stc + ret +endp mbnonresident + + +;Change le proprietaire de %0 a %1 +PROC mbchown FAR + ARG @blocks:word,@owner:word + USES bx,dx,es + mov bx,[@blocks] + dec bx + dec bx + mov es,bx + cmp [word ptr es:mb.check],"NH" + jne @@memoryerror + cmp [es:mb.reference],free + je @@wasfree + mov dx,[@owner] + mov [es:mb.reference],dx + ret +@@memoryerror: + stc + ret +@@wasfree: + stc + ret +endp mbchown -end start +;Alloue un bloc /data de CX caractere pour le process appelant -> ax +PROC mballoc FAR + ARG @size:word + USES ax,si,ds + push cs + pop ds + call mbcreate,offset @@data,[@size] + call mbchown,ax,[word ptr ss:bp+4] + ret + +@@data db '/data',0 +endp mballoc + +;Renvoie en AX le MB n° %0 carry quand terminé +PROC mbget FAR + ARG @num:word + USES bx,dx,es + mov bx,[cs:firstmb] + dec bx + dec bx + xor dx,dx +@@searchfree: + mov es,bx + cmp [word ptr es:mb.check],"NH" + jne @@memoryerror + inc bx + inc bx + add bx,[es:mb.sizes] + cmp [es:mb.sizes],0 + je @@memoryerror + cmp dx,[@num] + je @@foundmcb + ja @@notfound + inc dx + cmp [es:mb.isnotlast],true + je @@searchfree +@@memoryerror: + stc + ret +@@foundmcb: + mov ax,es + inc ax + inc ax + clc + ret +@@notfound: + stc + ret +endp mbget + +;Renvoie en AX le MCB qui correspond a ds:%0 +PROC mbfind FAR + ARG @blocks:word + USES bx,si,di,es + mov bx,[cs:firstmb] + dec bx + dec bx + mov si,[@blocks] + lea di,[es:mb.names] +@@search: + mov es,bx + cmp [word ptr es:mb.check],"NH" + jne @@memoryerror + inc bx + inc bx + add bx,[es:mb.sizes] + cmp [es:mb.sizes],0 + je @@memoryerror + push si di +@@cmpnames: + mov al,[es:di] + cmp al,[ds:si] + jne @@ok + cmp al,0 + je @@ok + inc si + inc di + jmp @@cmpnames +@@ok: + pop di si + je @@foundmcb + cmp [es:mb.isnotlast],true + je @@search +@@notfound: + stc + ret +@@memoryerror: + stc + ret +@@foundmcb: + mov ax,es + inc ax + inc ax + clc + ret +endp mbfind + + +;Renvoie en AX le sous mcb qui correspond a %0 et qui appartien a %1 +PROC mbfindsb FAR + ARG @blocks:word,@owner:word + USES bx,dx,si,di,es + mov bx,[cs:firstmb] + dec bx + dec bx + mov si,[@blocks] + lea di,[es:mb.names] + mov dx,[@owner] +@@search: + mov es,bx + cmp [word ptr es:mb.check],"NH" + jne @@memoryerror + inc bx + inc bx + add bx,[es:mb.sizes] + cmp [es:mb.sizes],0 + je @@memoryerror + push si di +@@cmpnames: + mov al,[es:di] + cmp al,[ds:si] + jne @@ok + cmp al,0 + je @@ok + inc si + inc di + jmp @@cmpnames +@@ok: + pop di si + jne @@notfoundmcb + cmp [es:mb.reference],dx + je @@foundmcb +@@notfoundmcb: + cmp [es:mb.isnotlast],true + je @@search +@@notfound: + stc + ret +@@foundmcb: + mov ax,es + inc ax + inc ax + clc + ret +@@memoryerror: + stc + ret +endp mbfindsb + +;Resouds les dépendances du bloc de mémoire %0 +PROC mbloadfuncs FAR + ARG @blocks:word + USES ax,bx,cx,dx,si,ds + mov ds,[@blocks] + cmp [word ptr 0],"EC" + jne @@notace + mov si,[ds:exe.imports] + cmp si,0 + je @@endofloading +@@loadfuncs: + cmp [word ptr si],0 + je @@endofloading + call mbsearchfunc,si + jnc @@toendoftext + mov bx,si +@@findend: + inc bx + cmp [byte ptr bx], ':' + jne @@findend + mov [byte ptr bx],0 +;call projectfile,bx + jc @@erroronload + mov [byte ptr bx],':' + call mbsearchfunc,si + jc @@libnotexist +@@toendoftext: + mov cl,[si] + cmp cl,0 + je @@oktonext + inc si + jmp @@toendoftext +@@oktonext: + inc si + mov [si],ax + mov [si+2],dx + add si,4 + jmp @@loadfuncs +@@endofloading: + clc + ret +@@notace: + stc + ret +@@libnotexist: + stc + ret +@@erroronload: + stc + ret +endp mbloadfuncs + + +;Recherche une fonction pointé par DS:SI en mémoire et renvoie son adresse en DX:AX +PROC mbsearchfunc FAR + ARG @func:word + USES bx,si,di,es + mov bx,[@func] + push bx +@@findend: + inc bx + cmp [byte ptr bx], ':' + jne @@findend + mov [byte ptr bx],0 + call mbfind + mov [byte ptr bx],':' + jc @@notfoundattallthesb + mov es,ax + cmp [word ptr es:exe.checks],"EC" + jne @@notfoundattallthesb + mov di,[es:exe.exports] + inc bx + inc bx +@@functions: + cmp [word ptr es:di],0 + je @@notfoundattallthesb + mov si,bx +@@cmpnamesfunc: + mov al,[es:di] + cmp al,[ds:si] + jne @@notfoundthesb + cmp al,0 + je @@seemsok + inc si + inc di + jmp @@cmpnamesfunc +@@notfoundthesb: + mov al,[es:di] + cmp al,0 + je @@oktonext + inc di + jmp @@notfoundthesb +@@oktonext: + inc di + inc di + inc di + jmp @@functions +@@seemsok: + mov dx,es + mov ax,[es:di+1] + clc + ret +@@notfoundattallthesb: + stc + ret +endp mbsearchfunc diff --git a/noyau/video.asm b/noyau/video.asm index c4c6d2b..79bbc55 100644 --- a/noyau/video.asm +++ b/noyau/video.asm @@ -1,104 +1,86 @@ -.model tiny -.486 -smart -.code +model tiny,stdcall +p486 +locals +jumps +codeseg +option procalign:byte + +include "..\include\mem.h" +include "..\include\graphic.h" org 0h +header exe <"CE",1,0,0,offset exports,,,> -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) +exports: + db "setvideomode",0 + dw setvideomode + db "getvideomode",0 dw getvideomode + db "clearscreen",0 dw clearscreen + db "setfont",0 dw setfont + db "loadfont",0 dw loadfont + db "getfont",0 dw getfont - dw showline + db "addline",0 + dw addline + db "showchar",0 dw showchar + db "showpixel",0 dw showpixel + db "getpixel",0 dw getpixel - dw nothings + db "setstyle",0 dw setstyle + db "getstyle",0 dw getstyle + db "enablecursor",0 dw enablecursor + db "disablecursor",0 dw disablecursor - dw nothings - dw nothings - dw nothings - dw nothings - dw nothings - dw nothings + db "setcolor",0 dw setcolor + db "getcolor",0 dw getcolor + db "scrolldown",0 dw scrolldown + db "getxy",0 dw getxy + db "setxy",0 dw setxy + db "savescreen",0 dw savescreen + db "restorescreen",0 dw restorescreen + db "page2to1",0 dw page2to1 + db "page1to2",0 dw page1to2 - dw xchgPages - dw nothings + ;db "xchgPages",0 + ;dw xchgpages + db "waithretrace",0 dw waithretrace + db "waitretrace",0 dw waitretrace + db "getvgainfos",0 dw getvgainfos - dw nothings - dw nothings - dw nothings - dw savedac - dw restoredac - dw savestate - dw restorestate + ;db "savedac",0 + ;dw savedac + ;db "restoredac",0 + ;dw restoredac + ;db "savestate",0 + ;dw savestate + ;db "restorestate",0 + ;dw restorestate + db "enablescroll",0 dw enablescroll + db "disablescroll",0 dw disablescroll - dw nothings - dw nothings - dw nothings - dw nothings - dw nothings + db "getchar",0 dw getchar ;================================Table des modes videos (64 BYTES) ============================================ @@ -211,8 +193,8 @@ mode11 DB 0E7H DB 100,75 -DATABLOCKSIZE equ 40 -DATABLOCK equ $ +datablocksize equ 40 +datablock equ $ ;============================================DATABLOCK========================================================= lines db 0 columns db 0 @@ -238,63 +220,47 @@ base dw 0 scrolling db 1 ;=======================================Equivalence pour la clarté du code======================================== -Sequencer equ 03C4h +sequencer equ 03C4h misc equ 03C2h -CCRT equ 03D4h -Attribs equ 03C0h +ccrt equ 03D4h +attribs equ 03C0h graphics equ 03CEh statut equ 03DAh -maxfunc equ 39h -maxmode equ 11 +maxmode equ 11 planesize equ 65000 ;============================================Fonctions de l'int VIDEO=========================================== -;message d'erreur specifiant que les interruptions n'existent plus -nothings: - push cx si - mov si,offset msg - mov ch,04 -showit: - mov cl,cs:[si] - cmp cl,0 - je endshowit - inc si - call charout - jmp showit -endshowit: - pop si cx - ret -msg db 'ERREUR: int 47h fonction inexistante !!!',0 - -;=============ENABLESCROLLING (Fonction 02AH)========= -;Autorise le d‚filement -;-> AH=42 +;=============ENABLESCROLLING========= +;Autorise le défilement +;-> ;<- -;===================================================== - EnableScroll: - mov cs:scrolling,1 +;===================================== +PROC enablescroll FAR + mov [cs:scrolling],1 ret +endp enablescroll -;=============DISABLESCROLLING (Fonction 2Bh)========= -;D‚sactive le d‚filement -;-> AH=43 +;=============DISABLESCROLLING========= +;Désactive le d‚filement +;-> ;<- -;===================================================== -DisableScroll: - mov cs:scrolling,0 +;====================================== +PROC disablescroll FAR + mov [cs:scrolling],0 ret - -;=============ENABLECURSOR (Fonction 013)========= +endp disablescroll + +;=============ENABLECURSOR============= ;Autorise le d‚filement -;-> AH=42 +;-> ;<- -;===================================================== - EnableCursor: - push ax dx - mov cs:cursor,1 - mov dx,CCRT +;====================================== +PROC enablecursor FAR + USES ax,dx + mov [cs:cursor],1 + mov dx,ccrt mov al,0Ah out dx,al inc dx @@ -304,21 +270,23 @@ DisableScroll: dec dx mov al,0Ah out dx,ax - mov bh,cs:x - mov bl,cs:y - call setxy - pop dx ax + mov al,[cs:x] + xor ah,ah + mov dl,[cs:y] + xor dh,dh + call setxy,ax,dx ret +endp enablecursor -;=============DISABLECURSOR (Fonction 14)========= +;=============DISABLECURSOR============= ;D‚sactive le d‚filement -;-> AH=43 +;-> ;<- -;===================================================== -DisableCursor: - push ax dx - mov cs:cursor,0 - mov dx,CCRT +;======================================= +PROC disablecursor FAR + USES ax,dx + mov [cs:cursor],0 + mov dx,ccrt mov al,0Ah out dx,al inc dx @@ -328,107 +296,103 @@ DisableCursor: dec dx mov al,0Ah out dx,ax - pop dx ax ret +endp disablecursor -;==========SETSTYLE (Fonction 11)========= -;Change le style du texte a CL -;-> AH=x ,CX style +;==========SETSTYLE========= +;Change le style du texte a %0 +;-> %0 style ;<- -;========================================= -setstyle: - mov cs:style,cl +;============================ +PROC setstyle FAR + ARG @style:word + USES cx + mov ax,[@style] + mov [cs:style],al ret +endp setstyle -;==========GETSTYLE (Fonction 12)========= -;Récupère le style du texte dans CL -;-> AH=x -;<- CX style -;========================================= -getstyle: - mov cl,cs:style - 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 +;==========GETSTYLE========= +;Récupère le style du texte dans AX +;-> +;<- AX style +;=========================== +PROC getstyle FAR + mov al,[cs:style] + xor ah,ah ret +endp getstyle -;=============SetVideoMode (Fonction 00h)========= -;Fixe le mode vidéo courant a AL -;-> AH=0, AL mode d'écran +;=============SetVideoMode========= +;Fixe le mode vidéo courant a %0 +;-> %0 mode d'écran ;<- Carry if error -;================================================= -setvideomode: - push ax cx dx di +;================================== +PROC setvideomode FAR + ARG @mode:word + USES ax,cx,dx,di + mov ax,[@mode] + xor ah,ah cmp al,maxmode - ja errorsetvideomode - cmp cs:mode,5h - jb nographic + 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 + jae @@nographic + call initfont +@@nographic: + cmp [cs:mode],0FFh + jne @@noinit + call initfont +@@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] + mov al,[cs:di] out dx,al inc di mov dx,statut - mov al,cs:[di] + mov al,[cs:di] out dx,al inc di mov dx,sequencer xor ax,ax -initsequencer: - mov ah,cs:[di] +@@initsequencer: + mov ah,[cs:di] out dx,ax inc al inc di cmp al,4 - jbe initsequencer + jbe @@initsequencer mov ax,0E11h mov dx,ccrt out dx,ax xor ax,ax -initcrt: - mov ah,cs:[di] +@@initcrt: + mov ah,[cs:di] out dx,ax inc al inc di cmp al,24 - jbe initcrt + jbe @@initcrt mov dx,graphics xor ax,ax -initgraphic: - mov ah,cs:[di] +@@initgraphic: + mov ah,[cs:di] out dx,ax inc al inc di cmp al,8 - jbe initgraphic + jbe @@initgraphic mov dx,statut in al,dx mov dx,attribs xor ax,ax -initattribs: - mov ah,cs:[di] +@@initattribs: + mov ah,[cs:di] push ax in ax,dx pop ax @@ -439,97 +403,93 @@ initattribs: inc al inc di cmp al,20 - jbe initattribs + 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 + mov al,[cs:di] + mov [cs:columns],al + mov ah,[cs:di+1] + mov [cs:lines],ah mul ah - mov cl,cs:[di-5] + mov cl,[cs:di-5] and cl,01000000b cmp cl,0 - je colors16 - mov cs:color,8 + je @@colors16 + mov [cs:color],8 mov cl,4 - jmp colors256 -colors16: - mov cs:color,4 + jmp @@colors256 +@@colors16: + mov [cs:color],4 mov cl,3 -colors256: - cmp cs:mode,5 - setae cs:graphic - jb istext +@@colors256: + cmp [cs:mode],5 + setae [cs:graphic] + jb @@istext shl ax,cl - mov cs:segments,0A000h - jmp wasgraph -istext: - mov cs:segments,0B800h + mov [cs:segments],0A000h + jmp @@wasgraph +@@istext: + mov [cs:segments],0B800h shl ax,1 -wasgraph: - mov cs:pagesize,ax +@@wasgraph: + mov [cs:pagesize],ax mov ax,planesize xor dx,dx - div cs:pagesize - mov cs:nbpage,al - mov al,cs:[di-36] + div [cs:pagesize] + mov [cs:nbpage],al + mov al,[cs:di-36] xor ah,ah shl ax,2 - mov cl,cs:graphic + mov cl,[cs:graphic] shr ax,cl - mov cs:linesize,ax - mov ax,cs:[di-43] - mov cs:adress,ax - mov cs:base,ax - mov cs:cursor,1 - mov cs:style,0 - pop di dx cx ax + mov [cs:linesize],ax + mov ax,[cs:di-43] + mov [cs:adress],ax + mov [cs:base],ax + mov [cs:cursor],1 + mov [cs:style],0 ret -errorsetvideomode: - pop di dx cx ax +@@errorsetvideomode: ret +endp setvideomode -initvideo: - push bx cx si ds + +initfont: + push ds call clearscreen 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 - pop ds si cx bx + call loadfont,offset font8x8,8,1 + call loadfont,offset font8x16,16,0 + pop ds ret -;=============GetVideoMode (Fonction 01h)========= -;Renvoie le mode vidéo courant dans AL -;-> AH=1 -;<- AL mode d'écran -;================================================= -getvideomode: - mov al,cs:mode +;=============GetVideoMode========= +;Renvoie le mode vidéo courant dans AX +;-> +;<- AX +;================================== +PROC getvideomode FAR + mov al,[cs:mode] + xor ah,ah ret +endp getvideomode -;=============CLEARSCREEN (Fonction 02h)========= +;=============CLEARSCREEN========= ;Efface l'ecran graphique ou texte -;-> AH=2 +;-> ;<- -;================================================ -clearscreen: - push eax cx dx di es +;================================= +PROC clearscreen FAR + USES eax,cx,dx,di,es mov cx,planesize - mov di,cs:adress + mov di,[cs:adress] shr cx,2 - cmp cs:graphic,1 - jne erasetext + cmp [cs:graphic],1 + jne @@erasetext mov ax,0A000h mov es,ax -erasegraph: +@@erasegraph: mov ax,0F02h mov dx,sequencer out dx,ax @@ -544,41 +504,40 @@ erasegraph: cld rep stosd mov ax,0005h - cmp cs:color,4 - je not256 + cmp [cs:color],4 + je @@not256 mov ax,4005h -not256: +@@not256: mov dx,graphics out dx,ax mov ax,0003h out dx,ax - jmp endoferase - - -erasetext: + jmp @@endoferase +@@erasetext: mov ax,0B800h mov es,ax mov eax,07200720h cld - rep stosd - -endoferase: - xor bx,bx - call setxy - pop es di dx cx eax + rep stosd +@@endoferase: + call setxy,0,0 ret +endp clearscreen -;=============SetFont (Fonction 03h)========= -;Active la font cl parmi les 8 -;-> AH=3, CL n° font +;=============SetFont========= +;Active la font %0 parmi les 8 +;-> %0 n° font ;<- Carry if error -;============================================ -setfont: - push ax cx dx +;============================= +PROC setfont FAR + ARG @font:word + USES ax,cx,dx + mov cx,[@font] + xor ch,ch cmp cl,7 - ja errorsetfont - mov cs:font,cl + ja @@errorsetfont + mov [cs:font],cl mov ah,cl and cl,11b and ah,0100b @@ -587,64 +546,54 @@ setfont: mov dx,sequencer mov al,3 out dx,ax - pop dx cx ax ret -errorsetfont: - pop dx cx ax +@@errorsetfont: ret +endp setfont -;=============GetFont (Fonction 05h)========= -;Récupère le n° de la font active -;-> AH=x +;=============GetFont========= +;Récupère le n° de la font active AX +;-> ;<- 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 +;============================= +PROC getfont FAR + mov al,[cs:font] + xor ah,ah +endp getfont -;=============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 +;!!!!!!!!!!!!!!!!!!!! a remettre les anciens params de timing depuis origine +;=============LoadFont======== +;Charge une police pointée par %0 dans la carte vidéo sous n°font %1, taille police dans %2 +;-> %0 n°font, %1 pointeur vers Font, %2 taille police ;<- Carry if error -;=========================================== -loadfont: - push ax bx cx dx si di es +;============================= +PROC loadfont FAR + ARG @pointer:word,@size:word,@font:word + USES ax,bx,cx,dx,si,di,es + LOCAL @poppop:dword + mov si,[@pointer] + mov cx,[@size] + mov bx,[@font] cmp bl,7 - ja errorloadfont + ja @@errorloadfont xor di,di cli mov dx,sequencer -doseq: - mov ax,cs:[di+offset reg1] +@@doseq: + mov ax,[cs:di+offset reg1] out dx,ax inc di inc di cmp di,6 - jbe doseq + jbe @@doseq mov dx,graphics -doseq2: - mov ax,cs:[di+offset reg1] +@@doseq2: + mov ax,[cs:di+offset reg1] out dx,ax inc di inc di cmp di,6+6 - jbe doseq2 + jbe @@doseq2 sti mov ax,0A000h mov es,ax @@ -652,14 +601,14 @@ doseq2: mov al,0 xor bh,bh cmp bl,4 - jb isless + jb @@isless sub bl,4 shl bl,1 inc bl - jmp okmake -isless: + jmp @@okmake +@@isless: shl bl,1 -okmake: +@@okmake: mov di,bx shl di,13 mov bh,cl @@ -668,104 +617,110 @@ okmake: neg bl xor cx,cx cld -popz: +@@popz: mov cl,bh rep movsb mov cl,bl rep stosb dec dx - jnz popz + jnz @@popz xor di,di mov dx,sequencer -doseqs: - mov ax,cs:[di+offset reg2] +@@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] + 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 + jbe @@doseqs2 ret -errorloadfont: +@@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 + dw 0204h, 0005h, 0406h +endp loadfont -;==========SHOWLINE (Fonction 06h)=============== +;==========SHOWLINE=============== ;remet le curseur text a la ligne avec un retour chariot -;-> AH=6 +;-> ;<- -;================================================ -showline: - push bx cx - mov bl,cs:y +;================================= +PROC addline FAR + USES bx,cx + mov bl,[cs:y] xor bh,bh - mov cl,cs:lines + mov cl,[cs:lines] sub cl,2 cmp bl,cl - jne scro + jne @@scro dec bl mov cx,1 - cmp cs:graphic,0 - je okscro + cmp [cs:graphic],0 + je @@okscro mov cx,8 -okscro: - call scrolldown -scro: +@@okscro: + call scrolldown,cx +@@scro: inc bl - call setxy - pop cx bx + call setxy,0,bx ret +endp addline -;==========SETCOLOR (Fonction 15h)========= +;==========SETCOLOR========= ;Change les attributs du texte a CL -;-> AH=21 ,CL couleur +;-> %0 couleur ;<- -;========================================= -setcolor: - mov cs:colors,CL +;=========================== +PROC setcolor FAR + ARG @color:word + USES cx + mov cx,[@color] + mov [cs:colors],cl ret +endp setcolor -;==========GETCOLOR (Fonction 16h)========= -;Récupère les attributs du texte dans CL -;-> AH=22 -;<- CL couleur -;========================================= -getcolor: - mov cl,cs:colors +;==========GETCOLOR========= +;Récupère les attributs du texte dans AX +;-> +;<- AX couleur +;=========================== +PROC getcolor FAR + mov al,[cs:colors] + xor ah,ah ret +endp getcolor -;==========SCROLLDOWN (Fonction 17h)========= -;defile de cx lines vers le bas -;-> AH=23, CX lines à défiler vers le bas +;==========SCROLLDOWN========= +;defile de %0 lines vers le bas +;-> %0 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 +PROC scrolldown FAR + ARG @line:word + USES ax,cx,dx,si,di,ds,es + cmp [cs:scrolling],0 + je @@graphp + mov ax,[@line] + mul [cs:linesize] mov si,ax - mov cx,cs:pagesize + mov cx,[cs:pagesize] sub cx,si - mov di,cs:adress + mov di,[cs:adress] cld - cmp byte ptr cs:graphic,1 - jne textp + cmp [cs:graphic],1 + jne @@textp mov ax,0A000h mov es,ax mov ds,ax @@ -778,74 +733,82 @@ scrolldown: cld rep movsb mov ax,0005h - cmp cs:color,4 - je not256ok + cmp [cs:color],4 + je @@not256ok mov ax,4005h -not256ok: +@@not256ok: mov dx,graphics out dx,ax mov ax,0003h out dx,ax - jmp graphp + jmp @@graphp -textp: +@@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 +@@graphp: ret +endp scrolldown -;==========SETXY (Fonction 19h)========= -;Change les coordonnées du curseur a X:BH,Y:BL -;-> AH=25, BH coordonnées x, BL coordonnées y +;==========GETXY========= +;Met les coordonnées du curseur dans %0 au format point +;-> +;<- ah coordonnées x, al coordonnées y +;======================== +PROC getxy FAR + ARG @pointer:word + USES bx + mov bx,[@pointer] + mov ah,[cs:x] + mov al,[cs:y] + ret +endp getxy + +;==========SETXY========= +;Change les coordonnées du curseur a X:%0,Y:%1 +;-> %0 coordonnées x, %1 coordonnées y ;<- -;===================================== -setxy: - push ax bx dx di - mov cs:x,bh - mov cs:y,bl - mov al,bl - mov bl,bh - xor bh,bh - mov di,cs:adress +;======================== +PROC setxy FAR + ARG @x:word,@y:word + USES ax,bx,dx,di + mov ax,[@y] + mov bx,[@x] + mov [cs:x],bl + mov [cs:y],al + mov di,[cs:adress] add di,bx - mul cs:columns + mul [cs:columns] add di,ax shl di,1 - mov cs:xy,di + mov [cs:xy],di call setcursor - pop di dx bx ax ret +endp setxy -;==========SHOWPIXEL (Fonction 08h)========= -;Affiche un pixel de couleur AL en X:BX,Y:CX -;-> AH=x, BX coordonnées x, CX coordonnées y, AL couleur +;==========SHOWPIXEL========= +;Affiche un pixel de couleur AL en X:%0,Y:%1 +;-> %0 coordonnées x, %1 coordonnées y, %2 couleur ;<- -;========================================= -showpixel: - push ax bx cx dx si di es - cmp cs:color,4 - je showpixel4 +;============================ +PROC showpixel FAR + ARG @x:word,@y:word,@color:word + USES ax,bx,cx,dx,si,di,es + mov bx,[@x] + mov cx,[@y] + mov ax,[@color] + cmp [cs:color],4 + je @@showpixel4 mov si,ax mov ax,cx mov cl,bl - mul cs:linesize + mul [cs:linesize] shr bx,2 add ax,bx mov di,ax - add di,cs:adress + add di,[cs:adress] and cl,3 mov ah,1 shl ah,cl @@ -855,19 +818,19 @@ showpixel: mov bx,0A000h mov es,bx mov ax,si - mov es:[di],al - jmp endofshow + mov [es:di],al + jmp @@endofshow -showpixel4: +@@showpixel4: mov dx,ax mov ax,cx mov ch,dl mov cl,bl - mul cs:linesize + mul [cs:linesize] shr bx,3 add ax,bx mov di,ax - add di,cs:adress + add di,[cs:adress] and cl,111b xor cl,111b mov ah,1 @@ -881,28 +844,30 @@ showpixel4: out dx,ax mov bx,0A000h mov es,bx - mov al,es:[di] - mov es:[di],ch - -endofshow: - pop es di si dx cx bx ax + mov al,[es:di] + mov [es:di],ch +@@endofshow: ret +endp showpixel -;==========GETPIXEL (Fonction 09h)========= -;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 -;<- +;!!!!!!!!!!!!!! gerer le mode chain 4 +;==========GETPIXEL========= +;Récupère en ax la couleur du pixel de coordonnées X:%0,Y:%1 +;-> %0 coordonnées x, %1 coordonnées y +;<- AX couleur ;========================================= -getpixel: - push ax bx cx dx di bp es - mov bp,ax +PROC getpixel FAR + ARG @x:word,@y:word + USES ax,bx,cx,dx,di,es + mov bx,[@x] + mov cx,[@y] mov ax,cx mov cl,bl - mul cs:linesize + mul [cs:linesize] shr bx,2 add ax,bx mov di,ax - add di,cs:adress + add di,[cs:adress] and cl,3 mov ah,cl mov al,4 @@ -910,98 +875,115 @@ getpixel: out dx,ax mov bx,0A000h mov es,bx - mov ax,bp - mov al,es:[di] - pop es bp di dx cx bx ax + mov al,[es:di] ret +endp getpixel -;==========GETVGAINFO (Fonction 0xh)========= +;==========GETVGAINFO========= ;Renvoie un bloc de donnée en ES:DI sur l'état de la carte graphique -;<- AH=x, ES:DI pointeur +;<- ES:%0 pointeur ;-> ;============================================= -Getvgainfos: - push cx si di ds +PROC getvgainfos FAR + ARG @pointer:word + USES cx,si,di,ds push cs pop ds mov cx,datablocksize mov si,offset datablock + mov di,[@pointer] cld rep movsb - pop ds di si cx ret +endp getvgainfos -;==========WAITRETRACE (Fonction 0xh)========= +;==========WAITRETRACE========= ;Synchronisation avec la retrace verticale -;<- AH=x +;<- ;-> -;============================================= -waitretrace: - push ax dx +;============================== +PROC waitretrace FAR + USES ax,dx mov dx,3DAh -waitr: +@@waitr: in al,dx test al,8 - jz waitr - pop dx ax + jz @@waitr ret +endp waitretrace -;==========WAITHRETRACE (Fonction 0xh)========= +;==========WAITHRETRACE========= ;Synchronisation avec la retrace horizontale -;<- AH=x +;<- ;-> -;============================================= -waithretrace: - push ax dx +;=============================== +PROC waithretrace FAR + USES ax,dx mov dx,3DAh -waitr2: +@@waitr: in al,dx test al,1 - jz waitr2 - pop dx ax + jz @@waitr ret - -;Renvoie le caractère sur le curseur en dl -getchar: - push ax di es +endp waithretrace + +;==========GETCHAR========= +;Renvoie en AX le caractère sur le curseur +;<- +;-> +;========================== +PROC getchar FAR + USES di,es mov ax,0B800h mov es,ax - mov di,cs:xy - mov dl,es:[di] - pop es di ax + mov di,[cs:xy] + mov al,[es:di] + xor ah,ah ret +endp getchar -;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 cs:graphic,1 - jne textaccess +;==========SHOWCHAR========= +;Ecrit le caractère ASCII %0 attribut %1 aprés le curseur, en le mettant à jours +;<- +;-> +;=========================== +PROC showchar FAR + ARG @char:word,@attr:word + USES ax,bx,cx,dx,di,es + mov cl,[byte ptr @char] + mov ch,[byte ptr @attr] + cmp [@attr],0FFFFh + jne @@notlastattr + mov ch,[cs:colors] +@@notlastattr: + cmp [cs:graphic],1 + jne @@textaccess call emulatechar - jmp adjusttext -textaccess: + 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 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 addline +@@noadjusted: call setcursor - pop es di dx cx bx ax ret +endp showchar setcursor: push ax cx dx - cmp cs:cursor,1 + cmp [cs:cursor],1 jne notshow - mov dx,CCRT + mov dx,ccrt mov al,0Eh - mov cx,cs:xy + mov cx,[cs:xy] shr cx,1 mov ah,ch out dx,ax @@ -1021,24 +1003,24 @@ emulatechar: and di,11111111b shl di,3 add di,offset font8x8 - mov bl,cs:x - mov cl,cs:y + mov bl,[cs:x] + mov cl,[cs:y] xor bh,bh xor ch,ch shl bx,3 shl cx,3 - mov ah,cs:[di] + mov ah,[cs:di] xor dx,dx bouclet: rol ah,1 push ax jc colored shr al,4 - cmp cs:style,0 + cmp [cs:style],0 jnz transparent colored: - and al,1111b - call showpixel + and ax,1111b + call showpixel,bx,cx,ax transparent: pop ax inc bx @@ -1046,7 +1028,7 @@ transparent: cmp dl,8 jb bouclet inc di - mov ah,cs:[di] + mov ah,[cs:di] xor dl,dl sub bx,8 inc cx @@ -1063,9 +1045,9 @@ ended: savescreen: push ax cx dx si di bp ds es gs mov bp,sp -mov dx,ss:[bp+22] +mov dx,[ss:bp+22] mov ah,2 -mov cx,cs:pagesize +mov cx,[cs:pagesize] push cs pop ds mov si,offset data3 @@ -1083,12 +1065,12 @@ data3 db '/vgascreen',0 ;===================================sauve l'ecran rapidement en es:di================ -SaveScreento: +savescreento: push cx si di ds mov cx,0B800h mov ds,cx xor ecx,ecx - mov cx,cs:pagesize + mov cx,[cs:pagesize] shr cx,2 xor si,si cld @@ -1097,7 +1079,7 @@ SaveScreento: ret ;===================================sauve les parametres en es:di================ -Saveparamto: +saveparamto: push ecx si di ds push cs pop ds @@ -1110,7 +1092,7 @@ Saveparamto: ret ;===================================restore les parametres depuis en ds:si================ -Restoreparamfrom: +restoreparamfrom: push ecx si di es push cs pop es @@ -1123,10 +1105,10 @@ Restoreparamfrom: ret ;R‚cupŠre l'ecran de la carte depuis son bloc mémoire -RestoreScreen: +restorescreen: push ax dx si bp ds gs mov bp,sp -mov dx,ss:[bp+16] +mov dx,[ss:bp+16] push cs pop ds mov si,offset data3 @@ -1140,12 +1122,12 @@ pop gs ds bp si dx ax ret ;===================================restore l'ecran rapidement de ds:si================ -RestoreScreenfrom: +restorescreenfrom: push ecx si di ds es mov cx,0B800H mov es,cx xor ecx,ecx - mov cx,cs:pagesize + mov cx,[cs:pagesize] shr cx,2 xor di,di cld @@ -1156,15 +1138,15 @@ RestoreScreenfrom: ;===============================Page2to1============================ -Page2to1: +page2to1: push ecx si di ds es mov cx,0B800H mov es,cx mov ds,cx xor ecx,ecx - mov cx,cs:pagesize + mov cx,[cs:pagesize] shr cx,2 - mov si,cs:pagesize + mov si,[cs:pagesize] xor di,di cld rep movsd @@ -1172,15 +1154,15 @@ Page2to1: ret ;===============================Page1to2============================ -Page1to2: +page1to2: push ecx si di ds es mov cx,0B800H mov es,cx mov ds,cx xor ecx,ecx - mov cx,cs:pagesize + mov cx,[cs:pagesize] shr cx,2 - mov di,cs:pagesize + mov di,[cs:pagesize] xor si,si cld rep movsd @@ -1188,196 +1170,195 @@ Page1to2: ret ;===============================xchgPages============================ -xchgPages: -push ax cx dx si di bp ds es gs -mov bp,sp -mov dx,ss:[bp+22] -mov ah,2 -mov cx,datablocksize -add cx,cs:pagesize -add cx,3*256 -push cs -pop ds -mov si,offset data4 -int 49h -mov ah,6 -int 49h -push gs -pop es -xor di,di -call savescreento -call Page2to1 -push gs -pop ds -xor si,si -mov cx,0B800H -mov es,cx -mov di,cs:pagesize -xor ecx,ecx -mov cx,cs:pagesize -shr cx,2 -cld -rep movsd -mov ah,01h -int 49h -pop gs es ds bp di si dx cx ax -ret - -data4 db '/vgatemp',0 +;xchgpages: +;push ax cx dx si di bp ds es gs +;mov bp,sp +;mov dx,[ss:bp+22] +;mov ah,2 +;mov cx,datablocksize +;add cx,[cs:pagesize] +;add cx,3*256 +;push cs +;pop ds +;mov si,offset data4 +;int 49h +;mov ah,6 +;int 49h +;push gs +;pop es +;xor di,di +;call savescreento +;call page2to1 +;push gs +;pop ds +;xor si,si +;mov cx,0B800H +;mov es,cx +;mov di,[cs:pagesize] +;xor ecx,ecx +;mov cx,[cs:pagesize] +;shr cx,2 +;cld +;rep movsd +;mov ah,01h +;int 49h +;pop gs es ds bp di si dx cx ax +;ret +; +;data4 db '/vgatemp',0 ;Sauve l'‚tat de la carte dans un bloc mémoire -savestate: -push ax cx dx si di bp ds es gs -mov bp,sp -mov dx,ss:[bp+22] -mov ah,2 -mov cx,datablocksize -add cx,cs:pagesize -add cx,3*256 -push cs -pop ds -mov si,offset data -int 49h -mov ah,6 -int 49h -push gs -pop es -xor di,di -call saveparamto -add di,datablocksize -call savescreento -add di,cs:pagesize -call savedacto -pop gs es ds bp di si dx cx ax -ret +;savestate: +;push ax cx dx si di bp ds es gs +;mov bp,sp +;mov dx,[ss:bp+22] +;mov ah,2 +;mov cx,datablocksize +;add cx,[cs:pagesize] +;add cx,3*256 +;push cs +;pop ds +;mov si,offset data +;int 49h +;mov ah,6 +;int 49h +;push gs +;pop es +;xor di,di +;call saveparamto +;add di,datablocksize +;call savescreento +;add di,[cs:pagesize] +;call savedacto +;pop gs es ds bp di si dx cx ax +;ret -data db '/vga',0 +;data db '/vga',0 ;R‚cupŠre l'‚tat de la carte depuis son bloc mémoire -restorestate: -push ax dx si bp ds gs -mov bp,sp -mov dx,ss:[bp+16] -push cs -pop ds -mov si,offset data -mov ah,9 -int 49h -push gs -pop ds -mov al,ds:[7] -cmp cs:mode,al -je nochangemode -mov ah,0 -call setvideomode -nochangemode: -xor si,si -call restoreparamfrom -add si,datablocksize -call restorescreenfrom -add si,cs:pagesize -call restoredacfrom -pop gs ds bp si dx ax -ret +;restorestate: +;push ax dx si bp ds gs +;mov bp,sp +;mov dx,[ss:bp+16] +;push cs +;pop ds +;mov si,offset data +;mov ah,9 +;int 49h +;push gs +;pop ds +;mov al,[ds:7] +;cmp [cs:mode],al +;je nochangemode +;mov ah,0 +;call setvideomode +;nochangemode: +;xor si,si +;call restoreparamfrom +;add si,datablocksize +;call restorescreenfrom +;add si,[cs:pagesize] +;call restoredacfrom +;pop gs ds bp si dx ax +;ret ;sauve le DAC dans un bloc de mémoire -savedac: -push ax cx dx si di bp ds es gs -mov bp,sp -mov dx,ss:[bp+22] -mov ah,2 -mov cx,3*256 -push cs -pop ds -mov si,offset data2 -int 49h -mov ah,6 -int 49h -push gs -pop es -xor di,di -call savedacto -pop gs es ds bp di si dx cx ax -ret +;savedac: +;push ax cx dx si di bp ds es gs +;mov bp,sp +;mov dx,[ss:bp+22] +;mov ah,2 +;mov cx,3*256 +;push cs +;pop ds +;mov si,offset data2 +;int 49h +;mov ah,6 +;int 49h +;push gs +;pop es +;xor di,di +;call savedacto +;pop gs es ds bp di si dx cx ax +;ret -data2 db '/vgadac',0 +;data2 db '/vgadac',0 ;R‚cupŠre le dac depuis son bloc mémoire -restoredac: -push ax dx si bp ds gs -mov bp,sp -mov dx,ss:[bp+16] -push cs -pop ds -mov si,offset data2 -mov ah,9 -int 49h -push gs -pop ds -xor si,si -call restoredacfrom -pop gs ds bp si dx ax -ret +;restoredac: +;push ax dx si bp ds gs +;mov bp,sp +;mov dx,[ss:bp+16] +;push cs +;pop ds +;mov si,offset data2 +;mov ah,9 +;int 49h +;push gs +;pop ds +;xor si,si +;call restoredacfrom +;pop gs ds bp si dx ax +;ret ;sauve le DAC en es:di -savedacto: -push ax cx dx di -mov dx,3C7h -mov cx,256 -save: -mov al,cl -dec al -out dx,al -inc dx -inc dx -in al,dx -mov es:[di],al -inc di -in al,dx -mov es:[di],al -inc di -in al,dx -mov es:[di],al -inc di -dec dx -dec dx -dec cx -jne save -pop di dx cx ax -ret +;savedacto: +;push ax cx dx di +;mov dx,3C7h +;mov cx,256 +;save: +;mov al,cl +;dec al +;out dx,al +;inc dx +;inc dx +;in al,dx +;mov [es:di],al +;inc di +;in al,dx +;mov [es:di],al +;inc di +;in al,dx +;mov [es:di],al +;inc di +;dec dx +;dec dx +;dec cx +;jne save +;pop di dx cx ax +;ret ;restore le DAC depuis ds:si -restoredacfrom: -push ax cx dx si -xor ax,ax -mov dx,3C8h -mov cx,256 -save2: -mov al,cl -dec al -out dx,al -inc dx -mov al,ds:[si] -inc si -out dx,al -mov al,ds:[si] -inc si -out dx,al -mov al,ds:[si] -inc si -out dx,al -dec dx -dec cx -jne save2 -pop si dx cx ax -ret +;restoredacfrom: +;push ax cx dx si +;xor ax,ax +;mov dx,3C8h +;mov cx,256 +;save2: +;mov al,cl +;dec al +;out dx,al +;inc dx +;mov al,[ds:si] +;inc si +;out dx,al +;mov al,[ds:si] +;inc si +;out dx,al +;mov al,[ds:si] +;inc si +;out dx,al +;dec dx +;dec cx +;jne save2 +;pop si dx cx ax +;ret font8x8: -include ..\include\pol8x8.inc +include "..\include\pol8x8.inc" font8x16: -include ..\include\pol8x16.inc +include "..\include\pol8x16.inc" -end start