refactor: rangement des sources dans différents répertoires. Gestion de joystick.

This commit is contained in:
Nicolas Hordé 2001-07-01 22:48:10 +02:00
parent 336d676da6
commit 9732d45b9f
45 changed files with 2560 additions and 1652 deletions

97
API.md Executable file
View File

@ -0,0 +1,97 @@
Liste exhaustive des APIs supportée par cos
78 fonctions
Drive.sys : Gestionnaires FAT,FIT et partition
Interruption 48h (Disquette uniquement)
fonctions 00h readsector
01h writesector
02h verifysector
03h loadfatway
04h loadfile
05h compressrle
06h decompressrle
lpt.sys : Gestionnaires port parallèle
Interruption 0Dh (LPT1) ou 0Fh (LPT2)
fonctions 00h getlptin
01h getlptout
02h getlptinout
03h setlptin
04h setlptout
05h setlptinout
06h getlpt
07h getfirstlpt
08h setemettor
09h setreceptor
0Ah settimeout
0Bh gettimeout
0Ch receivelpt
0Dh sendlpt
0Eh receivelptblock
0Fh sendlptblock
10h receivecommand
11h sendcommand
mouse.sys : Gestionnaires souris
Interruption 74h (PS/2)
fonctions 00h cmdmouse
01h cmdmouse2
02h detectmouse
03h getmouse
04h getmousescreen
05h configmouse
pic8259a.sys : Gestionnaires contrôleur d'interruption programmable
Interruption 50h (Maître et esclave)
fonctions 00h enableirq
01h disableirq
02h readmaskirq
03h readirr
04h readisr
05h installhandler
06h replacehandler
07h getint
08h setint
09h seteoi
video.sys : Gestionnaires de la carte video
Interruption 47h (VGA)
fonctions 00h setvideomode
01h getvideomode
02h cleartext
03h changefont
04h loadfont
05h space
06h line
07h showchar
08h showint
09h showsigned
0Ah showhex
0Bh showbin
0Ch showstring
0Dh showstring0
0Eh showcharat
0Fh showintat
10h showsignedat
11h showhexat
12h showbinat
13h showstringat
14h showstring0at
15h setcolor
16h getcolor
17h scrolldown
18h getxy
19h setxy
1Ah savescreen
1Bh restorescreen
1Ch page2to1
1Dh page1to2
1Eh xchgPages
1Fh savepage1
20h changelineattr
21h waitretrace
22h getinfos
23h loadbmp
24h showbmp
25h clearscr
26h savedac
27h restoredac
28h savestate
29h restorestate

36
INFORMATIONS.md Executable file
View File

@ -0,0 +1,36 @@
< COS2000 the new operating system >
I. Présentation
COS2000, par définition est système d'exploitation, celui prend la direction des opérations à partir du moment où le PC est mis sous tension (Aprés le BIOS). Celui gére tous les périphériques rattaché au PC et offre aux programmeur les moyens de développer des applications compatibles : les APIs. COS2000 est basé sur un concept particulier qui est d'offrir au programmeur un maximum de fonctions intégrés pour faciliter le travail des programmeurs et réduire la taille des programmes.
II. Mode d'emploi
Pour installer COS2000 :
- Insérez une disquette 1.44 Mo dans votre lecteur.
- Lancez le programme Setup.com.
- Si celui-ci ne détecte pas d'erreur, COS2000 est installé !
Pour lancer COS2000 :
- Insérez la disquette où COS2000 est installé.
- Veillez que dans le BIOS vous puissiez démarrer à partir de A:.
- Redémarrer votre ordinateur et vous serez sur COS2000.
Pour utiliser COS2000 :
Le COS MENU LOADER est le premier logiciel qui est lancé au démarrage. A partir de celui-ci vous pouvez visionner tout les fichiers présents sur votre disquette et éventuellement s'il possèdent l'extension EXE, ils peuvent être exécutés.
Pour cela il suffit de sélectionner avec la ligne en surbrillance le programme à executer en utilisant les flêches de directions, pour éxecuter le programmer presser la touche "Entrée".
A partir du COS MENU LOADER on peut lancer un interpréteur de commandes . Celui s'appelle PROMPT.EXE.
Une fois dans l'interpréteur de commande vous pouvez tout aussi bien lancer des logiciels en saissisant leurs noms après "COS>".
En plus des logiciels, l'interpréteur de commande peut exécuter 6 commandes :
EXIT Quitte l'interpréteur
VERSION Donne la version de COS2000
CLS Efface l'écran
REBOOT Redémarre le PC
COMMAND Donne la liste des commandes disponibles
MODE [mode] Permet de changer de mode vidéo, [mode] doit être un nombre entre 1 et 9.
les modes au delà de 4 sont des modes graphiques à texte émulé, il est
déconseillé de les utiliser car il est parfois impossible de revenir aux modes texte.

View File

@ -1 +0,0 @@
del ..\data\*.exe

View File

@ -1,11 +1,11 @@
@echo off
echo Assembling file %1...
util\tasm %1.asm /m5/x/t
..\util\tasm %1.asm /m5/x/t
if errorlevel 1 goto end
if "%1"=="boot" goto boot
echo Linking file %1...
util\tlink %1.obj /x/t
..\util\tlink %1.obj /x/t
if errorlevel 1 goto end
echo Copying file %1...
if "%1"=="video" goto video
@ -15,6 +15,7 @@ if "%1"=="mouse" goto system
if "%1"=="pic8259a" goto system
if "%1"=="timer" goto system
if "%1"=="drive" goto system
if "%1"=="joystick" goto system
if "%1"=="system" goto system
if "%1"=="setup" goto setup
copy %1.com ..\data\%1.exe>nul
@ -22,10 +23,10 @@ goto end
:boot
echo Linking file %1...
util\tlink %1.obj /x
..\util\tlink %1.obj /x
if errorlevel 1 goto end
echo Copying file %1...
util\exe2boot %1.exe
..\util\exe2boot %1.exe
copy %1.bin ..\data\%1.bin>nul
goto end

3
commande/clean.bat Executable file
View File

@ -0,0 +1,3 @@
@echo off
echo nettoyage en cours...
del ..\data\*.* >nul

2
commande/debog.bat Executable file
View File

@ -0,0 +1,2 @@
@echo off
..\util\td %1

View File

@ -12,6 +12,8 @@ start:
int 47h
mov ah,6
int 47h
mov ah,42
int 47h
mov ah,13
mov si,offset msg
int 47h
@ -182,7 +184,7 @@ Code_Version:
int 47h
ret
Version_Text db 'Cos 2000 version 1.1.1B by Nico',0
Version_Text db 'Cos 2000 version 2.0.1B by Nico',0
Code_Cls:
mov ah,2

View File

@ -70,6 +70,7 @@ int 21h
jc error
mov dx,offset boot
call addfile
jc error
mov ax,0F0FFh
mov cx,14
mov di,offset fat
@ -112,6 +113,9 @@ mov si,offset dta+30
mov cl,13
call uppercasemem
mov dx,si
cmp dword ptr [si],'toob'
clc
je allfilesend
int 21h
jc error
call addfile
@ -127,6 +131,7 @@ mov al,0
mov cl,13
cld
rep stosb
allfilesend:
mov ah,4fh
int 21h
jnc allfile
@ -223,12 +228,16 @@ end1:
mov ah,3eh
mov bx,cs:temp
int 21h
errorend:
pop es ds bp di si dx bx ax
ret
entrie dw 0
error2:
mov ah,3eh
mov bx,cs:temp
int 21h
stc
jmp end1
jmp errorend
temp dw 0
makefit:
@ -236,6 +245,7 @@ push bx cx si di bp
mov ax,cx
mov bx,offset fat
mov cx,13
retry:
call readsector
jc error3
xor si,si
@ -245,7 +255,8 @@ je finishfit
add si,32
cmp si,512
jb findfit
jmp error3
inc cx
jmp retry
finishfit:
mov di,si
add di,bx
@ -253,7 +264,6 @@ mov si,dx
call asciiztofit
jc error3
mov [di+26],ax
mov cx,13
call writesector
jc error3
end3:

View File

@ -1,2 +0,0 @@
@echo off
util\td %1

55
noyau/asm.bat Executable file
View File

@ -0,0 +1,55 @@
@echo off
echo Assembling file %1...
..\util\tasm %1.asm /m5/x/t
if errorlevel 1 goto end
if "%1"=="boot" goto boot
echo Linking file %1...
..\util\tlink %1.obj /x/t
if errorlevel 1 goto end
echo Copying file %1...
if "%1"=="video" goto video
if "%1"=="lpt" goto system
if "%1"=="keyboard" goto system
if "%1"=="mouse" goto system
if "%1"=="pic8259a" goto system
if "%1"=="timer" goto system
if "%1"=="drive" goto system
if "%1"=="joystick" goto system
if "%1"=="system" goto system
if "%1"=="setup" goto setup
if "%1"=="hours" goto system
copy %1.com ..\data\%1.exe>nul
goto end
:boot
echo Linking file %1...
..\util\tlink %1.obj /x
if errorlevel 1 goto end
echo Copying file %1...
..\util\exe2boot %1.exe
copy %1.bin ..\data\%1.bin>nul
goto end
:video
type thin8x8.fnt>>%1.com
:system
copy %1.com ..\data\%1.sys>nul
goto end
:setup
copy %1.com ..\%1.com>nul
goto end
:end
if not exist *.bin goto exes
del *.bin
:exes
if not exist *.exe goto coms
del *.exe
:coms
if not exist *.com goto objs
del *.com
:objs
if not exist *.obj goto nobjs
del *.obj
:nobjs

View File

@ -7,3 +7,5 @@ call asm pic8259a
call asm timer
call asm drive
call asm mouse
call asm joystick
call asm boot

3
noyau/clean.bat Executable file
View File

@ -0,0 +1,3 @@
@echo off
echo nettoyage en cours...
del ..\data\*.* >nul

2
noyau/debog.bat Executable file
View File

@ -0,0 +1,2 @@
@echo off
..\util\td %1

View File

@ -241,6 +241,7 @@ call searchfile
jc errorloadfile
mov bx,di
call loadfatway
jc errorloadfile
mov cx,dx
errorloadfile:
pop bx
@ -248,7 +249,7 @@ ret
;Recherche le fichier et retourne sont path et en cx sont debut
Searchfile:
push bx dx si di ds es
push ax bx dx si di ds es
push cs
pop es
xor dx,dx
@ -290,7 +291,7 @@ jmp goodboot
errorboot:
stc
goodboot:
pop es ds di si dx bx
pop es ds di si dx bx ax
ret
;->name ds:si ->es:di

81
noyau/hours.asm Executable file
View File

@ -0,0 +1,81 @@
.model tiny
.486
smart
.code
org 0100h
start:
jmp tsr
offsets dd 0
db 'HOURS'
tsr:
pushf
db 2eh,0ffh,1eh
dw offsets
cli
pusha
push ds es
push cs
push cs
pop ds
pop es
mov ah,22h
mov di,offset infos
int 47h
mov bl,[infos+1]
xor bh,bh
sub bl,8
mov di,bx
shl di,1
mov dx,71h
xor eax,eax
mov cx,0B800h
mov es,cx
mov cl,4
mov bp,8
show:
dec dx
mov al,cl
out dx,al
inc dx
in al,dx
call showbcd
cmp cl,0
je finic
mov byte ptr es:[di],':'
add di,2
sub cl,2
jmp show
finic:
pop es ds
popa
sti
iret
;==============================Affiche le nombre nb hexa en EDX==============
Showbcd:
push ax bx cx edx
mov edx,eax
mov cx,bp
sub cx,32
neg cx
shl edx,cl
mov ax,bp
shr ax,2
bcdaize:
rol edx,4
mov bx,dx
and bx,0fh
add bl,'0'
mov es:[di],bl
add di,2
dec al
jnz bcdaize
pop edx cx bx ax
ret
infos db 40 dup (0)
end start

298
noyau/joystick.asm Executable file
View File

@ -0,0 +1,298 @@
.model tiny
.486
smart
.code
org 0100h
start:
jmp tsr
drv db 'JOYSTICK',0
Tsr:
cli
cmp ax,1234h
jne nomore
mov ax,4321h
jmp itsok
nomore:
push bx
cmp byte ptr cs:isact,1
je nottest
mov cs:isact,1
jmp react
mov bl,ah
xor bh,bh
shl bx,1
mov bx,cs:[bx].tables
mov cs:current,bx
pop bx
call cs:current
itsok:
jnc noerror
push bp
mov bp,sp
or byte ptr [bp+6],1b
pop bp
mov ax,cs
shl eax,16
mov ax,cs:current
jmp endofint
noerror:
push bp
mov bp,sp
and byte ptr [bp+6],0FEh
pop bp
endofint:
mov cs:isact,0
sti
iret
nottest:
pop bx
jmp endofint
current dw 0
tables dw 0;detectjoystick
;dw getjoystick
;dw getjoystickscreen
;dw configjoystick
isact db 0
;envoie en bx,cx les coordonnes et en dl les boutons
getjoystick:
push ax cx
mov bx,cs:rx
mov cx,cs:ry
mov al,cs:button
not al
mov cl,4
shr al,cl
mov dl,al
pop cx ax
ret
;envoie en di les coordonnes ecran et en dl les boutons
getjoystickscreen:
push ax cx
mov di,cs:xy
mov al,cs:button
not al
mov cl,4
shr al,cl
mov dl,al
pop cx ax
ret
db 'button'
Button db 0
db 'rx'
rx dw 0
db 'ry'
ry dw 0
db 'vx'
VX db 0
db 'vy'
VY db 0
db 'x'
X dw 7FFFh
db 'y'
Y dw 7FFFh
speed db 6
spherex db 0
spherey db 0
db 'count'
count db 0
db 'error'
error db 0
xy dw 0
old db 0
calibrate db 0
db 'ticks'
ticks dw 0
db 'state'
state db 0
db 'connard'
connard db 1
connard2 db 1
;Gestionnaire de joystick
react:
push ax bx cx dx si di bp ds es
push cs
pop ds
mov dx,201h
cmp error, 1
je gest1
cmp count,1
je gest1
cmp count,2
je gest2
gest1:
mov error,0
mov count,2
call getticks
mov ticks,ax
out dx,al
in al,dx
and al,00000011b
mov state,al
jmp endgest
gest2:
not connard
call getticks
sub ax,ticks
cmp ax,1FF0h
jb nofinish
mov error,1
jmp endgest
nofinish:
mov bx,ax
in al,dx
and al,00000011b
cmp state,al
je endgest
xchg state,al
xor al,state
mov cl,4
or bx,bx
js noadj
shr bx,cl
noadj:
test al,1
je isy
mov VX,bl
jmp wasx
isy:
test al,2
je endgest
mov VY,bl
wasx:
mov connard2,0fh
mov count,1
endgest:
in al,dx
not al
mov cl,4
shr al,cl
mov button,al
push cs
pop es
mov di,offset infos
mov ah,34
int 47h
mov cl,speed
movsx bx,VY
shl bx,cl
cmp spherey,0
jne nolimity
xor ah,ah
mov al,[di]
cmp byte ptr [di+7],4
jbe text4
shl ax,3
text4:
dec ax
cmp bx,0
jg decy
cmp ry,ax
jae noaddy
jmp nolimity
decy:
cmp ry,0
je noaddy
nolimity:
sub y,bx
noaddy:
movsx bx,VX
shl bx,cl
cmp spherex,0
jne nolimitx
xor ah,ah
mov al,[di+1]
cmp byte ptr [di+7],4
jbe text5
shl ax,3
text5:
dec ax
cmp bx,0
jl decx
cmp rx,ax
jae noaddx
jmp nolimitx
decx:
cmp rx,0
je noaddx
nolimitx:
add x,bx
noaddx:
mov ax,x
mov bx,0FFFFh
xor ch,ch
mov cl,[di+1]
cmp byte ptr [di+7],4
jbe text1
shl cx,3
text1:
mul cx
div bx
mov rx,ax
mov ax,y
xor ch,ch
mov cl,[di]
cmp byte ptr [di+7],4
jbe text2
shl cx,3
text2:
mul cx
div bx
mov ry,ax
xor ch,ch
mov cl,[di+1]
cmp byte ptr [di+7],4
jbe text3
shl cx,3
text3:
mul cx
add ax,rx
cmp byte ptr [di+7],4
mov di,ax
jbe textpoint
mov ax,0A000h
mov es,ax
jmp graphpoint
textpoint:
mov ax,0B800h
mov es,ax
shl di,1
inc di
graphpoint:
mov bx,xy
cmp byte ptr es:[bx],070h
jne waschanged
mov al,old
mov byte ptr es:[bx],al
waschanged:
mov xy,di
mov al,es:[di]
mov old,al
mov byte ptr es:[di],070h
mov al, 20h
out 0a0h, al
out 20h, al
errormouse:
pop es ds bp di si dx cx bx ax
mov cs:isact,0
pop bx
iret
infos db 40 dup (0)
getticks:
mov al,0
out 43h,al
jmp wait1
wait1:
in al,40h
mov ah,al
jmp wait2
wait2:
in al,40h
xchg ah,al
ret
end start

View File

@ -33,7 +33,7 @@ tsr:
sti
iret
isstate db 0
infos db 10 dup (0)
infos db 40 dup (0)
F11:
push ax di es
@ -42,9 +42,13 @@ F11:
mov di,offset infos
mov ah,34
int 47h
mov al,cs:infos+7
mov al,cs:[di+7]
inc al
and ax,111b
cmp al,9
jbe notabove
mov al,0
notabove:
mov ah,0
int 47h
pop es di ax
jmp endof

View File

@ -146,7 +146,6 @@ ret
;envoie en di les coordonnes ecran et en dl les boutons
getmousescreen:
mov di,cs:xy
mov cx,cs:ry
mov dl,cs:button
sub dl,8
and dl,0Fh
@ -166,15 +165,15 @@ rx dw 0
ry dw 0
VX db 0
VY db 0
X dw 0
Y dw 0
X dw 7FFFh
Y dw 7FFFh
speed db 6
spherex db 0
spherey db 0
count db 0
error db 0
xy dw 0
old dw 0
old db 0
;Gestionnaire de souris PS/2
react:
push ax bx cx dx di ds es
@ -224,8 +223,12 @@ endgest:
shl bx,cl
cmp spherey,0
jne nolimity
mov al,[di]
xor ah,ah
mov al,[di]
cmp byte ptr [di+7],4
jbe text4
shl ax,3
text4:
dec ax
cmp bx,0
jg decy
@ -242,8 +245,12 @@ noaddy:
shl bx,cl
cmp spherex,0
jne nolimitx
xor ah,ah
mov al,[di+1]
xor ah,ah
cmp byte ptr [di+7],4
jbe text5
shl ax,3
text5:
dec ax
cmp bx,0
jl decx
@ -260,27 +267,53 @@ noaddx:
mov bx,0FFFFh
xor ch,ch
mov cl,[di+1]
cmp byte ptr [di+7],4
jbe text1
shl cx,3
text1:
mul cx
div bx
mov rx,ax
mov ax,y
xor ch,ch
mov cl,[di]
cmp byte ptr [di+7],4
jbe text2
shl cx,3
text2:
mul cx
div bx
mov ry,ax
mul byte ptr [di+1]
xor ch,ch
mov cl,[di+1]
cmp byte ptr [di+7],4
jbe text3
shl cx,3
text3:
mul cx
add ax,rx
shl ax,1
cmp byte ptr [di+7],4
mov di,ax
jbe textpoint
mov ax,0A000h
mov es,ax
jmp graphpoint
textpoint:
mov ax,0B800h
mov es,ax
shl di,1
inc di
graphpoint:
mov bx,xy
mov ax,old
mov word ptr es:[bx],ax
cmp byte ptr es:[bx],070h
jne waschanged
mov al,old
mov byte ptr es:[bx],al
waschanged:
mov xy,di
mov ax,es:[di]
mov old,ax
mov word ptr es:[di],0FF70h
mov al,es:[di]
mov old,al
mov byte ptr es:[di],070h
mov al, 20h
out 0a0h, al
out 20h, al
@ -289,6 +322,6 @@ errormouse:
mov cs:isact,0
pop bx
iret
infos db 10 dup (0)
infos db 40 dup (0)
end start

View File

@ -177,29 +177,33 @@ ret
;remplace le handler pointer par ds:si en bx:100h interruption ax
replacehandler:
push ax bx si di ds es
push ax bx cx si di ds es
mov es,bx
mov di,0100h
mov ah,4
int 48h
jc reph
mov bx,ax
call getint
mov es:[102h],si
mov es:[104h],ds
call setint
pop es ds di si bx ax
reph:
pop es ds di si cx bx ax
ret
;install le handler pointer par ds:si en bx:100h interruption ax
installhandler:
push bx di es
push bx cx di es
mov es,bx
mov di,100h
mov ah,4
int 48h
jc inh
mov bx,ax
call setint
pop es di bx
inh:
pop es di cx bx
ret
;met es:di le handle de l'int al

View File

@ -10,22 +10,27 @@ mov si,offset video
mov bx,400h
mov ax,47h
call installhandler
jc erroron
mov si,offset timer
mov bx,900h
mov ax,8h
call replacehandler
jc erroron
mov si,offset pic
mov bx,950h
mov ax,50h
call installhandler
jc erroron
mov si,offset drive
mov bx,1020h
mov ax,48h
call installhandler
jc erroron
mov si,offset keyboard
mov bx,1400h
mov ax,9h
call replacehandler
jc erroron
mov ax,40h
mov es,ax
mov dx,es:[8]
@ -38,6 +43,7 @@ mov si,offset lpt
mov bx,1500h
mov ax,0Fh
call installhandler
jc erroron
mov es,bx
sub al,8
xor ah,ah
@ -58,6 +64,7 @@ mov si,offset lpt
mov bx,1700h
mov ax,0Dh
call installhandler
jc erroron
sub al,8
xor ah,ah
int 50h
@ -68,19 +75,19 @@ mov si,offset mouse
mov bx,1900h
mov ax,74h
call installhandler
jc erroron
mov ax,0012
int 50h
;mov ah, 00010000b
;not ah
;in al, 0a1h
;and al, ah
;out 0a1h, al
mov ah,2
int 74h
;mov si,offset joystick
;mov bx,2700h
;mov ax,08h
;call replacehandler
mov si,offset hours
mov bx,2900h
mov ax,08h
call replacehandler
start2:
push cs
@ -231,65 +238,6 @@ executefatway:
push 7202h
popf
db 0CBh
;cx entre -> fatway chemin
getfatway:
push bx cx es
mov bx,offset fatway
fatagain:
mov cs:[bx],cx
add bx,2
cmp cx,0FFF0h
jae finishload
call getfat
jnc fatagain
finishload:
pop es cx bx
ret
loadfatway:
push ax bx cx di
call getfatway
jc endload
mov di,offset fatway
mov si,offset dot
mov ah,13
loadagain:
mov cx,cs:[di]
cmp cx,0FFF0h
jae endload
add di,2
call readsector
jc endload
int 47h
add bx,cs:sizec
jmp loadagain
endload:
pop di cx bx ax
ret
sizec dw 512
reserv dw 1
;<-cx nøsecteur ->cx code FAT
getfat:
push es ax bx dx
mov ax,cx
xor dx,dx
div cs:sizec
mov cx,ax
add cx,cs:reserv
mov bx,offset buffer
push cs
pop es
call readsector
jc errorgetfat
shl dx,1
add bx,dx
mov cx,cs:[bx]
errorgetfat:
pop dx bx ax es
ret
;selectionne la ligne xx
Select:
@ -318,7 +266,70 @@ msg3 db ' Cos will restart your computer, eject the floppy disk and press a key'
prompt db '>',0
spaces db ' ',0
dot db '.',0
;cx entre -> fatway chemin
getfatway:
push bx cx
mov bx,offset fatway
fatagain:
mov cs:[bx],cx
add bx,2
cmp cx,0FFF0h
jae finishload
call getfat
jnc fatagain
finishload:
pop cx bx
ret
;Charge le fichier de chemin cx -> taille dx
loadfatway:
push ax bx cx di
call getfatway
jc endload
mov di,offset fatway
mov si,offset dot
mov ah,13
xor dx,dx
loadagain:
mov cx,cs:[di]
cmp cx,0FFF0h
jae endload
add di,2
call readsector
jc endload
add bx,cs:sizec
add dx,cs:sizec
jmp loadagain
endload:
pop di cx bx ax
ret
sizec dw 512
reserv dw 1
;<-cx nøsecteur ->cx code FAT
getfat:
push es ax bx dx
push cs
pop ds
push cs
pop es
mov ax,cx
xor dx,dx
div sizec
mov cx,ax
add cx,reserv
mov bx,offset buffer
call readsector
jc errorgetfat
shl dx,1
add bx,dx
mov cx,[bx]
errorgetfat:
pop dx bx ax es
ret
ReadSector:
push ax cx dx si
@ -396,38 +407,45 @@ Lastread dw 0FFFFh
;remplace le handler pointer par ds:si en bx:100h interruption ax
replacehandler:
push ax bx si di ds es
push ax bx cx si di ds es
mov es,bx
mov di,0100h
call loadfile
jc reph
mov bx,ax
call getint
mov es:[102h],si
mov es:[104h],ds
call setint
pop es ds di si bx ax
reph:
pop es ds di si cx bx ax
ret
;install le handler pointer par ds:si en bx:100h interruption ax
installhandler:
push bx di es
push bx cx di es
mov es,bx
mov di,100h
call loadfile
jc insh
mov bx,ax
call setint
pop es di bx
insh:
pop es di cx bx
ret
;Charge le fichier Ds:si en es:di
;Charge le fichier Ds:si en es:di taille-> cx
loadfile:
push bx cx
push bx
call searchfile
jc errorloadfile
mov bx,di
call loadfatway
pop cx bx
ret
jc errorloadfile
mov cx,dx
errorloadfile:
pop bx
ret
;met es:di le handle de l'int bx
setint:
@ -453,17 +471,19 @@ mov ds,es:[bx+2]
pop es bx ax
ret
;Recherchele fichier et retourne sont path et en cx sont debut
;Recherche le fichier et retourne sont path et en cx sont debut
Searchfile:
push bx dx si di ds es
xor dx,dx
push ax bx dx si di ds es
push cs
pop es
xor dx,dx
mov di,offset temp
mov bx,offset buffer
call asciiztofit
push cs
pop ds
mov cx,13
check:
mov bx,offset buffer
call readsector
jc errorboot
xor di,di
@ -475,6 +495,7 @@ mov si,di
add si,bx
mov di,offset temp
mov cx,12+4
cld
rep cmpsb
pop cx di si
je oksystem
@ -488,8 +509,12 @@ inc cx
jmp Check
oksystem:
mov cx,[di+BX+26]
cld
jmp goodboot
errorboot:
pop es ds di si dx bx
stc
goodboot:
pop es ds di si dx bx ax
ret
;->name ds:si ->es:di
@ -565,9 +590,9 @@ inc di
cmp byte ptr cs:[di],0
jne isexcept
endanal:
pop di
clc
pop di
ret
exeptchar db '/\<>:|.',01,0,0
nogood:
stc
jmp endanal
@ -594,11 +619,43 @@ clc
pop ax cx di si
ret
erroron:
push cs
pop ds
xor edx,edx
mov dx,ax
mov ax,0001h
int 47h
mov ah,6
int 47h
mov ah,6
int 47h
mov ah,13
mov si,offset errormsg
int 47h
mov ah,10
mov cx,16
int 47h
mov ah,6
int 47h
mov ah,6
int 47h
mov ah,13
mov si,offset errormsg2
int 47h
mov ax,0
int 16h
push 0FFFFh
push 0
db 0CBh
errormsg db 'Error with drivers loading on interrupt nø',0
errormsg2 db 'Press a key to restart...',0
namesize equ 12
extsize equ 5
extsize equ 5
nbfit equ 255
hours db 'hours.sys',0
joystick db 'joystick.sys',0
mouse db 'mouse.sys',0
pic db 'pic8259a.sys',0
drive db 'drive.sys',0
@ -607,7 +664,7 @@ lpt db 'lpt.sys',0
video db 'video.sys',0
keyboard db 'keyboard.sys',0
temp db 12+5+1 dup (0)
exeptchar db '/\<>:|.',01,0,0
DiskSectorsPerTrack dw 18
DiskTracksPerHead dw 80
DiskHeads dw 2
@ -615,4 +672,5 @@ DiskHeads dw 2
fatway equ $
buffer equ $+3000
end start

