refactor: mise à jour vers fasm

This commit is contained in:
Nicolas Hordé 2019-07-09 18:30:00 +02:00
parent a9cba3a71a
commit 53b445a652
40 changed files with 3222 additions and 4361 deletions

Binary file not shown.

View File

@ -2,6 +2,7 @@ ASM=fasm
CLEAN=rm -rf CLEAN=rm -rf
all: boot12.bin all: boot12.bin
sync
boot12.bin: boot12.asm boot12.bin: boot12.asm
$(ASM) $< $(ASM) $<

View File

@ -1,32 +1,37 @@
struc vertex3d struc vertex3d tx,ty,tz
tx dd ? {
ty dd ? .tx dd ?
tz dd ? .ty dd ?
ends vertex3d .tz dd ?
.sizeof = $ - .tx
struc mat }
p1 dd ?
p2 dd ? struc mat
p3 dd ? {
p4 dd ? .p1 dd ?
p5 dd ? .p2 dd ?
p6 dd ? .p3 dd ?
p7 dd ? .p4 dd ?
p8 dd ? .p5 dd ?
p9 dd ? .p6 dd ?
p10 dd ? .p7 dd ?
p11 dd ? .p8 dd ?
p12 dd ? .p9 dd ?
p13 dd ? .p10 dd ?
p14 dd ? .p11 dd ?
p15 dd ? .p12 dd ?
p16 dd ? .p13 dd ?
ends mat .p14 dd ?
.p15 dd ?
main equ 4D4Dh .p16 dd ?
edit equ 3D3Dh .sizeof = $ - .p1
object equ 4000h }
mesh equ 4100h
vertex equ 4110h main equ 4D4Dh
face equ 4120h edit equ 3D3Dh
locale equ 4160h object equ 4000h
mesh equ 4100h
vertex equ 4110h
face equ 4120h
locale equ 4160h

View File

@ -1,39 +1,41 @@
struc bmp_file struc bmp_file
bmp_filetype db 'bm' {
bmp_filesize dd ? ; taille du fichier .bmp_filetype db 'bm'
bmp_reserved dd 0 ; toujours 0 .bmp_filesize dd ? ; taille du fichier
bmp_bitmapoffset dd ? ; offset de l'image .bmp_reserved dd 0 ; toujours 0
bmp_headersize dd ? ; taille de l'entete en octects .bmp_bitmapoffset dd ? ; offset de l'image
bmp_width dd ? ; largeur en pixels de l'image .bmp_headersize dd ? ; taille de l'entete en octects
bmp_height dd ? ; hauteur en pixels de l'image .bmp_width dd ? ; largeur en pixels de l'image
bmp_planes dw 1 ; nombre de plan utilisés .bmp_height dd ? ; hauteur en pixels de l'image
bmp_bitsperpixel dw ? ; nombre de bits par pixels .bmp_planes dw 1 ; nombre de plan utilisés
bmp_compression dd ? ; méthode de compression .bmp_bitsperpixel dw ? ; nombre de bits par pixels
bmp_sizeofbitmap dd ? ; taille de l'image en octects .bmp_compression dd ? ; méthode de compression
bmp_horzresolution dd ? ; resolution horizontale en pixels par mètre .bmp_sizeofbitmap dd ? ; taille de l'image en octects
bmp_vertresolution dd ? ; resolution verticale en pixels par mètre .bmp_horzresolution dd ? ; resolution horizontale en pixels par mètre
bmp_colorsused dd ? ; nombre de couleur dans la palette si 0: palette entière si bitperpixel<=8 .bmp_vertresolution dd ? ; resolution verticale en pixels par mètre
bmp_colorsimportant dd ? ; nombre de couleurs importantes masques pour les modes de plus de 8 bits par pixels .bmp_colorsused dd ? ; nombre de couleur dans la palette si 0: palette entière si bitperpixel<=8
bmp_redmask dd ? .bmp_colorsimportant dd ? ; nombre de couleurs importantes masques pour les modes de plus de 8 bits par pixels
bmp_greenmask dd ? .bmp_redmask dd ?
bmp_bluemask dd ? .bmp_greenmask dd ?
bmp_alphamask dd ? .bmp_bluemask dd ?
bmp_colorspacetype dd ? .bmp_alphamask dd ?
bmp_redx dd ? .bmp_colorspacetype dd ?
bmp_redy dd ? .bmp_redx dd ?
bmp_redz dd ? .bmp_redy dd ?
bmp_greenx dd ? .bmp_redz dd ?
bmp_greeny dd ? .bmp_greenx dd ?
bmp_greenz dd ? .bmp_greeny dd ?
bmp_bluex dd ? .bmp_greenz dd ?
bmp_bluey dd ? .bmp_bluex dd ?
bmp_bluez dd ? .bmp_bluey dd ?
bmp_gammared dd ? .bmp_bluez dd ?
bmp_gammagreen dd ? .bmp_gammared dd ?
bmp_gammeblue dd ? .bmp_gammagreen dd ?
ends bmp_file .bmp_gammeblue dd ?
.sizeof = $ - .bmp_filetype
}
;bmp_compression peut prendre les valeurs suivantes: ;.bmp_compression peut prendre les valeurs suivantes:
bmp_comp_uncomp equ 0 ; pas de compression bmp_comp_uncomp equ 0 ; pas de compression
bmp_comp_rle8 equ 1 ; 8-bit run length encoding bmp_comp_rle8 equ 1 ; 8-bit run length encoding
bmp_comp_rle4 equ 2 ; 4-bit tun length encoding bmp_comp_rle4 equ 2 ; 4-bit tun length encoding

View File

@ -2,6 +2,7 @@ struc point
{ {
.coordx db 0 .coordx db 0
.coordy db 0 .coordy db 0
.sizeof = $ - .coordx
} }
struc vgainf struc vgainf
@ -33,4 +34,5 @@ struc vertex2d
{ {
.px dw ? .px dw ?
.py dw ? .py dw ?
.sizeof = $ - .px
} }

View File

@ -15,7 +15,7 @@ struc regs
.sfs dw 0 .sfs dw 0
.sgs dw 0 .sgs dw 0
.sss dw 0 .sss dw 0
;.seflags dd 0 .seflags dd 0
;.sst0 dt 0 ;.sst0 dt 0
;;sst1 dt 0 ;;sst1 dt 0
;.sst2 dt 0 ;.sst2 dt 0
@ -37,6 +37,7 @@ struc vector off,seg
.data tuple off,seg .data tuple off,seg
virtual at .data virtual at .data
.content dd 0 .content dd 0
.sizeof = $ - .data
end virtual end virtual
} }

2434
lib/3d.asm

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,3 @@
model tiny,stdcall
p586N
locals
jumps
codeseg
option procalign:byte
include "..\include\mem.h" include "..\include\mem.h"
include "..\include\divers.h" include "..\include\divers.h"
include "..\include\bmp.h" include "..\include\bmp.h"
@ -12,7 +5,7 @@ include "..\include\bmp.h"
org 0h org 0h
start: start:
header exe <"CE",1,0,0,offset exports,offset imports,,> header exe 1
exporting exporting
declare showbmp declare showbmp
@ -28,45 +21,46 @@ endi
;<- DS:%0 BMP, %1 coordonnées X, %2 coordonnées Y ;<- DS:%0 BMP, %1 coordonnées X, %2 coordonnées Y
;-> ;->
;========================== ;==========================
PROC showbmp FAR proc showbmp uses ax bx cx dx si di, pointer:word, x:word, y:word
ARG @pointer:word, @x:word, @y:word mov si,[pointer]
USES ax,bx,cx,dx,si,di virtual at si
mov si,[@pointer] .bmp_file bmp_file
cmp [word ptr (bmp_file si).bmp_filetype],"MB" end virtual
jne @@errorshowing cmp word [.bmp_file.bmp_filetype],"MB"
mov edi,[(bmp_file si).bmp_bitmapoffset] jne .errorshowing
mov edi,[.bmp_file.bmp_bitmapoffset]
add di,400h add di,400h
add di,si add di,si
xor ebx,ebx xor ebx,ebx
mov ecx,[(bmp_file si).bmp_height] mov ecx,[.bmp_file.bmp_height]
mov edx,[(bmp_file si).bmp_width] mov edx,[.bmp_file.bmp_width]
;and dx,11111100b ;and dx,11111100b
cmp edx,[(bmp_file si).bmp_width] cmp edx,[.bmp_file.bmp_width]
;jae @@noadjust ;jae .noadjust
;add dx,4 ;add dx,4
@@noadjust: .noadjust:
sub edx,[(bmp_file si).bmp_width] sub edx,[.bmp_file.bmp_width]
@@bouclette: .bouclette:
push bx cx push bx cx
add bx,[@x] add bx,[x]
add cx,[@y] add cx,[y]
call [cs:showpixel],bx,cx,[word ptr di] invoke showpixel,bx,cx,word [di]
pop cx bx pop cx bx
inc bx inc bx
inc di inc di
cmp ebx,[(bmp_file si).bmp_width] cmp ebx,[.bmp_file.bmp_width]
jb @@bouclette jb .bouclette
xor bx,bx xor bx,bx
;add di,dx ;add di,dx
dec cx dec cx
cmp cx,0 cmp cx,0
jne @@bouclette jne .bouclette
clc clc
ret ret
@@errorshowing: .errorshowing:
stc stc
ret ret
ENDP showbmp endp
;==========LOADBMPPALET========= ;==========LOADBMPPALET=========
@ -74,14 +68,12 @@ ENDP showbmp
;-> DS:%0 BMP ;-> DS:%0 BMP
;<- ;<-
;=============================== ;===============================
PROC loadbmppalet FAR proc loadbmppalet uses ax bx cx dx si, pointer:word
ARG @pointer:word mov si,[pointer]
USES ax,bx,cx,dx,si
mov si,[@pointer]
mov bx,0400h+36h-4 mov bx,0400h+36h-4
mov cx,100h mov cx,100h
mov dx, 3c8h mov dx, 3c8h
@@paletteload: .paletteload:
mov al, cl mov al, cl
dec al dec al
out dx, al out dx, al
@ -98,8 +90,8 @@ PROC loadbmppalet FAR
sub bx,4 sub bx,4
dec dx dec dx
dec cl dec cl
jnz @@paletteload jnz .paletteload
ret ret
ENDP loadbmppalet endp

View File

@ -1,230 +1,226 @@
model tiny,stdcall include "..\include\mem.h"
p586 include "..\include\graphic.h"
locals
jumps org 0h
codeseg
option procalign:byte header exe 1
include "..\include\mem.h" exporting
include "..\include\graphic.h" declare hline
declare line
org 0h declare polyfill
ende
header exe <"CE",1,0,0,offset exports,offset imports,,>
importing
exporting use VIDEO,showpixel
declare hline endi
declare line
declare polyfill proc hline uses cx dx, x1:word,x2:word,y:word,color:word
ende mov cx,[x1]
mov dx,[x2]
importing cmp cx,dx
use VIDEO,showpixel jbe .boucle
endi xchg cx,dx
.boucle:
PROC hline FAR invoke showpixel,cx,[y],[color]
ARG @x1:word,@x2:word,@y:word,@color:word inc cx
USES cx,dx cmp cx,dx
mov cx,[@x1] jbe .boucle
mov dx,[@x2] ret
cmp cx,dx endp
jbe @@boucle
xchg cx,dx ; affiche un pixel en %0 %1 couleur %2
@@boucle: proc line uses ax bx cx dx si di, x1:word,y1:word,x2:word,y2:word,color:word
call [cs:showpixel],cx,[@y],[@color] local deltax:WORD,deltay:WORD
inc cx mov ax,[x2]
cmp cx,dx sub ax,[x1]
jbe @@boucle call absolute
ret mov [deltax],ax
endp hline mov cx,ax
mov ax,[y2]
; affiche un pixel en %0 %1 couleur %2 sub ax,[y1]
PROC line FAR call absolute
ARG @x1:word,@y1:word,@x2:word,@y2:word,@color:word mov dx,ax
USES ax,bx,cx,dx,si,di mov [deltay],ax
LOCAL @@deltax:word,@@deltay:word mov ax,-1
mov ax,[@x2] mov bx,-1
sub ax,[@x1] mov si,[x1]
call absolute mov di,[y1]
mov [@@deltax],ax cmp si,[x2]
mov cx,ax jg .x1greater
mov ax,[@y2] mov ax,1
sub ax,[@y1] .x1greater:
call absolute cmp di,[y2]
mov dx,ax jg .y1greater
mov [@@deltay],ax mov bx,1
mov ax,-1 .y1greater:
mov bx,-1 cmp cx,dx
mov si,[@x1] jl .deltaxgreater
mov di,[@y1] mov dx,[deltax]
cmp si,[@x2] sar dx,1
jg @@x1greater xor cx,cx
mov ax,1 .boucle1:
@@x1greater: add si,ax
cmp di,[@y2] add dx,[deltay]
jg @@y1greater cmp dx,[deltax]
mov bx,1 jl .above1
@@y1greater: sub dx,[deltax]
cmp cx,dx add di,bx
jl @@deltaxgreater .above1:
mov dx,[@@deltax] invoke showpixel,si,di,[color]
sar dx,1 inc cx
xor cx,cx cmp cx,[deltax]
@@boucle1: jl .boucle1
add si,ax jmp .endofline
add dx,[@@deltay] .deltaxgreater:
cmp dx,[@@deltax] mov dx,[deltay]
jl @@above1 sar dx,1
sub dx,[@@deltax] xor cx,cx
add di,bx .boucle2:
@@above1: add di,bx
call [cs:showpixel],si,di,[@color] add dx,[deltax]
inc cx cmp dx,[deltay]
cmp cx,[@@deltax] jle .above2
jl @@boucle1 sub dx,[deltay]
jmp @@endofline add si,ax
@@deltaxgreater: .above2:
mov dx,[@@deltay] invoke showpixel,si,di,[color]
sar dx,1 inc cx
xor cx,cx cmp cx,[deltay]
@@boucle2: jl .boucle2
add di,bx .endofline:
add dx,[@@deltax] ret
cmp dx,[@@deltay] endp
jle @@above2
sub dx,[@@deltay] ;renvoie la valeur absolue de AX
add si,ax proc absolute
@@above2: cmp ax,0
call [cs:showpixel],si,di,[@color] jg .noabs
inc cx neg ax
cmp cx,[@@deltay] .noabs:
jl @@boucle2 ret
@@endofline: endp
ret
endp line ymax equ 200
;renvoie la valeur absolue de AX ; initialise un segment 2
PROC absolute NEAR proc polyfill uses eax ebx ecx edx si di es, pointer:word,nbfaces:word,color:word;
cmp ax,0 local startx[200]:WORD,endx[200]:WORD,pas:DWORD,miny:WORD,maxy:WORD
jg @@noabs mov di,bp
neg ax sub di,2
@@noabs: mov ax,16000
ret mov cx,(200+200)*2
endp absolute push ss
pop es
ymax equ 200 std
rep stosw
; initialise un segment 2 mov si,[pointer]
PROC polyfill FAR mov di,[pointer]
ARG @pointer:word,@nbfaces:word,@color:word; virtual at 0
LOCAL @@startx:word:200,@@endx:word:200,@@pas:dword,@@miny:word,@@maxy:word .vertex2d vertex2d
USES eax,ebx,ecx,edx,si,di,es end virtual
mov di,bp add di,.vertex2d.sizeof
sub di,2 mov [miny],ymax
mov ax,16000 mov [maxy],0
mov cx,(200+200)*2 mov cx,[nbfaces]
push ss dec cx
pop es .boucle:
std push si di cx
rep stosw virtual at si
mov si,[@pointer] .vertex2dsrc vertex2d
mov di,[@pointer] end virtual
add di,size vertex2d virtual at di
mov [@@miny],ymax .vertex2ddst vertex2d
mov [@@maxy],0 end virtual
mov cx,[@nbfaces] mov ax,[.vertex2ddst.py]
dec cx cmp ax,[.vertex2dsrc.py]
@@boucle: je .noexchange
push si di cx jge .nothingtodo
mov ax,[(vertex2d di).py] xchg si,di
cmp ax,[(vertex2d si).py] .nothingtodo:
je @@noexchange xor eax,eax
jge @@nothingtodo mov ax,[.vertex2dsrc.px]
xchg si,di cwde
@@nothingtodo: sal eax,8
xor eax,eax mov ebx,eax
mov ax,[(vertex2d si).px] xor eax,eax
cwde mov ax,[.vertex2ddst.px]
sal eax,8 sub ax,[.vertex2dsrc.px]
mov ebx,eax cwde
xor eax,eax sal eax,8
mov ax,[(vertex2d di).px] xor ecx,ecx
sub ax,[(vertex2d si).px] mov cx,[.vertex2ddst.py]
cwde sub cx,[.vertex2dsrc.py]
sal eax,8 cdq
xor ecx,ecx idiv ecx
mov cx,[(vertex2d di).py] mov [pas],eax
sub cx,[(vertex2d si).py] add ebx,eax
cdq mov dx,[.vertex2dsrc.py]
idiv ecx inc dx
mov [@@pas],eax cmp dx,[miny]
add ebx,eax jge .notinf
mov dx,[(vertex2d si).py] mov [miny],dx
inc dx .notinf:
cmp dx,[@@miny] mov ax,[.vertex2ddst.py]
jge @@notinf cmp ax,[maxy]
mov [@@miny],dx jle .boucle2
@@notinf: mov [maxy],ax
mov ax,[(vertex2d di).py] .boucle2:
cmp ax,[@@maxy] cmp dx,0
jle @@boucle2 jl .notgood
mov [@@maxy],ax cmp dx,ymax
@@boucle2: jge .notgood
cmp dx,0 mov si,dx
jl @@notgood shl si,1
cmp dx,ymax neg si
jge @@notgood cmp word [bp+si-2],16000
mov si,dx jne .notgoodforinf
shl si,1 mov eax,ebx
neg si sar eax,8
cmp [word ptr bp+si-2],16000 mov [bp+si-2],ax
jne @@notgoodforinf .notgoodforinf:
mov eax,ebx mov eax,ebx
sar eax,8 sar eax,8
mov [bp+si-2],ax mov [bp+si-200*2-2],ax
@@notgoodforinf: .notgood:
mov eax,ebx add ebx,[pas]
sar eax,8 inc dx
mov [bp+si-200*2-2],ax cmp dx,[.vertex2ddst.py]
@@notgood: jle .boucle2
add ebx,[@@pas] .noexchange:
inc dx pop cx di si
cmp dx,[(vertex2d di).py] add si,.vertex2d.sizeof
jle @@boucle2 add di,.vertex2d.sizeof
@@noexchange: dec cx
pop cx di si js .finished
add si,size vertex2d jnz .boucle
add di,size vertex2d mov di,[pointer]
dec cx mov cx,0FFFFh
js @@finished jmp .boucle
jnz @@boucle .finished:
mov di,[@pointer] cmp word [miny],0
mov cx,0FFFFh jae .noadj
jmp @@boucle mov [miny],0
@@finished: .noadj:
cmp [word ptr @@miny],0 cmp word [maxy],ymax
jae @@noadj jb .noadj2
mov [@@miny],0 mov [maxy],ymax-1
@@noadj: .noadj2:
cmp [word ptr @@maxy],ymax mov cx,[miny]
jb @@noadj2 .drawboucle:
mov [@@maxy],ymax-1 mov si,cx
@@noadj2: shl si,1
mov cx,[@@miny] neg si
@@drawboucle: mov ax,[bp+si-2]
mov si,cx mov bx,[bp+si-200*2-2]
shl si,1 cmp bx,16000
neg si jnz .noinfatall
mov ax,[bp+si-2] mov ax,bx
mov bx,[bp+si-200*2-2] .noinfatall:
cmp bx,16000 stdcall hline,ax,bx,cx,[color]
jnz @@noinfatall inc cx
mov ax,bx cmp cx,[maxy]
@@noinfatall: jna .drawboucle
call hline,ax,bx,cx,[@color] ret
inc cx endp
cmp cx,[@@maxy]
jna @@drawboucle
ret
endp polyfill

