and over again (triple faulting) whenever I issue the jmp 0000:8000 command.
What I am trying to do is load the second sector of the floppy and then jump to it.
This is my bootloader sector 1 code that the bios loads.
Code: Select all
org 0x7C00
BITS 16
jmp start
greetings db 'Greetings and welcome ',13d,10d,'$'
BOOTLOADER_NAME db 'Nates BootLoader Stage 1' ,13d,10d,'$'
STARTSECTOR db 2 ;start sector to load
LOADADDRESS dw 8000h ; where to load the sectors into memory
NUMBEROFSECTORS db 1 ; number of bytes to load begining at STARTSECTOR
clear_screen:
mov ax , 600h ; clear screen scroll up function
mov bh , 7h ; white on black background
mov ch , 0h ;upper line (top)
mov cl , 0h ;left col (far left)
mov dh , 18h ;bottom
mov dl , 4Fh ;far right
int 10h ; do the clearing
ret
readsectors_into_memory:
mov ah , 02h ; read function
mov al , NUMBEROFSECTORS ; number of sectors to read
mov ch , 0h ; cylinder number
mov cl , STARTSECTOR ; starting sector to begin reading from
mov dh , 0h ; head number
mov dl , 00h ;drive for floppy
mov bx , LOADADDRESS ; es:ds-> buffer for where the sectors will be loaded in this case 0000:8000h
int 13 ; execute the interrupt for reading into memory
ret
start:
mov ax , 0x9100 ;set the stack to some random address
mov ss , ax
mov sp , 0x9000 ; set the stack pointer to some random address
xor ax , ax
mov ds , ax ;data segment is at segment zero
mov es , ax ; exta segment is at segment zero now.
call clear_screen
mov ah , 13h
mov al , 01h
mov bh , 0h
mov bl , 0Fh
mov dh , 5h
mov dl , 3h
mov cx , greetings
mov bp , cx
mov cx , 22d
int 10h
mov cx , BOOTLOADER_NAME
mov bp , cx
mov cx , 24d
mov dh , 10h
mov dl , 0h
int 10h
readData:
call readsectors_into_memory
jc readData
;It get's here because I put a display string out to the screen and it wrote it out fine.
;I think it is loading the sector because the carry is never set but when it tries the jmp 0000:8000 it doesn't work??????? jmp 0000:8000
This is my sector 2 code that I want to load into memory 0000:8000 then jump to it
Code: Select all
org 0x8000
BITS 16
jmp main
hello db 'This is sector 2!',13d,10d,'$' ;Put any data here!
main:
mov ax , 0
mov ds , ax
mov es , ax
mov ax , 0x1110
mov ss , ax
mov sp , ax
mov ax , 600h ; clear screen scroll up function
mov bh , 7h ; white on black background
mov ch , 0h ;upper line (top)
mov cl , 0h ;left col (far left)
mov dh , 18h ;bottom
mov dl , 4Fh ;far right
int 10h ;do the clearing
; display the string This is sector 2 on the screen
;mov ax , 0
;mov es , ax
mov ah , 13h
mov al , 01h
mov bh , 0h
mov bl , 0Fh
mov dh , 5h
mov dl , 3h
mov cx , hello
mov bp , cx
mov cx , 16d
int 10h
; loop forever
endsss:
jmp endsss
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 01D30020. after alignment, vector=01D31000
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: Sun Jan 25 14:54:52 2009 (time0=1232913292)
00000000000i[DMA ] channel 4 used by cascade
00000000000i[DMA ] channel 2 used by Floppy Drive
00000000000i[FDD ] fd0: 'myfloppy2.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
00122798000i[WGUI ] system RESET callback
00122798000i[SYS ] bx_pc_system_c::Reset(HARDWARE) called
00122798000i[CPU0 ] cpu hardware reset
00122798000i[APIC0] local apic in CPU 0 initializing
00122798000i[ ] reset of 'harddrv' plugin device by virtual method
00122798000i[ ] reset of 'keyboard' plugin device by virtual method
00122798000i[ ] reset of 'serial' plugin device by virtual method
00122798000i[ ] reset of 'parallel' plugin device by virtual method
00122798000i[ ] reset of 'extfpuirq' plugin device by virtual method
00122798000i[ ] reset of 'gameport' plugin device by virtual method
00122798000i[ ] reset of 'speaker' plugin device by virtual method
00122798000i[ ] reset of 'pci_ide' plugin device by virtual method
00122798000i[ ] reset of 'acpi' plugin device by virtual method
00122801572i[BIOS ] $Revision: 1.193 $ $Date: 2007/12/20 18:12:11 $
00123115073i[KBD ] reset-disable command received
00123133467i[BIOS ] Starting rombios32
00123134189i[BIOS ] ram_size=0x20000000
00123154621i[BIOS ] Found 1 cpu(s)
00123170093i[BIOS ] bios_table_addr: 0x000faff8 end=0x000fe05b
00123170167i[PCI ] 440FX PMC write to PAM register 59 (TLB Flush)
00123497902i[PCI ] 440FX PMC write to PAM register 59 (TLB Flush)
00123826349i[P2I ] PCI IRQ routing: PIRQA# set to 0x0b
00123826398i[P2I ] PCI IRQ routing: PIRQB# set to 0x09
00123826447i[P2I ] PCI IRQ routing: PIRQC# set to 0x0b
00123826496i[P2I ] PCI IRQ routing: PIRQD# set to 0x09
00123826511i[P2I ] write: ELCR2 = 0x0a
00123827312i[BIOS ] PIIX3 init: elcr=00 0a
00123848225i[BIOS ] PCI: bus=0 devfn=0x00: vendor_id=0x8086 device_id=0x1237
00123851198i[BIOS ] PCI: bus=0 devfn=0x08: vendor_id=0x8086 device_id=0x7000
00123853639i[BIOS ] PCI: bus=0 devfn=0x09: vendor_id=0x8086 device_id=0x7010
00123854875i[BIOS ] region 4: 0x0000c000
00123857150i[BIOS ] PCI: bus=0 devfn=0x0b: vendor_id=0x8086 device_id=0x7113
00123857681i[ACPI ] new irq line = 11
00123881553i[BIOS ] MP table addr=0x000fb0d0 MPC table addr=0x000fb000 size=0xd0
00123883496i[BIOS ] ACPI tables: RSDP addr=0x000fb0e0 ACPI DATA addr=0x1fff0000 size=0x978
00123896366i[PCI ] 440FX PMC write to PAM register 59 (TLB Flush)
00124146707i[VBIOS]
VGABios $Id: vgabios.c,v 1.66 2006/07/10 07:47:51 vruppert Exp $
00124146778i[CLVGA] VBE known Display Interface b0c0
00124146810i[CLVGA] VBE known Display Interface b0c4
00124149735i[VBIOS] VBE Bios $Id: vbe.c,v 1.58 2006/08/19 09:39:43 vruppert Exp $
00124593997i[BIOS ] Booting from 0000:7c00
00131752000i[WGUI ] system RESET callback
00131752000i[SYS ] bx_pc_system_c::Reset(HARDWARE) called
00131752000i[CPU0 ] cpu hardware reset
00131752000i[APIC0] local apic in CPU 0 initializing
00131752000i[ ] reset of 'harddrv' plugin device by virtual method
00131752000i[ ] reset of 'keyboard' plugin device by virtual method
00131752000i[ ] reset of 'serial' plugin device by virtual method
00131752000i[ ] reset of 'parallel' plugin device by virtual method
00131752000i[ ] reset of 'extfpuirq' plugin device by virtual method
00131752000i[ ] reset of 'gameport' plugin device by virtual method
00131752000i[ ] reset of 'speaker' plugin device by virtual method
00131752000i[ ] reset of 'pci_ide' plugin device by virtual method
00131752000i[ ] reset of 'acpi' plugin device by virtual method
00131755572i[BIOS ] $Revision: 1.193 $ $Date: 2007/12/20 18:12:11 $
00132069073i[KBD ] reset-disable command received
00132087465i[BIOS ] Starting rombios32
00132088187i[BIOS ] ram_size=0x20000000
00132108597i[BIOS ] Found 1 cpu(s)
00132124069i[BIOS ] bios_table_addr: 0x000faff8 end=0x000fe05b
00132124143i[PCI ] 440FX PMC write to PAM register 59 (TLB Flush)
00132451878i[PCI ] 440FX PMC write to PAM register 59 (TLB Flush)
00132780325i[P2I ] PCI IRQ routing: PIRQA# set to 0x0b
00132780374i[P2I ] PCI IRQ routing: PIRQB# set to 0x09
00132780423i[P2I ] PCI IRQ routing: PIRQC# set to 0x0b
00132780472i[P2I ] PCI IRQ routing: PIRQD# set to 0x09
00132780487i[P2I ] write: ELCR2 = 0x0a
00132781288i[BIOS ] PIIX3 init: elcr=00 0a
00132802201i[BIOS ] PCI: bus=0 devfn=0x00: vendor_id=0x8086 device_id=0x1237
00132805174i[BIOS ] PCI: bus=0 devfn=0x08: vendor_id=0x8086 device_id=0x7000
00132807615i[BIOS ] PCI: bus=0 devfn=0x09: vendor_id=0x8086 device_id=0x7010
00132808851i[BIOS ] region 4: 0x0000c000
00132811126i[BIOS ] PCI: bus=0 devfn=0x0b: vendor_id=0x8086 device_id=0x7113
00132811657i[ACPI ] new irq line = 11
00132835529i[BIOS ] MP table addr=0x000fb0d0 MPC table addr=0x000fb000 size=0xd0
00132837472i[BIOS ] ACPI tables: RSDP addr=0x000fb0e0 ACPI DATA addr=0x1fff0000 size=0x978
00132850342i[PCI ] 440FX PMC write to PAM register 59 (TLB Flush)
00133100683i[VBIOS]
VGABios $Id: vgabios.c,v 1.66 2006/07/10 07:47:51 vruppert Exp $
00133100754i[CLVGA] VBE known Display Interface b0c0
00133100786i[CLVGA] VBE known Display Interface b0c4
00133103711i[VBIOS] VBE Bios $Id: vbe.c,v 1.58 2006/08/19 09:39:43 vruppert Exp $
00133547973i[BIOS ] Booting from 0000:7c00
00136930000p[WGUI ] >>PANIC<< POWER button turned off.
00136930000i[CPU0 ] CPU is in real mode (active)
00136930000i[CPU0 ] CS.d_b = 16 bit
00136930000i[CPU0 ] SS.d_b = 16 bit
00136930000i[CPU0 ] EFER = 0x00000000
00136930000i[CPU0 ] | RAX=000000000000023a RBX=0000000000007c38
00136930000i[CPU0 ] | RCX=0000000000000037 RDX=0000000000000000
00136930000i[CPU0 ] | RSP=0000000000009000 RBP=0000000000007c1c
00136930000i[CPU0 ] | RSI=00000000ffff88ca RDI=0000000000080000
00136930000i[CPU0 ] | R8=0000000000000000 R9=0000000000000000
00136930000i[CPU0 ] | R10=0000000000000000 R11=0000000000000000
00136930000i[CPU0 ] | R12=0000000000000000 R13=0000000000000000
00136930000i[CPU0 ] | R14=0000000000000000 R15=0000000000000000
00136930000i[CPU0 ] | IOPL=0 id vip vif ac vm rf nt of df if tf sf zf AF PF CF
00136930000i[CPU0 ] | SEG selector base limit G D
00136930000i[CPU0 ] | SEG sltr(index|ti|rpl) base limit G D
00136930000i[CPU0 ] | CS:0000( 0004| 0| 0) 00000000 0000ffff 0 0
00136930000i[CPU0 ] | DS:0000( 0005| 0| 0) 00000000 0000ffff 0 0
00136930000i[CPU0 ] | SS:9100( 0005| 0| 0) 00091000 0000ffff 0 0
00136930000i[CPU0 ] | ES:0000( 0005| 0| 0) 00000000 0000ffff 0 0
00136930000i[CPU0 ] | FS:0000( 0005| 0| 0) 00000000 0000ffff 0 0
00136930000i[CPU0 ] | GS:0000( 0005| 0| 0) 00000000 0000ffff 0 0
00136930000i[CPU0 ] | MSR_FS_BASE:0000000000000000
00136930000i[CPU0 ] | MSR_GS_BASE:0000000000000000
00136930000i[CPU0 ] | RIP=00000000000064ce (00000000000064ce)
00136930000i[CPU0 ] | CR0=0x00000010 CR1=0x0 CR2=0x0000000000000000
00136930000i[CPU0 ] | CR3=0x00000000 CR4=0x00000000
00136930000i[CPU0 ] >> add byte ptr ds:[bx+si], al : 0000
00136930000i[CMOS ] Last time is 1232913359 (Sun Jan 25 14:55:59 2009)
00136930000i[ ] restoring default signal behavior
00136930000i[CTRL ] quit_sim called with exit code 1
I don't know what the hell add byte ptr ds:[bx +si], al : 0000. Maybe it is not jumping to where I want it to.
Thanks for any help.
I have tried everything.