; ==================================
;
; BUG IN 16 BIT REAL MODE
;
; Author: Matthew W. Coan
; Date: Wed Apr  8 15:13:43 EDT 2015
; ==================================

[bits 16]
[org 0]

start:

	mov ax,cs
	mov ds,ax
	mov es,ax
	
	mov ah,03
	mov bh,0
	int 10h

        mov bp,sp
	sub sp,4
	mov bx,0
test_loop:
        add bx,[bp+2]
        add bx,[bp+4]
	add bx,100
	
	pusha
	push msg
	call print
	add sp,2
	popa
	
	jmp test_loop
	
	jmp 0x1000:0

print:
        push bp
        mov bp,sp
        mov si,[bp+4]
        again:
        mov al,[si]
        mov ah,0eh
        int 10h
        inc si
        mov al,[si]
        cmp al,0
        je endit
        jmp again
        endit:
        mov sp,bp
        pop bp
        ret

msg db "Hello, World!",10,13
