Difference between revisions of "No$cart"
(→DOS/AMSDOS patches) |
|||
(10 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
A utility by [[Nocash]] which converts a disk image to a cartridge. | A utility by [[Nocash]] which converts a disk image to a cartridge. | ||
− | The | + | Problems: |
+ | * The generated cartridges do not work on GX4000 or 464Plus | ||
+ | * If there are expansion ROMs then these will be activated when the cart is started which can cause compatibility issues | ||
+ | * The tool is a 16-bit DOS program so doesn't work on new versions of Windows | ||
+ | |||
+ | To solve these problems [[Arnoldemu]] has made a new version [[Nocart]] | ||
In addition if the game/program has any of the following it will not work on GX4000: | In addition if the game/program has any of the following it will not work on GX4000: | ||
Line 7: | Line 12: | ||
* It uses 128K ONLY (or it's a bad "crack" that requires 128K to work even though the game itself would work in 64K). | * It uses 128K ONLY (or it's a bad "crack" that requires 128K to work even though the game itself would work in 64K). | ||
− | However | + | If a game has any of the following then it can't be used from cartridge: |
+ | * Saving progress or hi-scores | ||
+ | * Requires expansion ROMs | ||
+ | * Direct access to disc for loading | ||
+ | * Disk has copy protection. | ||
+ | |||
+ | However the tool is easy for the non-programmer to use. | ||
== No$cart package == | == No$cart package == | ||
The No$cart package (available from the No$cash website) contains: | The No$cart package (available from the No$cash website) contains: | ||
− | * a COM executable file that can be run by DOS/Windows, | + | * a NO$CPC.COM executable file that can be run by DOS/Windows (can't be run on 64-bit windows e.g. windows 8), |
− | * a .ROM file (which contains the OS, BASIC and Amsdos - in theory you can then use your own patched versions) | + | * a NO$CPC.ROM file (which contains the OS, BASIC and Amsdos - in theory you can then use your own patched versions). The ROM is unpatched. The .COM file patches the ROM. |
− | * a readme document. | + | * a NO$CPC.TXT readme document. |
== Technical == | == Technical == | ||
Line 22: | Line 33: | ||
Page 0 is OS. | Page 0 is OS. | ||
Page 1 is BASIC. | Page 1 is BASIC. | ||
− | Page 2 contains | + | Page 2 contains disk image data. |
Page 3 contains AMSDOS. | Page 3 contains AMSDOS. | ||
− | Page 4 | + | Page 4-15 contains disk image data. |
The OS, BASIC and AMSDOS are based on CPC6128 ROMs and have all been patched. | The OS, BASIC and AMSDOS are based on CPC6128 ROMs and have all been patched. | ||
Note that expansion ROMs that have been installed (e.g. replacement AMSDOS such as Parados) on the Plus will override the AMSDOS in the cartridge made by No$cart. So ensure you remove all expansion ROMs before running the cart on the Plus. | Note that expansion ROMs that have been installed (e.g. replacement AMSDOS such as Parados) on the Plus will override the AMSDOS in the cartridge made by No$cart. So ensure you remove all expansion ROMs before running the cart on the Plus. | ||
+ | |||
+ | The tool supports single sided DATA format discs only. The data stored in the cartridge is uncompressed and is a dump of each sector's data ordered by sector ID (&c1 then &c2 then &c3 etc). | ||
+ | |||
+ | Page 2 is the first 32 sectors from the disc which holds the directory and first part of the data. | ||
+ | Page 4-15 contains all the remaining data from the disc. | ||
+ | |||
+ | A single side of a standard DATA format disc is 178K which uses 12 cartridge pages (the last page is not fully used and is padded with FF bytes by No$cart). Therefore No$cart uses a 256KB cartridge to store an entire disk. | ||
+ | |||
+ | The maximum size of uncompressed data that could be stored is 475136 bytes. Two sides of a DATA format disc would be 356K (40 tracks and 2 sides). | ||
+ | It would not be possible to store a double sided 80 track disc. | ||
+ | |||
+ | Discs of other disc formats would need different patched AMSDOS to handle them. | ||
+ | |||
=== OS patches === | === OS patches === | ||
Line 143: | Line 167: | ||
1c00 c314dc jp 0dc14h | 1c00 c314dc jp 0dc14h | ||
− | + | ||
1c03 c35adc jp 0dc5ah ;; os calls this on startup. | 1c03 c35adc jp 0dc5ah ;; os calls this on startup. | ||
;; this is the command to run | ;; this is the command to run | ||
Line 149: | Line 173: | ||
defb &aa ;; command to autorun from basic | defb &aa ;; command to autorun from basic | ||
defb 'RUN"DISC',0 | defb 'RUN"DISC',0 | ||
− | + | ||
defb 'ST2',0 | defb 'ST2',0 | ||
− | + | ||
1c14 f3 di | 1c14 f3 di | ||
1c15 c5 push bc | 1c15 c5 push bc | ||
Line 194: | Line 218: | ||
1c4c fb ei | 1c4c fb ei | ||
1c4d c9 ret | 1c4d c9 ret | ||
− | + | ||
1c4e ed79 out (c),a | 1c4e ed79 out (c),a | ||
1c50 0602 ld b,02h | 1c50 0602 ld b,02h | ||
Line 201: | Line 225: | ||
1c57 ed49 out (c),c | 1c57 ed49 out (c),c | ||
1c59 c9 ret | 1c59 c9 ret | ||
− | + | ||
;; called by OS on startup | ;; called by OS on startup | ||
1c5a cd96dc call 0dc96h ;; unlock plus features | 1c5a cd96dc call 0dc96h ;; unlock plus features | ||
Line 216: | Line 240: | ||
1c77 110040 ld de,4000h ;; plus sprite ram | 1c77 110040 ld de,4000h ;; plus sprite ram | ||
;; unpack pixels into sprite ram | ;; unpack pixels into sprite ram | ||
− | + | ||
1c7a 7e ld a,(hl) ;; read byte containing 2 pixels (one in upper nibble, other in lower nibble) | 1c7a 7e ld a,(hl) ;; read byte containing 2 pixels (one in upper nibble, other in lower nibble) | ||
− | + | ||
1c7b 0f rrca ;; transfer upper nibble into lower nibble | 1c7b 0f rrca ;; transfer upper nibble into lower nibble | ||
1c7c 0f rrca | 1c7c 0f rrca | ||
Line 224: | Line 248: | ||
1c7e 0f rrca | 1c7e 0f rrca | ||
1c7f 12 ld (de),a ;; store in sprite ram | 1c7f 12 ld (de),a ;; store in sprite ram | ||
− | + | ||
1c80 1c inc e ;; update sprite ram pointer | 1c80 1c inc e ;; update sprite ram pointer | ||
1c81 eda0 ldi ;; (DE) = (HL). Writes lower nibble into sprite pixel data. | 1c81 eda0 ldi ;; (DE) = (HL). Writes lower nibble into sprite pixel data. | ||
1c83 03 inc bc | 1c83 03 inc bc | ||
1c84 10f4 djnz 1c7ah ;; loop for more sprite pixels | 1c84 10f4 djnz 1c7ah ;; loop for more sprite pixels | ||
− | + | ||
1c86 1660 ld d,60h ;; plus sprite coordinates and magnification | 1c86 1660 ld d,60h ;; plus sprite coordinates and magnification | ||
1c88 0e0d ld c,0dh ;; (X,Y, magnification for 2 sprites) | 1c88 0e0d ld c,0dh ;; (X,Y, magnification for 2 sprites) | ||
1c8a edb0 ldir | 1c8a edb0 ldir | ||
− | + | ||
1c8c 01a07f ld bc,7fa0h ;; page out plus registers | 1c8c 01a07f ld bc,7fa0h ;; page out plus registers | ||
1c8f ed49 out (c),c | 1c8f ed49 out (c),c | ||
− | + | ||
;; lock plus | ;; lock plus | ||
1c91 0110bc ld bc,0bc10h | 1c91 0110bc ld bc,0bc10h | ||
1c94 1803 jr 1c99h | 1c94 1803 jr 1c99h | ||
− | + | ||
1c96 0111bc ld bc,0bc11h | 1c96 0111bc ld bc,0bc11h | ||
1c99 21a4dc ld hl,0dca4h ;; plus unlock sequence | 1c99 21a4dc ld hl,0dca4h ;; plus unlock sequence | ||
Line 249: | Line 273: | ||
1ca1 20f9 jr nz,1c9ch | 1ca1 20f9 jr nz,1c9ch | ||
1ca3 c9 ret | 1ca3 c9 ret | ||
− | + | ||
;; plus unlock sequence | ;; plus unlock sequence | ||
1ca4 | 1ca4 | ||
defb &ff,&00,&ff,&77,&b3,&51,&a8,&d4,&62,&39,&9c,&46,&2b,&15,&8a,&cd,&ee | defb &ff,&00,&ff,&77,&b3,&51,&a8,&d4,&62,&39,&9c,&46,&2b,&15,&8a,&cd,&ee | ||
− | + | ||
1cb5: | 1cb5: | ||
defw &07 | defw &07 | ||
Line 261: | Line 285: | ||
;; sprite pixels | ;; sprite pixels | ||
1cbd defb &1 | 1cbd defb &1 | ||
− | + | ||
;; &1cbe-&1dbc is 0 | ;; &1cbe-&1dbc is 0 | ||
defs 254 | defs 254 | ||
− | + | ||
1dbd 04 inc b | 1dbd 04 inc b | ||
1dbe 00 nop | 1dbe 00 nop | ||
Line 277: | Line 301: | ||
== Links == | == Links == | ||
− | * http:// | + | * http://problemkaputt.de |
− | * http:// | + | * http://problemkaputt.de/no$cart.htm |
+ | |||
+ | [[Category:Software]] |
Latest revision as of 15:32, 19 February 2018
A utility by Nocash which converts a disk image to a cartridge.
Problems:
- The generated cartridges do not work on GX4000 or 464Plus
- If there are expansion ROMs then these will be activated when the cart is started which can cause compatibility issues
- The tool is a 16-bit DOS program so doesn't work on new versions of Windows
To solve these problems Arnoldemu has made a new version Nocart
In addition if the game/program has any of the following it will not work on GX4000:
- It uses keyboard or requires keyboard input to get into the game
- It uses 128K ONLY (or it's a bad "crack" that requires 128K to work even though the game itself would work in 64K).
If a game has any of the following then it can't be used from cartridge:
- Saving progress or hi-scores
- Requires expansion ROMs
- Direct access to disc for loading
- Disk has copy protection.
However the tool is easy for the non-programmer to use.
Contents
No$cart package
The No$cart package (available from the No$cash website) contains:
- a NO$CPC.COM executable file that can be run by DOS/Windows (can't be run on 64-bit windows e.g. windows 8),
- a NO$CPC.ROM file (which contains the OS, BASIC and Amsdos - in theory you can then use your own patched versions). The ROM is unpatched. The .COM file patches the ROM.
- a NO$CPC.TXT readme document.
Technical
The created cartridge image has the OS, BASIC and Amsdos embedded in it and the data from the disk image (tracks/sectors).
Page 0 is OS. Page 1 is BASIC. Page 2 contains disk image data. Page 3 contains AMSDOS. Page 4-15 contains disk image data.
The OS, BASIC and AMSDOS are based on CPC6128 ROMs and have all been patched.
Note that expansion ROMs that have been installed (e.g. replacement AMSDOS such as Parados) on the Plus will override the AMSDOS in the cartridge made by No$cart. So ensure you remove all expansion ROMs before running the cart on the Plus.
The tool supports single sided DATA format discs only. The data stored in the cartridge is uncompressed and is a dump of each sector's data ordered by sector ID (&c1 then &c2 then &c3 etc).
Page 2 is the first 32 sectors from the disc which holds the directory and first part of the data. Page 4-15 contains all the remaining data from the disc.
A single side of a standard DATA format disc is 178K which uses 12 cartridge pages (the last page is not fully used and is padded with FF bytes by No$cart). Therefore No$cart uses a 256KB cartridge to store an entire disk.
The maximum size of uncompressed data that could be stored is 475136 bytes. Two sides of a DATA format disc would be 356K (40 tracks and 2 sides). It would not be possible to store a double sided 80 track disc.
Discs of other disc formats would need different patched AMSDOS to handle them.
OS patches
The OS ROM has been patched in the following way:
- Offset &67D has changed from:
call &0723 call &06fc ld hl,&0688 jr &6fc
to:
call &b900 ;; enable upper rom ld bc,&df07 ;; select upper rom (7 - normally DOS/AMSDOS) out (c),c jp &dc03 ;; call into DOS/AMSDOS rom
- Offset: &1052 and &1053 which define the first 2 colours of the "1st" palette have been changed from &04 to &14. The "1st" and "2nd" palette are swapped between in BASIC to implement flashing colours. &04 is blue. &14 is black.
- Offset: &1063 and &1064 which define the first 2 colours of the palette "2nd" palette have been changed from &04 to &14. The "1st" and "2nd" palette are swapped between in BASIC to implement flashing colours. &04 is blue, &14 is black.
When the OS starts, the colours are set to black and code patched into the DOS/AMSDOS rom is executed.
BASIC patches
The BASIC ROM has been patched in the following way:
- Offset &33 has been set to 0. It is the first character of " BASIC 1.1" text.
This stops the BASIC ROM from printing this text.
- Offset &D7 has been set to 0. It is the first character of "Ready" text. This stops the BASIC ROM from printing this text.
- At offset &af9, the code has been changed from:
LD HL,&ac8a
to
CALL &d583
- Part of the text "Random number seed ?" at offset &1583 (&D583 in the CPU address space) has been patched with the following code which will autotype a command into basic:
ld hl,&ac8a ld a,&aa cp (hl) ret nz pop af ld (hl),' ' scf ret
When BASIC is started the sign on messages are not displayed, and it auto runs a command-line.
DOS/AMSDOS patches
The DOS/AMSDOS rom has been patched in the following way:
- At offset &56D instead of:
CALL &c976
there is:
ld a,&c1 jr &c581
- At offset &62D instead of:
CALL &c638
there is:
scf ret defb &c6
- At offset &64D instead of:
ld a,&45
there is:
scf ret
- At offset &652 instead of:
ld a,&4d
there is:
scf ret
- At offset &666 instead of:
call &c976
there is:
jp &dc00
- At offset &763 instead of:
CALL &c976
there is:
SCF RET
- At offset &1c00 the following code has been added (on CPC this is filled with 0x0ff):
1c00 c314dc jp 0dc14h 1c03 c35adc jp 0dc5ah ;; os calls this on startup. ;; this is the command to run 1c06: defb &aa ;; command to autorun from basic defb 'RUN"DISC',0 defb 'ST2',0 1c14 f3 di 1c15 c5 push bc 1c16 d5 push de 1c17 e5 push hl 1c18 e5 push hl 1c19 79 ld a,c 1c1a e60f and 0fh 1c1c 3d dec a 1c1d 82 add a,d 1c1e 5f ld e,a 1c1f 2600 ld h,00h 1c21 6a ld l,d 1c22 54 ld d,h 1c23 29 add hl,hl 1c24 29 add hl,hl 1c25 29 add hl,hl 1c26 19 add hl,de 1c27 29 add hl,hl 1c28 7d ld a,l 1c29 f6c0 or 0c0h 1c2b 57 ld d,a 1c2c 1e00 ld e,00h 1c2e 29 add hl,hl 1c2f 29 add hl,hl 1c30 7c ld a,h 1c31 d5 push de 1c32 214edc ld hl,0dc4eh 1c35 1144be ld de,0be44h 1c38 010c00 ld bc,000ch 1c3b edb0 ldir 1c3d fe01 cp 01h 1c3f de7d sbc a,7dh 1c41 e1 pop hl 1c42 d1 pop de 1c43 06df ld b,0dfh 1c45 cd44be call 0be44h 1c48 e1 pop hl 1c49 d1 pop de 1c4a c1 pop bc 1c4b 37 scf 1c4c fb ei 1c4d c9 ret 1c4e ed79 out (c),a 1c50 0602 ld b,02h 1c52 edb0 ldir 1c54 0107df ld bc,0df07h ;; select disc rom 1c57 ed49 out (c),c 1c59 c9 ret ;; called by OS on startup 1c5a cd96dc call 0dc96h ;; unlock plus features 1c5d 01b87f ld bc,7fb8h ;; page in plus registers 1c60 ed49 out (c),c 1c62 2106dc ld hl,0dc06h 1c65 118aac ld de,0ac8ah ;; setup command for basic. 1c68 010e00 ld bc,000eh 1c6b edb0 ldir 1c6d 21b5dc ld hl,0dcb5h ;; location of stored palette 1c70 112264 ld de,6422h ;; plus sprite palette in plus registers 1c73 0e08 ld c,08h ;; 2*4 (2 bytes per palette entry, 4 entries) 1c75 edb0 ldir 1c77 110040 ld de,4000h ;; plus sprite ram ;; unpack pixels into sprite ram 1c7a 7e ld a,(hl) ;; read byte containing 2 pixels (one in upper nibble, other in lower nibble) 1c7b 0f rrca ;; transfer upper nibble into lower nibble 1c7c 0f rrca 1c7d 0f rrca 1c7e 0f rrca 1c7f 12 ld (de),a ;; store in sprite ram 1c80 1c inc e ;; update sprite ram pointer 1c81 eda0 ldi ;; (DE) = (HL). Writes lower nibble into sprite pixel data. 1c83 03 inc bc 1c84 10f4 djnz 1c7ah ;; loop for more sprite pixels 1c86 1660 ld d,60h ;; plus sprite coordinates and magnification 1c88 0e0d ld c,0dh ;; (X,Y, magnification for 2 sprites) 1c8a edb0 ldir 1c8c 01a07f ld bc,7fa0h ;; page out plus registers 1c8f ed49 out (c),c ;; lock plus 1c91 0110bc ld bc,0bc10h 1c94 1803 jr 1c99h 1c96 0111bc ld bc,0bc11h 1c99 21a4dc ld hl,0dca4h ;; plus unlock sequence 1c9c 7e ld a,(hl) 1c9d ed79 out (c),a 1c9f 23 inc hl 1ca0 0d dec c 1ca1 20f9 jr nz,1c9ch 1ca3 c9 ret ;; plus unlock sequence 1ca4 defb &ff,&00,&ff,&77,&b3,&51,&a8,&d4,&62,&39,&9c,&46,&2b,&15,&8a,&cd,&ee 1cb5: defw &07 defw &0f defw &077f defw &0fff ;; sprite pixels 1cbd defb &1 ;; &1cbe-&1dbc is 0 defs 254 1dbd 04 inc b 1dbe 00 nop 1dbf 010009 ld bc,0900h 1dc2 00 nop 1dc3 00 nop 1dc4 00 nop 1dc5 24 inc h 1dc6 00 nop 1dc7 010009 ld bc,0900h