View File

@ -1,17 +1,10 @@
model tiny,stdcall
p586N
locals
jumps
codeseg
option procalign:byte
include "..\include\mem.h" include "..\include\mem.h"
include "..\include\divers.h" include "..\include\divers.h"
org 0h org 0h
start: start:
header exe <"CE",1,0,0,offset exports,,,> header exe 1
waitkey: waitkey:
mov ax,0 mov ax,0
@ -19,6 +12,5 @@ waitkey:
retf retf
exporting exporting
declare waitkey declare waitkey
ende ende

View File

@ -1,20 +1,14 @@
asm= lzasm /z/t ASM=fasm
lnk= elink CLEAN=rm -rf
OBJS= $(SRCS:.c=.o)
SRC= $(wildcard *.asm)
LIB= $(SRC:.asm=.lib)
all: detect.lib video.lib str0.lib bmp.lib graphic.lib 3d.lib math.lib all: $(LIB)
sync
.asm.obj: %.lib: %.asm
$(asm) $< $(ASM) $^ $@
.obj.lib:
$(lnk) $< $*.lib
clean: clean:
del *.obj $(CLEAN) *.lib
del *.ce
del *.bak
del *.lib
del *.com
del *.bin
del *.sys
del *.err

View File

@ -1,38 +0,0 @@
model tiny,stdcall
p586
locals
jumps
codeseg
option procalign:byte
include "..\include\mem.h"
org 0h
header exe <"CE",1,0,0,offset exports,,,>
exporting
declare random
declare randomize
ende
randseed dw 1234h
PROC random FAR
USES dx
mov ax,[cs:randseed]
mov dx,8405h
mul dx
inc ax
mov [cs:randseed],ax
mov ax,dx
ret
endp random
PROC randomize FAR
USES ax,cx,dx
mov ah,0
int 1ah
mov [cs:randseed],dx
ret
endp randomize

File diff suppressed because it is too large Load Diff

View File

@ -110,11 +110,11 @@ proc print pointer:word
add di,2 add di,2
jmp .strinaize0 jmp .strinaize0
.showmultchar: .showmultchar:
mov cx,[.pointer+di+2+2] mov cx,[pointer+di+2+2]
cmp cx,0 cmp cx,0
je .nextfunc je .nextfunc
.showcharsx: .showcharsx:
invoke showchars,word [.pointer+di+2],0FFFFh invoke showchars,word [pointer+di+2],0FFFFh
dec cx dec cx
jnz .showcharsx jnz .showcharsx
.nextfunc: .nextfunc:
@ -123,19 +123,19 @@ proc print pointer:word
jmp .strinaize0 jmp .strinaize0
.showint: .showint:
stdcall showint,dword [.pointer+di+2] stdcall showint,dword [pointer+di+2]
add si,2 add si,2
add di,4 add di,4
jmp .strinaize0 jmp .strinaize0
.showfixint: .showfixint:
stdcall showintl,word [.pointer+di+6],[dword ptr .pointer+di+2] stdcall showintl,word [pointer+di+6],dword [pointer+di+2]
add di,6 add di,6
add si,2 add si,2
jmp .strinaize0 jmp .strinaize0
.showintr: .showintr:
stdcall showintr,word [.pointer+di+6],dword [.pointer+di+2] stdcall showintr,word [pointer+di+6],dword [pointer+di+2]
add di,6 add di,6
add si,2 add si,2
jmp .strinaize0 jmp .strinaize0
@ -156,32 +156,32 @@ proc print pointer:word
jmp .strinaize0 jmp .strinaize0
.showstring: .showstring:
cmp [byte ptr si+2],'P' cmp byte [si+2],'P'
je .showstring.pointer je .showstring.pointer
stdcall showstring,[word ptr .pointer+di+2] stdcall showstring,word [pointer+di+2]
add si,2 add si,2
add di,2 add di,2
jmp .strinaize0 jmp .strinaize0
.showstring.pointer: .showstring.pointer:
push ds push ds
mov ds,[offset .pointer+di+2+2] mov ds,[pointer+di+2+2]
stdcall showstring,[word ptr .pointer+di+2] stdcall showstring,word [pointer+di+2]
add si,3 add si,3
add di,4 add di,4
pop ds pop ds
jmp .strinaize0 jmp .strinaize0
.showstring0: .showstring0:
cmp [byte ptr si+2],'P' cmp byte [si+2],'P'
je .showstring0.pointer je .showstring0.pointer
stdcall showstring0,[word ptr offset .pointer+di+2] stdcall showstring0,word [pointer+di+2]
add si,2 add si,2
add di,2 add di,2
jmp .strinaize0 jmp .strinaize0
.showstring0.pointer: .showstring0.pointer:
push ds push ds
mov ds,[offset .pointer+di+2+2] mov ds,[pointer+di+2+2]
stdcall showstring0,[word ptr offset .pointer+di+2] stdcall showstring0,word [pointer+di+2]
add si,3 add si,3
add di,4 add di,4
pop ds pop ds
@ -193,44 +193,44 @@ proc print pointer:word
jmp .strinaize0 jmp .strinaize0
.showsize: .showsize:
stdcall showsize,[dword ptr offset .pointer+di+2] stdcall showsize,dword [pointer+di+2]
add si,2 add si,2
add di,4 add di,4
jmp .strinaize0 jmp .strinaize0
.showattr: .showattr:
stdcall showattr,[word ptr offset .pointer+di+2] stdcall showattr,word [pointer+di+2]
add si,2 add si,2
add di,2 add di,2
jmp .strinaize0 jmp .strinaize0
.showname: .showname:
stdcall showname,[word ptr offset .pointer+di+2] stdcall showname,word [pointer+di+2]
add si,2 add si,2
add di,2 add di,2
jmp .strinaize0 jmp .strinaize0
.showtime: .showtime:
stdcall showtime,[word ptr offset .pointer+di+2] stdcall showtime,word [pointer+di+2]
add si,2 add si,2
add di,2 add di,2
jmp .strinaize0 jmp .strinaize0
.showdate: .showdate:
stdcall showdate,[word ptr offset .pointer+di+2] stdcall showdate,word [pointer+di+2]
add si,2 add si,2
add di,2 add di,2
jmp .strinaize0 jmp .strinaize0
.Chosesize: .Chosesize:
pop cx pop cx
push [dword ptr offset .pointer+di+2] push dword [pointer+di+2]
add di,4 add di,4
cmp [byte ptr si+2],'B' cmp byte [si+2],'B'
je .byte je .byte
cmp [byte ptr si+2],'W' cmp byte [si+2],'W'
je .word je .word
cmp [byte ptr si+2],'D' cmp byte [si+2],'D'
je .dword je .dword
dec si dec si
@ -238,27 +238,27 @@ proc print pointer:word
push 16 push 16
add si,3 add si,3
push cx push cx
retfn ret
.byte: .byte:
push 8 push 8
add si,3 add si,3
push cx push cx
retfn ret
.dword: .dword:
push 32 push 32
add si,3 add si,3
push cx push cx
retfn ret
.special2: .special2:
cmp [byte ptr si+1],'\' cmp byte [si+1],'\'
jne .notshowit2 jne .notshowit2
inc si inc si
jmp .showit jmp .showit
.notshowit2: .notshowit2:
mov cl,[byte ptr si+1] mov cl,byte [si+1]
cmp cl,'l' cmp cl,'l'
je .showline je .showline
cmp cl,'g' cmp cl,'g'
@ -465,7 +465,7 @@ proc showname uses cx si, thename:word
mov si,[thename] mov si,[thename]
xor cx,cx xor cx,cx
.showthename: .showthename:
invoke showchars,[word ptr ds:si],0FFFFh invoke showchars,word [ds:si],0FFFFh
inc si inc si
inc cx inc cx
cmp cx,8 cmp cx,8
@ -547,22 +547,22 @@ proc showsize uses edx ds, thesize:dword
cmp edx,1024*9 cmp edx,1024*9
ja .kilo ja .kilo
stdcall showintr,4,edx stdcall showintr,4,edx
stdcall showstring0,offset unit stdcall showstring0,unit
jmp .finsize jmp .finsize
.kilo: .kilo:
shr edx,10 shr edx,10
stdcall showintr,4,edx stdcall showintr,4,edx
stdcall showstring0,offset unitkilo stdcall showstring0,unitkilo
jmp .finsize jmp .finsize
.mega: .mega:
shr edx,20 shr edx,20
stdcall showintr,4,edx stdcall showintr,4,edx
stdcall showstring0,offset unitmega stdcall showstring0,unitmega
jmp .finsize jmp .finsize
.giga: .giga:
shr edx,30 shr edx,30
stdcall showintr,4,edx stdcall showintr,4,edx
stdcall showstring0,offset unitgiga stdcall showstring0,unitgiga
.finsize: .finsize:
retf retf
@ -590,11 +590,11 @@ endp
;<- ;<-
;============================ ;============================
proc showint uses eax bx cx edx esi, integer:dword proc showint uses eax bx cx edx esi, integer:dword
local showbuffer db 50 dup (0FFh) local showbuffer[50]:BYTE
xor cx,cx xor cx,cx
mov eax,[integer] mov eax,[integer]
mov esi,10 mov esi,10
mov bx,offset showbuffer+27 lea bx,[showbuffer+27]
.decint: .decint:
xor edx,edx xor edx,edx
div esi div esi
@ -619,12 +619,13 @@ endp
;-> %0 un entier % taille en caracteres ;-> %0 un entier % taille en caracteres
;<- ;<-
;=============================== ;===============================
proc showintl eax bx cx edx esi di, sizeofint:word,integer:dword proc showintl uses eax bx cx edx esi di, sizeofint:word,integer:dword
local showbuffer[50]:BYTE
mov di,[sizeofint] mov di,[sizeofint]
xor cx,cx xor cx,cx
mov eax,[integer] mov eax,[integer]
mov esi,10 mov esi,10
mov bx,offset showbuffer+27 lea bx,[showbuffer+27]
.decint: .decint:
xor edx,edx xor edx,edx
div esi div esi
@ -640,7 +641,7 @@ proc showintl eax bx cx edx esi di, sizeofint:word,integer:dword
xchg cx,di xchg cx,di
sub cx,di sub cx,di
.rego: .rego:
mov [byte ptr cs:bx],'0' mov byte [cs:bx],'0'
dec bx dec bx
dec cx dec cx
jnz .rego jnz .rego
@ -663,11 +664,12 @@ endp
;<- ;<-
;=============================== ;===============================
proc showintr uses eax bx cx edx esi di, sizeofint:word,integer:dword proc showintr uses eax bx cx edx esi di, sizeofint:word,integer:dword
local showbuffer[50]:BYTE
mov di,[sizeofint] mov di,[sizeofint]
xor cx,cx xor cx,cx
mov eax,[integer] mov eax,[integer]
mov esi,10 mov esi,10
mov bx,offset showbuffer+27 lea bx,[showbuffer+27]
.decint: .decint:
xor edx,edx xor edx,edx
div esi div esi
@ -683,7 +685,7 @@ proc showintr uses eax bx cx edx esi di, sizeofint:word,integer:dword
xchg cx,di xchg cx,di
sub cx,di sub cx,di
.rego: .rego:
mov [byte ptr cs:bx],' ' mov byte [cs:bx],' '
dec bx dec bx
dec cx dec cx
jnz .rego jnz .rego
@ -705,7 +707,7 @@ endp
;-> %0 un entier, %1 la taille ;-> %0 un entier, %1 la taille
;<- ;<-
;=============================== ;===============================
proc showsigned ebx cx edx, sizeofint:word,integer:dword proc showsigned uses ebx cx edx, sizeofint:word,integer:dword
mov ebx,[integer] mov ebx,[integer]
mov cx,[sizeofint] mov cx,[sizeofint]
xor edx,edx xor edx,edx
@ -741,7 +743,7 @@ endp
;-> %0 un entier, %1 la taille ;-> %0 un entier, %1 la taille
;<- ;<-
;============================ ;============================
proc showhex ax bx cx edx, sizeofint:word,integer:dword proc showhex uses ax bx cx edx, sizeofint:word,integer:dword
mov edx,[integer] mov edx,[integer]
mov cx,[sizeofint] mov cx,[sizeofint]
mov ax,cx mov ax,cx
@ -753,7 +755,7 @@ proc showhex ax bx cx edx, sizeofint:word,integer:dword
rol edx,4 rol edx,4
mov bx,dx mov bx,dx
and bx,0fh and bx,0fh
mov cl,[cs:bx+offset Tab] mov cl,[cs:bx+Tab]
invoke showchars,cx,0FFFFh invoke showchars,cx,0FFFFh
dec al dec al
jnz .Hexaize jnz .Hexaize
@ -767,7 +769,7 @@ endp
;-> %0 un entier, %1 la taille ;-> %0 un entier, %1 la taille
;<- ;<-
;============================ ;============================
proc showbin ax cx edx, sizeofint:word,integer:dword proc showbin uses ax cx edx, sizeofint:word,integer:dword
mov edx,[integer] mov edx,[integer]
mov cx,[sizeofint] mov cx,[sizeofint]
sub cx,32 sub cx,32
@ -789,7 +791,7 @@ endp
;-> %0 un entier, %1 la taille ;-> %0 un entier, %1 la taille
;<- ;<-
;============================ ;============================
proc showbcd ax cx edx, sizeofint:word,integer:dword proc showbcd uses ax cx edx, sizeofint:word,integer:dword
mov edx,[integer] mov edx,[integer]
mov ax,[sizeofint] mov ax,[sizeofint]
mov cx,ax mov cx,ax
@ -813,12 +815,12 @@ endp
;-> ds:%1 pointeur chaine type pascal ;-> ds:%1 pointeur chaine type pascal
;<- ;<-
;=============================== ;===============================
proc showstring bx si, pointer:word proc showstring uses bx si, pointer:word
mov si,[pointer] mov si,[pointer]
mov bl,[si] mov bl,[si]
.strinaize: .strinaize:
inc si inc si
invoke showchars,[word ptr si],0FFFFh invoke showchars,word [si],0FFFFh
dec bl dec bl
jnz .strinaize jnz .strinaize
retf retf

View File

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

View File

@ -29,7 +29,7 @@ IRR = 0Ah ; Pas d'operation, pas de Poll, lire IRR
;Autorise une interruption electronique ;Autorise une interruption electronique
;Entree : %1 - Numero de l'interruption (0-15) à autoriser 0-7 = MASTERPIC , 8-15 = SLAVEPIC ;Entree : %1 - Numero de l'interruption (0-15) à autoriser 0-7 = MASTERPIC , 8-15 = SLAVEPIC
proc enableirq, irq proc enableirq uses ax cx dx, irq:word
mov ax,[irq] mov ax,[irq]
mov dx,MASTERPIC+IRQMASK mov dx,MASTERPIC+IRQMASK
cmp al,7 cmp al,7
@ -50,7 +50,7 @@ endp
;Desactive une interruption lectronique ;Desactive une interruption lectronique
;Entre : %0 - Numro de l'interruption (0-15) … desactiver 0-7 = MASTERPIC , 8-15 = SLAVEPIC ;Entre : %0 - Numro de l'interruption (0-15) … desactiver 0-7 = MASTERPIC , 8-15 = SLAVEPIC
proc disableirq, irq proc disableirq uses ax cx dx, irq:word
mov ax,[irq] mov ax,[irq]
mov dx,MASTERPIC+IRQMASK mov dx,MASTERPIC+IRQMASK
cmp al,7 cmp al,7
@ -71,7 +71,7 @@ endp
;Signale "End Of Interrupt" de l'interruption %0 ;Signale "End Of Interrupt" de l'interruption %0
proc seteoi, irq proc seteoi uses ax dx, irq:word
mov ax,[irq] mov ax,[irq]
cmp al,7 cmp al,7
jbe .master jbe .master
@ -85,7 +85,7 @@ endp
;Lit les masques d'un contr“leur IRQ dans ax, 0 master ou slave 1 ds %1 ;Lit les masques d'un contr“leur IRQ dans ax, 0 master ou slave 1 ds %1
proc readimr, controleurx proc readimr uses bx dx, controleur:word
mov bx,[controleur] mov bx,[controleur]
mov dx,MASTERPIC+ IRQMASK mov dx,MASTERPIC+ IRQMASK
cmp bl,0 cmp bl,0
@ -99,7 +99,7 @@ proc readimr, controleurx
endp endp
;Lit le registre d'tat d'un contr“leur IRQ dans ax, 0 master ou slave 1 ds %1 ;Lit le registre d'tat d'un contr“leur IRQ dans ax, 0 master ou slave 1 ds %1
proc readisr, controleur proc readisr uses bx dx, controleur:word
mov bx,[controleur] mov bx,[controleur]
mov dx,MASTERPIC mov dx,MASTERPIC
cmp bh,0 cmp bh,0
@ -115,7 +115,7 @@ endp
;Lit le registre d'tat d'un contr“leur IRQ dans al, 0 master ou slave 1 ds bh ;Lit le registre d'tat d'un contr“leur IRQ dans al, 0 master ou slave 1 ds bh
proc readirr, controleur proc readirr uses bx dx, controleur:word
mov bx,[controleur] mov bx,[controleur]
mov dx,MASTERPIC mov dx,MASTERPIC
cmp bh,0 cmp bh,0
@ -130,7 +130,7 @@ proc readirr, controleur
endp endp
;carry si enable et pas carry si pas enable ;carry si enable et pas carry si pas enable
proc isenableirq, irq proc isenableirq uses ax cx dx, irq:word
mov ax,[irq] mov ax,[irq]
mov dx,MASTERPIC+IRQMASK mov dx,MASTERPIC+IRQMASK
cmp al,7 cmp al,7
@ -147,7 +147,7 @@ endp
;carry si enable et pas carry si pas enable ;carry si enable et pas carry si pas enable
proc isinserviceirq, irq proc isinserviceirq uses ax cx dx, irq:word
mov ax,[irq] mov ax,[irq]
mov dx,MASTERPIC mov dx,MASTERPIC
cmp al,7 cmp al,7
@ -166,7 +166,7 @@ endp
;carry si enable et pas carry si pas enable ;carry si enable et pas carry si pas enable
proc isrequestirq, irq proc isrequestirq uses ax cx dx, irq:word
mov ax,[irq] mov ax,[irq]
mov dx,MASTERPIC mov dx,MASTERPIC
cmp al,7 cmp al,7
@ -184,62 +184,74 @@ proc isrequestirq, irq
endp endp
proc installirqhandler proc installirqhandler uses eax bx cx edx si di ds es
push fs push fs
stdcall mbcreate,interruptionbloc,256*ints.sizeof virtual at 0
.intsori ints
end virtual
stdcall mbcreate,interruptionbloc,256*.intsori.sizeof
mov es,ax mov es,ax
mov ax,0x0000 mov ax,0x0000
mov ds,ax mov ds,ax
xor si,si xor si,si
.searchdummypointer: .searchdummypointer:
mov fs,[si+vector.data.seg] virtual at si
mov bx,[si+vector.data.off] .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 cmp byte [fs:bx],0xCF ;iret
je .founded je .founded
add si,vector.sizeof add si,.vectorori.sizeof
cmp si,256*4 cmp si,256*4
jb .searchdummypointer jb .searchdummypointer
xor edx,edx xor edx,edx
jmp .suite jmp .suite
.founded: .founded:
mov edx,[si+vector.content] mov edx,[.vector.content]
.suite: .suite:
xor cx,cx xor cx,cx
xor si,si xor si,si
xor di,di xor di,di
cli cli
.copy: .copy:
mov [es:di+ints.number],cl virtual at di
mov [es:di+ints.locked],0 .ints ints
mov [es:di+ints.vector1.content],0 end virtual
mov [es:di+ints.vector3.content],0 mov [es:.ints.number],cl
mov [es:di+ints.vector4.content],0 mov [es:.ints.locked],0
mov [es:di+ints.vector5.content],0 mov [es:.ints.vector1.content],0
mov [es:di+ints.vector6.content],0 mov [es:.ints.vector3.content],0
mov [es:di+ints.vector7.content],0 mov [es:.ints.vector4.content],0
mov [es:di+ints.vector8.content],0 mov [es:.ints.vector5.content],0
mov [es:di+ints.launchedlow],0 mov [es:.ints.vector6.content],0
mov [es:di+ints.launchedhigh],0 mov [es:.ints.vector7.content],0
mov [es:di+ints.calledlow],0 mov [es:.ints.vector8.content],0
mov [es:di+ints.calledhigh],0 mov [es:.ints.launchedlow],0
mov eax,[si+vector.ints.content] mov [es:.ints.launchedhigh],0
mov [es:.ints.calledlow],0
mov [es:.ints.calledhigh],0
mov eax,[.vector.content]
cmp eax,edx cmp eax,edx
je .notarealvector je .notarealvector
mov [es:di+ints.vector1.content],eax mov [es:.ints.vector1.content],eax
mov [es:di+ints.activated],1 mov [es:.ints.activated],1
jmp .copynext jmp .copynext
.notarealvector: .notarealvector:
mov [es:di+ints.vector1.content],0 mov [es:.ints.vector1.content],0
mov [es:di+ints.activated],0 mov [es:.ints.activated],0
.copynext: .copynext:
mov bx,cx mov bx,cx
shl bx,3 shl bx,3
sub bx,cx sub bx,cx
add bx,coupling add bx,coupling
mov [si+vector.data.seg],cs mov [.vector.data.seg],cs
mov [si+vector.data.off],bx mov [.vector.data.off],bx
add si,vector.sizeof add si,.vectorori.sizeof
add di,ints.sizeof add di,.intsori.sizeof
inc cl inc cl
cmp cl,0 cmp cl,0
jne .copy jne .copy
@ -253,7 +265,7 @@ endp
interruptionbloc db '/interrupts',0 interruptionbloc db '/interrupts',0
proc savecontext, pointer proc savecontext uses eax si ds, pointer:word
pushfd pushfd
push eax push eax
push ebx push ebx
@ -278,39 +290,45 @@ push eax
mov ax,bp mov ax,bp
add ax,4 add ax,4
push eax push eax
pop [si+regs.sesp] virtual at si
pop [si+regs.seip] .regs regs
pop [si+regs.scs] end virtual
pop [si+regs.sebp] pop [.regs.sesp]
pop [si+regs.sss] pop [.regs.seip]
pop [si+regs.sgs] pop [.regs.scs]
pop [si+regs.sfs] pop [.regs.sebp]
pop [si+regs.ses] pop [.regs.sss]
pop [si+regs.sds] pop [.regs.sgs]
pop [si+regs.sedi] pop [.regs.sfs]
pop [si+regs.sesi] pop [.regs.ses]
pop [si+regs.sedx] pop [.regs.sds]
pop [si+regs.secx] pop [.regs.sedi]
pop [si+regs.sebx] pop [.regs.sesi]
pop [si+regs.seax] pop [.regs.sedx]
pop [si+regs.seflags] pop [.regs.secx]
pop [.regs.sebx]
pop [.regs.seax]
pop [.regs.seflags]
retf retf
endp endp
proc restorecontextg, pointer proc restorecontextg, pointer:word
mov si,[pointer] mov si,[pointer]
pushd [cs:si+regs.sesi] virtual at si
pushd [cs:si+regs.seflags] .regs regs
mov eax,[cs:si+regs.seax] end virtual
mov ebx,[cs:si+regs.sebx] pushd [cs:.regs.sesi]
mov ecx,[cs:si+regs.secx] pushd [cs:.regs.seflags]
mov edx,[cs:si+regs.sedx] mov eax,[cs:.regs.seax]
mov edi,[cs:si+regs.sedi] mov ebx,[cs:.regs.sebx]
mov ebp,[cs:si+regs.sebp] mov ecx,[cs:.regs.secx]
mov es,[cs:si+regs.ses] mov edx,[cs:.regs.sedx]
mov fs,[cs:si+regs.sfs] mov edi,[cs:.regs.sedi]
mov gs,[cs:si+regs.sgs] mov ebp,[cs:.regs.sebp]
mov ds,[cs:si+regs.sds] mov es,[cs:.regs.ses]
mov fs,[cs:.regs.sfs]
mov gs,[cs:.regs.sgs]
mov ds,[cs:.regs.sds]
popfd popfd
pop esi pop esi
pop [cs:dummy] pop [cs:dummy]
@ -322,7 +340,7 @@ endp
coupling: coupling:
repeat 256 repeat 256
push %+256 push %+256
push offset irqhandlers push irqhandlers
ret ret
end repeat end repeat
@ -334,48 +352,60 @@ function_reg regs
irqhandlers: irqhandlers:
cli cli
pop [cs:interrupt] pop [cs:interrupt]
stdcall savecontext,offset calling_reg stdcall savecontext,calling_reg
stdcall irqhandler,[cs:interrupt] stdcall irqhandler,[cs:interrupt]
stdcall restorecontextg,offset calling_reg stdcall restorecontextg,calling_reg
sti sti
iret iret
proc irqhandler, int proc irqhandler, int:word
push cs push cs
pop ds pop ds
stdcall mbfindsb,offset interruptionbloc,cs stdcall mbfindsb,interruptionbloc,cs
jc .end jc .end
mov es,ax mov es,ax
mov ax,[int] mov ax,[int]
sub ax,256 sub ax,256
mov cx,ints.sizeof virtual at 0
.intsorig ints
end virtual
mov cx,.intsorig.sizeof
mul cx mul cx
mov si,ax mov si,ax
add [es:si+ints.calledlow],1 virtual at si
adc [es:si+ints.calledhigh],0 .ints ints
cmp [es:si+ints.activated],1 end virtual
add [es:.ints.calledlow],1
adc [es:.ints.calledhigh],0
cmp [es:.ints.activated],1
jne .end jne .end
add [es:si+ints.launchedlow],1 add [es:.ints.launchedlow],1
adc [es:si+ints.launchedhigh],0 adc [es:.ints.launchedhigh],0
lea si,[es:si+ints.vector1] lea si,[es:.ints.vector1]
mov cl,8 mov cl,8
.launchall: .launchall:
cmp [es:si+vector.content],0 virtual at si
.vector vector
end virtual
virtual at 0
.vectorori vector
end virtual
cmp [es:.vector.content],0
je .end je .end
push word [cs:calling_reg.seflags] push word [cs:calling_reg.seflags]
push cs push cs
push offset .back push .back
push [es:si+vector.data.seg] push [es:.vector.data.seg]
push [es:si+vector.data.off] push [es:.vector.data.off]
stdcall savecontext,offset function_reg stdcall savecontext,function_reg
stdcall restorecontextg,offset calling_reg stdcall restorecontextg,calling_reg
db 0xCB db 0xCB
.back: .back:
cli cli
stdcall savecontext,offset calling_reg stdcall savecontext,calling_reg
stdcall restorecontextg,offset function_reg stdcall restorecontextg,function_reg
.next: .next:
add si,vector.sizeof add si,.vectorori.sizeof
dec cl dec cl
jnz .launchall jnz .launchall
.end: .end:

View File

@ -1,16 +1,17 @@
ASM=fasm ASM=fasm
CLEAN=rm -rf CLEAN=rm -rf
all: systeme.sys disque.sys video.sys all: disque.sys video.sys systeme.sys
sync
systeme.sys: systeme.asm systeme.sys: systeme.asm
$(ASM) $^ $(ASM) $^ $@
disque.sys: disque.asm disque.sys: disque.asm
$(ASM) $^ $(ASM) $^ $@
video.sys: video.asm video.sys: video.asm
$(ASM) $^ $(ASM) $^ $@
clean: clean:
$(CLEAN) *.sys $(CLEAN) *.sys

View File

