Last active
November 29, 2018 15:28
-
-
Save kmahyyg/4e8dc523f513ff78a53c18e4234460af to your computer and use it in GitHub Desktop.
ASM-EXP5
This file contains hidden or 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
| ; TESTED ON MASM | |
| ; REF: http://www.computing.dcu.ie/~ray/teaching/CA296/notes/8086_bios_and_dos_interrupts.html#int10h_13h | |
| assume cs:codesg | |
| codesg segment | |
| mov al, 1 ;string contains attibutes | |
| mov bh, 0 ;set to page 0 | |
| mov bl, 01001111b ;set foreground color == red, background color == white | |
| mov cx, msg1end - offset msg1 ; calculate message size, not include attributes | |
| mov dl, 10 ;write start at column | |
| mov dh, 7 ;write start at line | |
| push cs ;save current program addr to stack | |
| pop es ;load this program to es and make it start here | |
| mov bp, offset msg1 ;points to the string | |
| mov ah, 13h ;set mode - write string | |
| int 10h ;do print | |
| jmp msg1end | |
| msg1 db "Hello world" | |
| msg1end: | |
| mov ax,4c00h | |
| int 21h | |
| codesg ends | |
| end |
This file contains hidden or 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
| ;TESTED ON NASM | |
| org 0x7c00 | |
| bits 16 | |
| xor ax, ax | |
| mov es, ax | |
| mov bh, 0 | |
| mov bp, msg | |
| mov ah, 0x13 | |
| mov bl, [colors] | |
| mov al, 1 | |
| mov cx, [msg_length] | |
| mov dh, [msg_y] | |
| mov dl, [msg_x] | |
| int 0x10 | |
| jmp $ | |
| colors dw 0x4F | |
| msg db ' hello world ' | |
| msg_length dw $-msg | |
| msg_x dw 10 | |
| msg_y dw 7 | |
| times 510 - ($-$$) db 0 | |
| dw 0xAA55 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment