diff --git a/asm.bat b/asm.bat index c8bb1bc..9e704ec 100755 --- a/asm.bat +++ b/asm.bat @@ -1,7 +1,10 @@ @echo off del system.bin -copy id.com system.bin tasm boot.asm /t/x/m4 +tasm mem.asm /t/x/m4 +tasm choise.asm /t/x/m4 +tasm vg2.asm /t/x/m4 +tasm sect.asm /t/x/m4 tlink boot.obj /x del boot.obj exe2boot.com diff --git a/boot.asm b/boot.asm index a38e088..1418c6a 100755 --- a/boot.asm +++ b/boot.asm @@ -34,7 +34,7 @@ okloading db 'COS search system',0Dh,0ah,0 syst db 'Ok',0dh,0ah,0 dot db '.',0 carry db 0dh,0ah,0 -Sys db 'System file',0 +Sys db 'system ',0 sys2 db 'sys',0 errorboot: diff --git a/choice.asm b/choice.asm index d766dce..3034e24 100755 --- a/choice.asm +++ b/choice.asm @@ -5,32 +5,56 @@ smart org 0100h -start: + + +start: +mov cx,23 +mov bx,8400h +mov es,bx +mov bx,100h +call loadfatway +mov di,bx +mov bx,47h +call setint +ret +mov bx,9 +call getint +mov cs:int9seg,ds +mov cs:int9off,si +push cs +pop es +mov di,offset int9 +call setint +start2: push cs push cs pop ds pop es -call clear -mov ax,0 -call setxy -mov si,offset msg -call showstring0 -mov di,0 -mov al,112 -call changeattrib -call line -call line -mov si,offset mssg -call showstring0 -call line -mov si,offset msg2 -call showstring0 -call line +mov ah,21 +mov cl,7 +int 47h +mov ax,0002 +int 47h +mov ah,2 +int 47h +mov ah,25 +mov bx,0 +int 47h +mov ah,13 +mov si,offset msg1 +int 47h +mov ah,6 +int 47h +int 47h +mov ah,13 +mov si,offset prompt +int 47h +mov ah,6 +int 47h xor di,di mov bx,offset buffer mov cx,13 call readsector -jc fin2 xor bp,bp showall: cmp byte ptr [bx+di],0 @@ -39,117 +63,118 @@ mov al,[bx+di+12] mov byte ptr [bx+di+12],0 mov si,bx add si,di -call showstring0 +mov ah,13 +int 47h mov si,offset spaces -call showstring0 +int 47h mov [bx+di+12],al mov byte ptr [bx+di+12+5],0 mov si,bx add si,di add si,12 -call showstring0 -call line +int 47h +mov ah,6 +int 47h add di,32 inc bp jmp showall endof2: +mov xx,1 +mov xxold,2 call Select endof: mov ax,0 int 16h cmp ah,50h jne tre1 - cmp xxx,bp + cmp xx,bp je endof - inc xxx + inc xx call select jmp endof tre1: cmp ah,48h jne tre2 - cmp xxx,1 + cmp xx,1 je endof - dec xxx + dec xx call select jmp endof tre2: cmp al,0Dh - je fin2 jne tre3 - mov di,xxx + mov di,xx dec di shl di,5 mov cx,[di+bx+26] - call line - call line - mov si,offset msgg - call showstring0 - call executefat + mov ah,6 + int 47h + int 47h + mov ah,13 + mov si,offset msg2 + int 47h + call executefatway tre3: - cmp ah,3bh + cmp ah,59 jne endof -mov di,0 -mov cx,1 -mov al,7 -call changeattribword - mov si,offset popup - mov ax,0200h - call popupmenu -mov di,0 -mov cx,1 -mov al,112 -call changeattribword - jmp endof -fin2: -ret + mov lastread,0FFFFh + jmp start2 - -popup db 4,'&New' - db 5,'&Open' - db 1,'-' - db 7,'&Delete' - db 7,'R&ename' - db 5,'&Copy' - db 5,'&Link' - db 1,'-' - db 8,'&Restart' - db 10,'&Shut down' - db 1,'-' - db 12,'&About me...' - db 0 - db 070h ;couleur normale - db 07Fh ;couleur speciale - db 07h ;couleur select - -executefat: -push cs -mov bx,offset start -push bx -mov bx,6000h -mov es,bx -push bx -mov bx,0100h -push bx -mov si,offset dot +executefatway: + push cs + mov bx,offset start2 + push bx + mov bx,03000h + mov es,bx + push bx + mov bx,0100h + push bx + call loadfatway + push es + push es + push es + pop ds + pop fs + pop gs + push 7202h + popf + db 0CBh + +;cx entr‚e -> fatway chemin +getfatway: +push bx cx es +mov bx,offset fatway fatagain: +mov cs:[bx],cx +add bx,2 cmp cx,0FFF0h jae finishload -call readsector -jc fin2 -call showstring0 -add bx,sizec call getfat jnc fatagain -finishload: -push es -push es -push es -pop ds -pop fs -pop gs -push 7202h -popf -db 0CBh +finishload: +pop es cx bx +ret + +loadfatway: +push bx cx di +call getfatway +jc endload +mov di,offset fatway +mov si,offset dot +mov ah,13 +loadagain: +mov cx,cs:[di] +cmp cx,0FFF0h +jae endload +add di,2 +call readsector +jc endload +int 47h +add bx,cs:sizec +jmp loadagain +endload: +pop di cx bx +ret sizec dw 512 reserv dw 1 @@ -159,9 +184,9 @@ getfat: push es ax bx dx mov ax,cx xor dx,dx -div sizec +div cs:sizec mov cx,ax -add cx,reserv +add cx,cs:reserv mov bx,offset buffer push cs pop es @@ -169,7 +194,7 @@ call readsector jc errorgetfat shl dx,1 add bx,dx -mov cx,[bx] +mov cx,cs:[bx] errorgetfat: pop dx bx ax es ret @@ -179,342 +204,27 @@ Select: push ax di mov di,xxold mov al,7 -add di,3 -call changeattrib -mov ax,xxx +add di,2 +mov ah,32 +int 47h +mov ax,xx mov xxold,ax -mov di,xxx +mov di,xx +mov ah,32 mov al,112 -add di,3 -call changeattrib +add di,2 +int 47h pop di ax -ret - -;couleur al pour ligne di mot cx -Changeattribword: -push bp bx dx di es -mov dx,0B800h -mov es,dx -mov dx,di -shl dx,5 -shl di,7 -add di,dx -mov dx,80 -xor bp,bp -xor bx,bx -popp: -cmp byte ptr es:[di],' ' -je noway -cmp bx,1 -je noway2 -mov bx,1 -inc bp -cmp cx,bp -ja fint -jmp noway2 -noway: -xor bx,bx -noway2: -cmp bp,cx -jne noway3 -mov es:[di-1],al -noway3: -add di,2 -dec dx -jnz popp -fint: -pop es di dx bx bp -ret - - -;couleur al pour ligne di -changeattrib: -push dx di es -mov dx,0B800h -mov es,dx -mov dx,di -shl dx,5 -shl di,7 -add di,dx -mov cx,80 -inc di -popep: -mov es:[di],al -add di,2 -dec cx -jnz popep -pop es di dx -ret - -colors db 7 -xy dw 0 -x db 0 -y db 0 -xxx dw 1 -xxold dw 0 -msg db ' File Edition',0 -mssg db 'Cos 2000 menu loader release 1.0',0 -msg2 db '>',0 -spaces db ' ',0 -dot db '.',0 -msgg db 'Chargement du programme',0 - -;==========SHOWCHAR=========== -;met un caractŠre apr‚s le curseur -;-> dl -;<- -;============================= -showchar: -push dx bx es -mov bx,0B800h -mov es,bx -mov bx,cs:xy -mov dh,cs:colors -mov es:[bx],dx -add cs:xy,2 -pop es bx dx -ret - - - -;==========SPACE=========== -;met un espace apr‚s le curseur -;-> -;<- -;============================= -space: -push bx es -add cs:xy,2 -mov bx,0B800h -mov es,bx -mov bx,cs:xy -mov byte ptr es:[bx],' ' -pop es bx -ret - -;==============================Affiche le nombre nb binaire en EDX============== -ShowbinRow: - push es ax bx cx di - mov di,cs:xy - mov bx,0B800h - mov es,bx - mov ax,cx - sub cx,32 - neg cx - shl edx,cl - mov ch,cs:colors -binaize: - rol edx,1 - mov cl,'0' - adc cl,0 - mov es:[di],cx - add di,2 - dec al - jnz binaize - mov cs:xy,di - pop di cx bx ax es - ret - -;==========SETCOLOR========= -;Change les attributs du texte a CL -;-> CL -;<- -;============================= -setcolor: -mov cs:colors,CL -ret - -;=============CLEAR========= -;Efface l'ecran texte -;-> -;<- -;============================= -clear: -push es eax cx di -xor di,di -mov ax,0b800h -mov es,ax -mov eax,07200720h -mov cx,1000 -cld -rep stosd -pop di cx eax es -ret - -;==========SCROLLDOWN========= -;defile de cx lines vers le bas -;-> CX -;<- -;============================= -scrolldown: -push cx si di ds es -mov si,0B800h -mov es,si -mov ds,si -mov si,cx -shl si,5 -shl cx,7 -add si,cx -mov cx,4000 -sub cx,si -xor di,di -cld -rep movsb -pop es ds di si cx -ret - -;==========LINE========= -;remet le curseur a la ligne -;-> -;<- -;============================= -line: -push ax cx di es -mov ah,cs:x -mov al,cs:y -xor ah,ah -cmp al,24 -jne scro -dec al -mov cl,1 -call scrolldown -scro: -inc al -call setxy -pop es di cx ax -ret - -;==========SETXY========= -;Change les coordonnées du curseur a X:AL,Y:AH -;-> AX -;<- es di -;============================= -setxy: -push ax bx di -mov cs:x,ah -mov cs:y,al -mov bl,ah -xor bh,bh -xor ah,ah -mov di,ax -shl di,5 -shl ax,7 -shl bx,1 -add di,ax -add di,bx -mov cs:xy,di -pop di bx ax -ret - -;================Affiche la chaine 0 de caractŠre contenue dans ds:si -showstring0: - push es cx si di - mov di,cs:xy - mov cx,0B800h - mov es,cx - mov ch,cs:colors -strinaize0: - mov cl,[si] - cmp cl,0 - je no0 - mov es:[di],cx - add di,2 - inc si - jmp strinaize0 - no0: - mov cs:xy,di - pop di si cx es - ret - -;==============================Affiche le nombre nb hexa en EDX============== -ShowHexRow: - push es ax bx cx di - mov di,cs:xy - mov bx,0B800h - mov es,bx - mov ax,cx - sub cx,32 - neg cx - shl edx,cl - mov ch,cs:colors - shr ax,2 -Hexaize: - rol edx,4 - mov bx,dx - and bx,0fh - mov cl,cs:[bx+offset Tab] - mov es:[di],cx - add di,2 - dec al - jnz Hexaize - mov cs:xy,di - pop di cx bx ax es - ret -Tab db '0123456789ABCDEF' -ret - -;===================================sauve l'ecran rapidement================ -SaveScreen: - push cx si di ds es - mov cx,0B800H - mov ds,cx - push cs - pop es - mov cx,(80*25*2)/4 - xor si,si - mov di,offset Copy2 - cld - rep movsd - pop es ds di si cx - ret - - -;===================================sauve l'ecran rapidement================ -RestoreScreen: - push cx si di ds es - mov cx,0B800H - mov es,cx - push cs - pop ds - mov cx,(80*25*2)/4 - mov si,offset Copy2 - xor di,di - cld - rep movsd - pop es ds di si cx - ret - -;===================================Afficher un int EDX a l'‚cran en ah,al================ -ShowInt: - push eax bx cx edx esi di es ds - mov di,cs:xy - mov cx,0B800h - mov es,cx - xor cx,cx - mov eax,edx - mov esi,10 - mov bx,offset showbuffer+27 -decint3: - xor edx,edx - div esi - add dl,'0' - mov dh,cs:colors - sub bx,2 - add cx,2 - mov cs:[bx],dx - cmp ax,0 - jne decint3 - mov si,bx - push cs - pop ds - cld - rep movsb - mov cs:xy,di - pop ds es di esi edx cx bx eax ret -showbuffer db 35 dup (0FFh) -Lastread dw 0FFFFh +xx dw 1 +xxold dw 0 +msg1 db 'Cos 2000 menu loader release 1.0',0 +msg2 db 'Program loading',0 +prompt db '>',0 +spaces db ' ',0 +dot db '.',0 + ReadSector: push ax cx dx si @@ -550,9 +260,8 @@ TryAgain: mov word ptr cs:lastread,0ffffh Done: pop si dx cx ax -ret +ret -WriteSector: push ax cx dx si cmp cs:Lastread,cx jne nodestruct @@ -588,13 +297,213 @@ Done2: pop si dx cx ax ret -include menu.Asm +Lastread dw 0FFFFh +WriteSector: + + +;met es:di le handle de l'int bx +setint: +push ax bx ds +cli +shl bx,2 +xor ax,ax +mov ds,ax +mov ds:[bx],di +mov ds:[bx+2],es +pop ds bx ax +sti +ret + +;met ds:si le handle de l'int bx +getint: +push ax bx es +cli +shl bx,2 +xor ax,ax +mov es,ax +mov si,es:[bx] +mov ds,es:[bx+2] +pop es bx ax +sti +ret + +int9off dw 0 +int9seg dw 0 + +int9: + pushf + db 2eh,0ffh,1eh + dw int9off + cli + pusha + in al,60h + cmp cs:isstate,1 + jne nostate + cmp al,57 + jne nof12 + mov cs:isstate,0 + jmp noF12 + nostate: + cmp al,87 + jne NoF11 + push es + push cs + pop es + mov di,offset infos + mov ah,34 + int 47h + mov al,cs:infos+7 + inc al + and ax,11b + int 47h + pop es + + nof11: + cmp al,88 + jne NoF12 + mov ah,26 + int 47h + call showstate + mov cs:isstate,1 + sti + waitt: + cmp cs:isstate,0 + jne waitt + mov ah,27 + int 47h + noF12: + popa + sti + iret + isstate db 0 + infos db 10 dup (0) + + showstate: + push ds es + push ss + push gs + push fs + push es + push ds + push cs + pushad + pushfd + + push cs + push cs + pop es + pop ds + mov ah,2 + int 47h + mov ah,21 + mov cl,4 + int 47h + mov ah,13 + mov si,offset reg + int 47h + mov ah,6 + int 47h + mov ah,21 + mov cl,7 + int 47h + mov ah,13 + mov si,offset fla + int 47h + pop edx + mov cx,32 + mov ah,11 + int 47h + mov ah,5 + int 47h + mov ah,10 + int 47h + mov si,offset regs + mov bx,8+6 + mov ah,21 + mov cl,6 + int 47h +showallREG: + mov ah,6 + int 47h + cmp bx,7 + jb nodr + pop edx + jmp popo + nodr: + mov ah,21 + mov cl,1 + int 47h + xor edx,edx + pop dx + popo: + mov ah,13 + int 47h + mov ah,10 + mov cx,32 + int 47h + mov ah,5 + int 47h + push si + mov si,offset gr + mov ah,13 + int 47h + mov ah,8 + int 47h + mov si,offset dr + mov ah,13 + int 47h + pop si + add si,5 + dec bx + jnz showallreg + mov ah,34 + mov di,offset infos + int 47h + mov ah,25 + mov bl,cs:infos + xor bh,bh + dec bl + int 47h + mov si,offset app + mov ah,13 + int 47h + mov ah,32 + mov bl,cs:infos + xor bh,bh + mov di,ax + dec di + mov cl,116 + int 47h + pop es ds + ret + +reg db 'State of registers',0 +fla db 'Flags:',0 +regs db 'EDI:',0 + db 'ESI:',0 + db 'EBP:',0 + db 'ESP:',0 + db 'EBX:',0 + db 'EDX:',0 + db 'ECX:',0 + db 'EAX:',0 + db ' CS:',0 + db ' DS:',0 + db ' ES:',0 + db ' FS:',0 + db ' GS:',0 + db ' SS:',0 +gr db '(',0 +dr db ')',0 +app db 'Press enter to quit...',0 + + DiskSectorsPerTrack dw 18 DiskTracksPerHead dw 80 DiskHeads dw 2 -copy2 equ $ -buffer equ $ +fatway equ $ +buffer equ $+3000 end start diff --git a/cosinit.asm b/cosinit.asm new file mode 100755 index 0000000..998bc4f --- /dev/null +++ b/cosinit.asm @@ -0,0 +1,224 @@ +.model tiny +.486 +smart +.code + +org 0100h + +ent equ 32h + +start: +jmp CopyCOS + +DiskSectorsPerTrack dw 18 +DiskTracksPerHead dw 80 +DiskHeads dw 2 +NameBoot db 'Boot.bin',0 +Namesystem db 'System.bin',0 +Message db 0Ah,0Dh,'Installation of the COS (Celyn Operating System) !!',0Ah,0Dh,'Written By Nico',0Ah,0Dh,'Copyright 2000',0Ah,0Dh,'Please insert a floppy disk and press a key...',0Ah,0Dh,'Be careful! All the disk is going to be deleted',0Ah,0dh,'$' +Message2 db 0Ah,0Dh,'Create boot sector$' +systfile db 0Ah,0Dh,'Creating file allocation table 16 bits$' +systfile2 db 0Ah,0Dh,'Creating file information table 32 bytes$' +systfile3 db 0Ah,0Dh,'Creating operating system files$' +Errormsg db 0Ah,0Dh,0Ah,0Dh,'An error has stopped the copying process !',0Ah,0Dh,'$' +Ok db 0Ah,0Dh,0Ah,0Dh,'The boot sector and the system files had been succefully copied.',0Ah,0Dh, 'To try COS reboot with this system disk',0Ah,0Dh,0Ah,0Dh,'$' + +entrie db 'System file',0 + db 'sys',0,0 + dw 1234h + dw 1234h + dw 1234h + dw 1234h + db 0h + dw ent + dw 512 + dw 0h + dw 0 + + +CopyCOS: +mov ah,09 +mov dx,offset message +int 21h +jc error +mov ax,0 +int 16h +mov ah,09 +mov dx,offset message2 +int 21h +mov ax,3D00h +mov dx,offset nameboot +int 21h +jc error +mov bx,ax +mov ax,4202h +xor cx,cx +xor dx,dx +int 21h +jc error +cmp dx,0 +jne error +cmp ax,512 +jne error +mov ax,4200h +xor cx,cx +xor dx,dx +int 21h +jc error +mov ah,3fh +mov cx,512 +mov dx,offset buffer +int 21h +jc error +mov ah,3eh +int 21h +jc error +mov cx,0 +mov bx,dx +call writesector +jne error +jc error +mov ah,09 +mov dx,offset systfile3 +int 21h +jc error +mov ax,3D00h +mov dx,offset namesystem +int 21h +jc error +mov bx,ax +mov ax,4202h +xor cx,cx +xor dx,dx +int 21h +jc error +cmp dx,0 +jne error +sub ax,1 ;+512 +cmp ax,0 +jl error +shr ax,9 +inc ax +mov bp,ax +mov ax,4200h +xor cx,cx +xor dx,dx +int 21h +jc error +mov ah,3fh +mov cx,0FFFFh +mov dx,offset buffer +int 21h +jc error +mov bx,dx +mov cx,ent +mov dx,bp +syst: +call writesector +jne error +add bx,512 +inc cx +dec dx +jnz syst +ret ;++++++++++++++++++= +mov ah,09 +mov dx,offset systfile +int 21h +mov cx,512/4 +mov di,bx +mov eax,0 +rep stosd +mov cx,13 +fatanymore: +call writesector +jne error +dec cx +cmp cx,1 +ja fatanymore +mov di,bx +mov ax,0FFF0h +mov cx,13 +rep stosw +mov ax,0FFFFh +stosw +mov si,ent +dec bp +makefat: +mov ax,si +inc ax +shl si,1 +mov [bx+si],ax +mov si,ax +dec bp +jnz makefat +shl si,1 +mov word ptr [bx+si],0ffffh +mov cx,1 +call writesector +jne error +mov ah,09 +mov dx,offset systfile2 +int 21h +jc error +mov cx,13 +mov bx,offset entrie +call writesector +jne error +mov ah,09 +mov dx,offset ok +int 21h +jc error +ret +error: +mov ah,09 +mov dx,offset errormsg +int 21h +ret + + + + + + + +WriteSector: +push cx dx si + mov AX, CX + xor DX, DX + div DiskSectorsPerTrack + mov CL, DL ;{ Set the sector } + and CL, 63 ;{ Top two bits are bits 8&9 of the cylinder } + xor DX, DX + div DiskTracksPerHead + mov CH, DL ;{ Set the track bits 0-7 } + mov AL, DH + ror AL, 1 + ror AL, 1 + and AL, 11000000b + or CL, AL ;{ Set bits 8&9 of track } + xor DX, DX + div DiskHeads + mov DH, DL ;{ Set the head } + inc CL + mov SI, 4 +TryAgain: + mov AL, 1 + mov DL, 0 + mov AH, 3 + int 13h + jnc Done + dec SI + jnz TryAgain +Done: + mov cl, AH + mov ah,9 + mov dx,offset sign + int 21h + cmp cl,0 + pop si dx cx +ret + +sign db '.$' +buffer db 512 dup (0) + +end start diff --git a/exe2boot.asm b/exe2boot.asm deleted file mode 100755 index 2849930..0000000 --- a/exe2boot.asm +++ /dev/null @@ -1,67 +0,0 @@ -.model tiny -.486 -smart -.code - -org 0100h - - -start: -jmp transform -NameBoot db 'Boot.exe',0 -nameboot2 db 'Boot.bin',0 -buffer db 510 dup (0) - dw 0AA55h -message db 0ah,0dh,'Transformation of boot.com to boot.bin...',0ah,0dh,'By Horde Nicolas',0ah,0dh,'Copyright 2000',0ah,0dh,'$' -ok db 0ah,0dh,'The transformation was done succefully !',0ah,0dh,'$' -errormsg db 0ah,0dh,'Some errors has been detected !',0ah,0dh,'$' -transform: -mov ah,09 -mov dx,offset message -int 21h -mov ax,3D00h -mov dx,offset nameboot -int 21h -jc error -mov bx,ax -mov ax,4202h -xor cx,cx -xor dx,dx -int 21h -jc error -cmp dx,0 -jne error -mov ax,4200h -xor cx,cx -mov dx,7E00h -int 21h -jc error -mov ah,3fh -mov cx,512 -mov dx,offset buffer -int 21h -jc error -mov ah,3eh -int 21h -jc error -mov ah,3ch -xor cx,cx -mov dx,offset nameboot2 -int 21h -jc error -mov ah,40h -mov cx,512 -mov dx,offset buffer -int 21h -jc error -mov ah,09 -mov dx,offset ok -int 21h -ret -error: -mov ah,09 -mov dx,offset errormsg -int 21h -ret - -end start diff --git a/id.asm b/id.asm deleted file mode 100755 index 1f568f3..0000000 --- a/id.asm +++ /dev/null @@ -1,367 +0,0 @@ -.model tiny -.386c -.code -org 0100h - - colores equ 7 - - -logoY equ 064h -logo2X equ 0A0h -logo2Y equ 064h -ecartlogo2 equ 13Eh -logocoordsize equ 0B40h -logo2coordsize equ 26Ch -zoomout equ 43h - - - -start: - xor eax,eax - xor ebx,ebx - xor ecx,ecx - xor edx,edx - xor esi,esi - xor edi,edi - mov ax,13h - int 10h - - mov dx,3C8h - mov al,7 - out dx,al - inc dx - xor al,al - out dx,al - out dx,al - out dx,al - mov si,offset logo2text - call showstr - mov ax,0A000h - mov ds,ax - push ds - push es - push cs - mov di,logo2coord - mov cx,logo2coordsize - xor si,si - xor dx,dx - xor bx,bx - -loopcoord2: - lodsb - or al,al - jz nothingcoord2 - mov ax,dx - sub ax,5Ah - stosw - mov ax,bx - sub ax,14h - stosw - inc cs:nblogo2 -nothingcoord2: - add dx,3 - cmp dx,0BAh - jne short loc_3 - xor dx,dx - add si,102h - add bx,4 -loc_3: - loop loopcoord2 - - pop ds - call zerocurs - mov si,offset data6 - call showstr - - pop es - pop ds - mov cx,logocoordsize - xor si,si - xor dx,dx - xor bx,bx - -loopcoord: - lodsb - or al,al - jz nothingcoord - mov ax,dx - sub ax,32h - stosw - mov ax,bx - shl ax,1 - sub ax,1Eh - stosw - inc cs:nblogo -nothingcoord: - inc dx - inc dx - cmp dx,60h - jne short loc_6 - xor dx,dx - add si,110h - inc bx -loc_6: - loop loopcoord - - push ds - pop es - push cs - pop ds -masterloop: - inc logox ;++++ - inc data_10 - mov bl,data_10 - xor bh,bh - mov al,data_1[bx] - cbw - mov data_11,ax - add bl,zoomout - mov al,data_1[bx] - cbw - mov data_12,ax - mov cx,nblogo2 - push cx - push cx - mov si,logo2coord - -showlogo2: - lodsw - mov data_7,ax - lodsw - mov data_8,ax - mov data_9,0FFCEh - push cx - push si - mov si,offset data_8 - push si - mov di,offset data_9 - call sub_1 - mov si,offset data_7 - call sub_1 - pop di - call sub_1 - pop si - mov ax,100h - imul data_7 - mov bx,data_9 - add bx,140h - idiv bx - add ax,logo2X - mov bp,ax - mov ax,100h - imul data_8 - mov bx,data_9 - add bx,140h - idiv bx - add ax,logo2Y - mov bx,140h - imul bx - add ax,bp - mov di,ax - push si - sub si,logo2coord - shr si,1 - mov ds:data_16e[si],di - pop si - mov bx,data_9 - mov cl,4 - shr bx,cl - pop cx - mov al,17h - sub al,bl - mov ah,al - stosw - add di,ecartlogo2 - stosw - loop showlogo2 - - pop si - shl si,1 - shl si,1 - add si,logo2coord - mov cx,nblogo - -showlogo: - push cx - lodsw - imul data_12 - mov di,ax - lodsw - imul data_11 - sub di,ax - mov cl,7 - sar di,cl - add di,logoX - mov bx,di - sub si,4 - lodsw - imul data_11 - mov di,ax - lodsw - imul data_12 - add di,ax - sar di,cl - add di,logoy - mov ax,140h - imul di - add ax,bx - mov di,ax - pop cx - mov ax,cx - shl ax,1 - mov bx,data_17e - add bx,ax - mov [bx],di - mov al,28h - stosb - loop showlogo - - mov dx,3DAh - -synchro: - in al,dx - test al,8 - jnz synchro -synchroagain: - in al,dx - test al,8 - jz synchroagain - mov si,data_16e - pop cx - add cx,nblogo - add cx,14h - -showlogo2effect: - lodsw - mov di,ax - xor ax,ax - stosw - add di,ecartlogo2 - stosw - loop showlogo2effect - - in al,60h - cmp al,1 - je endofprog - jmp masterloop -endofprog: - mov ax,3 - int 10h - int 20h - ret - - -sub_1 proc near - mov ax,[si] - imul data_12 - mov bp,ax - mov ax,[di] - imul data_11 - sub bp,ax - mov cl,7 - sar bp,cl - push bp - mov ax,[si] - imul data_11 - mov bp,ax - mov ax,[di] - imul data_12 - add bp,ax - sar bp,cl - mov [di],bp - pop ax - mov [si],ax - retn -sub_1 endp - -showcrlf: - push ax bx - mov ax, 0E0Dh - xor bx, bx - int 10h - mov al, 0Ah - int 10h - pop bx ax -ret - -zerocurs: -push ax bx dx -mov ah,02h -mov bh,0 -mov dx,0 -int 10h -pop dx bx ax -ret - -showstr: - push ax bx si -again: - lodsb - or al,al - jz fin - cmp al,0Dh - jne noret - call showcrlf - jmp again -noret: - mov ah,0Eh - mov bx,colores - int 10h - jmp again - fin: - pop si bx ax - ret -logoX dw 0A0h ;++++ - - -data_1 db 0 - db 03h, 06h, 09h, 0Ch, 10h, 13h - db 16h, 19h, 1Ch, 1Fh - db '"%(+.1369 dl -;<- -;============================= -showchar: -push dx bx es -mov bx,0B800h -mov es,bx -mov bx,cs:xy -mov dh,cs:colors -mov es:[bx],dx -add cs:xy,2 -pop es bx dx -ret - - - -;==========SPACE=========== -;met un espace apr‚s le curseur -;-> -;<- -;============================= -space: -push bx es -add cs:xy,2 -mov bx,0B800h -mov es,bx -mov bx,cs:xy -mov byte ptr es:[bx],' ' -pop es bx -ret - -;==============================Affiche le nombre nb binaire en EDX============== -ShowbinRow: - push es ax bx cx di - mov di,cs:xy - mov bx,0B800h - mov es,bx - mov ax,cx - sub cx,32 - neg cx - shl edx,cl - mov ch,cs:colors -binaize: - rol edx,1 - mov cl,'0' - adc cl,0 - mov es:[di],cx - add di,2 - dec al - jnz binaize - mov cs:xy,di - pop di cx bx ax es - ret - -;==========SETCOLOR========= -;Change les attributs du texte a CL -;-> CL -;<- -;============================= -setcolor: -mov cs:colors,CL -ret - -;=============CLEAR========= -;Efface l'ecran texte -;-> -;<- -;============================= -clear: -push es eax cx di -xor di,di -mov ax,0b800h -mov es,ax -mov eax,07200720h -mov cx,1000 -cld -rep stosd -pop di cx eax es -ret - -;==========SCROLLDOWN========= -;defile de cx lines vers le bas -;-> CX -;<- -;============================= -scrolldown: -push cx si di ds es -mov si,0B800h -mov es,si -mov ds,si -mov si,cx -shl si,5 -shl cx,7 -add si,cx -mov cx,4000 -sub cx,si -xor di,di -cld -rep movsb -pop es ds di si cx -ret - -;==========LINE========= -;remet le curseur a la ligne -;-> -;<- -;============================= -line: -push ax cx di es -mov ah,cs:x -mov al,cs:y -xor ah,ah -cmp al,24 -jne scro -dec al -mov cl,1 -call scrolldown -scro: -inc al -call setxy -pop es di cx ax -ret - -;==========SETXY========= -;Change les coordonnées du curseur a X:AL,Y:AH -;-> AX -;<- es di -;============================= -setxy: -push ax bx di -mov cs:x,ah -mov cs:y,al -mov bl,ah -xor bh,bh -xor ah,ah -mov di,ax -shl di,5 -shl ax,7 -shl bx,1 -add di,ax -add di,bx -mov cs:xy,di -pop di bx ax -ret - -;================Affiche la chaine 0 de caractŠre contenue dans ds:si -showstring0: - push es cx si di - mov di,cs:xy - mov cx,0B800h - mov es,cx - mov ch,cs:colors -strinaize0: - mov cl,[si] - cmp cl,0 - je no0 - mov es:[di],cx - add di,2 - inc si - jmp strinaize0 - no0: - mov cs:xy,di - pop di si cx es - ret - -;==============================Affiche le nombre nb hexa en EDX============== -ShowHexRow: - push es ax bx cx di - mov di,cs:xy - mov bx,0B800h - mov es,bx - mov ax,cx - sub cx,32 - neg cx - shl edx,cl - mov ch,cs:colors - shr ax,2 -Hexaize: - rol edx,4 - mov bx,dx - and bx,0fh - mov cl,cs:[bx+offset Tab] - mov es:[di],cx - add di,2 - dec al - jnz Hexaize - mov cs:xy,di - pop di cx bx ax es - ret -Tab db '0123456789ABCDEF' -ret - -;===================================sauve l'ecran rapidement================ -SaveScreen: - push cx si di ds es - mov cx,0B800H - mov ds,cx - push cs - pop es - mov cx,(80*25*2)/4 - xor si,si - mov di,offset Copy2 - cld - rep movsd - pop es ds di si cx - ret - - -;===================================sauve l'ecran rapidement================ -RestoreScreen: - push cx si di ds es - mov cx,0B800H - mov es,cx - push cs - pop ds - mov cx,(80*25*2)/4 - mov si,offset Copy2 - xor di,di - cld - rep movsd - pop es ds di si cx - ret - -;===================================Afficher un int EDX a l'‚cran en ah,al================ -ShowInt: - push eax bx cx edx esi di es ds - mov di,cs:xy - mov cx,0B800h - mov es,cx - xor cx,cx - mov eax,edx - mov esi,10 - mov bx,offset showbuffer+27 -decint3: - xor edx,edx - div esi - add dl,'0' - mov dh,cs:colors - sub bx,2 - add cx,2 - mov cs:[bx],dx - cmp ax,0 - jne decint3 - mov si,bx - push cs - pop ds - cld - rep movsb - mov cs:xy,di - pop ds es di esi edx cx bx eax -ret showbuffer db 35 dup (0FFh) Lastread dw 0FFFFh @@ -644,8 +426,9 @@ ret DiskSectorsPerTrack dw 18 DiskTracksPerHead dw 80 DiskHeads dw 2 + +infos db 10 dup (0) -copy2 equ $ buffer equ $+4000 diff --git a/thin8x8.fnt b/thin8x8.fnt new file mode 100755 index 0000000..9fd96cd Binary files /dev/null and b/thin8x8.fnt differ diff --git a/vg2.asm b/vg2.asm new file mode 100755 index 0000000..2e218b4 --- /dev/null +++ b/vg2.asm @@ -0,0 +1,895 @@ +.model tiny +.486 +smart +.code + +org 0100h + +start: + +Tsr: +cli +cmp ax,1234h +jne nomore +mov ax,4321h +jmp itsok +nomore: +push bx +mov bl,ah +xor bh,bh +shl bx,1 +mov bx,cs:[bx].tables +mov cs:current,bx +pop bx +call cs:current +itsok: +jnc noerror +push bp +mov bp,sp +or byte ptr [bp+6],1b +pop bp +mov ax,cs +shl eax,16 +mov ax,cs:current +jmp endofint +noerror: +push bp +mov bp,sp +and byte ptr [bp+6],0FEh +pop bp +endofint: +sti +iret +current dw 0 +tables dw setvideomode + dw getvideomode + dw cleartext + dw changefont + dw loadfont + dw space + dw line + dw showchar + dw showint + dw showsigned + dw showhex + dw showbin + dw showstring + dw showstring0 + dw showcharat + dw showintat + dw showsignedat + dw showhexat + dw showbinat + dw showstringat + dw showstring0at + dw setcolor + dw getcolor + dw scrolldown + dw getxy + dw setxy2 + dw savescreen + dw restorescreen + dw page2to1 + dw page1to2 + dw xchgPages + dw savepage1 + dw changelineattr + dw waitretrace + dw getinfos + +;Change la police a CL +changefont: +push ax cx dx +mov ah,cl +and cl,11b +and ah,0100b +shl ah,2 +add ah,cl +mov dx,3C4h +mov al,3 +out dx,ax +pop dx cx ax +ret + +;met la police BL … ds:si taille dans CL +loadfont: +push ax bx cx dx si di es +xor di,di +mov dx,3C4h +cli +doseq: +mov ax,cs:[di+offset reg1] +out dx,ax +inc di +inc di +cmp di,6 +jbe doseq +mov dx,3CEh +doseq2: +mov ax,cs:[di+offset reg1] +out dx,ax +inc di +inc di +cmp di,6+6 +jbe doseq2 +sti +mov ax,0A000h +mov es,ax +mov dx,255 +mov al,0 +xor bh,bh +cmp bl,4 +jb isless +sub bl,4 +shl bl,1 +inc bl +jmp okmake +isless: +shl bl,1 +okmake: +mov di,bx +shl di,13 +mov bh,cl +mov bl,cl +sub bl,32 +neg bl +xor cx,cx +cld +popz: +mov cl,bh +rep movsb +mov cl,bl +rep stosb +dec dx +jnz popz +xor di,di +mov dx,3C4h +doseqs: +mov ax,cs:[di+offset reg2] +out dx,ax +inc di +inc di +cmp di,6 +jbe doseqs +mov dx,3CEh +doseqs2: +mov ax,cs:[di+offset reg2] +out dx,ax +inc di +inc di +cmp di,6+6 +jbe doseqs2 +pop es di si dx cx bx ax +ret +reg2 dw 0100h, 0302h, 0304h, 0300h + dw 0004h, 1005h, 0E06h +reg1 dw 0100h, 0402h, 0704h, 0300h + dw 0204h, 0005h, 0406h + +;40*25 16 couleurs +mode0 DB 63H,00H, 03H,09H,03H,00H,02H + DB 2DH,27H,28H,90H,2BH,0A0H,0BFH,01FH,00H,4FH,0DH,0EH,00H,00H,00H,00H + DB 9CH,8EH,8FH,14H,1FH,96H,0B9H,0A3H,0FFH + DB 00H,00H,00H,00H,00H,10H,0EH,00H,0FFH + DB 00H,01H,02H,03H,04H,05H,14H,07H,38H,39H,3AH,3BH,3CH,3DH,3EH,3FH + DB 0CH,00H,0FH,08H,00H + db 40,25 + +;80*25 16 couleurs +mode1 DB 67H,00H, 03H,00H,03H,00H,02H + DB 5FH,4FH,50H,82H,55H,81H,0BFH,1FH,00H,4FH,0DH,0EH,00H,00H,00H,00H + DB 9CH,0EH,8FH,28H,1FH,96H,0B9H,0A3H,0FFH + DB 00H,00H,00H,00H,00H,10H,0EH,00H,0FFH + DB 00H,01H,02H,03H,04H,05H,14H,07H,38H,39H,3AH,3BH,3CH,3DH,3EH,3FH + DB 0CH,00H,0FH,08H,00H + db 80,25 + +;80*50 16 couleurs +mode2 DB 63H, 00H, 03H,01H,03H,01H,02H + DB 5FH,4FH,50H,82H,55H,81H,0BFH,1FH,00H,47H,06H,07H,00H,00H,00H + DB 00H,9CH,8EH,8FH,28H,1FH,96H,0B9H,0A3H,0FFH + DB 00H,00H,00H,00H,00H,10H,0EH,00H,0FFH + DB 00H,01H,02H,03H,04H,05H,14H,07H,10H,11H,3AH,3BH,3CH,3DH,3EH,3FH + DB 0CH,00H,0FH,00H,00H + db 80,50 + +;640*480 16 couleurs +mode3 DB 63H, 00H, 03H,01H,0FH,00H,0EH + DB 5FH,4FH,50H,82H,54H,80H,0BFH,1FH,00H,41H,00H,00H,00H,00H,00H,00H + DB 9CH,0EH,8FH,28H,40H,96H,0B9H,0A3H,0FFH + DB 00H,00H,00H,00H,00H,40H,05H,0FH,0FFH + DB 00H,01H,02H,03H,04H,05H,06H,07H,08H,09H,0AH,0BH,0CH,0DH,0EH,0FH + DB 41H,00H,0FH,00H,00H + db 00,00 + +;320*240 256 couleurs +mode4 DB 63H, 00H, 03H,01H,0FH,00H,0EH + DB 5FH,4FH,50H,82H,54H,80H,0BFH,1FH,00H,41H,00H,00H,00H,00H,00H,00H + DB 9CH,0EH,8FH,28H,40H,96H,0B9H,0A3H,0FFH + DB 00H,00H,00H,00H,00H,10H,05H,0FH,0FFH + DB 00H,01H,02H,03H,04H,05H,06H,07H,08H,09H,0AH,0BH,0CH,0DH,0EH,0FH + DB 41H,00H,0FH,00H,00H + db 00,00 + +;=============CLEAR========= +;Efface l'ecran texte +;-> +;<- +;============================= +cleartext: +push es eax cx di +xor di,di +mov ax,0b800h +mov es,ax +mov eax,07200720h +mov cx,cs:pagesize +shr cx,2 +cld +rep stosd +mov cs:xy,0 +mov cs:x,0 +mov cs:y,0 +pop di cx eax es +ret + +;=============CLEAR========= +;Efface l'ecran texte +;-> +;<- +;============================= +clearpixel: +push es eax cx di +xor di,di +mov ax,0A000h +mov es,ax +mov eax,0h +mov cx,cs:pagesize +shr cx,2 +cld +rep stosd +pop di cx eax es +ret + +Sequencer equ 03C4h +misc equ 03C2h +CCRT equ 03D4h +Attribs equ 03C0h +graphic equ 03CEh +statut equ 3DAh + +initmode: +push bx cx si ds +mov bl,1 +mov cl,8 +push cs +pop ds +mov si,offset special +call loadfont +pop ds si cx bx +ret + +;Renvoie le mode video dans al +getvideomode: +mov al,cs:mode +ret + +;====Met le mode video a al +setvideomode: +push ax dx di +cmp cs:mode,0FFh +jne noinit +call initmode +mov cs:pagesize,4000 +call cleartext +noinit: +mov cs:mode,al +xor ah,ah +mov di,ax +shl di,6 +add di,offset mode0 +mov dx,misc +mov al,cs:[di] +out dx,al +inc di +mov dx,statut +mov al,cs:[di] +out dx,al +inc di +mov dx,sequencer +xor ax,ax +initsequencer: +mov ah,cs:[di] +out dx,ax +inc al +inc di +cmp al,5 +jb initsequencer +mov ax,0E11h +mov dx,ccrt +out dx,ax +xor ax,ax +initcrt: +mov ah,cs:[di] +out dx,ax +inc al +inc di +cmp al,25 +jb initcrt +mov dx,graphic +xor ax,ax +initgraphic: +mov ah,cs:[di] +out dx,ax +inc al +inc di +cmp al,9 +jb initgraphic +mov dx,statut +in al,dx +mov dx,attribs +xor ax,ax +initattribs: +mov ah,cs:[di] +push ax +in ax,dx +pop ax +out dx,al +xchg ah,al +out dx,al +xchg ah,al +inc al +inc di +cmp al,21 +jb initattribs +mov al,cs:[di] +mov cs:columns,al +mov ah,cs:[di+1] +mov cs:lines,ah +mul ah +shl ax,1 +mov cs:pagesize,ax +mov al,20h +out dx,al +pop di dx ax +ret + +;==========SPACE=========== +;met un espace apr‚s le curseur +;-> +;<- +;============================= +space: +push bx es +add cs:xy,2 +mov bx,0B800h +mov es,bx +mov bx,cs:xy +mov byte ptr es:[bx],' ' +pop es bx +ret + +;==========SHOWCHAR=========== +;met un caractŠre apr‚s le curseur +;-> dl +;<- +;============================= +showchar: +push dx bx es +mov bx,0B800h +mov es,bx +mov bx,cs:xy +mov dh,cs:colors +mov es:[bx],dx +add cs:xy,2 +pop es bx dx +ret + +;==========SHOWCHARAT=========== +;met un caractŠre apr‚s le curseur coord ah,al +;-> dl ah al +;<- +;============================= +showcharat: +push es di +call setxy +call showchar +pop di es +ret + +;==========LINE========= +;remet le curseur a la ligne +;-> +;<- +;============================= +line: +push bx cx di es +mov bh,cs:x +mov bl,cs:y +xor bh,bh +mov cl,cs:lines +dec cl +cmp bl,cl +jne scro +dec bl +mov cl,1 +call scrolldown +scro: +inc bl +call setxy +pop es di cx bx +ret + +;==========SETCOLOR========= +;Change les attributs du texte a CL +;-> CL +;<- +;============================= +setcolor: +mov cs:colors,CL +ret + +;==========GETCOLOR========= +;R‚cupŠre les attributs du texte dans CL +;-> +;<- CL +;============================= +getcolor: +mov cl,cs:colors +ret + +updatecursor: +push ax dx di +mov dx,3D4h +mov al,0Eh +mov di,offset xy +mov ah,cs:[di] +out dx,ax +mov ah,cs:[di+1] +inc al +out dx,ax +pop di dx ax +ret + +;==========SCROLLDOWN========= +;defile de cx lines vers le bas +;-> CX +;<- +;============================= +scrolldown: +push ax cx dx si di ds es +mov si,0B800h +mov es,si +mov ds,si +mov ax,cx +mul cs:columns +shl ax,1 +mov si,ax +mov cx,cs:pagesize +sub cx,si +xor di,di +cld +rep movsb +pop es ds di si dx cx ax +ret + +;==========GETXY========= +;Change les coordonnées du curseur a X:AL,Y:AH +;-> AX +;<- +;============================= +getxy: +mov bh,cs:x +mov bl,cs:y +ret + +;==========SETXY========= +;Change les coordonnées du curseur a X:AH,Y:AL +;-> AX +;<- es di +;============================= +setxy: +push ax bx dx +mov cs:x,bh +mov cs:y,bl +mov al,bl +mov bl,bh +xor bh,bh +mov di,bx +mul cs:columns +shl ax,1 +add di,ax +mov cs:xy,di +mov ax,0B800h +mov es,ax +pop dx bx ax +ret + +setxy2: +push es di +call setxy +pop di es +ret + + +;===================================sauve l'ecran rapidement================ +SaveScreen: + push cx si di ds es + mov cx,0B800H + mov ds,cx + push cs + pop es + mov cx,cs:pagesize + shr cx,2 + xor si,si + mov di,offset Copy2 + cld + rep movsd + pop es ds di si cx + ret + +;===================================sauve l'ecran rapidement================ +Savepage1: + push cx si di ds es + mov cx,0B800H + mov ds,cx + push cs + pop es + mov cx,cs:pagesize + shr cx,2 + xor si,si + mov di,offset Copy + cld + rep movsd + pop es ds di si cx + ret + +;===================================sauve l'ecran rapidement================ +RestoreScreen: + push cx si di ds es + mov cx,0B800H + mov es,cx + push cs + pop ds + mov cx,cs:pagesize + shr cx,2 + mov si,offset Copy2 + xor di,di + cld + rep movsd + pop es ds di si cx + ret +copy2 db 4000 dup (0) +copy db 4000 dup (0) + +;===============================Page2to1============================ +Page2to1: + push cx si di ds es + mov cx,0B800H + mov es,cx + mov ds,cx + mov cx,cs:pagesize + shr cx,2 + mov si,4000 + xor di,di + cld + rep movsd + pop es ds di si cx + ret + +;===============================Page1to2============================ +Page1to2: + push cx si di ds es + mov cx,0B800H + mov es,cx + mov ds,cx + mov cx,cs:pagesize + shr cx,2 + mov di,4000 + xor si,si + cld + rep movsd + pop ds es di si cx + ret + +;===============================xchgPages============================ +xchgPages: + push cx si di ds es + call savepage1 + call page2to1 + mov cx,0B800H + mov es,cx + push cs + pop ds + mov cx,cs:pagesize + shr cx,2 + mov si,offset Copy + mov di,4000 + rep movsd + pop es ds di si cx + ret + +;===================================Afficher un int EDX a l'‚cran en ah,al================ +ShowInt: + push eax bx cx edx esi di es ds + mov di,cs:xy + mov cx,0B800h + mov es,cx + xor cx,cx + mov eax,edx + mov esi,10 + mov bx,offset showbuffer+27 +decint3: + xor edx,edx + div esi + add dl,'0' + mov dh,cs:colors + sub bx,2 + add cx,2 + mov cs:[bx],dx + cmp ax,0 + jne decint3 + mov si,bx + push cs + pop ds + cld + rep movsb + mov cs:xy,di + pop ds es di esi edx cx bx eax +ret +showbuffer db 35 dup (0FFh) + +;===================================Afficher un int EDX a l'‚cran en ah,al================ +ShowIntat: +push es di + call setxy + call showint +pop di es +ret + +waitretrace: +push ax dx +mov dx,3DAh +waitr: +in al,dx +test al,8 +jz waitr +pop dx ax +ret + +nbexactbit: +push edx +xor cx,cx +viewnb: +inc cx +shr edx,1 +cmp edx,0 +jnz viewnb +pop edx +ret + +bittobyte: +push dx +adap: +mov dx,cx +and dx,3 +jz adapfin +add cx,1 +jmp adap +adapfin: +pop dx +ret + +Nbbit: +cmp edx,0FFh +jb ok1 +cmp edx,0FFFFh +jb ok2 +mov cx,32 +ret +ok1: +mov cx,8 +ret +ok2: +mov cx,16 +ret + +showhexat: +push es di + call setxy + call showhex +pop di es +ret + +showbinat: +push cx es di +call setxy +call showbin +pop di es cx +ret + +;==============================Affiche le nombre nb binaire en EDX============== +Showbin: + push es ax bx cx di + mov di,cs:xy + mov bx,0B800h + mov es,bx + mov ax,cx + sub cx,32 + neg cx + shl edx,cl + mov ch,cs:colors +binaize: + rol edx,1 + mov cl,'0' + adc cl,0 + mov es:[di],cx + add di,2 + dec al + jnz binaize + mov cs:xy,di + pop di cx bx ax es + ret + +;==============================Affiche le nombre nb hexa en EDX============== +ShowHex: + push es ax bx cx di + mov di,cs:xy + mov bx,0B800h + mov es,bx + mov ax,cx + sub cx,32 + neg cx + shl edx,cl + mov ch,cs:colors + shr ax,2 +Hexaize: + rol edx,4 + mov bx,dx + and bx,0fh + mov cl,cs:[bx+offset Tab] + mov es:[di],cx + add di,2 + dec al + jnz Hexaize + mov cs:xy,di + pop di cx bx ax es + ret +Tab db '0123456789ABCDEF' + +;===================================Afficher un int EDX a l'‚cran en ah,al================ +Showsigned: +push ax ebx edx es +xor ebx,ebx +mov bl,cl +bt edx,ebx +jnc pos +neg edx +mov ah,cs:colors +mov al,'-' +mov bx,0B800h +mov es,bx +mov bx,cs:xy +mov word ptr es:[bx],ax +add cs:xy,2 +pos: +call showint +pop es edx ebx ax +ret + +showsignedat: +push es di +call setxy +call showsigned +pop di es +ret + +;================Affiche la chaine de caractŠre contenue dans ds:si +showstring: + push es bx cx si di + mov di,cs:xy + mov bx,0B800h + mov es,bx + mov bl,[si] + mov ch,cs:colors +strinaize: + inc si + mov cl,[si] + mov es:[di],cx + add di,2 + dec bl + jnz strinaize + mov cs:xy,di + pop di si cx bx es + ret + +;================Affiche la chaine 0 de caractŠre contenue dans ds:si +showstring0: + push es cx si di + mov di,cs:xy + mov cx,0B800h + mov es,cx + mov ch,cs:colors +strinaize0: + mov cl,[si] + cmp cl,0 + je no0 + mov es:[di],cx + add di,2 + inc si + jmp strinaize0 + no0: + mov cs:xy,di + pop di si cx es + ret + + +showstringat: +push es di +call setxy +call showstring +pop di es +ret + +showstring0at: +push es di +call setxy +call showstring0 +pop di es +ret + +;couleur al pour ligne di +changelineattr: +push ax bx di es +mov bx,ax +mov ax,0B800h +mov es,ax +mov ax,di +mul cs:columns +mov di,ax +shl di,1 +mov al,cs:columns +inc di +popep: +mov es:[di],bl +add di,2 +dec al +jnz popep +pop es di bx ax +ret + +;Retourne en es:di un bloc de donn‚es +Getinfos: +push cx si di ds +push cs +pop ds +mov cx,10 +mov si,offset lines +cld +rep movsb +pop ds di si cx +ret + +lines db 0 +columns db 0 +x db 0 +y db 0 +xy dw 0 +colors db 7 +mode db 0FFh +pagesize dw 0 +special equ $ + + +endofme equ $ +4096 + +end start + + + + + + + + + +