![]() |
Maschinensprache und Assembler - ein kleines Beispiel
Aufgrund des diesen Beitrages
![]() Diskussionen bitte in obigen Threat schreiben, Erweiterungen zum Tutorial bitte hier ;-) Zitat:
Also...
So das sollte als Info reichen. Hier kann man noch etwas mehr dazu lesen: Viel Spaß Dr. MaBuSE |
Re: Maschinensprache und Assembler - ein kleines Beispiel
Hallo,
ich wurde folgendes gefragt: Zitat:
![]() gefunden mit: ![]() Viel Spaß Dr. MaBuSE |
Re: Maschinensprache und Assembler - ein kleines Beispiel
mabuse ich seh die seite nicht ;)
|
Re: Maschinensprache und Assembler - ein kleines Beispiel
Zitat:
Da diese Seiten zur privaten Verwendung kopiert werden dürfen,
Code:
habe ich Sie Dir per PM geschickt. (Hier werde ich die Seiten ohne vorherige Genehmigung des Autors nicht posten
This page may be freely copied for PERSONAL use ONLY !
( It may NOT be used for ANY other purpose unless you have first contacted and received permission from the author ! ) ![]() |
Re: Maschinensprache und Assembler - ein kleines Beispiel
Zitat:
die ganzen 0en rechts stimmen aber nicht oder? |
Re: Maschinensprache und Assembler - ein kleines Beispiel
Zitat:
Das ist ein sogenannter "Copy & Paste" Fehler [edit] Das Tutorial oben wurde geändert. Die Tabelle ist nun richtig. [/edit] |
Re: Maschinensprache und Assembler - ein kleines Beispiel
Zu dem Programm habe ich mal zwei Fragen:
Erstens: Ich habe das Programm mal geschrieben und jetzt kann ich es nicht mehr löschen. Es kommt die Fehlermeldung, dass die Datei von einem anderen Programm genutzt wird. Liegt das jetzt am Programm oder an meinem PC? Zweitens: Ist das Programm jetzt komplett Betriebssystemunabhängig oder braucht es immer noch DOS? Maschinensprache ist ja normalerweise unabhängig, aber in der Beschreibung steht, dass DOS Funktionen aufgerufen werden. |
Re: Maschinensprache und Assembler - ein kleines Beispiel
Zitat:
![]() Zitat:
|
Re: Maschinensprache und Assembler - ein kleines Beispiel
Zitat:
Edit: Ach verdammt, der olle Nico war schon wieder schneller... |
Re: Maschinensprache und Assembler - ein kleines Beispiel
Dann eine weitere Frage: Gibt es das Programm auch als komplett eigenständiges Programm, so dass ich es z.B. auf einer leeren Festplatte oder auf nicht DOS basierenden Betriebssystemen ausführen könnte?
(Darf ich diese Fragen eigentlich hier stellen oder ist das in einem Tutorial nicht so erwünscht?) |
Re: Maschinensprache und Assembler - ein kleines Beispiel
Wenn die Fragen nicht erwünscht sein sollten, haben die Moderatoren eine Funktion, um Beiträge abzusplitten.
Zitat:
Code:
Zu kompilieren mit dem GNU Assembler (GAS) und zu Speichern im ersten Sektor einer beliebigen Diskette und bootbar mit jedem IBM-kompatiblen PC-BIOS.
/*
Copyright (C) 2004 Thomas Liebetraut This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* __History__: 0.01 (2004-01-15): - added function print_string - Basic stack and initialization */ .code16 /* 16bit RealMode code */ .intel_syntax /* I am one of the few people who HATE AT&T-style ;-) */ /* make sure to be at 7c0h:00 instead of 00:7c00h*/ jmp 0x07c0, offset start /* here we really begin to do something */ start: /* * We definitely need a stack */ cli /* we don't have a stack in the next few nanoseconds ;-) */ mov ax, 0x07e0 /* 0x7c0 + 512 bytes */ mov ss, ax mov ax, 512 /* 512 bytes for the stack should be enough to start with */ mov sp, ax mov ax, 0x07c0 /* and by the way, update DS */ mov ds, ax sti /* now we have a proper stack, no problems for interrupts */ /* * the stack is now just behind the bootsector */ /* ensure to be in the correct graphics mode */ mov ax, 0x0003 int 0x10 /* * and clear the screen, just in case the BIOS behaves odd */ clear_scr: /* NOTE: we assume non-MDA and non-HGA! */ mov ax, 0xb800 mov es, ax mov bp, 0x00 mov cx, 2000 lp_clrscr: mov ax, 0x0700 /* color, character "0" */ mov es:[bp], ax /* output goes to page 0, color */ add bp, 2 loop lp_clrscr /* and move to the top left corner */ mov ax, 0x0200 mov bx, 0x0000 mov dx, 0x0000 int 0x010 /* * Now, the screen and everything is initialized and we can start * to work. */ load_stage2: /* first, print message saying what we're doing now */ mov si, offset msg_load call print_string /* get the boot drive */ jmp halt /* stop here */ /* * print_string puts a string to the screen at the current * cursor's position. * The string must be terminated with a zero-byte (C-style string) * and is interpreted by the BIOS according to BELL standards. * The string is expected to be at DS:SI. * * NOTE: After a call to print_string, SI points to the end of the string!!! */ print_string: push ax # safe the used registers push bx mov ah, 0x0e mov bx, word ptr 0x0000 print_loop: mov al, byte ptr [si] cmp al, 0x00 jz ps_halt int 0x10 inc di jmp print_loop ps_halt: pop bx pop ax ret halt: cli HLT /* * Data section * All variables and static data (mainly messages) goes here */ msg_load: .ascii "Loading stage 2...\x0d\x0a\x00" /* * Pad the binary with security code (normally we should never jump there) * and append boot signature */ .fill (510 - .)/2, 2, 0xF4F4 .byte 0x55, 0xAA War mal als kleiner Bootloader zum Rumspielen gedacht (daher am Ende die eigenartigen Kommentare), läuft nur bis er den String ausgibt. Zwar ein wenig komplexer aufgebaut als Marcs Beispiel, aber dafür muss man sich um die Länge des Strings keine Sorgen machen (solange er nicht länger ist als 510-(assemblierter Programmcode) Byte. Um es noch weiter zurechtzustutzen, damit wirklich nur der String ausgegeben wird, bin ich jetzt zu faul. |
Re: Maschinensprache und Assembler - ein kleines Beispiel
Zitat:
Wenn die Fragen so stark zusammenhängen, das sie als eine Frage anzusehen sind, natürlich nicht. Die Frage sollte nicht in der Sparte Tutorials gestellt werden, sondern in einer zur Frage passenden Sparte. Dann findet sich auch schneller jemand der antwortet. Was Tutorials angeht, ist es eigentlich nicht gewünscht, Fragen anzuhängen. Das macht das Tutorial unübersichtlich. Dazu gibt es die "Diskussionsthemen" (Das steht aber eigentlich auch oben im Tutorial ;-) Zitat:
Viel Spaß MaBuSE |
Alle Zeitangaben in WEZ +1. Es ist jetzt 12:57 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz