Autor Thema: Bochs meldet "prefetch: RIP > CS.limit"  (Gelesen 6709 mal)

Azi

  • Beiträge: 47
    • Profil anzeigen
Gespeichert
« am: 19. November 2005, 19:34 »
Hmm, was heißt das? Ist CS zu klein? Und RIP (War das nicht 'Ruhe in Frieden' :lol:  :lol:  :lol: ?)? Hier mal der Code:

[boot.asm]

;06.11.2005 21:56: Erster Code
;09.11.2005 21:50: Code, der funktioniert
;11.11.2005 21:54: Code, der Kernel laden kann

;---------------------------------------------------------------------------Code

;----------Adresse korregieren
org 07C00h

;----------Daten- und Stapelsegment erzeugen
cli
xor ax, ax
mov ds, ax
mov ax,0100h
mov ss,ax
mov sp,06C00h
sti

;----------Bootlaufwerk speichern
mov [boot],dl

;----------Unsere ersten Ausgaben
mov si,text_boot
call sag
mov si,text_loadkernel
call sag

;----------Laufwerk wird zurückgesetzt
mov ah,00h
mov dl,[boot]
int 013h

;----------Adresse für die Daten zum Einlesen wird gesetzt
mov ax,01000h
mov es,ax
mov bx,00h

;----------Lese Sektoren in den Speicher
mov ah,02h
mov al,01h     ;Anzahl der Sektoren, bei steigender Kernelgröße erhöhen!
mov ch,00h
mov cl,02h
mov dh,00h
mov dl,00h
int 013h

;----------Bereite den Sprung zu den ein gelesenen Daten vor
mov ax,01000h
mov ds,ax
mov es,ax
push ax
mov ax,00h
push ax

;----------DER ALLES ENTSCHEIDENE MOMENT: DER KERNEL WIRD GESTARTET
retf

;----------Wenn er irgendwie nix gemacht hat
call reboot

;---------------------------------------------------------------------------Daten

boot db 0
text_boot db "Bootloader wurde geladen",13,10,0
text_loadkernel db "Kernel wird geladen...",13,10,0



;---------------------------------------------------------------------------Funktionen

;----------sag
sag:
lodsb
or al,al
jz endesag
mov ah,0Eh
mov bx,07h
int 010h
jmp sag

endesag:
ret

;----------Reboot
reboot:
db 0EAh
dw 0000h
dw 0FFFFh
ret

;---------------------------------------------------------------------------Boot-Erlaubnis

;----------Dateigröße
times 512-($-$$)-2 db 0

;----------Bootsignatur
dw 0AA55h



[kernel2.asm]

;11.11.2005 22:54: Erster Boot mit dem Kernel

;---------------------------------------------------------------------------Code

;----------Unsere ersten Ausgaben
mov si,text_load
call sag
mov si,text_leer
call sag
mov si,text_leer
call sag
mov si,text_leer
call sag
mov si,text_os
call sag
mov si,text_copyright
call sag
mov si,text_reboot
call sag
mov si,text_shutdown
call sag

;----------Auswahl
auswahl:
mov si,text_eingabe
call sag
call anykey
cmp al,0Dh
je eingabetaste
push ax
call zeig
jmp auswahl

;----------Enter
eingabetaste:
pop ax
cmp al,072h
je auswahl_reboot
cmp al,073h
je auswahl_shutdown

;----------Neu starten
auswahl_reboot:
call reboot

;----------Shutdown
auswahl_shutdown:
call shutdown

;---------------------------------------------------------------------------Daten

text_leer db "",13,10,0
text_load db "Kernel wurde geladen",13,10,0
text_os db "AquanaSoft OS Codename 'Thaleia'",13,10,0
text_copyright db "Copyright 2005 Alexander S. Azim",13,10,0
text_reboot db "Dr?cken Sie 'R', um den Computer neu zu starten",13,10,0
text_shutdown db "Dr?cken Sie 'S', um den Computer auszuschalten",13,10,0
text_eingabe db "Eingabe: ",10,0

;---------------------------------------------------------------------------Funktionen

;----------sag
sag:
lodsb
or al,al
jz endesag
call zeig
jmp sag

endesag:
ret

;----------zeig
zeig:
mov ah,0Eh
mov bx,07h
int 010h
ret

;----------anykey
anykey:
mov ah,0
int 16h
ret

;----------Reboot
reboot:
db 0EAh
dw 0000h
dw 0FFFFh
ret

;----------Shutdown
shutdown:
mov ax,5301h ;Aktiviere RealMode APM Interface
xor bx,bx
int 15h

mov ax,530eh ;Waehle APM Version
xor bx,bx
mov cx,0102h ;v1.2
int 15h

mov ax,530fh ;Aktiviere APM fuer alle Geraete
mov bx,0001h ;ID 1=Alle Geraete
mov cx,0001h ;1=engage
int 15h

mov ax,5308h ;Aktiviere automatisches APM fuer alle Geraete
mov bx,0001h ;ID 1=Alle Geraete
mov cx,0001h ;1=enable
int 15h

mov ax,5307h ;Setze Geraetezustand
mov bx,0001h ;ID 1=Alle Geraete
mov cx,0003h ;Status 3=Ausgeschaltet
int 15h
ret

;----------Dateigröße anpassen, um genau in den Sektoren zu passen
times 1024-($-$$) db 0


Es gibt 10 Sorten von Menschen: Die einen können binär zählen, die anderen nicht.

Der Vorteil der Klugheit liegt darin, dass man sich dumm stellen kann. Das Gegenteil ist schon schwieriger.

n3Ro

  • Beiträge: 288
    • Profil anzeigen
Gespeichert
« Antwort #1 am: 19. November 2005, 19:50 »
RIP ist der Instruction Pointer auf x86_64 Maschinen (wie EIP). Deine Fehlermeldung heißt soviel wie : "Außerhalb des definierten Segments auf eine Stelle im Speicher zugegriffen!". Also solltest du deine Segmente und die Selektoren die du setzt prüfen.
Agieren statt Konsumieren!

bitmaster

  • Troll
  • Beiträge: 1 138
    • Profil anzeigen
    • OS-64 = 64 Bit Operating System
Gespeichert
« Antwort #2 am: 19. November 2005, 21:31 »
Zitat von: n3Ro
Also solltest du deine Segmente und die Selektoren die du setzt prüfen.
Nur das es im RM keine Selektoren gibt. ;)
Also ich habe den Code mal assembliert und unter Bochs laufen lassen. Es hat funktioniert. Verstehe nicht warum es bei dir nicht funktioniert. Aber ich habe einen Fehler in deinem Code gefunden (und ich finde der Code sieht nicht gerade schön aus). Hier ist der Fehler:

je eingabetaste
push ax
call zeig
jmp auswahl

;----------Enter
eingabetaste:
pop ax
Der Code müsste so aussehen:

push ax
je eingabetaste
add sp,0002h ;oder pop ax
call zeig
jmp auswahl

;----------Enter
eingabetaste:
pop ax
Ich verstehe zwar wie so vieles von deinem Code nicht, warum du ax abspeicherst wenn du es sowieso nicht veränderst. Trotz allem funktioniert der Code (solange das Stacksegment nicht übeläuft). Also liegt es wohl weniger am Code sondern vielleicht an deiner Bochs Einstellung. Oder du hast beim erstellen des Image einen Fehler gemacht. Bei mir funkioniert der Code nämlich. Wenn du willst schicke ich dir die Imagedatei per E-Mail. Viel Spaß noch!
In the Future everyone will need OS-64!!!

n3Ro

  • Beiträge: 288
    • Profil anzeigen
