Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- * THREE PROGRAM HEADER FOR 128K BANKED
- * SWITCHED CART
- * 2010-2014 hexbus.com, Stuart, and Tursi, please feel free to use and adapt as long as you leave this line in.
- 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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement