diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2018-06-23 15:12:55 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2018-06-23 15:12:55 -0400 |
commit | 3b46e7ef1f4c3f364e75e780eff923ef146ee42c (patch) | |
tree | c1e08f6ec3925c9c57f2093d59ab7444de9e28ce /builtin_free.asm | |
parent | 2362c3ae6b32c816c4febe9714847fa4d80e1ad5 (diff) | |
download | minos-3b46e7ef1f4c3f364e75e780eff923ef146ee42c.tar.gz |
Implement initial builtin commands
Diffstat (limited to 'builtin_free.asm')
-rw-r--r-- | builtin_free.asm | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/builtin_free.asm b/builtin_free.asm new file mode 100644 index 0000000..96e3c86 --- /dev/null +++ b/builtin_free.asm @@ -0,0 +1,35 @@ +%ifndef _BUILTIN_FREE_ASM +%define _BUILTIN_FREE_ASM + +builtin_free: + push bp + mov bp, sp + + mov cx, word [bp + 4] ; argc + mov bx, word [bp + 6] ; argv + + ;cmp cx, 0 ; if no arguments, return + ;jbe .return + + mov ah, 88h ; get extended memory size + int 15h + mov dx, ax + + int 12h ; get conventional memory size + ; but it's pretty much bogus + + push dx + push ax + push .msg_fmt + call printf + add sp, 2 * 2 + add bx, 2 + + .return: + mov sp, bp + pop bp + ret + .msg_fmt db 'Conventional memory: %dK\n' + db 'Extended memory: %dK', 0 + +%endif |