0

I'm trying to crate a prompt. I can't figure out how to store the typed text somewhere. I'm storing it because i want to make commands. Feel free to compile it :). This is a 8-bit operating system. I use nasm to compile my code. I have an intel cpu. I use QEMU to run my code. I use Linux as my operating system. Here is my code:

[ORG 0x7c00]
    xor ax, ax
    mov ds, ax
    cld

    mov si, msg
    call bios_print
    call keyboard

hang:
    jmp hang

msg db "Hello World!", 13, 10, 0
prompt db 0x0a, 0x0d, '> ', 0
 
bios_print:
    lodsb
    or al, al
    jz done
    mov ah, 0x0E
    mov bh, 0
    int 0x10
    jmp bios_print
clear:
    int 10h

keyboard:
    mov ah, 00h
    int 16h

    cmp ah, 0x1C
    je .enter

    mov ah, 0x0e
    int 0x10
    jmp keyboard
    .enter:
        hlt
        mov si, prompt
        call bios_print
        jmp keyboard

done:
    ret

    times 510-($-$$) db 0
    db 0x55
    db 0xAA
Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
  • 1
    Consider moving away from writing boot loaders. The environment is too restrictive to do anything useful with. – fuz Aug 16 '21 at 11:45
  • 1
    That is not what i asked –  Aug 16 '21 at 12:03
  • 1
    As an easier alternative, consider just writing DOS programs until you got the hang of it. – fuz Aug 16 '21 at 12:10
  • Okay what to you want me to do instead of botloaders? –  Aug 16 '21 at 13:11
  • Write COM-type DOS programs. You can do mostly the same thing as in a boot loader, but you are not restricted to 512 byte and get to play with the DOS API. This allows you to do stuff like reading or writing files. – fuz Aug 16 '21 at 13:15
  • 3
    A boot loader should really not do a whole lot more than loading the remaining system from disk. There's just not enough space for anything else. And it's always sad to see beginners get discouraged and frustrated due to all the uncertainties and restrictions you have when writing a boot loader. It's just not particularly educative. – fuz Aug 16 '21 at 13:16
  • 2
    What do you mean by "This is a 8-bit operating system."? x86 doesn't have an 8-bit mode, and your code is of course using some 16-bit registers. – Peter Cordes Aug 16 '21 at 14:23

0 Answers0