BIN
noyau/thin8x8.fnt Executable file

Binary file not shown.

32
noyau/timer.asm Executable file
View File

@ -0,0 +1,32 @@
.model tiny
.486
smart
.code
org 0100h
start:
jmp tsr
offsets dd 0
db 'TIMER'
tsr:
pushf
db 2eh,0ffh,1eh
dw offsets
cli
push ax bx es
mov bx,cs:compteur
inc bx
and bx,11b
mov cs:compteur,bx
mov bx,cs:[offset fig+bx]
mov ax,0B800h
mov es,ax
mov es:[0],bl
pop es bx ax
sti
iret
compteur dw 0
fig db 'Ä\³/'
end start

1560
noyau/video.asm Executable file

File diff suppressed because it is too large Load Diff

4
noyau/write.bat Executable file
View File

@ -0,0 +1,4 @@
@echo off
cd ..
setup
cd sources

54
programs/asm.bat Executable file
View File

@ -0,0 +1,54 @@
@echo off
echo Assembling file %1...
..\util\tasm %1.asm /m5/x/t
if errorlevel 1 goto end
if "%1"=="boot" goto boot
echo Linking file %1...
..\util\tlink %1.obj /x/t
if errorlevel 1 goto end
echo Copying file %1...
if "%1"=="video" goto video
if "%1"=="lpt" goto system
if "%1"=="keyboard" goto system
if "%1"=="mouse" goto system
if "%1"=="pic8259a" goto system
if "%1"=="timer" goto system
if "%1"=="drive" goto system
if "%1"=="joystick" goto system
if "%1"=="system" goto system
if "%1"=="setup" goto setup
copy %1.com ..\data\%1.exe>nul
goto end
:boot
echo Linking file %1...
..\util\tlink %1.obj /x
if errorlevel 1 goto end
echo Copying file %1...
..\util\exe2boot %1.exe
copy %1.bin ..\data\%1.bin>nul
goto end
:video
type thin8x8.fnt>>%1.com
:system
copy %1.com ..\data\%1.sys>nul
goto end
:setup
copy %1.com ..\%1.com>nul
goto end
:end
if not exist *.bin goto exes
del *.bin
:exes
if not exist *.exe goto coms
del *.exe
:coms
if not exist *.com goto objs
del *.com
:objs
if not exist *.obj goto nobjs
del *.obj
:nobjs

3
programs/clean.bat Executable file
View File

@ -0,0 +1,3 @@
@echo off
echo nettoyage en cours...
del ..\data\*.* >nul

2
programs/debog.bat Executable file
View File

@ -0,0 +1,2 @@
@echo off
..\util\td %1

View File

@ -10,10 +10,10 @@ start:
int 16h
mov ax,0002
int 47H
mov ah,26
int 47H
mov ah,2
int 47h
mov ah,43
int 47h
xor bp,bp
Adres:
mov di,offset infos
@ -45,6 +45,14 @@ Adres:
mov di,offset infos
mov ah,34
int 47h
dec byte ptr [di]
mov al,[di+1]
sub al,16
mov bl,al
shr al,2
mov [di+1],al
and bl,11b
mov [di+2],bl
mov al,[di+7]
cmp al,oldmode
je noinit
@ -52,7 +60,6 @@ Adres:
int 47h
mov oldmode,al
noinit:
dec infos
mov bx,0
mov ah,25
int 47h
@ -77,7 +84,7 @@ lines:
int 47h
mov ah,5
int 47h
mov al,16
mov al,infos+1
mov cl,7
mov ah,21
int 47h
@ -96,7 +103,7 @@ doaline:
mov si,offset spaces
mov ah,13
int 47h
mov al,16
mov al,infos+1
mov ah,21
mov cl,7
int 47h
@ -109,6 +116,8 @@ doaline2:
jnz doaline2
dec bh
je outes
cmp byte ptr infos+2,0
je lines
mov ah,6
int 47h
jmp lines
@ -116,8 +125,10 @@ outes:
mov ah,21
mov cl,112
int 47h
mov bh,0
mov bl,infos
mov si,offset menu
mov ah,13
mov ah,14h
int 47h
waitkey:
mov ax,0
@ -270,9 +281,7 @@ cursor:
jmp waitst
suit7:
cmp ax,4200h
jne waitkey
mov ah,27
int 47h
jne adres2
db 0CBH
ret

View File

