Jump to content
IGNORED

Challenge: Optimize this header...


acadiel
 Share

Recommended Posts

Short... I'm trying to make a 128K EPROM image with Fred's awesome disk utilities all in one EPROM (all selectable from the menu.)

 

Fred's programs are "copy to 32K and run", which works rather well. I can do this with almost an EA/5 program thanks to some initial advice/code from Tursi.

 

I have managed to "adapt" my header code to work with DM2K and CF2K to put them both in a 64K Cart, but I'm trying to add DU2K. Problem: The code for the three program header is >60 bytes too long. I need it to stop before >1B0 when compiled into a PROGRAM image, and instead, it stops at >210. The "two program" header (i.e. I cut out the DU2K chunk of the code) stops at >1A0, so it would work...

 

* THREE PROGRAM HEADER FOR 128K BANKED
* SWITCHED CART
      DEF SFIRST,SLAST,SLOAD
      UNL
* ROM HEADER
      AORG >6000
SFIRST EQU $
SLOAD  EQU $
GRMHDR BYTE >AA,1,1,0,0,0
      DATA PROG
      BYTE 0,0,0,0,0,0,0,0
PROG   DATA PROG2
      DATA CF2K
      BYTE 8
      TEXT 'CF2K 1.4'
      EVEN
PROG2  DATA PROG3
      DATA DM2K
      BYTE 8
      TEXT 'DM2K 1.4'
      EVEN
PROG3  DATA 0
      DATA DU2K
      BYTE 8
      TEXT 'DU2K 2.0'
      EVEN
MINIT  EQU $
      LWPI >8300

***************
* CF2K Module *
***************
CF2K   BL @GOGO * Set up Char Sets

* >6000 (highest bank)
      LI R7,>6000       * BANK TO SELECT
      LI R4,>076A       * BYTES DIV 4
      LI R9,>6258       * ADDRESS TO COPY FROM
      LI R10,>A000      * ADDRESS TO COPY TO
      BL @COPYME        * COPY IT!

* >6002 (2nd highest bank)
      LI R7,>6002       * BANK TO SELECT
      LI R4,>076A       * BYTES DIV 4
      LI R9,>6258       * ADDRESS TO COPY FROM
      LI R10,>BDA8      * ADDRESS TO COPY TO
      BL @COPYME        * COPY IT!

* >6004 (3rd highest bank)
      LI R7,>6004       * BANK TO SELECT
      LI R4,>076A       * BYTES DIV 4
      LI R9,>6258       * ADDRESS TO COPY FROM
      LI R10,>DB50      * ADDRESS TO COPY TO
      BL @COPYME        * COPY IT!

* >6006 (4th highest bank)
      LI R7,>6006       * BANK TO SELECT
      LI R4,>04C0       * BYTES DIV 4
      LI R9,>6D00       * ADDRESS TO COPY FROM
      LI R10,>2000      * ADDRESS TO COPY TO
      BL @COPYME        * COPY IT!

* ALRIGHT, WE'RE DONE.  LET'S GO!

      B @>A000

***************
* DM2K Module *
***************
DM2K    BL @GOGO  * Set up Char Sets

* >6008 (5th highest bank)
      LI R7,>6008       * BANK TO SELECT
      LI R4,>072A       * BYTES DIV 4
      LI R9,>6358       * ADDRESS TO COPY FROM
      LI R10,>A000      * ADDRESS TO COPY TO
      BL @COPYME        * COPY IT!

* >600A (6th highest bank)
      LI R7,>600A       * BANK TO SELECT
      LI R4,>072A       * BYTES DIV 4
      LI R9,>6358       * ADDRESS TO COPY FROM
      LI R10,>BCA8      * ADDRESS TO COPY TO
      BL @COPYME        * COPY IT!

* >600C (7th highest bank)
      LI R7,>600C       * BANK TO SELECT
      LI R4,>072A       * BYTES DIV 4
      LI R9,>6358       * ADDRESS TO COPY FROM
      LI R10,>D950      * ADDRESS TO COPY TO
      BL @COPYME        * COPY IT!

