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
all: boot12.bin
sync
boot12.bin: boot12.asm
$(ASM) $<

View File

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

View File

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

View File

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

View File

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

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

View File

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

View File

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

View File

@ -1,20 +1,14 @@
asm= lzasm /z/t
lnk= elink
ASM=fasm
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:
$(asm) $<
.obj.lib:
$(lnk) $< $*.lib
%.lib: %.asm
$(ASM) $^ $@
clean:
del *.obj
del *.ce
del *.bak
del *.lib
del *.com
del *.bin
del *.sys
del *.err
$(CLEAN) *.lib

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
jmp .strinaize0
.showmultchar:
mov cx,[.pointer+di+2+2]
mov cx,[pointer+di+2+2]
cmp cx,0
je .nextfunc
.showcharsx:
invoke showchars,word [.pointer+di+2],0FFFFh
invoke showchars,word [pointer+di+2],0FFFFh
dec cx
jnz .showcharsx
.nextfunc:
@ -123,19 +123,19 @@ proc print pointer:word
jmp .strinaize0
.showint:
stdcall showint,dword [.pointer+di+2]
stdcall showint,dword [pointer+di+2]
add si,2
add di,4
jmp .strinaize0
.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 si,2
jmp .strinaize0
.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 si,2
jmp .strinaize0
@ -156,32 +156,32 @@ proc print pointer:word
jmp .strinaize0
.showstring:
cmp [byte ptr si+2],'P'
cmp byte [si+2],'P'
je .showstring.pointer
stdcall showstring,[word ptr .pointer+di+2]
stdcall showstring,word [pointer+di+2]
add si,2
add di,2
jmp .strinaize0
.showstring.pointer:
push ds
mov ds,[offset .pointer+di+2+2]
stdcall showstring,[word ptr .pointer+di+2]
mov ds,[pointer+di+2+2]
stdcall showstring,word [pointer+di+2]
add si,3
add di,4
pop ds
jmp .strinaize0
.showstring0:
cmp [byte ptr si+2],'P'
cmp byte [si+2],'P'
je .showstring0.pointer
stdcall showstring0,[word ptr offset .pointer+di+2]
stdcall showstring0,word [pointer+di+2]
add si,2
add di,2
jmp .strinaize0
.showstring0.pointer:
push ds
mov ds,[offset .pointer+di+2+2]
stdcall showstring0,[word ptr offset .pointer+di+2]
mov ds,[pointer+di+2+2]
stdcall showstring0,word [pointer+di+2]
add si,3
add di,4
pop ds
@ -193,44 +193,44 @@ proc print pointer:word
jmp .strinaize0
.showsize:
stdcall showsize,[dword ptr offset .pointer+di+2]
stdcall showsize,dword [pointer+di+2]
add si,2
add di,4
jmp .strinaize0
.showattr:
stdcall showattr,[word ptr offset .pointer+di+2]
stdcall showattr,word [pointer+di+2]
add si,2
add di,2
jmp .strinaize0
.showname:
stdcall showname,[word ptr offset .pointer+di+2]
stdcall showname,word [pointer+di+2]
add si,2
add di,2
jmp .strinaize0
.showtime:
stdcall showtime,[word ptr offset .pointer+di+2]
stdcall showtime,word [pointer+di+2]
add si,2
add di,2
jmp .strinaize0
.showdate:
stdcall showdate,[word ptr offset .pointer+di+2]
stdcall showdate,word [pointer+di+2]
add si,2
add di,2
jmp .strinaize0
.Chosesize:
pop cx
push [dword ptr offset .pointer+di+2]
push dword [pointer+di+2]
add di,4
cmp [byte ptr si+2],'B'
cmp byte [si+2],'B'
je .byte
cmp [byte ptr si+2],'W'
cmp byte [si+2],'W'
je .word
cmp [byte ptr si+2],'D'
cmp byte [si+2],'D'
je .dword
dec si
@ -238,27 +238,27 @@ proc print pointer:word
push 16
add si,3
push cx
retfn
ret
.byte:
push 8
add si,3
push cx
retfn
ret
.dword:
push 32
add si,3
push cx
retfn
ret
.special2:
cmp [byte ptr si+1],'\'
cmp byte [si+1],'\'
jne .notshowit2
inc si
jmp .showit
.notshowit2:
mov cl,[byte ptr si+1]
mov cl,byte [si+1]
cmp cl,'l'
je .showline
cmp cl,'g'
@ -465,7 +465,7 @@ proc showname uses cx si, thename:word
mov si,[thename]
xor cx,cx
.showthename:
invoke showchars,[word ptr ds:si],0FFFFh
invoke showchars,word [ds:si],0FFFFh
inc si
inc cx
cmp cx,8
@ -547,22 +547,22 @@ proc showsize uses edx ds, thesize:dword
cmp edx,1024*9
ja .kilo
stdcall showintr,4,edx
stdcall showstring0,offset unit
stdcall showstring0,unit
jmp .finsize
.kilo:
shr edx,10
stdcall showintr,4,edx
stdcall showstring0,offset unitkilo
stdcall showstring0,unitkilo
jmp .finsize
.mega:
shr edx,20
stdcall showintr,4,edx
stdcall showstring0,offset unitmega
stdcall showstring0,unitmega
jmp .finsize
.giga:
shr edx,30
stdcall showintr,4,edx
stdcall showstring0,offset unitgiga
stdcall showstring0,unitgiga
.finsize:
retf
@ -590,11 +590,11 @@ endp
;<-
;============================
proc showint uses eax bx cx edx esi, integer:dword
local showbuffer db 50 dup (0FFh)
local showbuffer[50]:BYTE
xor cx,cx
mov eax,[integer]
mov esi,10
mov bx,offset showbuffer+27
lea bx,[showbuffer+27]
.decint:
xor edx,edx
div esi
@ -619,12 +619,13 @@ endp
;-> %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]
xor cx,cx
mov eax,[integer]
mov esi,10
mov bx,offset showbuffer+27
lea bx,[showbuffer+27]
.decint:
xor edx,edx
div esi
@ -640,7 +641,7 @@ proc showintl eax bx cx edx esi di, sizeofint:word,integer:dword
xchg cx,di
sub cx,di
.rego:
mov [byte ptr cs:bx],'0'
mov byte [cs:bx],'0'
dec bx
dec cx
jnz .rego
@ -663,11 +664,12 @@ endp
;<-
;===============================
proc showintr uses eax bx cx edx esi di, sizeofint:word,integer:dword
local showbuffer[50]:BYTE
mov di,[sizeofint]
xor cx,cx
mov eax,[integer]
mov esi,10
mov bx,offset showbuffer+27
lea bx,[showbuffer+27]
.decint:
xor edx,edx
div esi
@ -683,7 +685,7 @@ proc showintr uses eax bx cx edx esi di, sizeofint:word,integer:dword
xchg cx,di
sub cx,di
.rego:
mov [byte ptr cs:bx],' '
mov byte [cs:bx],' '
dec bx
dec cx
jnz .rego
@ -705,7 +707,7 @@ endp
;-> %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 cx,[sizeofint]
xor edx,edx
@ -741,7 +743,7 @@ endp
;-> %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 cx,[sizeofint]
mov ax,cx
@ -753,7 +755,7 @@ proc showhex ax bx cx edx, sizeofint:word,integer:dword
rol edx,4
mov bx,dx
and bx,0fh
mov cl,[cs:bx+offset Tab]
mov cl,[cs:bx+Tab]
invoke showchars,cx,0FFFFh
dec al
jnz .Hexaize
@ -767,7 +769,7 @@ endp
;-> %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 cx,[sizeofint]
sub cx,32
@ -789,7 +791,7 @@ endp
;-> %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 ax,[sizeofint]
mov cx,ax
@ -813,12 +815,12 @@ endp
;-> ds:%1 pointeur chaine type pascal
;<-
;===============================
proc showstring bx si, pointer:word
proc showstring uses bx si, pointer:word
mov si,[pointer]
mov bl,[si]
.strinaize:
inc si
invoke showchars,[word ptr si],0FFFFh
invoke showchars,word [si],0FFFFh
dec bl
jnz .strinaize
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
install:
(sudo apt-get install yasm qemu fusefat cgdb)
(sudo apt-get install fasm qemu fusefat cgdb)
clean:
make -C final clean
make -C boot clean
make -C lib clean
make -C noyau clean
make -C programs clean
@ -45,3 +46,7 @@ boot/boot12.bin:
lib/3d.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
;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 dx,MASTERPIC+IRQMASK
cmp al,7
@ -50,7 +50,7 @@ endp
;Desactive une interruption lectronique
;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 dx,MASTERPIC+IRQMASK
cmp al,7
@ -71,7 +71,7 @@ endp
;Signale "End Of Interrupt" de l'interruption %0
proc seteoi, irq
proc seteoi uses ax dx, irq:word
mov ax,[irq]
cmp al,7
jbe .master
@ -85,7 +85,7 @@ endp
;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 dx,MASTERPIC+ IRQMASK
cmp bl,0
@ -99,7 +99,7 @@ proc readimr, controleurx
endp
;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 dx,MASTERPIC
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
proc readirr, controleur
proc readirr uses bx dx, controleur:word
mov bx,[controleur]
mov dx,MASTERPIC
cmp bh,0
@ -130,7 +130,7 @@ proc readirr, controleur
endp
;carry si enable et pas carry si pas enable
proc isenableirq, irq
proc isenableirq uses ax cx dx, irq:word
mov ax,[irq]
mov dx,MASTERPIC+IRQMASK
cmp al,7
@ -147,7 +147,7 @@ endp
;carry si enable et pas carry si pas enable
proc isinserviceirq, irq
proc isinserviceirq uses ax cx dx, irq:word
mov ax,[irq]
mov dx,MASTERPIC
cmp al,7
@ -166,7 +166,7 @@ endp
;carry si enable et pas carry si pas enable
proc isrequestirq, irq
proc isrequestirq uses ax cx dx, irq:word
mov ax,[irq]
mov dx,MASTERPIC
cmp al,7
@ -184,62 +184,74 @@ proc isrequestirq, irq
endp
proc installirqhandler
proc installirqhandler uses eax bx cx edx si di ds es
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 ax,0x0000
mov ds,ax
xor si,si
.searchdummypointer:
mov fs,[si+vector.data.seg]
mov bx,[si+vector.data.off]
virtual at si
.vector vector
end virtual
virtual at 0
.vectorori vector
end virtual
mov fs,[.vector.data.seg]
mov bx,[.vector.data.off]
cmp byte [fs:bx],0xCF ;iret
je .founded
add si,vector.sizeof
add si,.vectorori.sizeof
cmp si,256*4
jb .searchdummypointer
xor edx,edx
jmp .suite
.founded:
mov edx,[si+vector.content]
mov edx,[.vector.content]
.suite:
xor cx,cx
xor si,si
xor di,di
cli
.copy:
mov [es:di+ints.number],cl
mov [es:di+ints.locked],0
mov [es:di+ints.vector1.content],0
mov [es:di+ints.vector3.content],0
mov [es:di+ints.vector4.content],0
mov [es:di+ints.vector5.content],0
mov [es:di+ints.vector6.content],0
mov [es:di+ints.vector7.content],0
mov [es:di+ints.vector8.content],0
mov [es:di+ints.launchedlow],0
mov [es:di+ints.launchedhigh],0
mov [es:di+ints.calledlow],0
mov [es:di+ints.calledhigh],0
mov eax,[si+vector.ints.content]
virtual at di
.ints ints
end virtual
mov [es:.ints.number],cl
mov [es:.ints.locked],0
mov [es:.ints.vector1.content],0
mov [es:.ints.vector3.content],0
mov [es:.ints.vector4.content],0
mov [es:.ints.vector5.content],0
mov [es:.ints.vector6.content],0
mov [es:.ints.vector7.content],0
mov [es:.ints.vector8.content],0
mov [es:.ints.launchedlow],0
mov [es:.ints.launchedhigh],0
mov [es:.ints.calledlow],0
mov [es:.ints.calledhigh],0
mov eax,[.vector.content]
cmp eax,edx
je .notarealvector
mov [es:di+ints.vector1.content],eax
mov [es:di+ints.activated],1
mov [es:.ints.vector1.content],eax
mov [es:.ints.activated],1
jmp .copynext
.notarealvector:
mov [es:di+ints.vector1.content],0
mov [es:di+ints.activated],0
mov [es:.ints.vector1.content],0
mov [es:.ints.activated],0
.copynext:
mov bx,cx
shl bx,3
sub bx,cx
add bx,coupling
mov [si+vector.data.seg],cs
mov [si+vector.data.off],bx
add si,vector.sizeof
add di,ints.sizeof
mov [.vector.data.seg],cs
mov [.vector.data.off],bx
add si,.vectorori.sizeof
add di,.intsori.sizeof
inc cl
cmp cl,0
jne .copy
@ -253,7 +265,7 @@ endp
interruptionbloc db '/interrupts',0
proc savecontext, pointer
proc savecontext uses eax si ds, pointer:word
pushfd
push eax
push ebx
@ -278,39 +290,45 @@ push eax
mov ax,bp
add ax,4
push eax
pop [si+regs.sesp]
pop [si+regs.seip]
pop [si+regs.scs]
pop [si+regs.sebp]
pop [si+regs.sss]
pop [si+regs.sgs]
pop [si+regs.sfs]
pop [si+regs.ses]
pop [si+regs.sds]
pop [si+regs.sedi]
pop [si+regs.sesi]
pop [si+regs.sedx]
pop [si+regs.secx]
pop [si+regs.sebx]
pop [si+regs.seax]
pop [si+regs.seflags]
virtual at si
.regs regs
end virtual
pop [.regs.sesp]
pop [.regs.seip]
pop [.regs.scs]
pop [.regs.sebp]
pop [.regs.sss]
pop [.regs.sgs]
pop [.regs.sfs]
pop [.regs.ses]
pop [.regs.sds]
pop [.regs.sedi]
pop [.regs.sesi]
pop [.regs.sedx]
pop [.regs.secx]
pop [.regs.sebx]
pop [.regs.seax]
pop [.regs.seflags]
retf
endp
proc restorecontextg, pointer
proc restorecontextg, pointer:word
mov si,[pointer]
pushd [cs:si+regs.sesi]
pushd [cs:si+regs.seflags]
mov eax,[cs:si+regs.seax]
mov ebx,[cs:si+regs.sebx]
mov ecx,[cs:si+regs.secx]
mov edx,[cs:si+regs.sedx]
mov edi,[cs:si+regs.sedi]
mov ebp,[cs:si+regs.sebp]
mov es,[cs:si+regs.ses]
mov fs,[cs:si+regs.sfs]
mov gs,[cs:si+regs.sgs]
mov ds,[cs:si+regs.sds]
virtual at si
.regs regs
end virtual
pushd [cs:.regs.sesi]
pushd [cs:.regs.seflags]
mov eax,[cs:.regs.seax]
mov ebx,[cs:.regs.sebx]
mov ecx,[cs:.regs.secx]
mov edx,[cs:.regs.sedx]
mov edi,[cs:.regs.sedi]
mov ebp,[cs:.regs.sebp]
mov es,[cs:.regs.ses]
mov fs,[cs:.regs.sfs]
mov gs,[cs:.regs.sgs]
mov ds,[cs:.regs.sds]
popfd
pop esi
pop [cs:dummy]
@ -322,7 +340,7 @@ endp
coupling:
repeat 256
push %+256
push offset irqhandlers
push irqhandlers
ret
end repeat
@ -334,48 +352,60 @@ function_reg regs
irqhandlers:
cli
pop [cs:interrupt]
stdcall savecontext,offset calling_reg
stdcall savecontext,calling_reg
stdcall irqhandler,[cs:interrupt]
stdcall restorecontextg,offset calling_reg
stdcall restorecontextg,calling_reg
sti
iret
proc irqhandler, int
proc irqhandler, int:word
push cs
pop ds
stdcall mbfindsb,offset interruptionbloc,cs
stdcall mbfindsb,interruptionbloc,cs
jc .end
mov es,ax
mov ax,[int]
sub ax,256
mov cx,ints.sizeof
virtual at 0
.intsorig ints
end virtual
mov cx,.intsorig.sizeof
mul cx
mov si,ax
add [es:si+ints.calledlow],1
adc [es:si+ints.calledhigh],0
cmp [es:si+ints.activated],1
virtual at si
.ints ints
end virtual
add [es:.ints.calledlow],1
adc [es:.ints.calledhigh],0
cmp [es:.ints.activated],1
jne .end
add [es:si+ints.launchedlow],1
adc [es:si+ints.launchedhigh],0
lea si,[es:si+ints.vector1]
add [es:.ints.launchedlow],1
adc [es:.ints.launchedhigh],0
lea si,[es:.ints.vector1]
mov cl,8
.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
push word [cs:calling_reg.seflags]
push cs
push offset .back
push [es:si+vector.data.seg]
push [es:si+vector.data.off]
stdcall savecontext,offset function_reg
stdcall restorecontextg,offset calling_reg
push .back
push [es:.vector.data.seg]
push [es:.vector.data.off]
stdcall savecontext,function_reg
stdcall restorecontextg,calling_reg
db 0xCB
.back:
cli
stdcall savecontext,offset calling_reg
stdcall restorecontextg,offset function_reg
stdcall savecontext,calling_reg
stdcall restorecontextg,function_reg
.next:
add si,vector.sizeof
add si,.vectorori.sizeof
dec cl
jnz .launchall
.end:

View File

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

View File

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

View File

@ -49,26 +49,26 @@ suite:
pop gs
stdcall biosprint,msg_ok
stdcall biosprint,msg_video_init
stdcall [cs:setvideomode],2
invoke setvideomode,2
jc error
stdcall [cs:clearscreen]
stdcall [cs:print],msg_memory
stdcall [cs:print],msg_ok2
stdcall [cs:print],msg_memory_init
stdcall [cs:print],msg_ok2
stdcall [cs:print],msg_memory_section
stdcall [cs:print],msg_ok2
stdcall [cs:print],msg_memory_jumps
stdcall [cs:print],msg_ok2
stdcall [cs:print],msg_video_init
stdcall [cs:print],msg_ok2
stdcall [cs:print],msg_handler
;stdcall installirqhandler
stdcall [cs:print],msg_ok2
stdcall [cs:print],msg_cpu_detect
stdcall [cs:cpuinfo],thecpu
stdcall [cs:setinfo],thecpu,temporary
stdcall [cs:print],msg_ok2
invoke clearscreen
invoke print,msg_memory
invoke print,msg_ok2
invoke print,msg_memory_init
invoke print,msg_ok2
invoke print,msg_memory_section
invoke print,msg_ok2
invoke print,msg_memory_jumps
invoke print,msg_ok2
invoke print,msg_video_init
invoke print,msg_ok2
invoke print,msg_handler
;invoke installirqhandler
invoke print,msg_ok2
invoke print,msg_cpu_detect
invoke cpuinfo,thecpu
invoke setinfo,thecpu,temporary
invoke print,msg_ok2
push temporary
xor eax,eax
mov al,[thecpu.family]
@ -79,11 +79,11 @@ suite:
push eax
push thecpu.names
push thecpu.vendor
stdcall [cs:print],msg_cpu_detect_inf
stdcall [cs:print],msg_pci
stdcall [cs:pciinfo],thepci
invoke print,msg_cpu_detect_inf
invoke print,msg_pci
invoke pciinfo,thepci
jc nopci
stdcall [cs:print],msg_ok2
invoke print,msg_ok2
xor eax,eax
mov al,[thepci.maxbus]
push eax
@ -91,25 +91,28 @@ suite:
push eax
mov al,[thepci.version_major]
push eax
stdcall [cs:print],msg_pci_info
stdcall [cs:print],msg_pci_enum
invoke print,msg_pci_info
invoke print,msg_pci_enum
xor ebx,ebx
xor ecx,ecx
xor si,si
searchpci:
stdcall [cs:getcardinfo],bx,cx,si,temporary
invoke getcardinfo,bx,cx,si,temporary
jc stopthis
mov al,[temporary+pcidata.subclass]
virtual at temporary
.pcidata pcidata
end virtual
mov al,[.pcidata.subclass]
push ax
mov al,[temporary+pcidata.class]
mov al,[.pcidata.class]
push ax
stdcall [cs:getpcisubclass]
invoke getpcisubclass
push dx
push ax
mov al,[temporary+pcidata.class]
mov al,[.pcidata.class]
xor ah,ah
push ax
stdcall [cs:getpciclass]
invoke getpciclass
push dx
push ax
push 4
@ -118,11 +121,11 @@ searchpci:
push ecx
push 4
push ebx
mov ax,[temporary+pcidata.device]
mov ax,[.pcidata.device]
push eax
mov ax,[temporary+pcidata.vendor]
mov ax,[.pcidata.vendor]
push eax
stdcall [cs:print],msg_pci_card
invoke print,msg_pci_card
inc si
cmp si,7
jbe searchpci
@ -137,29 +140,29 @@ stopthis:
jbe searchpci
jmp next
nopci:
stdcall [cs:print],msg_echec2
invoke print,msg_echec2
next:
;stdcall [cs:detectvmware]
;invoke detectvmware
;jne novirtual
;stdcall [cs:print],msg_vmware
;invoke print,msg_vmware
novirtual:
;stdcall [cs:print],msg_flat
;stdcall enablea20
;stdcall flatmode
;invoke print,msg_flat
;invoke enablea20
;invoke flatmode
;xor ax,ax
;mov fs,ax
;mov esi,0100000h
;mov [dword ptr fs:esi],"OKIN"
stdcall [cs:print],msg_ok2
stdcall [cs:print],msg_disk_init
stdcall [cs:initdrive]
invoke print,msg_ok2
invoke print,msg_disk_init
invoke initdrive
jc error2
stdcall [cs:print],msg_ok2
stdcall [cs:print],msg_launchcommand
stdcall [cs:execfile],shell
invoke print,msg_ok2
invoke print,msg_launchcommand
invoke execfile,shell
jc error2
error2:
stdcall [cs:print],msg_error2
invoke print,msg_error2
stdcall bioswaitkey
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\divers.h"
include "..\include\graphic.h"
@ -12,20 +5,20 @@ include "..\include\graphic.h"
org 0h
start:
header exe <"CE",1,0,0,,offset imports,,offset realstart>
header exe 1
realstart:
mov ax,0305h
mov bx,0008h
int 16h
call [savestate]
call [setvideomode],2
invoke savestate
invoke setvideomode,2
xor ebp,ebp
xor ax,ax
mov fs,ax
call [disablescroll]
invoke disablescroll
adres:
call [saveparamto],offset infos
invoke saveparamto, infos
mov al,[infos.lines]
dec al
mov [lastline],al
@ -36,13 +29,13 @@ shr al,2
mov [sizex],al
and bl,11b
mov [sizex2],bl
mov al,[infos.mode]
mov al,[infos.modenum]
cmp al,[oldmode]
je noinit
call [clearscreen]
invoke clearscreen
mov [oldmode],al
noinit:
call [setxy],0,0
invoke setxy,0,0
mov edi,ebp
mov bh,[lastline]
lines:
@ -53,8 +46,8 @@ mov edx,edi
shr edx,4*4
shl edx,4*3
push edx
push offset spaces
call [print]
push spaces
invoke print
mov dx,di
mov al,[sizex]
mov esi,edi
@ -63,24 +56,24 @@ mov edx,edi
shr edx,4*4
shl edx,4*3
mov fs,dx
push [dword ptr fs:di]
push dword [fs:di]
push 8
call [showhex]
call [showchar],' '
invoke showhex
invoke showchar,' '
inc edi
dec al
jnz doaline
mov edi,esi
push offset spaces2
call [print]
push spaces2
invoke print
mov al,[sizex]
doaline2:
mov edx,edi
shr edx,4*4
shl edx,4*3
mov fs,dx
push [word ptr fs:di]
call [showchar]
push word [fs:di]
invoke showchar
inc edi
dec al
jnz doaline2
@ -88,11 +81,11 @@ dec bh
je outes
cmp [sizex2],0
je lines
call [addline]
invoke addline
jmp lines
outes:
call [setxy],0,[word ptr lastline]
call [print],offset menu
invoke setxy,0,word [lastline]
invoke print, menu
waitkey:
mov ax,0
int 16h
@ -128,9 +121,9 @@ jmp adres
suit6:
cmp ax,4100h
jne suit7
mov [dword ptr pope],'TIDE'
call [setxy],0,[word ptr lastline]
call [print],offset menu
mov dword [pope],'TIDE'
invoke setxy,0,word [lastline]
invoke print, menu
mov ax,0B800h
mov es,ax
mov [xxyy2],3
@ -142,7 +135,7 @@ mov ax,0
int 16h
cmp ah,41h
jne tre
mov [dword ptr pope],' EUV'
mov dword [pope],' EUV'
push cs
pop es
jmp adres
@ -187,7 +180,7 @@ call calc1
call calc2
mov edi,[es:bx-1]
mov dx,[es:si-1]
mov [byte ptr es:bx],0112
mov byte [es:bx],0112
mov [es:bx-1],al
writs:
mov ax,0
@ -209,12 +202,12 @@ mov cl,[gs:bx]
cmp ch,cl
je no
push si ax
call [setxy],0,[word ptr lastline]
call [print],offset msg
invoke setxy,0,word [lastline]
invoke print, msg
mov ax,0
int 16h
call [setxy],0,[word ptr lastline]
call [print],offset menu
invoke setxy,0,word [lastline]
invoke print, menu
pop bx si
mov [es:bx-1],edi
mov [es:si-1],dx
@ -235,7 +228,7 @@ jmp waitst
suit7:
cmp ax,4200h
jne adres
call [restorestate]
invoke restorestate
retf
calc1:
push ax dx si
@ -251,11 +244,11 @@ shl bx,5
shl dx,7
add bx,dx
add bx,ax
mov [byte ptr es:bx],112
mov [byte ptr es:bx+2],112
mov byte [es:bx],112
mov byte [es:bx+2],112
mov si,[xxyy]
mov [byte ptr es:si],07
mov [byte ptr es:si+2],07
mov byte [es:si],07
mov byte [es:si+2],07
mov [xxyy],bx
pop si dx ax
ret
@ -270,9 +263,9 @@ mov dx,[xx]
shl dx,1
add si,dx
add si,129
mov [byte ptr es:si],112
mov byte [es:si],112
mov bx,[xxyy2]
mov [byte ptr es:bx],07
mov byte [es:bx],07
mov [xxyy2],si
pop dx bx ax
ret
@ -330,7 +323,7 @@ spaces2 db '\c04 | \c07',0
showbuffer db 35 dup (0FFh)
oldmode db 0
infos vgainf <>
infos vgainf
importing
use VIDEO,setvideomode
@ -346,10 +339,3 @@ use VIDEO.LIB,showhex
use VIDEO.LIB,showchar
endi

