Changes between Version 34 and Version 35 of WikiStart


Ignore:
Timestamp:
May 9, 2009, 3:17:29 PM (15 years ago)
Author:
Mattia Monga
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • WikiStart

    v34 v35  
    1313=== Programmi ===
    1414
    15  * Accesso diretto alla macchina fisica `mioboot-nobios-simple.asm`
    16 {{{
    17 bits 16                         ; 16 bit real mode
    18 org 0x7C00                      ; origine indirizzo 0000:7C00
    19 
    20 start: 
    21  mov ax, 0xb800  ; text video memory
    22  mov ds, ax
    23  mov eax, 10
    24 write:
    25  cmp eax, 0
    26  jz end
    27  mov byte [eax], 'm'
    28  mov byte [eax+1], 0x0F    ; attrib = white on black
    29  sub eax, 2
    30  jmp write
    31 end:
    32  hlt
    33 
    34 times 510-($-$$) db 0 ; 0-padding
    35 dw 0xAA55
    36 }}}
    37 {{{
    38 #!sh
    39 nasm -l mioboot-nobios-simple.lst -o mioboot-nobios-simple.img mioboot-nobios-simple.asm
    40 qemu mioboot-nobios-simple.img
    41 }}}
    42 
    43 
    44  * Uso dei servizi del BIOS `mioboot.asm`
    45 {{{
    46 bits 16                         ; 16 bit real mode
    47 org 0x7C00                      ; origine indirizzo 0000:7C00
    48        
    49 start:
    50         cld                     ; clears direction flag (index regs incremented)
    51         mov si, boot
    52         call message
    53 working:
    54         mov si, work
    55         call message
    56 
    57         call waitenter
    58         jmp working
    59 
    60 message:
    61         lodsb                   ; carica un byte da [DS:SI] in AL e inc SI
    62         cmp al, 0
    63         jz done
    64         mov ah, 0x0E            ; write char to screen in text mode
    65         mov bx, 0               ; BH page number BL foreground color
    66         int 0x10                ; write AL to screen (BIOS)
    67         jmp message
    68 done:   ret
    69 
    70 boot: db "Loading unuseful system...." , 10, 13, 0
    71 work: db "I've done my unuseful stuff!" , 10, 13, 0
    72 cont: db "Hit ENTER to continue...", 10, 13, 0
    73 wow: db "Great! Hello world!" , 10, 13, 0
    74        
    75 waitenter: mov si, cont
    76            call message
    77            mov ah, 0
    78            int 0x16                ; Wait for keypress (BIOS)
    79            cmp al, 'm'
    80            jz egg
    81            cmp al, 'b'
    82            jz basic
    83            cmp al, 13
    84            jnz waitenter
    85            ret
    86 egg:       mov si, wow
    87            call message
    88            jmp waitenter
    89 basic:     int 0x18             ; basic (BIOS)
    90            hlt
    91 
    92         times 510-($-$$) db 0
    93         dw 0xAA55
    94 }}}
     15 * Accesso diretto alla macchina fisica source:trunk/mioboot-nobios-simple.asm
     16 * Uso dei servizi del BIOS source:trunk/mioboot.asm
     17
    9518{{{
    9619#!sh