diff --git a/asm.bat b/asm.bat index 9e704ec..27d5cb7 100755 --- a/asm.bat +++ b/asm.bat @@ -1,12 +1,47 @@ @echo off -del 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 -del boot.exe -cosinit.com + +echo Assembling file %1... +util\tasm %1.asm /m5/x/t +if errorlevel 1 goto end +if "%1"=="boot" goto boot +echo Linking file %1... +util\tlink %1.obj /x/t +if errorlevel 1 goto end +echo Copying file %1... +if "%1"=="video" goto video +if "%1"=="system" goto system +if "%1"=="setup" goto setup +copy %1.com ..\data\%1.exe>nul +goto end + +:boot +echo Linking file %1... +util\tlink %1.obj /x +if errorlevel 1 goto end +echo Copying file %1... +util\exe2boot %1.exe +copy %1.bin ..\data\%1.bin>nul +goto end + +:video +type thin8x8.fnt>>%1.com +:system +copy %1.com ..\data\%1.sys>nul +goto end +:setup +copy %1.com ..\%1.com>nul +goto end + +:end +if not exist *.bin goto exes +del *.bin +:exes +if not exist *.exe goto coms +del *.exe +:coms +if not exist *.com goto objs +del *.com +:objs +if not exist *.obj goto nobjs +del *.obj +:nobjs diff --git a/boot.asm b/boot.asm index 1418c6a..347a19d 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 ',0 +Sys db 'system',0,0,0,0,0,0 sys2 db 'sys',0 errorboot: @@ -175,7 +175,7 @@ push ax cx dx si mov CL, DL ;{ Set the sector } and CL, 63 ;{ Top two bits are bits 8&9 of the cylinder } xor DX, DX - div head + div word ptr pope mov CH, DL ;{ Set the track bits 0-7 } mov AL, DH ror AL, 1 @@ -183,7 +183,7 @@ push ax cx dx si and AL, 11000000b or CL, AL ;{ Set bits 8&9 of track } xor dX, DX - div pope + div head mov DH, DL ;{ Set the head } inc CL mov SI, 4 @@ -214,6 +214,6 @@ again: Buffer equ $ - +boots ends end start diff --git a/cos.bmp b/cos.bmp new file mode 100755 index 0000000..c5a0890 Binary files /dev/null and b/cos.bmp differ diff --git a/cosinit.asm b/cosinit.asm deleted file mode 100755 index 998bc4f..0000000 --- a/cosinit.asm +++ /dev/null @@ -1,224 +0,0 @@ -.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/debog.bat b/debog.bat new file mode 100755 index 0000000..3530e81 --- /dev/null +++ b/debog.bat @@ -0,0 +1,2 @@ +@echo off +util\td %1 diff --git a/sect.asm b/disk.asm similarity index 91% rename from sect.asm rename to disk.asm index a0b5ab8..2a55d8b 100755 --- a/sect.asm +++ b/disk.asm @@ -177,7 +177,7 @@ waitst: int 16h cmp ah,41h jne tre - mov dword ptr [pope],' EUV' + mov dword ptr [pope],'WEIV' push cs pop es mov cx,sect @@ -343,9 +343,9 @@ xx dw 0 yy dw 0 xxyy dw 3 xxyy2 dw 3 -errordisk db 'Une erreur est survenu sur le lecteur A:, appuyer sur une touche ',0 -menu db 'Haut F1, Bas F2, Secteurs F3&F4, Load/Save F4&F5, Edit F7, Quitter F8 MODE ' -pope db 'VUE ',0 +errordisk db 'An error has occured on drive A:, press a key to continu ',0 +menu db 'Bottom F1, Top F2, Sectors F3&F4, Load/Save F5&F6, Mode F7, Quit F8 MODE ' +pope db 'VIEW ',0 spaces db ' ³ ',0 showbuffer db 35 dup (0FFh) diff --git a/editor.asm b/editor.asm new file mode 100755 index 0000000..7ac89ce --- /dev/null +++ b/editor.asm @@ -0,0 +1,450 @@ +.model tiny +.386c +.code +org 0100h + + +start: + mov ax,0305h + mov bx,0008h + int 16h + mov ax,0002 + int 47H + mov ah,26 + int 47H + mov ah,2 + int 47h + xor ebp,ebp + xor ax,ax + mov fs,ax +Adres: + mov di,offset infos + mov ah,34 + int 47h + dec infos + mov bx,0 + mov ah,25 + int 47h + mov bh,infos + mov edi,ebp + mov ah,21 + mov cl,7 + int 47h +lines: + mov edx,edi + shr edx,4*4 + shl edx,4*3 + mov cx,16 + mov ah,10 + int 47h + mov si,offset dep + mov ah,13 + int 47h + mov dx,di + mov ah,10 + int 47h + mov ah,13 + mov si,offset spaces + int 47h + mov al,16 + mov cl,7 + mov ah,21 + int 47h + mov esi,edi +doaline: + mov edx,edi + shr edx,4*4 + shl edx,4*3 + mov fs,dx + mov dl,fs:[di] + mov ah,10 + mov cl,8 + int 47h + mov ah,5 + int 47h + inc edi + dec al + jnz doaline + mov edi,esi + mov si,offset spaces + mov ah,13 + int 47h + mov al,16 + mov ah,21 + mov cl,7 + int 47h +doaline2: + mov edx,edi + shr edx,4*4 + shl edx,4*3 + mov fs,dx + mov dl,fs:[di] + mov ah,7 + int 47h + inc edi + dec al + jnz doaline2 + mov ah,6 + int 47h + dec bh + jnz lines + mov ah,21 + mov cl,112 + int 47h + mov si,offset menu + mov ah,13 + int 47h + waitkey: + mov ax,0 + int 16h + cmp ax,3B00h + jne suit + inc ebp + jmp adres + suit: + cmp ax,3C00h + jne suit2 + dec ebp + jmp adres + suit2: + cmp ax,3D00h + jne suit3 + add ebp,24*16 + jmp adres + suit3: + cmp ax,3E00h + jne suit4 + sub ebp,24*16 + jmp adres + suit4: + cmp ax,3F00h + jne suit5 + add ebp,010000h + jmp adres + suit5: + cmp ax,4000h + jne suit6 + sub ebp,010000h + jmp adres + suit6: + cmp ax,4100h + jne suit7 + mov dword ptr [pope],'TIDE' + mov bl,infos + xor bh,bh + mov ah,25 + int 47h + mov ah,21 + mov cl,116 + int 47h + mov si,offset menu + mov ah,13 + int 47h + mov ah,21 + mov cl,7 + int 47h + mov ax,0B800h + mov es,ax + mov xxyy2,3 + mov xxyy,3 + call calc1 + call calc2 +waitst: + mov ax,0 + int 16h + cmp ah,41h + jne tre + mov dword ptr [pope],' EUV' + push cs + pop es + jmp adres +tre: + cmp al,0 + jne write + cmp ah,48h + jne tre1 + cmp yy,0 + je waitst + dec yy + jmp cursor +tre1: + cmp ah,50h + jne tre2 + mov al,infos + dec al + xor ah,ah + cmp yy,ax + je waitst + inc yy + jmp cursor +tre2: + cmp ah,4Dh + jne tre4 + cmp xx,15 + je waitst + inc xx + jmp cursor +tre4: + cmp ah,4Bh + jne waitst + cmp xx,0 + je waitst + dec xx + jmp cursor +write: + call AsciiHex2dec + cmp cl,15 + ja waitst + call calc1 + call calc2 + mov edi,es:[bx-1] + mov dx,es:[si-1] + mov byte ptr es:[bx],0112 + mov es:[bx-1],al +writs: + mov ax,0 + int 16H + mov ch,cl + call AsciiHex2dec + cmp cl,15 + ja writs + shl ch,4 + add ch,cl + mov es:[bx+1],al + mov es:[si-1],ch + mov ax,bx + call calc3 + mov gs:[bx],ch + pusha + popa + mov cl,gs:[bx] + cmp ch,cl + je no + push si ax + mov ah,25 + mov bl,infos + xor bh,bh + int 47h + mov ah,21 + mov cl,117 + int 47h + mov si,offset msg + mov ah,13 + int 47h + mov ax,0 + int 16h + mov bl,infos + xor bh,bh + mov ah,25 + int 47h + mov ah,21 + mov cl,116 + int 47h + mov ah,13 + mov si,offset menu + int 47h + pop bx si + mov es:[bx-1],edi + mov es:[si-1],dx + no: + + inc xx + cmp xx,16 + jne pasde + inc yy + mov xx,0h + pasde: + call calc1 + call calc2 + jmp waitst + +cursor: + call calc1 + call calc2 + jmp waitst + suit7: + cmp ax,4200h + jne waitkey + mov ah,27 + int 47h + db 0CBH ; +++++++ + ret + +calc1: + push ax dx si + mov ax,xx + mov dx,xx + shl ax,2 + shl dx,1 + add ax,dx + add ax,25 + mov bx,YY + mov dx,yy + shl bx,5 + shl dx,7 + add bx,dx + add bx,ax + mov byte ptr es:[bx],112 + mov byte ptr es:[bx+2],112 + mov si,xxyy + mov byte ptr es:[si],07 + mov byte ptr es:[si+2],07 + mov xxyy,bx + pop si dx ax + ret + +calc2: + push ax bx dx + mov si,YY + mov dx,yy + shl si,5 + shl dx,7 + add si,dx + mov dx,xx + shl dx,1 + add si,dx + add si,127 + mov byte ptr es:[si],112 + mov bx,xxyy2 + mov byte ptr es:[bx],07 + mov xxyy2,si + pop dx bx ax + ret + +calc3: + push dx + xor ebx,ebx + mov bx,xx + mov dx,yy + shl dx,4 + add bx,dx + add ebx,ebp + mov edx,ebx + shr edx,4*4 + shl edx,4*3 + mov gs,dx + pop dx + ret + + asciihex2dec: + cmp al,'a' + jb nomin + cmp al,'f' + ja nomin + sub al,'a'-'A' + jmp ismaj + nomin: + cmp al,'A' + jb nomaj + cmp al,'F' + ja nomaj + ismaj: + mov cl,al + sub cl,'A'-10 + jmp endt + nomaj: + mov cl,al + sub cl,'0' + endt: + ret + +dep db ':',0 +sect dw 0 +xx dw 0 +yy dw 0 +xxyy dw 3 +xxyy2 dw 3 +msg db 'Error : Unchangeable area (ROM) press a key to continu ',0 +menu db 'Top F1, Bottom F2, Offset F3&F4, Segment F5&F6, Mode F7, Quit F8 MODE ' +pope db 'VUE ',0 +spaces db ' ³ ',0 + +showbuffer db 35 dup (0FFh) +Lastread dw 0FFFFh + +ReadSector: +push ax cx dx si + cmp cx,cs:lastread + je done + mov cs:LastRead,cx + mov AX, CX + xor DX, DX + div cs:DiskSectorsPerTrack + mov CL, DL ;{ Set the sector } + and CL, 63 ;{ Top two bits are bits 8&9 of the cylinder } + xor DX, DX + div cs:DiskTracksPerHead + mov CH, DL ;{ Set the track bits 0-7 } + mov AL, DH + ror AL, 1 + ror AL, 1 + and AL, 11000000b + or CL, AL ;{ Set bits 8&9 of track } + xor dX, DX + div cs:DiskHeads + mov DH, DL ;{ Set the head } + inc CL + mov SI, 4 +TryAgain: + mov AL, 1 + mov DL, 0 + mov AH, 2 + int 13h + jnc Done + dec SI + jnz TryAgain +mov word ptr cs:lastread,0ffffh +Done: + pop si dx cx ax +ret + +WriteSector: +push ax cx dx si + cmp cs:Lastread,cx + jne nodestruct + mov cs:Lastread,0ffffh + nodestruct: + mov AX, CX + xor DX, DX + div cs:DiskSectorsPerTrack + mov CL, DL ;{ Set the sector } + and CL, 63 ;{ Top two bits are bits 8&9 of the cylinder } + xor DX, DX + div cs:DiskTracksPerHead + mov CH, DL ;{ Set the track bits 0-7 } + mov AL, DH + ror AL, 1 + ror AL, 1 + and AL, 11000000b + or CL, AL ;{ Set bits 8&9 of track } + xor DX, DX + div cs:DiskHeads + mov DH, DL ;{ Set the head } + inc CL + mov SI, 4 +TryAgain2: + mov AL, 1 + mov DL, 0 + mov AH, 3 + int 13h + jnc Done2 + dec SI + jnz TryAgain2 +Done2: + pop si dx cx ax +ret + +DiskSectorsPerTrack dw 18 +DiskTracksPerHead dw 80 +DiskHeads dw 2 + +infos db 10 dup (0) +end start + + + + + + + + diff --git a/exe2boot.asm b/exe2boot.asm new file mode 100755 index 0000000..0946581 --- /dev/null +++ b/exe2boot.asm @@ -0,0 +1,67 @@ +.model tiny +.486 +smart +.code + +org 0100h + + +start: +jmp transform +NameBoot db 'Boot.exe',0 +nameboot2 db 'Boot.bin',0 +buffer db 510 dup (0) + dw 0AA55h +message db 0ah,0dh,'Transformation of boot.com to boot.bin...',0ah,0dh,'By Nico',0ah,0dh,'Copyright 2000',0ah,0dh,'$' +ok db 0ah,0dh,'The transformation was done succefully !',0ah,0dh,'$' +errormsg db 0ah,0dh,'Some errors has been detected !',0ah,0dh,'$' +transform: +mov ah,09 +mov dx,offset message +int 21h +mov ax,3D00h +mov dx,offset nameboot +int 21h +jc error +mov bx,ax +mov ax,4202h +xor cx,cx +xor dx,dx +int 21h +jc error +cmp dx,0 +jne error +mov ax,4200h +xor cx,cx +mov dx,7E00h +int 21h +jc error +mov ah,3fh +mov cx,512 +mov dx,offset buffer +int 21h +jc error +mov ah,3eh +int 21h +jc error +mov ah,3ch +xor cx,cx +mov dx,offset nameboot2 +int 21h +jc error +mov ah,40h +mov cx,512 +mov dx,offset buffer +int 21h +jc error +mov ah,09 +mov dx,offset ok +int 21h +ret +error: +mov ah,09 +mov dx,offset errormsg +int 21h +ret + +end start diff --git a/logo.asm b/logo.asm new file mode 100755 index 0000000..1f2a506 --- /dev/null +++ b/logo.asm @@ -0,0 +1,369 @@ +.model tiny +.386c +.code +org 0100h + + +start: +mov si,offset logo +call searchfile +mov bx,7000h +mov es,bx +mov bx,0h +call loadfatway +push es +pop ds +call loadbmp +xor ax,ax +xor bx,bx +call showbmp +mov ax,0 +int 16h +ret +db 0CBH + +loadbmp: +push ax bx cx dx bp ds +mov ax,4 +int 47h +mov ax,ds:[18] +mov si,ax +shr ax,2 +and si,11b +cmp si,0 +je is4x +add ax,1 +is4x: +mov cs:sizeh,ax +mov ax,ds:[22] +mov cs:sizev,ax +mov di,0FFFFh-1024 +mov si,54 +mov cl, 0ffh +paletteload: +lodsb +shr al, 2 +mov [di+2], al +lodsb +shr al, 2 +mov [di+1], al +lodsb +shr al, 2 +mov [di+0], al +inc si +add di, 3 +dec cl +jnz paletteload +mov si,0FFFFh-1024 +mov dx, 3c8h +cld +mov cl, 0ffh +xor bx, bx +palettemake: +mov al, bl +out dx, al +inc dx +lodsb +out dx, al +lodsb +out dx, al +lodsb +out dx, al +dec dx +inc bl +dec cl +jnz palettemake +pop ds bp dx cx bx ax +ret +sizeh dw 0 +sizev dw 0 + +showbmp: +push ax bx cx dx si di ds es +mov cx,cs:sizeh +mov dx,cs:sizev +add bx,dx +mov di,ax +mov ax,bx +shl ax,6 +shl bx,8 +add di,bx +add di,ax +mov bx,di +mov ax,0A000H +mov es,ax +mov si,1024+54 +mov ax,cx +bouclebmp: +cmp di,64000 +jae nopp +cld +rep movsd +no: +mov cx,ax +sub bx,320 +mov di,bx +dec dx +jnz bouclebmp +fin: +pop es ds di si dx cx bx ax +ret +nopp: +shl cx,2 +add si,cx +jmp no + +Searchfile: +push bx dx si di ds es +mov di,offset temp +mov bx,offset buffer +call asciiztofit +mov cx,13 +check: +call readsector +jc errorboot +xor di,di +findnext: +cmp byte ptr [bx+di],0 +je errorboot +push si di cx +mov si,di +add si,bx +mov di,offset temp +mov cx,12+4 +rep cmpsb +pop cx di si +je oksystem +add di,32 +inc dx +cmp dx,nbfit +ja errorboot +cmp di,sizec +jb findnext +inc cx +jmp Check +oksystem: +mov cx,[di+BX+26] +errorboot: +pop es ds di si dx bx +ret + +;->name ds:si ->es:di +AsciiZtoFit: +push ax bx cx dx si di ds es +xor bx,bx +mov dx,di +noextens: +mov al,[si+bx] +cmp al,'.' +je extens +call Issystchar +jc errortranslate +mov es:[di],al +inc di +inc bx +cmp bx,namesize ;(.) +jne noextens +erro: +stc +jmp errortranslate +extens: +add si,bx +inc si +sub bx,namesize +neg bx +mov al,0 +mov cx,bx +cld +rep stosb +xor bx,bx +wasextens: +mov al,[si+bx] +cmp al,0 +je endextens +call Issystchar +jc errortranslate +mov es:[di],al +inc di +inc bx +cmp bx,extsize +jne wasextens +jmp erro +endextens: +sub bx,extsize +neg bx +mov al,0 +mov cx,bx +cld +rep stosb +mov si,dx +mov di,dx +push es +pop ds +mov cx,extsize+namesize +call uppercaseMEM +clc +endtranslate: +pop es ds di si dx cx bx ax +ret +errortranslate: +stc +jmp endtranslate + +;Carry si al = caractŠre systŠme +isSystchar: +push di +mov di,offset exeptchar +isexcept: +cmp al,cs:[di] +je nogood +inc di +cmp byte ptr cs:[di],0 +jne isexcept +endanal: +pop di +ret +exeptchar db '/\<>:|.',01,0,0 +nogood: +stc +jmp endanal + +;Transforme les x caractŠres de la mem en ds:si en maj +uppercaseMEM: +push si di cx ax +mov di,si +uppercaser: +mov al,ds:[si] +inc si +cmp al,'A' +jb nonmaj +cmp al,'Z' +ja nonmaj +add al,'a'-'A' +nonmaj: +mov es:[di],al +inc di +dec cx +jnz uppercaser +enduppercase: +clc +pop ax cx di si +ret + +nbfit equ 255 + + +namesize equ 12 +extsize equ 5 + +;cx entr‚e -> fatway chemin +getfatway: +push bx cx es +mov bx,offset fatway +fatagain: +mov cs:[bx],cx +add bx,2 +cmp cx,0FFF0h +jae finishload +call getfat +jnc fatagain +finishload: +pop es cx bx +ret + +lastread dw 0FFFFh + +ReadSector: +push ax cx dx si + cmp cx,cs:lastread + je done + mov cs:LastRead,cx + mov AX, CX + xor DX, DX + div cs:DiskSectorsPerTrack + mov CL, DL ;{ Set the sector } + and CL, 63 ;{ Top two bits are bits 8&9 of the cylinder } + xor DX, DX + div cs:DiskTracksPerHead + mov CH, DL ;{ Set the track bits 0-7 } + mov AL, DH + ror AL, 1 + ror AL, 1 + and AL, 11000000b + or CL, AL ;{ Set bits 8&9 of track } + xor dX, DX + div cs:DiskHeads + mov DH, DL ;{ Set the head } + inc CL + mov SI, 4 +TryAgain: + mov AL, 1 + mov DL, 0 + mov AH, 2 + int 13h + jnc Done + dec SI + jnz TryAgain +mov word ptr cs:lastread,0ffffh +Done: + pop si dx cx ax +ret + + +dot db '.',0 + +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 + +;<-cx nøsecteur ->cx code FAT +getfat: +push es ax bx dx +mov ax,cx +xor dx,dx +div cs:sizec +mov cx,ax +add cx,cs:reserv +mov bx,offset buffer +push cs +pop es +call readsector +jc errorgetfat +shl dx,1 +add bx,dx +mov cx,cs:[bx] +errorgetfat: +pop dx bx ax es +ret + +logo db 'cos.bmp',0 +temp db 12+5+1 dup (0) + +DiskSectorsPerTrack dw 18 +DiskTracksPerHead dw 80 +DiskHeads dw 2 + +fatway equ $ + +buffer equ $+1000 +end start diff --git a/mem.asm b/mem.asm deleted file mode 100755 index ee62884..0000000 --- a/mem.asm +++ /dev/null @@ -1,607 +0,0 @@ -.model tiny -.386c -.code -org 0100h - - -start: - mov ax,0305h - mov bx,0008h - int 16h - mov ax,0B800h - mov es,ax - xor ebp,ebp -Adres: - call clear - mov xy,0 - mov x,0 - mov y,0 - mov ah,24 - mov ebx,ebp -lines: - mov colors,7 - mov edx,ebx - shr edx,4*4 - shl edx,4*3 - mov cx,16 - call showhexrow - mov si,offset dep - call showstring0 - mov dx,bx - mov cx,16 - call showhexrow - mov si,offset spaces - call showstring0 - mov al,16 - mov edi,ebx - mov cx,8 - mov colors,7 -doaline: - mov edx,ebx - shr edx,4*4 - shl edx,4*3 - mov fs,dx - mov dl,fs:[bx] - call showhexrow - call space - inc ebx - dec al - jnz doaline - mov si,offset spaces - call showstring0 - mov al,16 - mov colors,7 -doaline2: - mov edx,edi - shr edx,4*4 - shl edx,4*3 - mov fs,dx - mov dl,fs:[di] - call showchar - inc edi - dec al - jnz doaline2 - call line - dec ah - jnz lines - mov colors,112 - mov si,offset menu - call showstring0 - mov bx,bp - waitkey: - mov ax,0 - int 16h - cmp ax,3B00h - jne suit - inc ebp - jmp adres - suit: - cmp ax,3C00h - jne suit2 - dec ebp - jmp adres - suit2: - cmp ax,3D00h - jne suit3 - add ebp,24*16 - jmp adres - suit3: - cmp ax,3E00h - jne suit4 - sub ebp,24*16 - jmp adres - suit4: - cmp ax,3F00h - jne suit5 - add ebp,010000h - jmp adres - suit5: - cmp ax,4000h - jne suit6 - sub ebp,010000h - jmp adres - suit6: - cmp ax,4100h - jne suit7 - mov dword ptr [pope],'TIDE' - mov ax,24 - call setxy - mov colors,116 - mov si,offset menu - call showstring0 - mov colors,7 - mov xxyy2,1 - mov xxyy,1 - call calc1 - call calc2 -waitst: - mov ax,0 - int 16h - cmp ah,41h - jne tre - mov dword ptr [pope],' EUV' - jmp adres -tre: - cmp al,0 - jne write - cmp ah,48h - jne tre1 - cmp yy,0 - je waitst - dec yy - jmp cursor -tre1: - cmp ah,50h - jne tre2 - cmp yy,23 - je waitst - inc yy - jmp cursor -tre2: - cmp ah,4Dh - jne tre4 - cmp xx,15 - je waitst - inc xx - jmp cursor -tre4: - cmp ah,4Bh - jne waitst - cmp xx,0 - je waitst - dec xx - jmp cursor -write: - call AsciiHex2dec - cmp cl,15 - ja waitst - call calc1 - call calc2 - mov edi,es:[bx-1] - mov dx,es:[si-1] - mov byte ptr es:[bx],0112 - mov es:[bx-1],al -writs: - mov ax,0 - int 16H - mov ch,cl - call AsciiHex2dec - cmp cl,15 - ja writs - shl ch,4 - add ch,cl - mov es:[bx+1],al - mov es:[si-1],ch - mov ax,bx - call calc3 - mov gs:[bx],ch - pusha - popa - mov cl,gs:[bx] - cmp ch,cl - je no - push si ax - mov ax,24 - call setxy - mov colors,117 - mov si,offset msg - call showstring0 - mov ax,0 - int 16h - mov ax,24 - call setxy - mov colors,116 - mov si,offset menu - call showstring0 - pop bx si - mov es:[bx-1],edi - mov es:[si-1],dx - no: - inc xx - cmp xx,16 - jne pasde - inc yy - mov xx,0h - pasde: - call calc1 - call calc2 - jmp waitst - -cursor: - call calc1 - call calc2 - jmp waitst - suit7: - cmp ax,4200h - jne waitkey - call restorescreen - db 0CBH - -calc1: - push ax dx si - mov ax,xx - mov dx,xx - shl ax,2 - shl dx,1 - add ax,dx - add ax,25 - mov bx,YY - mov dx,yy - shl bx,5 - shl dx,7 - add bx,dx - add bx,ax - mov byte ptr es:[bx],112 - mov byte ptr es:[bx+2],112 - mov si,xxyy - mov byte ptr es:[si],07 - mov byte ptr es:[si+2],07 - mov xxyy,bx - pop si dx ax - ret - -calc2: - push ax bx dx - mov si,YY - mov dx,yy - shl si,5 - shl dx,7 - add si,dx - mov dx,xx - shl dx,1 - add si,dx - add si,127 - mov byte ptr es:[si],112 - mov bx,xxyy2 - mov byte ptr es:[bx],07 - mov xxyy2,si - pop dx bx ax - ret - -calc3: - push dx - xor ebx,ebx - mov bx,xx - mov dx,yy - shl dx,4 - add bx,dx - add ebx,ebp - mov edx,ebx - shr edx,4*4 - shl edx,4*3 - mov gs,dx - pop dx - ret - - asciihex2dec: - cmp al,'a' - jb nomin - cmp al,'f' - ja nomin - sub al,'a'-'A' - jmp ismaj - nomin: - cmp al,'A' - jb nomaj - cmp al,'F' - ja nomaj - ismaj: - mov cl,al - sub cl,'A'-10 - jmp endt - nomaj: - mov cl,al - sub cl,'0' - endt: - ret - -xx dw 0 -yy dw 0 -xxyy dw 0 -xxyy2 dw 0 -msg db 'Erreur : zone imodifiable (ROM) appuyer sur une touche ',0 -menu db 'Haut F1, Bas F2, Pages F3&F4, Segment F5&F6, Edit F7, Quitter F8 MODE ' -pope db 'VUE ',0 -spaces db ' ³ ',0 -dep db ':',0 -reg db 'Etats des registre apr‚s boot',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 -cxk dw 0 -edxk dd 0 -dsk dw 0 -sik dw 0 -gr db '(',0 -dr db ')',0 - - - - -xy dw 0 -colors db 7 -x db 1 -y Db 1 - -;==========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 -mov ax,0B800h -mov es,ax -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 - -end start - - - - - - - - - diff --git a/setup.asm b/setup.asm new file mode 100755 index 0000000..0fb317c --- /dev/null +++ b/setup.asm @@ -0,0 +1,425 @@ +.model tiny +.486 +smart +.code + +org 0100h + +ent equ 32h + +start: +jmp CopyCOS + +DiskSectorsPerTrack dw 18 +DiskTracksPerHead dw 80 +DiskHeads dw 2 + +Message db 0Dh,0Ah,'COS 2000b installation program (Celyn Operating System) !!',0Dh,0Ah,'Written By Nico',0Ah,0Dh,'Site online HTTP://WWW.MULTIMANIA.COM/COS2000',0Dh,0AH,'Copyright 2000',0Dh,0AH,'Please insert a floppy disk and press a key...',0Dh,0AH,'Be careful! All the disk is going to be deleted',0Dh,0AH,'$' +Message2 db 0Dh,0AH,'Create boot sector$' +systfile db 0Dh,0AH,'Creating file allocation table 16 bits$' +systfile2 db 0Dh,0AH,'Creating file information table 32 bytes$' +systfile3 db 0Dh,0AH,'Creating operating system files',0Dh,0Ah,'$' +systfile4 db 0D,0Ah,'Creating system tools',0Dh,0Ah,'$' +Errormsg db 0Dh,0AH,0Dh,0AH,'Installing error, please contact me at COS2000@MULTIMANIA.COM !',0Dh,0AH,'$' +Ok db 0Dh,0AH,0Dh,0AH,'The boot sector and the system files had been succefully copied.',0Dh,0AH, 'To try COS reboot with this system disk',0Dh,0AH,'$' +files db '*.*',0 +tools db '*.exe',0 +allboot db 0dh,0ah +boot db 'boot.bin',0,' $' +retu db 0Dh,0AH,'$' +dat db 'data',0 +dat2 db '..',0 +dta db 43 dup (0) + +copycos: +mov ah,3Bh +mov dx,offset dat +int 21h +mov ah,9 +mov dx,offset message +int 21h +jc error +mov ax,0 +int 16h +mov ah,9 +mov dx,offset systfile +int 21h +jc error +mov cx,12 +mov bx,offset fat +erase: +call writesector +jc error +dec cx +jnz erase +mov ah,9 +mov dx,offset message2 +int 21h +jc error +mov dx,Offset allboot +int 21h +jc error +mov dx,offset boot +call addfile +mov ax,0F0FFh +mov cx,14 +mov di,offset fat +cld +rep stosw +mov bx,offset fat +mov cx,1 +call writesector +jc error +mov ah,9 +mov dx,offset systfile2 +int 21h +jc error +mov eax,0 +mov cx,512/4 +mov di,offset fat +cld +rep stosd +mov bx,offset fat +mov cx,13 +call writesector +jc error +mov ah,1Ah +mov dx,offset dta +int 21h +jc error +mov ah,4eh +xor cx,cx +mov dx,offset files +int 21h +mov ah,9 +mov dx,offset systfile3 +int 21h +jc error +allfile: +mov di,offset dta+43 +mov byte ptr [di],'$' +mov ah,9 +mov si,offset dta+30 +mov cl,13 +call uppercasemem +mov dx,si +int 21h +jc error +call addfile +jc error +call makefit +jc error +mov ah,9 +mov dx,offset retu +int 21h +jc error +mov di,offset dta+30 +mov al,0 +mov cl,13 +cld +rep stosb +mov ah,4fh +int 21h +jnc allfile +mov ah,9 +mov dx,Offset ok +int 21h +mov ah,3Bh +mov dx,offset dat2 +int 21h +ret + +error: +mov ah,3Bh +mov dx,offset dat2 +int 21h +mov ah,9 +mov dx,offset errormsg +int 21h +ret + +addfile: +push ax bx dx si di bp +mov cx,1 +mov bx,offset fat +call readsector +jc error2 +mov ax,3D00h +int 21h +jc error2 +mov bx,ax +mov ax,4202h +xor cx,cx +xor dx,dx +int 21h +jc error2 +cmp dx,0 +jne error2 +cmp ax,0 +je error2 +sub ax,1 +shr ax,9 +inc ax +mov bp,ax +mov ax,4200h +xor cx,cx +xor dx,dx +int 21h +jc error2 +mov ah,3fh +mov cx,07FFFh +mov dx,offset buffer +int 21h +jc error2 +mov si,-2 +mov di,0 +mov bx,offset buffer +fats: +add si,2 +cmp si,512 +jz error2 +cmp WORD PTR [si+offset fat],0h +jne fats +mov ax,si +shr ax,1 +cmp di,0 +jne nonew +mov entrie,ax +jmp new +nonew: +mov [offset fat+di],ax +new: +mov di,si +mov cx,ax +call writesector +jc error2 +add bx,512 +dec bp +jnz fats +mov word ptr [offset fat+di],0FFFFh +mov bx,offset fat +mov cx,1 +call writesector +mov cx,entrie +end1: +pop bp di si dx bx ax +ret +entrie dw 0 +error2: +stc +jmp end1 + + +makefit: +push bx cx si di bp +mov ax,cx +mov bx,offset fat +mov cx,13 +call readsector +jc error3 +xor si,si +findfit: +cmp byte ptr [si+bx],0 +je finishfit +add si,32 +cmp si,512 +jb findfit +jmp error3 +finishfit: +mov di,si +add di,bx +mov si,dx +call asciiztofit +jc error3 +mov [di+26],ax +mov cx,13 +call writesector +jc error3 +end3: +pop bp di si cx bx +ret +error3: +stc +jmp end3 + +WriteSector: +push cx dx si + mov AX, CX + xor DX, DX + div DiskSectorsPerTrack + mov CL, DL ;{ Set the sector } + and CL, 63 ;{ Top two bits are bits 8&9 of the cylinder } + xor DX, DX + div DiskTracksPerHead + mov CH, DL ;{ Set the track bits 0-7 } + mov AL, DH + ror AL, 1 + ror AL, 1 + and AL, 11000000b + or CL, AL ;{ Set bits 8&9 of track } + xor DX, DX + div DiskHeads + mov DH, DL ;{ Set the head } + inc CL + mov SI, 4 +TryAgain: + mov AL, 1 + mov DL, 0 + mov AH, 3 + int 13h + jnc Done + dec SI + jnz TryAgain +Done: + jc enddd + mov cl, AH + mov ah,9 + mov dx,offset sign + int 21h + cmp cl,0 + enddd: + pop si dx cx +ret + +ReadSector: +push ax cx dx si + mov AX, CX + xor DX, DX + div cs:DiskSectorsPerTrack + mov CL, DL ;{ Set the sector } + and CL, 63 ;{ Top two bits are bits 8&9 of the cylinder } + xor DX, DX + div cs:DiskTracksPerHead + mov CH, DL ;{ Set the track bits 0-7 } + mov AL, DH + ror AL, 1 + ror AL, 1 + and AL, 11000000b + or CL, AL ;{ Set bits 8&9 of track } + xor dX, DX + div cs:DiskHeads + mov DH, DL ;{ Set the head } + inc CL + mov SI, 4 +TryAgain2: + mov AL, 1 + mov DL, 0 + mov AH, 2 + int 13h + jnc Done2 + dec SI + jnz TryAgain2 +Done2: + pop si dx cx ax +ret + +;->name ds:si ->es:di +AsciiZtoFit: +push ax bx cx dx si di ds es +xor bx,bx +mov dx,di +noextens: +mov al,[si+bx] +cmp al,'.' +je extens +call Issystchar +jc errortranslate +mov es:[di],al +inc di +inc bx +cmp bx,namesize ;(.) +jne noextens +erro: +stc +jmp errortranslate +extens: +add si,bx +inc si +sub bx,namesize +neg bx +mov al,0 +mov cx,bx +cld +rep stosb +xor bx,bx +wasextens: +mov al,[si+bx] +cmp al,0 +je endextens +call Issystchar +jc errortranslate +mov es:[di],al +inc di +inc bx +cmp bx,extsize +jne wasextens +jmp erro +endextens: +sub bx,extsize +neg bx +mov al,0 +mov cx,bx +cld +rep stosb +mov si,dx +mov di,dx +push es +pop ds +mov cx,extsize+namesize +call uppercaseMEM +clc +endtranslate: +pop es ds di si dx cx bx ax +ret +errortranslate: +stc +jmp endtranslate + +;Carry si al = caractŠre systŠme +isSystchar: +push di +mov di,offset exeptchar +isexcept: +cmp al,cs:[di] +je nogood +inc di +cmp byte ptr cs:[di],0 +jne isexcept +endanal: +pop di +ret +exeptchar db '/\<>:|.',01,0,0 +nogood: +stc +jmp endanal + +;Transforme les x caractŠres de la mem en ds:si en maj +uppercaseMEM: +push si di cx ax +mov di,si +uppercaser: +mov al,ds:[si] +inc si +cmp al,'A' +jb nonmaj +cmp al,'Z' +ja nonmaj +add al,'a'-'A' +nonmaj: +mov es:[di],al +inc di +dec cx +jnz uppercaser +enduppercase: +clc +pop ax cx di si +ret + +namesize equ 12 +extsize equ 5 + +sign db '.$' +fat DB 512 dup (0) +buffer db 0 + +end start diff --git a/choice.asm b/system.asm similarity index 69% rename from choice.asm rename to system.asm index 3034e24..f058a8a 100755 --- a/choice.asm +++ b/system.asm @@ -8,7 +8,8 @@ org 0100h start: -mov cx,23 +mov si,offset video +call searchfile mov bx,8400h mov es,bx mov bx,100h @@ -16,7 +17,6 @@ call loadfatway mov di,bx mov bx,47h call setint -ret mov bx,9 call getint mov cs:int9seg,ds @@ -79,6 +79,12 @@ add di,32 inc bp jmp showall endof2: +mov ah,21 +mov cl,112 +int 47h +mov ah,13 +mov si,offset menu +int 47h mov xx,1 mov xxold,2 call Select @@ -106,19 +112,45 @@ tre2: mov di,xx dec di shl di,5 - mov cx,[di+bx+26] + mov dx,[di+bx+26] mov ah,6 int 47h int 47h + mov ah,21 + mov cl,7 + int 47h mov ah,13 mov si,offset msg2 int 47h + mov cx,dx call executefatway tre3: cmp ah,59 - jne endof + jne tre4 mov lastread,0FFFFh jmp start2 +tre4: + cmp ah,67 + jne endof + mov ax,0001 + int 47h + mov ah,2 + int 47h + mov ah,21 + mov cl,4 + int 47h + mov ah,13 + mov si,offset msg3 + int 47h + mov ax,0 + int 16h + mov ax,40h + mov ds,ax + mov bx,1234h + mov ds:[072h],bx + push 0FFFFh + push 0000h + db 0CBh executefatway: push cs @@ -219,8 +251,10 @@ ret xx dw 1 xxold dw 0 +menu db 'F1 Read disk F2 Read file F9 Quit F11 Change video F12 Debug ',0 msg1 db 'Cos 2000 menu loader release 1.0',0 -msg2 db 'Program loading',0 +msg2 db 'The program is loading',0 +msg3 db 'Cos will restart your computer, eject the floppy disk and press a key',0 prompt db '>',0 spaces db ' ',0 dot db '.',0 @@ -354,7 +388,7 @@ int9: int 47h mov al,cs:infos+7 inc al - and ax,11b + and ax,111b int 47h pop es @@ -495,9 +529,152 @@ regs db 'EDI:',0 db ' SS:',0 gr db '(',0 dr db ')',0 -app db 'Press enter to quit...',0 +app db 'Press space to quit...',0 + +Searchfile: +push bx dx si di ds es +mov di,offset temp +mov bx,offset buffer +call asciiztofit +mov cx,13 +check: +call readsector +jc errorboot +xor di,di +findnext: +cmp byte ptr [bx+di],0 +je errorboot +push si di cx +mov si,di +add si,bx +mov di,offset temp +mov cx,12+4 +rep cmpsb +pop cx di si +je oksystem +add di,32 +inc dx +cmp dx,nbfit +ja errorboot +cmp di,sizec +jb findnext +inc cx +jmp Check +oksystem: +mov cx,[di+BX+26] +errorboot: +pop es ds di si dx bx +ret + +;->name ds:si ->es:di +AsciiZtoFit: +push ax bx cx dx si di ds es +xor bx,bx +mov dx,di +noextens: +mov al,[si+bx] +cmp al,'.' +je extens +call Issystchar +jc errortranslate +mov es:[di],al +inc di +inc bx +cmp bx,namesize ;(.) +jne noextens +erro: +stc +jmp errortranslate +extens: +add si,bx +inc si +sub bx,namesize +neg bx +mov al,0 +mov cx,bx +cld +rep stosb +xor bx,bx +wasextens: +mov al,[si+bx] +cmp al,0 +je endextens +call Issystchar +jc errortranslate +mov es:[di],al +inc di +inc bx +cmp bx,extsize +jne wasextens +jmp erro +endextens: +sub bx,extsize +neg bx +mov al,0 +mov cx,bx +cld +rep stosb +mov si,dx +mov di,dx +push es +pop ds +mov cx,extsize+namesize +call uppercaseMEM +clc +endtranslate: +pop es ds di si dx cx bx ax +ret +errortranslate: +stc +jmp endtranslate + +;Carry si al = caractŠre systŠme +isSystchar: +push di +mov di,offset exeptchar +isexcept: +cmp al,cs:[di] +je nogood +inc di +cmp byte ptr cs:[di],0 +jne isexcept +endanal: +pop di +ret +exeptchar db '/\<>:|.',01,0,0 +nogood: +stc +jmp endanal + +;Transforme les x caractŠres de la mem en ds:si en maj +uppercaseMEM: +push si di cx ax +mov di,si +uppercaser: +mov al,ds:[si] +inc si +cmp al,'A' +jb nonmaj +cmp al,'Z' +ja nonmaj +add al,'a'-'A' +nonmaj: +mov es:[di],al +inc di +dec cx +jnz uppercaser +enduppercase: +clc +pop ax cx di si +ret + +namesize equ 12 +extsize equ 5 +nbfit equ 255 +video db 'video.sys',0 +temp db 12+5+1 dup (0) DiskSectorsPerTrack dw 18 DiskTracksPerHead dw 80 diff --git a/vg2.asm b/video.asm similarity index 87% rename from vg2.asm rename to video.asm index 2e218b4..52bb781 100755 --- a/vg2.asm +++ b/video.asm @@ -193,8 +193,17 @@ mode2 DB 63H, 00H, 03H,01H,03H,01H,02H DB 0CH,00H,0FH,00H,00H db 80,50 -;640*480 16 couleurs -mode3 DB 63H, 00H, 03H,01H,0FH,00H,0EH +;320*200 16 couleurs +mode3 DB 63H,00H, 03H,09H,0FH,00H,06H + DB 2DH,27H,28H,90H,2BH,080H,0BFH,01FH,00H,0C0H,00H,00H,00H,00H,00H,00H + DB 9CH,8EH,8FH,14H,00H,96H,0B9H,0E3H,0FFH + DB 00H,00H,00H,00H,00H,00H,05H,0FH,0FFH + DB 00H,01H,02H,03H,04H,05H,06H,07H,08H,09H,0AH,0BH,0CH,0DH,0EH,0FH + DB 41H,00H,0FH,00H,00H + db 40,25 + +;320*200 256 couleurs +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,40H,05H,0FH,0FFH @@ -202,8 +211,8 @@ mode3 DB 63H, 00H, 03H,01H,0FH,00H,0EH DB 41H,00H,0FH,00H,00H db 00,00 -;320*240 256 couleurs -mode4 DB 63H, 00H, 03H,01H,0FH,00H,0EH +;640*400 16 couleurs +mode5 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 @@ -211,6 +220,25 @@ mode4 DB 63H, 00H, 03H,01H,0FH,00H,0EH DB 41H,00H,0FH,00H,00H db 00,00 +;640*400 16 couleurs +mode6 DB 63H, 00H, 03H,01H,0FH,00H,0EH + DB 2DH,27H,27H,91H,2AH,9FH,0BFH,1FH,00H,0C0H,00H,00H,00H,00H,00H,00H + DB 9CH,0EH,8FH,50H,00H,8FH,0C0H,0E3H,0FFH + DB 00H,00H,00H,00H,00H,40H,05H,0FH,0FFH + DB 00H,01H,02H,03H,04H,05H,06H,07H,08H,09H,0AH,0BH,0CH,0DH,0EH,0FH + DB 41H,00H,0FH,00H,00H + db 00,00 + +;640*400 16 couleurs +mode6 DB 63H, 00H, 03H,01H,0FH,00H,0EH + DB 2DH,27H,27H,91H,2AH,9FH,0BFH,1FH,00H,0C0H,00H,00H,00H,00H,00H,00H + DB 9CH,0EH,8FH,50H,00H,8FH,0C0H,0E3H,0FFH + DB 00H,00H,00H,00H,00H,40H,05H,0FH,0FFH + DB 00H,01H,02H,03H,04H,05H,06H,07H,08H,09H,0AH,0BH,0CH,0DH,0EH,0FH + DB 41H,00H,0FH,00H,00H + db 00,00 + +; ;=============CLEAR========= ;Efface l'ecran texte ;-> @@ -878,18 +906,6 @@ colors db 7 mode db 0FFh pagesize dw 0 special equ $ - - endofme equ $ +4096 end start - - - - - - - - - - diff --git a/write.bat b/write.bat new file mode 100755 index 0000000..808b110 --- /dev/null +++ b/write.bat @@ -0,0 +1,4 @@ +@echo off +cd .. +setup +cd sources