Commit a082d5beb7735f4067d3acb3397338761ecea223

Authored by Imanol-Mikel Barba Sabariego
1 parent 1135c706

--no commit message

Makefile
1 -TARGETS = boot_floppy.bin boot_usb.bin 1 +TARGETS = boot_floppy.bin boot_usb.bin second_binary.bin
2 2
3 3
4 boot_floppy.bin: boot_floppy.asm floppy.img 4 boot_floppy.bin: boot_floppy.asm floppy.img
5 nasm boot_floppy.asm -f bin -o boot_floppy.bin 5 nasm boot_floppy.asm -f bin -o boot_floppy.bin
6 dd if=boot_floppy.bin of=floppy.img bs=512 count=1 conv=notrunc 6 dd if=boot_floppy.bin of=floppy.img bs=512 count=1 conv=notrunc
7 7
8 -boot_usb.bin: boot_usb.asm 8 +boot_usb.bin: boot_usb.asm usb.img
9 nasm boot_usb.asm -f bin -o boot_usb.bin 9 nasm boot_usb.asm -f bin -o boot_usb.bin
  10 + dd if=boot_usb.bin of=usb.img bs=512 count=1 conv=notrunc
  11 +
  12 +second_binary.bin: second_binary.asm floppy.img usb.img
  13 + nasm second_binary.asm -f bin -o second_binary.bin
  14 + dd if=second_binary.bin of=floppy.img bs=512 count=1 seek=3 conv=notrunc
  15 + dd if=second_binary.bin of=usb.img bs=512 count=1 seek=3 conv=notrunc
  16 +
10 17
11 floppy.img: 18 floppy.img:
12 dd if=/dev/zero of=floppy.img bs=512 count=2880 19 dd if=/dev/zero of=floppy.img bs=512 count=2880
13 20
  21 +usb.img:
  22 + dd if=/dev/zero of=usb.img bs=512 count=2880
  23 +
14 clean: 24 clean:
15 rm -rf $(TARGETS) 25 rm -rf $(TARGETS)
16 26
bochsout
@@ -32,41 +32,41 @@ @@ -32,41 +32,41 @@
32 00000000000i[ ] SB16 support: yes 32 00000000000i[ ] SB16 support: yes
33 00000000000i[ ] USB support: yes 33 00000000000i[ ] USB support: yes
34 00000000000i[ ] VGA extension support: vbe 34 00000000000i[ ] VGA extension support: vbe
35 -00000000000i[MEM0 ] allocated memory at 0x7f93f621d010. after alignment, vector=0x7f93f621e000 35 +00000000000i[MEM0 ] allocated memory at 0x7fe55d4ff010. after alignment, vector=0x7fe55d500000
36 00000000000i[MEM0 ] 32,00MB 36 00000000000i[MEM0 ] 32,00MB
37 00000000000i[MEM0 ] mem block size = 0x00100000, blocks=32 37 00000000000i[MEM0 ] mem block size = 0x00100000, blocks=32
38 00000000000i[MEM0 ] rom at 0xfffe0000/131072 ('/usr/local/share/bochs/BIOS-bochs-latest') 38 00000000000i[MEM0 ] rom at 0xfffe0000/131072 ('/usr/local/share/bochs/BIOS-bochs-latest')
39 -00000000000i[ ] lt_dlhandle is 0x1cbb760 39 +00000000000i[ ] lt_dlhandle is 0x23ee760
40 00000000000i[PLGIN] loaded plugin libbx_hdimage.so 40 00000000000i[PLGIN] loaded plugin libbx_hdimage.so
41 -00000000000i[ ] lt_dlhandle is 0x1cbc220 41 +00000000000i[ ] lt_dlhandle is 0x23ef220
42 00000000000i[PLGIN] loaded plugin libbx_pci.so 42 00000000000i[PLGIN] loaded plugin libbx_pci.so
43 -00000000000i[ ] lt_dlhandle is 0x1cbcb10 43 +00000000000i[ ] lt_dlhandle is 0x23efb10
44 00000000000i[PLGIN] loaded plugin libbx_pci2isa.so 44 00000000000i[PLGIN] loaded plugin libbx_pci2isa.so
45 -00000000000i[ ] lt_dlhandle is 0x1cbd650 45 +00000000000i[ ] lt_dlhandle is 0x23f0650
46 00000000000i[PLGIN] loaded plugin libbx_usb_uhci.so 46 00000000000i[PLGIN] loaded plugin libbx_usb_uhci.so
47 -00000000000i[ ] lt_dlhandle is 0x1cbfcf0 47 +00000000000i[ ] lt_dlhandle is 0x23f2cf0
48 00000000000i[PLGIN] loaded plugin libbx_usb_common.so 48 00000000000i[PLGIN] loaded plugin libbx_usb_common.so
49 -00000000000i[ ] lt_dlhandle is 0x1cc0690 49 +00000000000i[ ] lt_dlhandle is 0x23f3690
50 00000000000i[PLGIN] loaded plugin libbx_acpi.so 50 00000000000i[PLGIN] loaded plugin libbx_acpi.so
51 -00000000000i[ ] lt_dlhandle is 0x1cc1080 51 +00000000000i[ ] lt_dlhandle is 0x23f4080
52 00000000000i[PLGIN] loaded plugin libbx_cmos.so 52 00000000000i[PLGIN] loaded plugin libbx_cmos.so
53 -00000000000i[ ] lt_dlhandle is 0x1cc19a0 53 +00000000000i[ ] lt_dlhandle is 0x23f49a0
54 00000000000i[PLGIN] loaded plugin libbx_dma.so 54 00000000000i[PLGIN] loaded plugin libbx_dma.so
55 -00000000000i[ ] lt_dlhandle is 0x1cc2420 55 +00000000000i[ ] lt_dlhandle is 0x23f5420
56 00000000000i[PLGIN] loaded plugin libbx_pic.so 56 00000000000i[PLGIN] loaded plugin libbx_pic.so
57 -00000000000i[ ] lt_dlhandle is 0x1cc2d10 57 +00000000000i[ ] lt_dlhandle is 0x23f5d10
58 00000000000i[PLGIN] loaded plugin libbx_pit.so 58 00000000000i[PLGIN] loaded plugin libbx_pit.so
59 -00000000000i[ ] lt_dlhandle is 0x1cc3790 59 +00000000000i[ ] lt_dlhandle is 0x23f6790
60 00000000000i[PLGIN] loaded plugin libbx_floppy.so 60 00000000000i[PLGIN] loaded plugin libbx_floppy.so
61 -00000000000i[ ] lt_dlhandle is 0x1cc4470 61 +00000000000i[ ] lt_dlhandle is 0x23f7470
62 00000000000i[PLGIN] loaded plugin libbx_vga.so 62 00000000000i[PLGIN] loaded plugin libbx_vga.so
63 -00000000000i[ ] lt_dlhandle is 0x1cc3ea0 63 +00000000000i[ ] lt_dlhandle is 0x23f6ea0
64 00000000000i[PLGIN] loaded plugin libbx_ioapic.so 64 00000000000i[PLGIN] loaded plugin libbx_ioapic.so
65 -00000000000i[ ] lt_dlhandle is 0x1cc5670 65 +00000000000i[ ] lt_dlhandle is 0x23f8670
66 00000000000i[PLGIN] loaded plugin libbx_keyboard.so 66 00000000000i[PLGIN] loaded plugin libbx_keyboard.so
67 -00000000000i[ ] lt_dlhandle is 0x1cc6050 67 +00000000000i[ ] lt_dlhandle is 0x23f9050
68 00000000000i[PLGIN] loaded plugin libbx_harddrv.so 68 00000000000i[PLGIN] loaded plugin libbx_harddrv.so
69 -00000000000i[ ] lt_dlhandle is 0x1cc5330 69 +00000000000i[ ] lt_dlhandle is 0x23f8330
70 00000000000i[PLGIN] loaded plugin libbx_pci_ide.so 70 00000000000i[PLGIN] loaded plugin libbx_pci_ide.so
71 00000000000i[PLGIN] init_dev of 'pci' plugin device by virtual method 71 00000000000i[PLGIN] init_dev of 'pci' plugin device by virtual method
72 00000000000i[DEV ] i440FX PMC present at device 0, function 0 72 00000000000i[DEV ] i440FX PMC present at device 0, function 0
@@ -74,7 +74,7 @@ @@ -74,7 +74,7 @@
74 00000000000i[DEV ] PIIX3 PCI-to-ISA bridge present at device 1, function 0 74 00000000000i[DEV ] PIIX3 PCI-to-ISA bridge present at device 1, function 0
75 00000000000i[PLGIN] init_dev of 'cmos' plugin device by virtual method 75 00000000000i[PLGIN] init_dev of 'cmos' plugin device by virtual method
76 00000000000i[CMOS ] Using local time for initial clock 76 00000000000i[CMOS ] Using local time for initial clock
77 -00000000000i[CMOS ] Setting initial clock to: Sun Mar 30 18:09:12 2014 (time0=1396195752) 77 +00000000000i[CMOS ] Setting initial clock to: Sun Mar 30 21:56:18 2014 (time0=1396209378)
78 00000000000i[PLGIN] init_dev of 'dma' plugin device by virtual method 78 00000000000i[PLGIN] init_dev of 'dma' plugin device by virtual method
79 00000000000i[DMA ] channel 4 used by cascade 79 00000000000i[DMA ] channel 4 used by cascade
80 00000000000i[PLGIN] init_dev of 'pic' plugin device by virtual method 80 00000000000i[PLGIN] init_dev of 'pic' plugin device by virtual method
@@ -184,7 +184,6 @@ @@ -184,7 +184,6 @@
184 00000000000i[XGUI ] Mouse capture off 184 00000000000i[XGUI ] Mouse capture off
185 00000000000i[XGUI ] Mouse capture off 185 00000000000i[XGUI ] Mouse capture off
186 00000000000i[MEM0 ] allocate_block: block=0x0 used 0x1 of 0x20 186 00000000000i[MEM0 ] allocate_block: block=0x0 used 0x1 of 0x20
187 -00000000000i[XGUI ] Mouse capture off  
188 00000004661i[BIOS ] $Revision: 11545 $ $Date: 2012-11-11 09:11:17 +0100 (So, 11. Nov 2012) $ 187 00000004661i[BIOS ] $Revision: 11545 $ $Date: 2012-11-11 09:11:17 +0100 (So, 11. Nov 2012) $
189 00000318067i[KBD ] reset-disable command received 188 00000318067i[KBD ] reset-disable command received
190 00000320801i[BIOS ] Starting rombios32 189 00000320801i[BIOS ] Starting rombios32
@@ -231,114 +230,25 @@ @@ -231,114 +230,25 @@
231 00001534975i[VBIOS] VBE Bios $Id: vbe.c,v 1.64 2011/07/19 18:25:05 vruppert Exp $ 230 00001534975i[VBIOS] VBE Bios $Id: vbe.c,v 1.64 2011/07/19 18:25:05 vruppert Exp $
232 00001600000i[XGUI ] charmap update. Font Height is 16 231 00001600000i[XGUI ] charmap update. Font Height is 16
233 00014040328i[BIOS ] Booting from 0000:7c00 232 00014040328i[BIOS ] Booting from 0000:7c00
234 -00014040383i[XGUI ] Mouse capture off  
235 -00014237238i[XGUI ] charmap update. Font Height is 16  
236 -00014237238i[XGUI ] Mouse capture off  
237 -00014240000i[XGUI ] system RESET callback  
238 -00014240000i[SYS ] bx_pc_system_c::Reset(HARDWARE) called  
239 -00014240000i[CPU0 ] cpu hardware reset  
240 -00014240000i[APIC0] allocate APIC id=0 (MMIO enabled) to 0x0000fee00000  
241 -00014240000i[CPU0 ] CPU[0] is the bootstrap processor  
242 -00014240000i[CPU0 ] CPUID[0x00000000]: 00000005 756e6547 6c65746e 49656e69  
243 -00014240000i[CPU0 ] CPUID[0x00000001]: 00000633 00010800 00002008 1fcbfbff  
244 -00014240000i[CPU0 ] CPUID[0x00000002]: 00410601 00000000 00000000 00000000  
245 -00014240000i[CPU0 ] CPUID[0x00000003]: 00000000 00000000 00000000 00000000  
246 -00014240000i[CPU0 ] CPUID[0x00000004]: 00000000 00000000 00000000 00000000  
247 -00014240000i[CPU0 ] CPUID[0x00000005]: 00000040 00000040 00000003 00000020  
248 -00014240000i[CPU0 ] CPUID[0x80000000]: 80000008 00000000 00000000 00000000  
249 -00014240000i[CPU0 ] CPUID[0x80000001]: 00000000 00000000 00000101 2a100000  
250 -00014240000i[CPU0 ] CPUID[0x80000002]: 20202020 20202020 20202020 6e492020  
251 -00014240000i[CPU0 ] CPUID[0x80000003]: 286c6574 50202952 69746e65 52286d75  
252 -00014240000i[CPU0 ] CPUID[0x80000004]: 20342029 20555043 20202020 00202020  
253 -00014240000i[CPU0 ] CPUID[0x80000005]: 01ff01ff 01ff01ff 40020140 40020140  
254 -00014240000i[CPU0 ] CPUID[0x80000006]: 00000000 42004200 02008140 00000000  
255 -00014240000i[CPU0 ] CPUID[0x80000007]: 00000000 00000000 00000000 00000000  
256 -00014240000i[CPU0 ] CPUID[0x80000008]: 00003028 00000000 00000000 00000000  
257 -00014240000i[PLGIN] reset of 'pci' plugin device by virtual method  
258 -00014240000i[PLGIN] reset of 'pci2isa' plugin device by virtual method  
259 -00014240000i[PLGIN] reset of 'cmos' plugin device by virtual method  
260 -00014240000i[PLGIN] reset of 'dma' plugin device by virtual method  
261 -00014240000i[PLGIN] reset of 'pic' plugin device by virtual method  
262 -00014240000i[PLGIN] reset of 'pit' plugin device by virtual method  
263 -00014240000i[PLGIN] reset of 'floppy' plugin device by virtual method  
264 -00014240000i[PLGIN] reset of 'vga' plugin device by virtual method  
265 -00014240000i[PLGIN] reset of 'acpi' plugin device by virtual method  
266 -00014240000i[PLGIN] reset of 'ioapic' plugin device by virtual method  
267 -00014240000i[PLGIN] reset of 'keyboard' plugin device by virtual method  
268 -00014240000i[PLGIN] reset of 'harddrv' plugin device by virtual method  
269 -00014240000i[PLGIN] reset of 'pci_ide' plugin device by virtual method  
270 -00014240000i[PLGIN] reset of 'unmapped' plugin device by virtual method  
271 -00014240000i[PLGIN] reset of 'biosdev' plugin device by virtual method  
272 -00014240000i[PLGIN] reset of 'speaker' plugin device by virtual method  
273 -00014240000i[PLGIN] reset of 'extfpuirq' plugin device by virtual method  
274 -00014240000i[PLGIN] reset of 'parallel' plugin device by virtual method  
275 -00014240000i[PLGIN] reset of 'serial' plugin device by virtual method  
276 -00014240000i[PLGIN] reset of 'gameport' plugin device by virtual method  
277 -00014240000i[PLGIN] reset of 'iodebug' plugin device by virtual method  
278 -00014240000i[PLGIN] reset of 'usb_uhci' plugin device by virtual method  
279 -00014244661i[BIOS ] $Revision: 11545 $ $Date: 2012-11-11 09:11:17 +0100 (So, 11. Nov 2012) $  
280 -00014558067i[KBD ] reset-disable command received  
281 -00014560801i[BIOS ] Starting rombios32  
282 -00014561235i[BIOS ] Shutdown flag 0  
283 -00014561830i[BIOS ] ram_size=0x02000000  
284 -00014562251i[BIOS ] ram_end=32MB  
285 -00014602744i[BIOS ] Found 1 cpu(s)  
286 -00014616931i[BIOS ] bios_table_addr: 0x000fa448 end=0x000fcc00  
287 -00014944728i[PCI ] i440FX PMC write to PAM register 59 (TLB Flush)  
288 -00015272655i[P2I ] PCI IRQ routing: PIRQA# set to 0x0b  
289 -00015272674i[P2I ] PCI IRQ routing: PIRQB# set to 0x09  
290 -00015272693i[P2I ] PCI IRQ routing: PIRQC# set to 0x0b  
291 -00015272712i[P2I ] PCI IRQ routing: PIRQD# set to 0x09  
292 -00015272722i[P2I ] write: ELCR2 = 0x0a  
293 -00015273488i[BIOS ] PIIX3/PIIX4 init: elcr=00 0a  
294 -00015281204i[BIOS ] PCI: bus=0 devfn=0x00: vendor_id=0x8086 device_id=0x1237 class=0x0600  
295 -00015283474i[BIOS ] PCI: bus=0 devfn=0x08: vendor_id=0x8086 device_id=0x7000 class=0x0601  
296 -00015285583i[BIOS ] PCI: bus=0 devfn=0x09: vendor_id=0x8086 device_id=0x7010 class=0x0101  
297 -00015286429i[BIOS ] region 4: 0x0000c000  
298 -00015288431i[BIOS ] PCI: bus=0 devfn=0x0a: vendor_id=0x8086 device_id=0x7020 class=0x0c03  
299 -00015289252i[BIOS ] region 4: 0x0000c020  
300 -00015289378i[UHCI ] new irq line = 9  
301 -00015291263i[BIOS ] PCI: bus=0 devfn=0x0b: vendor_id=0x8086 device_id=0x7113 class=0x0680  
302 -00015291496i[ACPI ] new irq line = 11  
303 -00015291508i[ACPI ] new irq line = 9  
304 -00015291579i[PCI ] setting SMRAM control register to 0x4a  
305 -00015455670i[CPU0 ] Enter to System Management Mode  
306 -00015455680i[CPU0 ] RSM: Resuming from System Management Mode  
307 -00015619698i[PCI ] setting SMRAM control register to 0x0a  
308 -00015634632i[BIOS ] MP table addr=0x000fa520 MPC table addr=0x000fa450 size=0xc8  
309 -00015636388i[BIOS ] SMBIOS table addr=0x000fa530  
310 -00015638583i[BIOS ] ACPI tables: RSDP addr=0x000fa650 ACPI DATA addr=0x01ff0000 size=0xf72  
311 -00015641780i[BIOS ] Firmware waking vector 0x1ff00cc  
312 -00015643578i[PCI ] i440FX PMC write to PAM register 59 (TLB Flush)  
313 -00015644306i[BIOS ] bios_table_cur_addr: 0x000fa674  
314 -00015771923i[VBIOS] VGABios $Id: vgabios.c,v 1.75 2011/10/15 14:07:21 vruppert Exp $  
315 -00015771994i[BXVGA] VBE known Display Interface b0c0  
316 -00015772026i[BXVGA] VBE known Display Interface b0c5  
317 -00015774951i[VBIOS] VBE Bios $Id: vbe.c,v 1.64 2011/07/19 18:25:05 vruppert Exp $  
318 -00016000000i[XGUI ] charmap update. Font Height is 16  
319 -00028280324i[BIOS ] Booting from 0000:7c00  
320 -00028280379i[XGUI ] Mouse capture off  
321 -00028338761i[XGUI ] charmap update. Font Height is 16  
322 -00028338761i[XGUI ] Mouse capture off  
323 -00028477234i[XGUI ] Mouse capture off  
324 -00095588000p[XGUI ] >>PANIC<< POWER button turned off.  
325 -00095588000i[CPU0 ] CPU is in real mode (active)  
326 -00095588000i[CPU0 ] CS.mode = 16 bit  
327 -00095588000i[CPU0 ] SS.mode = 16 bit  
328 -00095588000i[CPU0 ] EFER = 0x00000000  
329 -00095588000i[CPU0 ] | EAX=00001000 EBX=00000000 ECX=00090006 EDX=00000000  
330 -00095588000i[CPU0 ] | ESP=0000ffd6 EBP=00000000 ESI=000e7c0b EDI=00000400  
331 -00095588000i[CPU0 ] | IOPL=0 id vip vif ac vm rf nt of df if tf sf ZF af PF cf  
332 -00095588000i[CPU0 ] | SEG sltr(index|ti|rpl) base limit G D  
333 -00095588000i[CPU0 ] | CS:0000( 0004| 0| 0) 00000000 0000ffff 0 0  
334 -00095588000i[CPU0 ] | DS:0000( 0005| 0| 0) 00000000 0000ffff 0 0  
335 -00095588000i[CPU0 ] | SS:0000( 0005| 0| 0) 00000000 0000ffff 0 0  
336 -00095588000i[CPU0 ] | ES:1000( 0005| 0| 0) 00010000 0000ffff 0 0  
337 -00095588000i[CPU0 ] | FS:0000( 0005| 0| 0) 00000000 0000ffff 0 0  
338 -00095588000i[CPU0 ] | GS:0000( 0005| 0| 0) 00000000 0000ffff 0 0  
339 -00095588000i[CPU0 ] | EIP=00007c94 (00007c94)  
340 -00095588000i[CPU0 ] | CR0=0x60000010 CR2=0x00000000  
341 -00095588000i[CPU0 ] | CR3=0x00000000 CR4=0x00000000  
342 -00095588000i[CMOS ] Last time is 1396195775 (Sun Mar 30 18:09:35 2014)  
343 -00095588000i[XGUI ] Exit  
344 -00095588000i[CTRL ] quit_sim called with exit code 1 233 +00014400000i[XGUI ] charmap update. Font Height is 16
  234 +00088108000p[XGUI ] >>PANIC<< POWER button turned off.
  235 +00088108000i[CPU0 ] CPU is in real mode (active)
  236 +00088108000i[CPU0 ] CS.mode = 16 bit
  237 +00088108000i[CPU0 ] SS.mode = 16 bit
  238 +00088108000i[CPU0 ] EFER = 0x00000000
  239 +00088108000i[CPU0 ] | EAX=00000e00 EBX=00000002 ECX=00090004 EDX=00000000
  240 +00088108000i[CPU0 ] | ESP=0000ffc2 EBP=0000ffca ESI=000e8047 EDI=00000400
  241 +00088108000i[CPU0 ] | IOPL=0 id vip vif ac vm rf nt of df if tf sf ZF af PF cf
  242 +00088108000i[CPU0 ] | SEG sltr(index|ti|rpl) base limit G D
  243 +00088108000i[CPU0 ] | CS:0800( 0004| 0| 0) 00008000 0000ffff 0 0
  244 +00088108000i[CPU0 ] | DS:0000( 0005| 0| 0) 00000000 0000ffff 0 0
  245 +00088108000i[CPU0 ] | SS:0000( 0005| 0| 0) 00000000 0000ffff 0 0
  246 +00088108000i[CPU0 ] | ES:1000( 0005| 0| 0) 00010000 0000ffff 0 0
  247 +00088108000i[CPU0 ] | FS:0000( 0005| 0| 0) 00000000 0000ffff 0 0
  248 +00088108000i[CPU0 ] | GS:0000( 0005| 0| 0) 00000000 0000ffff 0 0
  249 +00088108000i[CPU0 ] | EIP=00000029 (00000029)
  250 +00088108000i[CPU0 ] | CR0=0x60000010 CR2=0x00000000
  251 +00088108000i[CPU0 ] | CR3=0x00000000 CR4=0x00000000
  252 +00088108000i[CMOS ] Last time is 1396209400 (Sun Mar 30 21:56:40 2014)
  253 +00088108000i[XGUI ] Exit
  254 +00088108000i[CTRL ] quit_sim called with exit code 1
