Last active
May 30, 2018 04:19
-
-
Save rebeccajae/190cb4535a050f49f1227595c93a2c94 to your computer and use it in GitHub Desktop.
Simple string printer in x86 ASM.
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
| global start | |
| section .text | |
| bits 32 | |
| string_start: | |
| dw 0x2f33, 0x2f32, 0x2f4f, 0x2f4b, 0x0 | |
| start: | |
| mov esp, stack_top | |
| mov ecx, 0x0 ; begin writing at character 0 in string | |
| mov ebx, string_start ; string starts at this pointer | |
| call write_string ; call display write | |
| hlt | |
| write_string: | |
| mov dx, [2*ecx + ebx] | |
| cmp dx, 0x0 | |
| jz .endwrite | |
| mov [2*ecx + 0xb8000], dx | |
| inc ecx | |
| jmp write_string | |
| .endwrite: | |
| ret | |
| stack_top: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment