-
Notifications
You must be signed in to change notification settings - Fork 15
/
mem2.asm
99 lines (77 loc) · 1.69 KB
/
mem2.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
.386p
_DATA segment use16 word public 'DATA' ;IGNORE
a db 1
;padding db 10241024 dup(?)
b db 2
cc db 3
d db 4
e db 5
f db 6
pas_de_mem db 'NOT enought memory for VGA display, controls work for network games',13,10,'$'
pbs1 db 'probleme dans allocation de descriptor..',13,10,'$'
pbs2 db 'probleme dans dans definition de la taille du segment',13,10,'$'
ASCII DB '00000000',0Dh,0Ah,'$' ; buffer for ASCII string
_DATA ends ;IGNORE
_TEXT segment use16 word public 'CODE' ;IGNORE
assume cs:_TEXT,ds:_DATA
start proc near
taille_moire equ ((((2030080+64000*26)/4096)+1)*4096)-1
;--------------------- rÇserve de la mÇmoire pour mettre les donnÇes. ----
;2.29 - Function 0501h - Allocate Memory Block:
;In: AX = 0501h
; BX:CX = size of block in bytes (must be non-zero)
;Out: if successful:
; carry flag clear
; BX:CX = linear address of allocated memory block
; SI:DI = memory block handle (used to resize and free block)
mov bx,1024*10/16
mov ah,48h
int 21h
jc failure
mov es,ax
mov bx,(1024*10/16)-1
mov ah,4Ah
int 21h
jc failure
mov byte ptr es:[0],55
cmp byte ptr es:[0],55
jne failure
mov bx,(1024*10/16)+5
mov ah,4Ah
int 21h
jc failure
inc byte ptr es:[0]
cmp byte ptr es:[0],56
jne failure
mov ah,49h
int 21h
jc failure
mov bx,5
mov ah,4Ah
int 21h
jc failure
push es
mov bx,10
mov ah,4Ah
int 21h
jc failure
mov ah,49h
int 21h
jc failure
pop es
mov ah,49h
int 21h
jc failure
MOV al,0
JMP exitLabel
failure:
mov al,1
exitLabel:
mov ah,4ch ; AH=4Ch - Exit To DOS
int 21h ; DOS INT 21h
start endp
_TEXT ends ;IGNORE
stackseg segment para stack 'STACK' ;IGNORE
db 1000h dup(?)
stackseg ends ;IGNORE
end start ;IGNORE