* >600E (8th highest bank)
      LI R7,>600E       * BANK TO SELECT
      LI R4,>072A       * BYTES DIV 4
      LI R9,>7400       * ADDRESS TO COPY FROM
      LI R10,>2000      * ADDRESS TO COPY TO
      BL @COPYME        * COPY IT!

* ALRIGHT, WE'RE DONE.  LET'S GO!

      B @>A000

***************
* DU2K Module *
***************
DU2K    BL @GOGO 

* >6008 (5th highest bank)
      LI R7,>6010       * BANK TO SELECT
      LI R4,>0794       * BYTES DIV 4
      LI R9,>61B0       * ADDRESS TO COPY FROM
      LI R10,>A000      * ADDRESS TO COPY TO
      BL @COPYME        * COPY IT!

* >600A (6th highest bank)
      LI R7,>6012       * BANK TO SELECT
      LI R4,>0794       * BYTES DIV 4
      LI R9,>61B0       * ADDRESS TO COPY FROM
      LI R10,>BE50      * ADDRESS TO COPY TO
      BL @COPYME        * COPY IT!

* >600C (7th highest bank)
      LI R7,>6014       * BANK TO SELECT
      LI R4,>0794       * BYTES DIV 4
      LI R9,>61B0       * ADDRESS TO COPY FROM
      LI R10,>DCA0      * ADDRESS TO COPY TO
      BL @COPYME        * COPY IT!

* >600E (8th highest bank)
      LI R7,>6016       * BANK TO SELECT
      LI R4,>0794       * BYTES DIV 4
      LI R9,>7000       * ADDRESS TO COPY FROM
      LI R10,>2000      * ADDRESS TO COPY TO
      BL @COPYME        * COPY IT!

* ALRIGHT, WE'RE DONE.  LET'S GO!

      B @>A000

****************
* Copy Routine *
****************
* R4  - Bytes Div 4
* R7  - Bank switch address
* R8  - Return for BL @COPYME
* R9  - Address to copy from
* R10 - Address to copy to
* R11 - Return spot, save it to R8

COPYME
   MOV R11,R8   * Save our Return Spot
   MOV R0,@R7   * Do the bank switch
LOOPIT
   MOV *R9+,*R10+
   MOV *R9+,*R10+
   DEC R4       
   JNE LOOPIT
   B *R8         * We're done.

****************************
* Load lower case charsets *
****************************
* Entry point here - ideally put this code first in your ROM
* load R3 with 6 for 99/4, or 7 for 99/4A
GOGO
MOV R11,R9   * Save our return spot
CLR R0
BL @GPLSET
BL @GETGPL   * read GROM >0000
LI R3,7
CI R0,>AA01  * 99/4 is AA01, all versions of 99/4A seem to be AA02 (even 2.2!)
JNE IS4A     * note we also assume unknown is 99/4A just to be safe
DEC R3

* make a copy of the capitals for the 99/4 to 'support' lowercase
* this will be partially overwritten by the main set, but it works!
LI R0,>0018  * GPL vector address
LI R1,>4A00  * dest in VDP - must OR with >4000 for write
LI R2,>0040  * how many chars
BL @GPLVDP   * this function goes somewhere later in your ROM
JMP MNSET

IS4A
* 'lowercase' letters
LI R0,>004A  * GPL vector address (not available for 99/4)
LI R1,>4B00  * dest in VDP - must OR with >4000 for write
LI R2,>001F  * how many chars
BL @GPLVDP   * this function goes somewhere later in your ROM

* main set
MNSET
LI R0,>0018  * GPL vector address
LI R1,>4900  * dest in VDP - must OR with >4000 for write
LI R2,>0040  * how many chars
BL @GPLVDP   * this function goes somewhere later in your ROM
B *R9        * RETURN TO CALLER

*****************
* GROM routines *
*****************
* Set GROM address
GPLSET
MOVB R0,@>9C02
SWPB R0
MOVB R0,@>9C02
B *R11

