diff --git a/programs/memoire.asm b/programs/memoire.asm index f220b60..5b33bf5 100644 --- a/programs/memoire.asm +++ b/programs/memoire.asm @@ -1,82 +1,77 @@ -.model tiny -.486 -smart -.code +model tiny,stdcall +p586N +locals +jumps +codeseg +option procalign:byte + +include "..\include\mem.h" +include "..\include\divers.h" org 0h -include ..\include\mem.h -include ..\include\divers.h - start: -header exe <,1,0,,,offset imports,,> +header exe <"CE",1,0,0,,offset imports,,offset realstart> realstart: -push offset msg -call [print] - -xor cx,cx + call [cs:print],offset msg + xor ebx,ebx + xor cx,cx listmcb: -mov ah,4 -int 49h -jc fino -inc cx - -;placement mémoire -mov dx,gs -inc dx -inc dx -push edx - + call [cs:mbget],cx + jc fino + dec ax + dec ax + mov gs,ax + inc cx + mov dx,gs + push edx ;Emplacement memoire hex 2 ;parent -cmp gs:[MB.Reference],0 -je next -mov dx,gs:[MB.Reference] -dec dx -dec dx -push dx -push offset MB.Names -jmp suitemn + cmp [gs:mb.reference],0 + jne next + push cs + push offset none ;parent lstr0 2x2 + add bx,[gs:mb.sizes] + jmp suitemn next: -push cs -push offset none + mov dx,[gs:mb.reference] + dec dx + dec dx + push dx ;parent lstr0 2x2 + push offset (mb).names suitemn: - -;Resident -cmp gs:[MB.IsResident],true -jne notresident -push offset resident -jmp suitelistmcb + cmp [gs: mb.isresident],true + jne notresident + push offset resident ;resident str0 2 + jmp suitelistmcb notresident: -push offset nonresident + push offset nonresident ;resident str0 2 suitelistmcb: - -;taille memoire -xor edx,edx -mov dx,gs:[MB.Sizes] -shl edx,4 -push 6 -push edx - -;nom -push gs -push offset MB.Names - -push offset line -call [print] - -jmp listmcb + xor edx,edx + mov dx,[gs: mb.sizes] + shl edx,4 + push 6 ;decimal 4 + type 2 + push edx + push gs ;nom lstr0 2x2 + push offset (mb).names + push offset line2 ;ligne + call [cs:print] + jmp listmcb fino: -db 0CBh -resident db "oui",0 -nonresident db "non",0 -line db "%0P\h15%w\h24%0\h30%0P\h46%hW\l",0 -msg db "Memory manager V1.5\lNom Taille Res Parent Mem\l",0 -none db ".",0 + shl ebx,4 + push ebx + push offset fin + call [cs:print] + retf +resident db "oui",0 +nonresident db "non",0 +line2 db "%0P\h15|%w\h25|%0\h30|%0P\h46|%hW\l",0 +fin db "\l\l\c02%u octets de memoire disponible\l\c07",0 +msg db "Plan de la memoire\l\lNom | Taille |Res |Parent |Mem\l",0 +none db ".",0 -imports: - db "VIDEO.LIB::print",0 -print dd 0 - dw 0 - -end start + +importing +use VIDEO.LIB,print +use SYSTEME,mbget +endi