@ -1,6 +1,6 @@
;Affiche le nombre hexa dans %0[dword] ;Affiche le nombre hexa dans %0[dword]
proc biosprinth, num:dword proc biosprinth uses ax bx cx edx si di, num:dword
mov edx,[num] mov edx,[num]
mov ah,09h mov ah,09h
mov di,8 mov di,8
@ -25,7 +25,7 @@ proc biosprinth, num:dword
endp endp
;Affiche le texte ASCIIZ pointé par %0 ;Affiche le texte ASCIIZ pointé par %0
proc biosprint, pointer proc biosprint uses ax bx cx si, pointer:word
mov si,[pointer] mov si,[pointer]
mov cx,1 mov cx,1
mov bx,7 mov bx,7
@ -45,7 +45,7 @@ proc biosprint, pointer
retf retf
endp endp
proc enablea20 proc enablea20 uses ax
mov al,0d1h mov al,0d1h
out 64h,al out 64h,al
call a20wait call a20wait
@ -58,7 +58,7 @@ proc enablea20
retf retf
endp endp
proc disablea20 proc disablea20 uses ax
mov al,0d1h mov al,0d1h
out 64h,al out 64h,al
call a20wait call a20wait
@ -88,7 +88,7 @@ a20wait:
;and al,not 2 ;and al,not 2
;out 92h,al ;out 92h,al
proc flatmode proc flatmode uses eax bx ds
push cs push cs
pop ds pop ds
; first, calculate the linear address of GDT ; first, calculate the linear address of GDT
@ -98,7 +98,10 @@ proc flatmode
add dword [.gdt+2],eax ; store as GDT linear base addr add dword [.gdt+2],eax ; store as GDT linear base addr
; now load the GDT into the GDTR ; now load the GDT into the GDTR
lgdt fword [.gdt] ; load GDT base lgdt fword [.gdt] ; load GDT base
mov bx,1 * descriptor.sizeof ; point to first descriptor virtual at 0
.descriptor descriptor
end virtual
mov bx,1 * .descriptor.sizeof ; point to first descriptor
cli ; turn off interrupts cli ; turn off interrupts
mov eax,cr0 ; prepare to enter protected mode mov eax,cr0 ; prepare to enter protected mode
or al,1 ; flip the PE bit or al,1 ; flip the PE bit
@ -120,7 +123,7 @@ gdtdata descriptor 0ffffh, 0, 0, 091h, 0cfh, 0 ; 4G data segment
endp endp
;Attend l'appuie sur une touche ;Attend l'appuie sur une touche
proc bioswaitkey proc bioswaitkey uses ax
xor ax,ax xor ax,ax
int 16h int 16h
retf retf
@ -130,7 +133,7 @@ firstmb dw 0
;Charge les sections du block %0 ;Charge les sections du block %0
proc mbloadsection, blocks proc mbloadsection uses ax bx cx si di ds es, blocks:word
mov ax,[blocks] mov ax,[blocks]
mov es,ax mov es,ax
mov ds,ax mov ds,ax
@ -138,7 +141,10 @@ proc mbloadsection, blocks
jne .notace jne .notace
lea si,[.toresov] lea si,[.toresov]
mov word [ss:si],0FFFFh mov word [ss:si],0FFFFh
mov bx,[ds:exe.sections] virtual at 0
.exe exe
end virtual
mov bx,[ds:.exe.sections]
cmp bx,0 cmp bx,0
je .finishloading je .finishloading
.loading: .loading:
@ -193,7 +199,7 @@ endp
;Initialise les blocs de mémoire en prenant memorystart pour segment de base ;Initialise les blocs de mémoire en prenant memorystart pour segment de base
proc mbinit proc mbinit uses ax cx si di ds es
cmp [cs:firstmb],0 cmp [cs:firstmb],0
jne .alreadyok jne .alreadyok
push cs push cs
@ -203,7 +209,10 @@ proc mbinit
mov es,ax mov es,ax
mov si,afree mov si,afree
xor di,di xor di,di
mov cx,mb.sizeof virtual at 0
.mb mb
end virtual
mov cx,.mb.sizeof
rep movsb rep movsb
clc clc
retf retf
@ -216,7 +225,7 @@ afree mb "HN",0,0,0,0A000h-memorystart,"Libre"
db 0 db 0
;Creér un bloc de nom %0 de taille %1 (octets) -> n°segment dans AX ;Creér un bloc de nom %0 de taille %1 (octets) -> n°segment dans AX
proc mbcreate , blocks, size proc mbcreate uses bx cx dx si di ds es, blocks:word, size:word
push gs push gs
mov ax,[ss:bp+4] mov ax,[ss:bp+4]
mov dx,ax mov dx,ax
@ -239,20 +248,23 @@ proc mbcreate , blocks, size
cmp dl,false cmp dl,false
je .notenougtmem je .notenougtmem
mov es,bx mov es,bx
cmp word [es:mb.check],"NH" virtual at 0
.mb mb
end virtual
cmp word [es:.mb.check],"NH"
jne .memoryerror jne .memoryerror
cmp [es:mb.isnotlast],true cmp [es:.mb.isnotlast],true
sete dl sete dl
cmp [es:mb.reference],free cmp [es:.mb.reference],free
jne .notsogood jne .notsogood
mov ax,[es:mb.sizes] mov ax,[es:.mb.sizes]
cmp cx,ax cmp cx,ax
ja .notsogood ja .notsogood
mov word [es:mb.check],"NH" mov word [es:.mb.check],"NH"
mov [es:mb.isnotlast],true mov [es:.mb.isnotlast],true
mov [es:mb.reference],gs mov [es:.mb.reference],gs
mov [es:mb.isresident],false mov [es:.mb.isresident],false
lea di,[es:mb.names] lea di,[es:.mb.names]
push cx push cx
mov cx,24/4 mov cx,24/4
mov si,[blocks] mov si,[blocks]
@ -266,18 +278,18 @@ proc mbcreate , blocks, size
je .nofree je .nofree
dec ax dec ax
dec ax dec ax
mov [es:mb.sizes],cx mov [es:.mb.sizes],cx
add cx,bx add cx,bx
mov es,cx mov es,cx
mov si,afree mov si,afree
xor di,di xor di,di
mov cx,mb.sizeof mov cx,.mb.sizeof
push cs push cs
pop ds pop ds
cld cld
rep movsb rep movsb
mov [es:mb.isnotlast],dl mov [es:.mb.isnotlast],dl
mov [es:mb.sizes],ax mov [es:.mb.sizes],ax
.nofree: .nofree:
mov ax,bx mov ax,bx
pop gs pop gs
@ -286,7 +298,7 @@ proc mbcreate , blocks, size
.notsogood: .notsogood:
inc bx inc bx
inc bx inc bx
add bx,[es:mb.sizes] add bx,[es:.mb.sizes]
jmp .searchfree jmp .searchfree
.memoryerror: .memoryerror:
pop gs pop gs
@ -299,23 +311,26 @@ proc mbcreate , blocks, size
endp endp
;Libère le bloc de mémoire %0 et ses sous blocs ;Libère le bloc de mémoire %0 et ses sous blocs
proc mbfree, blocks proc mbfree uses ax bx cx si di ds es, blocks:word
mov bx,[blocks] mov bx,[blocks]
mov ax,bx mov ax,bx
dec bx dec bx
dec bx dec bx
mov es,bx mov es,bx
cmp word [es:mb.check],"NH" virtual at 0
.mb mb
end virtual
cmp word [es:.mb.check],"NH"
jne .memoryerror jne .memoryerror
cmp [es:mb.reference],free cmp [es:.mb.reference],free
je .wasfree je .wasfree
cmp [es:mb.isresident],true cmp [es:.mb.isresident],true
je .wasresident je .wasresident
mov [es:mb.reference],free mov [es:.mb.reference],free
push cs push cs
pop ds pop ds
mov si,.isfree mov si,.isfree
lea di,[es:mb.names] lea di,[es:.mb.names]
mov cx,6 mov cx,6
cld cld
rep movsb rep movsb
@ -324,24 +339,24 @@ proc mbfree, blocks
dec bx dec bx
.searchtofree: .searchtofree:
mov es,bx mov es,bx
cmp word [es:mb.check],"NH" cmp word [es:.mb.check],"NH"
jne .memoryerror jne .memoryerror
inc bx inc bx
inc bx inc bx
add bx,[es:mb.sizes] add bx,[es:.mb.sizes]
cmp [es:mb.sizes],0 cmp [es:.mb.sizes],0
je .nottofree je .nottofree
cmp ax,[es:mb.reference] cmp ax,[es:.mb.reference]
jne .nottofree jne .nottofree
mov [es:mb.isresident],false mov [es:.mb.isresident],false
mov [es:mb.reference],free mov [es:.mb.reference],free
mov si,.isfree mov si,.isfree
lea di,[es:mb.names] lea di,[es:.mb.names]
mov cx,6 mov cx,6
cld cld
rep movsb rep movsb
.nottofree: .nottofree:
cmp [es:mb.isnotlast],true cmp [es:.mb.isnotlast],true
je .searchtofree je .searchtofree
stdcall mbclean stdcall mbclean
retf retf
@ -359,7 +374,7 @@ proc mbfree, blocks
endp endp
;Mise a nivo de la mémoire (jonction de blocs libre) ;Mise a nivo de la mémoire (jonction de blocs libre)
proc mbclean proc mbclean uses ax bx dx es gs
mov bx,[cs:firstmb] mov bx,[cs:firstmb]
dec bx dec bx
dec bx dec bx
@ -367,20 +382,23 @@ proc mbclean
xor dx,dx xor dx,dx
.searchfree: .searchfree:
mov gs,bx mov gs,bx
cmp word [gs:mb.check],"NH" virtual at 0
.mb mb
end virtual
cmp word [gs:.mb.check],"NH"
jne .memoryerror jne .memoryerror
inc bx inc bx
inc bx inc bx
add bx,[gs:mb.sizes] add bx,[gs:.mb.sizes]
cmp word [gs:mb.sizes],0 cmp word [gs:.mb.sizes],0
je .notenougtmem je .notenougtmem
cmp [gs:mb.reference],free cmp [gs:.mb.reference],free
jne .notfree jne .notfree
cmp ax,0 cmp ax,0
je .notmeetfree je .notmeetfree
add dx,[gs:mb.sizes] add dx,[gs:.mb.sizes]
mov word [gs:mb.check],0 mov word [gs:.mb.check],0
mov dword [gs:mb.names],0 mov dword [gs:.mb.names],0
inc dx inc dx
inc dx inc dx
jmp .nottrigered jmp .nottrigered
@ -392,16 +410,16 @@ proc mbclean
cmp ax,0 cmp ax,0
je .nottrigered je .nottrigered
mov es,ax mov es,ax
add [es:mb.sizes],dx add [es:.mb.sizes],dx
xor ax,ax xor ax,ax
.nottrigered: .nottrigered:
cmp [gs:mb.isnotlast],true cmp [gs:.mb.isnotlast],true
je .searchfree je .searchfree
cmp ax,0 cmp ax,0
je .reallyfinish je .reallyfinish
mov es,ax mov es,ax
add [es:mb.sizes],dx add [es:.mb.sizes],dx
mov [es:mb.isnotlast],false mov [es:.mb.isnotlast],false
.reallyfinish: .reallyfinish:
clc clc
retf retf
@ -414,14 +432,17 @@ proc mbclean
endp endp
;Rend le segment %0 résident ;Rend le segment %0 résident
proc mbresident, blocks proc mbresident uses bx es, blocks:word
mov bx,[blocks] mov bx,[blocks]
dec bx dec bx
dec bx dec bx
mov es,bx mov es,bx
cmp word [es:mb.check],"NH" virtual at 0
.mb mb
end virtual
cmp word [es:.mb.check],"NH"
jne .memoryerror jne .memoryerror
mov [es:mb.isresident],true mov [es:.mb.isresident],true
retf retf
.memoryerror: .memoryerror:
stc stc
@ -429,14 +450,17 @@ proc mbresident, blocks
endp endp
;Rend le segment %0 non résident ;Rend le segment %0 non résident
proc mbnonresident, blocks proc mbnonresident uses bx es, blocks:word
mov bx,[blocks] mov bx,[blocks]
dec bx dec bx
dec bx dec bx
mov es,bx mov es,bx
cmp word [es:mb.check],"NH" virtual at 0
.mb mb
end virtual
cmp word [es:.mb.check],"NH"
jne .memoryerror jne .memoryerror
mov [es:mb.isresident],false mov [es:.mb.isresident],false
retf retf
.memoryerror: .memoryerror:
stc stc
@ -445,17 +469,20 @@ endp
;Change le proprietaire de %0 a %1 ;Change le proprietaire de %0 a %1
proc mbchown ,blocks, owner proc mbchown uses bx dx es,blocks:word, owner:word
mov bx,[blocks] mov bx,[blocks]
dec bx dec bx
dec bx dec bx
mov es,bx mov es,bx
cmp word [es:mb.check],"NH" virtual at 0
.mb mb
end virtual
cmp word [es:.mb.check],"NH"
jne .memoryerror jne .memoryerror
cmp [es:mb.reference],free cmp [es:.mb.reference],free
je .wasfree je .wasfree
mov dx,[owner] mov dx,[owner]
mov [es:mb.reference],dx mov [es:.mb.reference],dx
retf retf
.memoryerror: .memoryerror:
stc stc
@ -466,7 +493,7 @@ proc mbchown ,blocks, owner
endp endp
;Alloue un bloc /data de CX caractere pour le process appelant -> ax ;Alloue un bloc /data de CX caractere pour le process appelant -> ax
proc mballoc, size proc mballoc uses si ds, size:word
push cs push cs
pop ds pop ds
stdcall mbcreate,.data,[size] stdcall mbcreate,.data,[size]
@ -477,25 +504,28 @@ proc mballoc, size
endp endp
;Renvoie en AX le MB n° %0 carry quand terminé ;Renvoie en AX le MB n° %0 carry quand terminé
proc mbget, num proc mbget uses bx dx es, num:word
mov bx,[cs:firstmb] mov bx,[cs:firstmb]
dec bx dec bx
dec bx dec bx
xor dx,dx xor dx,dx
.searchfree: .searchfree:
mov es,bx mov es,bx
cmp word [es:mb.check],"NH" virtual at 0
.mb mb
end virtual
cmp word [es:.mb.check],"NH"
jne .memoryerror jne .memoryerror
inc bx inc bx
inc bx inc bx
add bx,[es:mb.sizes] add bx,[es:.mb.sizes]
cmp [es:mb.sizes],0 cmp [es:.mb.sizes],0
je .memoryerror je .memoryerror
cmp dx,[num] cmp dx,[num]
je .foundmcb je .foundmcb
ja .notfound ja .notfound
inc dx inc dx
cmp [es:mb.isnotlast],true cmp [es:.mb.isnotlast],true
je .searchfree je .searchfree
.memoryerror: .memoryerror:
stc stc
@ -512,20 +542,23 @@ proc mbget, num
endp endp
;Renvoie en AX le MCB qui correspond a ds:%0 ;Renvoie en AX le MCB qui correspond a ds:%0
proc mbfind, blocks proc mbfind uses bx si di es, blocks:word
mov bx,[cs:firstmb] mov bx,[cs:firstmb]
dec bx dec bx
dec bx dec bx
mov si,[blocks] mov si,[blocks]
.search: .search:
mov es,bx mov es,bx
lea di,[es:mb.names] virtual at 0
cmp word [es:mb.check],"NH" .mb mb
end virtual
lea di,[es:.mb.names]
cmp word [es:.mb.check],"NH"
jne .memoryerror jne .memoryerror
inc bx inc bx
inc bx inc bx
add bx,[es:mb.sizes] add bx,[es:.mb.sizes]
cmp [es:mb.sizes],0 cmp [es:.mb.sizes],0
je .memoryerror je .memoryerror
push si di push si di
.cmpnames: .cmpnames:
@ -540,7 +573,7 @@ proc mbfind, blocks
.ok: .ok:
pop di si pop di si
je .foundmcb je .foundmcb
cmp [es:mb.isnotlast],true cmp [es:.mb.isnotlast],true
je .search je .search
.notfound: .notfound:
stc stc
@ -558,21 +591,24 @@ endp
;Renvoie en AX le sous mcb qui correspond a %0 et qui appartien a %1 ;Renvoie en AX le sous mcb qui correspond a %0 et qui appartien a %1
proc mbfindsb, blocks, owner proc mbfindsb uses bx dx si di es, blocks:word, owner:word
mov bx,[cs:firstmb] mov bx,[cs:firstmb]
dec bx dec bx
dec bx dec bx
mov si,[blocks] mov si,[blocks]
lea di,[es:mb.names] virtual at 0
.mb mb
end virtual
lea di,[es:.mb.names]
mov dx,[owner] mov dx,[owner]
.search: .search:
mov es,bx mov es,bx
cmp word [es:mb.check],"NH" cmp word [es:.mb.check],"NH"
jne .memoryerror jne .memoryerror
inc bx inc bx
inc bx inc bx
add bx,[es:mb.sizes] add bx,[es:.mb.sizes]
cmp [es:mb.sizes],0 cmp [es:.mb.sizes],0
je .memoryerror je .memoryerror
push si di push si di
.cmpnames: .cmpnames:
@ -587,10 +623,10 @@ proc mbfindsb, blocks, owner
.ok: .ok:
pop di si pop di si
jne .notfoundmcb jne .notfoundmcb
cmp [es:mb.reference],dx cmp [es:.mb.reference],dx
je .foundmcb je .foundmcb
.notfoundmcb: .notfoundmcb:
cmp [es:mb.isnotlast],true cmp [es:.mb.isnotlast],true
je .search je .search
.notfound: .notfound:
stc stc
@ -607,11 +643,14 @@ proc mbfindsb, blocks, owner
endp endp
;Resouds les dépendances du bloc de mémoire %0 ;Resouds les dépendances du bloc de mémoire %0
proc mbloadfuncs, blocks proc mbloadfuncs uses ax bx cx dx si ds, blocks:word
mov ds,[blocks] mov ds,[blocks]
cmp word [0],"EC" cmp word [0],"EC"
jne .notace jne .notace
mov si,[ds:exe.imports] virtual at 0
.exe exe
end virtual
mov si,[ds:.exe.imports]
cmp si,0 cmp si,0
je .endofloading je .endofloading
.loadfuncs: .loadfuncs:
@ -628,7 +667,7 @@ proc mbloadfuncs, blocks
cmp byte [bx], ':' cmp byte [bx], ':'
jne .findend jne .findend
mov byte [bx],0 mov byte [bx],0
stdcall [cs:projfile],si invoke projfile,si
mov byte [bx],':' mov byte [bx],':'
jc .erroronload jc .erroronload
;pushad ;pushad
@ -664,10 +703,13 @@ endp
;Recherche une fonction pointé par DS:%0 en mémoire et renvoie son adresse en DX:AX ;Recherche une fonction pointé par DS:%0 en mémoire et renvoie son adresse en DX:AX
proc mbsearchfunc, func proc mbsearchfunc uses bx si di es, func:word
mov bx,[func] mov bx,[func]
mov si,bx mov si,bx
.findend: .findend:
virtual at 0
.exe exe
end virtual
inc bx inc bx
cmp byte [bx], ':' cmp byte [bx], ':'
jne .findend jne .findend
@ -676,9 +718,9 @@ proc mbsearchfunc, func
mov byte [bx],':' mov byte [bx],':'
jc .notfoundattallthesb jc .notfoundattallthesb
mov es,ax mov es,ax
cmp word [es:exe.checks],"EC" cmp word [es:.exe.checks],"EC"
jne .notfoundattallthesb jne .notfoundattallthesb
mov di,[es:exe.exports] mov di,[es:.exe.exports]
inc bx inc bx
inc bx inc bx
.functions: .functions:

View File

@ -49,26 +49,26 @@ suite:
pop gs pop gs
stdcall biosprint,msg_ok stdcall biosprint,msg_ok
stdcall biosprint,msg_video_init stdcall biosprint,msg_video_init
stdcall [cs:setvideomode],2 invoke setvideomode,2
jc error jc error
stdcall [cs:clearscreen] invoke clearscreen
stdcall [cs:print],msg_memory invoke print,msg_memory
stdcall [cs:print],msg_ok2 invoke print,msg_ok2
stdcall [cs:print],msg_memory_init invoke print,msg_memory_init
stdcall [cs:print],msg_ok2 invoke print,msg_ok2
stdcall [cs:print],msg_memory_section invoke print,msg_memory_section
stdcall [cs:print],msg_ok2 invoke print,msg_ok2
stdcall [cs:print],msg_memory_jumps invoke print,msg_memory_jumps
stdcall [cs:print],msg_ok2 invoke print,msg_ok2
stdcall [cs:print],msg_video_init invoke print,msg_video_init
stdcall [cs:print],msg_ok2 invoke print,msg_ok2
stdcall [cs:print],msg_handler invoke print,msg_handler
;stdcall installirqhandler ;invoke installirqhandler
stdcall [cs:print],msg_ok2 invoke print,msg_ok2
stdcall [cs:print],msg_cpu_detect invoke print,msg_cpu_detect
stdcall [cs:cpuinfo],thecpu invoke cpuinfo,thecpu
stdcall [cs:setinfo],thecpu,temporary invoke setinfo,thecpu,temporary
stdcall [cs:print],msg_ok2 invoke print,msg_ok2
push temporary push temporary
xor eax,eax xor eax,eax
mov al,[thecpu.family] mov al,[thecpu.family]
@ -79,11 +79,11 @@ suite:
push eax push eax
push thecpu.names push thecpu.names
push thecpu.vendor push thecpu.vendor
stdcall [cs:print],msg_cpu_detect_inf invoke print,msg_cpu_detect_inf
stdcall [cs:print],msg_pci invoke print,msg_pci
stdcall [cs:pciinfo],thepci invoke pciinfo,thepci
jc nopci jc nopci
stdcall [cs:print],msg_ok2 invoke print,msg_ok2
xor eax,eax xor eax,eax
mov al,[thepci.maxbus] mov al,[thepci.maxbus]
push eax push eax
@ -91,25 +91,28 @@ suite:
push eax push eax
mov al,[thepci.version_major] mov al,[thepci.version_major]
push eax push eax
stdcall [cs:print],msg_pci_info invoke print,msg_pci_info
stdcall [cs:print],msg_pci_enum invoke print,msg_pci_enum
xor ebx,ebx xor ebx,ebx
xor ecx,ecx xor ecx,ecx
xor si,si xor si,si
searchpci: searchpci:
stdcall [cs:getcardinfo],bx,cx,si,temporary invoke getcardinfo,bx,cx,si,temporary
jc stopthis jc stopthis
mov al,[temporary+pcidata.subclass] virtual at temporary
.pcidata pcidata
end virtual
mov al,[.pcidata.subclass]
push ax push ax
mov al,[temporary+pcidata.class] mov al,[.pcidata.class]
push ax push ax
stdcall [cs:getpcisubclass] invoke getpcisubclass
push dx push dx
push ax push ax
mov al,[temporary+pcidata.class] mov al,[.pcidata.class]
xor ah,ah xor ah,ah
push ax push ax
stdcall [cs:getpciclass] invoke getpciclass
push dx push dx
push ax push ax
push 4 push 4
@ -118,11 +121,11 @@ searchpci:
push ecx push ecx
push 4 push 4
push ebx push ebx
mov ax,[temporary+pcidata.device] mov ax,[.pcidata.device]
push eax push eax
mov ax,[temporary+pcidata.vendor] mov ax,[.pcidata.vendor]
push eax push eax
stdcall [cs:print],msg_pci_card invoke print,msg_pci_card
inc si inc si
cmp si,7 cmp si,7
jbe searchpci jbe searchpci
@ -137,29 +140,29 @@ stopthis:
jbe searchpci jbe searchpci
jmp next jmp next
nopci: nopci:
stdcall [cs:print],msg_echec2 invoke print,msg_echec2
next: next:
;stdcall [cs:detectvmware] ;invoke detectvmware
;jne novirtual ;jne novirtual
;stdcall [cs:print],msg_vmware ;invoke print,msg_vmware
novirtual: novirtual:
;stdcall [cs:print],msg_flat ;invoke print,msg_flat
;stdcall enablea20 ;invoke enablea20
;stdcall flatmode ;invoke flatmode
;xor ax,ax ;xor ax,ax
;mov fs,ax ;mov fs,ax
;mov esi,0100000h ;mov esi,0100000h
;mov [dword ptr fs:esi],"OKIN" ;mov [dword ptr fs:esi],"OKIN"
stdcall [cs:print],msg_ok2 invoke print,msg_ok2
stdcall [cs:print],msg_disk_init invoke print,msg_disk_init
stdcall [cs:initdrive] invoke initdrive
jc error2 jc error2
stdcall [cs:print],msg_ok2 invoke print,msg_ok2
stdcall [cs:print],msg_launchcommand invoke print,msg_launchcommand
stdcall [cs:execfile],shell invoke execfile,shell
jc error2 jc error2
error2: error2:
stdcall [cs:print],msg_error2 invoke print,msg_error2
stdcall bioswaitkey stdcall bioswaitkey
jmp far 0FFFFh:0000h jmp far 0FFFFh:0000h

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,3 @@
model tiny,stdcall
p586N
locals
jumps
codeseg
option procalign:byte
include "..\include\mem.h" include "..\include\mem.h"
include "..\include\divers.h" include "..\include\divers.h"
include "..\include\graphic.h" include "..\include\graphic.h"
@ -12,20 +5,20 @@ include "..\include\graphic.h"
org 0h org 0h
start: start:
header exe <"CE",1,0,0,,offset imports,,offset realstart> header exe 1
realstart: realstart:
mov ax,0305h mov ax,0305h
mov bx,0008h mov bx,0008h
int 16h int 16h
call [savestate] invoke savestate
call [setvideomode],2 invoke setvideomode,2
xor ebp,ebp xor ebp,ebp
xor ax,ax xor ax,ax
mov fs,ax mov fs,ax
call [disablescroll] invoke disablescroll
adres: adres:
call [saveparamto],offset infos invoke saveparamto, infos
mov al,[infos.lines] mov al,[infos.lines]
dec al dec al
mov [lastline],al mov [lastline],al
@ -36,13 +29,13 @@ shr al,2
mov [sizex],al mov [sizex],al
and bl,11b and bl,11b
mov [sizex2],bl mov [sizex2],bl
mov al,[infos.mode] mov al,[infos.modenum]
cmp al,[oldmode] cmp al,[oldmode]
je noinit je noinit
call [clearscreen] invoke clearscreen
mov [oldmode],al mov [oldmode],al
noinit: noinit:
call [setxy],0,0 invoke setxy,0,0
mov edi,ebp mov edi,ebp
mov bh,[lastline] mov bh,[lastline]
lines: lines:
@ -53,8 +46,8 @@ mov edx,edi
shr edx,4*4 shr edx,4*4
shl edx,4*3 shl edx,4*3
push edx push edx
push offset spaces push spaces
call [print] invoke print
mov dx,di mov dx,di
mov al,[sizex] mov al,[sizex]
mov esi,edi mov esi,edi
@ -63,24 +56,24 @@ mov edx,edi
shr edx,4*4 shr edx,4*4
shl edx,4*3 shl edx,4*3
mov fs,dx mov fs,dx
push [dword ptr fs:di] push dword [fs:di]
push 8 push 8
call [showhex] invoke showhex
call [showchar],' ' invoke showchar,' '
inc edi inc edi
dec al dec al
jnz doaline jnz doaline
mov edi,esi mov edi,esi
push offset spaces2 push spaces2
call [print] invoke print
mov al,[sizex] mov al,[sizex]
doaline2: doaline2:
mov edx,edi mov edx,edi
shr edx,4*4 shr edx,4*4
shl edx,4*3 shl edx,4*3
mov fs,dx mov fs,dx
push [word ptr fs:di] push word [fs:di]
call [showchar] invoke showchar
inc edi inc edi
dec al dec al
jnz doaline2 jnz doaline2
@ -88,11 +81,11 @@ dec bh
je outes je outes
cmp [sizex2],0 cmp [sizex2],0
je lines je lines
call [addline] invoke addline
jmp lines jmp lines
outes: outes:
call [setxy],0,[word ptr lastline] invoke setxy,0,word [lastline]
call [print],offset menu invoke print, menu
waitkey: waitkey:
mov ax,0 mov ax,0
int 16h int 16h
@ -128,9 +121,9 @@ jmp adres
suit6: suit6:
cmp ax,4100h cmp ax,4100h
jne suit7 jne suit7
mov [dword ptr pope],'TIDE' mov dword [pope],'TIDE'
call [setxy],0,[word ptr lastline] invoke setxy,0,word [lastline]
call [print],offset menu invoke print, menu
mov ax,0B800h mov ax,0B800h
mov es,ax mov es,ax
mov [xxyy2],3 mov [xxyy2],3
@ -142,7 +135,7 @@ mov ax,0
int 16h int 16h
cmp ah,41h cmp ah,41h
jne tre jne tre
mov [dword ptr pope],' EUV' mov dword [pope],' EUV'
push cs push cs
pop es pop es
jmp adres jmp adres
@ -187,7 +180,7 @@ call calc1
call calc2 call calc2
mov edi,[es:bx-1] mov edi,[es:bx-1]
mov dx,[es:si-1] mov dx,[es:si-1]
mov [byte ptr es:bx],0112 mov byte [es:bx],0112
mov [es:bx-1],al mov [es:bx-1],al
writs: writs:
mov ax,0 mov ax,0
@ -209,12 +202,12 @@ mov cl,[gs:bx]
cmp ch,cl cmp ch,cl
je no je no
push si ax push si ax
call [setxy],0,[word ptr lastline] invoke setxy,0,word [lastline]
call [print],offset msg invoke print, msg
mov ax,0 mov ax,0
int 16h int 16h
call [setxy],0,[word ptr lastline] invoke setxy,0,word [lastline]
call [print],offset menu invoke print, menu
pop bx si pop bx si
mov [es:bx-1],edi mov [es:bx-1],edi
mov [es:si-1],dx mov [es:si-1],dx
@ -235,7 +228,7 @@ jmp waitst
suit7: suit7:
cmp ax,4200h cmp ax,4200h
jne adres jne adres
call [restorestate] invoke restorestate
retf retf
calc1: calc1:
push ax dx si push ax dx si
@ -251,11 +244,11 @@ shl bx,5
shl dx,7 shl dx,7
add bx,dx add bx,dx
add bx,ax add bx,ax
mov [byte ptr es:bx],112 mov byte [es:bx],112
mov [byte ptr es:bx+2],112 mov byte [es:bx+2],112
mov si,[xxyy] mov si,[xxyy]
mov [byte ptr es:si],07 mov byte [es:si],07
mov [byte ptr es:si+2],07 mov byte [es:si+2],07
mov [xxyy],bx mov [xxyy],bx
pop si dx ax pop si dx ax
ret ret
@ -270,9 +263,9 @@ mov dx,[xx]
shl dx,1 shl dx,1
add si,dx add si,dx
add si,129 add si,129
mov [byte ptr es:si],112 mov byte [es:si],112
mov bx,[xxyy2] mov bx,[xxyy2]
mov [byte ptr es:bx],07 mov byte [es:bx],07
mov [xxyy2],si mov [xxyy2],si
pop dx bx ax pop dx bx ax
ret ret
@ -330,7 +323,7 @@ spaces2 db '\c04 | \c07',0
showbuffer db 35 dup (0FFh) showbuffer db 35 dup (0FFh)
oldmode db 0 oldmode db 0
infos vgainf <> infos vgainf
importing importing
use VIDEO,setvideomode use VIDEO,setvideomode
@ -346,10 +339,3 @@ use VIDEO.LIB,showhex
use VIDEO.LIB,showchar use VIDEO.LIB,showchar
endi endi

View File

@ -1,9 +1,3 @@
model tiny,stdcall
p586N
locals
jumps
codeseg
option procalign:byte
include "..\include\mem.h" include "..\include\mem.h"
include "..\include\divers.h" include "..\include\divers.h"
@ -11,16 +5,16 @@ include "..\include\divers.h"
org 0h org 0h
start: start:
header exe <"CE",1,0,0,,offset imports,,offset realstart> header exe 1
realstart: realstart:
call [print],offset message invoke print,message
call [waitkey] invoke waitkey
retf retf
message db 'Appel de la librairie \c02video\c07 et de la librairie \c02EXEM-LIB.LIB\c07 !',0 message db 'Appel de la librairie \c02video\c07 et de la librairie \c02EXEM-LIB.LIB\c07 !',0
importing importing
use VIDEO.LIB,print use VIDEO.LIB,print
use EXEM-LIB.LIB,waitkey use LIB.LIB,waitkey
endi endi

View File

@ -1,10 +1,3 @@
model tiny,stdcall
p586N
locals
jumps
codeseg
option procalign:byte
include "..\include\mem.h" include "..\include\mem.h"
include "..\include\fat.h" include "..\include\fat.h"
include "..\include\divers.h" include "..\include\divers.h"
@ -13,35 +6,35 @@ include "..\include\graphic.h"
org 0h org 0h
start: start:
header exe <"CE",1,0,0,,offset imports,,offset realstart> header exe 1
realstart: realstart:
call [saveparamto],offset infos invoke saveparamto, infos
call [print],offset msg1 invoke print, msg1
call [initdrive] invoke initdrive
xor bp,bp xor bp,bp
call [findfirstfile],offset bufferentry invoke findfirstfile, bufferentry
jc nofiles jc nofiles
go: go:
push [word bufferentry.result.fileattr] push word [bufferentry.result.fileattr]
push [bufferentry.result.filesize] push [bufferentry.result.filesize]
push [bufferentry.result.filetime] push [bufferentry.result.filetime]
push [bufferentry.result.filedate] push [bufferentry.result.filedate]
push [bufferentry.result.filetimecrea] push [bufferentry.result.filetimecrea]
push [bufferentry.result.filedatecrea] push [bufferentry.result.filedatecrea]
mov bx,offset bufferentry.result.filename mov bx,bufferentry.result.filename
push bx push bx
push offset line push line
call [print] invoke print
call [findnextfile],offset bufferentry invoke findnextfile, bufferentry
jc nofiles jc nofiles
inc bp inc bp
jmp go jmp go
nofiles: nofiles:
call [print],offset menu invoke print, menu
mov [xx],1 mov [xx],1
call changelineattr,[xx],112 stdcall changelineattr,[xx],112
endof: endof:
mov ax,0 mov ax,0
int 16h int 16h
@ -49,18 +42,18 @@ endof:
jne tre1 jne tre1
cmp [xx],bp cmp [xx],bp
ja endof ja endof
call changelineattr,[xx],7 stdcall changelineattr,[xx],7
inc [xx] inc [xx]
call changelineattr,[xx],112 stdcall changelineattr,[xx],112
jmp endof jmp endof
tre1: tre1:
cmp ah,48h cmp ah,48h
jne tre2 jne tre2
cmp [xx],1 cmp [xx],1
je endof je endof
call changelineattr,[xx],7 stdcall changelineattr,[xx],7
dec [xx] dec [xx]
call changelineattr,[xx],112 stdcall changelineattr,[xx],112
jmp endof jmp endof
tre2: tre2:
cmp al,0Dh cmp al,0Dh
@ -75,26 +68,24 @@ tre4:
retf retf
;couleur al pour ligne %0 en %1 ;couleur al pour ligne %0 en %1
PROC changelineattr near proc changelineattr uses ax bx di es,line:word,attr:word
USES ax,bx,di,es
ARG @line:word,@attr:word
mov ax,0B800h mov ax,0B800h
mov es,ax mov es,ax
mov ax,[@line] mov ax,[line]
add ax,3 add ax,3
mul [cs:infos.columns] mul [cs:infos.columns]
mov di,ax mov di,ax
shl di,1 shl di,1
mov al,[cs:infos.columns] mov al,[cs:infos.columns]
inc di inc di
mov bx,[@attr] mov bx,[attr]
@@popep: popep:
mov [es:di],bl mov [es:di],bl
add di,2 add di,2
dec al dec al
jnz @@popep jnz popep
ret retf
endp changelineattr endp
xx dw 1 xx dw 1
xxold dw 0 xxold dw 0
@ -104,8 +95,8 @@ msg1 db '\e\g00,00\c70 Gestionnaire de fichier Version 1.5
db '\g00,02Nom Ext. Date creation Date modification Taille Attributs' db '\g00,02Nom Ext. Date creation Date modification Taille Attributs'
db '\g00,03-------------------------------------------------------------------------------\l',0 db '\g00,03-------------------------------------------------------------------------------\l',0
line db '\c07%n %d %t %d %t %z %a\l',0 line db '\c07%n %d %t %d %t %z %a\l',0
bufferentry find <> bufferentry find
infos vgainf <> infos vgainf
importing importing
use VIDEO.LIB,print use VIDEO.LIB,print

View File

@ -1,17 +1,10 @@
model tiny,stdcall
p586N
locals
jumps
codeseg
option procalign:byte
include "..\include\mem.h" include "..\include\mem.h"
include "..\include\divers.h" include "..\include\divers.h"
org 0h org 0h
start: start:
header exe <"CE",1,0,0,,,,offset realstart> header exe 1
realstart: realstart:
retf retf

View File

@ -1,69 +1,62 @@
model tiny,stdcall
p586N
locals
jumps
codeseg
option procalign:byte
include "..\include\mem.h" include "..\include\mem.h"
include "..\include\divers.h" include "..\include\divers.h"
org 0h org 0h
start: start:
header exe <"CE",1,0,0,,offset imports,,offset realstart> header exe 1
realstart: realstart:
call [cs:mballoc],65535 invoke mballoc,65535
jc problem3 jc problem3
push ax push ax
pop es pop es
call [cs:projfile],offset logo invoke projfile,logo
jc problem jc problem
mov ecx,eax mov ecx,eax
call [cs:mbfind],offset logo invoke mbfind,logo
jc problem jc problem
call [cs:decompressrle],ax,0,es,0,cx invoke decompressrle,ax,0,es,0,cx
jc problem2 jc problem2
push es push es
pop ds pop ds
call [cs:savestate] invoke savestate
call [cs:setvideomode],word 8 invoke setvideomode,word 8
call [cs:clearscreen] invoke clearscreen
call [cs:loadbmppalet],word 0 invoke loadbmppalet,word 0
call [cs:showbmp],word 0,word 20,word 150 invoke showbmp,word 0,word 20,word 150
jc problem4 jc problem4
push cs push cs
pop ds pop ds
call [cs:print],offset poper invoke print,poper
endofit: endofit:
xor ax,ax xor ax,ax
int 16h int 16h
call [cs:restorestate] invoke restorestate
retf retf
problem: problem:
push cs push cs
pop ds pop ds
call [cs:print],offset error invoke print, error
jmp endofit jmp endofit
problem2: problem2:
push cs push cs
pop ds pop ds
call [cs:print],offset error2 invoke print, error2
jmp endofit jmp endofit
problem3: problem3:
push cs push cs
pop ds pop ds
call [cs:print],offset error3 invoke print, error3
jmp endofit jmp endofit
problem4: problem4:
push cs push cs
pop ds pop ds
call [cs:print],offset error4 invoke print, error4
jmp endofit jmp endofit
poper db '\c0BC\c0CO\c0DS\c0E2\c0E0\c0E0\c0F0 en mode graphique',0 poper db '\c0BC\c0CO\c0DS\c0E2\c0E0\c0E0\c0F0 en mode graphique',0

View File

@ -1,471 +0,0 @@
.model tiny
.486
smart
.code
org 0100h
start:
;call setemettor
call getfirstlpt
call initlpt
call receivecommand
ret
gogo db 'Salut'
gotoz db 23 dup (0)
;Re‡ois une commande et l'execute
Receivecommand:
push ax bx cx di es
push cs
pop es
mov di,offset command
call receivelptblock
mov bl,al
xor bh,bh
shl bx,1
add bx,offset cmd
call [bx]
pop es di cx ax
ret
command db 25 dup (0)
cmd dw nothings
dw sendram
nothings:
ret
Sendram:
push ax cx si ds
mov ax,es:[di]
mov si,ax
mov ax,es:[di+2]
mov ds,ax
mov cx,es:[di+2]
call sendlptblock
pop ds si cx ax
ret
;---------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
tokenstart equ 0
tokennext equ 1
tokenstop equ 2
tokenbad equ 3
tokenresend equ 4
Initlpt:
push ax ecx
call StartTimer
cmp 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,ax
ret
timeout dw tensec
getTimeout:
mov ax,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 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,times
mov ecx,0
pop ds ax
ret
;->
GetLptOut:
push dx
mov dx,lpt
in al,dx
pop dx
ret
GetLptIn:
push dx
mov dx,lpt
inc dx
in al,dx
shr al,3
pop dx
ret
GetLptInOut:
push dx
mov dx,lpt
add dx,2
in al,dx
and al,11111b
pop dx
ret
SetLptOut:
push dx
mov dx,lpt
out dx,al
pop dx
ret
SetLptIn:
push dx
mov dx,lpt
inc dx
out dx,al
pop dx
ret
SetLptInOut:
push dx
mov dx,lpt
add dx,2
out dx,al
pop dx
ret
;Ralise un checksum 8 bits sur donnes DS:SI, nb CX rsultat dans dl
Checksum8:
push cx si
check:
add dl,[si]
inc si
dec cx
jnz check
pop si cx
ret
;DS:SI pointeur sur donnes, CX nombres de donnes, 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 donnes au nombres de CX token AL (AH) (ECX)
receiveLptBlock:
push ax 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 ax
ret
end start;

View File

@ -1,12 +0,0 @@
program Project1;
uses
Forms,
Unit1 in 'UNIT1.PAS' {Form1};
{$R *.RES}
begin
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

View File

@ -1,34 +0,0 @@
[Compiler]
A=1
B=0
D=1
F=0
I=1
K=1
L=1
P=1
Q=0
R=0
S=1
T=0
U=1
V=1
W=0
X=1
Y=1
[Linker]
MapFile=0
LinkBuffer=0
DebugInfo=0
OptimizeExe=0
StackSize=16384
HeapSize=8192
[Directories]
OutputDir=
SearchPath=
Conditionals=
[Parameters]
RunParams=

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,517 +0,0 @@
unit Unit1;
interface
uses
SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
Forms, Dialogs, StdCtrls, Grids, Outline, DirOutln, FileCtrl, Buttons,
Gauges, ExtCtrls, Spin, Mask;
type
TForm1 = class(TForm)
DriveComboBox1: TDriveComboBox;
FilterComboBox1: TFilterComboBox;
FileListBox1: TFileListBox;
DirectoryListBox1: TDirectoryListBox;
SpeedButton1: TSpeedButton;
SpeedButton2: TSpeedButton;
Memo1: TMemo;
Memo2: TMemo;
Memo3: TMemo;
SpeedButton3: TSpeedButton;
SpeedButton4: TSpeedButton;
Gauge1: TGauge;
SpeedButton5: TSpeedButton;
SpeedButton6: TSpeedButton;
SpinButton1: TSpinButton;
MaskEdit1: TMaskEdit;
SpeedButton8: TSpeedButton;
SpinButton2: TSpinButton;
okm: TCheckBox;
Label1: TLabel;
procedure FormActivate(Sender: TObject);
procedure SpinButton1DownClick(Sender: TObject);
procedure SpinButton1UpClick(Sender: TObject);
procedure showadress(Sender: TObject);
procedure SpeedButton6Click(Sender: TObject);
procedure SpeedButton8Click(Sender: TObject);
procedure MaskEdit1Change(Sender: TObject);
procedure SpinButton2DownClick(Sender: TObject);
procedure SpinButton2UpClick(Sender: TObject);
procedure SpeedButton3Click(Sender: TObject);
procedure Memo2Click(Sender: TObject);
private
{ Private-déclarations }
public
{ Public-déclarations }
end;
const UNESEC = 1000;
DIXSEC = 4000;
ACK = $00;
NAK = $FF;
MAXTRY = 5;
type DBloc = array[ 1..15534 ] of byte;
type BHEADER = record
case boolean of
true : ( Checksum:byte;
Lenb : byte;
Lenh : byte;
Token : byte;
);
false : ( Champ : array[ 0..3 ] of byte );
end;
var
Form1: TForm1;
Inlpt : word;
Outlpt : word;
times : longint;
Block : DBLOC;
adress :longint;
errors: boolean;
reste:integer;
pop:boolean;
implementation
{$R *.DFM}
function Getlpt( Number : integer ) : boolean;
begin
Outlpt := MemW[ $0040: 6 + Number * 2 ];
if ( Outlpt <> 0 ) then
begin
Inlpt := Outlpt + 1;
Getlpt := TRUE;
end
else
Getlpt := FALSE;
end;
function getfirstlpt:byte;
var i:integer;
begin
i:=1;
while (not(getlpt(i)) or (i>4)) do inc(i);
if (getlpt(i)=false) then i:=0;
getfirstlpt:= i;
end;
function getb:byte;
begin
getb:=port[inlpt] and $F8
end;
procedure putb(what:byte);
begin
port[outlpt]:=what;
end;
procedure starttimer;
begin
times:=GetTickCount;
end;
function endtimer:longint;
begin
endtimer:=getTickCount-times;
end;
function Initlpt( Emetteur : boolean ) : boolean;
begin
errors:=false;
putb($10);
putb($18);
putb($10);
starttimer;
if ( Emetteur ) then
begin
while ( ( GetB <> $00 ) and ( Endtimer <= DIXSEC ) ) do;
end
else
begin
while ( ( GetB <> $00 ) and ( Endtimer <= DIXSEC ) ) do;
PutB( $10 );
end;
Initlpt := ( Endtimer <= DIXSEC );
end;
function sendlpt( Wert : byte ) : boolean;
var Retour : byte;
label fin;
begin
if errors then goto fin;
Starttimer;
PutB( Wert and $0F );
while ( ( ( GetB and 128 ) = 0 ) and ( Endtimer <= DIXSEC )) do;
if ( Endtimer > DIXSEC ) then
begin
errors:=true;
goto fin;
end;
Retour := ( GetB shr 3 ) and $0F;
Starttimer;
PutB( ( Wert shr 4 ) or $10 );
while ( ( ( GetB and 128 ) <> 0 ) and ( Endtimer <= DIXSEC ) ) do
if ( Endtimer > DIXSEC ) then
begin
errors:=true;
goto fin;
end;
Retour := Retour or ( ( GetB shl 1 ) and $F0 );
fin:
sendlpt := ( Wert = Retour );
end;
function receivelpt : byte;
var LoNib,
HiNib : byte;
label fin;
begin
if errors then goto fin;
Starttimer;
while ( ( ( GetB and 128 ) = 0 ) and ( Endtimer <= DIXSEC )) do;
if ( Endtimer > DIXSEC ) then
begin
errors:=true;
goto fin;
end;
LoNib := ( GetB shr 3 ) and $0F;
PutB( LoNib );
Starttimer;
while ( ( ( GetB and 128 ) <> 0 ) and ( Endtimer <= DIXSEC ) ) do;
if ( Endtimer > DIXSEC ) then
begin
errors:=true;
goto fin;
end;
HiNib := ( GetB shl 1 ) and $F0;
PutB( ( HiNib shr 4 ) or $10 );
fin:
receivelpt := ( LoNib or HiNib );
end;
function checksum8(Nombre:word;Dptr : pointer):byte ;
var donnees : ^DBloc ;
i:word;
ch:byte;
begin
ch:=0;
donnees:=dptr;
for i:=1 to Nombre do ch:=ch + Donnees^[ i ];
checksum8:=ch;
end;
function SendlptBlock( Token : byte;
Nombre : word;
Dptr : pointer ):boolean;
var header : BHEADER;
ok : boolean;
i : word;
trys : word;
Donnees : ^DBloc;
label fin;
begin
form1.gauge1.visible:=true;
header.Token := Token;
header.Lenb := (Nombre and $FF00) shr 8;
header.Lenh := Nombre and $FF;
header.Checksum:=checksum8(nombre,Dptr);
trys := MAXTRY;
repeat
ok := TRUE;
for i := 0 to 3 do
ok := ok and sendlpt( Header.Champ[ i ] );
if ( ok ) then
ok := ok and sendlpt( ACK )
else
ok := ok and sendlpt( NAK );
if ( not ok ) then
dec( trys );
until ( ( ok ) or ( trys = 0 ) or (errors));
if ( (trys = 0) or (errors)) then
begin
goto fin;
SendlptBlock:=false;
end;
if ( Nombre > 0 ) then
begin
Donnees := DPTR;
trys := MAXTRY;
repeat
ok := TRUE;
for i := Nombre downto 1 do
begin
ok := ok and sendlpt( Donnees^[ i ] );
reste:=trunc(100-i/nombre*100);
form1.gauge1.progress:=reste
end;
if ( ok ) then
ok := ok and sendlpt( ACK )
else
ok := ok and sendlpt( NAK );
if ( not ok ) then
dec( trys );
until ( ( ok ) or ( trys = 0 ) or (errors));
if ( (trys = 0) or (errors)) then
begin
goto fin;
SendlptBlock:=false;
end;
end;
SendlptBlock:=true;
fin:
form1.gauge1.visible:=false;
end;
function ReceivelptBlock( var Token : byte;
var Len : word;
Dptr : pointer ):boolean;
var header : BHEADER;
ok : boolean;
i : word;
trys : word;
EscapeStatus : boolean;
ByteBuffer : byte;
Donnees : ^DBloc;
label fin,good;
begin
form1.gauge1.visible:=true;
trys := MAXTRY;
repeat
for i:= 0 to 3 do
Header.Champ[ i ] := receivelpt;
ByteBuffer := receivelpt;
if ( ByteBuffer <> ACK ) then
dec( trys );
until ( ( trys = 0 ) or ( ByteBuffer = ACK ) or (errors));
if ( (trys = 0) or (errors)) then
begin
goto fin;
receivelptblock:=false;
end;
Token := Header.Token;
Len := Header.Lenh+(Header.Lenb shl 8);
if ( Len > 0 ) then
begin
Donnees := Dptr;
trys := MAXTRY;
repeat
for i := len downto 1 do
begin
Donnees^[ i ] := receivelpt;
reste:=trunc(100-i/len*100);
form1.gauge1.progress:=reste
end;
ByteBuffer := receivelpt;
if ( ByteBuffer <> ACK ) then
dec( trys );
until ( ( trys = 0 ) or ( ByteBuffer = ACK ) );
if ( trys = 0 ) then
begin
goto fin;
receivelptblock:=false;
end;
end;
receivelptblock:=true;
fin:
form1.gauge1.visible:=false;
end;
function Sendfile(name:string):boolean;
var lus:word;
Fichier:file;
begin
assign( Fichier, Name );
reset( Fichier, 1 );
Blockread( Fichier, Block, 15000, Lus );
if lus>0 then
Sendfile:=SendlptBlock( 1, Lus, @Block )
else
Sendfile:=false;
end;
procedure TForm1.FormActivate(Sender: TObject);
begin
adress:=0;
showadress(sender);
Memo2Click(Sender);
SpeedButton8Click(Sender);
pop:=true;
end;
procedure TForm1.SpinButton1DownClick(Sender: TObject);
begin
if (adress>0) and okm.checked then
begin
dec(adress);
SpeedButton6Click(Sender);
end;
end;
procedure TForm1.SpinButton1UpClick(Sender: TObject);
begin
if (adress<65536*16) and okm.checked then
begin
inc(adress);
SpeedButton6Click(Sender);
end;
end;
function hextoint(hex:string;n:word):longint;
var
resu,exp:longint;
i:word;
begin
hex :=UpperCase(hex);
resu:=0;
exp:=1;
for i:=n downto 1 do
begin
resu:=resu+(Pos(hex[i],'0123456789ABCDEF')-1)*(exp);
exp:=exp*16
end;
hextoint:=resu;
end ;
function adresstoint(hex:string):longint;
begin
adresstoint:=hextoint(Copy(hex, 1, 4),4)shl 4 + hextoint(Copy(hex, length(hex)-3, 4),4)
end;
procedure TForm1.showadress(Sender: TObject);
var i,j,adh,adl:word;
adress2:longint;
old,old2:string;
begin
memo1.clear;
memo2.clear;
memo3.clear;
for i:=0 to 29 do
begin
adress2:=adress+i*16;
adl:=adress2 and $FFFF;
adh:=(adress2 and $F0000) shr 4;
memo1.lines.add(IntToHex(adh,4)+':'+IntToHex(adl,4)) ;
old:='';
old2:='';
for j:=1 to 16 do
begin
old:=old+inttohex(block[i*16+j],2);
if block[i*16+j]=0 then
old2:=old2+'.'
else
old2:=old2+char(block[i*16+j]) ;
if j mod 2=0 then old:=old+' ';
end;
memo2.lines.add(old) ;
memo3.lines.add(old2) ;
end
end;
procedure TForm1.SpeedButton8Click(Sender: TObject);
begin
if getfirstlpt=0 then showmessage('Pas de port parallèle détecté');
errors:=false;
end;
procedure TForm1.SpeedButton6Click(Sender: TObject);
var adl,adh,good:word;
tok:byte;
ok:boolean;
begin
if (inlpt=0) then SpeedButton8Click(sender);
if ((inlpt<>0) and (initlpt(true))) then
begin
adl:=adress and $FFFF;
adh:=(adress and $F0000) shr 4;
Block[1]:=lo(adl);
Block[2]:= hi(adl);
Block[3]:= lo(adh);
Block[4]:= hi(adh);
Block[5]:= lo(512);
Block[6]:= hi(512) ;
ok:=false;
if SendlptBlock( 1,6,@Block) then ok:=receivelptBlock(tok,good ,@Block); {demande de RAM}
if not(ok) or errors then Showmessage('Erreur de transmission !!!!!!!!!!');
showadress(sender);
end
else
Showmessage('Pas de PC distant');
putb($08);
errors:=false;
end;
procedure TForm1.MaskEdit1Change(Sender: TObject);
begin
if pop then
begin
adress:=adresstoint(maskedit1.text);
if okm.checked=true then SpeedButton6Click(sender);
showadress(sender);
end;
end;
procedure TForm1.SpinButton2DownClick(Sender: TObject);
begin
if (adress+16*30<=65536*16) and okm.checked then
begin
adress:=adress+16*30;
SpeedButton6Click(Sender);
end;
end;
procedure TForm1.SpinButton2UpClick(Sender: TObject);
begin
if (adress-16*30>=0) and okm.checked then
begin
adress:=adress-16*30;
SpeedButton6Click(Sender);
end;
end;
procedure TForm1.SpeedButton3Click(Sender: TObject);
var adl,adh,good:word;
adress2:longint;
tok:byte;
ok:boolean;
begin
if (inlpt=0) then SpeedButton8Click(sender);
if ((inlpt<>0) and (initlpt(true))) then
begin
adress2 :=adresstoint(maskedit1.text);
adl:=adress2 and $FFFF;
adh:=(adress2 and $F0000) shr 4;
Block[1]:=lo(adl);
Block[2]:= hi(adl);
Block[3]:= lo(adh);
Block[4]:= hi(adh);
ok:=SendlptBlock( 7,4,@Block);
if not(ok) or errors then Showmessage('Erreur de transmission !!!!!!!!!!');
end
else
Showmessage('Pas de PC distant');
putb($18);
errors:=false;
end;
procedure TForm1.Memo2Click(Sender: TObject);
var ligne,col,pos,adl,adh:word;
adress2:longint;
begin
ligne:=memo2.selstart div 42;
col:= (trunc((memo2.selstart mod 42+1) / 2.5));
pos:=16*ligne+col;
label1.caption:=inttostr(ligne)+':'+inttostr(col)+':'+inttostr(pos);
adress2:=pos+adress;
adl:=adress2 and $FFFF;
adh:=(adress2 and $F0000) shr 4;
pop:=false;
maskedit1.text:=inttohex(adh,4)+':'+inttohex(adl,4);
pop:=true;
end;
end.

