flat assembler
Message board for the users of flat assembler.
Index
> OS Construction > Question about moving data to RAM |
Author |
|
cod3b453 06 May 2011, 19:10
I'm may be wrong here but the only BIOS locations I know of are:
0x00400 - 0x00600 0x9FC00 - 0xA0000 (this can vary) 0xE0000 - 0xFFFFF ---- The accessible range is 0x00000 - 0xFFFFF unless you have less than 1MB of RAM. Looking at your code, you've set es to 0x8000 which translates to linear address 0x80000 but your print routines don't access this buffer and simply move the constant 0x1020 to ax every time; you'd have to do something like mov ax, word [es:0]. |
|||
06 May 2011, 19:10 |
|
Howesr1@yahoo.com 06 May 2011, 20:55
I got the answer from someone. I have to set ds to the 8000 that's in es after the movsb: push es and pop ds. Now ds points to 8000h and the expansion rom chip now has dynamic RAM variables instead of static ROM values located at label begindata $ (for a total of 812 bytes of variable.)
_________________ Bob's your uncle. Millie's your aunt. |
|||
06 May 2011, 20:55 |
|
Howesr1@yahoo.com 07 May 2011, 00:00
Thank you cod3b453.
Now that that is resolved, Int 13 AH,42 returns ah=01, invalid parameter mov ax,08000h ;8000h mov es,ax ; now es and ax are pointing to the same place. lea si,[begindata] lea di,[begindata] mov cx,812 ; bytes ; move 300 bytes to ram - plus 512 bytes for iobuff. (512 = 256 Dwords) rep movsb ; move 100 bytes to 8000H push es ; this pushed 812 onto the stack pop ds ; now pop 8000h off the stack - ds now points to 8000h mov dl,80h ; hard disk 1 lea si,[lbaio] ; lbaio mov ah,42h ;read int 13h jc notok <<< jumps to Not Ok >>> never gets here <<<<<< Ah returns as 01 01h invalid function in AH or invalid parameter Can anyone explain why this might be? _________________ Bob's your uncle. Millie's your aunt. |
|||
07 May 2011, 00:00 |
|
typedef 07 May 2011, 05:21
int 13h, AH 42h
parameters dl-Drive number ds:si-segment and offset to DAP Last edited by typedef on 07 May 2011, 18:33; edited 1 time in total |
|||
07 May 2011, 05:21 |
|
BAiC 07 May 2011, 12:20
512 Bytes is 128 Dwords (in the x86-style of DWORD)
mov cx, 812 rep movsb the movsb doesn't update ES it updates SI and DI.. the rep updates CX (at the end of the movsb it becomes zero). |
|||
07 May 2011, 12:20 |
|
Howesr1@yahoo.com 08 May 2011, 16:37
Thank you typedef and BAiC. I'm a noob. I've got manuals to read! Like, what is the DAP?
As I read your response again I see: SI and DI! So Int 13 return is telling the truth. The destination buffer parameter is not valid. Thanks again! Last edited by Howesr1@yahoo.com on 08 May 2011, 19:44; edited 1 time in total |
|||
08 May 2011, 16:37 |
|
BAiC 08 May 2011, 16:46
calculating ROM addresses vs. physical addresses isn't particularly difficult.
it's information that's needed most of all: Where are you trying to Read From and where are you trying to write to? The formula, by the way, is 16*Segment + LinearAddress. |
|||
08 May 2011, 16:46 |
|
ouadji 08 May 2011, 17:47
off topic, sorry... just this, What OS are you using to use an interrupt like int13 ? |
|||
08 May 2011, 17:47 |
|
Howesr1@yahoo.com 08 May 2011, 20:04
Hi BAiC
Int 13 ah42 reads the hard disk 01 and should be putting the 512 byte sector idata nto lbaio. (I used 812 bytes to allow creation of additional variable data to be used above the 512 hd data: indexes, counts, strings, etc.) lbaio and other variables are declared in the ROM, but rom is an OTP with no stack or data space so I had to movsb it to RAM, which is where all the trouble starts! Hi ouadji No os, or maybe the bios uses a version of DOS assembly language. I'm programming a bios extension device. |
|||
08 May 2011, 20:04 |
|
Howesr1@yahoo.com 08 May 2011, 21:03
I've been experimenting with how to set si and ds to point to the 8000h offset for use with int 13 ah42 hard drive read with no success. I always get ah=01 invalid parameter. does anyone have any ideas?
No matter what I set ds and si to I get that same error code. push ds push es mov ax,08000h ;8000h mov es,ax ; now es and ax are pointing to the same place. lea si,[begindata] lea di,[begindata] mov cx,812 ; bytes ; move 300 bytes to ram - plus 512 bytes for iobuff. (512 = 256 Dwords) rep movsb ; move 100 bytes to 8000H mov ax,08000h ;8000h mov es,ax ; now es and ax are pointing to the same place. push es ; this pushed 800h onto the stack pop ds ; now pop 8000h off the stack - ds now points to 8000h mov dl,80h ; hard disk 1 lea si,[lbaio] ; lbaio mov ah,42h ;read int 13h jc notok ret _________________ Bob's your uncle. Millie's your aunt. |
|||
08 May 2011, 21:03 |
|
typedef 08 May 2011, 23:14
move variables first then code.
destination address=0800h label_vars: myword dw ? ;2 bytes here mystring db 'hello world',0 ; 12 bytes here, 14 bytes total. first copy those to ram @ SI like this. note this is rather slow than just using rep movsb. mov si,label_vars mov di,08000h ; segment + offset mov cx,14 @@: lodsb cmp cx,0 je @F movsb dec cx jmp @B @@: ; now when in ram, myword will be at 08000h linear and my string will be at 08003h linear your code should start at 080012h linear |
|||
08 May 2011, 23:14 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.