boot_floppy.asm
@@ -18,9 +18,7 @@ @@ -18,9 +18,7 @@
18 [BITS 16] 18 [BITS 16]
19 [org 0x7C00] 19 [org 0x7C00]
20 20
21 -JMP short Start  
22 -  
23 -str: db 'THE GAME ',0x00 21 +JMP Start
24 22
25 clear_screen: 23 clear_screen:
26 PUSH ax 24 PUSH ax
@@ -53,8 +51,8 @@ print_sector: @@ -53,8 +51,8 @@ print_sector:
53 PUSH bx 51 PUSH bx
54 PUSH cx 52 PUSH cx
55 PUSH dx 53 PUSH dx
56 - MOV al, [6 + ebp] ; num  
57 - MOV cl, [8 + ebp] ; offset 54 + MOV al, [8 + ebp] ; num
  55 + MOV cl, [6 + ebp] ; offset
58 MOV ah, 2 56 MOV ah, 2
59 XOR ch, ch 57 XOR ch, ch
60 XOR dx,dx 58 XOR dx,dx
@@ -82,7 +80,7 @@ print_sector: @@ -82,7 +80,7 @@ print_sector:
82 POP ebp 80 POP ebp
83 RETN 81 RETN
84 82
85 -print_char: 83 +print_char:
86 PUSH ax 84 PUSH ax
87 PUSH bx 85 PUSH bx
88 MOV ah,0x0E ; Specifies that we want to write a character to the screen 86 MOV ah,0x0E ; Specifies that we want to write a character to the screen
@@ -93,6 +91,27 @@ print_char: @@ -93,6 +91,27 @@ print_char:
93 POP ax 91 POP ax
94 RETN 92 RETN
95 93
  94 +execute_sector:
  95 + PUSH ebp
  96 + MOV ebp, esp
  97 + PUSH ax
  98 + PUSH bx
  99 + PUSH cx
  100 + PUSH dx
  101 + MOV ax, [10 + ebp] ; base address
  102 + MOV es, ax
  103 + MOV al, [8 + ebp] ; num
  104 + MOV cl, [6 + ebp] ; offset
  105 + MOV ah, 2 ; Function read
  106 + XOR ch, ch ; cylinder
  107 + XOR dx,dx ; Head and drive
  108 + INT 0x13
  109 + XOR si, si
  110 + PUSH es
  111 + PUSH bx
  112 + RETF
  113 +
  114 +
