From 3fae8c41afe67047fb2a11ae7e25ee9d8be2c302 Mon Sep 17 00:00:00 2001 From: Alex Kotov Date: Thu, 27 Jan 2022 05:33:11 +0500 Subject: [PATCH] Add func "print_size" --- src/x86_stage1.S | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/src/x86_stage1.S b/src/x86_stage1.S index bccbab8..5a999b1 100644 --- a/src/x86_stage1.S +++ b/src/x86_stage1.S @@ -62,25 +62,13 @@ main: mov $STAGE2_BASE, %bx /* Address */ int $0x13 - mov $STAGE1_ADDR(stage1_size_str), %si - call print_str - mov $STAGE1_ADDR(size), %bx mov (%bx), %ax - call print_number - - mov $STAGE1_ADDR(newline), %si - call print_str - - mov $STAGE1_ADDR(stage2_size_str), %si - call print_str + call print_size mov $STAGE2_ADDR(size), %bx mov (%bx), %ax - call print_number - - mov $STAGE1_ADDR(newline), %si - call print_str + call print_size ljmp $0, $STAGE2_BASE @@ -141,4 +129,19 @@ print_number_notnull: ret +// AX - size +print_size: + push %ax + + mov $STAGE1_ADDR(stage1_size_str), %si + call print_str + + pop %ax + call print_number + + mov $STAGE1_ADDR(newline), %si + call print_str + + ret + _end: