flat assembler
Message board for the users of flat assembler.

Index > OS Construction > Why doesn't this code write all lines?

Author
Thread Post new topic Reply to topic
joachim_neu



Joined: 22 Dec 2003
Posts: 139
joachim_neu 08 Mar 2004, 08:14
hello,

I've got a new problem... I coded a code, which should read 512 chars from the monitor and then it should write it to the drive... My problem is, that the code doesn't write the first and the last line... It is such a unlogical problem and I don't know the answer... Please help me, this is the part of my code:

Code:
; Schreibt einen Sektor auf die Platte
wrs:
call sdel
mov si,wr_choice
call putstr
call getkey
cmp ah,1Fh
jz wr_sc
cmp ah,1Eh
jz wr_as
wr_sc:
mov si,sc_choice
call putstr
mov ax,0x5000
mov es,ax
mov ax,0h
mov di,ax
mov cx,200h
sc_schl:
call writekey
cmp ah,01h
jz writes
mov al,ah
stosb
loop sc_schl
jmp writes
wr_as:
mov si,as_choice
call putstr
mov ax,0x5000
mov es,ax
mov ax,0h
mov di,ax
mov cx,200h
as_schl:
call writekey
cmp ah,01h
jz writes
stosb
loop as_schl
jmp writes                 
.......
writes:
mov si,write_msg
call putstr
mov ch,00h
mov dx,0000h
mov bx,0h
mov ax,0x5000
mov es,ax
call getkey
dec ah
mov cl,ah
mov ah,03h
mov al,01h
int 13h
jmp START    



; Stringausgabe
putstr:
lodsb            ; Byte laden
or al,al
jz short putstrd ; 0-Byte? -> Ende!
mov ah,0x0E      ; Funktion 0x0E
mov bx,0x0007    ; Atrribut-Byte
int 0x10         ; schreiben
jmp putstr       ; nächstes Byte
putstrd:
retn

; Warte auf einen Tastendruck
getkey:
mov ah, 0 ; Funktion 0
int 016h  ; Ausführen
ret

; Wartet auf einen Druck und zeigt ihn an
writekey:
mov ah, 0 ; Funktion 0
int 016h  ; Ausführen
mov dx,ax
mov bl,07h
mov ah,0Eh
int 10h
mov ax,dx
ret

;löscht einen Speichersektor
sdel:
mov ax,0x5000
mov es,ax
mov ax,0h
mov di,ax
mov cx,200h
delschl:
xor ax,ax
stosb
loop delschl
ret        
    


Please help me!!!!!!!!!!!

JOACHIM NEU
Post 08 Mar 2004, 08:14
View user's profile Send private message Visit poster's website Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 08 Mar 2004, 09:02
Hi.
What you tryed to solve the problem?

Regards
Post 08 Mar 2004, 09:02
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
joachim_neu



Joined: 22 Dec 2003
Posts: 139
joachim_neu 08 Mar 2004, 09:50
sorry, I didn't try anything special, because I didn't saw the logic behind it, I think, there's something wrong, because normally a computer writes all or nothing but something in the middle wasn't logically for me, so I couldn't do something...
Post 08 Mar 2004, 09:50
View user's profile Send private message Visit poster's website Reply with quote
joachim_neu



Joined: 22 Dec 2003
Posts: 139
joachim_neu 08 Mar 2004, 09:52
If it whould only not write the last 20 chars, I whould see a logic, but exactly allways the first and the last line... Sometimes the last line are 30 or 32 chars and so there I found no logic...
Post 08 Mar 2004, 09:52
View user's profile Send private message Visit poster's website Reply with quote
joachim_neu



Joined: 22 Dec 2003
Posts: 139
joachim_neu 08 Mar 2004, 10:45
oh Embarassed Embarassed Embarassed Embarassed Embarassed ,

I did a mistake... The mistake is not in the write-code (I tested with bootread from bitdog, I wrote in sector 1 and read it with bootread), the mistake is in the read-code, but where?:

Code:
; Ließt Sektoren von der Platte
loads:
mov si,load_msg
call putstr

; Diskdrive reset (Interrupt 13h, 0)
push ds            ; Save DS
mov ax, 0          ; The function (reset)
mov dl, 0          ; This drive
int 13h            ; run the interrupt
pop ds             ; DS recover
jc loads            ; Misstake? Again!

load1:
mov ax,0x5000      ; ES:BX = 50000
mov es,ax
mov bx, 0

; read sectors (Interrupt 13h, 2)
mov ch,00h
call getkey
dec ah
mov cl,ah
mov dx,0x0000
mov al,1h
mov ah,2h       ; Function 2 (Lesen)
int 13h         ; ES:BX =  Dates of the drive
jc load1        ; misstake? again!

mov ax,0x5000
mov es,ax
mov BP, 0
mov AH,13h
mov AL,0h
mov BL,07h
mov BH,00h
mov CX,0x200
mov DH,19h
mov DL,0
int 10h

mov si,empty
call putstr
jmp START  
    


thanks

JOACHIM NEU
Post 08 Mar 2004, 10:45
View user's profile Send private message Visit poster's website Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 08 Mar 2004, 10:59
Good. You have an advance.
Keep working this way.

regards.
Post 08 Mar 2004, 10:59
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
joachim_neu



Joined: 22 Dec 2003
Posts: 139
joachim_neu 08 Mar 2004, 11:37
I think some empty lines are written over the others...

I'll test it...
Post 08 Mar 2004, 11:37
View user's profile Send private message Visit poster's website Reply with quote
joachim_neu



Joined: 22 Dec 2003
Posts: 139
joachim_neu 08 Mar 2004, 18:48
thanks... there were two lines overlapped, the last were empty....
Post 08 Mar 2004, 18:48
View user's profile Send private message Visit poster's website Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 08 Mar 2004, 18:54
Great! Smile
Post 08 Mar 2004, 18:54
View user's profile Send private message Visit poster's website ICQ Number 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-2023, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.