Ok, I tried adding this to the start of the bootloader
Code: Select all
start:
mov ax , 0x9000
mov ss , ax
xor ax , ax
mov ds , ax
mov es , ax
So the stack for the first stage bootloader should be located at 0000:9000.
Just in case I set ds , es , to zero before I do any work.
I also put in 3 calles to readsectors_into_memory since somebody said reading from I floppy
May take a few tries.
Code: Select all
call readsectors_into_memory
call readsectors_into_memory
call readsectors_into_memory
jmp 0000:8000
Still the same looping crap.
Note when I jump to 0000:8000 I don't set the stack to anything different.
Still using 9000 but I would think this is ok?
Never set ds , es to anything so they are still pointing to 0 I think after the jump?
Was I suppose to set the sp stack pointer as well as ss stack segment?
Anyway , a few question I have is what memory is reserved.
Like I would never load stuff to the first 1024 bytes since this is the IVT in 16 mode.
what is the places in memory you should never use? Is it just where IVT , VGA are in real mode.
Anyway I think I am OK to use 0000:8000 and 0000:9000 for loading.
Why the hell is it looping?
This is the bochesout.txt gives
Code: Select all
00000000000i[ ] Bochs x86 Emulator 2.3.6
00000000000i[ ] Build from CVS snapshot, on December 24, 2007
00000000000i[ ] System configuration
00000000000i[ ] processors: 1 (cores=1, HT threads=1)
00000000000i[ ] A20 line support: yes
00000000000i[ ] APIC support: yes
00000000000i[ ] CPU configuration
00000000000i[ ] level: 6
00000000000i[ ] TLB enabled: yes
00000000000i[ ] SMP support: no
00000000000i[ ] FPU support: yes
00000000000i[ ] MMX support: yes
00000000000i[ ] SSE support: 2
00000000000i[ ] CLFLUSH support: yes
00000000000i[ ] VME support: yes
00000000000i[ ] 3dnow! support: no
00000000000i[ ] PAE support: yes
00000000000i[ ] PGE support: yes
00000000000i[ ] PSE support: yes
00000000000i[ ] x86-64 support: yes
00000000000i[ ] SEP support: yes
00000000000i[ ] MWAIT support: no
00000000000i[ ] Optimization configuration
00000000000i[ ] Guest2HostTLB support: yes
00000000000i[ ] RepeatSpeedups support: yes
00000000000i[ ] Icache support: yes
00000000000i[ ] Trace cache support: yes
00000000000i[ ] Fast function calls: yes
00000000000i[ ] Devices configuration
00000000000i[ ] ACPI support: yes
00000000000i[ ] NE2000 support: yes
00000000000i[ ] PCI support: yes
00000000000i[ ] SB16 support: yes
00000000000i[ ] USB support: yes
00000000000i[ ] VGA extension support: vbe cirrus
00000000000i[MEM0 ] allocated memory at 02480020. after alignment, vector=02481000
00000000000i[MEM0 ] 512.00MB
00000000000i[MEM0 ] rom at 0xfffe0000/131072 ('BIOS-bochs-latest')
00000000000i[MEM0 ] rom at 0xc0000/38400 ('../VGABIOS-lgpl-latest')
00000000000i[APIC?] set APIC ID to 0
00000000000i[APIC0] 80686
00000000000i[APIC0] local apic in CPU apicid=00 initializing
00000000000i[IOAP ] initializing I/O APIC
00000000000i[IOAP ] set APIC ID to 1
00000000000i[MEM0 ] Register memory access handlers: fec00000-fec00fff
00000000000i[CMOS ] Using local time for initial clock
00000000000i[CMOS ] Setting initial clock to: Sat Nov 22 14:41:16 2008 (time0=1227382876)
00000000000i[DMA ] channel 4 used by cascade
00000000000i[DMA ] channel 2 used by Floppy Drive
00000000000i[FDD ] fd0: 'myfloppy.img' ro=0, h=2,t=80,spt=18
00000000000i[PCI ] 440FX Host bridge present at device 0, function 0
00000000000i[PCI ] PIIX3 PCI-to-ISA bridge present at device 1, function 0
00000000000i[MEM0 ] Register memory access handlers: 000a0000-000bffff
00000000000i[WGUI ] Desktop Window dimensions: 1152 x 864
00000000000i[WGUI ] Number of Mouse Buttons = 3
00000000000i[WGUI ] IME disabled
00000000000i[MEM0 ] Register memory access handlers: e0000000-e07fffff
00000000000i[CLVGA] VBE Bochs Display Extension Enabled
00000000000i[CLVGA] interval=40000
00000000000i[ ] init_mem of 'harddrv' plugin device by virtual method
00000000000i[ ] init_mem of 'keyboard' plugin device by virtual method
00000000000i[ ] init_mem of 'serial' plugin device by virtual method
00000000000i[ ] init_mem of 'parallel' plugin device by virtual method
00000000000i[ ] init_mem of 'extfpuirq' plugin device by virtual method
00000000000i[ ] init_mem of 'gameport' plugin device by virtual method
00000000000i[ ] init_mem of 'speaker' plugin device by virtual method
00000000000i[ ] init_mem of 'pci_ide' plugin device by virtual method
00000000000i[ ] init_mem of 'acpi' plugin device by virtual method
00000000000i[ ] init_dev of 'harddrv' plugin device by virtual method
00000000000i[HD ] Using boot sequence floppy, cdrom, disk
00000000000i[HD ] Floppy boot signature check is enabled
00000000000i[ ] init_dev of 'keyboard' plugin device by virtual method
00000000000i[KBD ] will paste characters every 1000 keyboard ticks
00000000000i[ ] init_dev of 'serial' plugin device by virtual method
00000000000i[SER ] com1 at 0x03f8 irq 4
00000000000i[ ] init_dev of 'parallel' plugin device by virtual method
00000000000i[PAR ] parallel port 1 at 0x0378 irq 7
00000000000i[ ] init_dev of 'extfpuirq' plugin device by virtual method
00000000000i[ ] init_dev of 'gameport' plugin device by virtual method
00000000000i[ ] init_dev of 'speaker' plugin device by virtual method
00000000000i[ ] init_dev of 'pci_ide' plugin device by virtual method
00000000000i[PCI ] PIIX3 PCI IDE controller present at device 1, function 1
00000000000i[ ] init_dev of 'acpi' plugin device by virtual method
00000000000i[PCI ] ACPI Controller present at device 1, function 3
00000000000i[ ] register state of 'harddrv' plugin device by virtual method
00000000000i[ ] register state of 'keyboard' plugin device by virtual method
00000000000i[ ] register state of 'serial' plugin device by virtual method
00000000000i[ ] register state of 'parallel' plugin device by virtual method
00000000000i[ ] register state of 'extfpuirq' plugin device by virtual method
00000000000i[ ] register state of 'gameport' plugin device by virtual method
00000000000i[ ] register state of 'speaker' plugin device by virtual method
00000000000i[ ] register state of 'pci_ide' plugin device by virtual method
00000000000i[ ] register state of 'acpi' plugin device by virtual method
00000000000i[SYS ] bx_pc_system_c::Reset(HARDWARE) called
00000000000i[CPU0 ] cpu hardware reset
00000000000i[APIC0] local apic in CPU 0 initializing
00000000000i[ ] reset of 'harddrv' plugin device by virtual method
00000000000i[ ] reset of 'keyboard' plugin device by virtual method
00000000000i[ ] reset of 'serial' plugin device by virtual method
00000000000i[ ] reset of 'parallel' plugin device by virtual method
00000000000i[ ] reset of 'extfpuirq' plugin device by virtual method
00000000000i[ ] reset of 'gameport' plugin device by virtual method
00000000000i[ ] reset of 'speaker' plugin device by virtual method
00000000000i[ ] reset of 'pci_ide' plugin device by virtual method
00000000000i[ ] reset of 'acpi' plugin device by virtual method
00000003445i[BIOS ] $Revision: 1.193 $ $Date: 2007/12/20 18:12:11 $
00000317060i[KBD ] reset-disable command received
00000335566i[BIOS ] Starting rombios32
00000336288i[BIOS ] ram_size=0x20000000
00000356698i[BIOS ] Found 1 cpu(s)
00000372170i[BIOS ] bios_table_addr: 0x000faff8 end=0x000fe05b
00000372244i[PCI ] 440FX PMC write to PAM register 59 (TLB Flush)
00000699979i[PCI ] 440FX PMC write to PAM register 59 (TLB Flush)
00001028426i[P2I ] PCI IRQ routing: PIRQA# set to 0x0b
00001028475i[P2I ] PCI IRQ routing: PIRQB# set to 0x09
00001028524i[P2I ] PCI IRQ routing: PIRQC# set to 0x0b
00001028573i[P2I ] PCI IRQ routing: PIRQD# set to 0x09
00001028588i[P2I ] write: ELCR2 = 0x0a
00001029389i[BIOS ] PIIX3 init: elcr=00 0a
00001050302i[BIOS ] PCI: bus=0 devfn=0x00: vendor_id=0x8086 device_id=0x1237
00001053275i[BIOS ] PCI: bus=0 devfn=0x08: vendor_id=0x8086 device_id=0x7000
00001055716i[BIOS ] PCI: bus=0 devfn=0x09: vendor_id=0x8086 device_id=0x7010
00001056198i[PIDE ] new BM-DMA address: 0xc000
00001056952i[BIOS ] region 4: 0x0000c000
00001059227i[BIOS ] PCI: bus=0 devfn=0x0b: vendor_id=0x8086 device_id=0x7113
00001059758i[ACPI ] new irq line = 11
00001059794i[ACPI ] new PM base address: 0xb000
00001059861i[ACPI ] new SM base address: 0xb100
00001060246i[CPU0 ] Enter to System Management Mode
00001060256i[CPU0 ] RSM: Resuming from System Management Mode
00001060290i[PCI ] setting SMRAM control register to 0x4a
00001060508i[PCI ] setting SMRAM control register to 0x0a
00001084183i[BIOS ] MP table addr=0x000fb0d0 MPC table addr=0x000fb000 size=0xd0
00001086126i[BIOS ] ACPI tables: RSDP addr=0x000fb0e0 ACPI DATA addr=0x1fff0000 size=0x978
00001098996i[PCI ] 440FX PMC write to PAM register 59 (TLB Flush)
00001349337i[VBIOS] VGABios $Id: vgabios.c,v 1.66 2006/07/10 07:47:51 vruppert Exp $
00001349408i[CLVGA] VBE known Display Interface b0c0
00001349440i[CLVGA] VBE known Display Interface b0c4
00001352365i[VBIOS] VBE Bios $Id: vbe.c,v 1.58 2006/08/19 09:39:43 vruppert Exp $
00001440000i[WGUI ] dimension update x=720 y=400 fontheight=16 fontwidth=9 bpp=8
00001796627i[BIOS ] Booting from 0000:7c00
00027100000p[WGUI ] >>PANIC<< POWER button turned off.
00027100000i[CPU0 ] CPU is in real mode (active)
00027100000i[CPU0 ] CS.d_b = 16 bit
00027100000i[CPU0 ] SS.d_b = 16 bit
00027100000i[CPU0 ] EFER = 0x00000000
00027100000i[CPU0 ] | RAX=000000000000023a RBX=0000000000007c38
00027100000i[CPU0 ] | RCX=0000000000000037 RDX=0000000000000000
00027100000i[CPU0 ] | RSP=000000000000ffdc RBP=0000000000007c1c
00027100000i[CPU0 ] | RSI=00000000ffff88ca RDI=0000000000080000
00027100000i[CPU0 ] | R8=0000000000000000 R9=0000000000000000
00027100000i[CPU0 ] | R10=0000000000000000 R11=0000000000000000
00027100000i[CPU0 ] | R12=0000000000000000 R13=0000000000000000
00027100000i[CPU0 ] | R14=0000000000000000 R15=0000000000000000
00027100000i[CPU0 ] | IOPL=0 id vip vif ac vm rf nt OF df if tf SF zf af PF cf
00027100000i[CPU0 ] | SEG selector base limit G D
00027100000i[CPU0 ] | SEG sltr(index|ti|rpl) base limit G D
00027100000i[CPU0 ] | CS:0000( 0004| 0| 0) 00000000 0000ffff 0 0
00027100000i[CPU0 ] | DS:0000( 0005| 0| 0) 00000000 0000ffff 0 0
00027100000i[CPU0 ] | SS:9000( 0005| 0| 0) 00090000 0000ffff 0 0
00027100000i[CPU0 ] | ES:0000( 0005| 0| 0) 00000000 0000ffff 0 0
00027100000i[CPU0 ] | FS:0000( 0005| 0| 0) 00000000 0000ffff 0 0
00027100000i[CPU0 ] | GS:0000( 0005| 0| 0) 00000000 0000ffff 0 0
00027100000i[CPU0 ] | MSR_FS_BASE:0000000000000000
00027100000i[CPU0 ] | MSR_GS_BASE:0000000000000000
00027100000i[CPU0 ] | RIP=00000000000079a2 (00000000000079a2)
00027100000i[CPU0 ] | CR0=0x00000010 CR1=0x0 CR2=0x0000000000000000
00027100000i[CPU0 ] | CR3=0x00000000 CR4=0x00000000
00027100000i[CPU0 ] >> add byte ptr ds:[bx+si], al : 0000
00027100000i[CMOS ] Last time is 1227382889 (Sat Nov 22 14:41:29 2008)
00027100000i[ ] restoring default signal behavior
00027100000i[CTRL ] quit_sim called with exit code 1
If you have a look you see that all the segment registers are at zero except the ss segemtn register equals 9000 as should be?
Is their something wrong with my jump command jmp 0000:8000 should I add an h on the end for hex value or is this implied. AHHHHHHHH I just don't know. I am currently in the process o learning how to use the boches debugger. But I havn't figured it out fully yet.
I think it's only for higher versions
You must use flex version 2.5.4 or greater. I have heard that version 2.5.2 will not work.
I have 2.3.6 and I don't want to start downloadiing a new version when I have everything setup perfectly.