Commit 8a46b12305c658f178ac5517ff98d9c030d085e7

Authored by Imanol-Mikel Barba Sabariego
0 parents

Initial commit

Makefile 0 → 100644
  1 +++ a/Makefile
  1 +TARGETS = floppy.img boot.bin
  2 +
  3 +
  4 +boot.bin: boot.asm
  5 + nasm boot.asm -f bin -o boot.bin
  6 + dd if=boot.bin of=floppy.img bs=512
  7 +
  8 +floppy.img:
  9 + dd if=/dev/zero of=floppy.img bs=512 count=2880
  10 +
  11 +clean:
  12 + rm -rf $(TARGETS)
  13 +
  14 +all: $(TARGETS)
  15 +
... ...
bochsout 0 → 100644
  1 +++ a/bochsout
  1 +00000000000i[ ] Bochs x86 Emulator 2.4.6
  2 +00000000000i[ ] Build from CVS snapshot, on February 22, 2011
  3 +00000000000i[ ] Compiled at Jun 8 2013, 05:16:39
  4 +00000000000i[ ] System configuration
  5 +00000000000i[ ] processors: 1 (cores=1, HT threads=1)
  6 +00000000000i[ ] A20 line support: yes
  7 +00000000000i[ ] CPU configuration
  8 +00000000000i[ ] level: 6
  9 +00000000000i[ ] SMP support: no
  10 +00000000000i[ ] APIC support: yes
  11 +00000000000i[ ] FPU support: yes
  12 +00000000000i[ ] MMX support: yes
  13 +00000000000i[ ] 3dnow! support: no
  14 +00000000000i[ ] SEP support: yes
  15 +00000000000i[ ] SSE support: sse2
  16 +00000000000i[ ] XSAVE support: no
  17 +00000000000i[ ] AES support: no
  18 +00000000000i[ ] MOVBE support: no
  19 +00000000000i[ ] x86-64 support: yes
  20 +00000000000i[ ] 1G paging support: no
  21 +00000000000i[ ] VMX support: no
  22 +00000000000i[ ] Optimization configuration
  23 +00000000000i[ ] RepeatSpeedups support: yes
  24 +00000000000i[ ] Trace cache support: yes
  25 +00000000000i[ ] Fast function calls: yes
  26 +00000000000i[ ] Devices configuration
  27 +00000000000i[ ] ACPI support: yes
  28 +00000000000i[ ] NE2000 support: yes
  29 +00000000000i[ ] PCI support: yes, enabled=yes
  30 +00000000000i[ ] SB16 support: yes
  31 +00000000000i[ ] USB support: yes
  32 +00000000000i[ ] VGA extension support: vbe
  33 +00000000000i[MEM0 ] allocated memory at 0xb4188008. after alignment, vector=0xb4189000
  34 +00000000000i[MEM0 ] 32,00MB
  35 +00000000000i[MEM0 ] mem block size = 0x00100000, blocks=32
  36 +00000000000i[MEM0 ] rom at 0xfffe0000/131072 ('/usr/share/bochs/BIOS-bochs-latest')
  37 +00000000000i[MEM0 ] rom at 0xc0000/41472 ('/usr/share/bochs/VGABIOS-lgpl-latest')
  38 +00000000000i[ ] lt_dlhandle is 0xa4bcbd8
  39 +00000000000i[PLGIN] loaded plugin libbx_cmos.so
  40 +00000000000i[ ] lt_dlhandle is 0xa4bd1f8
  41 +00000000000i[PLGIN] loaded plugin libbx_dma.so
  42 +00000000000i[ ] lt_dlhandle is 0xa4bd830
  43 +00000000000i[PLGIN] loaded plugin libbx_pic.so
  44 +00000000000i[ ] lt_dlhandle is 0xa4bdd28
  45 +00000000000i[PLGIN] loaded plugin libbx_pit.so
  46 +00000000000i[ ] lt_dlhandle is 0xa4be368
  47 +00000000000i[PLGIN] loaded plugin libbx_vga.so
  48 +00000000000i[ ] lt_dlhandle is 0xa4be768
  49 +00000000000i[PLGIN] loaded plugin libbx_hdimage.so
  50 +00000000000i[ ] lt_dlhandle is 0xa4becf8
  51 +00000000000i[PLGIN] loaded plugin libbx_floppy.so
  52 +00000000000i[ ] lt_dlhandle is 0xa4bf4c8
  53 +00000000000i[PLGIN] loaded plugin libbx_soundmod.so
  54 +00000000000i[ ] lt_dlhandle is 0xa4bfa58
  55 +00000000000i[PLGIN] loaded plugin libbx_pci.so
  56 +00000000000i[ ] lt_dlhandle is 0xa4c0168
  57 +00000000000i[PLGIN] loaded plugin libbx_pci2isa.so
  58 +00000000000i[ ] lt_dlhandle is 0xa4c07c8
  59 +00000000000i[PLGIN] loaded plugin libbx_usb_common.so
  60 +00000000000i[ ] lt_dlhandle is 0xa4c0d18
  61 +00000000000i[PLGIN] loaded plugin libbx_unmapped.so
  62 +00000000000i[ ] lt_dlhandle is 0xa4c11a8
  63 +00000000000i[PLGIN] loaded plugin libbx_biosdev.so
  64 +00000000000i[ ] lt_dlhandle is 0xa4c1778
  65 +00000000000i[PLGIN] loaded plugin libbx_speaker.so
  66 +00000000000i[ ] lt_dlhandle is 0xa4c1c60
  67 +00000000000i[PLGIN] loaded plugin libbx_extfpuirq.so
  68 +00000000000i[ ] lt_dlhandle is 0xa4c2190
  69 +00000000000i[PLGIN] loaded plugin libbx_gameport.so
  70 +00000000000i[ ] lt_dlhandle is 0xa4c2680
  71 +00000000000i[PLGIN] loaded plugin libbx_pci_ide.so
  72 +00000000000i[ ] lt_dlhandle is 0xa4c2cc0
  73 +00000000000i[PLGIN] loaded plugin libbx_acpi.so
  74 +00000000000i[ ] lt_dlhandle is 0xa4c3300
  75 +00000000000i[PLGIN] loaded plugin libbx_ioapic.so
  76 +00000000000i[ ] lt_dlhandle is 0xa4c38c0
  77 +00000000000i[PLGIN] loaded plugin libbx_keyboard.so
  78 +00000000000i[ ] lt_dlhandle is 0xa4c3ed0
  79 +00000000000i[PLGIN] loaded plugin libbx_harddrv.so
  80 +00000000000i[ ] lt_dlhandle is 0xa4d5b38
  81 +00000000000i[PLGIN] loaded plugin libbx_serial.so
  82 +00000000000i[ ] lt_dlhandle is 0xa4d6678
  83 +00000000000i[PLGIN] loaded plugin libbx_parallel.so
  84 +00000000000i[CMOS ] Using local time for initial clock
  85 +00000000000i[CMOS ] Setting initial clock to: Fri Mar 28 20:48:54 2014 (time0=1396036134)
  86 +00000000000i[DMA ] channel 4 used by cascade
  87 +00000000000i[DMA ] channel 2 used by Floppy Drive
  88 +00000000000i[FDD ] fd0: 'floppy.img' ro=0, h=2,t=80,spt=18
  89 +00000000000i[PCI ] 440FX Host bridge present at device 0, function 0
  90 +00000000000i[PCI ] PIIX3 PCI-to-ISA bridge present at device 1, function 0
  91 +00000000000i[VGA ] interval=50000
  92 +00000000000i[MEM0 ] Register memory access handlers: 0x00000000000a0000 - 0x00000000000bffff
  93 +00000000000i[MEM0 ] Register memory access handlers: 0x00000000e0000000 - 0x00000000e0ffffff
  94 +00000000000i[VGA ] VBE Bochs Display Extension Enabled
  95 +00000000000i[PLGIN] init_dev of 'unmapped' plugin device by virtual method
  96 +00000000000i[PLGIN] init_dev of 'biosdev' plugin device by virtual method
  97 +00000000000i[PLGIN] init_dev of 'speaker' plugin device by virtual method
  98 +00000000000i[SPEAK] Failed to open /dev/console: Resource temporarily unavailable
  99 +00000000000i[SPEAK] Deactivating beep on console
  100 +00000000000i[PLGIN] init_dev of 'extfpuirq' plugin device by virtual method
  101 +00000000000i[PLGIN] init_dev of 'gameport' plugin device by virtual method
  102 +00000000000i[PLGIN] init_dev of 'pci_ide' plugin device by virtual method
  103 +00000000000i[PCI ] PIIX3 PCI IDE controller present at device 1, function 1
  104 +00000000000i[PLGIN] init_dev of 'acpi' plugin device by virtual method
  105 +00000000000i[PCI ] ACPI Controller present at device 1, function 3
  106 +00000000000i[PLGIN] init_dev of 'ioapic' plugin device by virtual method
  107 +00000000000i[IOAP ] initializing I/O APIC
  108 +00000000000i[MEM0 ] Register memory access handlers: 0x00000000fec00000 - 0x00000000fec00fff
  109 +00000000000i[PLGIN] init_dev of 'keyboard' plugin device by virtual method
  110 +00000000000i[KBD ] will paste characters every 1000 keyboard ticks
  111 +00000000000i[PLGIN] init_dev of 'harddrv' plugin device by virtual method
  112 +00000000000i[HD ] Using boot sequence floppy, none, none
  113 +00000000000i[HD ] Floppy boot signature check is enabled
  114 +00000000000i[PLGIN] init_dev of 'serial' plugin device by virtual method
  115 +00000000000i[SER ] com1 at 0x03f8 irq 4
  116 +00000000000i[PLGIN] init_dev of 'parallel' plugin device by virtual method
  117 +00000000000i[PAR ] parallel port 1 at 0x0378 irq 7
  118 +00000000000i[PLGIN] register state of 'unmapped' plugin device by virtual method
  119 +00000000000i[PLGIN] register state of 'biosdev' plugin device by virtual method
  120 +00000000000i[PLGIN] register state of 'speaker' plugin device by virtual method
  121 +00000000000i[PLGIN] register state of 'extfpuirq' plugin device by virtual method
  122 +00000000000i[PLGIN] register state of 'gameport' plugin device by virtual method
  123 +00000000000i[PLGIN] register state of 'pci_ide' plugin device by virtual method
  124 +00000000000i[PLGIN] register state of 'acpi' plugin device by virtual method
  125 +00000000000i[PLGIN] register state of 'ioapic' plugin device by virtual method
  126 +00000000000i[PLGIN] register state of 'keyboard' plugin device by virtual method
  127 +00000000000i[PLGIN] register state of 'harddrv' plugin device by virtual method
  128 +00000000000i[PLGIN] register state of 'serial' plugin device by virtual method
  129 +00000000000i[PLGIN] register state of 'parallel' plugin device by virtual method
  130 +00000000000i[SYS ] bx_pc_system_c::Reset(HARDWARE) called
  131 +00000000000i[CPU0 ] cpu hardware reset
  132 +00000000000i[APIC0] allocate APIC id=0 (MMIO enabled) to 0x00000000fee00000
  133 +00000000000i[CPU0 ] CPUID[0x00000000]: 00000003 756e6547 6c65746e 49656e69
  134 +00000000000i[CPU0 ] CPUID[0x00000001]: 00000f23 00000800 00002000 07cbfbff
  135 +00000000000i[CPU0 ] CPUID[0x00000002]: 00410601 00000000 00000000 00000000
  136 +00000000000i[CPU0 ] CPUID[0x00000003]: 00000000 00000000 00000000 00000000
  137 +00000000000i[CPU0 ] CPUID[0x00000004]: 00000000 00000000 00000000 00000000
  138 +00000000000i[CPU0 ] CPUID[0x00000007]: 00000000 00000000 00000000 00000000
  139 +00000000000i[CPU0 ] CPUID[0x80000000]: 80000008 00000000 00000000 00000000
  140 +00000000000i[CPU0 ] CPUID[0x80000001]: 00000000 00000000 00000001 2a100800
  141 +00000000000i[CPU0 ] CPUID[0x80000002]: 20202020 20202020 20202020 6e492020
  142 +00000000000i[CPU0 ] CPUID[0x80000003]: 286c6574 50202952 69746e65 52286d75
  143 +00000000000i[CPU0 ] CPUID[0x80000004]: 20342029 20555043 20202020 00202020
  144 +00000000000i[CPU0 ] CPUID[0x80000006]: 00000000 42004200 02008140 00000000
  145 +00000000000i[CPU0 ] CPUID[0x80000007]: 00000000 00000000 00000000 00000000
  146 +00000000000i[CPU0 ] CPUID[0x80000008]: 00003028 00000000 00000000 00000000
  147 +00000000000i[PLGIN] reset of 'unmapped' plugin device by virtual method
  148 +00000000000i[PLGIN] reset of 'biosdev' plugin device by virtual method
  149 +00000000000i[PLGIN] reset of 'speaker' plugin device by virtual method
  150 +00000000000i[PLGIN] reset of 'extfpuirq' plugin device by virtual method
  151 +00000000000i[PLGIN] reset of 'gameport' plugin device by virtual method
  152 +00000000000i[PLGIN] reset of 'pci_ide' plugin device by virtual method
  153 +00000000000i[PLGIN] reset of 'acpi' plugin device by virtual method
  154 +00000000000i[PLGIN] reset of 'ioapic' plugin device by virtual method
  155 +00000000000i[PLGIN] reset of 'keyboard' plugin device by virtual method
  156 +00000000000i[PLGIN] reset of 'harddrv' plugin device by virtual method
  157 +00000000000i[PLGIN] reset of 'serial' plugin device by virtual method
  158 +00000000000i[PLGIN] reset of 'parallel' plugin device by virtual method
  159 +00000003305i[BIOS ] $Revision: 1.257 $ $Date: 2011/01/26 09:52:02 $
  160 +00000318042i[KBD ] reset-disable command received
  161 +00000447872i[VBIOS] VGABios $Id: vgabios.c,v 1.75 2011/10/15 14:07:21 vruppert Exp $
  162 +00000447943i[VGA ] VBE known Display Interface b0c0
  163 +00000447975i[VGA ] VBE known Display Interface b0c5
  164 +00000450900i[VBIOS] VBE Bios $Id: vbe.c,v 1.64 2011/07/19 18:25:05 vruppert Exp $
  165 +00000771016i[BIOS ] Starting rombios32
  166 +00000771454i[BIOS ] Shutdown flag 0
  167 +00000772038i[BIOS ] ram_size=0x02000000
  168 +00000772459i[BIOS ] ram_end=32MB
  169 +00000813018i[BIOS ] Found 1 cpu(s)
  170 +00000828866i[BIOS ] bios_table_addr: 0x000fb928 end=0x000fcc00
  171 +00000828960i[PCI ] 440FX PMC write to PAM register 59 (TLB Flush)
  172 +00001156657i[PCI ] 440FX PMC write to PAM register 59 (TLB Flush)
  173 +00001484585i[P2I ] PCI IRQ routing: PIRQA# set to 0x0b
  174 +00001484604i[P2I ] PCI IRQ routing: PIRQB# set to 0x09
  175 +00001484623i[P2I ] PCI IRQ routing: PIRQC# set to 0x0b
  176 +00001484642i[P2I ] PCI IRQ routing: PIRQD# set to 0x09
  177 +00001484652i[P2I ] write: ELCR2 = 0x0a
  178 +00001485423i[BIOS ] PIIX3/PIIX4 init: elcr=00 0a
  179 +00001493095i[BIOS ] PCI: bus=0 devfn=0x00: vendor_id=0x8086 device_id=0x1237 class=0x0600
  180 +00001495370i[BIOS ] PCI: bus=0 devfn=0x08: vendor_id=0x8086 device_id=0x7000 class=0x0601
  181 +00001497484i[BIOS ] PCI: bus=0 devfn=0x09: vendor_id=0x8086 device_id=0x7010 class=0x0101
  182 +00001497708i[PIDE ] new BM-DMA address: 0xc000
  183 +00001498323i[BIOS ] region 4: 0x0000c000
  184 +00001500350i[BIOS ] PCI: bus=0 devfn=0x0b: vendor_id=0x8086 device_id=0x7113 class=0x0680
  185 +00001500579i[ACPI ] new irq line = 11
  186 +00001500591i[ACPI ] new irq line = 9
  187 +00001500616i[ACPI ] new PM base address: 0xb000
  188 +00001500630i[ACPI ] new SM base address: 0xb100
  189 +00001500658i[PCI ] setting SMRAM control register to 0x4a
  190 +00001664751i[CPU0 ] Enter to System Management Mode
  191 +00001664761i[CPU0 ] RSM: Resuming from System Management Mode
  192 +00001828782i[PCI ] setting SMRAM control register to 0x0a
  193 +00001837532i[BIOS ] MP table addr=0x000fba00 MPC table addr=0x000fb930 size=0xd0
  194 +00001839346i[BIOS ] SMBIOS table addr=0x000fba10
  195 +00001842501i[BIOS ] Firmware waking vector 0x1ff00cc
  196 +00001847425i[BIOS ] ACPI tables: RSDP addr=0x000fbb30 ACPI DATA addr=0x01ff0000 size=0x1f18
  197 +00001847461i[PCI ] 440FX PMC write to PAM register 59 (TLB Flush)
  198 +00001848185i[BIOS ] bios_table_cur_addr: 0x000fbb54
  199 +00014041548i[BIOS ] Booting from 0000:7c00
  200 +00097000000p[SDL ] >>PANIC<< POWER button turned off.
  201 +00097000000i[CPU0 ] CPU is in real mode (active)
  202 +00097000000i[CPU0 ] CS.d_b = 16 bit
  203 +00097000000i[CPU0 ] SS.d_b = 16 bit
  204 +00097000000i[CPU0 ] EFER = 0x00000000
  205 +00097000000i[CPU0 ] | RAX=0000000000000000 RBX=0000000000000000
  206 +00097000000i[CPU0 ] | RCX=0000000000090000 RDX=0000000000000000
  207 +00097000000i[CPU0 ] | RSP=000000000000ffd2 RBP=0000000000000000
  208 +00097000000i[CPU0 ] | RSI=00000000000e7c0b RDI=000000000000ffac
  209 +00097000000i[CPU0 ] | R8=0000000000000000 R9=0000000000000000
  210 +00097000000i[CPU0 ] | R10=0000000000000000 R11=0000000000000000
  211 +00097000000i[CPU0 ] | R12=0000000000000000 R13=0000000000000000
  212 +00097000000i[CPU0 ] | R14=0000000000000000 R15=0000000000000000
  213 +00097000000i[CPU0 ] | IOPL=0 id vip vif ac vm rf nt of df if tf sf ZF af PF cf
  214 +00097000000i[CPU0 ] | SEG selector base limit G D
  215 +00097000000i[CPU0 ] | SEG sltr(index|ti|rpl) base limit G D
  216 +00097000000i[CPU0 ] | CS:0000( 0004| 0| 0) 00000000 0000ffff 0 0
  217 +00097000000i[CPU0 ] | DS:0000( 0005| 0| 0) 00000000 0000ffff 0 0
  218 +00097000000i[CPU0 ] | SS:0000( 0005| 0| 0) 00000000 0000ffff 0 0
  219 +00097000000i[CPU0 ] | ES:0000( 0005| 0| 0) 00000000 0000ffff 0 0
  220 +00097000000i[CPU0 ] | FS:0000( 0005| 0| 0) 00000000 0000ffff 0 0
  221 +00097000000i[CPU0 ] | GS:0000( 0005| 0| 0) 00000000 0000ffff 0 0
  222 +00097000000i[CPU0 ] | MSR_FS_BASE:0000000000000000
  223 +00097000000i[CPU0 ] | MSR_GS_BASE:0000000000000000
  224 +00097000000i[CPU0 ] | RIP=0000000000007c1d (0000000000007c1d)
  225 +00097000000i[CPU0 ] | CR0=0x60000010 CR2=0x0000000000000000
  226 +00097000000i[CPU0 ] | CR3=0x00000000 CR4=0x00000000
  227 +00097000000i[CPU0 ] 0x0000000000007c1d>> jmp .-2 (0x00007c1d) : EBFE
  228 +00097000000i[CMOS ] Last time is 1396036158 (Fri Mar 28 20:49:18 2014)
  229 +00097000000i[ ] restoring default signal behavior
  230 +00097000000i[CTRL ] quit_sim called with exit code 1
... ...
bochsrc.txt 0 → 100644
  1 +++ a/bochsrc.txt
  1 +megs: 32
  2 +#romimage: file=/usr/local/bochs/1.4.1/BIOS-bochs-latest, address=0xf0000
  3 +#vgaromimage: /usr/local/bochs/1.4.1/VGABIOS-elpin-2.40
  4 +floppya: 1_44=floppy.img, status=inserted
  5 +boot: a
  6 +log: bochsout
  7 +mouse: enabled=0
  8 +display_library: sdl
... ...
boot.asm 0 → 100644
  1 +++ a/boot.asm
  1 +;BLACK 0x0
  2 +;BLUE 0x1
  3 +;GREEN 0x2
  4 +;CYAN 0x3
  5 +;RED 0x4
  6 +;MAGENTA 0x5
  7 +;BROWN 0x6
  8 +;GREY 0x7
  9 +;DARK_GREY 0x8
  10 +;LIGHT_BLUE 0x9
  11 +;LIGHT_GREEN 0xA
  12 +;LIGHT_CYAN 0xB
  13 +;LIGHT_RED 0xC
  14 +;LIGHT_MAGENTA 0xD
  15 +;LIGHT_BROWN 0xE
  16 +;WHITE 0xF
  17 +
  18 +[BITS 16]
  19 +[org 0x7C00]
  20 +
  21 +JMP short Start
  22 +
  23 +str: db 'THE GAME ',0x00
  24 +
  25 +
  26 +
  27 +Start:
  28 + XOR ax, ax
  29 + MOV ds, ax
  30 + CALL clear_screen
  31 + PUSH 2 ; num
  32 + PUSH 2 ; offset
  33 + ;CALL print_sector ; (offset, num)
  34 + ;ADD esp, 12
  35 + for_start_0:
  36 + MOV si,str
  37 + CALL print_string
  38 + ;JMP for_start_0
  39 + JMP $
  40 +
  41 +clear_screen:
  42 + MOV al, 02h ; Setting the graphical mode 80x25(text)
  43 + MOV ah, 00h ; Code of the function of changing video mode
  44 + INT 10h ; Call interruption
  45 + RETN
  46 +
  47 +print_string: ; Expects null terminated message in si
  48 + ;MOV bl,0x00
  49 + for_print_string_0:
  50 + MOV al,[si]
  51 + OR al,al
  52 + JZ .end
  53 + INC si
  54 + CALL print_char
  55 + ;INCL bl
  56 + JMP for_print_string_0
  57 + .end:
  58 + RETN
  59 +
  60 +print_sector:
  61 + PUSH ebp
  62 + MOV ebp, esp
  63 + PUSH ax
  64 + PUSH bx
  65 + PUSH cx
  66 + PUSH dx
  67 + MOV al, [12 + ebp]
  68 + MOV cl, [8 + ebp]
  69 + MOV ah, 2
  70 + MOV ch, 0
  71 + MOV dh, 0
  72 + INT 0x13
  73 + POP dx
  74 + POP cx
  75 + POP bx
  76 + POP ax
  77 + MOV esp, ebp
  78 + POP ebp
  79 + RETN
  80 +
  81 +print_char:
  82 + PUSH ebp
  83 + MOV ebp, esp
  84 + PUSH ax
  85 + PUSH bx
  86 + MOV ah,0x0E ; Specifies that we want to write a character to the screen
  87 + MOV bl,0x02 ; Specifies output text color. Not required, but useful to know
  88 + MOV bh,0x00 ; Page number. Leave this alone.
  89 + INT 0x10 ; Signal video interrupt to BIOS
  90 + POP bx
  91 + POP ax
  92 + MOV esp,ebp
  93 + POP ebp
  94 + RETN
  95 +
  96 +TIMES 510 - ($ - $$) db 0
  97 +DW 0xAA55
  98 +
  99 +
  100 +
... ...
boot.bin 0 → 100644
No preview for this file type
floppy.img 0 → 100644
No preview for this file type