Gespeichert
« Antwort #3 am: 19. November 2005, 21:39 »
Stimmt, ist 16-Bit RealMode Code. Dann kann es an der Bochs-Version liegen, da gab es diese Fehlermeldung auch mal als Bug. Also -> updaten.
Agieren statt Konsumieren!

Thoth

  • Beiträge: 62
    • Profil anzeigen
Gespeichert
« Antwort #4 am: 19. November 2005, 23:53 »
Mit


cli
xor ax, ax
mov ds, ax
mov ax,0100h
mov ss,ax
mov sp,06C00h
sti


setzt du doch den Stack direkt unter deinen Bootsektor, oder? Könnte es nicht, wenns blöd kommt passieren, dass der zu groß wird und dir deine IVT überschreibt? Also ich glaube nicht, dass das was mit deinem Problem zu tun hat, es ist mehr ne allgemeine Verständnisfrage.
Und den oberen Speicher (also ab 9FFFFh (640k) abwärts) brauchst du doch (noch) eh nicht.
Madness isn't a bug - it's a feature

Azi

  • Beiträge: 47
    • Profil anzeigen
Gespeichert
« Antwort #5 am: 20. November 2005, 02:15 »
@bitmaster:
Was verstehst du sonst nicht? Ich würde es dir gerne erklären:wink:!
Der Teil mit dem push und pop:
Also, erstmal soll ja alles Ausgegeben werden. Aber wenn ich Enter drücke, muss der davor eingegebene Buchstabe zum Auswerten her. Den hab ich auf dem Stack gesichert. Würde ich deine Version nehmen, hätte ich Enter auch noch gesichert.
Die Bochs-Einstellungen hab ich aus der bochs-sampel-Datei im Bochs-Verzeichnis, da hab ich gesagt, dass er meine Diskette zum booten wählen soll und dass er keine Festplatte haben soll.
Edit: Kann man auch Dateien Anhängen? Ist sonst ein bissen viel zum scrollen...
[thaleia.bxrc]

# You may now use double quotes around pathnames, in case
# your pathname includes spaces.

#=======================================================================
# CONFIG_INTERFACE
#
# The configuration interface is a series of menus or dialog boxes that
# allows you to change all the settings that control Bochs's behavior.
# There are two choices of configuration interface: a text mode version
# called "textconfig" and a graphical version called "wx".  The text
# mode version uses stdin/stdout and is always compiled in.  The graphical
# version is only available when you use "--with-wx" on the configure
# command.  If you do not write a config_interface line, Bochs will
# choose a default for you.
#
# NOTE: if you use the "wx" configuration interface, you must also use
# the "wx" display library.
#=======================================================================
#config_interface: textconfig
#config_interface: wx

#=======================================================================
# DISPLAY_LIBRARY
#
# The display library is the code that displays the Bochs VGA screen.  Bochs
# has a selection of about 10 different display library implementations for
# different platforms.  If you run configure with multiple --with-* options,
# the display_library command lets you choose which one you want to run with.
# If you do not write a display_library line, Bochs will choose a default for
# you.
#
# The choices are:
#   x              use X windows interface, cross platform
#   win32          use native win32 libraries
#   carbon         use Carbon library (for MacOS X)
#   beos           use native BeOS libraries
#   macintosh      use MacOS pre-10
#   amigaos        use native AmigaOS libraries
#   sdl            use SDL library, cross platform
#   svga           use SVGALIB library for Linux, allows graphics without X11
#   term           text only, uses curses/ncurses library, cross platform
#   rfb            provides an interface to AT&T's VNC viewer, cross platform
#   wx             use wxWidgets library, cross platform
#   nogui          no display at all
#
# NOTE: if you use the "wx" configuration interface, you must also use
# the "wx" display library.
#
# Specific options:
# Some display libraries now support specific option to control their
# behaviour. See the examples below for currently supported options.
#=======================================================================
#display_library: amigaos
#display_library: beos
#display_library: carbon
#display_library: macintosh
#display_library: nogui
#display_library: rfb, options="timeout=60" # time to wait for client
#display_library: sdl, options="fullscreen" # startup in fullscreen mode
#display_library: term
#display_library: win32, options="legacyF12" # use F12 to toggle mouse
#display_library: wx
#display_library: x

#=======================================================================
# ROMIMAGE:
# You now need to load a ROM BIOS into F0000-FFFFF. Normally, you can
# use a precompiled BIOS in the bios/ directory of the source tree,
# named BIOS-bochs-latest.
# You can also use the environment variable $BXSHARE to specify the
# location of the BIOS.
#=======================================================================
romimage: file=$BXSHARE/BIOS-bochs-latest, address=0xf0000
#romimage: file=bios/BIOS-bochs-2-processors, address=0xf0000
#romimage: file=bios/BIOS-bochs-4-processors, address=0xf0000
#romimage: file=bios/rombios.bin, address=0xf0000

#=======================================================================
# MEGS
# Set the number of Megabytes of physical memory you want to emulate.
# The default is 32MB, most OS's won't need more than that.
# The maximum amount of memory supported is 2048Mb.
#=======================================================================
#megs: 256
#megs: 128
#megs: 64
megs: 32
#megs: 16
#megs: 8

#=======================================================================
# OPTROMIMAGE[1-4]:
# You may now load up to 4 optional ROM images. Be sure to use a
# read-only area, typically between C8000 and EFFFF. These optional
# ROM images should not overwrite the rombios (located at
# F0000-FFFFF) and the videobios (located at C0000-C7FFF).
# Those ROM images will be initialized by the bios if they contain
# the right signature (0x55AA) and a valid checksum.
# It can also be a convenient way to upload some arbitary code/data
# in the simulation, that can be retrieved by the boot loader
#=======================================================================
#optromimage1: file=optionalrom.bin, address=0xd0000
#optromimage2: file=optionalrom.bin, address=0xd1000
#optromimage3: file=optionalrom.bin, address=0xd2000
#optromimage4: file=optionalrom.bin, address=0xd3000

#=======================================================================
# VGAROMIMAGE
# You now need to load a VGA ROM BIOS into C0000.
#=======================================================================
#vgaromimage: file=bios/VGABIOS-elpin-2.40
vgaromimage: file=$BXSHARE/VGABIOS-lgpl-latest
#vgaromimage: file=bios/VGABIOS-lgpl-latest-cirrus

#=======================================================================
# VGA:
# Here you can specify the display extension to be used. With the value
# 'none' you can use standard VGA with no extension. Other supported
# values are 'vbe' for Bochs VBE and 'cirrus' for Cirrus SVGA support.
#=======================================================================
#vga: extension=cirrus
vga: extension=vbe

#=======================================================================
# FLOPPYA:
# Point this to pathname of floppy image file or device
# This should be of a bootable floppy(image/device) if you're
# booting from 'a' (or 'floppy').
#
# You can set the initial status of the media to 'ejected' or 'inserted'.
#   floppya: 2_88=path, status=ejected             (2.88M 3.5" floppy)
#   floppya: 1_44=path, status=inserted            (1.44M 3.5" floppy)
#   floppya: 1_2=path, status=ejected              (1.2M  5.25" floppy)
#   floppya: 720k=path, status=inserted            (720K  3.5" floppy)
#   floppya: 360k=path, status=inserted            (360K  5.25" floppy)
#   floppya: 320k=path, status=inserted            (320K  5.25" floppy)
#   floppya: 180k=path, status=inserted            (180K  5.25" floppy)
#   floppya: 160k=path, status=inserted            (160K  5.25" floppy)
#   floppya: image=path, status=inserted           (guess type from image size)
#
# The path should be the name of a disk image file.  On Unix, you can use a raw
# device name such as /dev/fd0 on Linux.  On win32 platforms, use drive letters
# such as a: or b: as the path.  The parameter 'image' works with image files
# only. In that case the size must match one of the supported types.
#=======================================================================
#floppya: 1_44=/dev/fd0, status=inserted
#floppya: image=../1.44, status=inserted
#floppya: 1_44=/dev/fd0H1440, status=inserted
#floppya: 1_2=../1_2, status=inserted
floppya: 1_44=a:, status=inserted
#floppya: 1_44=a.img, status=inserted
#floppya: 1_44=/dev/rfd0a, status=inserted

#=======================================================================
# FLOPPYB:
# See FLOPPYA above for syntax
#=======================================================================
#floppyb: 1_44=b:, status=inserted
#floppyb: 1_44=b.img, status=inserted

#=======================================================================
# ATA0, ATA1, ATA2, ATA3
# ATA controller for hard disks and cdroms
#
# ata[0-3]: enabled=[0|1], ioaddr1=addr, ioaddr2=addr, irq=number
#
# These options enables up to 4 ata channels. For each channel
# the two base io addresses and the irq must be specified.
#
# ata0 is enabled by default, with ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14
#
# Examples:
#   ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14
#   ata1: enabled=1, ioaddr1=0x170, ioaddr2=0x370, irq=15
#   ata2: enabled=1, ioaddr1=0x1e8, ioaddr2=0x3e0, irq=11
#   ata3: enabled=1, ioaddr1=0x168, ioaddr2=0x360, irq=9
#=======================================================================
ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14
ata1: enabled=0, ioaddr1=0x170, ioaddr2=0x370, irq=15
ata2: enabled=0, ioaddr1=0x1e8, ioaddr2=0x3e0, irq=11
ata3: enabled=0, ioaddr1=0x168, ioaddr2=0x360, irq=9

#=======================================================================
# ATA[0-3]-MASTER, ATA[0-3]-SLAVE
#
# This defines the type and characteristics of all attached ata devices:
#   type=       type of attached device [disk|cdrom]
#   mode=       only valid for disks [flat|concat|external|dll|sparse|vmware3]
#   mode=       only valid for disks [undoable|growing|volatile]
#   path=       path of the image
#   cylinders=  only valid for disks
#   heads=      only valid for disks
#   spt=        only valid for disks
#   status=     only valid for cdroms [inserted|ejected]
#   biosdetect= type of biosdetection [none|auto], only for disks on ata0 [cmos]
#   translation=type of transation of the bios, only for disks [none|lba|large|rechs|auto]
#   model=      string returned by identify device command
#   journal=    optional filename of the redolog for undoable and volatile disks
#  
# Point this at a hard disk image file, cdrom iso file, or physical cdrom
# device.  To create a hard disk image, try running bximage.  It will help you
# choose the size and then suggest a line that works with it.
#
# In UNIX it may be possible to use a raw device as a Bochs hard disk,
# but WE DON'T RECOMMEND IT.  In Windows there is no easy way.
#
# In windows, the drive letter + colon notation should be used for cdroms.
# Depending on versions of windows and drivers, you may only be able to
# access the "first" cdrom in the system.  On MacOSX, use path="drive"
# to access the physical drive.
#
# The path, cylinders, heads, and spt are mandatory for type=disk
# The path is mandatory for type=cdrom
#
# Default values are:
#   mode=flat, biosdetect=auto, translation=auto, model="Generic 1234"
#
# The biosdetect option has currently no effect on the bios
#
# Examples:
#   ata0-master: type=disk, mode=flat, path=10M.sample, cylinders=306, heads=4, spt=17
#   ata0-slave:  type=disk, mode=flat, path=20M.sample, cylinders=615, heads=4, spt=17
#   ata1-master: type=disk, mode=flat, path=30M.sample, cylinders=615, heads=6, spt=17
#   ata1-slave:  type=disk, mode=flat, path=46M.sample, cylinders=940, heads=6, spt=17
#   ata2-master: type=disk, mode=flat, path=62M.sample, cylinders=940, heads=8, spt=17
#   ata2-slave:  type=disk, mode=flat, path=112M.sample, cylinders=900, heads=15, spt=17
#   ata3-master: type=disk, mode=flat, path=483M.sample, cylinders=1024, heads=15, spt=63
#   ata3-slave:  type=cdrom, path=iso.sample, status=inserted
#=======================================================================
#ata0-master: type=disk, mode=flat, path="30M.sample", cylinders=615, heads=6, spt=17
#ata0-slave: type=cdrom, path=D:, status=inserted
#ata0-slave: type=cdrom, path=/dev/cdrom, status=inserted
#ata0-slave: type=cdrom, path="drive", status=inserted
#ata0-slave: type=cdrom, path=/dev/rcd0d, status=inserted

#=======================================================================
# BOOT:
# This defines the boot sequence. Now you can specify up to 3 boot drives.
# You can either boot from 'floppy', 'disk' or 'cdrom'
# legacy 'a' and 'c' are also supported
# Examples:
#   boot: floppy
#   boot: disk
#   boot: cdrom
#   boot: c
#   boot: a
#   boot: cdrom, floppy, disk
#=======================================================================
boot: floppy
#boot: disk

#=======================================================================
# IPS:
# Emulated Instructions Per Second.  This is the number of IPS that bochs
# is capable of running on your machine.  Read the note in config.h
# on how to find this.  Make sure to recompile after.
#
# IPS is used to calibrate many time-dependent events within the bochs
# simulation.  For example, changing IPS affects the frequency of VGA
# updates, the duration of time before a key starts to autorepeat, and
# the measurement of BogoMips and other benchmarks.
#
# Examples:
# Machine                                         Mips
# ________________________________________________________________
# 1.6Ghz Intel P4 with Win2000/g++ 3.3            5 to 7 Mips
# 650Mhz Athlon K-7 with Linux 2.4.4/egcs-2.91.66 2 to 2.5 Mips
# 400Mhz Pentium II with Linux 2.0.36/egcs-1.0.3  1 to 1.8 Mips
# 166Mhz 64bit Sparc with Solaris 2.x             approx 0.75 Mips
# 200Mhz Pentium with Linux 2.x                   approx 0.5 Mips
#
#=======================================================================
ips: 10000000

#=======================================================================
# CLOCK:
# This defines the parameters of the clock inside Bochs:
#
#  SYNC:
#  TO BE COMPLETED (see Greg explaination in bug #536329)
#
#  TIME0:
#  Specifies the start (boot) time of the virtual machine. Use a time
#  value as returned by the time(2) system call. If no time0 value is
#  set or if time0 equal to 1 (special case) or if time0 equal 'local',
#  the simulation will be started at the current local host time.
#  If time0 equal to 2 (special case) or if time0 equal 'utc',
#  the simulation will be started at the current utc time.
#
# Syntax:
#  clock: sync=[none|slowdown|realtime], time0=[timeValue|local|utc]
#
# Example:
#   clock: sync=none,     time0=local       # Now (localtime)
#   clock: sync=slowdown, time0=315529200   # Tue Jan  1 00:00:00 1980
#   clock: sync=none,     time0=631148400   # Mon Jan  1 00:00:00 1990
#   clock: sync=realtime, time0=938581955   # Wed Sep 29 07:12:35 1999
#   clock: sync=realtime, time0=946681200   # Sat Jan  1 00:00:00 2000
#   clock: sync=none,     time0=1           # Now (localtime)
#   clock: sync=none,     time0=utc         # Now (utc/gmt)
#
# Default value are sync=none, time0=local
#=======================================================================
#clock: sync=none, time0=local


#=======================================================================
# FLOPPY_BOOTSIG_CHECK: disabled=[0|1]
# Enables or disables the 0xaa55 signature check on boot floppies
# Defaults to disabled=0
# Examples:
#   floppy_bootsig_check: disabled=0
#   floppy_bootsig_check: disabled=1
#=======================================================================
#floppy_bootsig_check: disabled=1
floppy_bootsig_check: disabled=0

#=======================================================================
# LOG:
# Give the path of the log file you'd like Bochs debug and misc. verbage
# to be written to. If you don't use this option or set the filename to
# '-' the output is written to the console. If you really don't want it,
# make it "/dev/null" (Unix) or "nul" (win32). :^(
#
# Examples:
#   log: ./bochs.out
#   log: /dev/tty
#=======================================================================
#log: /dev/null
log: bochsout.txt

#=======================================================================
# LOGPREFIX:
# This handles the format of the string prepended to each log line.
# You may use those special tokens :
#   %t : 11 decimal digits timer tick
#   %i : 8 hexadecimal digits of cpu0 current eip
#   %e : 1 character event type ('i'nfo, 'd'ebug, 'p'anic, 'e'rror)
#   %d : 5 characters string of the device, between brackets
#
# Default : %t%e%d
# Examples:
#   logprefix: %t-%e-@%i-%d
#   logprefix: %i%e%d
#=======================================================================
#logprefix: %t%e%d

#=======================================================================
# LOG CONTROLS
#
# Bochs now has four severity levels for event logging.
#   panic: cannot proceed.  If you choose to continue after a panic,
#          don't be surprised if you get strange behavior or crashes.
#   error: something went wrong, but it is probably safe to continue the
#          simulation.
#   info: interesting or useful messages.
#   debug: messages useful only when debugging the code.  This may
#          spit out thousands per second.
#
# For events of each level, you can choose to crash, report, or ignore.
# TODO: allow choice based on the facility: e.g. crash on panics from
#       everything except the cdrom, and only report those.
#
# If you are experiencing many panics, it can be helpful to change
# the panic action to report instead of fatal.  However, be aware
# that anything executed after a panic is uncharted territory and can
# cause bochs to become unstable.  The panic is a "graceful exit," so
# if you disable it you may get a spectacular disaster instead.
#=======================================================================
panic: action=ask
error: action=report
info: action=report
debug: action=ignore
#pass: action=fatal

#=======================================================================
# DEBUGGER_LOG:
# Give the path of the log file you'd like Bochs to log debugger output.
# If you really don't want it, make it /dev/null or '-'. :^(
#
# Examples:
#   debugger_log: ./debugger.out
#=======================================================================
#debugger_log: /dev/null
#debugger_log: debugger.out
debugger_log: -

#=======================================================================
# COM1, COM2, COM3, COM4:
# This defines a serial port (UART type 16550A). In the 'term' you can specify
# a device to use as com1. This can be a real serial line, or a pty.  To use
# a pty (under X/Unix), create two windows (xterms, usually).  One of them will
# run bochs, and the other will act as com1. Find out the tty the com1
# window using the `tty' command, and use that as the `dev' parameter.
# Then do `sleep 1000000' in the com1 window to keep the shell from
# messing with things, and run bochs in the other window.  Serial I/O to
# com1 (port 0x3f8) will all go to the other window.
# Other serial modes are 'null' (no input/output), 'file' (output to a file
# specified as the 'dev' parameter), 'raw' (use the real serial port - under
# construction for win32) and 'mouse' (standard serial mouse - requires
# mouse option setting 'type=serial' or 'type=serial_wheel')
#
# Examples:
#   com1: enabled=1, mode=null
#   com1: enabled=1, mode=mouse
#   com2: enabled=1, mode=file, dev=serial.out
#   com3: enabled=1, mode=raw, dev=com1
#=======================================================================
#com1: enabled=1, mode=term, dev=/dev/ttyp9


#=======================================================================
# PARPORT1, PARPORT2:
# This defines a parallel (printer) port. When turned on and an output file is
# defined the emulated printer port sends characters printed by the guest OS
# into the output file. On some platforms a device filename can be used to
# send the data to the real parallel port (e.g. "/dev/lp0" on Linux, "lpt1" on
# win32 platforms).
#
# Examples:
#   parport1: enabled=1, file="parport.out"
#   parport2: enabled=1, file="/dev/lp0"
#   parport1: enabled=0
#=======================================================================
parport1: enabled=1, file="parport.out"

#=======================================================================
# SB16:
# This defines the SB16 sound emulation. It can have several of the
# following properties.
# All properties are in the format sb16: property=value
# midi: The filename is where the midi data is sent. This can be a
#       device or just a file if you want to record the midi data.
# midimode:
#      0=no data
#      1=output to device (system dependent. midi denotes the device driver)
#      2=SMF file output, including headers
#      3=output the midi data stream to the file (no midi headers and no
#        delta times, just command and data bytes)
# wave: This is the device/file where wave output is stored
# wavemode:
#      0=no data
#      1=output to device (system dependent. wave denotes the device driver)
#      2=VOC file output, incl. headers
#      3=output the raw wave stream to the file
# log:  The file to write the sb16 emulator messages to.
# loglevel:
#      0=no log
#      1=only midi program and bank changes
#      2=severe errors
#      3=all errors
#      4=all errors plus all port accesses
#      5=all errors and port accesses plus a lot of extra info
# dmatimer:
#      microseconds per second for a DMA cycle.  Make it smaller to fix
#      non-continous sound.  750000 is usually a good value.  This needs a
#      reasonably correct setting for IPS.
#
# For an example look at the next line:
#=======================================================================

#sb16: midimode=1, midi=/dev/midi00, wavemode=1, wave=/dev/dsp, loglevel=2, log=sb16.log, dmatimer=600000

#=======================================================================
# VGA_UPDATE_INTERVAL:
# Video memory is scanned for updates and screen updated every so many
# virtual seconds.  The default is 300000, about 3Hz.  This is generally
# plenty.  Keep in mind that you must tweak the 'ips:' directive
# to be as close to the number of emulated instructions-per-second
# your workstation can do, for this to be accurate.
#
# Examples:
#   vga_update_interval: 250000
#=======================================================================
vga_update_interval: 300000

# using for Winstone '98 tests
#vga_update_interval:  100000

#=======================================================================
# KEYBOARD_SERIAL_DELAY:
# Approximate time in microseconds that it takes one character to
# be transfered from the keyboard to controller over the serial path.
# Examples:
#   keyboard_serial_delay: 200
#=======================================================================
keyboard_serial_delay: 250

#=======================================================================
# KEYBOARD_PASTE_DELAY:
# Approximate time in microseconds between attempts to paste
# characters to the keyboard controller. This leaves time for the
# guest os to deal with the flow of characters.  The ideal setting
# depends on how your operating system processes characters.  The
# default of 100000 usec (.1 seconds) was chosen because it works
# consistently in Windows.
#
# If your OS is losing characters during a paste, increase the paste
# delay until it stops losing characters.
#
# Examples:
#   keyboard_paste_delay: 100000
#=======================================================================
keyboard_paste_delay: 100000

#=======================================================================
# FLOPPY_COMMAND_DELAY:
# Time in microseconds to wait before completing some floppy commands
# such as read/write/seek/etc, which normally have a delay associated.
# I had this hardwired to 50,000 before.
#
# Examples:
#   floppy_command_delay: 50000
#=======================================================================
floppy_command_delay: 500

#=======================================================================
# MOUSE:
# This option prevents Bochs from creating mouse "events" unless a mouse
# is  enabled. The hardware emulation itself is not disabled by this.
# You can turn the mouse on by setting enabled to 1, or turn it off by
# setting enabled to 0. Unless you have a particular reason for enabling
# the mouse by default, it is recommended that you leave it off.
# You can also toggle the mouse usage at runtime (control key + middle
# mouse button on X11, SDL, wxWidgets and Win32).
# With the mouse type option you can select the type of mouse to emulate.
# The default value is 'ps2'. The other choices are 'imps2' (wheel mouse
# on PS/2), 'serial', 'serial_wheel' (one com port requires setting
# 'mode=mouse') and 'usb' (3-button mouse - one of the USB ports must be
# connected with the 'mouse' device - requires PCI and USB support).
#
# Examples:
#   mouse: enabled=1
#   mouse: enabled=1, type=imps2
#   mouse: enabled=1, type=serial
#   mouse: enabled=0
#=======================================================================
mouse: enabled=0