* Get a word from GPL
GETGPL
MOVB @>9800,R0
SWPB R0
MOVB @>9800,R0
SWPB R0
B *R11

* Copy R2 characters from a GPL copy function vectored at
* R0 to VDP R1. GPL vector must be a B or BR and
* the first actual instruction must be a DEST with an
* immediate operand. Set R3 to 6 for 99/4 (6 byte characters)
* or 7 for a 99/4A (7 byte characters)
GPLVDP
MOV R11,R10    * save return address
BL @GPLSET     * set GROM address
BL @GETGPL     * Get branch instruction (not verified!)
ANDI R0,>1FFF  * mask out instruction part
AI R0,3        * skip instruction and destination
BL @GPLSET     * set new GROM address
BL @GETGPL     * get actual address of the table
BL @GPLSET     * and set that GROM address - GROM is now ready!

SWPB R1        * assume VDP is already prepared for write to save space
MOVB R1,@>8C02
SWPB R1
MOVB R1,@>8C02 * VDP is now ready!

CLR R0

LP8
MOVB R0,@>8C00 * pad the top of the char with a space
MOV R3,R0      * then copy 7 (or 6) bytes
CI R3,6        * check for 99/4
JNE LP9
MOVB R0,@>8C00 * extra blank line for 99/4

LP9
MOVB @>9800,@>8C00  * copy a byte (both sides autoincrement)
DEC R0
JNE LP9

DEC R2         * next character
JNE LP8

B *R10

FINISH EQU $
SLAST  END

 

I've attached the 64K EPROM image for DM2K and CF2K, as well as the compiled PROGRAM image for both the 3 and 2 bank headers.

DM2K_CF2K.bin

HEADER2.BIN

HEADER3_PROGS.BIN

Link to comment
Share on other sites

What if you re-order the routines so that the common routines are at the start of your code and each 32K bank has only the respective four COPY routines for its bank? Your header could start by branching to GOGO to set up the environment, which could then bank to the proper bank, then continue execution to the COPY statements for the proper block. You'd have to store R0 somehow at the start of GOGO, if I read the code correctly. (though I'm not sure how R0 is properly set before the COPYME routine - I must be missing something there).

 

you can save 2 bytes in COPYME by eliminating the extra MOV and adjusting your copy counter.

 

;)

 

If I count correctly, you'll save approx >A0 bytes if the changes above are effective.

 

tim

Link to comment
Share on other sites

R0 is simply being used to make a write to ROM to do the bank switch. There can be any value in R0 (from what I understand) - what counts is you are writing to a specific ROM address for the bank switch to happen.

 

So, from what I'm understanding is that I should only have one copy of the values for each module's headers - since the values/instructions are the same across all three modules, it shouldn't matter that I perform a bank switch; it's going to pick up from the bank I'm in, and the length for those instructions will be the same?

 

How would you set up the entry points in the header this way?

Link to comment
Share on other sites

R0 is simply being used to make a write to ROM to do the bank switch. There can be any value in R0 (from what I understand) - what counts is you are writing to a specific ROM address for the bank switch to happen.

 

So, from what I'm understanding is that I should only have one copy of the values for each module's headers - since the values/instructions are the same across all three modules, it shouldn't matter that I perform a bank switch; it's going to pick up from the bank I'm in, and the length for those instructions will be the same?

 

How would you set up the entry points in the header this way?

 

 

I'm sure there are other ways to skin this cat ;) I assumed each bank must contain the stub because you don't know the initial bank at startup, hence the header and GOGO routine are up front. I modified COPYME to use data statements to conserve space. And hopefully no errors crept into what I typed.

 

* HEADER

* GOGO routine

 

****COPYME

**** MOV R11,R8 * Save our Return Spot (not needed unless we branch outside this routine)

**** MOV R0,@R7 * Do the bank switch (how did @R7 work?)

 

COPYME

MOV *R11+,R7 bank address

MOV *R11+,R4 count

MOV *R11+,R9 source

MOV *R11+,R10 dest

