feat: version bêta 1.3.2fr
This commit is contained in:
parent
9e47321c92
commit
8d0fd22134
266
noyau/8237.asm
Normal file
266
noyau/8237.asm
Normal file
@ -0,0 +1,266 @@
|
||||
;****************************************************************
|
||||
; *
|
||||
; Periph‚rique : DMA *
|
||||
; Plages Entr‚es-Sorties : 0000-000F *
|
||||
; 00C0-00DF *
|
||||
; 0080-0090 *
|
||||
; (0094-009F) *
|
||||
; Plages M‚moires : AUCUNES *
|
||||
; *
|
||||
DmaRead equ 044h ;I/O to memory, no autoinit, increment, single mode
|
||||
DmaWrite equ 048h ;Memory to I/O, no autoinit, increment, single mode
|
||||
|
||||
;Lecture des bits du registre d'‚tat (08, D0 )
|
||||
STATUS_REQ3 = 80h ;Bit actif: le canal DMA concern‚
|
||||
STATUS_REQ2 = 40h ;re‡oit une requˆte DMA
|
||||
STATUS_REQ1 = 20h ;Request
|
||||
STATUS_REQ0 = 10h
|
||||
STATUS_TC3 = 08h ;Bit actif: Un transfert DMA a ‚t‚
|
||||
STATUS_TC2 = 04h ;ex‚cut‚ depuis la derniŠre lecture
|
||||
STATUS_TC1 = 02h ;du registre d'‚tat.
|
||||
STATUS_TC0 = 01h ;Terminal Count
|
||||
|
||||
;Ecriture des bits du registre de commande (08, D0)
|
||||
COMMAND_DACKLEVEL = 80h ;Bit 7 actif: ligne DMA Acknowledge HIGH active
|
||||
COMMAND_DREQLEVEL = 40h ;Bit 6 actif: ligne REQ Acknowledge LOW active
|
||||
COMMAND_EXTWRITE = 20h ;Bit 5 actif: EXTENDED Write,sinon LATE Write
|
||||
COMMAND_FIXEDPRI = 10h ;Bit 4 actif: priorit‚ constante
|
||||
COMMAND_COMPRESS = 08h ;Bit 3 actif: compression
|
||||
COMMAND_INACTIVE = 04h ;Bit 2 actif: contr“leur d‚sactiv‚
|
||||
COMMAND_ADH0 = 02h ;Bit 1 actif: Adress Hold pour canal 0/4 d‚sactiv‚
|
||||
COMMAND_MEM2MEM = 01h ;Bit 0 actif: m‚moire/m‚moire, sinon m‚moire/p‚riph‚rie
|
||||
|
||||
;Ecriture des bits du registre de requˆte ( 09, D2 )
|
||||
REQUEST_RESERVED = 0F8h ;R‚glage des bits r‚serv‚s =0
|
||||
REQUEST_SET = 04h ;D‚finir requˆte DMA
|
||||
REQUEST_CLR = 00h ;Supprimer requˆte DMA
|
||||
REQUEST_MSK = 03h ;Indiquer le canal dans les deux bits du bas
|
||||
|
||||
;Ecriture des bits du registre de masquage de canal ( 0A, D4 )
|
||||
CHANNEL_RESERVED = 0F8h ;R‚glage des bits r‚serv‚s =0
|
||||
CHANNEL_SET = 04h ;Masquer/verrouiller canal DMA
|
||||
CHANNEL_CLR = 00h ;Lib‚rer canal DMA
|
||||
CHANNEL_MSK = 03h ;Indiquer le canal dans les deux bits du bas
|
||||
|
||||
;Ecriture des bits du registre de mode (0B,D6)
|
||||
MODE_DEMAND = 00h ;Transf‚rer … la demande
|
||||
MODE_SINGLE = 40h ;Transf‚rer valeurs uniques
|
||||
MODE_BLOCK = 80h ;Transf‚rer en bloc
|
||||
MODE_CASCADE = 0C0h ;Transf‚rer en cascade
|
||||
MODE_DECREMENT = 20h ;D‚cr‚menter
|
||||
MODE_AUTOINIT = 10h ;Autoinitialisation vers la fin
|
||||
MODE_VERIFY = 00h ;V‚rifier
|
||||
MODE_WRITE = 04h ;Ecrire dans la m‚moire
|
||||
MODE_READ = 08h ;Lire depuis la m‚moire
|
||||
MODE_INVALID = 0Ch ;Incorrect
|
||||
MODE_CHANNELMSK = 03h ;Indiquer le canal dans les deux bits du bas
|
||||
|
||||
;Ports du DMA esclave
|
||||
|
||||
DmaStatusS dw 08h ;R SLAVE Registre d'‚tat
|
||||
DmaCommandS dw 08h ;W SLAVE Registre de commande
|
||||
DmaRequestS dw 09h ;W SLAVE Ex‚cuter requˆte DMA
|
||||
DmachMaskS dw 0ah ;W SLAVE Masquer canaux
|
||||
DmaModeS dw 0bh ;W SLAVE Mode de transfert
|
||||
DmaFlipFlopS dw 0ch ;W SLAVE Flipflop adr/compteur
|
||||
DmaTempS dw 0dh ;R SLAVE Reset du contr“leur
|
||||
DmaClearS dw 0dh ;R SLAVE Registre temporaire
|
||||
DmaMaskClrS dw 0eh ;R SLAVE Lib‚rer canaux
|
||||
DmaMaskS dw 0fh ;R SLAVE Masquer canaux
|
||||
|
||||
;Ports du DMA esclave
|
||||
|
||||
DmaStatusM dw 0D0h ;R MASTER Registre d'‚tat
|
||||
DmaCommandM dw 0D0h ;W MASTER Registre de commande
|
||||
DmaRequestM dw 0D2h ;W MASTER Ex‚cuter requˆte DMA
|
||||
DmaMaskM dw 0D4h ;W MASTER Masquer canaux
|
||||
DmaModeM dw 0D6h ;W MASTER Mode de transfert
|
||||
DmaFlipFlopM dw 0D8h ;W MASTER Flipflop adr/compteur
|
||||
DmaTempM dw 0DAh ;R MASTER Reset du contr“leur
|
||||
DmaClearM dw 0DAh ;R MASTER Registre temporaire
|
||||
DmaMaskClrM dw 0DCh ;R MASTER Lib‚rer canaux
|
||||
DmaMaskM2 dw 0DEh ;R MASTER Masquer canaux
|
||||
|
||||
DmaAdress db 00h ;DMA address register 0
|
||||
db 002h ;DMA address register 1
|
||||
db 004h ;DMA address register 2
|
||||
db 006h ;DMA address register 3
|
||||
db 0c0h ;DMA address register 4
|
||||
db 0c4h ;DMA address register 5
|
||||
db 0c8h ;DMA address register 6
|
||||
db 0cch ;DMA address register 7
|
||||
|
||||
DmaCount db 001h ;DMA count registers 0
|
||||
db 003h ;DMA count registers 1
|
||||
db 005h ;DMA count registers 2
|
||||
db 007h ;DMA count registers 3
|
||||
db 0c2h ;DMA count registers 4
|
||||
db 0c6h ;DMA count registers 5
|
||||
db 0cah ;DMA count registers 6
|
||||
db 0ceh ;DMA count registers 7
|
||||
|
||||
DmaPage db 087h ;DMA page registers 0
|
||||
db 083h ;DMA page registers 1
|
||||
db 081h ;DMA page registers 2
|
||||
db 082h ;DMA page registers 3
|
||||
db 08fh ;DMA page registers 4
|
||||
db 08bh ;DMA page registers 5
|
||||
db 089h ;DMA page registers 6
|
||||
db 08ah ;DMA page registers 7
|
||||
|
||||
;verouille le canal AL
|
||||
DisableDma:
|
||||
push ax dx
|
||||
cmp al, 4
|
||||
jae MasterDisableDma
|
||||
mov dx, DmaMaskS
|
||||
or al, 00000100b
|
||||
out dx, al
|
||||
jmp EndDisableDma
|
||||
MasterDisableDma:
|
||||
mov dx, DmaMaskS
|
||||
and al, 00000011b
|
||||
or al, 00000100b
|
||||
out dx, al
|
||||
EndDisableDma:
|
||||
pop dx ax
|
||||
ret
|
||||
|
||||
;déverouille le canal AL
|
||||
EnableDma:
|
||||
push ax dx
|
||||
cmp al, 4
|
||||
jae MasterDisableDma
|
||||
mov dx, DmaMaskS
|
||||
out dx, al
|
||||
jmp EndEnableDma
|
||||
MasterEnableDma:
|
||||
mov dx, DmaMaskS
|
||||
and al, 00000011b
|
||||
out dx, al
|
||||
EndEnableDma:
|
||||
pop dx ax
|
||||
ret
|
||||
|
||||
;Efface le FlipFlop canal AL
|
||||
ClrDmaFlipFlop:
|
||||
push ax dx
|
||||
cmp al, 4
|
||||
jae MasterClrFlipFlopDma
|
||||
mov dx,DmaFlipFlopS
|
||||
xor ax, ax
|
||||
out dx, al
|
||||
jmp EndClrFlipFlopDma
|
||||
MasterClrFlipFlopDma:
|
||||
mov dx,DmaFlipFlopM
|
||||
xor ax, ax
|
||||
out dx, al
|
||||
EndClrFlipFlopDma:
|
||||
pop dx ax
|
||||
ret
|
||||
|
||||
;Met le mode du canal al à ah
|
||||
SetDmaMode:
|
||||
push ax dx
|
||||
cmp al, 4
|
||||
jae MasterSetDmaMode
|
||||
mov dx,DmaModeS
|
||||
or al, ah
|
||||
out dx, al
|
||||
jmp EndSetDmaMode
|
||||
MasterSetDmaMode:
|
||||
mov dx,DmaModeM
|
||||
and al, 00000011b
|
||||
or al, ah
|
||||
out dx, al
|
||||
EndSetDmaMode:
|
||||
pop dx ax
|
||||
ret
|
||||
|
||||
|
||||
;Met le page du canal al a ah
|
||||
SetDmaPage:
|
||||
push ax bx dx si
|
||||
cmp al, 4
|
||||
jae MasterSetDmaPage
|
||||
mov si, offset DmaPage
|
||||
xor dh, dh
|
||||
xor bh, bh
|
||||
mov bl, al
|
||||
mov dl, cs:[si+bx]
|
||||
xchg al, ah
|
||||
out dx, al
|
||||
jmp EndSetDmaPage
|
||||
MasterSetDmaPage:
|
||||
EndSetDmaPage:
|
||||
pop si dx bx ax
|
||||
ret
|
||||
|
||||
;Met l'adresse du canal al a DS:BX
|
||||
SetDmaAdress:
|
||||
push ax bx cx dx si
|
||||
push ax
|
||||
mov ax, ds
|
||||
and ax, 0000111111111111b
|
||||
shl ax,4
|
||||
add bx, ax
|
||||
mov ax, ds
|
||||
and ax, 1111000000000000b
|
||||
shr ax, 4
|
||||
mov cx,ax
|
||||
pop ax
|
||||
push ax
|
||||
add ax,cx
|
||||
call SetDmaPage
|
||||
pop ax
|
||||
call ClrDmaFlipFlop
|
||||
mov si, offset DmaAdress
|
||||
xor dh, dh
|
||||
push bx
|
||||
xor bh, bh
|
||||
mov bl, al
|
||||
mov dl, byte ptr cs:[si+bx]
|
||||
pop bx
|
||||
cmp al, 4
|
||||
jae MasterSetDmaAddress
|
||||
mov al, bh
|
||||
out dx, al
|
||||
mov al, bl
|
||||
out dx, al
|
||||
jmp EndSetDmaAddress
|
||||
MasterSetDmaAddress:
|
||||
mov al, bh
|
||||
out dx, al
|
||||
call ClrDmaFlipFlop
|
||||
mov al, bl
|
||||
out dx, al
|
||||
EndSetDmaAddress:
|
||||
pop si dx cx bx ax
|
||||
ret
|
||||
|
||||
;Spécifie au controleur DMA le nombre d'octets à transférer dans CX
|
||||
SetDmaCount:
|
||||
push ax bx dx si
|
||||
call ClrDmaFlipFlop
|
||||
mov si, offset DmaCount
|
||||
xor dh, dh
|
||||
xor bh, bh
|
||||
mov bl, al
|
||||
mov dl, byte ptr cs:[si+bx]
|
||||
cmp al, 4
|
||||
jae MasterSetDmaCount
|
||||
mov al, ch
|
||||
out dx, al
|
||||
mov al, cl
|
||||
out dx, al
|
||||
jmp EndSetDmaCount
|
||||
MasterSetDmaCount:
|
||||
mov al, ch
|
||||
out dx, al
|
||||
call ClrDmaFlipFlop
|
||||
mov al, cl
|
||||
out dx, al
|
||||
EndSetDmaCount:
|
||||
pop si dx bx ax
|
||||
ret
|
||||
|
415
noyau/8259a.asm
Normal file
415
noyau/8259a.asm
Normal file
@ -0,0 +1,415 @@
|
||||
;Adresses de port du contr“leur IRQ
|
||||
MASTERPIC = 020h ;Adresse de base du PIC maŒtre
|
||||
SLAVEPIC = 0A0h ;Adresse de base du PIC esclave
|
||||
IRQMASK = 001h ;Offset sur port de masquage
|
||||
|
||||
;Commandes IRQ OCW2
|
||||
DISABLEROTATION = 000h ;Desactiver la rotation de priorités en mode EOI automatique
|
||||
EOI = 020h ;End of Interrupt non sp‚cifi‚
|
||||
COMMANDEOI = 060h ;Commande EOI particulière
|
||||
ENABLEROTATION = 080h ;Activer la rotation de priorités en mode EOI automatique
|
||||
ROTATIONNOSPEC = 0A0h ;Rotation des priorités en mode EOI automatique
|
||||
SETPRIORITY = 0C0h ;Definir la priorité
|
||||
ROTATIONSPEC = 0E0h ;Rotation des priorités en mode EOI spécifié
|
||||
|
||||
;Position des vecteurs d'interruptions
|
||||
MASTERFIRSTVECTOR = 008h ;Vecteurs logiciels des interruptions
|
||||
SLAVEFIRSTVECTOR = 070h ;‚lectroniques
|
||||
|
||||
;OCW3 codes registres
|
||||
IRR = 002h ;Interrupt Request Register
|
||||
ISR = 003h ;In Service Register
|
||||
;OCW3 et modes
|
||||
OCW3 = 008h ;OCW3
|
||||
POLLING = 004h ;Polling bit
|
||||
|
||||
|
||||
ISR = 0Bh ; Pas d'op‚ration, pas de Poll, lire ISR OCW3
|
||||
IRR = 0Ah ; Pas d'op‚ration, pas de Poll, lire IRR
|
||||
|
||||
;Autorise une interruption ‚lectronique
|
||||
;Entr‚e : %1 - Num‚ro de l'interruption (0-15) … autoriser 0-7 = MASTERPIC , 8-15 = SLAVEPIC
|
||||
PROC enableirq FAR
|
||||
ARG @irq:word
|
||||
USES ax,cx,dx
|
||||
mov ax,[@irq]
|
||||
mov dx,MASTERPIC+IRQMASK
|
||||
cmp al,7
|
||||
jbe @@master
|
||||
mov dx,SLAVEPIC+IRQMASK
|
||||
@@master:
|
||||
mov cl,al
|
||||
and cl,7
|
||||
mov al,1
|
||||
shl al,cl
|
||||
not al
|
||||
mov ah,al
|
||||
in al,dx
|
||||
and al,ah
|
||||
out dx,al
|
||||
ret
|
||||
endp enableirq
|
||||
|
||||
;Desactive une interruption ‚lectronique
|
||||
;Entr‚e : %0 - Num‚ro de l'interruption (0-15) … desactiver 0-7 = MASTERPIC , 8-15 = SLAVEPIC
|
||||
PROC disableirq FAR
|
||||
ARG @irq:word
|
||||
USES ax,cx,dx
|
||||
mov ax,[@irq]
|
||||
mov dx,MASTERPIC+IRQMASK
|
||||
cmp al,7
|
||||
jbe @@master
|
||||
mov dx,SLAVEPIC+IRQMASK
|
||||
@@master:
|
||||
mov cl,al
|
||||
and cl,7
|
||||
mov al,1
|
||||
shl al,cl
|
||||
not al
|
||||
mov ah,al
|
||||
in al,dx
|
||||
or al,ah
|
||||
out dx,al
|
||||
ret
|
||||
endp disableirq
|
||||
|
||||
|
||||
;Signale "End Of Interrupt" de l'interruption %0
|
||||
PROC seteoi FAR
|
||||
ARG @irq:word
|
||||
USES ax,dx
|
||||
mov ax,[@irq]
|
||||
cmp al,7
|
||||
jbe @@master
|
||||
mov al,EOI
|
||||
out SLAVEPIC,al
|
||||
@@master:
|
||||
mov al,EOI
|
||||
out MASTERPIC,al
|
||||
ret
|
||||
endp seteoi
|
||||
|
||||
|
||||
;Lit les masques d'un contr“leur IRQ dans ax, 0 master ou slave 1 ds %1
|
||||
PROC readimr FAR
|
||||
ARG @controleur:word
|
||||
USES bx,dx
|
||||
mov bx,[@controleur]
|
||||
mov dx,MASTERPIC+ IRQMASK
|
||||
cmp bl,0
|
||||
jne @@master
|
||||
mov dx,SLAVEPIC+ IRQMASK
|
||||
@@master:
|
||||
xor ah,ah
|
||||
in al,dx
|
||||
pop dx
|
||||
ret
|
||||
endp readimr
|
||||
|
||||
;Lit le registre d'‚tat d'un contr“leur IRQ dans ax, 0 master ou slave 1 ds %1
|
||||
PROC readisr FAR
|
||||
ARG @controleur:word
|
||||
USES bx,dx
|
||||
mov bx,[@controleur]
|
||||
mov dx,MASTERPIC
|
||||
cmp bh,0
|
||||
jne @@master
|
||||
mov dx,SLAVEPIC
|
||||
@@master:
|
||||
mov al,ISR
|
||||
out dx,al
|
||||
xor ah,ah
|
||||
in al,dx
|
||||
ret
|
||||
endp readisr
|
||||
|
||||
|
||||
;Lit le registre d'‚tat d'un contr“leur IRQ dans al, 0 master ou slave 1 ds bh
|
||||
PROC readirr FAR
|
||||
ARG @controleur:word
|
||||
USES bx,dx
|
||||
mov bx,[@controleur]
|
||||
mov dx,MASTERPIC
|
||||
cmp bh,0
|
||||
jne @@master
|
||||
mov dx,SLAVEPIC
|
||||
@@master:
|
||||
mov al,IRR
|
||||
out dx,al
|
||||
xor ah,ah
|
||||
in al,dx
|
||||
ret
|
||||
endp readirr
|
||||
|
||||
;carry si enable et pas carry si pas enable
|
||||
PROC isenableirq FAR
|
||||
ARG @irq:word
|
||||
USES ax,cx,dx
|
||||
mov ax,[@irq]
|
||||
mov dx,MASTERPIC+IRQMASK
|
||||
cmp al,7
|
||||
jbe @@master
|
||||
mov dx,SLAVEPIC+IRQMASK
|
||||
@@master:
|
||||
mov cl,al
|
||||
and cx,7
|
||||
in al,dx
|
||||
neg al
|
||||
bt ax,cx
|
||||
ret
|
||||
endp isenableirq
|
||||
|
||||
|
||||
;carry si enable et pas carry si pas enable
|
||||
PROC isinserviceirq FAR
|
||||
ARG @irq:word
|
||||
USES ax,cx,dx
|
||||
mov ax,[@irq]
|
||||
mov dx,MASTERPIC
|
||||
cmp al,7
|
||||
jbe @@master
|
||||
mov dx,SLAVEPIC
|
||||
@@master:
|
||||
mov cl,al
|
||||
mov al,ISR
|
||||
out dx,al
|
||||
and cx,7
|
||||
in al,dx
|
||||
neg al
|
||||
bt ax,cx
|
||||
ret
|
||||
endp isinserviceirq
|
||||
|
||||
|
||||
;carry si enable et pas carry si pas enable
|
||||
PROC isrequestirq FAR
|
||||
ARG @irq:word
|
||||
USES ax,cx,dx
|
||||
mov ax,[@irq]
|
||||
mov dx,MASTERPIC
|
||||
cmp al,7
|
||||
jbe @@master
|
||||
mov dx,SLAVEPIC
|
||||
@@master:
|
||||
mov cl,al
|
||||
mov al,IRR
|
||||
out dx,al
|
||||
and cx,7
|
||||
in al,dx
|
||||
neg al
|
||||
bt ax,cx
|
||||
ret
|
||||
endp isrequestirq
|
||||
|
||||
|
||||
PROC installirqhandler FAR
|
||||
USES eax,bx,cx,edx,si,di,ds,es
|
||||
push fs
|
||||
call mbcreate,offset interruptionbloc,256*size ints
|
||||
mov es,ax
|
||||
mov ax,0x0000
|
||||
mov ds,ax
|
||||
xor si,si
|
||||
@@searchdummypointer:
|
||||
mov fs,[(vector si).data.seg]
|
||||
mov bx,[(vector si).data.off]
|
||||
cmp [byte ptr fs:bx],0xCF ;iret
|
||||
je @@founded
|
||||
add si,size vector
|
||||
cmp si,256*4
|
||||
jb @@searchdummypointer
|
||||
xor edx,edx
|
||||
jmp @@suite
|
||||
@@founded:
|
||||
mov edx,[(vector si).content]
|
||||
@@suite:
|
||||
xor cx,cx
|
||||
xor si,si
|
||||
xor di,di
|
||||
cli
|
||||
@@copy:
|
||||
mov [es:(ints di).number],cl
|
||||
mov [es:(ints di).locked],0
|
||||
mov [es:(ints di).vector1.content],0
|
||||
mov [es:(ints di).vector3.content],0
|
||||
mov [es:(ints di).vector4.content],0
|
||||
mov [es:(ints di).vector5.content],0
|
||||
mov [es:(ints di).vector6.content],0
|
||||
mov [es:(ints di).vector7.content],0
|
||||
mov [es:(ints di).vector8.content],0
|
||||
mov [es:(ints di).launchedlow],0
|
||||
mov [es:(ints di).launchedhigh],0
|
||||
mov [es:(ints di).calledlow],0
|
||||
mov [es:(ints di).calledhigh],0
|
||||
mov eax,[(vector si).content]
|
||||
cmp eax,edx
|
||||
je @@notarealvector
|
||||
mov [es:(ints di).vector1.content],eax
|
||||
mov [es:(ints di).activated],1
|
||||
jmp @@copynext
|
||||
@@notarealvector:
|
||||
mov [es:(ints di).vector1.content],0
|
||||
mov [es:(ints di).activated],0
|
||||
@@copynext:
|
||||
mov bx,cx
|
||||
shl bx,3
|
||||
sub bx,cx
|
||||
add bx,offset coupling
|
||||
mov [(vector si).data.seg],cs
|
||||
mov [(vector si).data.off],bx
|
||||
add si,size vector
|
||||
add di,size ints
|
||||
inc cl
|
||||
cmp cl,0
|
||||
jne @@copy
|
||||
@@end:
|
||||
pop fs
|
||||
sti
|
||||
ret
|
||||
endp installirqhandler
|
||||
|
||||
|
||||
interruptionbloc db '/interrupts',0
|
||||
|
||||
|
||||
PROC savecontext FAR
|
||||
ARG @pointer:word
|
||||
USES eax,si,ds
|
||||
pushfd
|
||||
push eax
|
||||
push ebx
|
||||
push ecx
|
||||
push edx
|
||||
push esi
|
||||
push edi
|
||||
push ds
|
||||
push es
|
||||
push fs
|
||||
push gs
|
||||
push ss
|
||||
mov si,[@pointer]
|
||||
mov ds,[ss:bp+4]
|
||||
mov eax,ebp
|
||||
mov ax,[word ptr ss:bp]
|
||||
push eax
|
||||
push [word ptr ss:bp+4]
|
||||
xor eax,eax
|
||||
mov ax,[word ptr ss:bp+2]
|
||||
push eax
|
||||
mov ax,bp
|
||||
add ax,4
|
||||
push eax
|
||||
pop [(regs si).sesp]
|
||||
pop [(regs si).seip]
|
||||
pop [(regs si).scs]
|
||||
pop [(regs si).sebp]
|
||||
pop [(regs si).sss]
|
||||
pop [(regs si).sgs]
|
||||
pop [(regs si).sfs]
|
||||
pop [(regs si).ses]
|
||||
pop [(regs si).sds]
|
||||
pop [(regs si).sedi]
|
||||
pop [(regs si).sesi]
|
||||
pop [(regs si).sedx]
|
||||
pop [(regs si).secx]
|
||||
pop [(regs si).sebx]
|
||||
pop [(regs si).seax]
|
||||
pop [(regs si).seflags]
|
||||
ret
|
||||
endp savecontext
|
||||
|
||||
PROC restorecontextg FAR
|
||||
ARG @pointer:word
|
||||
mov si,[@pointer]
|
||||
pushd [cs:(regs si).sesi]
|
||||
pushd [cs:(regs si).seflags]
|
||||
mov eax,[cs:(regs si).seax]
|
||||
mov ebx,[cs:(regs si).sebx]
|
||||
mov ecx,[cs:(regs si).secx]
|
||||
mov edx,[cs:(regs si).sedx]
|
||||
mov edi,[cs:(regs si).sedi]
|
||||
mov ebp,[cs:(regs si).sebp]
|
||||
mov es,[cs:(regs si).ses]
|
||||
mov fs,[cs:(regs si).sfs]
|
||||
mov gs,[cs:(regs si).sgs]
|
||||
mov ds,[cs:(regs si).sds]
|
||||
popfd
|
||||
pop esi
|
||||
pop [cs:dummy]
|
||||
db 0xCA,0x02,0x00 ;retf 2
|
||||
endp restorecontextg
|
||||
|
||||
|
||||
|
||||
coupling:
|
||||
counter = 0
|
||||
REPEAT 256
|
||||
push counter+256
|
||||
push offset irqhandlers
|
||||
ret
|
||||
counter = counter + 1
|
||||
ENDM
|
||||
|
||||
interrupt dw 0
|
||||
dummy dw 0
|
||||
calling_reg regs <>
|
||||
function_reg regs <>
|
||||
|
||||
irqhandlers:
|
||||
cli
|
||||
pop [cs:interrupt]
|
||||
call savecontext,offset calling_reg
|
||||
call irqhandler,[cs:interrupt]
|
||||
call restorecontextg,offset calling_reg
|
||||
sti
|
||||
iret
|
||||
|
||||
PROC irqhandler NEAR
|
||||
ARG @int:word
|
||||
push cs
|
||||
pop ds
|
||||
call mbfindsb,offset interruptionbloc,cs
|
||||
jc @@end
|
||||
mov es,ax
|
||||
mov ax,[@int]
|
||||
sub ax,256
|
||||
mov cx,size ints
|
||||
mul cx
|
||||
mov si,ax
|
||||
add [es:(ints si).calledlow],1
|
||||
adc [es:(ints si).calledhigh],0
|
||||
cmp [es:(ints si).activated],1
|
||||
jne @@end
|
||||
add [es:(ints si).launchedlow],1
|
||||
adc [es:(ints si).launchedhigh],0
|
||||
lea si,[es:(ints si).vector1]
|
||||
mov cl,8
|
||||
@@launchall:
|
||||
cmp [es:(vector si).content],0
|
||||
je @@end
|
||||
push [word ptr cs:calling_reg.seflags]
|
||||
push cs
|
||||
push offset @@back
|
||||
push [es:(vector si).data.seg]
|
||||
push [es:(vector si).data.off]
|
||||
call savecontext,offset function_reg
|
||||
call restorecontextg,offset calling_reg
|
||||
db 0xCB
|
||||
@@back:
|
||||
cli
|
||||
call savecontext,offset calling_reg
|
||||
call restorecontextg,offset function_reg
|
||||
@@next:
|
||||
add si,size vector
|
||||
dec cl
|
||||
jnz @@launchall
|
||||
@@end:
|
||||
ret
|
||||
endp irqhandler
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
38
noyau/MAKEFILE
Normal file
38
noyau/MAKEFILE
Normal file
@ -0,0 +1,38 @@
|
||||
asm= lzasm /z/t
|
||||
lnk= elink
|
||||
|
||||
all: systeme.sys boot.bin
|
||||
|
||||
systeme.sys: video.obj disque.obj systeme.obj
|
||||
$(lnk) systeme.obj systeme.sys
|
||||
|
||||
systeme.obj: ..\lib\detect.lib ..\lib\video.lib video.sys disque.sys
|
||||
$(asm) systeme.asm
|
||||
|
||||
disque.sys:
|
||||
$(lnk) disque.obj disque.sys
|
||||
|
||||
video.sys:
|
||||
$(lnk) video.obj video.sys
|
||||
|
||||
boot.bin: boot.obj
|
||||
$(lnk) boot.obj boot.bin /bs
|
||||
|
||||
video.obj:
|
||||
$(asm) video.asm
|
||||
|
||||
disque.obj:
|
||||
$(asm) disque.asm
|
||||
|
||||
boot.obj:
|
||||
$(asm) boot.asm
|
||||
|
||||
clean:
|
||||
del *.obj
|
||||
del *.exe
|
||||
del *.bak
|
||||
del *.lib
|
||||
del *.com
|
||||
del *.bin
|
||||
del *.sys
|
||||
del *.err
|
216
noyau/boot.asm
Normal file
216
noyau/boot.asm
Normal file
@ -0,0 +1,216 @@
|
||||
model tiny,stdcall
|
||||
p486
|
||||
locals
|
||||
jumps
|
||||
codeseg
|
||||
option procalign:byte
|
||||
|
||||
include "..\include\mem.h"
|
||||
include "..\include\fat.h"
|
||||
include "..\include\divers.h"
|
||||
|
||||
org 7C00h
|
||||
|
||||
jmp boot
|
||||
|
||||
bootsec bootinfo <"COS2000A",512,1,1,2,224,2880,0F0h,9,18,2,0,0,0,0,0,29h,01020304h,"COS2000 ","FAT12 ">
|
||||
|
||||
errorloading db " [Erreur]",0dh,0ah,0
|
||||
okloading db "Recherche noyau ",0Dh,0ah," -"
|
||||
sys db "SYSTEME SYS",0
|
||||
syst db " [ Ok ]",0dh,0ah,"Chargement ",0
|
||||
dot db ".",0
|
||||
|
||||
|
||||
|
||||
errorboot:
|
||||
mov si,offset errorloading
|
||||
call showstr
|
||||
mov ah,0
|
||||
int 16h
|
||||
int 19h
|
||||
|
||||
boot:
|
||||
mov [bootsec.bootdrive],dl
|
||||
cli
|
||||
mov ax,09000h
|
||||
mov ss,ax
|
||||
mov sp,0FFFFh
|
||||
sti
|
||||
boot2:
|
||||
push cs
|
||||
push cs
|
||||
pop es
|
||||
pop ds
|
||||
xor ax,ax
|
||||
mov dl,[bootsec.bootdrive]
|
||||
int 13h
|
||||
jc errorboot
|
||||
mov si,offset okloading
|
||||
call showstr
|
||||
mov cx,[bootsec.reservedsectors]
|
||||
add cx,[bootsec.hiddensectorsh]
|
||||
adc cx,[bootsec.hiddensectorsl]
|
||||
push cx
|
||||
mov bx,[bootsec.sectorsperfat]
|
||||
mov di,offset bufferfat
|
||||
readfat:
|
||||
call readsector
|
||||
jc errorboot
|
||||
inc cx
|
||||
add di,[bootsec.sectorsize]
|
||||
dec bx
|
||||
jnz readfat
|
||||
pop cx
|
||||
xor ax,ax
|
||||
mov al,[bootsec.fatsperdrive]
|
||||
mov bx,[bootsec.sectorsperfat]
|
||||
mul bx
|
||||
add cx,ax
|
||||
mov ax,32
|
||||
mul [bootsec.directorysize]
|
||||
div [bootsec.sectorsize]
|
||||
add ax,cx
|
||||
sub ax,2
|
||||
mov [word ptr bootsec.reservedfornt],ax
|
||||
xor dx,dx
|
||||
checkroot:
|
||||
mov di,offset buffer
|
||||
call readsector
|
||||
jc errorboot
|
||||
xor bx,bx
|
||||
findnext:
|
||||
cmp [byte ptr di],0
|
||||
je errorboot
|
||||
cmp [byte ptr di],0E5h
|
||||
je no
|
||||
cmp [byte ptr di],041h
|
||||
je no
|
||||
mov si,offset dot
|
||||
call showstr
|
||||
push di cx
|
||||
mov si,offset sys
|
||||
mov cx,11
|
||||
rep cmpsb
|
||||
pop cx di
|
||||
je oksystem
|
||||
no:
|
||||
add di,32
|
||||
add bx,32
|
||||
inc dx
|
||||
cmp dx,[bootsec.directorysize]
|
||||
ja errorboot
|
||||
cmp bx,[bootsec.sectorsize]
|
||||
jb findnext
|
||||
inc cx
|
||||
jmp checkroot
|
||||
oksystem:
|
||||
mov si,offset syst
|
||||
call showstr
|
||||
mov cx,[di+26]
|
||||
mov ax,8000h
|
||||
mov es,ax
|
||||
push es
|
||||
mov di,0000h
|
||||
push 0010h
|
||||
mov si,offset dot
|
||||
xor ax,ax
|
||||
fatagain:
|
||||
cmp cx,0FF0h
|
||||
jae finishload
|
||||
push cx
|
||||
add cx,[word ptr bootsec.reservedfornt]
|
||||
call readsector
|
||||
pop cx
|
||||
jc errorboot
|
||||
inc ax
|
||||
call showstr
|
||||
add di,[bootsec.sectorsize]
|
||||
call getfat
|
||||
jnc fatagain
|
||||
finishload:
|
||||
retf
|
||||
|
||||
;=============READSECTOR (Fonction 01H)===============
|
||||
;Lit le secteur CX et le met en es:di
|
||||
;-> AH=1
|
||||
;<- Flag Carry si erreur
|
||||
;=====================================================
|
||||
readsector:
|
||||
push ax bx cx dx si
|
||||
mov ax,cx
|
||||
xor dx,dx
|
||||
div [bootsec.sectorspertrack]
|
||||
inc dl
|
||||
mov bl,dl
|
||||
xor dx,dx
|
||||
div [bootsec.headsperdrive]
|
||||
xchg dl,dh
|
||||
mov cx,ax
|
||||
xchg cl,ch
|
||||
shl cl,6
|
||||
or cl, bl
|
||||
mov bx,di
|
||||
mov si, 4
|
||||
mov al, 1
|
||||
tryagain:
|
||||
mov ah, 2
|
||||
mov dl,[bootsec.bootdrive]
|
||||
int 13h
|
||||
jnc done
|
||||
dec si
|
||||
jnz tryagain
|
||||
done:
|
||||
pop si dx cx bx ax
|
||||
ret
|
||||
|
||||
|
||||
getfat:
|
||||
push ax bx dx di
|
||||
mov di,offset bufferfat
|
||||
mov ax,cx
|
||||
mov bx,ax
|
||||
and bx,0000000000000001b
|
||||
shr ax,1
|
||||
mov cx,3
|
||||
mul cx
|
||||
add di,ax
|
||||
cmp bx,0h
|
||||
jnz evenfat
|
||||
oddfat:
|
||||
mov dx,[di]
|
||||
and dx,0FFFh
|
||||
mov cx,dx
|
||||
jmp endfat
|
||||
evenfat:
|
||||
mov dx,[di+1]
|
||||
and dx,0FFF0h
|
||||
shr dx,4
|
||||
mov cx,dx
|
||||
endfat:
|
||||
pop di dx bx ax
|
||||
ret
|
||||
|
||||
|
||||
showstr:
|
||||
push ax bx si
|
||||
again:
|
||||
lodsb
|
||||
or al,al
|
||||
jz fin
|
||||
mov ah,0Eh
|
||||
mov bx,07h
|
||||
int 10h
|
||||
jmp again
|
||||
fin:
|
||||
pop si bx ax
|
||||
ret
|
||||
|
||||
|
||||
db 055h,0AAh
|
||||
|
||||
endof:
|
||||
|
||||
buffer equ offset endof+2048
|
||||
bufferfat equ offset endof+4096
|
||||
|
261
noyau/clavier.asm
Normal file
261
noyau/clavier.asm
Normal file
@ -0,0 +1,261 @@
|
||||
.model tiny
|
||||
.486
|
||||
smart
|
||||
.code
|
||||
|
||||
org 0h
|
||||
|
||||
include ..\include\mem.h
|
||||
|
||||
start:
|
||||
|
||||
jmp tsr
|
||||
offsets dd 0
|
||||
db 'KEYBOARD'
|
||||
tsr:
|
||||
pushf
|
||||
db 2eh,0ffh,1eh
|
||||
dw offsets
|
||||
cli
|
||||
cmp cs:isstate,1
|
||||
je endofforce
|
||||
mov cs:isstate,1
|
||||
mov cs:eaxr,eax
|
||||
in al,60h
|
||||
cmp al,68
|
||||
je F10
|
||||
cmp al,87
|
||||
je F11
|
||||
cmp al,88
|
||||
je F12
|
||||
endof:
|
||||
mov cs:isstate,0
|
||||
mov eax,cs:eaxr
|
||||
endofforce:
|
||||
sti
|
||||
iret
|
||||
isstate db 0
|
||||
infos db 40 dup (0)
|
||||
feax dd 0
|
||||
|
||||
F10:
|
||||
push cs
|
||||
pop ds
|
||||
mov si,offset com
|
||||
mov ah,5
|
||||
int 49h
|
||||
pop ax
|
||||
pop ax
|
||||
pop ax
|
||||
push gs
|
||||
push gs
|
||||
push gs
|
||||
pop ds
|
||||
pop es
|
||||
pop fs
|
||||
push gs
|
||||
push size exe
|
||||
sti
|
||||
mov cs:[isstate],0
|
||||
retf
|
||||
|
||||
com db 'COMMANDE.CE',0
|
||||
|
||||
F11:
|
||||
push ax di es
|
||||
push cs
|
||||
pop es
|
||||
mov di,offset infos
|
||||
mov ah,34
|
||||
int 47h
|
||||
mov al,cs:[di+7]
|
||||
inc al
|
||||
cmp al,9
|
||||
jbe notabove
|
||||
mov al,0
|
||||
notabove:
|
||||
mov ah,0
|
||||
int 47h
|
||||
pop es di ax
|
||||
jmp endof
|
||||
|
||||
|
||||
f12:
|
||||
pushad
|
||||
pushf
|
||||
push ds
|
||||
mov cs:[eaxr],eax
|
||||
mov cs:[ebxr],ebx
|
||||
mov cs:[ecxr],ecx
|
||||
mov cs:[edxr],edx
|
||||
mov cs:[esir],esi
|
||||
mov cs:[edir],edi
|
||||
mov cs:[espr],esp
|
||||
mov cs:[ebpr],ebp
|
||||
mov cs:[csr],cs
|
||||
mov cs:[dsr],ds
|
||||
mov cs:[esr],es
|
||||
mov cs:[fsr],fs
|
||||
mov cs:[gsr],gs
|
||||
mov cs:[ssr],ss
|
||||
push cs
|
||||
pop ds
|
||||
mov si,offset sep
|
||||
call Showstr
|
||||
mov si,offset reg
|
||||
mov di,offset regdata
|
||||
mov bx,7
|
||||
showregs:
|
||||
cmp byte ptr cs:[si+6],":"
|
||||
jne endshowregs
|
||||
call Showstr
|
||||
cmp byte ptr cs:[si+4]," "
|
||||
je segsss
|
||||
mov edx,cs:[di]
|
||||
mov cx,32
|
||||
call Showhex
|
||||
add di,4
|
||||
jmp showmax
|
||||
segsss:
|
||||
mov dx,cs:[di]
|
||||
mov cx,16
|
||||
call Showhex
|
||||
add di,2
|
||||
showmax:
|
||||
add si,9
|
||||
mov bp,dx
|
||||
push si
|
||||
mov si,offset beginds
|
||||
call showstr
|
||||
mov si,bp
|
||||
mov cx,8
|
||||
mov al,0
|
||||
letshow:
|
||||
mov dl,ds:[si]
|
||||
inc si
|
||||
call showhex
|
||||
inc al
|
||||
cmp al,10
|
||||
jb letshow
|
||||
mov si,offset ende
|
||||
call showstr
|
||||
mov si,offset begines
|
||||
call showstr
|
||||
mov si,bp
|
||||
mov cx,8
|
||||
mov al,0
|
||||
letshow2:
|
||||
mov dl,es:[si]
|
||||
inc si
|
||||
call showhex
|
||||
inc al
|
||||
cmp al,10
|
||||
jb letshow2
|
||||
mov si,offset ende
|
||||
call showstr
|
||||
pop si
|
||||
jmp showregs
|
||||
endshowregs:
|
||||
mov si,offset sep
|
||||
call Showstr
|
||||
xor ax,ax
|
||||
int 16h
|
||||
pop ds
|
||||
popf
|
||||
popad
|
||||
jmp endof
|
||||
begines db ' es[',0
|
||||
beginds db ' ds[',0
|
||||
ende db '] ',0
|
||||
|
||||
|
||||
;==============================Affiche le nombre nb hexa en EDX de taille CX et couleur BL==============
|
||||
ShowHex:
|
||||
push ax bx cx edx si di
|
||||
mov di,cx
|
||||
sub cx,32
|
||||
neg cx
|
||||
shl edx,cl
|
||||
shr di,2
|
||||
mov ah,09h
|
||||
and bx,1111b
|
||||
Hexaize:
|
||||
rol edx,4
|
||||
mov si,dx
|
||||
and si,1111b
|
||||
mov al,[si+offset tab]
|
||||
push cx
|
||||
mov cx,1
|
||||
cmp al,32
|
||||
jb control2
|
||||
mov ah,09h
|
||||
int 10h
|
||||
control2:
|
||||
mov ah,0Eh
|
||||
int 10h
|
||||
pop cx
|
||||
dec di
|
||||
jnz Hexaize
|
||||
pop di si edx cx bx ax
|
||||
ret
|
||||
Tab db '0123456789ABCDEF'
|
||||
|
||||
;==============================Affiche une chaine DS:SI de couleur BL==============
|
||||
showstr:
|
||||
push ax bx cx si
|
||||
mov cx,1
|
||||
again:
|
||||
lodsb
|
||||
or al,al
|
||||
jz fin
|
||||
and bx,0111b
|
||||
cmp al,32
|
||||
jb control
|
||||
mov ah,09h
|
||||
int 10h
|
||||
control:
|
||||
mov ah,0Eh
|
||||
int 10h
|
||||
jmp again
|
||||
fin:
|
||||
pop si cx bx ax
|
||||
ret
|
||||
|
||||
|
||||
;================================================
|
||||
;Routine de débogage
|
||||
;================================================
|
||||
regdata:
|
||||
eaxr dd 0
|
||||
ebxr dd 0
|
||||
ecxr dd 0
|
||||
edxr dd 0
|
||||
esir dd 0
|
||||
edir dd 0
|
||||
espr dd 0
|
||||
ebpr dd 0
|
||||
csr dw 0
|
||||
dsr dw 0
|
||||
esr dw 0
|
||||
fsr dw 0
|
||||
gsr dw 0
|
||||
ssr dw 0
|
||||
|
||||
reg db 0Dh,0Ah,"eax : ",0
|
||||
db 0Dh,0Ah,"ebx : ",0
|
||||
db 0Dh,0Ah,"ecx : ",0
|
||||
db 0Dh,0Ah,"edx : ",0
|
||||
db 0Dh,0Ah,"esi : ",0
|
||||
db 0Dh,0Ah,"edi : ",0
|
||||
db 0Dh,0Ah,"esp : ",0
|
||||
db 0Dh,0Ah,"ebp : ",0
|
||||
db 0Dh,0Ah,"cs : ",0
|
||||
db 0Dh,0Ah,"ds : ",0
|
||||
db 0Dh,0Ah,"es : ",0
|
||||
db 0Dh,0Ah,"fs : ",0
|
||||
db 0Dh,0Ah,"gs : ",0
|
||||
db 0Dh,0Ah,"ss : ",0
|
||||
|
||||
sep db 0Ah,0Dh,'********************',0Ah,0Dh,0
|
||||
|
||||
end start
|
1099
noyau/disque.asm
Normal file
1099
noyau/disque.asm
Normal file
File diff suppressed because it is too large
Load Diff
BIN
noyau/font/2_hebrew.fnt
Normal file
BIN
noyau/font/2_hebrew.fnt
Normal file
Binary file not shown.
BIN
noyau/font/8x11snsf.fnt
Normal file
BIN
noyau/font/8x11snsf.fnt
Normal file
Binary file not shown.
BIN
noyau/font/ad&d.fnt
Normal file
BIN
noyau/font/ad&d.fnt
Normal file
Binary file not shown.
BIN
noyau/font/antique.fnt
Normal file
BIN
noyau/font/antique.fnt
Normal file
Binary file not shown.
BIN
noyau/font/applicat.fnt
Normal file
BIN
noyau/font/applicat.fnt
Normal file
Binary file not shown.
BIN
noyau/font/backward.fnt
Normal file
BIN
noyau/font/backward.fnt
Normal file
Binary file not shown.
BIN
noyau/font/bigserif.fnt
Normal file
BIN
noyau/font/bigserif.fnt
Normal file
Binary file not shown.
BIN
noyau/font/blcksnsf.fnt
Normal file
BIN
noyau/font/blcksnsf.fnt
Normal file
Binary file not shown.
BIN
noyau/font/block.fnt
Normal file
BIN
noyau/font/block.fnt
Normal file
Binary file not shown.
BIN
noyau/font/bold.fnt
Normal file
BIN
noyau/font/bold.fnt
Normal file
Binary file not shown.
BIN
noyau/font/breeze.fnt
Normal file
BIN
noyau/font/breeze.fnt
Normal file
Binary file not shown.
BIN
noyau/font/broadway.fnt
Normal file
BIN
noyau/font/broadway.fnt
Normal file
Binary file not shown.
BIN
noyau/font/comp.fnt
Normal file
BIN
noyau/font/comp.fnt
Normal file
Binary file not shown.
BIN
noyau/font/computer.fnt
Normal file
BIN
noyau/font/computer.fnt
Normal file
Binary file not shown.
BIN
noyau/font/courier.fnt
Normal file
BIN
noyau/font/courier.fnt
Normal file
Binary file not shown.
BIN
noyau/font/cyrillic.fnt
Normal file
BIN
noyau/font/cyrillic.fnt
Normal file
Binary file not shown.
BIN
noyau/font/dblmtx14.fnt
Normal file
BIN
noyau/font/dblmtx14.fnt
Normal file
Binary file not shown.
BIN
noyau/font/dblmtx16.fnt
Normal file
BIN
noyau/font/dblmtx16.fnt
Normal file
Binary file not shown.
BIN
noyau/font/finnish.fnt
Normal file
BIN
noyau/font/finnish.fnt
Normal file
Binary file not shown.
BIN
noyau/font/font1!!!.dat
Normal file
BIN
noyau/font/font1!!!.dat
Normal file
Binary file not shown.
BIN
noyau/font/font2!!!.dat
Normal file
BIN
noyau/font/font2!!!.dat
Normal file
Binary file not shown.
BIN
noyau/font/font3!!!.dat
Normal file
BIN
noyau/font/font3!!!.dat
Normal file
Binary file not shown.
BIN
noyau/font/font4!!!.dat
Normal file
BIN
noyau/font/font4!!!.dat
Normal file
Binary file not shown.
BIN
noyau/font/frankfrt.fnt
Normal file
BIN
noyau/font/frankfrt.fnt
Normal file
Binary file not shown.
BIN
noyau/font/fresno.fnt
Normal file
BIN
noyau/font/fresno.fnt
Normal file
Binary file not shown.
BIN
noyau/font/future.fnt
Normal file
BIN
noyau/font/future.fnt
Normal file
Binary file not shown.
BIN
noyau/font/greek.fnt
Normal file
BIN
noyau/font/greek.fnt
Normal file
Binary file not shown.
BIN
noyau/font/hebrew.fnt
Normal file
BIN
noyau/font/hebrew.fnt
Normal file
Binary file not shown.
BIN
noyau/font/hollow.fnt
Normal file
BIN
noyau/font/hollow.fnt
Normal file
Binary file not shown.
BIN
noyau/font/hylas.fnt
Normal file
BIN
noyau/font/hylas.fnt
Normal file
Binary file not shown.
BIN
noyau/font/inverted.fnt
Normal file
BIN
noyau/font/inverted.fnt
Normal file
Binary file not shown.
BIN
noyau/font/italic.fnt
Normal file
BIN
noyau/font/italic.fnt
Normal file
Binary file not shown.
BIN
noyau/font/italics.fnt
Normal file
BIN
noyau/font/italics.fnt
Normal file
Binary file not shown.
BIN
noyau/font/itt.fnt
Normal file
BIN
noyau/font/itt.fnt
Normal file
Binary file not shown.
BIN
noyau/font/lcd.fnt
Normal file
BIN
noyau/font/lcd.fnt
Normal file
Binary file not shown.
BIN
noyau/font/mechanix.fnt
Normal file
BIN
noyau/font/mechanix.fnt
Normal file
Binary file not shown.
BIN
noyau/font/medieval.fnt
Normal file
BIN
noyau/font/medieval.fnt
Normal file
Binary file not shown.
BIN
noyau/font/modern-1.fnt
Normal file
BIN
noyau/font/modern-1.fnt
Normal file
Binary file not shown.
BIN
noyau/font/norway.fnt
Normal file
BIN
noyau/font/norway.fnt
Normal file
Binary file not shown.
BIN
noyau/font/norway2.fnt
Normal file
BIN
noyau/font/norway2.fnt
Normal file
Binary file not shown.
BIN
noyau/font/old8x8.fnt
Normal file
BIN
noyau/font/old8x8.fnt
Normal file
Binary file not shown.
BIN
noyau/font/oldeng.fnt
Normal file
BIN
noyau/font/oldeng.fnt
Normal file
Binary file not shown.
BIN
noyau/font/roman.fnt
Normal file
BIN
noyau/font/roman.fnt
Normal file
Binary file not shown.
BIN
noyau/font/sanserif.fnt
Normal file
BIN
noyau/font/sanserif.fnt
Normal file
Binary file not shown.
BIN
noyau/font/script.fnt
Normal file
BIN
noyau/font/script.fnt
Normal file
Binary file not shown.
BIN
noyau/font/standard.fnt
Normal file
BIN
noyau/font/standard.fnt
Normal file
Binary file not shown.
BIN
noyau/font/stretch.fnt
Normal file
BIN
noyau/font/stretch.fnt
Normal file
Binary file not shown.
BIN
noyau/font/thai.fnt
Normal file
BIN
noyau/font/thai.fnt
Normal file
Binary file not shown.
BIN
noyau/font/thin.fnt
Normal file
BIN
noyau/font/thin.fnt
Normal file
Binary file not shown.
81
noyau/heure.asm
Normal file
81
noyau/heure.asm
Normal file
@ -0,0 +1,81 @@
|
||||
.model tiny
|
||||
.486
|
||||
smart
|
||||
.code
|
||||
|
||||
org 0h
|
||||
|
||||
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
|
32
noyau/horloge.asm
Normal file
32
noyau/horloge.asm
Normal file
@ -0,0 +1,32 @@
|
||||
.model tiny
|
||||
.486
|
||||
smart
|
||||
.code
|
||||
|
||||
org 0h
|
||||
|
||||
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
|
298
noyau/manette.asm
Normal file
298
noyau/manette.asm
Normal file
@ -0,0 +1,298 @@
|
||||
.model tiny
|
||||
.486
|
||||
smart
|
||||
.code
|
||||
org 0h
|
||||
start:
|
||||
jmp tsr
|
||||
drv db 'JOYSTICK',0
|
||||
Tsr:
|
||||
cli
|
||||
cmp ax,1234h
|
||||
jne nomore
|
||||
mov ax,4321h
|
||||
jmp itsok
|
||||
nomore:
|
||||
push bx
|
||||
cmp byte ptr cs:isact,1
|
||||
je nottest
|
||||
mov cs:isact,1
|
||||
jmp react
|
||||
mov bl,ah
|
||||
xor bh,bh
|
||||
shl bx,1
|
||||
mov bx,cs:[bx].tables
|
||||
mov cs:current,bx
|
||||
pop bx
|
||||
call cs:current
|
||||
itsok:
|
||||
jnc noerror
|
||||
push bp
|
||||
mov bp,sp
|
||||
or byte ptr [bp+6],1b
|
||||
pop bp
|
||||
mov ax,cs
|
||||
shl eax,16
|
||||
mov ax,cs:current
|
||||
jmp endofint
|
||||
noerror:
|
||||
push bp
|
||||
mov bp,sp
|
||||
and byte ptr [bp+6],0FEh
|
||||
pop bp
|
||||
endofint:
|
||||
mov cs:isact,0
|
||||
sti
|
||||
iret
|
||||
nottest:
|
||||
pop bx
|
||||
jmp endofint
|
||||
current dw 0
|
||||
tables dw 0;detectjoystick
|
||||
;dw getjoystick
|
||||
;dw getjoystickscreen
|
||||
;dw configjoystick
|
||||
isact db 0
|
||||
|
||||
;envoie en bx,cx les coordonn‚es et en dl les boutons
|
||||
getjoystick:
|
||||
push ax cx
|
||||
mov bx,cs:rx
|
||||
mov cx,cs:ry
|
||||
mov al,cs:button
|
||||
not al
|
||||
mov cl,4
|
||||
shr al,cl
|
||||
mov dl,al
|
||||
pop cx ax
|
||||
ret
|
||||
|
||||
;envoie en di les coordonn‚es ecran et en dl les boutons
|
||||
getjoystickscreen:
|
||||
push ax cx
|
||||
mov di,cs:xy
|
||||
mov al,cs:button
|
||||
not al
|
||||
mov cl,4
|
||||
shr al,cl
|
||||
mov dl,al
|
||||
pop cx ax
|
||||
ret
|
||||
db 'button'
|
||||
Button db 0
|
||||
db 'rx'
|
||||
rx dw 0
|
||||
db 'ry'
|
||||
ry dw 0
|
||||
db 'vx'
|
||||
VX db 0
|
||||
db 'vy'
|
||||
VY db 0
|
||||
db 'x'
|
||||
X dw 7FFFh
|
||||
db 'y'
|
||||
Y dw 7FFFh
|
||||
speed db 6
|
||||
spherex db 0
|
||||
spherey db 0
|
||||
db 'count'
|
||||
count db 0
|
||||
db 'error'
|
||||
error db 0
|
||||
xy dw 0
|
||||
old db 0
|
||||
|
||||
calibrate db 0
|
||||
db 'ticks'
|
||||
ticks dw 0
|
||||
db 'state'
|
||||
state db 0
|
||||
db 'connard'
|
||||
connard db 1
|
||||
connard2 db 1
|
||||
;Gestionnaire de joystick
|
||||
react:
|
||||
push ax bx cx dx si di bp ds es
|
||||
push cs
|
||||
pop ds
|
||||
mov dx,201h
|
||||
cmp error, 1
|
||||
je gest1
|
||||
cmp count,1
|
||||
je gest1
|
||||
cmp count,2
|
||||
je gest2
|
||||
gest1:
|
||||
mov error,0
|
||||
mov count,2
|
||||
call getticks
|
||||
mov ticks,ax
|
||||
out dx,al
|
||||
in al,dx
|
||||
and al,00000011b
|
||||
mov state,al
|
||||
jmp endgest
|
||||
gest2:
|
||||
not connard
|
||||
call getticks
|
||||
sub ax,ticks
|
||||
cmp ax,1FF0h
|
||||
jb nofinish
|
||||
mov error,1
|
||||
jmp endgest
|
||||
nofinish:
|
||||
mov bx,ax
|
||||
in al,dx
|
||||
and al,00000011b
|
||||
cmp state,al
|
||||
je endgest
|
||||
xchg state,al
|
||||
xor al,state
|
||||
mov cl,4
|
||||
or bx,bx
|
||||
js noadj
|
||||
shr bx,cl
|
||||
noadj:
|
||||
test al,1
|
||||
je isy
|
||||
mov VX,bl
|
||||
jmp wasx
|
||||
isy:
|
||||
test al,2
|
||||
je endgest
|
||||
mov VY,bl
|
||||
wasx:
|
||||
mov connard2,0fh
|
||||
mov count,1
|
||||
endgest:
|
||||
in al,dx
|
||||
not al
|
||||
mov cl,4
|
||||
shr al,cl
|
||||
mov button,al
|
||||
push cs
|
||||
pop es
|
||||
mov di,offset infos
|
||||
mov ah,34
|
||||
int 47h
|
||||
mov cl,speed
|
||||
movsx bx,VY
|
||||
shl bx,cl
|
||||
cmp spherey,0
|
||||
jne nolimity
|
||||
xor ah,ah
|
||||
mov al,[di]
|
||||
cmp byte ptr [di+7],4
|
||||
jbe text4
|
||||
shl ax,3
|
||||
text4:
|
||||
dec ax
|
||||
cmp bx,0
|
||||
jg decy
|
||||
cmp ry,ax
|
||||
jae noaddy
|
||||
jmp nolimity
|
||||
decy:
|
||||
cmp ry,0
|
||||
je noaddy
|
||||
nolimity:
|
||||
sub y,bx
|
||||
noaddy:
|
||||
movsx bx,VX
|
||||
shl bx,cl
|
||||
cmp spherex,0
|
||||
jne nolimitx
|
||||
xor ah,ah
|
||||
mov al,[di+1]
|
||||
cmp byte ptr [di+7],4
|
||||
jbe text5
|
||||
shl ax,3
|
||||
text5:
|
||||
dec ax
|
||||
cmp bx,0
|
||||
jl decx
|
||||
cmp rx,ax
|
||||
jae noaddx
|
||||
jmp nolimitx
|
||||
decx:
|
||||
cmp rx,0
|
||||
je noaddx
|
||||
nolimitx:
|
||||
add x,bx
|
||||
noaddx:
|
||||
mov ax,x
|
||||
mov bx,0FFFFh
|
||||
xor ch,ch
|
||||
mov cl,[di+1]
|
||||
cmp byte ptr [di+7],4
|
||||
jbe text1
|
||||
shl cx,3
|
||||
text1:
|
||||
mul cx
|
||||
div bx
|
||||
mov rx,ax
|
||||
mov ax,y
|
||||
xor ch,ch
|
||||
mov cl,[di]
|
||||
cmp byte ptr [di+7],4
|
||||
jbe text2
|
||||
shl cx,3
|
||||
text2:
|
||||
mul cx
|
||||
div bx
|
||||
mov ry,ax
|
||||
xor ch,ch
|
||||
mov cl,[di+1]
|
||||
cmp byte ptr [di+7],4
|
||||
jbe text3
|
||||
shl cx,3
|
||||
text3:
|
||||
mul cx
|
||||
add ax,rx
|
||||
cmp byte ptr [di+7],4
|
||||
mov di,ax
|
||||
jbe textpoint
|
||||
mov ax,0A000h
|
||||
mov es,ax
|
||||
jmp graphpoint
|
||||
textpoint:
|
||||
mov ax,0B800h
|
||||
mov es,ax
|
||||
shl di,1
|
||||
inc di
|
||||
graphpoint:
|
||||
mov bx,xy
|
||||
cmp byte ptr es:[bx],070h
|
||||
jne waschanged
|
||||
mov al,old
|
||||
mov byte ptr es:[bx],al
|
||||
waschanged:
|
||||
mov xy,di
|
||||
mov al,es:[di]
|
||||
mov old,al
|
||||
mov byte ptr es:[di],070h
|
||||
mov al, 20h
|
||||
out 0a0h, al
|
||||
out 20h, al
|
||||
errormouse:
|
||||
pop es ds bp di si dx cx bx ax
|
||||
mov cs:isact,0
|
||||
pop bx
|
||||
iret
|
||||
infos db 40 dup (0)
|
||||
|
||||
|
||||
getticks:
|
||||
mov al,0
|
||||
out 43h,al
|
||||
jmp wait1
|
||||
wait1:
|
||||
in al,40h
|
||||
mov ah,al
|
||||
jmp wait2
|
||||
wait2:
|
||||
in al,40h
|
||||
xchg ah,al
|
||||
ret
|
||||
|
||||
end start
|
749
noyau/mcb.asm
Normal file
749
noyau/mcb.asm
Normal file
@ -0,0 +1,749 @@
|
||||
|
||||
;Affiche le nombre hexa dans %0[dword]
|
||||
PROC biosprinth FAR
|
||||
ARG @num:dword
|
||||
USES ax,bx,cx,edx,si,di
|
||||
mov edx,[@num]
|
||||
mov ah,09h
|
||||
mov di,8
|
||||
@@hexaize:
|
||||
rol edx,4
|
||||
mov si,dx
|
||||
and si,1111b
|
||||
mov al,[cs:si+offset @@tab]
|
||||
mov cx,1
|
||||
cmp al,32
|
||||
jb @@control
|
||||
mov bx,7
|
||||
mov ah,09h
|
||||
int 10h
|
||||
@@control:
|
||||
mov ah,0Eh
|
||||
int 10h
|
||||
dec di
|
||||
jnz @@hexaize
|
||||
ret
|
||||
@@tab db '0123456789ABCDEF'
|
||||
endp biosprinth
|
||||
|
||||
;Affiche le texte ASCIIZ pointé par %0
|
||||
PROC biosprint FAR
|
||||
ARG @pointer:word
|
||||
USES ax,bx,cx,si
|
||||
mov si,[@pointer]
|
||||
mov cx,1
|
||||
mov bx,7
|
||||
@@again:
|
||||
lodsb
|
||||
or al,al
|
||||
jz @@fin
|
||||
cmp al,32
|
||||
jb @@control
|
||||
mov ah,09h
|
||||
int 10h
|
||||
@@control:
|
||||
mov ah,0Eh
|
||||
int 10h
|
||||
jmp @@again
|
||||
@@fin:
|
||||
ret
|
||||
endp biosprint
|
||||
|
||||
PROC enablea20 FAR
|
||||
USES ax
|
||||
mov al,0d1h
|
||||
out 64h,al
|
||||
call a20wait
|
||||
mov al,0dfh
|
||||
out 60h,al
|
||||
call a20wait
|
||||
;mov al,0ffh
|
||||
;out 64h,al
|
||||
;call a20wait
|
||||
ret
|
||||
endp enablea20
|
||||
|
||||
PROC disablea20 FAR
|
||||
USES ax
|
||||
mov al,0d1h
|
||||
out 64h,al
|
||||
call a20wait
|
||||
mov al,0DDh
|
||||
out 60h,al
|
||||
call a20wait
|
||||
;mov al,0ffh
|
||||
;out 64h,al
|
||||
;call a20wait
|
||||
ret
|
||||
endp disablea20
|
||||
|
||||
a20wait:
|
||||
in al,64h
|
||||
jmp @@suite
|
||||
@@suite:
|
||||
and al,2
|
||||
jnz a20wait
|
||||
ret
|
||||
;par le system control port A
|
||||
;in al,92h
|
||||
;or al,2
|
||||
;out 92h,al
|
||||
|
||||
;par le system control port A
|
||||
;in al,92h
|
||||
;and al,not 2
|
||||
;out 92h,al
|
||||
|
||||
PROC flatmode FAR
|
||||
USES eax,bx,ds
|
||||
push cs
|
||||
pop ds
|
||||
; first, calculate the linear address of GDT
|
||||
xor eax,eax
|
||||
mov ax,ds
|
||||
shl eax,4
|
||||
add [dword ptr offset @@gdt+2],eax ; store as GDT linear base addr
|
||||
; now load the GDT into the GDTR
|
||||
lgdt [fword ptr offset @@gdt] ; load GDT base
|
||||
mov bx,1 * size descriptor ; point to first descriptor
|
||||
cli ; turn off interrupts
|
||||
mov eax,cr0 ; prepare to enter protected mode
|
||||
or al,1 ; flip the PE bit
|
||||
mov cr0,eax ; we're now in protected mode
|
||||
jmp @@suite
|
||||
@@suite:
|
||||
mov fs,bx ; load the FS segment register
|
||||
and al,0FEh ; clear the PE bit again
|
||||
mov cr0,eax ; back to real mode
|
||||
jmp @@suite2
|
||||
@@suite2:
|
||||
sti ; resume handling interrupts
|
||||
ret ;
|
||||
|
||||
@@gdt descriptor <offset @@gdtend - offset @@gdt - 1, offset @@gdt, 0, 0, 0, 0> ; the GDT itself
|
||||
descriptor <0ffffh, 0, 0, 091h, 0cfh, 0> ; 4G data segment
|
||||
@@gdtend:
|
||||
endp flatmode
|
||||
|
||||
;Attend l'appuie sur une touche
|
||||
PROC bioswaitkey FAR
|
||||
USES ax
|
||||
xor ax,ax
|
||||
int 16h
|
||||
ret
|
||||
endp bioswaitkey
|
||||
|
||||
firstmb dw 0
|
||||
|
||||
|
||||
;Charge les sections du block %0
|
||||
PROC mbloadsection FAR
|
||||
ARG @blocks:word
|
||||
USES ax,bx,cx,si,di,ds,es
|
||||
LOCAL @@toresov:word:60
|
||||
mov ax,[@blocks]
|
||||
mov es,ax
|
||||
mov ds,ax
|
||||
cmp [word ptr 0],"EC"
|
||||
jne @@notace
|
||||
lea si,[@@toresov]
|
||||
mov [word ptr ss:si],0FFFFh
|
||||
mov bx,[ds:exe.sections]
|
||||
cmp bx,0
|
||||
je @@finishloading
|
||||
@@loading:
|
||||
cmp [dword ptr bx],0
|
||||
je @@finishloading
|
||||
mov ax,bx
|
||||
add ax,4
|
||||
pushad
|
||||
call biosprint,ax
|
||||
popad
|
||||
call mbcreate,ax,[word ptr bx+2]
|
||||
jc @@error
|
||||
inc si
|
||||
inc si
|
||||
mov [ss:si],ax
|
||||
push si
|
||||
mov si,[bx]
|
||||
xor di,di
|
||||
mov es,ax
|
||||
mov cx,[bx+2]
|
||||
cld
|
||||
rep movsb
|
||||
pop si
|
||||
add bx,4
|
||||
@@gonext:
|
||||
inc bx
|
||||
cmp [byte ptr bx],0
|
||||
jne @@gonext
|
||||
inc bx
|
||||
jmp @@loading
|
||||
@@finishloading:
|
||||
cmp [word ptr ss:si],0FFFFh
|
||||
je @@finishdepands
|
||||
call mbloadfuncs,[word ptr ss:si]
|
||||
jc @@depandserror
|
||||
dec si
|
||||
dec si
|
||||
jmp @@finishloading
|
||||
@@finishdepands:
|
||||
ret
|
||||
@@notace:
|
||||
stc
|
||||
ret
|
||||
@@error:
|
||||
stc
|
||||
ret
|
||||
@@depandserror:
|
||||
stc
|
||||
ret
|
||||
endp mbloadsection
|
||||
|
||||
|
||||
;Initialise les blocs de mémoire en prenant memorystart pour segment de base
|
||||
PROC mbinit FAR
|
||||
USES ax,cx,si,di,ds,es
|
||||
cmp [cs:firstmb],0
|
||||
jne @@alreadyok
|
||||
push cs
|
||||
pop ds
|
||||
mov [cs:firstmb],memorystart
|
||||
mov ax,memorystart-2
|
||||
mov es,ax
|
||||
mov si,offset afree
|
||||
xor di,di
|
||||
mov cx,size mb
|
||||
rep movsb
|
||||
clc
|
||||
ret
|
||||
@@alreadyok:
|
||||
stc
|
||||
ret
|
||||
endp mbinit
|
||||
|
||||
afree mb <"HN",0,0,0,0A000h-memorystart,"Libre">
|
||||
db 0
|
||||
|
||||
;Creér un bloc de nom %0 de taille %1 (octets) -> n°segment dans AX
|
||||
PROC mbcreate FAR
|
||||
ARG @blocks:word,@size:word
|
||||
USES bx,cx,dx,si,di,ds,es
|
||||
push gs
|
||||
mov ax,[ss:bp+4]
|
||||
mov dx,ax
|
||||
dec dx
|
||||
dec dx
|
||||
mov gs,dx
|
||||
cmp [word ptr gs:0x0],'NH'
|
||||
je @@oktoset
|
||||
mov ax,memorystart
|
||||
@@oktoset:
|
||||
mov gs,ax
|
||||
mov cx,[@size]
|
||||
shr cx,4
|
||||
inc cx
|
||||
mov bx,[cs:firstmb]
|
||||
dec bx
|
||||
dec bx
|
||||
mov dl,true
|
||||
@@searchfree:
|
||||
cmp dl,false
|
||||
je @@notenougtmem
|
||||
mov es,bx
|
||||
cmp [word ptr es:mb.check],"NH"
|
||||
jne @@memoryerror
|
||||
cmp [es:mb.isnotlast],true
|
||||
sete dl
|
||||
cmp [es:mb.reference],free
|
||||
jne @@notsogood
|
||||
mov ax,[es:mb.sizes]
|
||||
cmp cx,ax
|
||||
ja @@notsogood
|
||||
mov [word ptr es:mb.check],"NH"
|
||||
mov [es:mb.isnotlast],true
|
||||
mov [es:mb.reference],gs
|
||||
mov [es:mb.isresident],false
|
||||
lea di,[es:mb.names]
|
||||
push cx
|
||||
mov cx,24/4
|
||||
mov si,[@blocks]
|
||||
cld
|
||||
rep movsd
|
||||
pop cx
|
||||
inc bx
|
||||
inc bx
|
||||
sub ax,cx
|
||||
cmp ax,0
|
||||
je @@nofree
|
||||
dec ax
|
||||
dec ax
|
||||
mov [es:mb.sizes],cx
|
||||
add cx,bx
|
||||
mov es,cx
|
||||
mov si,offset afree
|
||||
xor di,di
|
||||
mov cx,size mb
|
||||
push cs
|
||||
pop ds
|
||||
cld
|
||||
rep movsb
|
||||
mov [es:mb.isnotlast],dl
|
||||
mov [es:mb.sizes],ax
|
||||
@@nofree:
|
||||
mov ax,bx
|
||||
pop gs
|
||||
clc
|
||||
ret
|
||||
@@notsogood:
|
||||
inc bx
|
||||
inc bx
|
||||
add bx,[es:mb.sizes]
|
||||
jmp @@searchfree
|
||||
@@memoryerror:
|
||||
pop gs
|
||||
stc
|
||||
ret
|
||||
@@notenougtmem:
|
||||
pop gs
|
||||
stc
|
||||
ret
|
||||
endp mbcreate
|
||||
|
||||
;Libère le bloc de mémoire %0 et ses sous blocs
|
||||
PROC mbfree FAR
|
||||
ARG @blocks:word
|
||||
USES ax,bx,cx,si,di,ds,es
|
||||
mov bx,[@blocks]
|
||||
mov ax,bx
|
||||
dec bx
|
||||
dec bx
|
||||
mov es,bx
|
||||
cmp [word ptr es:mb.check],"NH"
|
||||
jne @@memoryerror
|
||||
cmp [es:mb.reference],free
|
||||
je @@wasfree
|
||||
cmp [es:mb.isresident],true
|
||||
je @@wasresident
|
||||
mov [es:mb.reference],free
|
||||
push cs
|
||||
pop ds
|
||||
mov si,offset @@isfree
|
||||
lea di,[es:mb.names]
|
||||
mov cx,6
|
||||
cld
|
||||
rep movsb
|
||||
mov bx,[cs:firstmb]
|
||||
dec bx
|
||||
dec bx
|
||||
@@searchtofree:
|
||||
mov es,bx
|
||||
cmp [word ptr es:mb.check],"NH"
|
||||
jne @@memoryerror
|
||||
inc bx
|
||||
inc bx
|
||||
add bx,[es:mb.sizes]
|
||||
cmp [es:mb.sizes],0
|
||||
je @@nottofree
|
||||
cmp ax,[es:mb.reference]
|
||||
jne @@nottofree
|
||||
mov [es:mb.isresident],false
|
||||
mov [es:mb.reference],free
|
||||
mov si,offset @@isfree
|
||||
lea di,[es:mb.names]
|
||||
mov cx,6
|
||||
cld
|
||||
rep movsb
|
||||
@@nottofree:
|
||||
cmp [es:mb.isnotlast],true
|
||||
je @@searchtofree
|
||||
call mbclean
|
||||
ret
|
||||
@@memoryerror:
|
||||
stc
|
||||
ret
|
||||
@@wasfree:
|
||||
stc
|
||||
ret
|
||||
@@wasresident:
|
||||
stc
|
||||
ret
|
||||
|
||||
@@isfree db "libre",0
|
||||
endp mbfree
|
||||
|
||||
;Mise a nivo de la mémoire (jonction de blocs libre)
|
||||
PROC mbclean FAR
|
||||
USES ax,bx,dx,es,gs
|
||||
mov bx,[cs:firstmb]
|
||||
dec bx
|
||||
dec bx
|
||||
xor ax,ax
|
||||
xor dx,dx
|
||||
@@searchfree:
|
||||
mov gs,bx
|
||||
cmp [word ptr gs:mb.check],"NH"
|
||||
jne @@memoryerror
|
||||
inc bx
|
||||
inc bx
|
||||
add bx,[gs:mb.sizes]
|
||||
cmp [word ptr gs:mb.sizes],0
|
||||
je @@notenougtmem
|
||||
cmp [gs:mb.reference],free
|
||||
jne @@notfree
|
||||
cmp ax,0
|
||||
je @@notmeetfree
|
||||
add dx,[gs:mb.sizes]
|
||||
mov [word ptr gs:mb.check],0
|
||||
mov [dword ptr gs:mb.names],0
|
||||
inc dx
|
||||
inc dx
|
||||
jmp @@nottrigered
|
||||
@@notmeetfree:
|
||||
xor dx,dx
|
||||
mov ax,gs
|
||||
jmp @@nottrigered
|
||||
@@notfree:
|
||||
cmp ax,0
|
||||
je @@nottrigered
|
||||
mov es,ax
|
||||
add [es:mb.sizes],dx
|
||||
xor ax,ax
|
||||
@@nottrigered:
|
||||
cmp [gs:mb.isnotlast],true
|
||||
je @@searchfree
|
||||
cmp ax,0
|
||||
je @@reallyfinish
|
||||
mov es,ax
|
||||
add [es:mb.sizes],dx
|
||||
mov [es:mb.isnotlast],false
|
||||
@@reallyfinish:
|
||||
clc
|
||||
ret
|
||||
@@notenougtmem:
|
||||
stc
|
||||
ret
|
||||
@@memoryerror:
|
||||
stc
|
||||
ret
|
||||
endp mbclean
|
||||
|
||||
;Rend le segment %0 résident
|
||||
PROC mbresident FAR
|
||||
ARG @blocks:word
|
||||
USES bx,es
|
||||
mov bx,[@blocks]
|
||||
dec bx
|
||||
dec bx
|
||||
mov es,bx
|
||||
cmp [word ptr es:mb.check],"NH"
|
||||
jne @@memoryerror
|
||||
mov [es:mb.isresident],true
|
||||
ret
|
||||
@@memoryerror:
|
||||
stc
|
||||
ret
|
||||
endp mbresident
|
||||
|
||||
;Rend le segment %0 non résident
|
||||
PROC mbnonresident FAR
|
||||
ARG @blocks:word
|
||||
USES bx,es
|
||||
mov bx,[@blocks]
|
||||
dec bx
|
||||
dec bx
|
||||
mov es,bx
|
||||
cmp [word ptr es:mb.check],"NH"
|
||||
jne @@memoryerror
|
||||
mov [es:mb.isresident],false
|
||||
ret
|
||||
@@memoryerror:
|
||||
stc
|
||||
ret
|
||||
endp mbnonresident
|
||||
|
||||
|
||||
;Change le proprietaire de %0 a %1
|
||||
PROC mbchown FAR
|
||||
ARG @blocks:word,@owner:word
|
||||
USES bx,dx,es
|
||||
mov bx,[@blocks]
|
||||
dec bx
|
||||
dec bx
|
||||
mov es,bx
|
||||
cmp [word ptr es:mb.check],"NH"
|
||||
jne @@memoryerror
|
||||
cmp [es:mb.reference],free
|
||||
je @@wasfree
|
||||
mov dx,[@owner]
|
||||
mov [es:mb.reference],dx
|
||||
ret
|
||||
@@memoryerror:
|
||||
stc
|
||||
ret
|
||||
@@wasfree:
|
||||
stc
|
||||
ret
|
||||
endp mbchown
|
||||
|
||||
;Alloue un bloc /data de CX caractere pour le process appelant -> ax
|
||||
PROC mballoc FAR
|
||||
ARG @size:word
|
||||
USES si,ds
|
||||
push cs
|
||||
pop ds
|
||||
call mbcreate,offset @@data,[@size]
|
||||
call mbchown,ax,[word ptr ss:bp+4]
|
||||
ret
|
||||
|
||||
@@data db '/data',0
|
||||
endp mballoc
|
||||
|
||||
;Renvoie en AX le MB n° %0 carry quand terminé
|
||||
PROC mbget FAR
|
||||
ARG @num:word
|
||||
USES bx,dx,es
|
||||
mov bx,[cs:firstmb]
|
||||
dec bx
|
||||
dec bx
|
||||
xor dx,dx
|
||||
@@searchfree:
|
||||
mov es,bx
|
||||
cmp [word ptr es:mb.check],"NH"
|
||||
jne @@memoryerror
|
||||
inc bx
|
||||
inc bx
|
||||
add bx,[es:mb.sizes]
|
||||
cmp [es:mb.sizes],0
|
||||
je @@memoryerror
|
||||
cmp dx,[@num]
|
||||
je @@foundmcb
|
||||
ja @@notfound
|
||||
inc dx
|
||||
cmp [es:mb.isnotlast],true
|
||||
je @@searchfree
|
||||
@@memoryerror:
|
||||
stc
|
||||
ret
|
||||
@@foundmcb:
|
||||
mov ax,es
|
||||
inc ax
|
||||
inc ax
|
||||
clc
|
||||
ret
|
||||
@@notfound:
|
||||
stc
|
||||
ret
|
||||
endp mbget
|
||||
|
||||
;Renvoie en AX le MCB qui correspond a ds:%0
|
||||
PROC mbfind FAR
|
||||
ARG @blocks:word
|
||||
USES bx,si,di,es
|
||||
mov bx,[cs:firstmb]
|
||||
dec bx
|
||||
dec bx
|
||||
mov si,[@blocks]
|
||||
@@search:
|
||||
mov es,bx
|
||||
lea di,[es:mb.names]
|
||||
cmp [word ptr es:mb.check],"NH"
|
||||
jne @@memoryerror
|
||||
inc bx
|
||||
inc bx
|
||||
add bx,[es:mb.sizes]
|
||||
cmp [es:mb.sizes],0
|
||||
je @@memoryerror
|
||||
push si di
|
||||
@@cmpnames:
|
||||
mov al,[es:di]
|
||||
cmp al,[ds:si]
|
||||
jne @@ok
|
||||
cmp al,0
|
||||
je @@ok
|
||||
inc si
|
||||
inc di
|
||||
jmp @@cmpnames
|
||||
@@ok:
|
||||
pop di si
|
||||
je @@foundmcb
|
||||
cmp [es:mb.isnotlast],true
|
||||
je @@search
|
||||
@@notfound:
|
||||
stc
|
||||
ret
|
||||
@@memoryerror:
|
||||
stc
|
||||
ret
|
||||
@@foundmcb:
|
||||
mov ax,es
|
||||
inc ax
|
||||
inc ax
|
||||
clc
|
||||
ret
|
||||
endp mbfind
|
||||
|
||||
|
||||
;Renvoie en AX le sous mcb qui correspond a %0 et qui appartien a %1
|
||||
PROC mbfindsb FAR
|
||||
ARG @blocks:word,@owner:word
|
||||
USES bx,dx,si,di,es
|
||||
mov bx,[cs:firstmb]
|
||||
dec bx
|
||||
dec bx
|
||||
mov si,[@blocks]
|
||||
lea di,[es:mb.names]
|
||||
mov dx,[@owner]
|
||||
@@search:
|
||||
mov es,bx
|
||||
cmp [word ptr es:mb.check],"NH"
|
||||
jne @@memoryerror
|
||||
inc bx
|
||||
inc bx
|
||||
add bx,[es:mb.sizes]
|
||||
cmp [es:mb.sizes],0
|
||||
je @@memoryerror
|
||||
push si di
|
||||
@@cmpnames:
|
||||
mov al,[es:di]
|
||||
cmp al,[ds:si]
|
||||
jne @@ok
|
||||
cmp al,0
|
||||
je @@ok
|
||||
inc si
|
||||
inc di
|
||||
jmp @@cmpnames
|
||||
@@ok:
|
||||
pop di si
|
||||
jne @@notfoundmcb
|
||||
cmp [es:mb.reference],dx
|
||||
je @@foundmcb
|
||||
@@notfoundmcb:
|
||||
cmp [es:mb.isnotlast],true
|
||||
je @@search
|
||||
@@notfound:
|
||||
stc
|
||||
ret
|
||||
@@foundmcb:
|
||||
mov ax,es
|
||||
inc ax
|
||||
inc ax
|
||||
clc
|
||||
ret
|
||||
@@memoryerror:
|
||||
stc
|
||||
ret
|
||||
endp mbfindsb
|
||||
|
||||
;Resouds les dépendances du bloc de mémoire %0
|
||||
PROC mbloadfuncs FAR
|
||||
ARG @blocks:word
|
||||
USES ax,bx,cx,dx,si,ds
|
||||
mov ds,[@blocks]
|
||||
cmp [word ptr 0],"EC"
|
||||
jne @@notace
|
||||
mov si,[ds:exe.imports]
|
||||
cmp si,0
|
||||
je @@endofloading
|
||||
@@loadfuncs:
|
||||
cmp [word ptr si],0
|
||||
je @@endofloading
|
||||
call mbsearchfunc,si
|
||||
jnc @@toendoftext
|
||||
mov bx,si
|
||||
;pushad
|
||||
;call biosprint,si
|
||||
;popad
|
||||
@@findend:
|
||||
inc bx
|
||||
cmp [byte ptr bx], ':'
|
||||
jne @@findend
|
||||
mov [byte ptr bx],0
|
||||
call [cs:projfile],si
|
||||
jc @@erroronload
|
||||
mov [byte ptr bx],':'
|
||||
;pushad
|
||||
;call biosprint,si
|
||||
;popad
|
||||
call mbsearchfunc,si
|
||||
jc @@libnotexist
|
||||
@@toendoftext:
|
||||
mov cl,[si]
|
||||
cmp cl,0
|
||||
je @@oktonext
|
||||
inc si
|
||||
jmp @@toendoftext
|
||||
@@oktonext:
|
||||
inc si
|
||||
mov [si],ax
|
||||
mov [si+2],dx
|
||||
add si,4
|
||||
jmp @@loadfuncs
|
||||
@@endofloading:
|
||||
clc
|
||||
ret
|
||||
@@notace:
|
||||
stc
|
||||
ret
|
||||
@@libnotexist:
|
||||
stc
|
||||
ret
|
||||
@@erroronload:
|
||||
stc
|
||||
ret
|
||||
endp mbloadfuncs
|
||||
|
||||
|
||||
;Recherche une fonction pointé par DS:%0 en mémoire et renvoie son adresse en DX:AX
|
||||
PROC mbsearchfunc FAR
|
||||
ARG @func:word
|
||||
USES bx,si,di,es
|
||||
mov bx,[@func]
|
||||
mov si,bx
|
||||
@@findend:
|
||||
inc bx
|
||||
cmp [byte ptr bx], ':'
|
||||
jne @@findend
|
||||
mov [byte ptr bx],0
|
||||
call mbfind,si
|
||||
mov [byte ptr bx],':'
|
||||
jc @@notfoundattallthesb
|
||||
mov es,ax
|
||||
cmp [word ptr es:exe.checks],"EC"
|
||||
jne @@notfoundattallthesb
|
||||
mov di,[es:exe.exports]
|
||||
inc bx
|
||||
inc bx
|
||||
@@functions:
|
||||
cmp [word ptr es:di],0
|
||||
je @@notfoundattallthesb
|
||||
mov si,bx
|
||||
@@cmpnamesfunc:
|
||||
mov al,[es:di]
|
||||
cmp al,[ds:si]
|
||||
jne @@notfoundthesb
|
||||
cmp al,0
|
||||
je @@seemsok
|
||||
inc si
|
||||
inc di
|
||||
jmp @@cmpnamesfunc
|
||||
@@notfoundthesb:
|
||||
mov al,[es:di]
|
||||
cmp al,0
|
||||
je @@oktonext
|
||||
inc di
|
||||
jmp @@notfoundthesb
|
||||
@@oktonext:
|
||||
inc di
|
||||
inc di
|
||||
inc di
|
||||
jmp @@functions
|
||||
@@seemsok:
|
||||
mov dx,es
|
||||
mov ax,[es:di+1]
|
||||
clc
|
||||
ret
|
||||
@@notfoundattallthesb:
|
||||
stc
|
||||
ret
|
||||
endp mbsearchfunc
|
699
noyau/port.asm
Normal file
699
noyau/port.asm
Normal file
@ -0,0 +1,699 @@
|
||||
.model tiny
|
||||
.486
|
||||
smart
|
||||
.code
|
||||
org 0h
|
||||
start:
|
||||
jmp tsr
|
||||
drv db 'LPT ',0
|
||||
Tsr:
|
||||
cli
|
||||
cmp ax,1234h
|
||||
jne nomore
|
||||
mov ax,4321h
|
||||
jmp itsok
|
||||
nomore:
|
||||
push bx ax
|
||||
mov ah,4
|
||||
mov bh,1
|
||||
int 50h
|
||||
mov bl,al
|
||||
pop ax
|
||||
cmp byte ptr cs:isact,1
|
||||
je nottest
|
||||
mov cs:isact,1
|
||||
cmp bl,80h
|
||||
jae 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 getlptin
|
||||
dw getlptout
|
||||
dw getlptinout
|
||||
dw setlptin
|
||||
dw setlptout
|
||||
dw setlptinout
|
||||
dw getlpt
|
||||
dw getfirstlpt
|
||||
dw setemettor
|
||||
dw setreceptor
|
||||
dw settimeout
|
||||
dw gettimeout
|
||||
dw receivelpt
|
||||
dw sendlpt
|
||||
dw receivelptblock
|
||||
dw sendlptblock
|
||||
dw receivecommand
|
||||
dw sendcommand
|
||||
|
||||
react:
|
||||
push ds es
|
||||
mov cs:isact,1
|
||||
pushad
|
||||
push cs
|
||||
pop ds
|
||||
push cs
|
||||
pop es
|
||||
cmp byte ptr never,1
|
||||
je oknever
|
||||
mov bl,[drv+3]
|
||||
sub bl,'0'
|
||||
xor bh,bh
|
||||
call getlpt
|
||||
dec bl
|
||||
shl bl,1
|
||||
mov al,7
|
||||
sub al,bl
|
||||
mov ah,40
|
||||
mov di,offset video
|
||||
int 47h
|
||||
push ax
|
||||
mov ah,01h
|
||||
int 50h
|
||||
mov ah,21
|
||||
mov cl,4
|
||||
int 47h
|
||||
sti
|
||||
mov al,0111b
|
||||
call setlptout
|
||||
call setreceptor
|
||||
call initlpt
|
||||
jc errorie
|
||||
mov cx,0
|
||||
mov ah,20
|
||||
mov bx,1012h
|
||||
mov si,offset initok
|
||||
int 47h
|
||||
cmp byte ptr always,1
|
||||
je yes
|
||||
mov ah,20
|
||||
mov bx,1010h
|
||||
mov si,offset mdd
|
||||
int 47h
|
||||
mov ah,13
|
||||
mov si,offset drv
|
||||
int 47h
|
||||
mov ah,6
|
||||
int 47h
|
||||
mov ah,20
|
||||
mov bx,1011h
|
||||
mov si,offset msg
|
||||
int 47h
|
||||
waitkey:
|
||||
mov ax,0
|
||||
int 16h
|
||||
cmp al,'n'
|
||||
je no
|
||||
cmp al,'N'
|
||||
je no
|
||||
cmp al,'Y'
|
||||
je yes
|
||||
cmp al,'y'
|
||||
je yes
|
||||
cmp al,'e'
|
||||
je nev
|
||||
cmp al,'E'
|
||||
je nev
|
||||
cmp al,'a'
|
||||
je alw
|
||||
cmp al,'A'
|
||||
je alw
|
||||
jmp waitkey
|
||||
yes:
|
||||
call receivecommand
|
||||
jc errortimeout
|
||||
no:
|
||||
mov al,0111b
|
||||
call setlptout
|
||||
cli
|
||||
mov ah,41
|
||||
mov si,offset video
|
||||
int 47h
|
||||
pop ax
|
||||
mov ah,00h
|
||||
int 50h
|
||||
mov ah,09h
|
||||
int 50h
|
||||
oknever:
|
||||
popad
|
||||
pop es ds
|
||||
mov cs:isact,0
|
||||
pop bx
|
||||
jmp endofint
|
||||
errorie:
|
||||
mov si,offset inits
|
||||
jmp show
|
||||
errortimeout:
|
||||
mov si,offset timeouts
|
||||
show:
|
||||
mov ah,20
|
||||
mov bx,1012h
|
||||
int 47h
|
||||
mov ax,0
|
||||
int 16h
|
||||
jmp no
|
||||
nev:
|
||||
mov byte ptr never,1
|
||||
jmp no
|
||||
alw:
|
||||
mov byte ptr always,1
|
||||
jmp yes
|
||||
initok db 'Initialisation is realised !',0
|
||||
inits db 'Error on initialisation',0
|
||||
timeouts db 'Connection lost or timeout complete !!',0
|
||||
mdd db 'Connection demand on ',0
|
||||
msg db 'Accept connection ? (Y)es (N)o n(E)ver (A)lways',0
|
||||
isact db 0
|
||||
always db 0
|
||||
never db 0
|
||||
|
||||
;envois une commande al
|
||||
sendcommand:
|
||||
push ax bx cx di
|
||||
mov bl,al
|
||||
xor bh,bh
|
||||
shl bx,1
|
||||
add bx,offset cmde
|
||||
call cs:[bx]
|
||||
pop di cx bx ax
|
||||
ret
|
||||
cmde dw nothing
|
||||
dw getram
|
||||
|
||||
;recupŠre la ram en ds:si de cx distant caractŠres en es:di local
|
||||
getram:
|
||||
push ax bx cx ds
|
||||
mov bx,offset command
|
||||
mov cs:[bx+2],ds
|
||||
mov cs:[bx],si
|
||||
mov cs:[bx+4],cx
|
||||
push cs
|
||||
pop ds
|
||||
mov si,bx
|
||||
mov cx,6
|
||||
call sendlptblock
|
||||
jc endofget
|
||||
call receivelptblock
|
||||
endofget:
|
||||
pop ds cx bx ax
|
||||
ret
|
||||
|
||||
;Re‡ois une commande et l'execute
|
||||
Receivecommand:
|
||||
push ax bx cx di ds es
|
||||
push cs
|
||||
pop es
|
||||
push cs
|
||||
pop ds
|
||||
mov di,offset command
|
||||
call receivelptblock
|
||||
jc endofno
|
||||
mov bl,al
|
||||
xor bh,bh
|
||||
shl bx,1
|
||||
add bx,offset cmd
|
||||
call cs:[bx]
|
||||
clc
|
||||
endofno:
|
||||
pop es ds di cx bx ax
|
||||
ret
|
||||
|
||||
command db 25 dup (0)
|
||||
cmd dw nothings
|
||||
dw sendram
|
||||
dw receiveram
|
||||
dw sendreg
|
||||
dw receivereg
|
||||
dw sendport
|
||||
dw receiveport
|
||||
dw letexecute
|
||||
nothings:
|
||||
ret
|
||||
|
||||
letexecute:
|
||||
push ds es fs gs
|
||||
pushad
|
||||
push cs
|
||||
push offset suite
|
||||
mov ax,es:[di+2]
|
||||
mov ds,ax
|
||||
mov es,ax
|
||||
mov fs,ax
|
||||
mov gs,ax
|
||||
push ax
|
||||
mov ax,es:[di]
|
||||
push ax
|
||||
DB 0CBh
|
||||
suite:
|
||||
popad
|
||||
pop gs fs es ds
|
||||
ret
|
||||
|
||||
Sendram:
|
||||
push ax cx si ds
|
||||
mov si,es:[di]
|
||||
mov ax,es:[di+2]
|
||||
mov ds,ax
|
||||
mov cx,es:[di+4]
|
||||
call sendlptblock
|
||||
pop ds si cx ax
|
||||
ret
|
||||
|
||||
receiveram:
|
||||
sendreg:
|
||||
receivereg:
|
||||
|
||||
sendport:
|
||||
push ax cx dx si
|
||||
mov dx,es:[di]
|
||||
in ax,dx
|
||||
mov cx,2
|
||||
mov si,offset tempblock
|
||||
mov ds:[si],ax
|
||||
call sendlptblock
|
||||
pop si dx cx ax
|
||||
ret
|
||||
|
||||
receiveport:
|
||||
push ax dx
|
||||
mov dx,es:[di]
|
||||
mov ax,es:[di+2]
|
||||
out dx,ax
|
||||
pop dx ax
|
||||
ret
|
||||
|
||||
tempblock db 25 dup (0)
|
||||
|
||||
;---------Segment Adress-----------
|
||||
Bios equ 040h
|
||||
;---------Offset Adress------------
|
||||
Lptadr equ 008h
|
||||
Timer equ 06Ch
|
||||
;---------Constant-----------------
|
||||
onesec equ 18
|
||||
tensec equ 182
|
||||
Ack equ 00
|
||||
Nack equ 0FFh
|
||||
maxtry equ 10
|
||||
|
||||
Initlpt:
|
||||
push ax ecx
|
||||
call StartTimer
|
||||
cmp cs:emettor,0
|
||||
je receptinit
|
||||
mov al,10000b
|
||||
call SetLptOut
|
||||
waitinit1:
|
||||
call EndTimer
|
||||
cmp cx,cs:timeout
|
||||
ja errorinit
|
||||
call getlptIn
|
||||
cmp al,00000b
|
||||
jnz waitinit1
|
||||
jmp endinit
|
||||
receptinit:
|
||||
call EndTimer
|
||||
cmp cx,cs:timeout
|
||||
ja errorinit
|
||||
call getlptIn
|
||||
cmp al,00000b
|
||||
jnz receptinit
|
||||
mov al,10000b
|
||||
call SetLptOut
|
||||
endinit:
|
||||
clc
|
||||
pop ecx ax
|
||||
ret
|
||||
errorinit:
|
||||
stc
|
||||
pop ecx ax
|
||||
ret
|
||||
|
||||
|
||||
;-Envoie DL (dh) JNE si problŠme JNC error timeout
|
||||
Sendlpt:
|
||||
push ax bx ecx
|
||||
call StartTimer
|
||||
mov dh,dl
|
||||
mov al,dl
|
||||
and al,0Fh
|
||||
call SetLptOut
|
||||
waitSend:
|
||||
call EndTimer
|
||||
cmp cx,cs:timeout
|
||||
ja errorsend
|
||||
call getlptIn
|
||||
bt ax,4
|
||||
jnc waitsend
|
||||
and al,0Fh
|
||||
mov bl,al
|
||||
call StartTimer ;/////
|
||||
mov al,dh
|
||||
shr al,4
|
||||
or al,10000b
|
||||
call SetLptOut
|
||||
waitSend2:
|
||||
call EndTimer
|
||||
cmp cx,cs:timeout
|
||||
ja errorsend
|
||||
call getlptIn
|
||||
bt ax,4
|
||||
jc waitsend2
|
||||
and al,0Fh
|
||||
shl al,4
|
||||
add bl,al
|
||||
cmp dl,bl
|
||||
pop ecx bx ax
|
||||
clc
|
||||
ret
|
||||
errorsend:
|
||||
pop ecx bx ax
|
||||
stc
|
||||
ret
|
||||
|
||||
|
||||
;-Re‡ois DL (dh)
|
||||
Receivelpt:
|
||||
push ax bx ecx
|
||||
call StartTimer
|
||||
waitreceive:
|
||||
call EndTimer
|
||||
cmp cx,cs:timeout
|
||||
ja errorreceive
|
||||
call getlptIn
|
||||
bt ax,4
|
||||
jnc waitreceive
|
||||
and al,0Fh
|
||||
mov dl,al
|
||||
call SetLptOut
|
||||
call StartTimer ;/////
|
||||
waitreceive2:
|
||||
call EndTimer
|
||||
cmp cx,cs:timeout
|
||||
ja errorreceive
|
||||
call getlptIn
|
||||
bt ax,4
|
||||
jc waitreceive2
|
||||
and al,0Fh
|
||||
mov dh,al
|
||||
shl dh,4
|
||||
add dl,dh
|
||||
or al,10000b
|
||||
call SetlptOut
|
||||
clc
|
||||
pop ecx bx ax
|
||||
ret
|
||||
errorreceive:
|
||||
stc
|
||||
pop ecx bx ax
|
||||
ret
|
||||
|
||||
;-AX
|
||||
SetTimeout:
|
||||
mov cs:Timeout,dx
|
||||
ret
|
||||
|
||||
timeout dw tensec
|
||||
|
||||
getTimeout:
|
||||
mov dx,cs:Timeout
|
||||
ret
|
||||
|
||||
SetEmettor:
|
||||
mov cs:Emettor,1
|
||||
ret
|
||||
|
||||
Emettor db 0
|
||||
|
||||
SetReceptor:
|
||||
mov cs:Emettor,0
|
||||
ret
|
||||
|
||||
;->bx Nøport->Adresse dx
|
||||
GetLpt:
|
||||
push ax bx ds
|
||||
mov ax,bios
|
||||
mov ds,ax
|
||||
dec bx
|
||||
shl bx,1
|
||||
mov dx,ds:[Lptadr+bx]
|
||||
mov cs:lpt,dx
|
||||
pop ds bx ax
|
||||
ret
|
||||
lpt dw 0
|
||||
|
||||
;->bx Nøport->Adresse dx
|
||||
GetFirstLpt:
|
||||
push ax ds
|
||||
mov ax,bios
|
||||
mov ds,ax
|
||||
xor bx,bx
|
||||
findlpt:
|
||||
mov dx,ds:[Lptadr+bx]
|
||||
cmp dx,0
|
||||
jne oklpt
|
||||
add bx,2
|
||||
cmp bx,4
|
||||
jbe findlpt
|
||||
oklpt:
|
||||
mov cs:lpt,dx
|
||||
pop ds ax
|
||||
ret
|
||||
|
||||
;->
|
||||
StartTimer:
|
||||
push ax ecx ds
|
||||
mov ax,Bios
|
||||
mov ds,ax
|
||||
mov ecx,ds:[timer]
|
||||
mov cs:times,ecx
|
||||
pop ds ecx ax
|
||||
ret
|
||||
times dd 0
|
||||
|
||||
;->Ecx time elapsed
|
||||
EndTimer:
|
||||
push ax ds
|
||||
mov ax,Bios
|
||||
mov ds,ax
|
||||
mov ecx,ds:[timer]
|
||||
sub ecx,cs:times
|
||||
pop ds ax
|
||||
ret
|
||||
|
||||
;->
|
||||
GetLptOut:
|
||||
push dx
|
||||
mov dx,cs:lpt
|
||||
in al,dx
|
||||
pop dx
|
||||
ret
|
||||
|
||||
GetLptIn:
|
||||
push dx
|
||||
mov dx,cs:lpt
|
||||
inc dx
|
||||
in al,dx
|
||||
shr al,3
|
||||
pop dx
|
||||
ret
|
||||
|
||||
GetLptInOut:
|
||||
push dx
|
||||
mov dx,cs:lpt
|
||||
add dx,2
|
||||
in al,dx
|
||||
and al,11111b
|
||||
pop dx
|
||||
ret
|
||||
|
||||
SetLptOut:
|
||||
push dx
|
||||
mov dx,cs:lpt
|
||||
out dx,al
|
||||
pop dx
|
||||
ret
|
||||
|
||||
SetLptIn:
|
||||
push dx
|
||||
mov dx,cs:lpt
|
||||
inc dx
|
||||
out dx,al
|
||||
pop dx
|
||||
ret
|
||||
|
||||
SetLptInOut:
|
||||
push dx
|
||||
mov dx,cs:lpt
|
||||
add dx,2
|
||||
out dx,al
|
||||
pop dx
|
||||
ret
|
||||
|
||||
;R‚alise un checksum 8 bits sur donn‚es DS:SI, nb CX r‚sultat dans dl
|
||||
Checksum8:
|
||||
push cx si
|
||||
check:
|
||||
add dl,[si]
|
||||
inc si
|
||||
dec cx
|
||||
jnz check
|
||||
pop si cx
|
||||
ret
|
||||
|
||||
;DS:SI pointeur sur donn‚es, CX nombres de donn‚es, AL token
|
||||
SendLptBlock:
|
||||
push ax bx cx edx si edi bp
|
||||
mov dx,cx
|
||||
shl edx,16
|
||||
mov dh,al
|
||||
call checksum8
|
||||
mov edi,edx
|
||||
xor dh,dh
|
||||
mov bp,dx
|
||||
mov ah,maxtry
|
||||
retry:
|
||||
mov bl,4
|
||||
xor al,al
|
||||
header:
|
||||
mov dx,di
|
||||
call sendlpt
|
||||
setne al
|
||||
jc outt
|
||||
rol edi,8
|
||||
dec bl
|
||||
jnz header
|
||||
cmp al,0
|
||||
jne notgood
|
||||
mov dl,ACK
|
||||
jmp allsend
|
||||
notgood:
|
||||
mov dl,NACK
|
||||
allsend:
|
||||
call sendlpt
|
||||
setne al
|
||||
jc outt
|
||||
cmp al,0
|
||||
je okheader
|
||||
dec ah
|
||||
jnz retry
|
||||
jmp outt
|
||||
okheader:
|
||||
cmp cx,0
|
||||
je endoftrans
|
||||
mov di,maxtry
|
||||
retry2:
|
||||
mov bx,cx
|
||||
xor ax,ax
|
||||
body:
|
||||
mov dl,[si+bx-1]
|
||||
add ah,dl
|
||||
call sendlpt
|
||||
setne al
|
||||
jc outt
|
||||
dec bx
|
||||
jnz body
|
||||
cmp al,0
|
||||
jne notgood2
|
||||
mov dl,ACK
|
||||
jmp allisend
|
||||
notgood2:
|
||||
mov dl,NACK
|
||||
allisend:
|
||||
call sendlpt
|
||||
setne al
|
||||
jc outt
|
||||
cmp al,0
|
||||
je endoftrans
|
||||
dec di
|
||||
jnz retry2
|
||||
outt:
|
||||
stc
|
||||
endoftrans:
|
||||
mov al,ah
|
||||
xor ah,ah
|
||||
cmp bp,ax
|
||||
pop bp edi si edx cx bx ax
|
||||
ret
|
||||
|
||||
;Receptionne en es:di les donn‚es au nombres de CX token AL (AH) (ECX)
|
||||
receiveLptBlock:
|
||||
push bx dx si bp
|
||||
mov ah,maxtry
|
||||
retrye:
|
||||
mov bl,4
|
||||
headere:
|
||||
call receivelpt
|
||||
jc outte
|
||||
mov cl,dl
|
||||
rol ecx,8
|
||||
dec bl
|
||||
jnz headere
|
||||
call receivelpt
|
||||
jc outte
|
||||
cmp dl,ACK
|
||||
je okheadere
|
||||
dec ah
|
||||
jnz retrye
|
||||
jmp outte
|
||||
okheadere:
|
||||
mov al,ch
|
||||
xor ch,ch
|
||||
mov bp,cx
|
||||
rol ecx,16
|
||||
cmp cx,0
|
||||
je endoftranse
|
||||
mov si,maxtry
|
||||
retrye2:
|
||||
mov bx,cx
|
||||
xor ah,ah
|
||||
bodye:
|
||||
call receivelpt
|
||||
jc outte
|
||||
mov es:[di+bx-1],dl
|
||||
add ah,dl
|
||||
dec bx
|
||||
jnz bodye
|
||||
call receivelpt
|
||||
jc outte
|
||||
cmp dl,ACK
|
||||
je endoftranse
|
||||
dec si
|
||||
jnz retrye2
|
||||
outte:
|
||||
stc
|
||||
endoftranse:
|
||||
mov bl,ah
|
||||
xor bh,bh
|
||||
cmp bp,bx
|
||||
pop bp si dx bx
|
||||
ret
|
||||
video db 0
|
||||
end start
|
327
noyau/souris.asm
Normal file
327
noyau/souris.asm
Normal file
@ -0,0 +1,327 @@
|
||||
.model tiny
|
||||
.486
|
||||
smart
|
||||
.code
|
||||
org 0h
|
||||
start:
|
||||
jmp tsr
|
||||
drv db 'MOUSE',0
|
||||
Tsr:
|
||||
cli
|
||||
cmp ax,1234h
|
||||
jne nomore
|
||||
mov ax,4321h
|
||||
jmp itsok
|
||||
nomore:
|
||||
push bx ax
|
||||
mov ah,4
|
||||
mov bh,0
|
||||
int 50h
|
||||
mov bl,al
|
||||
pop ax
|
||||
cmp byte ptr cs:isact,1
|
||||
je nottest
|
||||
mov cs:isact,1
|
||||
and bl,10000b
|
||||
cmp bl,16
|
||||
jae 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 cmdmouse
|
||||
dw cmdmouse2
|
||||
dw detectmouse
|
||||
dw getmouse
|
||||
dw getmousescreen
|
||||
dw configmouse
|
||||
|
||||
isact db 0
|
||||
|
||||
;Envoie une commande AL … la souris via controleur clavier
|
||||
cmdmouse:
|
||||
push ax
|
||||
videbuff1:
|
||||
in al, 64h
|
||||
and al, 10b
|
||||
jne videbuff1
|
||||
mov al, 00d4h
|
||||
out 64h, al
|
||||
videbuff2:
|
||||
in al, 64h
|
||||
and al, 10b
|
||||
jne videbuff2
|
||||
pop ax
|
||||
out 60h, al
|
||||
in al, 60h
|
||||
ret
|
||||
|
||||
;Envoie une commande2 AL … la souris via controleur clavier carry=nomouse
|
||||
cmdmouse2:
|
||||
push ax
|
||||
videbuff21:
|
||||
in al, 64h
|
||||
and al, 10b
|
||||
jne videbuff21
|
||||
mov al, 0060h
|
||||
out 64h, al
|
||||
videbuff22:
|
||||
in al, 64h
|
||||
and al, 10b
|
||||
jne videbuff22
|
||||
pop ax
|
||||
out 60h, al
|
||||
in al, 60h
|
||||
ret
|
||||
|
||||
Detectmouse:
|
||||
push ax cx
|
||||
mov al, 0a8h ;AUX enable
|
||||
out 64h, al
|
||||
mov al, 0f3h ;Set sample
|
||||
call cmdmouse
|
||||
mov al, 100 ;Set sample
|
||||
call cmdmouse
|
||||
mov al, 0e8h ;Set resolution
|
||||
call cmdmouse
|
||||
mov al, 01 ;Set resolution
|
||||
call cmdmouse
|
||||
mov al, 0e7h ;Set scale 2:1
|
||||
call cmdmouse
|
||||
mov al, 0f4h ;Enable device
|
||||
call cmdmouse
|
||||
mov al, 47h ;Interruption ON
|
||||
call cmdmouse2
|
||||
mov cx, 1024
|
||||
testmouse:
|
||||
in al, 60h ;Lecture du port de donn‚es
|
||||
cmp al, 250 ;Test si il y a une souris
|
||||
je okmouse
|
||||
dec cx
|
||||
jnz testmouse
|
||||
stc
|
||||
jmp endoftest
|
||||
okmouse:
|
||||
clc
|
||||
endoftest:
|
||||
pop cx ax
|
||||
ret
|
||||
|
||||
;envoie en bx,cx les coordonn‚es et en dl les boutons
|
||||
getmouse:
|
||||
mov bx,cs:rx
|
||||
mov cx,cs:ry
|
||||
mov dl,cs:button
|
||||
sub dl,8
|
||||
and dl,0Fh
|
||||
clc
|
||||
ret
|
||||
|
||||
;envoie en di les coordonn‚es ecran et en dl les boutons
|
||||
getmousescreen:
|
||||
mov di,cs:xy
|
||||
mov dl,cs:button
|
||||
sub dl,8
|
||||
and dl,0Fh
|
||||
clc
|
||||
ret
|
||||
|
||||
|
||||
;configure la rapidit‚ dans cl et dans ah,al sphŠre x et y
|
||||
Configmouse:
|
||||
mov cs:speed,cl
|
||||
mov cs:spherex,ah
|
||||
mov cs:spherey,al
|
||||
ret
|
||||
|
||||
Button db 0
|
||||
rx dw 0
|
||||
ry dw 0
|
||||
VX db 0
|
||||
VY db 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 db 0
|
||||
;Gestionnaire de souris PS/2
|
||||
react:
|
||||
push ax bx cx dx di ds es
|
||||
push cs
|
||||
pop ds
|
||||
in al, 60h
|
||||
cmp error, 1
|
||||
je gest1
|
||||
cmp count, 1
|
||||
je gest1
|
||||
cmp count, 2
|
||||
je gest2
|
||||
cmp count, 3
|
||||
je gest3
|
||||
|
||||
gest1:
|
||||
mov count, 2
|
||||
mov Button, al
|
||||
and al, 00001000b
|
||||
cmp al, 8
|
||||
je gest1end
|
||||
mov error, 1
|
||||
jmp gest1end2
|
||||
gest1end:
|
||||
mov error, 0
|
||||
gest1end2:
|
||||
mov count, 2
|
||||
jmp endgest
|
||||
gest2:
|
||||
mov count, 3
|
||||
mov VX, al
|
||||
jmp endgest
|
||||
gest3:
|
||||
mov count, 1
|
||||
mov VY, al
|
||||
jmp endgest
|
||||
endgest:
|
||||
cmp error,1
|
||||
je errormouse
|
||||
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 di dx cx bx ax
|
||||
mov cs:isact,0
|
||||
pop bx
|
||||
iret
|
||||
infos db 40 dup (0)
|
||||
|
||||
end start
|
297
noyau/systeme.asm
Normal file
297
noyau/systeme.asm
Normal file
@ -0,0 +1,297 @@
|
||||
model tiny,stdcall
|
||||
p586N
|
||||
locals
|
||||
jumps
|
||||
codeseg
|
||||
option procalign:byte
|
||||
|
||||
include "..\include\mem.h"
|
||||
include "..\include\divers.h"
|
||||
include "..\include\cpu.h"
|
||||
include "..\include\pci.h"
|
||||
include "..\include\fat.h"
|
||||
|
||||
memorystart equ 0052h ;premier bloc de la mémoire
|
||||
|
||||
org 0h
|
||||
|
||||
mb0:
|
||||
header exe <"CE",1,0,0,offset exports,offset imports,offset section,offset start>
|
||||
|
||||
start:
|
||||
push cs
|
||||
push cs
|
||||
push cs
|
||||
push cs
|
||||
pop ds
|
||||
pop es
|
||||
pop fs
|
||||
pop gs
|
||||
call biosprint,offset return
|
||||
call biosprint,offset msg_memory
|
||||
call biosprint,offset return
|
||||
call biosprint,offset msg_memory_init
|
||||
call mbinit
|
||||
jc error
|
||||
call biosprint,offset msg_ok
|
||||
call biosprint,offset msg_memory_section
|
||||
mov ax,cs
|
||||
call mbloadsection,ax
|
||||
jc error
|
||||
call biosprint,offset msg_ok
|
||||
call biosprint,offset msg_memory_jumps
|
||||
jmp [dword ptr cs:pointer]
|
||||
pointer:
|
||||
dw suite
|
||||
dw memorystart
|
||||
suite:
|
||||
push cs
|
||||
push cs
|
||||
push cs
|
||||
push cs
|
||||
pop ds
|
||||
pop es
|
||||
pop fs
|
||||
pop gs
|
||||
call biosprint,offset msg_ok
|
||||
call biosprint,offset msg_video_init
|
||||
call [cs:setvideomode],2
|
||||
jc error
|
||||
call [cs:clearscreen]
|
||||
call [cs:print],offset msg_memory
|
||||
call [cs:print],offset msg_ok2
|
||||
call [cs:print],offset msg_memory_init
|
||||
call [cs:print],offset msg_ok2
|
||||
call [cs:print],offset msg_memory_section
|
||||
call [cs:print],offset msg_ok2
|
||||
call [cs:print],offset msg_memory_jumps
|
||||
call [cs:print],offset msg_ok2
|
||||
call [cs:print],offset msg_video_init
|
||||
call [cs:print],offset msg_ok2
|
||||
call [cs:print],offset msg_handler
|
||||
;call installirqhandler
|
||||
call [cs:print],offset msg_ok2
|
||||
call [cs:print],offset msg_cpu_detect
|
||||
call [cs:cpuinfo],offset thecpu
|
||||
call [cs:setinfo],offset thecpu,offset temp
|
||||
call [cs:print],offset msg_ok2
|
||||
push offset temp
|
||||
xor eax,eax
|
||||
mov al,[thecpu.family]
|
||||
push eax
|
||||
mov al,[thecpu.models]
|
||||
push eax
|
||||
mov al,[thecpu.stepping]
|
||||
push eax
|
||||
push offset thecpu.names
|
||||
push offset thecpu.vendor
|
||||
call [cs:print],offset msg_cpu_detect_inf
|
||||
call [cs:print],offset msg_pci
|
||||
call [cs:pciinfo],offset thepci
|
||||
jc nopci
|
||||
call [cs:print],offset msg_ok2
|
||||
xor eax,eax
|
||||
mov al,[thepci.maxbus]
|
||||
push eax
|
||||
mov al,[thepci.version_minor]
|
||||
push eax
|
||||
mov al,[thepci.version_major]
|
||||
push eax
|
||||
call [cs:print],offset msg_pci_info
|
||||
call [cs:print],offset msg_pci_enum
|
||||
xor bx,bx
|
||||
xor cx,cx
|
||||
xor si,si
|
||||
searchpci:
|
||||
call [cs:getcardinfo],bx,cx,si,offset temp
|
||||
jc stopthis
|
||||
mov al,[(pcidata offset temp).subclass]
|
||||
push ax
|
||||
mov al,[(pcidata offset temp).class]
|
||||
push ax
|
||||
call [cs:getpcisubclass]
|
||||
push dx
|
||||
push ax
|
||||
mov al,[(pcidata offset temp).class]
|
||||
xor ah,ah
|
||||
push ax
|
||||
call [cs:getpciclass]
|
||||
push dx
|
||||
push ax
|
||||
push 4
|
||||
push esi
|
||||
push 4
|
||||
push ecx
|
||||
push 4
|
||||
push ebx
|
||||
mov ax,[(pcidata offset temp).device]
|
||||
push eax
|
||||
mov ax,[(pcidata offset temp).vendor]
|
||||
push eax
|
||||
call [cs:print],offset msg_pci_card
|
||||
inc si
|
||||
cmp si,7
|
||||
jbe searchpci
|
||||
stopthis:
|
||||
xor si,si
|
||||
inc cx
|
||||
cmp cx,31
|
||||
jbe searchpci
|
||||
xor cx,cx
|
||||
inc bx
|
||||
cmp bx,16
|
||||
jbe searchpci
|
||||
jmp next
|
||||
nopci:
|
||||
call [cs:print],offset msg_echec2
|
||||
next:
|
||||
call [cs:detectvmware]
|
||||
jne novirtual
|
||||
call [cs:print],offset msg_vmware
|
||||
novirtual:
|
||||
call [cs:print],offset msg_flat
|
||||
call enablea20
|
||||
call flatmode
|
||||
xor ax,ax
|
||||
mov fs,ax
|
||||
mov esi,0100000h
|
||||
mov [dword ptr fs:esi],"OKIN"
|
||||
call [cs:print],offset msg_ok2
|
||||
call [cs:print],offset msg_disk_init
|
||||
call [cs:initdrive]
|
||||
jc error2
|
||||
call [cs:print],offset msg_ok2
|
||||
call [cs:execfile],offset shell
|
||||
|
||||
error2:
|
||||
call [cs:print],offset msg_error2
|
||||
call bioswaitkey
|
||||
jmp far 0FFFFh:0000h
|
||||
|
||||
error:
|
||||
call biosprint,offset msg_error
|
||||
call bioswaitkey
|
||||
jmp far 0FFFFh:0000h
|
||||
|
||||
shell find <"COMMANDE.CE",0,0,0,1,>
|
||||
thepci pciinf <>
|
||||
thecpu cpu <>
|
||||
temp db 256 dup (0)
|
||||
return db 0dh,0ah,0
|
||||
msg_memory db "Initialisation de la memoire",0
|
||||
msg_memory_init db " -Creation du bloc primordial",0
|
||||
msg_memory_section db " -Developpement des sections",0
|
||||
msg_memory_jumps db "Redirection du systeme",0
|
||||
msg_video_init db "Initialisation du pilote VIDEO",0
|
||||
msg_handler db "Initialisation du gestionnaire d'interruption",0
|
||||
msg_cpu_detect db "Dectection du processeur",0
|
||||
msg_cpu_detect_inf db " -Fondeur : %0\l -Modele : %0\l -Revision : %u\l -Version : %u\l -Famille : %u\l -Technologies: %0\l",0
|
||||
msg_pci db "Detection des systemes PCI",0
|
||||
msg_pci_info db " -Version : %yB.%yB\l -Numero bus max: %u\l",0
|
||||
msg_pci_enum db " -Enumeration des peripheriques PCI:\l"
|
||||
db " |Vendeur|Modele|Bus |Dev.|Func|Classe.Sous-classe\l",0
|
||||
msg_pci_card db " | %hW | %hW |%w|%w|%w|%0P.%0P\l",0
|
||||
msg_vmware db "\c04 VMWare a ete detecte !!!\c07\l",0
|
||||
msg_flat db "Initialisation du Flat Real Mode\l",0
|
||||
msg_disk_init db "Initialisation du pilote DISQUE\l",0
|
||||
|
||||
|
||||
msg_error db " [Erreur]",0dh,0ah,"<Pressez une touche pour redemarrer le systeme>",0
|
||||
msg_ok db " [ Ok ]",0dh,0ah,0
|
||||
msg_error2 db "\h70 [\c04Erreur\c07]\g00,49<Pressez une touche pour redemarrer le systeme>",0
|
||||
msg_ok2 db "\h70 [\c02 Ok \c07]\l",0
|
||||
msg_echec2 db "\h70 [\c0CPasser\c07]\l",0
|
||||
|
||||
|
||||
exporting
|
||||
declare biosprinth
|
||||
declare biosprint
|
||||
declare mbinit
|
||||
declare mbcreate
|
||||
declare mbfree
|
||||
declare mbclean
|
||||
declare mbresident
|
||||
declare mbnonresident
|
||||
declare mbchown
|
||||
declare mballoc
|
||||
declare mbfind
|
||||
declare mbfindsb
|
||||
declare mbget
|
||||
declare mbloadfuncs
|
||||
declare mbsearchfunc
|
||||
declare bioswaitkey
|
||||
declare mbloadsection
|
||||
declare enableirq
|
||||
declare enableirq
|
||||
declare readimr
|
||||
declare readirr
|
||||
declare readisr
|
||||
declare seteoi
|
||||
declare enablea20
|
||||
declare disablea20
|
||||
declare flatmode
|
||||
declare installirqhandler
|
||||
declare irqhandler
|
||||
declare isenableirq
|
||||
declare isrequestirq
|
||||
declare isinserviceirq
|
||||
declare savecontext
|
||||
declare restorecontextg
|
||||
ende
|
||||
|
||||
|
||||
importing
|
||||
use VIDEO,setvideomode
|
||||
use VIDEO,clearscreen
|
||||
use VIDEO.LIB,print
|
||||
use DETECT.LIB,cpuinfo
|
||||
use DETECT.LIB,setinfo
|
||||
use DETECT.LIB,pciinfo
|
||||
use DETECT.LIB,getcardinfo
|
||||
use DETECT.LIB,getpcisubclass
|
||||
use DETECT.LIB,getpciclass
|
||||
use DETECT.LIB,detectvmware
|
||||
use DISQUE,initdrive
|
||||
use DISQUE,projfile
|
||||
use DISQUE,execfile
|
||||
endi
|
||||
|
||||
include "mcb.asm"
|
||||
include "8259a.asm"
|
||||
|
||||
section:
|
||||
dw offset mb0
|
||||
dw offset mb1-offset mb0
|
||||
db "SYSTEME",0
|
||||
|
||||
dw offset mb1
|
||||
dw offset mb2-offset mb1
|
||||
db "VIDEO",0
|
||||
|
||||
dw offset mb2
|
||||
dw offset mb3-offset mb2
|
||||
db "VIDEO.LIB",0
|
||||
|
||||
dw offset mb3
|
||||
dw offset mb4-offset mb3
|
||||
db "DETECT.LIB",0
|
||||
|
||||
dw offset mb4
|
||||
dw offset mb5-offset mb4
|
||||
db "DISQUE",0
|
||||
|
||||
dd 0
|
||||
|
||||
mb1:
|
||||
includebin "video.sys"
|
||||
mb2:
|
||||
includebin "..\lib\video.lib"
|
||||
mb3:
|
||||
includebin "..\lib\detect.lib"
|
||||
mb4:
|
||||
includebin "disque.sys"
|
||||
mb5:
|
||||
|
||||
|
||||
|
||||
|
9
noyau/systeme.ini
Normal file
9
noyau/systeme.ini
Normal file
@ -0,0 +1,9 @@
|
||||
mcb.sys(49)
|
||||
video.sys(47)
|
||||
horloge.sys(8)
|
||||
8259a.sys(50)
|
||||
disque.sys(48)
|
||||
souris.sys(74)
|
||||
heure.sys(8)
|
||||
clavier.sys(9)
|
||||
port.sys(D)
|
1352
noyau/video.asm
Normal file
1352
noyau/video.asm
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user