Skip to main content
Tweeted twitter.com/StackCodeReview/status/1332293125457448960
added 96 characters in body
Source Link
Arian
  • 65
  • 1
  • 7

I made a very simple OS in Assembly. But my code is too long. I want to make my code shorter.

Here is my code:

    BITS 16

start:
    mov ax, 07C0h
    add ax, 288
    mov ss, ax
    mov sp, 4096

    mov ax, 07C0h
    mov ds, ax


    mov si, text_string
    call print_string

    jmp $


    text_string db 'OS', 0


print_string:
    mov ah, 0Eh

.repeat:
    lodsb
    cmp al, 0
    je .done
    int 10h
    jmp .repeat

.done:
    ret


    times 510-($-$$) db 0
    dw 0xAA55

Makefile:

DIR=build build
$(shell mkdir -p $(DIR))
$(shell nasm -f bin OS1.asm -o build/OS1.flp)
$(shell mkisofs -no-emul-boot -o build/OS1.iso -b OS1.flp build)

Can I make this code shorter? Is it possible to do? If it is, how?

(This code may be updated in my GitHub account.)

I made a very simple OS in Assembly. But my code is too long. I want to make my code shorter.

Here is my code:

    BITS 16

start:
    mov ax, 07C0h
    add ax, 288
    mov ss, ax
    mov sp, 4096

    mov ax, 07C0h
    mov ds, ax


    mov si, text_string
    call print_string

    jmp $


    text_string db 'OS', 0


print_string:
    mov ah, 0Eh

.repeat:
    lodsb
    cmp al, 0
    je .done
    int 10h
    jmp .repeat

.done:
    ret


    times 510-($-$$) db 0
    dw 0xAA55

Makefile:

DIR=build build
$(shell mkdir -p $(DIR))
$(shell nasm -f bin OS1.asm -o build/OS1.flp)
$(shell mkisofs -no-emul-boot -o build/OS1.iso -b OS1.flp build)

Can I make this code shorter? Is it possible to do? If it is, how?

I made a very simple OS in Assembly. But my code is too long. I want to make my code shorter.

Here is my code:

    BITS 16

start:
    mov ax, 07C0h
    add ax, 288
    mov ss, ax
    mov sp, 4096

    mov ax, 07C0h
    mov ds, ax


    mov si, text_string
    call print_string

    jmp $


    text_string db 'OS', 0


print_string:
    mov ah, 0Eh

.repeat:
    lodsb
    cmp al, 0
    je .done
    int 10h
    jmp .repeat

.done:
    ret


    times 510-($-$$) db 0
    dw 0xAA55

Makefile:

DIR=build build
$(shell mkdir -p $(DIR))
$(shell nasm -f bin OS1.asm -o build/OS1.flp)
$(shell mkisofs -no-emul-boot -o build/OS1.iso -b OS1.flp build)

Can I make this code shorter? Is it possible to do? If it is, how?

(This code may be updated in my GitHub account.)

Ediit tags
Source Link
1201ProgramAlarm
  • 7.8k
  • 2
  • 22
  • 39

I made a very simple OS in Assembly. But my code is too long. I want to make my code shorter.

ItHere is my code:

    BITS 16

start:
    mov ax, 07C0h
    add ax, 288
    mov ss, ax
    mov sp, 4096

    mov ax, 07C0h
    mov ds, ax


    mov si, text_string
    call print_string

    jmp $


    text_string db 'OS', 0


print_string:
    mov ah, 0Eh

.repeat:
    lodsb
    cmp al, 0
    je .done
    int 10h
    jmp .repeat

.done:
    ret


    times 510-($-$$) db 0
    dw 0xAA55

Makefile:

DIR=build build
$(shell mkdir -p $(DIR))
$(shell nasm -f bin OS1.asm -o build/OS1.flp)
$(shell mkisofs -no-emul-boot -o build/OS1.iso -b OS1.flp build)

Can I make this code shorter? Is it possible to do? If it is, how?

I made a very simple OS in Assembly. But my code is too long. I want to make my code shorter.

It is my code:

    BITS 16

start:
    mov ax, 07C0h
    add ax, 288
    mov ss, ax
    mov sp, 4096

    mov ax, 07C0h
    mov ds, ax


    mov si, text_string
    call print_string

    jmp $


    text_string db 'OS', 0


print_string:
    mov ah, 0Eh

.repeat:
    lodsb
    cmp al, 0
    je .done
    int 10h
    jmp .repeat

.done:
    ret


    times 510-($-$$) db 0
    dw 0xAA55

Makefile:

DIR=build build
$(shell mkdir -p $(DIR))
$(shell nasm -f bin OS1.asm -o build/OS1.flp)
$(shell mkisofs -no-emul-boot -o build/OS1.iso -b OS1.flp build)

Can I make this code shorter? Is it possible to do? If it is, how?

I made a very simple OS in Assembly. But my code is too long. I want to make my code shorter.

Here is my code:

    BITS 16

start:
    mov ax, 07C0h
    add ax, 288
    mov ss, ax
    mov sp, 4096

    mov ax, 07C0h
    mov ds, ax


    mov si, text_string
    call print_string

    jmp $


    text_string db 'OS', 0


print_string:
    mov ah, 0Eh

.repeat:
    lodsb
    cmp al, 0
    je .done
    int 10h
    jmp .repeat

.done:
    ret


    times 510-($-$$) db 0
    dw 0xAA55

Makefile:

DIR=build build
$(shell mkdir -p $(DIR))
$(shell nasm -f bin OS1.asm -o build/OS1.flp)
$(shell mkisofs -no-emul-boot -o build/OS1.iso -b OS1.flp build)

Can I make this code shorter? Is it possible to do? If it is, how?

Source Link
Arian
  • 65
  • 1
  • 7

Very simple OS in Assembly

I made a very simple OS in Assembly. But my code is too long. I want to make my code shorter.

It is my code:

    BITS 16

start:
    mov ax, 07C0h
    add ax, 288
    mov ss, ax
    mov sp, 4096

    mov ax, 07C0h
    mov ds, ax


    mov si, text_string
    call print_string

    jmp $


    text_string db 'OS', 0


print_string:
    mov ah, 0Eh

.repeat:
    lodsb
    cmp al, 0
    je .done
    int 10h
    jmp .repeat

.done:
    ret


    times 510-($-$$) db 0
    dw 0xAA55

Makefile:

DIR=build build
$(shell mkdir -p $(DIR))
$(shell nasm -f bin OS1.asm -o build/OS1.flp)
$(shell mkisofs -no-emul-boot -o build/OS1.iso -b OS1.flp build)

Can I make this code shorter? Is it possible to do? If it is, how?