]> git.sur5r.net Git - cc65/blob - libsrc/cbm/cbm_load.c
695af504b61d0829e5ba7daa05c5738d9f256d0d
[cc65] / libsrc / cbm / cbm_load.c
1 /*
2 ** Marc 'BlackJack' Rintsch, 06.03.2001
3 **
4 ** unsigned int cbm_load(const char* name,
5 **                       unsigned char device,
6 **                       const unsigned char* data);
7 */
8
9 #include <cbm.h>
10
11 /* loads file "name" from given device to given address or to the load address
12 ** of the file if "data" is 0
13 */
14 unsigned int cbm_load(const char* name, unsigned char device, void* data)
15 {
16     /* LFN is set to 0; but, it's not needed for loading
17     ** (BASIC V2 sets it to the value of the SA for LOAD).
18     */
19     cbm_k_setlfs(0, device, data == 0);
20     cbm_k_setnam(name);
21     return (cbm_k_load(0, (unsigned int)data) - (unsigned int)data);
22 }