MOV R7,*R7 set the bank

LOOPIT

MOV *R9+,*R10+ *could eliminate a MOV if we double the R4 count

MOV *R9+,*R10+

DEC R4

JNE LOOPIT

RT * use R11

 

** B *R8 * We're done.

 

 

*--------------------------------------------------------------

* Let's determine proper bank (22 bytes)

*

CF2K LI R7,>6000 4 bytes

JMP MOVEIT 2 bytes

DM2K LI R7,>6008 4

JMP MOVEIT 2

DU2K LI R7,>6010 4

JMP MOVEIT 2

BNK4 LI R7,>6018 4

 

* start code for this module copy

* each 32K bank should contain the copy data for the 4 8k banks

*

* use DATA statements to eliminate 2 bytes per LI statement

* (2*16=32 bytes - 10 added to COPY = 22 bytes saved. Offsets our header branch above)

MOVEIT

MOV R0,*R7 change to bank

BL @COPYME

* following code should change depending on bank

DATA >6000,>076A,>6258,>A000 bank,count/4, from address, to address

BL @COPYME

DATA >6002,>076A,>6258,>A000

BL @COPYME

DATA >6004,>076A,>6258,>A000

BL @COPYME

DATA >6006,>076A,>6258,>A000

B @>A000

 

FINISH EQU $

SLAST END

Link to comment
Share on other sites

Haven't had a chance to look at your code yet, but I have two now.. Tursi graciously wrote some as well, and like you, used DATA statements...

 

* THREE PROGRAM HEADER FOR 64K BANKED
* SWITCHED CART
      DEF SFIRST,SLAST,SLOAD
      UNL

* ROM HEADER
      AORG >6000

SFIRST EQU $
SLOAD  EQU $

GRMHDR BYTE >AA,1,1,0,0,0
      DATA PROG
      BYTE 0,0,0,0,0,0,0,0

PROG   DATA PROG2
      DATA CF2K
      BYTE 8
      TEXT 'CF2K 1.4'
      EVEN

PROG2  DATA 0
      DATA DM2K
      BYTE 8
      TEXT 'DM2K 1.4'
      EVEN

MINIT  EQU $
      LWPI >8300

***************
* Copy Data for Modules *
* Format is:
* First, the address to load for the first source bank.
* Number of 32-bit words, source address, target address
* To end list, provide a start address greater than >8000
* (This means you can't start in the low RAM bank)
***************
CF2KDAT DATA >6000
	DATA >076A,>6258,>A000,>076A,>6258,>BDA8
	DATA >076A,>6258,>DB50,>04C0,>6D00,>2000
	DATA >A000

DM2KDAT DATA >6008
	DATA >072A,>6358,>A000,>072A,>6358,>BCA8
	DATA >072A,>6358,>D950,>072A,>7400,>2000
	DATA >A000

***************
* CF2K Module *
***************
CF2K	LI R14,CF2KDAT	 * address of copy table
	JMP COPYLP

***************
* DM2K Module *
***************
DM2K	LI R14,DM2KDAT	 * address of copy table
	JMP COPYLP

***************
* Common Code *
***************
COPYLP	BL @GOGO * Set up Char Sets

	MOV *R14+,R7	 * get bank

ONEBLK	MOV *R14+,R4	 * Get bytes divided by 4
	JGT CONT		 * Branch if positive (less than >8000)
	B *R4			 * Else it's the jump address, so start the program

CONT	MOV *R14+,R9	 * Address to copy from
	MOV *R14+,R10	 * Address to copy to
	BL @COPYME		 * COPY IT!

	INCT R7			 * Next Bank

	JMP ONEBLK

****************
* Copy Routine *
****************
* R4  - Bytes Div 4
* R7  - Bank switch address
* R9  - Address to copy from
* R10 - Address to copy to
* R11 - Return spot, save it to R8

COPYME
   MOV R0,*R7   * Do the bank switch
LOOPIT
   MOV *R9+,*R10+
   MOV *R9+,*R10+
   DEC R4
   JNE LOOPIT
   B *R11         * We're done.

****************************
* Load lower case charsets *
****************************
* Note, if you still need space, you can remove support for the
* 99/4 by deleting the code marked between * +++ 99/4 support +++ begin/end
blocks

GOGO
MOV R11,R9   * Save our return spot

* +++ 99/4 support begin +++

* load R3 with 6 for 99/4, or 7 for 99/4A
CLR R0
BL @GPLSET
BL @GETGPL   * read GROM >0000
LI R3,7
CI R0,>AA01  * 99/4 is AA01, all versions of 99/4A seem to be AA02 (even
2.2!)
JNE IS4A     * note we also assume unknown is 99/4A just to be safe
DEC R3

* make a copy of the capitals for the 99/4 to 'support' lowercase
* this will be partially overwritten by the main set, but it works!

LI R0,>0018  * GPL vector address
LI R1,>4A00  * dest in VDP - must OR with >4000 for write
LI R2,>0040  * how many chars
BL @GPLVDP   * this function goes somewhere later in your ROM
JMP MNSET

* +++ 99/4 support end +++
* If you delete the above block, replace with
* LI R3,7
* so that the character size counter is still valid

IS4A
* 'lowercase' letters
LI R0,>004A  * GPL vector address (not available for 99/4)
LI R1,>4B00  * dest in VDP - must OR with >4000 for write
LI R2,>001F  * how many chars
BL @GPLVDP   * this function goes somewhere later in your ROM

* main set
MNSET
LI R0,>0018  * GPL vector address
LI R1,>4900  * dest in VDP - must OR with >4000 for write
LI R2,>0040  * how many chars
BL @GPLVDP   * this function goes somewhere later in your ROM
B *R9        * RETURN TO CALLER

*****************
* GROM routines *
*****************

* Set GROM address
GPLSET
MOVB R0,@>9C02
SWPB R0
MOVB R0,@>9C02
B *R11

* Get a word from GPL
GETGPL
MOVB @>9800,R0
SWPB R0
MOVB @>9800,R0
SWPB R0
B *R11

* Copy R2 characters from a GPL copy function vectored at
* R0 to VDP R1. GPL vector must be a B or BR and
* the first actual instruction must be a DEST with an
* immediate operand. Set R3 to 6 for 99/4 (6 byte characters)
* or 7 for a 99/4A (7 byte characters)
GPLVDP
MOV R11,R10    * save return address
BL @GPLSET     * set GROM address
BL @GETGPL     * Get branch instruction (not verified!)
ANDI R0,>1FFF  * mask out instruction part
AI R0,3        * skip instruction and destination
BL @GPLSET     * set new GROM address
BL @GETGPL     * get actual address of the table
BL @GPLSET     * and set that GROM address - GROM is now ready!

SWPB R1        * assume VDP is already prepared for write to save space
MOVB R1,@>8C02
SWPB R1
MOVB R1,@>8C02 * VDP is now ready!

CLR R0
LP8
MOVB R0,@>8C00 * pad the top of the char with a space
MOV R3,R0      * then copy 7 (or 6) bytes

* +++ 99/4 support begin +++

CI R3,6        * check for 99/4
JNE LP9
MOVB R0,@>8C00 * extra blank line for 99/4

* +++ 99/4 support end +++
* no changes needed if this block removed

LP9
MOVB @>9800,@>8C00  * copy a byte (both sides autoincrement)
DEC R0
JNE LP9

DEC R2         * next character
JNE LP8

B *R10

FINISH EQU $
SLAST  END

 

I'll probably have time to continue with this next week... but my goal is to get a Fred Kaal cart with all of his programs in it, menu driven! :)

Link to comment
Share on other sites

Here's the final copy... we had to load the workspace pointers to get everything to work properly. Thanks again, Tursi!

 

Attached is the 128K EPROM image of Fred's carts... DM2K, DU2K, CF2K. Will work in Classic99, a hacked 64K Cart board, or a prototype 128K board.

 

* THREE PROGRAM HEADER FOR 128K BANKED
* SWITCHED CART
      DEF SFIRST,SLAST,SLOAD
      UNL

* ROM HEADER
      AORG >6000

SFIRST EQU $
SLOAD  EQU $

GRMHDR BYTE >AA,1,1,0,0,0
      DATA PROG3
      BYTE 0,0,0,0,0,0,0,0


PROG3  DATA PROG2
      DATA DU2K
      BYTE 8
      TEXT 'DU2K 2.0'
      EVEN

PROG2  DATA PROG
      DATA DM2K
      BYTE 8
      TEXT 'DM2K 2.4'
      EVEN

PROG   DATA 0
      DATA CF2K
      BYTE 8
      TEXT 'CF2K 1.4'
      EVEN

***************
* Copy Data for Modules *
* Format is:
* First, the address to load for the first source bank.
* Number of 32-bit words, source address, target address
* To end list, provide a start address greater than >8000
* (This means you can't start in the low RAM bank)
***************
CF2KDT DATA >6000
	DATA >076A,>6258,>A000,>076A,>6258,>BDA8
	DATA >076A,>6258,>DB50,>04C0,>6D00,>2000
	DATA >A000

DM2KDT DATA >6008
	DATA >072A,>6358,>A000,>072A,>6358,>BCA8
	DATA >072A,>6358,>D950,>0300,>7400,>2000
	DATA >A000

DU2KDT DATA >6010
               DATA >0794,>61B0,>A000,>0794,>61B0,>BE50
               DATA >0794,>61B0,>DCA0,>0400,>7000,>2000
               DATA >A000

***************
* CF2K Module *
***************
CF2K	LWPI >8300
       LI R14,CF2KDT	 * address of copy table
JMP COPYLP

***************
* DM2K Module *
***************
DM2K	LWPI >8300
       LI R14,DM2KDT	 * address of copy table
JMP COPYLP

***************
* DU2K Module *
***************
DU2K	LWPI >8300
       LI R14,DU2KDT	 * address of copy table
JMP COPYLP

***************
* Common Code *
***************
COPYLP	BL @GOGO * Set up Char Sets

	MOV *R14+,R7	 * get bank

ONEBLK	MOV *R14+,R4	 * Get bytes divided by 4
	JGT CONT		 * Branch if positive (less than >8000)
	B *R4			 * Else it's the jump address, so start the program

CONT	MOV *R14+,R9	 * Address to copy from
	MOV *R14+,R10	 * Address to copy to
	BL @COPYME		 * COPY IT!

	INCT R7			 * Next Bank

	JMP ONEBLK

****************
* Copy Routine *
****************
* R4  - Bytes Div 4
* R7  - Bank switch address
* R9  - Address to copy from
* R10 - Address to copy to
* R11 - Return spot

COPYME
   MOV R0,*R7   * Do the bank switch
LOOPIT
   MOV *R9+,*R10+
   MOV *R9+,*R10+
   DEC R4
   JNE LOOPIT
   B *R11         * We're done.

****************************
* Load lower case charsets *
****************************
* Note, if you still need space, you can remove support for the
* 99/4 by deleting the code marked between * +++ 99/4 support +++ begin/end
* blocks

GOGO
MOV R11,R9   * Save our return spot

* +++ 99/4 support begin +++

* load R3 with 6 for 99/4, or 7 for 99/4A
CLR R0
BL @GPLSET
BL @GETGPL   * read GROM >0000
LI R3,7
CI R0,>AA01  * 99/4 is AA01, all versions of 99/4A seem to be AA02 (even 2.2!)
JNE IS4A     * note we also assume unknown is 99/4A just to be safe
DEC R3

* make a copy of the capitals for the 99/4 to 'support' lowercase
* this will be partially overwritten by the main set, but it works!

LI R0,>0018  * GPL vector address
LI R1,>4A00  * dest in VDP - must OR with >4000 for write
LI R2,>0040  * how many chars
BL @GPLVDP   * this function goes somewhere later in your ROM
JMP MNSET

* +++ 99/4 support end +++
* If you delete the above block, replace with
* LI R3,7
* so that the character size counter is still valid

IS4A
* 'lowercase' letters
LI R0,>004A  * GPL vector address (not available for 99/4)
LI R1,>4B00  * dest in VDP - must OR with >4000 for write
LI R2,>001F  * how many chars
BL @GPLVDP   * this function goes somewhere later in your ROM

* main set
MNSET
LI R0,>0018  * GPL vector address
LI R1,>4900  * dest in VDP - must OR with >4000 for write
LI R2,>0040  * how many chars
BL @GPLVDP   * this function goes somewhere later in your ROM
B *R9        * RETURN TO CALLER

*****************
* GROM routines *
*****************

* Set GROM address
GPLSET
MOVB R0,@>9C02
SWPB R0
MOVB R0,@>9C02
B *R11

* Get a word from GPL
GETGPL
MOVB @>9800,R0
SWPB R0
MOVB @>9800,R0
SWPB R0
B *R11

* Copy R2 characters from a GPL copy function vectored at
* R0 to VDP R1. GPL vector must be a B or BR and
* the first actual instruction must be a DEST with an
* immediate operand. Set R3 to 6 for 99/4 (6 byte characters)
* or 7 for a 99/4A (7 byte characters)
GPLVDP
MOV R11,R10    * save return address
BL @GPLSET     * set GROM address
BL @GETGPL     * Get branch instruction (not verified!)
ANDI R0,>1FFF  * mask out instruction part
AI R0,3        * skip instruction and destination
BL @GPLSET     * set new GROM address
BL @GETGPL     * get actual address of the table
BL @GPLSET     * and set that GROM address - GROM is now ready!

SWPB R1        * assume VDP is already prepared for write to save space
MOVB R1,@>8C02
SWPB R1
MOVB R1,@>8C02 * VDP is now ready!

CLR R0
LP8
MOVB R0,@>8C00 * pad the top of the char with a space
MOV R3,R0      * then copy 7 (or 6) bytes

* +++ 99/4 support begin +++

CI R3,6        * check for 99/4
JNE LP9
MOVB R0,@>8C00 * extra blank line for 99/4

* +++ 99/4 support end +++
* no changes needed if this block removed

LP9
MOVB @>9800,@>8C00  * copy a byte (both sides autoincrement)
DEC R0
JNE LP9

DEC R2         * next character
JNE LP8

B *R10

FINISH EQU $
SLAST  END

fredcarts.bin

Link to comment
Share on other sites

Thanks for the binary Daniel :)

 

Add the below to your classic99.ini file for playing around with the 128K image in classic99,

ofcourse changing the file path according to your needs:

 

[usercart0]
name=Disk Utilities
rom0=3|0000|20000|D:\emulator\ti\classic99\MODS\fredcarts.bin

Link to comment
Share on other sites

Finally got a chance to read here.. InsaneMultitaker's option is the best for saving space - by putting a different copy loop in each bank, you only need to select the appropriate bank, and then each bank would have a different set of data.

 

Also, of course, the character set copy code could be reduced by removing the 99/4 support -- I don't expect anyone is using a 99/4 in actual use given their limitations and value, but it was a challenge in my original code to make it work. ;)

 

I'm glad it's working though. :)

Link to comment
Share on other sites

Here's the final copy... we had to load the workspace pointers to get everything to work properly. Thanks again, Tursi!

 

Attached is the 128K EPROM image of Fred's carts... DM2K, DU2K, CF2K. Will work in Classic99, a hacked 64K Cart board, or a prototype 128K board.

 

Looks good :) The only question that popped into my mind the first time I looked at the code (and then quickly popped out before I wrote it down) was, "how you are preparing the 8k images?" Your copy/header code is placed in each 8k bank which means you have to split chained 8k program image files outside their 'normal' boundaries..?

 

Course, if you knew which bank this would start in, you could dedicate 8k to your own "loader". But I am pretty sure that's been hashed over many times in SWPB and other arenas. <grin>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...