@ -10,18 +10,25 @@ start:
int 16h
mov ax,0002
int 47H
mov ah,26
int 47H
mov ah,2
int 47h
xor ebp,ebp
xor ax,ax
mov fs,ax
mov fs,ax
mov ah,43
int 47h
Adres:
mov di,offset infos
mov ah,34
int 47h
dec infos
dec byte ptr [di]
mov al,[di+1]
sub al,16
mov bl,al
shr al,2
mov [di+1],al
and bl,11b
mov [di+2],bl
mov al,[di+7]
cmp al,oldmode
je noinit
@ -55,7 +62,7 @@ lines:
int 47h
mov ah,5
int 47h
mov al,16
mov al,infos+1
mov cl,7
mov ah,21
int 47h
@ -78,7 +85,7 @@ doaline:
mov si,offset spaces
mov ah,13
int 47h
mov al,16
mov al,infos+1
mov ah,21
mov cl,7
int 47h
@ -95,6 +102,8 @@ doaline2:
jnz doaline2
dec bh
je outes
cmp byte ptr infos+2,0
je lines
mov ah,6
int 47h
jmp lines
@ -102,8 +111,10 @@ outes:
mov ah,21
mov cl,112
int 47h
mov bh,0
mov bl,infos
mov si,offset menu
mov ah,13
mov ah,14h
int 47h
waitkey:
mov ax,0
@ -140,16 +151,14 @@ outes:
suit6:
cmp ax,4100h
jne suit7
mov dword ptr [pope],'TIDE'
mov bl,infos
xor bh,bh
mov ah,25
int 47h
mov ah,21
mov cl,116
int 47h
mov dword ptr [pope],'TIDE'
mov bl,infos
xor bh,bh
mov si,offset menu
mov ah,13
mov ah,14h
int 47h
mov ah,21
mov cl,7
@ -275,7 +284,7 @@ cursor:
jmp waitst
suit7:
cmp ax,4200h
jne waitkey
jne adres
mov ah,27
int 47h
db 0CBH ; +++++++
@ -372,7 +381,7 @@ spaces db '
showbuffer db 35 dup (0FFh)
oldmode db 0
infos db 10 dup (0)
infos db 40 dup (0)
end start

View File

@ -21,7 +21,7 @@ mov ah,6
int 48h
push es
pop ds
mov ax,0006h
mov ax,0009h
int 47h
mov ah,38
int 47h
@ -29,8 +29,10 @@ mov ah,35
int 47h
mov ah,37
int 47h
xor cx,cx
xor bx,bx
mov ah,2
int 47h
mov cx,400
mov bx,40
mov ah,36
int 47h
mov ax,0

41
programs/mous.asm Executable file
View File

@ -0,0 +1,41 @@
.model tiny
.486
smart
.code
org 0100h
start:
mov ax,6
int 47h
mov ax,0a000h
mov es,ax
mov ds,ax
xor di,di
mov cx,0ffffh/4
mov eax,0
rep stosd
mov ax,0c40h
boucle:
mov ah,4
int 74h
mov byte ptr es:[di],0FFh
mov si,0
mov di,0
mov cx,0ffffh
reboucle:
mov al,[si]
inc si
cmp al,0
je suite
dec al
suite:
mov es:[di],al
inc di
dec cx
jnz reboucle
cmp dl,2
jne boucle
db 0CBh
end start

View File

@ -48,11 +48,13 @@ int 47h
mov ah,6
int 47h
mov edx,-6876253
mov cx,32
mov ah,9
int 47h
mov ah,6
int 47h
mov edx,-311212323
mov cx,32
mov ah,9
int 47h
mov ah,6

4
programs/write.bat Executable file
View File

@ -0,0 +1,4 @@
@echo off
cd ..
setup
cd sources

View File

@ -1,91 +0,0 @@
.model tiny
.486
smart
.code
org 0100h
start:
jmp tsr
offsets dd 0
db 'TIMER'
tsr:
pushf
db 2eh,0ffh,1eh
dw offsets
cli
push ax bx es
mov bx,cs:compteur
inc bx
and bx,11b
mov cs:compteur,bx
mov bx,cs:[offset fig+bx]
mov ax,0B800h
mov es,ax
mov es:[0],bl
push ds es
pusha
mov ax,40h
mov es,ax
mov ax,0B800h
mov ds,ax
mov word ptr dx,es:[8]
in al,dx
mov di,158
decompose:
mov cl,al
and cl,1
cmp cl,1
je un
mov byte ptr ds:[di],'0'
jmp errr
un:
mov byte ptr ds:[di],'1'
errr:
shr al,1
dec di
dec di
cmp di,142
jne decompose
inc dx
in al,dx
mov di,318
decompose2:
mov cl,al
and cl,1
cmp cl,1
je un2
mov byte ptr ds:[di],'0'
jmp errr2
un2:
mov byte ptr ds:[di],'1'
errr2:
cmp di,314
jb errrr
mov byte ptr ds:[di],'X'
errrr:
shr al,1
dec di
dec di
cmp di,302
jne decompose2
popa
pop es ds
pop es bx ax
sti
iret
compteur dw 0
fig db 'Ä\³/'
end start

1412
video.asm

File diff suppressed because it is too large Load Diff