|
|
1.1 root 1: /*
2: Hatari
3:
4: Cartridge Pexec program
5:
6: To load programs into memory, through TOS, we need to intercept GEMDOS so we can
7: relocate/execute programs via GEMDOS call $4B(PExec).
8: We have some 68000 assembler, located at 0xFA1000(cartridge memory), which is used as our
9: new GEMDOS handler. This checks if we need to intercept the call.
10: You'll notice PaCifiST has a 'cartridge' icon on screen, which contains a program called
11: 'Don't run me' - this is a similar routine used for loading.
12: This assembler routine needs modifying according to the TOS image we have selected to ensure
13: compatibility with the rest of TOS(TOS assumes the disc sector is read into a set workspace
14: address)
15:
16: The assembler routine is called 'cart.s', and has been converted to a byte array and stored
17: in 'cartimg.c'.
18: */
19:
20: #include "main.h"
21: #include "cart.h"
1.1.1.2 root 22: #include "tos.h"
1.1 root 23: #include "m68000.h"
24: #include "misc.h"
25: #include "stMemory.h"
1.1.1.2 root 26: #include "gemdos.h"
1.1 root 27: #include "cartimg.c" /* Cartridge program used as inferface to PC system */
28:
29:
30: /*-----------------------------------------------------------------------*/
31: /*
32: Load ST GEMDOS intercept program image into cartridge memory space
33: This is used as an interface to the PC file system and for GemDOS
34: */
35: void Cart_LoadImage(void)
36: {
1.1.1.2 root 37: /* Copy cartrige header into ST's cartridge memory */
38: memcpy((char *)STRam+0xFA0000,cart_hdr,sizeof(cart_hdr));
39:
1.1 root 40: /* Copy 'cart.img' file into ST's cartridge memory */
41: memcpy((char *)STRam+0xFA1000,cart_img,sizeof(cart_img));
1.1.1.2 root 42:
1.1 root 43: }
44:
45:
46: /*-----------------------------------------------------------------------*/
47: /*
48: Modify program loaded into cartridge memory to set where load sectors from disc image -
49: this value MUST correspond with where the TOS version assumes it will be loaded
50:
51: We can find this by looking for hdv_boot function(see tos.cpp),move.l <addr>,$47A(a5)
52: and then follow code for move.l #<value>,-(sp) and jsr <floprd>
53: */
54: void Cart_WriteHdvAddress(unsigned short int HdvAddress)
55: {
1.1.1.2 root 56: STMemory_WriteWord(CART_HDV_ADDR_1,HdvAddress);
57: STMemory_WriteWord(CART_HDV_ADDR_2,HdvAddress);
1.1 root 58: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.