白色的星星白色的月吧 关注:26贴子:618
  • 6回复贴,共1
近期的桌面wwww


IP属地:广东1楼2017-03-29 20:25回复
    .code16
    .section ".bstext", "ax"
    .global bootsect_start
    bootsect_start:
    cli
    movw %cs, %ax#ax = code section address
    movw%ax, %ds#ds = code section address
    movw%ax, %es#es = code section address
    movw0x4000, %ax#toplimit of stack
    movw%ax, %ss#ss = toplimit of stack
    xorw%sp, %sp#sp = 0
    movw0xB800, %ax
    movw%ax, %es#es = address of VGA
    xorw%di, %di#di = 0, initial address
    movw0x0000, %ax#ax = black space
    movw0x0250, %bx#the destination of loop
    cloop:stosw#store, di automatically + 2
    cmp%di, %bx#check if arrive the destination
    jb cloop
    xorw%di, %di#di = 0, initial print address
    movw$output, %si#si = output addr, init hello word addr
    movw0x004C, %bx#the destination of loop
    ploop:
    lodsb#al -> word, si automatically + 1
    movb0x07, %ah#ah -> white word
    stosw#print word in colour
    cmp%di, %bx
    jb ploop
    eloop:
    jmp eloop
    .section ".bsdata", "ax" #data section
    output: .ascii "helloworld by whitestarmeow, PB15111598"
    length:
    .int 2000
    strlen:
    .int 39
    .section ".signature", "a"
    .globl sig
    sig: .word 0xAA55


    IP属地:广东2楼2017-03-29 20:26
    回复
      gcc -c -m32 start16_hello.S -o start16_hello.o
      ld -T start16_hello.ld start16_hello.o -o start16_hello.elf
      objcopy -O binary start16_hello.elf start16_hello.bin
      dd if=/dev/zero of=a_start16_hello.img bs=512 count=2880
      sudo losetup /dev/loop4 a_start16_hello.img
      sudo dd if=start16_hello.bin of=/dev/loop4 bs=512 count=1
      sudo losetup -d /dev/loop4
      qemu-system-i386 -fda a_start16_hello.img


      IP属地:广东3楼2017-03-29 20:26
      回复
        start16_hello.ld
        /*
        * start16.ld
        *
        * Linker script for the i386 bootsect code
        */
        OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
        OUTPUT_ARCH(i386)
        ENTRY(bootsect_start)
        SECTIONS
        {
        . = 0x7C00;
        .bstext: { *(.bstext) }
        .bsdata: { *(.bsdata) }
        . = 0x7C00 + 510;
        .signature: { *(.signature) }
        }


        IP属地:广东4楼2017-03-29 20:30
        回复


          IP属地:广东来自Android客户端5楼2017-04-02 00:12
          回复


            IP属地:广东来自Android客户端6楼2017-04-26 18:18
            收起回复