1987-10-06 16:39:14 +00:00
|
|
|
.sect .text; .sect .rom; .sect .data; .sect .bss
|
|
|
|
|
1987-10-30 15:35:50 +00:00
|
|
|
.define begtext,begdata,begbss,syscal
|
1987-10-06 16:39:14 +00:00
|
|
|
.define hol0,.reghp,.limhp,.trppc,.ignmask
|
|
|
|
.define ERANGE,ESET,EHEAP,ECASE,EILLINS,EIDIVZ,EODDZ
|
1991-03-06 14:26:16 +00:00
|
|
|
.extern endbss
|
1987-10-06 16:39:14 +00:00
|
|
|
|
|
|
|
ERANGE = 1
|
|
|
|
ESET = 2
|
|
|
|
EIDIVZ = 6
|
|
|
|
EHEAP = 17
|
|
|
|
EILLINS = 18
|
|
|
|
EODDZ = 19
|
|
|
|
ECASE = 20
|
|
|
|
|
|
|
|
.sect .text
|
1987-10-30 15:35:50 +00:00
|
|
|
.data1 0353
|
|
|
|
.data1 0176 ! jmp to begtext in 2 bytes. Assembler generates 3
|
|
|
|
! bytes.
|
|
|
|
syscal: jmp 1f
|
|
|
|
grow: jmp 2f
|
|
|
|
jmp 2f
|
|
|
|
.data2 -277, -277, -277, -277, -277, -277
|
|
|
|
2:
|
|
|
|
mov ax,2088
|
|
|
|
1:
|
|
|
|
int 5
|
|
|
|
jmp 1f
|
|
|
|
.space 100
|
|
|
|
1:
|
|
|
|
ret
|
|
|
|
|
1987-10-06 16:39:14 +00:00
|
|
|
begtext:
|
|
|
|
mov bx,sp
|
|
|
|
mov cx,(bx)
|
|
|
|
add bx,2
|
|
|
|
mov ax,cx
|
|
|
|
inc ax
|
|
|
|
shl ax,1
|
|
|
|
add ax,bx
|
|
|
|
push ax
|
|
|
|
push bx
|
|
|
|
push cx
|
|
|
|
xor bp,bp
|
1991-03-06 14:26:16 +00:00
|
|
|
mov bx,endbss
|
1987-10-30 15:35:50 +00:00
|
|
|
mov cx,9
|
|
|
|
add bx,1024
|
|
|
|
shr bx,cl
|
|
|
|
shl bx,cl
|
|
|
|
call grow
|
1988-07-13 16:55:48 +00:00
|
|
|
xor cx,cx
|
|
|
|
push cx
|
1991-03-06 14:26:16 +00:00
|
|
|
call __sbrk
|
1988-07-13 16:55:48 +00:00
|
|
|
mov (.limhp),ax
|
|
|
|
mov (.reghp),ax ! on Xenix, heap begins above stack!
|
|
|
|
pop ax
|
1991-03-06 14:26:16 +00:00
|
|
|
call __m_a_i_n
|
1988-07-13 16:55:48 +00:00
|
|
|
push ax
|
1987-10-06 16:39:14 +00:00
|
|
|
call __exit
|
|
|
|
.sect .data
|
|
|
|
begdata:
|
|
|
|
hol0:
|
|
|
|
.data2 0,0
|
|
|
|
.data2 0,0
|
|
|
|
argv:
|
|
|
|
.data2 3f
|
|
|
|
envp:
|
|
|
|
.data2 0
|
|
|
|
3:
|
|
|
|
.asciz "PROGRAM"
|
|
|
|
.reghp:
|
|
|
|
.data2 endbss
|
|
|
|
.limhp:
|
|
|
|
.data2 endbss
|
|
|
|
.ignmask:
|
|
|
|
.data2 0
|
|
|
|
.trppc:
|
|
|
|
.data2 0
|
|
|
|
|
|
|
|
.sect .bss
|
|
|
|
begbss:
|