How to load a +3 dos file from disk to memory in z80

edited February 2014 in Development
Hi all again,

Are there any example z80 code listings (not BASIC) to load a +3 binary dos file from disk to a specific memory destination?

Thanks.
Post edited by Speccy_James on

Comments

  • edited February 2014
    In the Compendium, file Plus3.TXT, section "+3 BASIC DOS_Demo". This provides 19 DOS functions from a BASIC menu. The assembler listing in the accompanying ZIP file shows how to code them in assembler.
  • edited February 2014
    - duplicate deleted - (The page was taking so long to refresh that I went back to do it again and ended up with getting it posted twice.)
  • edited February 2014
    In the Compendium, file Plus3.TXT, section "+3 BASIC DOS_Demo". This provides 19 DOS functions from a BASIC menu. The accompanying assembler listing shows how to code them in assembler.

    Great thanks again.

    I can see at the end of Plus3.TXT you have the assembly listing for "+3e Load & Run from Assembler" to load & run a BASIC program saved with an auto-LINE number and return to BASIC afterwards. Will it be the same principal to load a binary file into a memory range?


    ** I missed the zip file you were refering to previously, I've got it now.
  • edited February 2014
    There's more to it then I expected there, I thought it would be setting up the file name and then some rom calls to do this. I have some learning to do.
  • edited February 2014
    The DOS LOAD routine ultimately does similar things at a low level, but it goes about it in an entirely different way from other types of disk file access. The SAVE & LOAD routines are in a different ROM from all the other DOS routines, the parameters are set up differently, it uses reserved file numbers, and the return procedure is different. Apart from that ...

    There's a simple example of using the DOS routines on page 201 of the +3 manual. All the routines are comprehensively described from page 223 onwards.
  • ZupZup
    edited February 2014
    In this thread I made a "generic" loader capable of loading chunks of data into memory.

    My loader has evolved (to include compressed blocks, jump to a position and pauses between blocks), but still works the same:

    - Page +3DOS (that means ROM2, RAM5, RAM2, RAM 7)
    - (Optional) Set cache size
    - Open file
    - (Optional) Set file position (seek)
    - Read data
    - (Optional) Do more things with file
    - Close file
    - Page BASIC (that means ROM3, RAM5, RAM2, RAM 0)

    But remember some important things:
    - If you're going to load data into the start of RAM1, cache size must set to zero to prevent data corruption in RAM1.
    - You should check for errors every time after a DOS call.
    - Loading data into RAM7 should be avoided or your computer may hang/reset (it's not entirely true... there are places where you can store data).
    - You may do a DOS call with or without interrupts enabled, but interrupts will be enabled after that.
    I was there, too
    An' you know what they said?
    Well, some of it was true!
  • edited February 2014
    Zup wrote: »
    In this thread I made a "generic" loader capable of loading chunks of data into memory.

    My loader has evolved (to include compressed blocks, jump to a position and pauses between blocks), but still works the same:

    - Page +3DOS (that means ROM2, RAM5, RAM2, RAM 7)
    - (Optional) Set cache size
    - Open file
    - (Optional) Set file position (seek)
    - Read data
    - (Optional) Do more things with file
    - Close file
    - Page BASIC (that means ROM3, RAM5, RAM2, RAM 0)

    But remember some important things:
    - If you're going to load data into the start of RAM1, cache size must set to zero to prevent data corruption in RAM1.
    - You should check for errors every time after a DOS call.
    - Loading data into RAM7 should be avoided or your computer may hang/reset (it's not entirely true... there are places where you can store data).
    - You may do a DOS call with or without interrupts enabled, but interrupts will be enabled after that.

    Thanks bud, I'll read through it.
Sign In or Register to comment.