96 Start: 115 Start:
97 XOR ax, ax 116 XOR ax, ax
98 MOV ds, ax 117 MOV ds, ax
@@ -104,12 +123,15 @@ PUSH 2 ; num @@ -104,12 +123,15 @@ PUSH 2 ; num
104 PUSH 2 ; offset 123 PUSH 2 ; offset
105 CALL print_sector ; (offset, num) 124 CALL print_sector ; (offset, num)
106 ADD esp, 4 125 ADD esp, 4
107 -for_start_0:  
108 - MOV si,str  
109 - CALL print_string  
110 - ;JMP for_start_0  
111 - JMP $ 126 +MOV si,str
  127 +CALL print_string
  128 +PUSH 0x800; Base address, offset is 0
  129 +PUSH 1 ; num
  130 +PUSH 4 ; offset
  131 +XOR bx, bx;
  132 +CALL execute_sector
112 133
  134 +str: db 'THE GAME',0x0A,0x0D,0x00
113 135
114 TIMES 510 - ($ - $$) db 0 136 TIMES 510 - ($ - $$) db 0
115 DW 0xAA55 137 DW 0xAA55
boot_floppy.bin
No preview for this file type
boot_usb.asm 0 → 100644
  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 Start
  22 +
  23 +clear_screen:
  24 + PUSH ax
  25 + MOV al, 03h ; Setting the graphical mode 80x25(text)
  26 + MOV ah, 00h ; Code of the function of changing video mode
  27 + INT 10h ; Call interruption
  28 + MOV cl, 0x06
  29 + MOV ah, 0x01
  30 + INT 10h
  31 + POP ax
  32 + RETN
  33 +
  34 +print_string: ; Expects null terminated message in si
  35 + PUSH ax
  36 + for_print_string_0:
  37 + MOV al,[si]
  38 + OR al,al
  39 + JZ end_for_print_string_0
  40 + INC si
  41 + CALL print_char
  42 + JMP for_print_string_0
  43 + end_for_print_string_0:
  44 + POP ax
  45 + RETN
  46 +
  47 +print_sector:
  48 + PUSH ebp
  49 + MOV ebp, esp
  50 + PUSH ax
  51 + PUSH bx
  52 + PUSH cx
  53 + PUSH dx
  54 + MOV al, [8 + ebp] ; num
  55 + MOV cl, [6 + ebp] ; offset
  56 + MOV ah, 2
  57 + XOR ch, ch
  58 + XOR dh, dh
  59 + MOV dl, 0x80
  60 + INT 0x13
  61 + MOV di, 512
  62 + XOR ah, ah
  63 + IMUL di, ax
  64 + XOR si, si
  65 + for_print_sector_0:
  66 + CMP si, di
  67 + JZ end_for_print_sector_0
  68 + MOV al,[es:si]
  69 + OR al, al
  70 + JZ end_print_char_0
  71 + CALL print_char
  72 + end_print_char_0:
  73 + INC si
  74 + JMP for_print_sector_0
  75 + end_for_print_sector_0:
  76 + POP dx
  77 + POP cx
  78 + POP bx
  79 + POP ax
  80 + MOV esp, ebp
  81 + POP ebp
  82 + RETN
  83 +
  84 +print_char:
  85 + PUSH ax
  86 + PUSH bx
  87 + MOV ah,0x0E ; Specifies that we want to write a character to the screen
  88 + MOV bl,0x02 ; Specifies output text color. Not required, but useful to know
  89 + MOV bh,0x00 ; Page number. Leave this alone.
  90 + INT 0x10 ; Signal video interrupt to BIOS
  91 + POP bx
  92 + POP ax
  93 + RETN
  94 +
  95 +execute_sector:
  96 + PUSH ebp
  97 + MOV ebp, esp
  98 + PUSH ax
  99 + PUSH bx
  100 + PUSH cx
  101 + PUSH dx
  102 + MOV ax, [10 + ebp] ; base address
  103 + MOV es, ax
  104 + MOV al, [8 + ebp] ; num
  105 + MOV cl, [6 + ebp] ; offset
  106 + MOV ah, 2 ; Function read
  107 + XOR ch, ch ; cylinder
  108 + XOR dh, dh ; head
  109 + MOV dl, 0x80 ; drive
  110 + INT 0x13
  111 + XOR si, si
  112 + PUSH es
  113 + PUSH bx
  114 + RETF
  115 +
  116 +Start:
  117 +XOR ax, ax
  118 +MOV ds, ax
  119 +MOV ax, 0x1000
  120 +MOV es, ax
  121 +XOR bx, bx
  122 +CALL clear_screen
  123 +PUSH 2 ; num
  124 +PUSH 2 ; offset
  125 +CALL print_sector ; (offset, num)
  126 +ADD esp, 4
  127 +MOV si,str
  128 +CALL print_string
  129 +PUSH 0x800; Base address, offset is 0
  130 +PUSH 1 ; num
  131 +PUSH 4 ; offset
  132 +XOR bx, bx;
  133 +CALL execute_sector
  134 +
  135 +
  136 +str: db 'THE GAME',0x0A,0x0D,0x00
  137 +
  138 +TIMES 510 - ($ - $$) db 0
  139 +DW 0xAA55
  140 +
  141 +
  142 +