View File

@ -1,23 +1,14 @@
asm= lzasm /z/t ASM=fasm
lnk= elink CLEAN=rm -rf
OBJS= $(SRCS:.c=.o)
SRC= $(wildcard *.asm)
PROG= $(SRC:.asm=.ce)
all: exem-lib.lib exem-ce.ce pmode.ce isa.ce editeur.ce volume.ce test.ce verifier.ce gestion.ce logo.ce souris.ce test3d.ce test2d.ce all: $(PROG)
sync
.asm.obj: %.ce: %.asm
$(asm) $< $(ASM) $^ $@
.obj.ce:
$(lnk) $< $*.ce
.obj.lib:
$(lnk) $< $*.lib
clean: clean:
del *.obj $(CLEAN) *.ce
del *.ce
del *.bak
del *.lib
del *.com
del *.bin
del *.sys
del *.err

View File

@ -1,17 +1,10 @@
model tiny,stdcall
p586N
locals
jumps
codeseg
option procalign:byte
include "..\include\mem.h" include "..\include\mem.h"
include "..\include\divers.h" include "..\include\divers.h"
org 0h org 0h
start: start:
header exe <"CE",1,0,0,,,,offset realstart> header exe 1
realstart: realstart:
mov eax,cr0 mov eax,cr0

View File

@ -1,26 +1,19 @@
model tiny,stdcall
p586N
locals
jumps
codeseg
option procalign:byte
include "..\include\mem.h" include "..\include\mem.h"
include "..\include\divers.h" include "..\include\divers.h"
org 0h org 0h
start: start:
header exe <"CE",1,0,0,,offset imports,,offset realstart> header exe 1
realstart: realstart:
call [mouseon] invoke mouseon
jc errormouse jc errormouse
call [print],offset message invoke print, message
retf retf
errormouse: errormouse:
call [print],offset errormessage invoke print, errormessage
retf retf
message db 'Activation de la souris\l',0 message db 'Activation de la souris\l',0

View File

@ -1,27 +1,20 @@
model tiny,stdcall
p586N
locals
jumps
codeseg
option procalign:byte
include "..\include\mem.h" include "..\include\mem.h"
include "..\include\divers.h" include "..\include\divers.h"
org 0h org 0h
start: start:
header exe <"CE",1,0,0,,offset imports,,offset realstart> header exe 1
realstart: realstart:
call [cs:randomize] invoke randomize
push 0FFFFh push 0FFFFh
pushd 652201 pushd 652201
pushd 1545454545 pushd 1545454545
push 1523 push 1523
push 2041 push 2041
push offset zero push zero
push offset fixe push fixe
push 5 push 5
push 'i' push 'i'
push 'a' push 'a'
@ -31,71 +24,71 @@ realstart:
pushd 125645 pushd 125645
pushd 5041 pushd 5041
pushd 125645 pushd 125645
push offset message push message
call [print] invoke print
xor ax,ax xor ax,ax
int 16h int 16h
call [clearscreen] invoke clearscreen
call [xchgpages] invoke xchgpages
call [clearscreen] invoke clearscreen
mov cx,200 mov cx,200
go1: go1:
call [xchgpages] invoke xchgpages
call [waitretrace] invoke waitretrace
call [print],offset textdemo1 invoke print, textdemo1
call put invoke put
call [xchgpages] invoke xchgpages
call [waitretrace] invoke waitretrace
dec cx dec cx
jnz go1 jnz go1
mov cx,200 mov cx,200
go2: go2:
call [xchgpages] invoke xchgpages
call [waitretrace] invoke waitretrace
call [print],offset textdemo2 invoke print, textdemo2
call put invoke put
call [xchgpages] invoke xchgpages
call [waitretrace] invoke waitretrace
dec cx dec cx
jnz go2 jnz go2
mov cx,200 mov cx,200
go3: go3:
call [xchgpages] invoke xchgpages
call [waitretrace] invoke waitretrace
call [print],offset textdemo3 invoke print, textdemo3
call put invoke put
call [xchgpages] invoke xchgpages
call [waitretrace] invoke waitretrace
dec cx dec cx
jnz go3 jnz go3
call [clearscreen] invoke clearscreen
call [xchgpages] invoke xchgpages
call [clearscreen] invoke clearscreen
call [print],offset texte2 invoke print, texte2
mov bp,255 mov bp,255
xor edx,edx xor edx,edx
go4: go4:
call [xchgpages] invoke xchgpages
call [waitretrace] invoke waitretrace
inc edx inc edx
push edx push edx
push offset texte3 push texte3
call [print] invoke print
call [xchgpages] invoke xchgpages
call [waitretrace] invoke waitretrace
dec bp dec bp
jnz go4 jnz go4
push offset texte4 push texte4
call [print] invoke print
mov ax,0 mov ax,0
int 16h int 16h
call [restorestate] invoke restorestate
retf retf
put: put:
call [cs:random] invoke random
mov di,ax mov di,ax
and di,4096-2 and di,4096-2
mov si,offset fond mov si,fond
call showstring2 call showstring2
ret ret

View File

@ -1,55 +1,48 @@
model tiny,stdcall include "..\include\mem.h"
p586N include "..\include\fat.h"
locals include "..\include\divers.h"
jumps include "..\include\3d.h"
codeseg
option procalign:byte org 0h
include "..\include\mem.h" start:
include "..\include\fat.h" header exe 1
include "..\include\divers.h"
include "..\include\3d.h" realstart:
invoke randomize
org 0h invoke savestate
invoke setvideomode,10
start: invoke clearscreen
header exe <"CE",1,0,0,,offset imports,,offset realstart> mov cx,65535
show:
realstart: invoke random
call [cs:randomize] and ax,1111b
call [cs:savestate] push ax
call [cs:setvideomode],10 invoke random
call [cs:clearscreen] push ax
mov cx,65535 invoke random
show: push ax
call [cs:random] invoke random
and ax,1111b push ax
push ax invoke random
call [cs:random] push ax
push ax invoke line
call [cs:random] dec cx
push ax jnz show
call [cs:random] invoke bioswaitkey
push ax invoke restorestate
call [cs:random] retf
push ax
call [cs:line] importing
dec cx use VIDEO.LIB,print
jnz show use VIDEO,savestate
call [cs:bioswaitkey] use VIDEO,clearscreen
call [cs:restorestate] use VIDEO,setvideomode
retf use VIDEO,restorestate
use VIDEO,waitretrace
importing use GRAPHIC,line ;@x1:word,@y1:word,@x2:word,@y2:word,@color:word
use VIDEO.LIB,print use GRAPHIC,polyfill ;@pointer:word,@nbfaces:word,@color:word;
use VIDEO,savestate use SYSTEME,bioswaitkey
use VIDEO,clearscreen use MATH.LIB,randomize
use VIDEO,setvideomode use MATH.LIB,random
use VIDEO,restorestate endi
use VIDEO,waitretrace
use GRAPHIC,line ;@x1:word,@y1:word,@x2:word,@y2:word,@color:word
use GRAPHIC,polyfill ;@pointer:word,@nbfaces:word,@color:word;
use SYSTEME,bioswaitkey
use MATH.LIB,randomize
use MATH.LIB,random
endi

View File

@ -1,245 +1,230 @@
model tiny,stdcall include "..\include\mem.h"
p586N include "..\include\fat.h"
locals include "..\include\divers.h"
jumps include "..\include\3d.h"
codeseg
option procalign:byte org 0h
include "..\include\mem.h" start:
include "..\include\fat.h" header exe 1
include "..\include\divers.h"
include "..\include\3d.h" alldata:
camera vertex3d 320.0,240.0,70.0
org 0h
zoom dd 5.0
start: rot1 dd 0.1
header exe <"CE",1,0,0,,offset imports,,offset realstart> rot2 dd -0.1
data: vertexnbp dw 15
dd 0.0,0.0,0.0
camera vertex3d <320.0,240.0,70.0> dd 20.0,0.0,0.0
dd 24.0,0.0,0.0
zoom dd 5.0 dd 20.0,-2.0,0.0
rot1 dd 0.1 dd 20.0,2.0,0.0
rot2 dd -0.1 dd 0.0,0.0,0.0
dd 0.0,20.0,0.0
vertexnbp dw 15 dd 0.0,24.0,0.0
dd 0.0,0.0,0.0 dd -2.0,20.0,0.0
dd 20.0,0.0,0.0 dd 2.0,20.0,0.0
dd 24.0,0.0,0.0 dd 0.0,0.0,0.0
dd 20.0,-2.0,0.0 dd 0.0,0.0,20.0
dd 20.0,2.0,0.0 dd 0.0,0.0,24.0
dd 0.0,0.0,0.0 dd -2.0,-2.0,20.0
dd 0.0,20.0,0.0 dd 2.0,2.0,20.0
dd 0.0,24.0,0.0
dd -2.0,20.0,0.0 facenbp dw 6
dd 2.0,20.0,0.0 dw 0,1,1
dd 0.0,0.0,0.0 dw 2,4,3
dd 0.0,0.0,20.0 dw 5,6,6
dd 0.0,0.0,24.0 dw 7,9,8
dd -2.0,-2.0,20.0 dw 10,11,11
dd 2.0,2.0,20.0 dw 12,14,13
facenbp dw 6 vertexnbp2 dw 15
dw 0,1,1 dd 0.0,0.0,0.0
dw 2,4,3 dd 20.0,0.0,0.0
dw 5,6,6 dd 24.0,0.0,0.0
dw 7,9,8 dd 20.0,-2.0,0.0
dw 10,11,11 dd 20.0,2.0,0.0
dw 12,14,13 dd 0.0,0.0,0.0
dd 0.0,20.0,0.0
vertexnbp2 dw 15 dd 0.0,24.0,0.0
dd 0.0,0.0,0.0 dd -2.0,20.0,0.0
dd 20.0,0.0,0.0 dd 2.0,20.0,0.0
dd 24.0,0.0,0.0 dd 0.0,0.0,0.0
dd 20.0,-2.0,0.0 dd 0.0,0.0,20.0
dd 20.0,2.0,0.0 dd 0.0,0.0,24.0
dd 0.0,0.0,0.0 dd -2.0,-2.0,20.0
dd 0.0,20.0,0.0 dd 2.0,2.0,20.0
dd 0.0,24.0,0.0
dd -2.0,20.0,0.0
dd 2.0,20.0,0.0 mat1 mat
dd 0.0,0.0,0.0 mat2 mat
dd 0.0,0.0,20.0 mat3 mat
dd 0.0,0.0,24.0 matrixp mat
dd -2.0,-2.0,20.0
dd 2.0,2.0,20.0 mode db 0
objectp:
mat1 mat <?> vertexp equ objectp+15
mat2 mat <?> facep equ vertexp+20000
mat3 mat <?> screen equ facep+20000
matrixp mat <?>
realstart:
mode db 0 invoke savestate
invoke setvideomode,10
objectp: invoke clearscreen
vertexp equ objectp+15 invoke mballoc,65535
facep equ vertexp+20000 mov es,ax
screen equ facep+20000 mov si, alldata
mov di,si
;typep db ? mov ecx,( realstart- alldata)
;objectp db 15 dup (?) shr ecx,2
;vertexp db 1000*4*3+2 dup (?) inc ecx
;facep db 2000*3+2 dup (?) cld
;screen db 1000*2*2 dup (?) rep movsd
invoke projfile, filename
jc errorloading
realstart: invoke mbfind, filename
call [cs:savestate] jc errorloading
call [cs:setvideomode],10 push es
call [cs:clearscreen] pop ds
call [cs:mballoc],65535 mov es,ax
mov es,ax invoke load3ds,es,0, objectp, vertexp, matrixp, facep
mov si,offset data invoke transform, vertexnbp, matrixp
mov di,si invoke identity, mat1
mov ecx,(offset realstart-offset data) jmp show
shr ecx,2 rool:
inc ecx mov ah,1
cld int 16h
rep movsd jz rool
call [cs:projfile],offset filename xor ax,ax
jc errorloading int 16h
call [cs:mbfind],offset filename cmp ax,011Bh
jc errorloading je endee
push es cmp ax,3B00h
pop ds jne notmode
mov es,ax inc [mode]
call [cs:load3ds],es,0,offset objectp,offset vertexp,offset matrixp,offset facep cmp [mode],3
call [cs:transform],offset vertexnbp,offset matrixp jb notmodify
call [cs:identity],offset mat1 mov [mode],0
jmp show jmp notmodify
rool: notmode:
mov ah,1 cmp ax,4800h
int 16h jne notup
jz rool invoke rotationx, mat1,[rot2]
xor ax,ax jmp show
int 16h notup:
cmp ax,011Bh cmp ax,5000h
je endee jne notdown
cmp ax,3B00h invoke rotationx, mat1,[rot1]
jne notmode jmp show
inc [mode] notdown:
cmp [mode],3 cmp ax,4B00h
jb notmodify jne notleft
mov [mode],0 invoke rotationy, mat1,[rot1]
jmp notmodify jmp show
notmode: notleft:
cmp ax,4800h cmp ax,4D00h
jne notup jne notright
call [cs:rotationx],offset mat1,[rot2] invoke rotationy, mat1,[rot2]
jmp show jmp show
notup: notright:
cmp ax,5000h cmp ax,4900h
jne notdown jne notupup
call [cs:rotationx],offset mat1,[rot1] invoke rotationz, mat1,[rot1]
jmp show jmp show
notdown: notupup:
cmp ax,4B00h cmp ax,5100h
jne notleft jne notdowndown
call [cs:rotationy],offset mat1,[rot1] invoke rotationz, mat1,[rot2]
jmp show jmp show
notleft: notdowndown:
cmp ax,4D00h cmp ax,4A2Dh
jne notright jne notminus
call [cs:rotationy],offset mat1,[rot2] fld [camera.tz]
jmp show fsub [zoom]
notright: fstp [camera.tz]
cmp ax,4900h jmp show
jne notupup notminus:
call [cs:rotationz],offset mat1,[rot1] cmp ax,4E2Bh
jmp show jne notmaxus
notupup: fld [camera.tz]
cmp ax,5100h fadd [zoom]
jne notdowndown fstp [camera.tz]
call [cs:rotationz],offset mat1,[rot2] jmp show
jmp show notmaxus:
notdowndown: invoke identity, mat1
cmp ax,4A2Dh jmp rool
jne notminus show:
fld [camera.tz] invoke transform, vertexp, mat1
fsub [zoom] invoke transform, vertexnbp, mat1
fstp [camera.tz] notmodify:
jmp show invoke clearscreen
notminus: invoke print, objectp
cmp ax,4E2Bh invoke draw3d_line,3, facenbp, vertexnbp, screen, camera,3
jne notmaxus invoke draw3d_line,3, facenbp, vertexnbp2, screen, camera,3
fld [camera.tz] cmp [mode],0
fadd [zoom] jne line
fstp [camera.tz] invoke draw3d_point, vertexp, screen, camera,4
jmp show jmp retrace
notmaxus: line:
call [cs:identity],offset mat1 cmp [mode],1
jmp rool jne hidden
show: invoke draw3d_line,3, facep, vertexp, screen, camera,4
call [cs:transform],offset vertexp,offset mat1 jmp retrace
call [cs:transform],offset vertexnbp,offset mat1 hidden:
notmodify: invoke draw3d_hidden,3, facep, vertexp, screen, camera,4
call [cs:clearscreen] retrace:
call [cs:print],offset objectp invoke waitretrace
call [cs:draw3d_line],3,offset facenbp,offset vertexnbp,offset screen,offset camera,3 invoke waitretrace
call [cs:draw3d_line],3,offset facenbp,offset vertexnbp2,offset screen,offset camera,3 jmp rool
cmp [mode],0 endee:
jne line invoke restorestate
call [cs:draw3d_point],offset vertexp,offset screen,offset camera,4 retf
jmp retrace
line: errorloading:
cmp [mode],1 push cs
jne hidden pop ds
call [cs:draw3d_line],3,offset facep,offset vertexp,offset screen,offset camera,4 invoke print, errorload
jmp retrace invoke bioswaitkey
hidden: jmp endee
call [cs:draw3d_hidden],3,offset facep,offset vertexp,offset screen,offset camera,4
retrace: errorload db '\c02Erreur au chargement du fichier 3D\l<Appuyez sur une touche>\c07',0
call [cs:waitretrace]
call [cs:waitretrace] filename find "SPHERE.3DS"
jmp rool
endee:
call [cs:restorestate] importing
retf use 3D.LIB,draw3d_point
use 3D.LIB,draw3d_line
errorloading: use 3D.LIB,draw3d_hidden
push cs use 3D.LIB,draw3d_hidden_fill
pop ds use 3D.LIB,load3ds
call [cs:print],offset errorload use 3D.LIB,translate
call [cs:bioswaitkey] use 3D.LIB,translatex
jmp endee use 3D.LIB,translatey
use 3D.LIB,translatez
errorload db '\c02Erreur au chargement du fichier 3D\l<Appuyez sur une touche>\c07',0 use 3D.LIB,scale
use 3D.LIB,rescale
filename find <"SPHERE.3DS",0,0,0,1,> use 3D.LIB,copy
use 3D.LIB,fill
use 3D.LIB,identity
importing use 3D.LIB,rotationx
use 3D.LIB,draw3d_point use 3D.LIB,rotationy
use 3D.LIB,draw3d_line use 3D.LIB,rotationz
use 3D.LIB,draw3d_hidden use 3D.LIB,rotation
use 3D.LIB,draw3d_hidden_fill use 3D.LIB,project
use 3D.LIB,load3ds use 3D.LIB,transform
use 3D.LIB,translate use 3D.LIB,multiply
use 3D.LIB,translatex use VIDEO,savestate
use 3D.LIB,translatey use VIDEO,clearscreen
use 3D.LIB,translatez use VIDEO,setvideomode
use 3D.LIB,scale use VIDEO,restorestate
use 3D.LIB,rescale use VIDEO,waitretrace
use 3D.LIB,copy use SYSTEME,bioswaitkey
use 3D.LIB,fill use SYSTEME,mbfind
use 3D.LIB,identity use SYSTEME,mballoc
use 3D.LIB,rotationx use VIDEO.LIB,print
use 3D.LIB,rotationy use DISQUE,projfile
use 3D.LIB,rotationz endi
use 3D.LIB,rotation
use 3D.LIB,project
use 3D.LIB,transform
use 3D.LIB,multiply
use VIDEO,savestate
use VIDEO,clearscreen
use VIDEO,setvideomode
use VIDEO,restorestate
use VIDEO,waitretrace
use SYSTEME,bioswaitkey
use SYSTEME,mbfind
use SYSTEME,mballoc
use VIDEO.LIB,print
use DISQUE,projfile
endi

View File

@ -1,21 +1,14 @@
model tiny,stdcall
p586N
locals
jumps
codeseg
option procalign:byte
include "..\include\mem.h" include "..\include\mem.h"
include "..\include\divers.h" include "..\include\divers.h"
org 0h org 0h
start: start:
header exe <"CE",1,0,0,,offset imports,,offset realstart> header exe 1
realstart: realstart:
call [savestate] invoke savestate
call [print],offset msg invoke print, msg
mov bp,1000h mov bp,1000h
xor di,di xor di,di
xor cx,cx xor cx,cx
@ -40,9 +33,9 @@ nokey:
div si div si
mov dx,ax mov dx,ax
push edx push edx
call [print],offset msg2 invoke print, msg2
call gauge call gauge
call [verifysector],cx invoke verifysector,cx
jc errors jc errors
je noprob je noprob
inc di inc di
@ -53,20 +46,20 @@ noprob:
enend: enend:
cmp di,0 cmp di,0
je noatall je noatall
call [print],offset error2 invoke print, error2
jmp someof jmp someof
noatall: noatall:
call [print],offset noerror invoke print, noerror
someof: someof:
mov ah,0 mov ah,0
int 16h int 16h
call [restorestate] invoke restorestate
retf retf
errors: errors:
call [print],offset error invoke print, error
mov ah,0 mov ah,0
int 16h int 16h
call [restorestate] invoke restorestate
retf retf
error db '\g10,10Erreur avec le lecteur de disquette !',0 error db '\g10,10Erreur avec le lecteur de disquette !',0
@ -88,10 +81,10 @@ gauge:
mov dx,ax mov dx,ax
push dx push dx
push 'Û' push 'Û'
push offset gauges push gauges
call [print] invoke print
pop dx ax pop dx ax
retn ret
max dw 2879 max dw 2879
sizeof dw 50 sizeof dw 50

View File

@ -1,10 +1,3 @@
model tiny,stdcall
p586N
locals
jumps
codeseg
option procalign:byte
include "..\include\mem.h" include "..\include\mem.h"
include "..\include\divers.h" include "..\include\divers.h"
include "..\include\graphic.h" include "..\include\graphic.h"
@ -12,29 +5,29 @@ include "..\include\graphic.h"
org 0h org 0h
start: start:
header exe <"CE",1,0,0,,offset imports,,offset realstart> header exe 1
realstart: realstart:
mov ax,0305h mov ax,0305h
mov bx,0008h mov bx,0008h
int 16h int 16h
call [savestate] invoke savestate
call [setvideomode],2 invoke setvideomode,2
xor ebp,ebp xor ebp,ebp
xor ax,ax xor ax,ax
mov fs,ax mov fs,ax
call [disablescroll] invoke disablescroll
adres: adres:
call [saveparamto],offset infos invoke saveparamto,infos
call [readsector],[sect],offset buffer invoke readsector,[sect], buffer
jnc adres2 jnc adres2
errtr: errtr:
call [setxy],0,[word ptr lastline] invoke setxy,0,word [lastline]
call [print],offset errordisk invoke print, errordisk
xor ax,ax xor ax,ax
int 16h int 16h
adres2: adres2:
call [saveparamto],offset infos invoke saveparamto, infos
mov al,[infos.lines] mov al,[infos.lines]
dec al dec al
mov [lastline],al mov [lastline],al
@ -45,13 +38,13 @@ shr al,2
mov [sizex],al mov [sizex],al
and bl,11b and bl,11b
mov [sizex2],bl mov [sizex2],bl
mov al,[infos.mode] mov al,[infos.modenum]
cmp al,[oldmode] cmp al,[oldmode]
je noinit je noinit
call [clearscreen] invoke clearscreen
mov [oldmode],al mov [oldmode],al
noinit: noinit:
call [setxy],0,0 invoke setxy,0,0
mov edi,ebp mov edi,ebp
mov bh,[lastline] mov bh,[lastline]
lines: lines:
@ -61,26 +54,26 @@ push edx
mov edx,edi mov edx,edi
mov dx,[sect] mov dx,[sect]
push edx push edx
push offset spaces push spaces
call [print] invoke print
mov dx,di mov dx,di
mov al,[sizex] mov al,[sizex]
mov esi,edi mov esi,edi
doaline: doaline:
push [dword ptr di+offset buffer] push dword [di+buffer]
push 8 push 8
call [showhex] invoke showhex
call [showchar],' ' invoke showchar,' '
inc edi inc edi
dec al dec al
jnz doaline jnz doaline
mov edi,esi mov edi,esi
push offset spaces2 push spaces2
call [print] invoke print
mov al,[sizex] mov al,[sizex]
doaline2: doaline2:
push [word ptr di+offset buffer] push word [di+buffer]
call [showchar] invoke showchar
inc edi inc edi
dec al dec al
jnz doaline2 jnz doaline2
@ -88,11 +81,11 @@ dec bh
je outes je outes
cmp [sizex2],0 cmp [sizex2],0
je lines je lines
call [addline] invoke addline
jmp lines jmp lines
outes: outes:
call [setxy],0,[word ptr lastline] invoke setxy,0,word [lastline]
call [print],offset menu invoke print,menu
waitkey: waitkey:
mov ax,0 mov ax,0
int 16h int 16h
@ -130,30 +123,30 @@ call [print],offset menu
suit5: suit5:
cmp ax,4000h cmp ax,4000h
jne suit6 jne suit6
call [writesector],[sect],offset buffer invoke writesector,[sect],buffer
jnc waitkey jnc waitkey
jmp errtr jmp errtr
suit6: suit6:
cmp ax,4100h cmp ax,4100h
jne suit7 jne suit7
mov [dword ptr pope],'TIDE' mov dword [pope],'TIDE'
call [setxy],0,[word ptr lastline] invoke setxy,0,word [lastline]
call [print],offset menu invoke print,menu
mov ax,0B800h mov ax,0B800h
mov es,ax mov es,ax
mov [xxyy2],3 mov [xxyy2],3
mov [xxyy],3 mov [xxyy],3
call calc1 invoke calc1
call calc2 invoke calc2
waitst: waitst:
mov ax,0 mov ax,0
int 16h int 16h
cmp ah,41h cmp ah,41h
jne tre jne tre
mov [dword ptr pope],' EUV' mov dword [pope],' EUV'
push cs push cs
pop es pop es
call [writesector],[sect],offset buffer invoke writesector,[sect],buffer
jnc waitkey jnc waitkey
jmp errtr jmp errtr
tre: tre:
@ -190,14 +183,14 @@ je waitst
dec [xx] dec [xx]
jmp cursor jmp cursor
write: write:
call asciihex2dec invoke asciihex2dec
cmp cl,15 cmp cl,15
ja waitst ja waitst
call calc1 invoke calc1
call calc2 invoke calc2
mov edi,[es:bx-1] mov edi,[es:bx-1]
mov dx,[es:si-1] mov dx,[es:si-1]
mov [byte ptr es:bx],0112 mov byte [es:bx],0112
mov [es:bx-1],al mov [es:bx-1],al
writs: writs:
mov ax,0 mov ax,0
@ -229,7 +222,7 @@ jmp waitst
suit7: suit7:
cmp ax,4200h cmp ax,4200h
jne adres jne adres
call [restorestate] invoke restorestate
retf retf
calc1: calc1:
push ax dx si push ax dx si
@ -245,11 +238,11 @@ shl bx,5
shl dx,7 shl dx,7
add bx,dx add bx,dx
add bx,ax add bx,ax
mov [byte ptr es:bx],112 mov byte [es:bx],112
mov [byte ptr es:bx+2],112 mov byte [es:bx+2],112
mov si,[xxyy] mov si,[xxyy]
mov [byte ptr es:si],07 mov byte [es:si],07
mov [byte ptr es:si+2],07 mov byte [es:si+2],07
mov [xxyy],bx mov [xxyy],bx
pop si dx ax pop si dx ax
ret ret
@ -264,9 +257,9 @@ mov dx,[xx]
shl dx,1 shl dx,1
add si,dx add si,dx
add si,129 add si,129
mov [byte ptr es:si],112 mov byte [es:si],112
mov bx,[xxyy2] mov bx,[xxyy2]
mov [byte ptr es:bx],07 mov byte [es:bx],07
mov [xxyy2],si mov [xxyy2],si
pop dx bx ax pop dx bx ax
ret ret
@ -278,7 +271,7 @@ calc3:
shl dx,4 shl dx,4
add bx,dx add bx,dx
add bx,bp add bx,bp
add bx,offset buffer add bx,buffer
pop dx pop dx
ret ret
@ -324,7 +317,7 @@ spaces2 db '\c04 | \c07',0
showbuffer db 35 dup (0FFh) showbuffer db 35 dup (0FFh)
oldmode db 0 oldmode db 0
sect dw 0 sect dw 0
infos vgainf <> infos vgainf
importing importing
use DISQUE,readsector use DISQUE,readsector
@ -342,10 +335,3 @@ use VIDEO.LIB,showhex
use VIDEO.LIB,showchar use VIDEO.LIB,showchar
endi endi