        .386p
        jumps
code32  segment para public use32
        assume cs:code32, ds:code32, ss:code32

include start32.inc     ; All externs are defined in there

public  _main

;ฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑ
; DATA
;ฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑ
msg0            db      'Free low mem:  '
msg0len=$-msg0
msg1            db      'Free high mem: '
msg1len=$-msg1

;ฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑ
; CODE
;ฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑฑ

;อออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออออ
_main:
        @rlp edi,0b8000h                ; fill text screen with stuff
        mov ecx,80*25
        mov al,'ฑ'
        mov ah,78h
        rep stosw

        mov ah,0fh                      ; put amount of free low mem
        @rlp edi,0b8000h+2*160+4
        mov esi,offset msg0
        mov ecx,msg0len
mainl0:
        lodsb
        stosw
        loop mainl0
        call _lomemsize
        call putnum

        @rlp edi,0b8000h+3*160+4        ; put amount of free high mem
        mov esi,offset msg1
        mov ecx,msg1len
mainl1:
        lodsb
        stosw
        loop mainl1
        call _himemsize
        call putnum

; Uncomment this and the next piece of code if you have a mouse driver loaded
; and want to test the handling of real-mode IRQs.
;       mov v86r_ax,0                   ; Enable and unhide mouse cursor
;       mov al,33h
;       int 30h
;       mov v86r_ax,1
;       int 30h

        mov v86r_ah,0                   ; INT 16h, AH=0, wait for keypress
        mov al,16h
        int 30h

;       mov v86r_ax,0                   ; Disable mouse
;       mov al,33h
;       int 30h

        jmp _exit                       ; return to real mode

;-----------------------------------------------------------------------------
putnum:                                 ; put EAX to EDI
        mov edx,eax
        mov ecx,8
        mov ebx,offset _hextbl
        mov ah,0fh
putnuml0:
        rol edx,4
        mov al,dl
        and al,0fh
        xlat
        stosw
        loop putnuml0
        ret


code32  ends
        end

