| 
            Last change
 on this file since 17 was             2, checked in by Mattia Monga, 15 years ago           | 
        
        
          | 
             
Importazione sorgenti 
 
           | 
        
        
          | 
            File size:
            1.4 KB
           | 
        
      
      
| Line |   | 
|---|
| 1 | ;Copyright (C) 2008 by Mattia Monga <mattia.monga@unimi.it>
 | 
|---|
| 2 | bits 16                         ; 16 bit real mode
 | 
|---|
| 3 | org 0x7C00                      ; origine indirizzo 0000:7C00
 | 
|---|
| 4 |         
 | 
|---|
| 5 | start:
 | 
|---|
| 6 |         cld                     ; clears direction flag (index regs incremented)
 | 
|---|
| 7 |         mov si, boot
 | 
|---|
| 8 |         call message
 | 
|---|
| 9 | working:
 | 
|---|
| 10 |         mov si, work
 | 
|---|
| 11 |         call message
 | 
|---|
| 12 | 
 | 
|---|
| 13 |         call waitenter
 | 
|---|
| 14 |         jmp working
 | 
|---|
| 15 | 
 | 
|---|
| 16 | message:
 | 
|---|
| 17 |         lodsb                   ; carica un byte da [DS:SI] in AL e inc SI
 | 
|---|
| 18 |         cmp al, 0
 | 
|---|
| 19 |         jz done
 | 
|---|
| 20 |         mov ah, 0x0E            ; write char to screen in text mode
 | 
|---|
| 21 |         mov bx, 0               ; BH page number BL foreground color
 | 
|---|
| 22 |         int 0x10                ; write AL to screen (BIOS)
 | 
|---|
| 23 |         jmp message
 | 
|---|
| 24 | done:   ret
 | 
|---|
| 25 | 
 | 
|---|
| 26 | boot: db "Loading unuseful system...." , 10, 13, 0
 | 
|---|
| 27 | work: db "I've done my unuseful stuff!" , 10, 13, 0 
 | 
|---|
| 28 | cont: db "Hit ENTER to continue...", 10, 13, 0
 | 
|---|
| 29 | wow: db "Great! Hello world!" , 10, 13, 0
 | 
|---|
| 30 |         
 | 
|---|
| 31 | waitenter: mov si, cont
 | 
|---|
| 32 |            call message
 | 
|---|
| 33 |            mov ah, 0
 | 
|---|
| 34 |            int 0x16                ; Wait for keypress (BIOS)
 | 
|---|
| 35 |            cmp al, 'm'
 | 
|---|
| 36 |            jz egg
 | 
|---|
| 37 |            cmp al, 'b'
 | 
|---|
| 38 |            jz basic
 | 
|---|
| 39 |            cmp al, 13
 | 
|---|
| 40 |            jnz waitenter
 | 
|---|
| 41 |            ret
 | 
|---|
| 42 | egg:       mov si, wow
 | 
|---|
| 43 |            call message
 | 
|---|
| 44 |            jmp waitenter
 | 
|---|
| 45 | basic:     int 0x18             ; basic (BIOS)
 | 
|---|
| 46 |            hlt
 | 
|---|
| 47 | 
 | 
|---|
| 48 |         times 510-($-$$) db 0
 | 
|---|
| 49 |         dw 0xAA55
 | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.