fix: correction des structures et entêtes

This commit is contained in:
Nicolas Hordé 2019-07-14 12:47:14 +02:00
parent 26b8139657
commit dc0184f27d
29 changed files with 94 additions and 146 deletions

View File

@ -39,6 +39,9 @@ struc entries
.filesize dd 0
.sizeof = $ - .filename
}
virtual at 0
entries entries
end virtual
;Pour recherches
struc find files

View File

@ -25,12 +25,18 @@ struc regs
;.sst6 dt 0
;.sst7 dt 0
}
virtual at 0
regs regs
end virtual
struc tuple off,seg
{
.off dw 0 ;adresse
.seg dw 0 ;segment
}
virtual at 0
tuple tuple ?,?
end virtual
struc vector off,seg
{
@ -40,6 +46,9 @@ virtual at .data
.sizeof = $ - .data
end virtual
}
virtual at 0
vector vector ?,?
end virtual
struc ints;bloc interruption
{
@ -60,6 +69,9 @@ struc ints ;bloc interruption
.vector8 vector ?
.sizeof = $ - .number
}
virtual at 0
ints ints
end virtual
struc mb asize,aname ;Bloc de mémoire
{
@ -76,18 +88,21 @@ virtual at 0
mb mb ?,?
end virtual
struc exe major
struc exe major,exports,imports,sections,starting
;Executable COS
{
.checks db "CE" ;signature de l'exe
.major db 1 ;N° version
.checksum dd 0 ;Checksum de l'exe
.compressed db 0 ;a 1 si compressé par RLE
.exports dw 0 ;importation de fonctions
.imports dw 0 ;exportation de fonctions
.sections dw 0 ;sections des blocs mémoire
.starting dw 15
.exports dw exports ;importation de fonctions
.imports dw imports ;exportation de fonctions
.sections dw sections ;sections des blocs mémoire
.starting dw starting
}
virtual at 0
exe exe ?,?,?,?,?
end virtual
struc descriptor limit_low,base_low,base_middle,dpltype,limit_high,base_high
{
@ -99,6 +114,9 @@ struc descriptor limit_low,base_low,base_middle,dpltype,limit_high,base_high
.base_high db 0
.sizeof = $ - .limit_low
}
virtual at 0
descriptor descriptor ?,?,?,?,?,?
end virtual
free equ 0 ;Reference quand libre
@ -163,9 +181,6 @@ macro stdcall proc,[arg] ; directly call STDCALL procedure
end if
push cs
call proc
if size@ccall
add sp,size@ccall
end if
}
macro invoke proc,[arg] ; directly call STDCALL procedure
@ -178,11 +193,7 @@ macro invoke proc,[arg] ; directly call STDCALL procedure
size@ccall = size@ccall+2
common
end if
call far [cs:proc]
if size@ccall
add sp,size@ccall
end if
}
call far [cs:proc] }
macro proc [args] ; define procedure
{ common
@ -208,7 +219,7 @@ macro epiloguedef procname,flag,parmbytes,localbytes,reglist
if parmbytes | localbytes
leave
end if
retf }
retf parmbytes }
macro define@proc name,statement
{ local params,flag,regs,parmbytes,localbytes,current

View File

@ -7,7 +7,7 @@ include "..\include\3d.h"
org 0h
header exe 1
header exe 1,exports,imports,0,0
exporting
declare draw3d_point

View File

@ -7,8 +7,7 @@ include "..\include\bmp.h"
org 0h
start:
header exe 1
header exe 1,exports,imports,0,0
exporting
declare showbmp

View File

@ -7,7 +7,7 @@ include "..\include\pci.h"
org 0h
header exe 1
header exe 1,exports,0,0,0
exporting
declare cpuinfo

View File

@ -6,7 +6,7 @@ include "..\include\graphic.h"
org 0h
header exe 1
header exe 1,exports,imports,0,0
exporting
declare hline

View File

@ -6,8 +6,7 @@ include "..\include\divers.h"
org 0h
start:
header exe 1
header exe 1,exports,0,0,0
waitkey:
mov ax,0

View File

@ -5,7 +5,7 @@ include "..\include\mem.h"
org 0h
header exe 1
header exe 1,exports,0,0,0
exporting
declare random

View File

@ -6,7 +6,7 @@ include "..\include\divers.h"
org 0h
header exe 1
header exe 1,exports,0,0,0
exporting

View File

@ -5,7 +5,7 @@ include "..\include\mem.h"
org 0h
header exe 1
header exe 1,exports,imports,0,0
exporting
declare print

View File

@ -2,7 +2,7 @@ all: boot/boot12.bin lib/3d.lib noyau/systeme.sys programs/commande.ce
sync
install:
(sudo apt-get install fasm qemu fusefat cgdb)
(sudo apt-get install fasm qemu fusefat gdb)
clean:
make -C final clean

View File

@ -186,10 +186,7 @@ endp
proc installirqhandler uses eax bx cx edx si di ds es
push fs
virtual at 0
.intsori ints
end virtual
stdcall mbcreate,interruptionbloc,256*.intsori.sizeof
stdcall mbcreate,interruptionbloc,256*ints.sizeof
mov es,ax
mov ax,0x0000
mov ds,ax
@ -198,14 +195,11 @@ proc installirqhandler uses eax bx cx edx si di ds es
virtual at si
.vector vector
end virtual
virtual at 0
.vectorori vector
end virtual
mov fs,[.vector.data.seg]
mov bx,[.vector.data.off]
cmp byte [fs:bx],0xCF ;iret
je .founded
add si,.vectorori.sizeof
add si,vector.sizeof
cmp si,256*4
jb .searchdummypointer
xor edx,edx
@ -250,8 +244,8 @@ proc installirqhandler uses eax bx cx edx si di ds es
add bx,coupling
mov [.vector.data.seg],cs
mov [.vector.data.off],bx
add si,.vectorori.sizeof
add di,.intsori.sizeof
add si,vector.sizeof
add di,ints.sizeof
inc cl
cmp cl,0
jne .copy
@ -366,10 +360,7 @@ jc .end
mov es,ax
mov ax,[int]
sub ax,256
virtual at 0
.intsorig ints
end virtual
mov cx,.intsorig.sizeof
mov cx,ints.sizeof
mul cx
mov si,ax
virtual at si
@ -387,9 +378,6 @@ mov cl,8
virtual at si
.vector vector
end virtual
virtual at 0
.vectorori vector
end virtual
cmp [es:.vector.content],0
je .end
push word [cs:calling_reg.seflags]
@ -405,7 +393,7 @@ cli
stdcall savecontext,calling_reg
stdcall restorecontextg,function_reg
.next:
add si,.vectorori.sizeof
add si,vector.sizeof
dec cl
jnz .launchall
.end:

View File

@ -3,7 +3,7 @@ include "..\include\fat.h"
org 0h
header exe 1
header exe 1,exports,imports,0,0
exporting
@ -168,10 +168,7 @@ proc execfile, file:word
push cs
push .arrive
push ds
virtual at 0
.exe exe
end virtual
push word [.exe.starting]
push word [exe.starting]
push ds
push ds
push ds
@ -579,10 +576,7 @@ proc findnextfile uses ax bx cx di si ds es, pointer:word
.findnextfileagain:
cmp [es:.find.firstsearch],1
je .first
virtual at 0
.entries2 entries
end virtual
add bx,.entries2.sizeof
add bx,entries.sizeof
cmp bx,[cs:clustersize]
jb .nopop
.first:
@ -635,7 +629,7 @@ proc findnextfile uses ax bx cx di si ds es, pointer:word
.find2 find
end virtual
lea di,[es:.find2.result]
mov cx,.entries2.sizeof
mov cx,entries.sizeof
cld
rep movsb
clc

View File

@ -98,10 +98,7 @@ proc flatmode uses eax bx ds
add dword [.gdt+2],eax ; store as GDT linear base addr
; now load the GDT into the GDTR
lgdt fword [.gdt] ; load GDT base
virtual at 0
.descriptor descriptor
end virtual
mov bx,1 * .descriptor.sizeof ; point to first descriptor
mov bx,1 * descriptor.sizeof ; point to first descriptor
cli ; turn off interrupts
mov eax,cr0 ; prepare to enter protected mode
or al,1 ; flip the PE bit
@ -138,14 +135,11 @@ proc mbloadsection uses ax bx cx si di ds es, blocks:word
mov ax,[blocks]
mov es,ax
mov ds,ax
cmp word [0],"EC"
cmp word [0],"CE"
jne .notace
lea si,[toresov]
mov word [ss:si],0FFFFh
virtual at 0
.exe exe
end virtual
mov bx,[ds:.exe.sections]
mov bx,[ds:exe.sections]
cmp bx,0
je .finishloading
.loading:
@ -229,7 +223,7 @@ proc mbcreate uses bx cx dx si di ds es, blocks:word, size:word
dec dx
dec dx
mov gs,dx
cmp word [gs:0x0],'NH'
cmp word [gs:0x0],'HN'
je .oktoset
mov ax,memorystart
.oktoset:
@ -245,7 +239,7 @@ proc mbcreate uses bx cx dx si di ds es, blocks:word, size:word
cmp dl,false
je .notenougtmem
mov es,bx
cmp word [es:mb.check],"NH"
cmp word [es:mb.check],"HN"
jne .memoryerror
cmp [es:mb.isnotlast],true
sete dl
@ -254,7 +248,7 @@ proc mbcreate uses bx cx dx si di ds es, blocks:word, size:word
mov ax,[es:mb.sizes]
cmp cx,ax
ja .notsogood
mov word [es:mb.check],"NH"
mov word [es:mb.check],"HN"
mov [es:mb.isnotlast],true
mov [es:mb.reference],gs
mov [es:mb.isresident],false
@ -311,7 +305,7 @@ proc mbfree uses ax bx cx si di ds es, blocks:word
dec bx
dec bx
mov es,bx
cmp word [es:mb.check],"NH"
cmp word [es:mb.check],"HN"
jne .memoryerror
cmp [es:mb.reference],free
je .wasfree
@ -330,7 +324,7 @@ proc mbfree uses ax bx cx si di ds es, blocks:word
dec bx
.searchtofree:
mov es,bx
cmp word [es:mb.check],"NH"
cmp word [es:mb.check],"HN"
jne .memoryerror
inc bx
inc bx
@ -373,7 +367,7 @@ proc mbclean uses ax bx dx es gs
xor dx,dx
.searchfree:
mov gs,bx
cmp word [gs:mb.check],"NH"
cmp word [gs:mb.check],"HN"
jne .memoryerror
inc bx
inc bx
@ -425,7 +419,7 @@ proc mbresident uses bx es, blocks:word
dec bx
dec bx
mov es,bx
cmp word [es:mb.check],"NH"
cmp word [es:mb.check],"HN"
jne .memoryerror
mov [es:mb.isresident],true
ret
@ -440,7 +434,7 @@ proc mbnonresident uses bx es, blocks:word
dec bx
dec bx
mov es,bx
cmp word [es:mb.check],"NH"
cmp word [es:mb.check],"HN"
jne .memoryerror
mov [es:mb.isresident],false
ret
@ -456,7 +450,7 @@ proc mbchown uses bx dx es,blocks:word, owner:word
dec bx
dec bx
mov es,bx
cmp word [es:mb.check],"NH"
cmp word [es:mb.check],"HN"
jne .memoryerror
cmp [es:mb.reference],free
je .wasfree
@ -490,7 +484,7 @@ proc mbget uses bx dx es, num:word
xor dx,dx
.searchfree:
mov es,bx
cmp word [es:mb.check],"NH"
cmp word [es:mb.check],"HN"
jne .memoryerror
inc bx
inc bx
@ -526,7 +520,7 @@ proc mbfind uses bx si di es, blocks:word
.search:
mov es,bx
lea di,[es:mb.names]
cmp word [es:mb.check],"NH"
cmp word [es:mb.check],"HN"
jne .memoryerror
inc bx
inc bx
@ -573,7 +567,7 @@ proc mbfindsb uses bx dx si di es, blocks:word, owner:word
mov dx,[owner]
.search:
mov es,bx
cmp word [es:mb.check],"NH"
cmp word [es:mb.check],"HN"
jne .memoryerror
inc bx
inc bx
@ -615,12 +609,9 @@ endp
;Resouds les dépendances du bloc de mémoire %0
proc mbloadfuncs uses ax bx cx dx si ds, blocks:word
mov ds,[blocks]
cmp word [0],"EC"
cmp word [0],"CE"
jne .notace
virtual at 0
.exe exe
end virtual
mov si,[ds:.exe.imports]
mov si,[ds:exe.imports]
cmp si,0
je .endofloading
.loadfuncs:
@ -677,9 +668,6 @@ proc mbsearchfunc uses bx si di es, func:word
mov bx,[func]
mov si,bx
.findend:
virtual at 0
.exe exe
end virtual
inc bx
cmp byte [bx], ':'
jne .findend
@ -688,9 +676,9 @@ proc mbsearchfunc uses bx si di es, func:word
mov byte [bx],':'
jc .notfoundattallthesb
mov es,ax
cmp word [es:.exe.checks],"EC"
cmp word [es:exe.checks],"CE"
jne .notfoundattallthesb
mov di,[es:.exe.exports]
mov di,[es:exe.exports]
inc bx
inc bx
.functions:

View File

@ -12,7 +12,7 @@ memorystart equ 0052h ;premier bloc de la m
org 0h
mb0:
header exe 1
header exe 1,0,imports,allsection,start
start:
push cs

View File

@ -6,7 +6,7 @@ include "..\include\graphic.h"
org 0h
header exe 1
header exe 1,exports,imports,0,0
exporting
declare setvideomode

View File

@ -9,8 +9,7 @@ include "..\include\cpu.h"
org 0h
start:
header exe 1
header exe 1,0,imports,0,realstart
realstart:
invoke print, msginit
@ -509,33 +508,27 @@ suitelistmcb2:
invoke print
cmp word [fs:0x0],'EC'
jne endofdumpformoment
virtual at 0
.exe exe
end virtual
push dword [fs:.exe.starting]
push dword [fs:exe.starting]
push fs
push fs
push dword [fs:.exe.sections]
push dword [fs:exe.sections]
push fs
push fs
push dword [fs:.exe.imports]
push dword [fs:exe.imports]
push fs
push fs
push dword [fs:.exe.exports]
push dword [fs:exe.exports]
push fs
push fs
cmp [fs:.exe.compressed],true
cmp [fs:exe.compressed],true
jne notcompressed
push oui
jmp suiteiscompressed
notcompressed:
push non
suiteiscompressed:
virtual at 0
.exe exe
end virtual
push dword [fs:.exe.checksum]
push dword [fs:.exe.major]
push dword [fs:exe.checksum]
push dword [fs:exe.major]
invoke print, dumpshowce
endofdumpformoment:
ret
@ -582,10 +575,7 @@ haveatargetsections:
mov fs,ax
cmp word [fs:0x0],'EC'
jne errornotace2
virtual at 0
.exe exe
end virtual
mov si,[fs:.exe.sections]
mov si,[fs:exe.sections]
cmp si,0
je errornosections
xor edx,edx
@ -632,10 +622,7 @@ haveatargetexports:
mov fs,ax
cmp word [fs:0x0],'EC'
jne errornotace2
virtual at 0
.exe exe
end virtual
mov si,[fs:.exe.exports]
mov si,[fs:exe.exports]
cmp si,0
je errornoexports
xor edx,edx
@ -682,10 +669,7 @@ haveatargetimports:
mov fs,ax
cmp word [fs:0x0],'EC'
jne errornotace2
virtual at 0
.exe exe
end virtual
mov si,[fs:.exe.imports]
mov si,[fs:exe.imports]
cmp si,0
je errornoimports
xor edx,edx
@ -818,10 +802,7 @@ xor ebx,ebx
intoirq:
xor eax,eax
mov al,[bx+ irqmap]
virtual at 0
.intsori ints
end virtual
mov dx,.intsori.sizeof
mov dx,ints.sizeof
mul dx
mov si,ax
virtual at si
@ -902,10 +883,7 @@ mov es,ax
invoke gettypeditem,di,0,' '
xor edi,edi
mov di,ax
virtual at 0
.intsori ints
end virtual
mov cx,.intsori.sizeof
mov cx,ints.sizeof
mul cx
mov si,ax
virtual at si

View File

@ -7,8 +7,7 @@ include "..\include\graphic.h"
org 0h
start:
header exe 1
header exe 1,0,imports,0,realstart
realstart:
mov ax,0305h

View File

@ -6,8 +6,7 @@ include "..\include\divers.h"
org 0h
start:
header exe 1
header exe 1,0,imports,0,realstart
realstart:
invoke print,message

View File

@ -8,8 +8,7 @@ include "..\include\graphic.h"
org 0h
start:
header exe 1
header exe 1,0,imports,0,realstart
realstart:
invoke saveparamto, infos

View File

@ -6,8 +6,7 @@ include "..\include\divers.h"
org 0h
start:
header exe 1
header exe 1,0,0,0,realstart
realstart:
retf

View File

@ -6,8 +6,7 @@ include "..\include\divers.h"
org 0h
start:
header exe 1
header exe 1,0,imports,0,realstart
realstart:
invoke mballoc,65535

View File

@ -6,8 +6,7 @@ include "..\include\divers.h"
org 0h
start:
header exe 1
header exe 1,0,0,0,realstart
realstart:
mov eax,cr0

View File

@ -6,8 +6,7 @@ include "..\include\divers.h"
org 0h
start:
header exe 1
header exe 1,0,imports,0,realstart
realstart:
invoke mouseon

View File

@ -6,8 +6,7 @@ include "..\include\divers.h"
org 0h
start:
header exe 1
header exe 1,0,imports,0,realstart
realstart:
invoke randomize

View File

@ -8,8 +8,7 @@ include "..\include\3d.h"
org 0h
start:
header exe 1
header exe 1,0,imports,0,realstart
realstart:
invoke randomize

View File

@ -8,8 +8,7 @@ include "..\include\3d.h"
org 0h
start:
header exe 1
header exe 1,0,imports,0,realstart
alldata:
camera vertex3d 320.0,240.0,70.0

View File

@ -6,8 +6,7 @@ include "..\include\divers.h"
org 0h
start:
header exe 1
header exe 1,0,imports,0,realstart
realstart:
invoke savestate

View File

@ -7,8 +7,7 @@ include "..\include\graphic.h"
org 0h
start:
header exe 1
header exe 1,0,imports,0,realstart
realstart:
mov ax,0305h