Skip to content

Commit

Permalink
stage hello world incomplete
Browse files Browse the repository at this point in the history
  • Loading branch information
anurag-bit committed Oct 20, 2023
1 parent 801ad99 commit e8aea20
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
Binary file modified anurag-os-dev/build/main.bin
Binary file not shown.
Binary file modified anurag-os-dev/build/main_floppy.img
Binary file not shown.
42 changes: 41 additions & 1 deletion anurag-os-dev/src/main.asm
Original file line number Diff line number Diff line change
@@ -1,8 +1,40 @@
org 0x7C00
bits 16

%define ENDL 0x0D, 0x0A

start:
jmp main

;
;
;Prints a String to the screen.
;Params:
; - ds:si points to strings
;
;
puts:
push si
push ax
push bx

.loop:
lodsb ;loads the next character in al
or al, al ;verify if next character is null?
jz .done

mov ah, 0x0E ;call bios interrupt routine
mov bh, 0
int 0x10

jmp .loop

.done:
pop bx
pop ax
pop si
ret


main:
Expand All @@ -13,12 +45,20 @@ main:

; setup stack
mov ss, ax
mov sp, 0x7C00 ; stack grows down
mov sp, 0x7C00 ; stack grows downwards from where loaded into memory

; print message
mov si, msg_hello
call puts

hlt

.halt:
jmp .halt


msg_hello: db 'Hello world!', ENDL, 0


times 510-($-$$) db 0
dw 0AA55h

0 comments on commit e8aea20

Please sign in to comment.