#=======================================================================
# private_colormap: Request that the GUI create and use it's own
#                   non-shared colormap.  This colormap will be used
#                   when in the bochs window.  If not enabled, a
#                   shared colormap scheme may be used.  Not implemented
#                   on all GUI's.
#
# Examples:
#   private_colormap: enabled=1
#   private_colormap: enabled=0
#=======================================================================
private_colormap: enabled=0

#=======================================================================
# fullscreen: ONLY IMPLEMENTED ON AMIGA
#             Request that Bochs occupy the entire screen instead of a
#             window.
#
# Examples:
#   fullscreen: enabled=0
#   fullscreen: enabled=1
#=======================================================================
#fullscreen: enabled=0
#screenmode: name="sample"

#=======================================================================
# ne2k: NE2000 compatible ethernet adapter
#
# Examples:
# ne2k: ioaddr=IOADDR, irq=IRQ, mac=MACADDR, ethmod=MODULE, ethdev=DEVICE, script=SCRIPT
#
# ioaddr, irq: You probably won't need to change ioaddr and irq, unless there
# are IRQ conflicts.
#
# mac: The MAC address MUST NOT match the address of any machine on the net.
# Also, the first byte must be an even number (bit 0 set means a multicast
# address), and you cannot use ff:ff:ff:ff:ff:ff because that's the broadcast
# address.  For the ethertap module, you must use fe:fd:00:00:00:01.  There may
# be other restrictions too.  To be safe, just use the b0:c4... address.
#
# ethdev: The ethdev value is the name of the network interface on your host
# platform.  On UNIX machines, you can get the name by running ifconfig.  On
# Windows machines, you must run niclist to get the name of the ethdev.
# Niclist source code is in misc/niclist.c and it is included in Windows
# binary releases.
#
# script: The script value is optionnal, and is the name of a script that
# is executed after bochs initialize the network interface. You can use
# this script to configure this network interface, or enable masquerading.
# This is mainly useful for the tun/tap devices that only exist during
# Bochs execution. The network interface name is supplied to the script
# as first parameter
#
# If you don't want to make connections to any physical networks,
# you can use the following 'ethmod's to simulate a virtual network.
#   null: All packets are discarded, but logged to a few files.
#   arpback: ARP is simulated. Disabled by default.
#   vnet: ARP, ICMP-echo(ping), DHCP and read/write TFTP are simulated.
#         The virtual host uses 192.168.10.1.
#         DHCP assignes 192.168.10.2 to the guest.
#         TFTP uses the ethdev value for the root directory and doesn't
#         overwrite files.
#
#=======================================================================
# ne2k: ioaddr=0x240, irq=9, mac=fe:fd:00:00:00:01, ethmod=fbsd, ethdev=en0 #macosx
# ne2k: ioaddr=0x240, irq=9, mac=b0:c4:20:00:00:00, ethmod=fbsd, ethdev=xl0
# ne2k: ioaddr=0x240, irq=9, mac=b0:c4:20:00:00:00, ethmod=linux, ethdev=eth0
# ne2k: ioaddr=0x240, irq=9, mac=b0:c4:20:00:00:01, ethmod=win32, ethdev=MYCARD
# ne2k: ioaddr=0x240, irq=9, mac=fe:fd:00:00:00:01, ethmod=tap, ethdev=tap0
# ne2k: ioaddr=0x240, irq=9, mac=fe:fd:00:00:00:01, ethmod=tuntap, ethdev=/dev/net/tun0, script=./tunconfig
# ne2k: ioaddr=0x240, irq=9, mac=b0:c4:20:00:00:01, ethmod=null, ethdev=eth0
# ne2k: ioaddr=0x240, irq=9, mac=b0:c4:20:00:00:01, ethmod=vnet, ethdev="c:/temp"

#=======================================================================
# KEYBOARD_MAPPING:
# This enables a remap of a physical localized keyboard to a
# virtualized us keyboard, as the PC architecture expects.
# If enabled, the keymap file must be specified.
#
# Examples:
#   keyboard_mapping: enabled=1, map=gui/keymaps/x11-pc-de.map
#=======================================================================
keyboard_mapping: enabled=0, map=

#=======================================================================
# KEYBOARD_TYPE:
# Type of keyboard return by a "identify keyboard" command to the
# keyboard controler. It must be one of "xt", "at" or "mf".
# Defaults to "mf". It should be ok for almost everybody. A known
# exception is french macs, that do have a "at"-like keyboard.
#
# Examples:
#   keyboard_type: mf
#=======================================================================
#keyboard_type: mf

#=======================================================================
# USER_SHORTCUT:
# This defines the keyboard shortcut to be sent when you press the "user"
# button in the headerbar. The shortcut string can be a combination of
# these key names: "alt", "bksp", "ctrl", "del", "esc", "f1", "f4", "tab"
# and "win". Up to 3 keys can be pressed at a time.
#
# Example:
#   user_shortcut: keys=ctrlaltdel
#=======================================================================
#user_shortcut: keys=ctrlaltdel

#=======================================================================
# I440FXSUPPORT:
# This option controls the presence of the i440FX PCI chipset. You can
# also specify the devices connected to PCI slots. Up to 5 slots are
# available now. These devices are currently supported: ne2k, pcivga,
# pcidev and pcipnic. If Bochs is compiled with Cirrus SVGA support
# you'll have the additional choice 'cirrus'.
#
# Example:
#   i440fxsupport: enabled=1, slot1=pcivga, slot2=ne2k
#=======================================================================
#i440fxsupport: enabled=1

#=======================================================================
# USB1:
# This option controls the presence of the USB root hub which is a part
# of the i440FX PCI chipset. With the portX option you can connect devices
# to the hub (currently supported: 'mouse' and 'keypad'). If you connect
# the mouse to one of the ports and use the mouse option 'type=usb' you'll
# have a 3-button USB mouse.
#
# Example:
#   usb1: enabled=1, ioaddr=0xFF80, port1=mouse, port2=keypad
#=======================================================================
#usb1: enabled=1, ioaddr=0xFF80

#=======================================================================
# other stuff
#=======================================================================
#magic_break: enabled=1
#cmosimage: cmos.img
#load32bitOSImage: os=nullkernel, path=../kernel.img, iolog=../vga_io.log
#load32bitOSImage: os=linux, path=../linux.img, iolog=../vga_io.log, initrd=../initrd.img
#text_snapshot_check: enable

#-------------------------
# PCI host device mapping
#-------------------------
#pcidev: vendor=0x1234, device=0x5678

#=======================================================================
# GDBSTUB:
# Enable GDB stub. See user documentation for details.
# Default value is enabled=0.
#=======================================================================
#gdbstub: enabled=0, port=1234, text_base=0, data_base=0, bss_base=0

#=======================================================================
# for Macintosh, use the style of pathnames in the following
# examples.
#
# vgaromimage: :bios:VGABIOS-elpin-2.40
# romimage: file=:bios:BIOS-bochs-latest, address=0xf0000
# floppya: 1_44=[fd:], status=inserted
#=======================================================================


#=======================================================================
#
# The following directives are DEPRECATED
# Please convert them to the new syntax  or remove them
#
#=======================================================================

