Opening a file in DOS

Page 3/3
1 | 2 |

By WORP3

Paladin (863)

WORP3's picture

05-02-2011, 23:21

You can see the following routine as a replacement for ldir:

PUSH AF
LOOP:
LD A,(HL)
LD (DE),A
INC HL
INC DE
DEC BC
LD A,C
OR B
JR NZ,LOOP
POP AF

Use the above routine only as a reference, did a fast typo Wink

By Daemos

Paragon (2009)

Daemos's picture

06-02-2011, 17:48

OK new problem very minor but somehow anoying. Smile2

So I have come so far that I even read out the pallette out of the SC5 file and get a wonderfull full screen picture on my screen. That means mission complete Hannibal

But now something nasty happens. The screen5 image is about 30KB in RAM covering two pages of RAM. I have to place the data somewhere in the RAM but page 1,2 and a part of page 3 are used by my listing assembler etc. Page 0 holds my program. So when I load the program my assembler and listing gets overwritten and I have to restart the assembler reload the listing after each test... Now there has got to be a way to put that image in the other 64KB of RAM since I do have 128KB of RAM at total but I have absolutely no clue how. My question. How can I adress that upper 64KB of RAM to temporary store the file prior to VRAM transfer??

By Manuel

Ascended (18950)

Manuel's picture

06-02-2011, 19:30

Why don't you transfer it in blocks of 16k for instance?

By Daemos

Paragon (2009)

Daemos's picture

06-02-2011, 20:14

Why don't you transfer it in blocks of 16k for instance?

Like. Loading 16K in the RAM transfer it to VRAM. Overwrite this 16K with new stuff from disk. Tranfer again to VRAM, like that?

By Manuel

Ascended (18950)

Manuel's picture

06-02-2011, 21:17

yeah like that. You can also use a smaller buffer of course. But there's no need to load it *all* in RAM at once.

By Daemos

Paragon (2009)

Daemos's picture

07-02-2011, 15:26

Got it to load in smaller chunks. Also found out that there was some major error in my code. Lucky for me that I am still in the learning fase. The listing and assembler now remain in the RAM so thats very nice.

I have used 1024 byte blocks. And it needs about 30 of those to load (actually less but I was too lazy to calculate the exact size). I have split the 30 blocks in chunks of 10 using about 10 KB's of RAM which fits nicely in page 3 running from #c000 to about #e000. Because I used the high speed CPU to VRAM command I just execute the command first. Load in the first 10 chunks into the VRAM then load the next 10 chunks in RAM translocate them to VRAM until I reach the last chunk. Then fetch the palette data from the last chunk and BOOM a huge image on the screen. Because of my laziness (no screen disable) you can actually see the process happen in rapid sucession. 1/3 screen fill then some disk drive snorring etc.

I still wonder though how I can write/read in that other 64KB of RAM. Thats more a curiousity rather then something I really need done.

By NYYRIKKI

Enlighted (5943)

NYYRIKKI's picture

07-02-2011, 16:03

I still wonder though how I can write/read in that other 64KB of RAM. Thats more a curiousity rather then something I really need done.

See these recent forum topics:
http://www.msx.org/forumtopic12255.html
http://www.msx.org/forumtopic12241.html

By Manuel

Ascended (18950)

Manuel's picture

07-02-2011, 22:39

If you're good, you'll always be in the learning phase Smile

By Daemos

Paragon (2009)

Daemos's picture

08-02-2011, 20:49

There. Another thing learned Cool I am really starting to get somewhere.

It took me some time to figure though. I read everything about slots and subslots and memory management so after some hours of staring I just thought "lets try this out"

So then I got major hanging of the MSX and even some commands cause wierd noises coming out of the MSX oO but in the end I managed to get to that other 64KB. Here is how:

setmap:

ld a,5
out (&HFE),a
ld a,4
out (&HFD),a
ret

setram:

ld a,2
out (&HFE),a
ld a,1
out (&HFD),a
ret

So the basic idea is that I temporary exchange the two pages holding my listing and assembler for free space in the other slot. I wrote a little program that basicly shows all the memory occupance on screen for the entire 4 page area and after aplying my little code here I see the expected results. Before: page 1 and 2 nearly fully ocupied. After: nearly 3 pages of free RAM and the BIOS variables intact in page 3.

So I tested this on the older version of my picture viewer and behold!! A full screen picture and my assembler and listing intact afterwards LOL!

Page 3/3
1 | 2 |