boot_usb.bin 0 → 100644
No preview for this file type
floppy.img
No preview for this file type
second_binary.asm 0 → 100644
  1 +[BITS 16]
  2 +[org 0x8000]
  3 +
  4 +JMP short Start
  5 +
  6 +print_string: ; Expects null terminated message in si
  7 + for_print_string_0:
  8 + MOV al,[si]
  9 + OR al,al
  10 + JZ end_for_print_string_0
  11 + INC si
  12 + CALL print_char
  13 + JMP for_print_string_0
  14 + end_for_print_string_0:
  15 + RETN
  16 +
  17 +print_char:
  18 + MOV ah,0x0E ; Specifies that we want to write a character to the screen
  19 + MOV bl,0x02 ; Specifies output text color. Not required, but useful to know
  20 + MOV bh,0x00 ; Page number. Leave this alone.
  21 + INT 0x10 ; Signal video interrupt to BIOS
  22 + RETN
  23 +
  24 +Start:
  25 +XOR ax, ax
  26 +MOV ds, ax
  27 +MOV ax, 0x1000
  28 +MOV es, ax
  29 +XOR bx, bx
  30 +for_start_0:
  31 + MOV si, str
  32 + CALL print_string
  33 + ;JMP for_start_0
  34 + JMP $
  35 +
  36 +str: db 'Hi! I',0x27,'m the second binary!',0x0A,0x0D,0x00
  37 +
  38 +TIMES 510 - ($ - $$) db 0
  39 +
  40 +
  41 +
second_binary.bin 0 → 100644
No preview for this file type
usb.img 0 → 100644
No preview for this file type