#=======================================================================
#
# The TIME0 directive is DEPRECATED. Use the CLOCK directive instead
#
# TIME0:
# Specifies the start (boot) time of the virtual machine. Use a time
# value as returned by the time(2) system call. If no time0 value is
# set or if time0 equal to 1 (special case), the simulation will be
# started at the current time of the host.
#
# Examples:
#   time0: 1           # Now
#   time0: 315529200   # Tue Jan  1 00:00:00 1980
#   time0: 631148400   # Mon Jan  1 00:00:00 1990
#   time0: 938581955   # Wed Sep 29 07:12:35 1999
#   time0: 946681200   # Sat Jan  1 00:00:00 2000
#=======================================================================
#time0: 938581955

#=======================================================================
#
# The PIT directive is DEPRECATED. Use the CLOCK directive instead
#
# PIT:
# The PIT is the programmable interval timer.  It has an option that tries to
# keep the PIT in sync with real time.  This feature is still experimental,
# but it may be useful if you want to prevent Bochs from running too fast, for
# example a DOS video game.  Be aware that with the realtime pit option, your
# simulation will not be repeatable; this can a problem if you are debugging.
#=======================================================================
#pit: realtime=1




@n3Ro:
Hab die neuste Version von Bochs.

Was ich auch noch sagen könnte: Die Meldung kommt, bevor der Kernel geladen wurde ('Kernel wird geladen...' ist die letzte Mitteilung)
So, hier der neue Code, der immernoch nicht funktioniert:
[boot.asm]

;06.11.2005 21:56: Erster Code
;09.11.2005 21:50: Code, der funktioniert
;11.11.2005 21:54: Code, der Kernel laden kann

;---------------------------------------------------------------------------Code

;----------Adresse korregieren
org 07C00h

;----------Daten- und Stapelsegment erzeugen
cli
xor ax, ax
mov ds, ax
mov ax,0100h
mov ss,ax
mov sp,06C00h
sti

;----------Bootlaufwerk speichern
mov [boot],dl

;----------Unsere ersten Ausgaben
mov si,text_boot
call sag
mov si,text_loadkernel
call sag

;----------Laufwerk wird zurückgesetzt
mov ah,00h
mov dl,[boot]
int 013h

;----------Adresse für die Daten zum Einlesen wird gesetzt
mov ax,01000h
mov es,ax
mov bx,00h

;----------Lese Sektoren in den Speicher
mov ah,02h
mov al,02h     ;Anzahl der Sektoren, bei steigender Kernelgröße erhöhen!
mov ch,00h
mov cl,02h
mov dh,00h
mov dl,00h
int 013h

;----------Bereite den Sprung zu den ein gelesenen Daten vor
mov ax,01000h
mov ds,ax
mov es,ax
push ax
mov ax,00h
push ax

;----------DER ALLES ENTSCHEIDENE MOMENT: DER KERNEL WIRD GESTARTET
retf

;----------Wenn er irgendwie nix gemacht hat
call reboot

;---------------------------------------------------------------------------Daten

boot db 0
text_boot db "Bootloader wurde geladen",13,10,0
text_loadkernel db "Kernel wird geladen...",13,10,0



;---------------------------------------------------------------------------Funktionen

;----------sag
sag:
lodsb
or al,al
jz endesag
mov ah,0Eh
mov bx,07h
int 010h
jmp sag

endesag:
ret

;----------Reboot
reboot:
db 0EAh
dw 0000h
dw 0FFFFh
ret

;---------------------------------------------------------------------------Boot-Erlaubnis

;----------Dateigröße
times 512-($-$$)-2 db 0

;----------Bootsignatur
dw 0AA55h

[kernel2.asm]

;11.11.2005 22:54: Erster Boot mit dem Kernel

;---------------------------------------------------------------------------Code

;----------Unsere ersten Ausgaben
mov si,text_load
call sag
mov si,text_leer
call sag
mov si,text_leer
call sag
mov si,text_leer
call sag
mov si,text_os
call sag
mov si,text_copyright
call sag
mov si,text_reboot
call sag
mov si,text_shutdown
call sag

;----------Auswahl
auswahl:
push 00h
mov si,text_eingabe
call sag
nocheinzeichen:
call anykey
cmp al,0Dh
je eingabetaste
pop ax
push ax
call zeig
jmp nocheinzeichen

;----------Enter
eingabetaste:
pop ax
cmp al,072h
je auswahl_reboot
cmp al,073h
je auswahl_shutdown
ret

;----------Neu starten
auswahl_reboot:
call reboot

;----------Shutdown
auswahl_shutdown:
call shutdown

;---------------------------------------------------------------------------Daten

text_leer db "",13,10,0
text_load db "Kernel wurde geladen",13,10,0
text_os db "AquanaSoft OS Codename 'Thaleia'",13,10,0
text_copyright db "Copyright 2005 Alexander S. Azim",13,10,0
text_reboot db "Dr?cken Sie 'R', um den Computer neu zu starten",13,10,0
text_shutdown db "Dr?cken Sie 'S', um den Computer auszuschalten",13,10,0
text_eingabe db "Eingabe: "

;---------------------------------------------------------------------------Funktionen

;----------sag
sag:
lodsb
or al,al
jz endesag
call zeig
jmp sag

endesag:
ret

;----------zeig
zeig:
mov ah,0Eh
mov bx,07h
int 010h
ret

;----------anykey
anykey:
mov ah,0
int 16h
ret

;----------Reboot
reboot:
db 0EAh
dw 0000h
dw 0FFFFh
ret

;----------Shutdown
shutdown:
mov ax,5301h ;Aktiviere RealMode APM Interface
xor bx,bx
int 15h

mov ax,530eh ;Waehle APM Version
xor bx,bx
mov cx,0102h ;v1.2
int 15h

mov ax,530fh ;Aktiviere APM fuer alle Geraete
mov bx,0001h ;ID 1=Alle Geraete
mov cx,0001h ;1=engage
int 15h

mov ax,5308h ;Aktiviere automatisches APM fuer alle Geraete
mov bx,0001h ;ID 1=Alle Geraete
mov cx,0001h ;1=enable
int 15h

mov ax,5307h ;Setze Geraetezustand
mov bx,0001h ;ID 1=Alle Geraete
mov cx,0003h ;Status 3=Ausgeschaltet
int 15h
ret

;----------Dateigröße anpassen, um genau in die Sektoren zu passen
times 1024-($-$$) db 0

Es gibt 10 Sorten von Menschen: Die einen können binär zählen, die anderen nicht.

Der Vorteil der Klugheit liegt darin, dass man sich dumm stellen kann. Das Gegenteil ist schon schwieriger.

bitmaster

  • Troll
  • Beiträge: 1 138
    • Profil anzeigen
    • OS-64 = 64 Bit Operating System
Gespeichert
« Antwort #6 am: 20. November 2005, 07:51 »
Ach, so. Ja dein Code ist so schlecht das ich da gar nicht mehr durchblicke. Stand dort vorher schon push 00h? Also ich würde in diesem Fall auch nicht den langsamen Stack nehmen, da du ja noch ein paar schnelle Register frei hast. Nehme z.B. dx. So würde es dann aussehen:

auswahl:
xor dl,dl ;auf Null
mov si,text_eingabe
call sag
nocheinzeichen:
call anykey
cmp al,0Dh
je eingabetaste
mov dl,al
call zeig
jmp nocheinzeichen

;----------Enter
eingabetaste:
cmp dl,072h
je auswahl_reboot
cmp dl,073h
je auswahl_shutdown
ret ;was soll das bewirken?

;----------Neu starten
auswahl_reboot:
call reboot

;----------Shutdown
auswahl_shutdown:
call shutdown


Das müsste funktionieren, wenn ich alles verstanden habe was dein Code bewierken soll. Eventuell kannst du auch noch eine Fehlermeldung ausgeben, wenn keiner der erwünschten Tasten gedrückt wurde. Das mit dem Bochs habe ich mir jetzt nicht durchgelesen, aber hier mal mein Code den ich in Bochs verwende:

megs: 32
romimage: file=D:\Program\Bochs-2.2.1\BIOS-bochs-latest, address=0xf0000
vgaromimage: file=D:\Program\Bochs-2.2.1\VGABIOS-elpin-2.40
floppya: image=C:\Dokume~1\KlausS~1\Desktop\test.img, status=inserted
boot: a
log: D:\Program\Bochs-2.2.1\protokoll.log
mouse: enabled=1, type=imps2
debugger_log: D:\Program\Bochs-2.2.1\debug.log
debugger_log: -
panic: action=ask
error: action=report
info: action=report
debug: action=ignore


D:\Program\Bochs-2.2.1 musst du natürlich in deinem Bochs Installationsverzeichnis umändern. C:\Dokume~1\KlausS~1\Desktop\test.img musst du so ändern das es auf deine Imagedatei zeigt. Kannst aber auch eine Diskette benutzen. Falls das auch nicht funktioniert, lade dir eine neue Bochs Version herrunter. Vielleicht hat deine noch einen Bug, wie jemand hier schon andeutete. Also viel Spaß dann noch beim Proggen.
In the Future everyone will need OS-64!!!

Azi

  • Beiträge: 47
    • Profil anzeigen
Gespeichert
« Antwort #7 am: 20. November 2005, 12:07 »
Mist, es lag an meiner Diskette...

Zitat
Ach, so. Ja dein Code ist so schlecht das ich da gar nicht mehr durchblicke.

Was ist so schlecht? Der Aufbau? Zu wenige Kommentare? Zu viel Nutzloses? Zu chaotisch? Zu unübersichtlich? Ich dachte, ich hätte es so geschrieben, dass jeder den Code versteht :cry: ...

Es gibt 10 Sorten von Menschen: Die einen können binär zählen, die anderen nicht.

Der Vorteil der Klugheit liegt darin, dass man sich dumm stellen kann. Das Gegenteil ist schon schwieriger.

bitmaster

  • Troll
  • Beiträge: 1 138
    • Profil anzeigen
    • OS-64 = 64 Bit Operating System
Gespeichert
« Antwort #8 am: 20. November 2005, 12:34 »
Zu viel Nutzloses. Ich verstehe nicht warum du z.B. push und pop verwendest, wenn du doch noch Register hast. Und warum push 00h, pop ax, push ax dann ist ax immer Null, egal was du machst. Und dann prüfst du ob al gleich 72h oder 73h ist, was nie der Fall sein wird da ax und somit auch al immer gleich Null ist. Also rufst du ein ret auf. Und was bewirkt dieses ret? Du hast doch dann gar nichts mehr auf dem Stack. Der Code funktioniert auch nicht. Hier hast du wohl eine Null vergessen nicht wahr. ;)

text_eingabe db "Eingabe: "

Also verwende lieber Register, die sind viel schneller (auch wenn man das nicht merkt). Und das mit dem ret musst du wirklich ändern. Und das ax immer Null bleibt ist doch auch falsch. Was genau willst du eigentlich? Wenn jemand s drückt das der PC herunterfährt und wenn jemand ein r drückt das er neu startet? Und was ist wenn jemand aus Versehen ein a oder so drückt? Also ich blick bei deinem Code nicht mehr durch.
In the Future everyone will need OS-64!!!

Azi

  • Beiträge: 47
    • Profil anzeigen
Gespeichert
« Antwort #9 am: 20. November 2005, 12:47 »
Dann stelle ich dir mal die Verbesserte Version vor:

;11.11.2005 22:54: Erster Boot mit dem Kernel

;---------------------------------------------------------------------------Code

;----------Unsere ersten Ausgaben
mov si,text_load
call sag
mov si,text_leer
call sag
mov si,text_leer
call sag
mov si,text_leer
call sag
mov si,text_os
call sag
mov si,text_copyright
call sag
mov si,text_leer
call sag
mov si,text_reboot
call sag
mov si,text_shutdown
call sag

;----------Auswahl
auswahl:
mov si,text_leer
call sag
xor dl,dl                ;dl=0
mov si,text_eingabe
call sag
nocheinzeichen:
call anykey              ;warte auf Tastatureingabe
cmp al,0Dh               ;wenn ENTER...
je eingabetaste          ;...springe zur Auswertung
mov dl,al                ;Sichere Zeichen für die Auswertung nach dl
call zeig
jmp nocheinzeichen

;----------Enter
eingabetaste:
cmp dl,072h              ;Wenn ein 'R' eingegeben wurde...
je auswahl_reboot        ;...Reboote
cmp dl,073h              ;Wenn ein 'S' eingegeben wurde...
je auswahl_shutdown      ;...Schalte ab
jmp auswahl              ;Wenn keines von beiden eingegeben wurde springe zurück zur Auswahl

;----------Neu starten
auswahl_reboot:
call reboot

;----------Shutdown
auswahl_shutdown:
call shutdown
;----------Falls nicht unterstützt
mov si,text_leer
call sag
mov si,text_leer
call sag
mov si,text_leer
call sag
mov si,text_off
call sag
endlos:
jmp endlos

;---------------------------------------------------------------------------Daten

text_leer db "",13,10,0
text_load db "Kernel wurde geladen",13,10,0
text_os db "AquanaSoft OS Codename 'Thaleia'",13,10,0
text_copyright db "Copyright 2005 Alexander S. Azim",13,10,0
text_reboot db "Dr?cken Sie 'R', um den Computer neu zu starten",13,10,0
text_shutdown db "Dr?cken Sie 'S', um den Computer auszuschalten",13,10,0
text_eingabe db "Eingabe: ",0
text_off db "Sie k”nnen den Computer jetzt ausschalten.",13,10,0

;---------------------------------------------------------------------------Funktionen

;----------sag
sag:
lodsb
or al,al
jz endesag
call zeig
jmp sag

endesag:
ret

;----------zeig
zeig:
mov ah,0Eh
mov bx,07h
int 010h
ret

;----------anykey
anykey:
mov ah,0
int 16h
ret

;----------Reboot
reboot:
db 0EAh
dw 0000h
dw 0FFFFh
ret

;----------Shutdown
shutdown:
mov ax,5301h ;Aktiviere RealMode APM Interface
xor bx,bx
int 15h

mov ax,530eh ;Waehle APM Version
xor bx,bx
mov cx,0102h ;v1.2
int 15h

mov ax,530fh ;Aktiviere APM fuer alle Geraete
mov bx,0001h ;ID 1=Alle Geraete
mov cx,0001h ;1=engage
int 15h

mov ax,5308h ;Aktiviere automatisches APM fuer alle Geraete
mov bx,0001h ;ID 1=Alle Geraete
mov cx,0001h ;1=enable
int 15h

mov ax,5307h ;Setze Geraetezustand
mov bx,0001h ;ID 1=Alle Geraete
mov cx,0003h ;Status 3=Ausgeschaltet
int 15h
ret

;----------Dateigröße anpassen, um genau in die Sektoren zu passen
times 1024-($-$$) db 0



Also, bei mir klappt es.
Ich wusste garnicht, dass Register schneller sind, ich habe mit Assembler frisch angefangen. Das ret war wirklich falsch an der Stelle, ich hatte nämlich den Eingabe-Teil als Funktion gehabt und in per call aufgerufen, aber am Ende doch noch oben in den Code gepackt. Den hab ich einfach verschoben, das ret habe ich vergessen...
Den push 00h pop ax-Teil ist nur am Anfang so, da sonst eitwas gepopt wird, obwohl der stack leer ist.

push 00h ;<---------------
mov si,text_eingabe
call sag
nocheinzeichen:
call anykey
cmp al,0Dh
je eingabetaste
pop ax ;<---------------
push ax ;<---------------


Somit ist ax auch nicht null, wegen anykey.
'text_eingabe db "Eingabe: "' Stimmt, hatte ich aber beim ersten Test auf einer anderen Diskette scho gemerkt und korregiert :wink: .
Wenn jemand 'a' drückt, wird nochmal abgefragt.

Es gibt 10 Sorten von Menschen: Die einen können binär zählen, die anderen nicht.

Der Vorteil der Klugheit liegt darin, dass man sich dumm stellen kann. Das Gegenteil ist schon schwieriger.

bitmaster

  • Troll
  • Beiträge: 1 138
    • Profil anzeigen
    • OS-64 = 64 Bit Operating System
Gespeichert
« Antwort #10 am: 20. November 2005, 12:53 »
Hi, ersetze folgenden Codeteil:

auswahl:
push 00h
mov si,text_eingabe
call sag
nocheinzeichen:
call anykey
cmp al,0Dh
je eingabetaste
pop ax
push ax
call zeig
jmp nocheinzeichen

;----------Enter
eingabetaste:
pop ax
cmp al,072h
je auswahl_reboot
cmp al,073h
je auswahl_shutdown
ret

durch diesen:

mov si,text_eingabe
call sag
auswahl:
call anykey
cmp al,72h
je key_ok
cmp al,73h
jne auswahl

key_ok:
mov dl,al
call zeig

test_enter:
call anykey
cmp al,0Dh
jne test_enter
cmp dl,72h
je auswahl_reboot
jmp auswahl_shutdown


Damit müsste das funktionieren was du vorhast. Ach ja, und hinter der Enter Meldung nicht die Null vergessen.
In the Future everyone will need OS-64!!!

bitmaster

  • Troll
  • Beiträge: 1 138
    • Profil anzeigen
    • OS-64 = 64 Bit Operating System
Gespeichert
« Antwort #11 am: 20. November 2005, 13:06 »
Uups, habe deine neue Antwort zu spät gesehen. Aber die Lösung die du dort hast ist auch nicht das Wahre. Wenn du z.B. Hallor eingibst rebootet der PC auch. Würde lieber meinen Forschlag nehmen. Der PC wartet solange bis du r oder s eingibst. Und danach solange bis du Enter drückst. Das wolltest du doch oder? Du kannst ihn auch so verändern, das wenn du eine andere Taste drückst er diese zeichnet und dann zur neuen Eingabe auffordert. Dann würde der Code so aussehen:

auswahl:
mov si,text_eingabe
call sag
call anykey
call zeig
cmp al,72h
je key_ok
cmp al,73h
je key_ok
mov al,0Dh
call zeig
mov al,0Ah
call zeig
jmp auswahl

key_ok:
mov dl,al

test_enter:
call anykey
cmp al,0Dh
jne test_enter
cmp dl,72h
je auswahl_reboot
jmp auswahl_shutdown


Also suche dir aus wie du es haben willst.
In the Future everyone will need OS-64!!!

Azi

  • Beiträge: 47
    • Profil anzeigen
Gespeichert
« Antwort #12 am: 20. November 2005, 13:09 »
Edit:Jetzt war ich am schreiben und hab deinen nicht gelesen...
Wahrscheinlich hast du meinen letzten Post nicht gelesen, da warst du bestimmt selber am schreiben.

Bei deinem Code wird man gezwungen, s oder r zu drücken, aber ich wollte gerne alle eingegebenen Zeichen sehen. So, wie du es hast, hatte ich ungefähr in der Version davor:

auswahl:
call anykey
cmp al,072h
je auswahl_reboot
cmp al,073h
je auswahl_shutdown
jmp auswahl

Der Unterschied liegt in der Enter-Taste, und es wird garkein Zeichen ausgegeben.

Es gibt 10 Sorten von Menschen: Die einen können binär zählen, die anderen nicht.

Der Vorteil der Klugheit liegt darin, dass man sich dumm stellen kann. Das Gegenteil ist schon schwieriger.

bitmaster

  • Troll
  • Beiträge: 1 138
    • Profil anzeigen
    • OS-64 = 64 Bit Operating System
Gespeichert
« Antwort #13 am: 20. November 2005, 13:12 »
Zitat von: Azi
und es wird garkein Zeichen ausgegeben.
? Natürlich, wenn du r oder s drückst schon. Dann lies dir mal meinen Post durch, wo du noch am schreiben warst. ;)

PS: Weist du schon was passiert wenn du y oder z drückst (oder der gleichen)?  :lol:
In the Future everyone will need OS-64!!!

Azi

  • Beiträge: 47
    • Profil anzeigen
Gespeichert
« Antwort #14 am: 20. November 2005, 13:23 »
Zitat von: bitmaster
Aber die Lösung die du dort hast ist auch nicht das Wahre. Wenn du z.B. Hallor eingibst rebootet der PC auch.

Das habe ich extra gemacht, damit mein PC rebootet, wenn ich 'bitmaster' eingebe! :lol:  :lol:  :lol: Und wenn ich 'bitmaster kann alles' eingebe, schaltet er sich ab!  :lol:  :lol:  :lol:

Ist jetzt nichts gegen dich, aber es fiel mir gerade auf.

Bei deiner Version gebe ich 'a' ein, und es erscheint sofort eine neu Aufforderung. Wenn ich 's' eingebe, wartet der solange, bis ich Enter drücke. Hatte ich aber vor, 'r' einzutippen, habe aber mein Ziel verfehlt, kann ich nichts mehr dagegen unternehmen... Deshalb bleibe ich bei meiner Lösung.

Es gibt 10 Sorten von Menschen: Die einen können binär zählen, die anderen nicht.

Der Vorteil der Klugheit liegt darin, dass man sich dumm stellen kann. Das Gegenteil ist schon schwieriger.

Azi

  • Beiträge: 47
    • Profil anzeigen
Gespeichert
« Antwort #15 am: 20. November 2005, 13:25 »
Zitat von: bitmaster
Zitat von: Azi
und es wird garkein Zeichen ausgegeben.
? Natürlich, wenn du r oder s drückst schon. Dann lies dir mal meinen Post durch, wo du noch am schreiben warst. ;)

PS: Weist du schon was passiert wenn du y oder z drückst (oder der gleichen)?  :lol:


So, jetzt les du meinen, den ich schrieb, als du ihn schriebst :D.
Wir reden ziemlich zeitversetzt...

Es gibt 10 Sorten von Menschen: Die einen können binär zählen, die anderen nicht.

Der Vorteil der Klugheit liegt darin, dass man sich dumm stellen kann. Das Gegenteil ist schon schwieriger.

bitmaster

  • Troll
  • Beiträge: 1 138
    • Profil anzeigen
    • OS-64 = 64 Bit Operating System
Gespeichert
« Antwort #16 am: 20. November 2005, 14:39 »
Dann mache es am besten so:

auswahl:
mov si,text_eingabe
call sag

after_backspace:
call anykey
call zeig
cmp al,72h
je key_ok
cmp al,73h
je key_ok
mov al,0Dh
call zeig
mov al,0Ah
call zeig
jmp auswahl

key_ok:
mov dl,al

test_key:
call anykey
cmp al,08h
je backspace
cmp al,0Dh
jne test_enter
cmp dl,72h
je auswahl_reboot
jmp auswahl_shutdown

backspace:
call zeig
mov al,20h
call zeig
mov al,08h
call zeig
jmp after_backspace
In the Future everyone will need OS-64!!!

 

Einloggen