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.
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.)
Can I make this code shorter?


If you use the ORG 7C00h directive, then loading the segment registers will be shorter code.
You can choose to setup the stack below the bootloader and shave off that addition. Even if you leave the stack where you placed it before (above the bootloader), with SS=0 the change would become mov sp, 9E00h.
You avoid having to load the string address (and the need to come up with suitable label names) if you store the actual string directly beneath the call instruction and have the print_string routine jump back to behind the terminating zero.
This technique becomes more interesting if more than 1 string is to be printed.

    BITS  16
    ORG   7C00h

start:
    cld                          &lt;--- Not shorter but better!
    xor   ax, ax
    mov   ds, ax
    mov   ss, ax
    mov   sp, 7C00h

    call  print_string
    db    'OS', 0
    jmp   $

print_string:
    pop   si
    mov   bx, 7                  &lt;--- Not shorter but better!
    mov   ah, 0Eh
.repeat:
    cs lodsb ; Need CS override since SI is an offset in code segment!
    cmp   al, 0
    je    .done
    int   10h
    jmp   .repeat
.done:
    jmp   si


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

The CS segment override on the LODSB instruction is required unless you know that DS == CS. Many bootloaders will have a far jump at the top to ensure that this is the case. e.g. jmp 0000h:7C05h as the very first instruction. This will set CS=0.
Not shorter but better

Adding a CLD instruction makes sure that the LODSB instruction will function correctly.
Passing all the required parameters to the BIOS.Teletype function is best. BH is DisplayPage and BL is GraphicsColor. If you know that the screen is in a text video mode then you can drop the setting for BL and just write mov bh, 0 to select the video page.