	.8086

;
;	Real mode test functions	
;

	assume	cs:CODE16

CODE16	segment public byte 'CODE'

	public	_hello16

	dw	hello16_end-hello16_start

_hello16 proc	far

hello16_start label near

	push	ds

	mov	dx,offset my_msg - hello16_start
	push	cs
	pop	ds

	mov	ah,9h
	int	21h

	pop	ds
	ret

my_msg	label	near
	db	'Hello from real mode.',0dh,0ah,'$'

hello16_end label near

_hello16 endp

	public	_reg_test16

	dw	reg_test16_end-reg_test16_start

_reg_test16 proc far

reg_test16_start label near

	neg	ax
	neg	bx
	neg	cx
	neg	dx
	neg	si
	neg	di
	neg	bp

	push	ax
	mov	ax,ds
	neg	ax
	mov	ds,ax
	mov	ax,es
	neg	ax
	mov	es,ax
	pop	ax
	
	ret

reg_test16_end label near

_reg_test16 endp

	public	_stack_test16

	dw	stack_test16_end-stack_test16_start

_stack_test16 proc far

stack_test16_start label near

	push	bp
	mov	bp,sp

	mov	ax,[bp + 6]
	mov	bx,[bp + 8]
	mov	cx,[bp + 10]

	pop	bp
	
	ret

stack_test16_end label near

_stack_test16 endp

	public	_pascal_test16

	dw	pascal_test16_end-pascal_test16_start

_pascal_test16 proc far

pascal_test16_start label near

	push	bp
	mov	bp,sp

	mov	ax,[bp + 12]
	mov	bx,[bp + 10]
	mov	cx,[bp + 8]
	mov	dx,[bp + 6]

	pop	bp

	ret	8

pascal_test16_end label near

_pascal_test16 endp

CODE16	ends

	end


