|
|
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 "decode.h"
24: #include "m68000.h"
25: #include "misc.h"
26: #include "stMemory.h"
1.1.1.2 ! root 27: #include "gemdos.h"
1.1 root 28: #include "cartimg.c" /* Cartridge program used as inferface to PC system */
29:
30:
31: /*-----------------------------------------------------------------------*/
32: /*
33: Load ST GEMDOS intercept program image into cartridge memory space
34: This is used as an interface to the PC file system and for GemDOS
35: */
36: void Cart_LoadImage(void)
37: {
1.1.1.2 ! root 38: /* Copy cartrige header into ST's cartridge memory */
! 39: memcpy((char *)STRam+0xFA0000,cart_hdr,sizeof(cart_hdr));
! 40:
1.1 root 41: /* Copy 'cart.img' file into ST's cartridge memory */
42: memcpy((char *)STRam+0xFA1000,cart_img,sizeof(cart_img));
1.1.1.2 ! root 43:
1.1 root 44: }
45:
46:
47: /*-----------------------------------------------------------------------*/
48: /*
49: Modify program loaded into cartridge memory to set where load sectors from disc image -
50: this value MUST correspond with where the TOS version assumes it will be loaded
51:
52: We can find this by looking for hdv_boot function(see tos.cpp),move.l <addr>,$47A(a5)
53: and then follow code for move.l #<value>,-(sp) and jsr <floprd>
54: */
55: void Cart_WriteHdvAddress(unsigned short int HdvAddress)
56: {
1.1.1.2 ! root 57: STMemory_WriteWord(CART_HDV_ADDR_1,HdvAddress);
! 58: STMemory_WriteWord(CART_HDV_ADDR_2,HdvAddress);
1.1 root 59: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.