![]() |
|
|
![]()
|
|
| Бориска |
|
|||
|
Unregistered |
Народ! Помогите найти ошибку (NASM)
Это программа загрузочного сектора дискеты. Всё что она должна делать это передать управление MBR Буду признателен любой помощи! org 07C00h ;this tells nasm that the first byte will be positioned at address 0000:07C00h so that all the jumps will be correct jmp short begin_bootroutine ;jump to the start of our bootroutine skipping any data nop ;first field must be 3 bytes long jmp short is 2 bytes db 'MajOS1.0' ; OEM identification dw 512 ; Bytes per sector db 1 ; Sectors per cluster dw 1 ; Number of reserved sectors db 2 ; Number of FATs dw 0E0h ; Number of dirs in root dw 0B40h ; Number of sectors in volume db 0F0h ; Media descriptor dw 9 ; Number of sectors per FAT dw 18 ; Number of sectors per track dw 2 ; Number of read/write heads dw 0 ; Number of hidden sectors begin_bootroutine: ;this is where the bootroutine starts start: ; Update the segment registers mov ax, cs mov ds, ax mov es, ax read: mov ax, 1000h ; ES:BX = 1000:07C00h mov es, ax ; mov bx, 07C00h ; mov ah, 2 ; Load disk data to ES:BX mov al, 1 ; Load 1 sectors mov ch, 0 ; Cylinder=0 mov cl, 1 ; Sector=1 mov dh, 0 ; Head=0 mov dl, 128 ; Drive=С: int 13h ; Read! jc read ; ERROR => Try again jmp 1000h:07C00h ; Jump to the program times 510-($-$$) db 0 dw 0AA55h email:[email protected] |
|||
|
||||
| Chingachguk |
|
|||
|
Эксперт ![]() ![]() ![]() Профиль Группа: Участник Клуба Сообщений: 1232 Регистрация: 25.3.2002 Где: Москва Репутация: нет Всего: 18 |
Ты куда-то не туда запузыриваешь стандартный код ;) Обычно его читают в 0000:7C00, и, можешь верить, он на это расчитывает - оказаться именно там ;) Тебя же именно туды загрузили... ps непонятна инициализация стека - ты ее не делаешь ... Говорят, надо ... -------------------- I don't like the drugs (but the drugs like me). M.Manson. |
|||
|
||||
| Boriska |
|
|||
|
Unregistered |
Если так, то тоже не выходит
org 07C00h ;this tells nasm that the first byte will be positioned ;at address 0000 ; be correct jmp short begin_bootroutine ;jump to the start of our bootroutine skipping any data nop ;first field must be 3 bytes long jmp short is 2 bytes db 'MajOS1.0' ; OEM identification dw 512 ; Bytes per sector db 1 ; Sectors per cluster dw 1 ; Number of reserved sectors db 2 ; Number of FATs dw 0E0h ; Number of dirs in root dw 0B40h ; Number of sectors in volume db 0F0h ; Media descriptor dw 9 ; Number of sectors per FAT dw 18 ; Number of sectors per track dw 2 ; Number of read/write heads dw 0 ; Number of hidden sectors begin_bootroutine: ;this is where the bootroutine starts start: ; Update the segment registers mov ax, cs mov ds, ax mov es, ax read: mov ax, 0000h ; ES:BX = 0000 mov es, ax ; mov bx, 07C00h ; mov ah, 2 ; Load disk data to ES:BX mov al, 1 ; Load 1 sectors mov ch, 0 ; Cylinder=0 mov cl, 1 ; Sector=1 mov dh, 0 ; Head=0 mov dl, 128 ; Drive=C int 13h ; Read! jc read ; ERROR => Try again jmp 0000h:07C00h ; Jump to the program times 510-($-$$) db 0 dw 0AA55h |
|||
|
||||
| Chingachguk |
|
|||
|
Эксперт ![]() ![]() ![]() Профиль Группа: Участник Клуба Сообщений: 1232 Регистрация: 25.3.2002 Где: Москва Репутация: нет Всего: 18 |
1) Что же все-таки со стеком ?;
2) И что именно не работает ? Как выглядит ошибка ?; 3) Самое главное. В момент чтения сектора твой код НАХОДИТСЯ В 0000:7C00, а читаешь ты куда ? правильно, туда же, где твой код выполняется, при этом ЗАТИРАЯ СВОЙ КОД вызовом int 13h ! Можно делать так: push 0000 pop es mov bx,7C00h mov ax,0201h mov cx,0001h mov dx,0080h pushf push es push bx jmp far es:[13h*4] ; jmp to bios - имитируем интеррапт Либо копируй себя в другое место, и читай оттуда ! -------------------- I don't like the drugs (but the drugs like me). M.Manson. |
|||
|
||||
![]()
|
| Правила форума "Asm: Общие вопросы" | |
|
|
Если Вам понравилась атмосфера форума, заходите к нам чаще! С уважением, MAKCim. |
| 0 Пользователей читают эту тему (0 Гостей и 0 Скрытых Пользователей) | |
| 0 Пользователей: | |
| « Предыдущая тема | Asm: Общие вопросы | Следующая тема » |
|
|
По вопросам размещения рекламы пишите на vladimir(sobaka)vingrad.ru
Отказ от ответственности Powered by Invision Power Board(R) 1.3 © 2003 IPS, Inc. |