Created
October 2, 2024 18:05
-
-
Save risknu/a41e6ff55193543d539e782666f770d5 to your computer and use it in GitHub Desktop.
simple assembler program
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[BITS 16] | |
[ORG 0x7C00] | |
; change video mode to 80x25 | |
mov ah, 0x00 | |
mov al, 0x03 | |
int 0x10 ; call bios | |
; change boot backgrund color to blue | |
mov ah, 0x0B | |
mov bh, 0x00 | |
mov bl, 0xF1 | |
int 0x10 ; call bios | |
; print hello_world string | |
mov si, helloworldmessage | |
call puthelloworld | |
; wait 'q' or ESC press button to exit | |
wait_key: | |
mov ah, 0x00 | |
int 0x16 ; call bios | |
cmp al, 'q' | |
je shutdown | |
cmp al, 0x1B | |
je shutdown | |
jmp wait_key | |
; shutdown function for shutdown :) | |
shutdown: | |
mov ax, 0x5307 ; ACPI shutdown | |
mov bx, 0x0001 | |
mov cx, 0x0003 | |
int 0x15 ; call bios function | |
jmp $ | |
; function for print hello world text | |
puthelloworld: | |
mov ah, 0x0E ; bios teletype | |
.next_char: | |
lodsb | |
cmp al, 0 | |
je .done | |
int 0x10 | |
jmp .next_char | |
.done: | |
ret | |
; hello world text | |
helloworldmessage db 'hi from asm, for quit press q or ESC :)', 0 | |
; end of script | |
times 510-($-$$) db 0 | |
dw 0xAA55 ; load sector |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment