Avatar of Nadir Van Thielen
Nadir Van ThielenFlag for Belgium

asked on 

assembly

Hallo, in Asm I have a problem reading from the disk , the file is on the disk built cant read it .


File : Readdsik.asm 

ReadDisk:
    mov ah, 0x02                    ; Read disk
    mov bx, PROGRAM_SPACE           ; Set disk info into PROGRAM_SPACE     mov al, 4     mov dl, [BOOT_DISK]     mov ch, 0x00     mov dh, 0x00     mov cl, 0x02                    ; Read Sector 2     int 0x13

Open in new window



file on the disk: Extend.asm

[org 0x7e00]
mov bx, ExetendspacheSpaceSucess
call PrintString jmp $ %include "print.asm" ExetendspacheSpaceSucess:    db 'We are seccessfully in extended space' , 0 times 2048-($-$$) db 0

Open in new window



AssemblyProgramming

Avatar of undefined
Last Comment
Bill Bach
Avatar of ste5an
ste5an
Flag of Germany image

Well, more context would be helpful. What OS, what CPU architecture, what assembler is used?

p.s. the [code][/code] tags use square brackets ;)
Avatar of Nadir Van Thielen

ASKER

I am, running it on a virtual computer, X86, the solution the I am building a own kernel on a disk.
Using assembler to compile and build.

-Programs :
Notepad
nasm
virtual box

in the bootloader.asm
[org 0x7c00]

mov [BOOT_DISK] , dl

mov bp, 0x7c00
mov sp, bp

mov bx, Print_text
call PrintString

call ReadDisk

mov ah, 0x0e
mov al, [PROGRAM_SPACE]
int 0x10

jmp $


%include "print.asm"
%include "Diskread.asm"

times 510-($-$$) db 0
dw 0xaa55

Open in new window


Avatar of Nadir Van Thielen

ASKER

I sloft i my self < joehoe >
bootloader.asm

[org 0x7c00]

mov [BOOT_DISK] , dl      ; load program disk nummer into the system

mov bp, 0x7c00
mov sp , bp

mov bx, TestString
call PrintString

call ReadDisk

mov ah, 0x0e
mov al, [PROGRAM_SPACE]
int 0x10


jmp $

%include "print.asm"
%include "Diskread.asm"

times 510-($-$$) db 0

dw 0x55aa 

Open in new window

Readdisk.asm

PROGRAM_SPACE equ 0x7e00

ReadDisk:
   mov ah, 0x02               ; Set bios funcion read disk
   mov bx, PROGRAM_SPACE
   mov al, 2                  ; read 2000byts
   mov dl, [BOOT_DISK]            ; from whits disk need to by read from
   mov ch, 0x00               ; set the cilinder data to 0
   mov dh, 0x00               ; set head from the disk
   mov cl, 0x02               ; read sectror 2

   int 0x13                  ; BIOS read interupt.
   
   jc DiskReadFaild
   
   ret


BOOT_DISK:
   db 0

DiskReadErrorString:
   db 'Disk read Faild', 0

DiskReadFaild:
   mov bx, DiskReadErrorString
   call PrintString

   jmp $

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Bill Bach
Bill Bach
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Programming
Programming

Programming includes both the specifics of the language you’re using, like Visual Basic, .NET, Java and others, but also the best practices in user experience and interfaces and the management of projects, version control and development. Other programming topics are related to web and cloud development and system and hardware programming.

55K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo