|
|
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" ! 22: #include "decode.h" ! 23: #include "m68000.h" ! 24: #include "misc.h" ! 25: #include "stMemory.h" ! 26: ! 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: { ! 37: /* Copy 'cart.img' file into ST's cartridge memory */ ! 38: memcpy((char *)STRam+0xFA1000,cart_img,sizeof(cart_img)); ! 39: } ! 40: ! 41: ! 42: /*-----------------------------------------------------------------------*/ ! 43: /* ! 44: Modify program loaded into cartridge memory to set where load sectors from disc image - ! 45: this value MUST correspond with where the TOS version assumes it will be loaded ! 46: ! 47: We can find this by looking for hdv_boot function(see tos.cpp),move.l <addr>,$47A(a5) ! 48: and then follow code for move.l #<value>,-(sp) and jsr <floprd> ! 49: */ ! 50: void Cart_WriteHdvAddress(unsigned short int HdvAddress) ! 51: { ! 52: STMemory_WriteWord(CART_HDV_ADDR_1,HdvAddress); ! 53: STMemory_WriteWord(CART_HDV_ADDR_2,HdvAddress); ! 54: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.