View File

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

View File

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

View File

@ -1,69 +1,62 @@
model tiny,stdcall
p586N
locals
jumps
codeseg
option procalign:byte
include "..\include\mem.h"
include "..\include\divers.h"
org 0h
start:
header exe <"CE",1,0,0,,offset imports,,offset realstart>
header exe 1
realstart:
call [cs:mballoc],65535
invoke mballoc,65535
jc problem3
push ax
pop es
call [cs:projfile],offset logo
invoke projfile,logo
jc problem
mov ecx,eax
call [cs:mbfind],offset logo
invoke mbfind,logo
jc problem
call [cs:decompressrle],ax,0,es,0,cx
invoke decompressrle,ax,0,es,0,cx
jc problem2
push es
pop ds
call [cs:savestate]
call [cs:setvideomode],word 8
call [cs:clearscreen]
call [cs:loadbmppalet],word 0
call [cs:showbmp],word 0,word 20,word 150
invoke savestate
invoke setvideomode,word 8
invoke clearscreen
invoke loadbmppalet,word 0
invoke showbmp,word 0,word 20,word 150
jc problem4
push cs
pop ds
call [cs:print],offset poper
invoke print,poper
endofit:
xor ax,ax
int 16h
call [cs:restorestate]
invoke restorestate
retf
problem:
push cs
pop ds
call [cs:print],offset error
invoke print, error
jmp endofit
problem2:
push cs
pop ds
call [cs:print],offset error2
invoke print, error2
jmp endofit
problem3:
push cs
pop ds
call [cs:print],offset error3
invoke print, error3
jmp endofit
problem4:
push cs
pop ds
call [cs:print],offset error4
invoke print, error4
jmp endofit
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
lnk= elink
ASM=fasm
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:
$(asm) $<
.obj.ce:
$(lnk) $< $*.ce
.obj.lib:
$(lnk) $< $*.lib
%.ce: %.asm
$(ASM) $^ $@
clean:
del *.obj
del *.ce
del *.bak
del *.lib
del *.com
del *.bin
del *.sys
del *.err
$(CLEAN) *.ce

View File

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

View File

@ -1,10 +1,3 @@
model tiny,stdcall
p586N
locals
jumps
codeseg
option procalign:byte
include "..\include\mem.h"
include "..\include\fat.h"
include "..\include\divers.h"
@ -13,31 +6,31 @@ include "..\include\3d.h"
org 0h
start:
header exe <"CE",1,0,0,,offset imports,,offset realstart>
header exe 1
realstart:
call [cs:randomize]
call [cs:savestate]
call [cs:setvideomode],10
call [cs:clearscreen]
invoke randomize
invoke savestate
invoke setvideomode,10
invoke clearscreen
mov cx,65535
show:
call [cs:random]
invoke random
and ax,1111b
push ax
call [cs:random]
invoke random
push ax
call [cs:random]
invoke random
push ax
call [cs:random]
invoke random
push ax
call [cs:random]
invoke random
push ax
call [cs:line]
invoke line
dec cx
jnz show
call [cs:bioswaitkey]
call [cs:restorestate]
invoke bioswaitkey
invoke restorestate
retf
importing

View File

@ -1,10 +1,3 @@
model tiny,stdcall
p586N
locals
jumps
codeseg
option procalign:byte
include "..\include\mem.h"
include "..\include\fat.h"
include "..\include\divers.h"
@ -13,11 +6,10 @@ include "..\include\3d.h"
org 0h
start:
header exe <"CE",1,0,0,,offset imports,,offset realstart>
header exe 1
data:
camera vertex3d <320.0,240.0,70.0>
alldata:
camera vertex3d 320.0,240.0,70.0
zoom dd 5.0
rot1 dd 0.1
@ -66,10 +58,10 @@ dd -2.0,-2.0,20.0
dd 2.0,2.0,20.0
mat1 mat <?>
mat2 mat <?>
mat3 mat <?>
matrixp mat <?>
mat1 mat
mat2 mat
mat3 mat
matrixp mat
mode db 0
@ -78,36 +70,29 @@ vertexp equ objectp+15
facep equ vertexp+20000
screen equ facep+20000
;typep db ?
;objectp db 15 dup (?)
;vertexp db 1000*4*3+2 dup (?)
;facep db 2000*3+2 dup (?)
;screen db 1000*2*2 dup (?)
realstart:
call [cs:savestate]
call [cs:setvideomode],10
call [cs:clearscreen]
call [cs:mballoc],65535
invoke savestate
invoke setvideomode,10
invoke clearscreen
invoke mballoc,65535
mov es,ax
mov si,offset data
mov si, alldata
mov di,si
mov ecx,(offset realstart-offset data)
mov ecx,( realstart- alldata)
shr ecx,2
inc ecx
cld
rep movsd
call [cs:projfile],offset filename
invoke projfile, filename
jc errorloading
call [cs:mbfind],offset filename
invoke mbfind, filename
jc errorloading
push es
pop ds
mov es,ax
call [cs:load3ds],es,0,offset objectp,offset vertexp,offset matrixp,offset facep
call [cs:transform],offset vertexnbp,offset matrixp
call [cs:identity],offset mat1
invoke load3ds,es,0, objectp, vertexp, matrixp, facep
invoke transform, vertexnbp, matrixp
invoke identity, mat1
jmp show
rool:
mov ah,1
@ -127,32 +112,32 @@ rool:
notmode:
cmp ax,4800h
jne notup
call [cs:rotationx],offset mat1,[rot2]
invoke rotationx, mat1,[rot2]
jmp show
notup:
cmp ax,5000h
jne notdown
call [cs:rotationx],offset mat1,[rot1]
invoke rotationx, mat1,[rot1]
jmp show
notdown:
cmp ax,4B00h
jne notleft
call [cs:rotationy],offset mat1,[rot1]
invoke rotationy, mat1,[rot1]
jmp show
notleft:
cmp ax,4D00h
jne notright
call [cs:rotationy],offset mat1,[rot2]
invoke rotationy, mat1,[rot2]
jmp show
notright:
cmp ax,4900h
jne notupup
call [cs:rotationz],offset mat1,[rot1]
invoke rotationz, mat1,[rot1]
jmp show
notupup:
cmp ax,5100h
jne notdowndown
call [cs:rotationz],offset mat1,[rot2]
invoke rotationz, mat1,[rot2]
jmp show
notdowndown:
cmp ax,4A2Dh
@ -169,45 +154,45 @@ notminus:
fstp [camera.tz]
jmp show
notmaxus:
call [cs:identity],offset mat1
invoke identity, mat1
jmp rool
show:
call [cs:transform],offset vertexp,offset mat1
call [cs:transform],offset vertexnbp,offset mat1
invoke transform, vertexp, mat1
invoke transform, vertexnbp, mat1
notmodify:
call [cs:clearscreen]
call [cs:print],offset objectp
call [cs:draw3d_line],3,offset facenbp,offset vertexnbp,offset screen,offset camera,3
call [cs:draw3d_line],3,offset facenbp,offset vertexnbp2,offset screen,offset camera,3
invoke clearscreen
invoke print, objectp
invoke draw3d_line,3, facenbp, vertexnbp, screen, camera,3
invoke draw3d_line,3, facenbp, vertexnbp2, screen, camera,3
cmp [mode],0
jne line
call [cs:draw3d_point],offset vertexp,offset screen,offset camera,4
invoke draw3d_point, vertexp, screen, camera,4
jmp retrace
line:
cmp [mode],1
jne hidden
call [cs:draw3d_line],3,offset facep,offset vertexp,offset screen,offset camera,4
invoke draw3d_line,3, facep, vertexp, screen, camera,4
jmp retrace
hidden:
call [cs:draw3d_hidden],3,offset facep,offset vertexp,offset screen,offset camera,4
invoke draw3d_hidden,3, facep, vertexp, screen, camera,4
retrace:
call [cs:waitretrace]
call [cs:waitretrace]
invoke waitretrace
invoke waitretrace
jmp rool
endee:
call [cs:restorestate]
invoke restorestate
retf
errorloading:
push cs
pop ds
call [cs:print],offset errorload
call [cs:bioswaitkey]
invoke print, errorload
invoke bioswaitkey
jmp endee
errorload db '\c02Erreur au chargement du fichier 3D\l<Appuyez sur une touche>\c07',0
filename find <"SPHERE.3DS",0,0,0,1,>
filename find "SPHERE.3DS"
importing

View File

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