flat assembler
Message board for the users of flat assembler.

Index > OS Construction > Newby floppy IO

Author
Thread Post new topic Reply to topic
Silux



Joined: 14 Jun 2007
Posts: 2
Silux 14 Jun 2007, 23:45
I have a simple OS made of peices of code I have found here and there along with some of my own - though I dont have a very good grasp on a lot of things.. Basically I want to be able to write a string to say...sector 3, then be able to read it back in and output it.
This really doesnt have much application for anything, I just took on this assignment for school and I want to be able to atleast save something, and read it back in when needed.


I beleive I need interrupt 13h for both, and I may even already have it writing the data...problem is that when it reads it in, I have no idea where it goes to. (From what I've found, int 13h reads disk sector into "memory"...not sure how to access said "memory" Razz)

Anyone spare some help?
Post 14 Jun 2007, 23:45
View user's profile Send private message Reply with quote
Silux



Joined: 14 Jun 2007
Posts: 2
Silux 15 Jun 2007, 12:28
Okay well my problem kind of shifted just a bit. Data writes fine, and it may even read fine. I dont even really know how to explain it, but say i write to (ES:BX) 0050:0000, then i read from the same spot, then i want to store whatever is at that point in memory in SI to print out. I cannot seem to read the data that is written, or atleast not determine the memory address of it so SI can access it.
Post 15 Jun 2007, 12:28
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 15 Jun 2007, 13:26
I think it would be better if you paste some code
Post 15 Jun 2007, 13:26
View user's profile Send private message Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u 15 Jun 2007, 18:13
Try this:
Code:
 ;**********************************; ; Simple Floppy dump demo          ; ; Assemble like this:              ; ; c:\fasm Fddump.asm Fddump.com    ; ;                                  ; ; By Dex                  16/06/07 ; ;**********************************;org   100huse16start:mov   si,Msg1                          ; point to mesagecall  Print                          ; call the print functionxor   ax,ax                          ; wait for a key pressint   0x16mov   si,Msg2                       ; point to mesagecall  Print                          ; call the print functioncall  ReadSect                       ; Read Boot Sectorjc    Errorcall  PrintBuf                         ; Print the Bufferxor   ax,ax                         ; wait for a key pressint   0x16ret                                ; CHANGE this for jmp $ when booting;====================================================;;  Error.                                            ;;====================================================;Error:mov   si,ErrMsg              ; point to mesagecall  Print                          ; call the print functionxor   ax,ax                          ; wait for a key pressint   0x16ret                                ; CHANGE this for jmp $ when booting;====================================================;;  ReadSect.                                         ;;====================================================;ReadSect:mov   bx,Buf                       ; NOTE: it would be best to do 3 retry on error.mov   ah,0x02                      ; Read drive, write = 0x03mov   al,1                        ; Number of Sectors to readmov   ch,0                         ; Track Numbermov   cl,1                      ; Sector Numbermov   dh,0                     ; Head Numbermov   dl,0                       ; Drive Number, 0 = A drive, 0x80 = C driveint   0x13ret            ;====================================================;;  PrintBuf.                                         ;;====================================================;PrintBuf: mov   cx,512@@:mov   ah,0x0emov   al,[es:bx]int   0x10inc   bxloop  @bret;====================================================;;  Print.                                            ;;====================================================; Print:mov   ah,0Eh                        ; Request displayagain1:lodsb                                   ; load a byte into AL from DS:SIor   al,al                        ; Or ALjz   done1                     ; Jump 0, to label done1int  10h                      ; Call interrupt servicejmp  again1                           ; Jump to label again1done1:ret                                 ; Return ;----------------------------------------------------; ; Data                                               ; ;----------------------------------------------------;Msg1: db  'Press any Key to Dump Boot sector....',13,10,0Msg2:  db  'Reading from Drive A:',13,10,0ErrMsg:  db  'Error Reading Floppy Drive ',13,10,0Buf:      rb   512    

Note: you can boot the com file with http://alexfru.chat.ru/epm.html#bootprog
Also when it dumps the sector, it will mosty look like garbage.
Post 15 Jun 2007, 18:13
View user's profile Send private message Reply with quote
Hayden



Joined: 06 Oct 2005
Posts: 132
Hayden 16 Jun 2007, 16:20
0050h:0000h is not the best address to read/write to... your address should be at least 0600h:0000h.

_________________
New User.. Hayden McKay.
Post 16 Jun 2007, 16:20
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.