Donnerstag, 25. Juni 2009

Samstag, 20. Juni

;****************************************************************************
;****************************************************************************
;* COMPUTER BOOT
;****************************************************************************
;****************************************************************************

[BITS 16]
[ORG 0x7C00]

global start

;****************************************************************************
;* ASSIGN
;****************************************************************************
%assign POWER ON 1 STROM EIN
%assign POWER ON SELF TEST 2 HARDWARE?
%assign PLUG 'N PLAY 3 WEITERE HILFSPROGRAMME?
%assign TEST BOOT DRIVE 4 STARTPOSITION?
%assign BOOTABLE MEDIA FOUND 5 IN STARTPOSITION
%assign LOAD INITAL BOOT LOADER 6 STARTPROGRAM (URLADER)
%assign START OPERATING SYSTEM 7 BETRIEBSSYSTEM HOCHFAHREN

;****************************************************************************
;* DATA
;****************************************************************************
section .bss
Den Tag verliere ich mich in technischen Anleitungen und Code-Beispielen, um ein Gefühl für die einzelnen Schritte des Bootvorgangs zu bekommen. Wo kann ich ansetzen?


;****************************************************************************
;* STARTVERSUCHE
;****************************************************************************
section .text
start:

Anhören Dell1.mp3
Anhören Dell2.mp3
Anhören Dell3.mp3
Anhören Maxdata.mp3
Anhören Forefront.mp3
Anhören Desktop1.mp3
Anhören Desktop2.mp3

;execute unmodified code first

code1_end:

;do something real nasty: edi points right after the 'rep stosb'
;instruction, so this will really modify itself

mov dword edi, ebp
add dword edi, (code2_mark - code2_start)
call dword ebp

endless:

;here comes the magic, which prevents endless execution

mov dword ecx, (smc_end_1 - smc_end)
mov dword esi, smc_end
mov dword edi, endless
rep movsb

;do it again

jmp short endless

;****************************************************************************
;* WRITE_HEX
;****************************************************************************
write_hex:

mov byte bh, bl
shr byte bl, 4
add byte bl, 0x30
cmp byte bl, 0x3a
jb short .number_1
add byte bl, 0x07

section .data
hex_text: db "ebx: "
hex_number: db "00h", 10

;****************************************************************************
;* SOME TEXT
;****************************************************************************
endless_loop: db "No endless loop here!", 10
hello_world_1: db "Hello World!", 10
hello_world_2: db "This code was modified!", 10
hello_world_3:

;****************************************************************************
;* ERROR
;****************************************************************************
section .text
error:
xor dword eax, eax
inc dword eax
mov dword ebx, eax
int byte 0x80

;****************************************************************************
;* END
;****************************************************************************
section .text
end:

Anhören Thinkpad.mp3 ; nachdem schon alles geladen und hochgefahren ist

;*********************************************** linuxassembly@unusedino.de *

TIMES 510 - ($ - $$) db 0 ;Fill the rest of sector with 0
DW 0xAA55 ;Add boot signature at the end of bootloader