diff --git a/programs/MAKEFILE b/programs/MAKEFILE new file mode 100644 index 0000000..46a0203 --- /dev/null +++ b/programs/MAKEFILE @@ -0,0 +1,23 @@ +asm= lzasm /z/t +lnk= elink + +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 + +.asm.obj: + $(asm) $< + +.obj.ce: + $(lnk) $< $*.ce + +.obj.lib: + $(lnk) $< $*.lib + +clean: + del *.obj + del *.ce + del *.bak + del *.lib + del *.com + del *.bin + del *.sys + del *.err diff --git a/programs/cos.rip b/programs/cos.rip new file mode 100644 index 0000000..f9e2076 Binary files /dev/null and b/programs/cos.rip differ diff --git a/programs/editeur.asm b/programs/editeur.asm new file mode 100644 index 0000000..89ad446 --- /dev/null +++ b/programs/editeur.asm @@ -0,0 +1,355 @@ +model tiny,stdcall +p586N +locals +jumps +codeseg +option procalign:byte + +include "..\include\mem.h" +include "..\include\divers.h" +include "..\include\graphic.h" + +org 0h + +start: +header exe <"CE",1,0,0,,offset imports,,offset realstart> + +realstart: +mov ax,0305h +mov bx,0008h +int 16h +call [savestate] +call [setvideomode],2 +xor ebp,ebp +xor ax,ax +mov fs,ax +call [disablescroll] +adres: +call [saveparamto],offset infos +mov al,[infos.lines] +dec al +mov [lastline],al +mov al,[infos.columns] +sub al,16 +mov bl,al +shr al,2 +mov [sizex],al +and bl,11b +mov [sizex2],bl +mov al,[infos.mode] +cmp al,[oldmode] +je noinit +call [clearscreen] +mov [oldmode],al +noinit: +call [setxy],0,0 +mov edi,ebp +mov bh,[lastline] +lines: +xor edx,edx +mov dx,di +push edx +mov edx,edi +shr edx,4*4 +shl edx,4*3 +push edx +push offset spaces +call [print] +mov dx,di +mov al,[sizex] +mov esi,edi +doaline: +mov edx,edi +shr edx,4*4 +shl edx,4*3 +mov fs,dx +push [dword ptr fs:di] +push 8 +call [showhex] +call [showchar],' ' +inc edi +dec al +jnz doaline +mov edi,esi +push offset spaces2 +call [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] +inc edi +dec al +jnz doaline2 +dec bh +je outes +cmp [sizex2],0 +je lines +call [addline] +jmp lines +outes: +call [setxy],0,[word ptr lastline] +call [print],offset menu +waitkey: +mov ax,0 +int 16h +cmp ax,3B00h +jne suit +inc ebp +jmp adres +suit: +cmp ax,3C00h +jne suit2 +dec ebp +jmp adres +suit2: +cmp ax,3D00h +jne suit3 +add ebp,24*16 +jmp adres +suit3: +cmp ax,3E00h +jne suit4 +sub ebp,24*16 +jmp adres +suit4: +cmp ax,3F00h +jne suit5 +add ebp,010000h +jmp adres +suit5: +cmp ax,4000h +jne suit6 +sub ebp,010000h +jmp adres +suit6: +cmp ax,4100h +jne suit7 +mov [dword ptr pope],'TIDE' +call [setxy],0,[word ptr lastline] +call [print],offset menu +mov ax,0B800h +mov es,ax +mov [xxyy2],3 +mov [xxyy],3 +call calc1 +call calc2 +waitst: +mov ax,0 +int 16h +cmp ah,41h +jne tre +mov [dword ptr pope],' EUV' +push cs +pop es +jmp adres +tre: +cmp al,0 +jne write +cmp ah,48h +jne tre1 +cmp [yy],0 +je waitst +dec [yy] +jmp cursor +tre1: +cmp ah,50h +jne tre2 +mov al,[lastline] +dec al +xor ah,ah +cmp [yy],ax +je waitst +inc [yy] +jmp cursor +tre2: +cmp ah,4Dh +jne tre4 +cmp [xx],15 +je waitst +inc [xx] +jmp cursor +tre4: +cmp ah,4Bh +jne waitst +cmp [xx],0 +je waitst +dec [xx] +jmp cursor +write: +call asciihex2dec +cmp cl,15 +ja waitst +call calc1 +call calc2 +mov edi,[es:bx-1] +mov dx,[es:si-1] +mov [byte ptr es:bx],0112 +mov [es:bx-1],al +writs: +mov ax,0 +int 16H +mov ch,cl +call asciihex2dec +cmp cl,15 +ja writs +shl ch,4 +add ch,cl +mov [es:bx+1],al +mov [es:si-1],ch +mov ax,bx +call calc3 +mov [gs:bx],ch +pusha +popa +mov cl,[gs:bx] +cmp ch,cl +je no +push si ax +call [setxy],0,[word ptr lastline] +call [print],offset msg +mov ax,0 +int 16h +call [setxy],0,[word ptr lastline] +call [print],offset menu +pop bx si +mov [es:bx-1],edi +mov [es:si-1],dx +no: +inc [xx] +cmp [xx],16 +jne pasde +inc [yy] +mov [xx],0h +pasde: +call calc1 +call calc2 +jmp waitst +cursor: +call calc1 +call calc2 +jmp waitst +suit7: +cmp ax,4200h +jne adres +call [restorestate] +retf +calc1: +push ax dx si +mov ax,[xx] +mov dx,[xx] +shl ax,2 +shl dx,1 +add ax,dx +add ax,27 +mov bx,[yy] +mov dx,[yy] +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 si,[xxyy] +mov [byte ptr es:si],07 +mov [byte ptr es:si+2],07 +mov [xxyy],bx +pop si dx ax +ret +calc2: +push ax bx dx +mov si,[yy] +mov dx,[yy] +shl si,5 +shl dx,7 +add si,dx +mov dx,[xx] +shl dx,1 +add si,dx +add si,129 +mov [byte ptr es:si],112 +mov bx,[xxyy2] +mov [byte ptr es:bx],07 +mov [xxyy2],si +pop dx bx ax +ret +calc3: +push dx +xor ebx,ebx +mov bx,[xx] +mov dx,[yy] +shl dx,4 +add bx,dx +add ebx,ebp +mov edx,ebx +shr edx,4*4 +shl edx,4*3 +mov gs,dx +pop dx +ret +asciihex2dec: +cmp al,'a' +jb nomin +cmp al,'f' +ja nomin +sub al,'a'-'A' +jmp ismaj +nomin: +cmp al,'A' +jb nomaj +cmp al,'F' +ja nomaj +ismaj: +mov cl,al +sub cl,'A'-10 +jmp endt +nomaj: +mov cl,al +sub cl,'0' +endt: +ret + +xx dw 0 +yy dw 0 +xxyy dw 3 +xxyy2 dw 3 + +lastline db 0 +sizex db 0 +sizex2 db 0 + +dep db ':',0 +msg db '\c74Erreur : zone non modifiable (ROM) pressez une touche pour continuer ',0 +menu db '\c70haut/bas [F1/2] Offset [F3/4] Segment [F5/6] Mode F7, Quitter F8 MODE ' +pope db 'VUE ',0 +spaces db '\c02%hW:%hW \c04| \c07',0 +spaces2 db '\c04 | \c07',0 + +showbuffer db 35 dup (0FFh) +oldmode db 0 +infos vgainf <> + +importing +use VIDEO,setvideomode +use VIDEO,savestate +use VIDEO,restorestate +use VIDEO,setxy +use VIDEO,addline +use VIDEO,saveparamto +use VIDEO,disablescroll +use VIDEO,clearscreen +use VIDEO.LIB,print +use VIDEO.LIB,showhex +use VIDEO.LIB,showchar +endi + + + + + + + + diff --git a/programs/exem-ce.asm b/programs/exem-ce.asm new file mode 100644 index 0000000..867d0d7 --- /dev/null +++ b/programs/exem-ce.asm @@ -0,0 +1,26 @@ +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> + +realstart: + call [print],offset message + call [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 +endi diff --git a/programs/exem-lib.asm b/programs/exem-lib.asm new file mode 100644 index 0000000..0feaf4c --- /dev/null +++ b/programs/exem-lib.asm @@ -0,0 +1,24 @@ +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,,,> + +waitkey: + mov ax,0 + int 16h + retf + +exporting + +declare waitkey +ende diff --git a/programs/gestion.asm b/programs/gestion.asm new file mode 100644 index 0000000..95de6ed --- /dev/null +++ b/programs/gestion.asm @@ -0,0 +1,117 @@ +model tiny,stdcall +p586N +locals +jumps +codeseg +option procalign:byte + +include "..\include\mem.h" +include "..\include\fat.h" +include "..\include\divers.h" +include "..\include\graphic.h" + +org 0h + +start: +header exe <"CE",1,0,0,,offset imports,,offset realstart> + +realstart: + call [saveparamto],offset infos + call [print],offset msg1 + call [initdrive] + xor bp,bp + call [findfirstfile],offset bufferentry + jc nofiles +go: + 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 + push bx + push offset line + call [print] + + call [findnextfile],offset bufferentry + jc nofiles + inc bp + jmp go +nofiles: + call [print],offset menu + mov [xx],1 + call changelineattr,[xx],112 +endof: + mov ax,0 + int 16h + cmp ah,50h + jne tre1 + cmp [xx],bp + ja endof + call changelineattr,[xx],7 + inc [xx] + call changelineattr,[xx],112 + jmp endof +tre1: + cmp ah,48h + jne tre2 + cmp [xx],1 + je endof + call changelineattr,[xx],7 + dec [xx] + call changelineattr,[xx],112 + jmp endof +tre2: + cmp al,0Dh + jne tre3 +tre3: + cmp ah,59 + jne tre4 + jmp realstart +tre4: + cmp ah,67 + jne endof + retf + +;couleur al pour ligne %0 en %1 +PROC changelineattr near +USES ax,bx,di,es +ARG @line:word,@attr:word +mov ax,0B800h +mov es,ax +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 [es:di],bl +add di,2 +dec al +jnz @@popep +ret +endp changelineattr + +xx dw 1 +xxold dw 0 +menu db '\c70 [F1] Lire disque [F9] Quitter \c07',0 +msg1 db '\e\g00,00\c70 Gestionnaire de fichier Version 1.5 ' + db '\g00,01\c07--------------------------------------------------------------------------------' + 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 <> + +importing +use VIDEO.LIB,print +use VIDEO,saveparamto +use DISQUE,initdrive +use DISQUE,findfirstfile +use DISQUE,findnextfile +endi + diff --git a/programs/isa.asm b/programs/isa.asm new file mode 100644 index 0000000..f3e7e9c --- /dev/null +++ b/programs/isa.asm @@ -0,0 +1,46 @@ +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> + +realstart: +retf + +PNP_ADR_PORT equ 0x279 +PNP_WRITE_PORT equ 0xA79 +;MIN and MAX READ_ADDR must have the bottom two bits set +MIN_READ_ADDR equ 0x203 +MAX_READ_ADDR equ 0x3FF +;READ_ADDR_STEP must be a multiple of 4 +READ_ADDR_STEP equ 8 + +;bits +CONFIG_WAIT_FOR_KEY equ 0x02 +CONFIG_RESET_CSN equ 0x04 +IDENT_LEN equ 9 + +;renvoie le timer en ax +ctc: + cli + mov dx,043h + mov al,0 + out dx,al + mov dx,40h + in al,dx + mov ah,al + in al,dx + sti + ret + +;attend pendant ax microsecondes +usleep: diff --git a/programs/logo.asm b/programs/logo.asm new file mode 100644 index 0000000..5e5a0da --- /dev/null +++ b/programs/logo.asm @@ -0,0 +1,91 @@ +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> + +realstart: + call [cs:mballoc],65535 + jc problem3 + push ax + pop es + call [cs:projfile],offset logo + jc problem + mov ecx,eax + call [cs:mbfind],offset logo + jc problem + call [cs: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 + jc problem4 + push cs + pop ds + call [cs:print],offset poper +endofit: + xor ax,ax + int 16h + call [cs:restorestate] + retf + +problem: + push cs + pop ds + call [cs:print],offset error + jmp endofit + +problem2: + push cs + pop ds + call [cs:print],offset error2 + jmp endofit + +problem3: + push cs + pop ds + call [cs:print],offset error3 + jmp endofit + +problem4: + push cs + pop ds + call [cs:print],offset error4 + jmp endofit + +poper db '\c0BC\c0CO\c0DS\c0E2\c0E0\c0E0\c0F0 en mode graphique',0 +logo db 'COS.RIP',0 +ok1 db 'Chargement de l''image OK',0 +ok2 db 'Decompression de l''image OK',0 +error3 db '\c04Une erreur est apparue lors de l''allocation de mémoire',0 +error db '\c04Une erreur est apparue lors du chargement de l''image',0 +error2 db '\c04Une erreur est apparue lors de la decompression de l''image',0 +error4 db '\c0FUne erreur est apparue lors de l''affichage de l''image',0 + + +importing +use VIDEO,restorestate +use VIDEO,savestate +use VIDEO,setvideomode +use VIDEO,clearscreen +use DISQUE,decompressrle +use DISQUE,projfile +use SYSTEME,mbfind +use SYSTEME,mballoc +use VIDEO.LIB,print +use BMP.LIB,showbmp +use BMP.LIB,loadbmppalet +endi diff --git a/programs/lpt/com.asm b/programs/lpt/com.asm new file mode 100644 index 0000000..4c83399 --- /dev/null +++ b/programs/lpt/com.asm @@ -0,0 +1,471 @@ +.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 + +;R‚alise un checksum 8 bits sur donn‚es DS:SI, nb CX r‚sultat dans dl +Checksum8: +push cx si +check: +add dl,[si] +inc si +dec cx +jnz check +pop si cx +ret + +;DS:SI pointeur sur donn‚es, CX nombres de donn‚es, AL token +SendLptBlock: +push ax bx cx edx si edi bp +mov dx,cx +shl edx,16 +mov dh,al +call checksum8 +mov edi,edx +xor dh,dh +mov bp,dx +mov ah,maxtry +retry: +mov bl,4 +xor al,al +header: +mov dx,di +call sendlpt +setne al +jc outt +rol edi,8 +dec bl +jnz header +cmp al,0 +jne notgood +mov dl,ACK +jmp allsend +notgood: +mov dl,NACK +allsend: +call sendlpt +setne al +jc outt +cmp al,0 +je okheader +dec ah +jnz retry +jmp outt +okheader: +cmp cx,0 +je endoftrans +mov di,maxtry +retry2: +mov bx,cx +xor ax,ax +body: +mov dl,[si+bx-1] +add ah,dl +call sendlpt +setne al +jc outt +dec bx +jnz body +cmp al,0 +jne notgood2 +mov dl,ACK +jmp allisend +notgood2: +mov dl,NACK +allisend: +call sendlpt +setne al +jc outt +cmp al,0 +je endoftrans +dec di +jnz retry2 +outt: +stc +endoftrans: +mov al,ah +xor ah,ah +cmp bp,ax +pop bp edi si edx cx bx ax +ret + +;Receptionne en es:di les donn‚es au nombres de CX token AL (AH) (ECX) +receiveLptBlock: +push 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; diff --git a/programs/lpt/project1.dpr b/programs/lpt/project1.dpr new file mode 100644 index 0000000..a771b7e --- /dev/null +++ b/programs/lpt/project1.dpr @@ -0,0 +1,12 @@ +program Project1; + +uses + Forms, + Unit1 in 'UNIT1.PAS' {Form1}; + +{$R *.RES} + +begin + Application.CreateForm(TForm1, Form1); + Application.Run; +end. diff --git a/programs/lpt/project1.opt b/programs/lpt/project1.opt new file mode 100644 index 0000000..8ebc76c --- /dev/null +++ b/programs/lpt/project1.opt @@ -0,0 +1,34 @@ +[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= diff --git a/programs/lpt/project1.res b/programs/lpt/project1.res new file mode 100644 index 0000000..ab74376 Binary files /dev/null and b/programs/lpt/project1.res differ diff --git a/programs/lpt/unit1.dcu b/programs/lpt/unit1.dcu new file mode 100644 index 0000000..ab1d6e8 Binary files /dev/null and b/programs/lpt/unit1.dcu differ diff --git a/programs/lpt/unit1.dfm b/programs/lpt/unit1.dfm new file mode 100644 index 0000000..8faee1a Binary files /dev/null and b/programs/lpt/unit1.dfm differ diff --git a/programs/lpt/unit1.pas b/programs/lpt/unit1.pas new file mode 100644 index 0000000..d3a6687 --- /dev/null +++ b/programs/lpt/unit1.pas @@ -0,0 +1,517 @@ +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. diff --git a/programs/pmode.asm b/programs/pmode.asm new file mode 100644 index 0000000..c7c048b --- /dev/null +++ b/programs/pmode.asm @@ -0,0 +1,22 @@ +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> + +realstart: + mov eax,cr0 + or al,1 + mov cr0,eax + retf + + diff --git a/programs/souris.asm b/programs/souris.asm new file mode 100644 index 0000000..eca057b --- /dev/null +++ b/programs/souris.asm @@ -0,0 +1,32 @@ +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> + +realstart: + call [mouseon] + jc errormouse + call [print],offset message + retf + +errormouse: + call [print],offset errormessage + retf + +message db 'Activation de la souris\l',0 +errormessage db 'impossible d''activer la souris\l',0 + +importing +use VIDEO.LIB,print +use MOUSE.SYS,mouseon +endi diff --git a/programs/test.asm b/programs/test.asm new file mode 100644 index 0000000..d48bc79 --- /dev/null +++ b/programs/test.asm @@ -0,0 +1,169 @@ +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> + +realstart: + call [savestate] + push 0FFFFh + pushd 652201 + pushd 1545454545 + push 1523 + push 2041 + push offset zero + push offset fixe + push 5 + push 'i' + push 'a' + pushd 5041 + pushd 125645 + pushd 5041 + pushd 125645 + pushd 5041 + pushd 125645 + push offset message + call [print] + xor ax,ax + int 16h + call [clearscreen] + call [xchgpages] + call [clearscreen] + mov cx,200 +go1: + call [xchgpages] + call [waitretrace] + call [print],offset textdemo1 + call put + call [xchgpages] + call [waitretrace] + dec cx + jnz go1 + mov cx,200 +go2: + call [xchgpages] + call [waitretrace] + call [print],offset textdemo2 + call put + call [xchgpages] + call [waitretrace] + dec cx + jnz go2 + mov cx,200 +go3: + call [xchgpages] + call [waitretrace] + call [print],offset textdemo3 + call put + call [xchgpages] + call [waitretrace] + dec cx + jnz go3 + call [xchgpages] + call [clearscreen] + call [print],offset texte2 + call [xchgpages] + call [clearscreen] + call [xchgpages] + mov bp,255 + xor edx,edx +go4: + call [xchgpages] + call [waitretrace] + inc edx + push edx + push offset texte3 + call [print] + call [xchgpages] + call [waitretrace] + dec bp + jnz go4 + push offset texte4 + call [print] + mov ax,0 + int 16h + call [restorestate] + retf +put: + call random + mov di,dx + and di,4096-2 + mov si,offset fond + call showstring2 + ret +random: + push ax + MOV AX,[cs:randseed] + MOV DX,8405h + MUL DX + INC AX + MOV [cs:randseed],AX + pop ax + ret +randseed dw 1234h +Randomize: + push ax cx dx + mov ah,0 + int 1ah + mov [cs:randseed],dx + pop dx cx ax + ret + +zero db 'Chaine a z‚ro terminal',0 +fixe db 20,'Chaine a taille fixe' +message db "\m01\e\c07\h01D‚monstration de la librairie VIDEO.LIB\l\l" + db "\c01Nombres entiers ou sign‚s (%%u/%%i):\l%u\l%iD\l" + db "\c02Nombre hexad‚cimaux (%%h):\l%hD\l%hW\l" + db "\c03Nombres Binaires (%%b):\l%bD\l%bB\l" + db "\c04Caracteres simples ou multiples (%%c/%%cM):\l%c\l%cM\l" + db "\c05Chaines a z‚ro terminal ou fixes (%%0/%%s):\l%s\l%0\l" + db "\c06Dates et heures (%%t/%%d):\l%t\l%d\l" + db "\c07Nombre a echelle automatique (%%z):\l%z\l%z\l" + db "\c08Attributs de fichiers (%%a):\l%a",0 + +fond db 16,'Ceci est un fond' +textdemo1 db '\c05Scrolling Scrolling Scrolling Scrolling Scrolling Scrolling Scrolling Scrolling\l',0 +textdemo2 db '\c07Vertical Vertical Vertical Vertical Vertical Vertical Vertical Vertical\l',0 +textdemo3 db '\c09Rapide Rapide Rapide Rapide Rapide Rapide Rapide Rapide\l',0 +texte1 db 'Echange rapide de pages Vid‚o',0 +texte2 db '\g04,13Routine d''affichage Ultra Rapide Agissant sur le Mat‚riel' + db '\g04,14Possibilit‚ de r‚aliser des effets de superposition',0 +texte3 db '\c04%bD\l',0 +texte4 db '\g01,00Sauvegarde et restauration de l''ecran (%%s/%%r)',0 + +showstring2: + push es bx cx si di + add di,4000 + mov bx,0B800h + mov es,bx + mov bl,[si] + mov ch,3 +strinaize4: + inc si + mov cl,[si] + mov [es:di],cx + add di,2 + dec bl + jnz strinaize4 + pop di si cx bx es + ret + + +importing +use VIDEO.LIB,print +use VIDEO,xchgpages +use VIDEO,setvideomode +use VIDEO,clearscreen +use VIDEO,savestate +use VIDEO,restorestate +use VIDEO,waitretrace +endi diff --git a/programs/verifier.asm b/programs/verifier.asm new file mode 100644 index 0000000..93d601e --- /dev/null +++ b/programs/verifier.asm @@ -0,0 +1,106 @@ +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> + +realstart: + call [savestate] + call [print],offset msg + mov bp,1000h + xor di,di + xor cx,cx + xor edx,edx +verifall: + mov ah,1 + int 16h + jz nokey + cmp al,' ' + je enend +nokey: + mov dx,di + push edx + mov dx,cx + inc dx + push edx + mov ax,cx + inc ax + mov si,100 + mul si + mov si,2880 + div si + mov dx,ax + push edx + call [print],offset msg2 + call gauge + call [verifysector],cx + jc errors + je noprob + inc di +noprob: + inc cx + cmp cx,2880 + jnz verifall +enend: + cmp di,0 + je noatall + call [print],offset error2 + jmp someof +noatall: + call [print],offset noerror +someof: + mov ah,0 + int 16h + call [restorestate] + retf +errors: + call [print],offset error + mov ah,0 + int 16h + call [restorestate] + retf + +error db '\g10,10Erreur avec le lecteur de disquette !',0 +error2 db '\g10,10Le disque est defectueux, appuyez sur une touche pour quitter',0 +noerror db '\g10,10Pas de secteurs defectueux, appuyez sur une touche pour continuer',0 +msg db '\m02\e\c07\g29,00- Test de surface du disque -\g02,49',0 +msg2 db '\g10,20%u %%\g10,16%u cluster testes. \h34%u cluster defectueux. ',0 + +gauge: + push ax dx + mov ax,cx + mul [sizeof] + div [max] + xor edx,edx + mov dx,[sizeof] + sub dx,ax + push dx + push 'Û' + mov dx,ax + push dx + push 'Û' + push offset gauges + call [print] + pop dx ax + retn + +max dw 2879 +sizeof dw 50 + +gauges db '\g10,18\c05%cM\c07%cM',0 + +importing +use VIDEO.LIB,print +use VIDEO,savestate +use VIDEO,restorestate +use DISQUE,verifysector +endi diff --git a/programs/volume.asm b/programs/volume.asm new file mode 100644 index 0000000..bc9703e --- /dev/null +++ b/programs/volume.asm @@ -0,0 +1,351 @@ +model tiny,stdcall +p586N +locals +jumps +codeseg +option procalign:byte + +include "..\include\mem.h" +include "..\include\divers.h" +include "..\include\graphic.h" + +org 0h + +start: +header exe <"CE",1,0,0,,offset imports,,offset realstart> + +realstart: +mov ax,0305h +mov bx,0008h +int 16h +call [savestate] +call [setvideomode],2 +xor ebp,ebp +xor ax,ax +mov fs,ax +call [disablescroll] +adres: +call [saveparamto],offset infos +call [readsector],[sect],offset buffer +jnc adres2 +errtr: + call [setxy],0,[word ptr lastline] + call [print],offset errordisk + xor ax,ax + int 16h +adres2: +call [saveparamto],offset infos +mov al,[infos.lines] +dec al +mov [lastline],al +mov al,[infos.columns] +sub al,16 +mov bl,al +shr al,2 +mov [sizex],al +and bl,11b +mov [sizex2],bl +mov al,[infos.mode] +cmp al,[oldmode] +je noinit +call [clearscreen] +mov [oldmode],al +noinit: +call [setxy],0,0 +mov edi,ebp +mov bh,[lastline] +lines: +xor edx,edx +mov dx,di +push edx +mov edx,edi +mov dx,[sect] +push edx +push offset spaces +call [print] +mov dx,di +mov al,[sizex] +mov esi,edi +doaline: +push [dword ptr di+offset buffer] +push 8 +call [showhex] +call [showchar],' ' +inc edi +dec al +jnz doaline +mov edi,esi +push offset spaces2 +call [print] +mov al,[sizex] +doaline2: +push [word ptr di+offset buffer] +call [showchar] +inc edi +dec al +jnz doaline2 +dec bh +je outes +cmp [sizex2],0 +je lines +call [addline] +jmp lines +outes: +call [setxy],0,[word ptr lastline] +call [print],offset menu + waitkey: + mov ax,0 + int 16h + cmp ax,3B00h + jne suit + cmp bp,8*16 + jae waitkey + add bp,16 + jmp adres2 + suit: + cmp ax,3C00h + jne suit2 + cmp bp,0 + je waitkey + sub bp,16 + jmp adres2 + suit2: + cmp ax,3D00h + jne suit3 + cmp [sect],2880 + ja waitkey + inc [sect] + jmp adres + suit3: + cmp ax,3E00h + jne suit4 + cmp [sect],0 + je waitkey + dec [sect] + jmp adres + suit4: + cmp ax,3F00h + jne suit5 + jmp adres2 + suit5: + cmp ax,4000h + jne suit6 +call [writesector],[sect],offset 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 ax,0B800h +mov es,ax +mov [xxyy2],3 +mov [xxyy],3 +call calc1 +call calc2 +waitst: +mov ax,0 +int 16h +cmp ah,41h +jne tre +mov [dword ptr pope],' EUV' +push cs +pop es +call [writesector],[sect],offset buffer + jnc waitkey + jmp errtr +tre: +cmp al,0 +jne write +cmp ah,48h +jne tre1 +cmp [yy],0 +je waitst +dec [yy] +jmp cursor +tre1: +cmp ah,50h +jne tre2 +mov al,[lastline] +dec al +xor ah,ah +cmp [yy],ax +je waitst +inc [yy] +jmp cursor +tre2: +cmp ah,4Dh +jne tre4 +cmp [xx],15 +je waitst +inc [xx] +jmp cursor +tre4: +cmp ah,4Bh +jne waitst +cmp [xx],0 +je waitst +dec [xx] +jmp cursor +write: +call asciihex2dec +cmp cl,15 +ja waitst +call calc1 +call calc2 +mov edi,[es:bx-1] +mov dx,[es:si-1] +mov [byte ptr es:bx],0112 +mov [es:bx-1],al +writs: + mov ax,0 + int 16h + mov ch,cl + call asciihex2dec + cmp cl,15 + ja writs + shl ch,4 + add ch,cl + mov [es:bx+1],al + mov [es:si-1],ch + mov ax,bx + call calc3 + mov [bx],ch + inc [xx] + cmp [xx],16 + jne pasde + inc [yy] + mov [xx],0h + pasde: + call calc1 + call calc2 + jmp waitst +cursor: +call calc1 +call calc2 +jmp waitst +suit7: +cmp ax,4200h +jne adres +call [restorestate] +retf +calc1: +push ax dx si +mov ax,[xx] +mov dx,[xx] +shl ax,2 +shl dx,1 +add ax,dx +add ax,27 +mov bx,[yy] +mov dx,[yy] +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 si,[xxyy] +mov [byte ptr es:si],07 +mov [byte ptr es:si+2],07 +mov [xxyy],bx +pop si dx ax +ret +calc2: +push ax bx dx +mov si,[yy] +mov dx,[yy] +shl si,5 +shl dx,7 +add si,dx +mov dx,[xx] +shl dx,1 +add si,dx +add si,129 +mov [byte ptr es:si],112 +mov bx,[xxyy2] +mov [byte ptr es:bx],07 +mov [xxyy2],si +pop dx bx ax +ret +calc3: + push dx + xor bx,bx + mov bx,[xx] + mov dx,[yy] + shl dx,4 + add bx,dx + add bx,bp + add bx,offset buffer + pop dx + ret + +asciihex2dec: +cmp al,'a' +jb nomin +cmp al,'f' +ja nomin +sub al,'a'-'A' +jmp ismaj +nomin: +cmp al,'A' +jb nomaj +cmp al,'F' +ja nomaj +ismaj: +mov cl,al +sub cl,'A'-10 +jmp endt +nomaj: +mov cl,al +sub cl,'0' +endt: +ret + +xx dw 0 +yy dw 0 +xxyy dw 3 +xxyy2 dw 3 + +lastline db 0 +sizex db 0 +sizex2 db 0 +buffer db 2048 dup (0) + +dep db ':',0 +errordisk db '\c74Une erreur est apparue sur le lecteur, appuyez sur une touche ',0 +menu db '\c70Haut&Bas [F1/2] Secteur [F3/4] Charger/Sauver [F5/6] Mode [F7] Quit. [F8] ' +pope db 'VUE ',0 +spaces db '\c02%hW:%hW \c04| \c07',0 +spaces2 db '\c04 | \c07',0 + +showbuffer db 35 dup (0FFh) +oldmode db 0 +sect dw 0 +infos vgainf <> + +importing +use DISQUE,readsector +use DISQUE,writesector +use VIDEO,setvideomode +use VIDEO,savestate +use VIDEO,restorestate +use VIDEO,setxy +use VIDEO,addline +use VIDEO,saveparamto +use VIDEO,disablescroll +use VIDEO,clearscreen +use VIDEO.LIB,print +use VIDEO.LIB,showhex +use VIDEO.LIB,showchar +endi + + + + + + + +