user9216466
user9216466

Reputation:

AssemblyOS questions

So, I am making an OS in Assembly for fun and learning. I have a few questions however. First of all, I want my OS to make use of all the cores/threads it can. In Python, you just import multiprocessing and then use a pool/threads script to make use of a set number of cores. I want the user to be prompted to enter the number of cores in their system (or it is automatically detected) and then it is stored away in a text file or something like that, so that the next time you boot the OS reads the text file and says, "Hey, he has four cores. Use them." Can I achieve this by using Assembly to run a python program, or just pure Assembly? If so, please tell me how. Secondly, how do I get keyboard input in Assembly? In python, it is a=raw_input("enter text here") but I don't know how to in Assembly. I need to know because my OS is like a great big terminal. Thanks, and sorry if this is too long. I'm new to the site and have a bunch of questions.

Upvotes: 1

Views: 104

Answers (1)

Sep Roland
Sep Roland

Reputation: 39711

how do I get keyboard input in Assembly?

You can use the BIOS keyboard API for input of a single key.

mov ah, 00h  ;BIOS.GetKey
int 16h      ; -> AL is ASCII, AH is scancode

Can I achieve this by using Assembly to run a python program, or just pure Assembly?

If you're making an OS in Assembly (for fun and learning), then all the things you ask about are possible from writing assembly code.

As an example displaying a prompt:

    cld
    mov  si, msg
    mov  bx, 0007h  ; Display page 0 and Color WhiteOnBlack
    jmp  .b
.a: mov  ah, 0Eh    ; BIOS.Teletype
    int  10h
.b: lodsb
    test al, al
    jnz  .a
    ...
msg: db 'How many cores?',0

Reading and writing files requires you to develop a filesystem of your own, or simpler, use the filesystem that's already on the disk (like Fat16) from the existing OS.

Upvotes: 1

Related Questions