> What's the fastest way to load say a screen 8 file into VRAM using MSX-DOS
> and a 16KB max buffer? Which file reading function, register size, buffer
> address are the best?

I have attached a sample of my diskroutines, it is fast, at least a lot
faster than the diskroutine you used in your overscan-demo.

It might contain an error because it didn't work in my SA-source, where I
took it from, but I think the error is in the memorymap-routines and not in
this routine, because it DID work until I recently changed the
memmap-routines...


> How can you feed VRAM in a reasonable system friendly way while keeping
> disk performance as the next section of the file is being read?

You probably use a routine like this to move the data to the VRAM:

    ld    bc,#4000
    ld    hl,ImageData
Loop:
    ld    a,(hl)
    out  (#98),a
    inc  hl
    dec bc
    ld    a,b
    or    c
    jp    nz,Loop

Just use the Fast 16-bit Loop I use in my routines instead of this one and
the VRAM loading will go a lot faster. It is a bit complicated to understand
(I wrote an article in Dutch about it), but it does work and is as fast as a
'normal' 8-bit OTIR.


> Does having BIOS + DISK-ROM already living at 0000-7FFF have an impact on
> performance?

??? Ummm... I don't think so but I'm not sure.


> Much too used to step motors and head settling times I guess...
>
> Bad habits?

Sounds like it, yes.


~Grauw "Have you already got a photo online?"


--
>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<
email: [EMAIL PROTECTED] or ICQ: 10196372
Visit the Datax homepage at http://datax.cjb.net/
                ... Live long and prosper...
>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<

;
;=============================================================================
;= Example  ==================================================================
;=============================================================================
;
;For the graphics I use a raw data format; a dump of the VRAM.
;  (A BSAVEd file without the 7-byte header).
;  (you can make it BSAVE-compatible by inserting 
;   LD  HL,7 : call Read_File right after the Open_File-call...) 
;
;It is a really fast loader...
;
;Example call which loads the image LOADING.SCR into the VRAM
;
Start:  ld      hl,LOADING
        call    Set_FileName    ;Put filename into FCB
        ld      a,2             ;page 2 of scr5 = page 1 of scr8
        ld      hl,0            ;
        ld      bc,212*256      ;Nr. of bytes
        call    Load_Screen     ;Load the screen
        ret


;
;=============================================================================
;Diskaccess ==================================================================
;=============================================================================
;
;Load file from disk to VRAM.
;Filename in FCB (using routine SetFileName),
;VRAM startadress in HL, VRAM pagenr. in A.
;Nr. of bytes in BC.
;
;It uses page 1 (#4000-#7FFF as temporary page).
;
Load_Screen:
        rl      h
        rl      h
        rl      a
        srl     h
        srl     h
        di
        out     (#99),a
        ld      a,14+128
        out     (#99),a
        nop
        ld      a,l
        out     (#99),a
        ld      a,h
        or      64
        out     (#99),a
        ei
        push    bc
        ld      de,#4000        ;Set DMA (DTA)
        call    Set_DMA
        call    Open_File
        pop     de      ;Nr. of bytes into DE

Load_Screen1:
        ld      a,d
        sub     #40     ;-#4000
        jp      c,Load_ScrNext  ;Jump if less than 16k left to load.
        ld      d,a
        push    de
        ex      de,hl
        call    Read_File
        pop     de
        ld      a,#3F   ;Repeat #4000 times...
        ld      bc,#0098
        ld      hl,#4000
Load_Screen2:
        otir            ;Fast loop #4000 bytes
        dec     a
        jp      nz,Load_Screen2
        jp      Load_Screen1
;
Load_ScrNext:
        ld      a,d
        or      e       ;If 0 bytes left then end
        jp      z,Load_ScrEnd
        push    de
        ex      de,hl   ;LD  HL,DE...
        call    Read_File
        pop     de
        ld      a,e
        ld      b,e
        sub     1       ;If 0, then set carry
        ld      a,d
        sbc     0       ;if B=E=0 then A=D-1 (for fast loop)
        ld      c,#98   ;  else A=D
        ld      hl,#4000
Load_Screen3:
        otir            ;Fast loop DE bytes...
        dec     a
        jp      nz,Load_Screen3
Load_ScrEnd:
        call    Close_File
        ret


;
;====================
;Disk OS routines
;
;
;Set the Disk Transer Adress to DE.
;
Set_DMA:
        ld      c,26    ;Set DMA (DTA)
        jp      Bdos

;
;Set the filename on adress (HL) into the FCB.
;
Set_FileName:
        ld      de,FILENAME
        ld      bc,11
        ldir
        ret

;
;Open the file in the FCB.
;
Open_File:      ld      de,FCB  ;Open File
        ld      c,15
        call    Bdos
        and     a
        jp      nz,DiskError
        xor     a
        ld      (RECORDNR),a
        ld      (RECORDNR+1),a
        ld      (RECORDNR+2),a
        ld      hl,1
        ld      (RECORDLENGTH),hl
        ret

;
;Lees HL bytes in uit het geopende FCB.
;
Read_File:
        ld      de,FCB
        ld      c,39
        call    Bdos
        and     a
        jp      nz,DiskError
        ret

;
;Sluit geopend FCB en stop de disk.
;
Close_File:
        ld      de,FCB
        ld      c,16
        call    Bdos
        and     a
        jp      nz,DiskError
        ret





;
;=============================================================================
;Data's ======================================================================
;=============================================================================
;
;
;Data
;
LOADING:        DB      "LOADING SCR"

;
FCB:    DB      0
FILENAME:       DB      "filenaamext"
BLOCK:  DW      #00
RECORDLENGTH:   DW      #00
FILELENGTH:     DW      #00,#00
SYSTEMVAR:      DW      #00,#00,#00,#00,#00,#00
        DB      0
RECORDNR:       DW      #00,#00

Reply via email to