home *** CD-ROM | disk | FTP | other *** search
- ;ROM dump version 1.0b2
- ;last updated:1/6/98 at 23:27 hours(11:27pm)
- ;This utility will let you dump a 16K block of ROM. Address are from $0000-$3FFF, and
- ;$4000-$7FFF, pages 0-7.
- ;Anyway, this is for ZShell and this is a Beta 2 release
- ;It is very well commented and if you have any questions e-mail me
- ;
- ;Matt Butch
- ;mjb25@hotmail.com
- ;
- ;PS:This file is written for CAZ on the Mac.
-
- INCLUDE "TI-85.H"
-
- ORG 0
- DEFM "ROM Dump v1.0 B2", 0
- CALL ROM_CALL
- DEFB CLEARLCD; what do you think?
- LD HL, ZS_BITS; tell zshell(or whatever) to recalc checksum
- SET 0, (HL)
- LD BC, #0100; display title screen
- LD DE, TITLE
- SET 3, (IY+05); set inverted text
- CALL CALL_
- DEFW DISPLAY; call my special and easy to use display routine-see attached files
- RES 3, (IY+05); set back normal text
- LD BC, #0402
- LD DE, DIVNM
- CALL CALL_
- DEFW DISPLAY
- RPT:; wait
- CALL GET_KEY
- CP 00
- JR Z, RPT
- START:
- CALL ROM_CALL
- DEFB CLEARLCD
- LD A, 7; select mem page
- OUT (5), A; and output it
- LD A, (#7FFF); load rom ver.(it's not #8C8E-"ROM_VER" because TinyPhat, and some other
- ; OS's didn't have this, and romdump would crash)
- CP 57; start of compares of ROM versions, this is 3.0A
- JR NZ, NXTROM1
- LD C, 00; load offset of table of ASCII strings of ROM ver ("3.0A")
- LD DE, #29A1; load ROM call of variable allocation(thanks to Dines for TI-ROMadd.txt)
- NXTROM1:
- CP 8E; 4.0
- JR NZ, NXTROM3
- LD C, #05
- LD DE, #29A5
- NXTROM3:
- CP 5E; 5.0
- JR NZ, NXTROM4
- LD C, #09
- LD DE, #29A5
- NXTROM4:
- CP 3D; 6.0
- JR NZ, NXTROM5
- LD C, #0D
- LD DE, #29A5
- NXTROM5:
- CP 97; 8.0
- JR NZ, NXTROM6
- LD C, #11
- LD DE, #29A9
- NXTROM6:
- CP #91; 9.0
- JR NZ, NXTROM7
- LD C, #15
- LD DE, #2954
- JR LOAD_NO
- NXTROM7:
- CP 35; 10.0
- CALL JUMP_NZ; if a wrong ROM ver is found (the only other ROM ver is 2.0)
- DEFW ERROR1; goto error subroutine 1
- LD C, #1A
- LD DE, #296E
- LOAD_NO:
- PUSH BC
- PUSH DE
- LD HL, (PROGRAM_ADDR)
- LD DE, VATALLRC
- ADD HL, DE; get location of call location
- INC HL; skip over call instruction(#CD) and to the area where the value to be called is
- POP DE
- LD (HL), E ; load it
- INC HL
- LD (HL), D
- POP BC
- LD B, 00
- LD HL, ROMVERTAB
- ADD HL, BC
- LD DE, (PROGRAM_ADDR)
- ADD HL, DE; point to ASCII equivalent of ROM version
- LD BC, #0C00
- LD (CURSOR_ROW), BC
- CALL ROM_CALL
- DEFB D_ZT_STR ; display it
- LD BC, 0200
- LD DE, ROMVER
- CALL CALL_
- DEFW DISPLAY
- LD HL, (X8BEB); load last byte of free memory
- LD DE, (#8BE1); load first byte of free memory
- SCF; set carry flag
- CCF; complement carry flag-here I use it to reset the CY flag
- SBC HL, DE; subtract them
- LD DE, #4000; load size of string that the dump will be put in
- SCF
- CCF
- SBC HL, DE; here it is used to compare the size of free memory and the size of the ROM dump
- CALL JUMP_NC; if DE is greater than HL than goto error subroutine 2
- DEFW ERROR2
- LD BC, 0000; display menu
- LD DE, ROMVER
- CALL CALL_
- DEFW DISPLAY
- LD BC, #0002
- LD DE, CHOOSE
- CALL CALL_
- DEFW DISPLAY
- LD BC, #0003
- LD DE, F1MENU
- CALL CALL_
- DEFW DISPLAY
- LD BC, #0004
- LD DE, F1ADDR
- CALL CALL_
- DEFW DISPLAY
- LD BC, #0005
- LD DE, F2MENU
- CALL CALL_
- DEFW DISPLAY
- LD BC, #0006
- LD DE, F2ADDR
- CALL CALL_
- DEFW DISPLAY
- LD BC, #0007
- LD DE, F5MENU
- CALL CALL_
- DEFW DISPLAY
- KEY:
- CALL GET_KEY
- CP 00
- JR Z, KEY
- CP K_F1
- JR Z, LWRROM
- CP K_F2
- JR Z, UPRROM
- CP K_F5
- RET Z
- CP K_EXIT
- RET Z
- JR KEY
- LWRROM:
- LD DE, LRVATN; point DE to the VAT name
- LD HL, (PROGRAM_ADDR)
- ADD HL, DE; HL now points to the VAT name in RAM
- LD DE, #0000; point to the start of the dump in ROM
- CALL JUMP_; jump to the dumping routine
- DEFW PRESTART
- UPRROM:
- LD A, #00; the following lines clear everything off the screen except the ROM version
- LD (VIDEO_MEM+#80), A
- LD HL, VIDEO_MEM+#80
- LD DE, VIDEO_MEM+#81
- LD BC, #37F
- LDIR
- LD BC, #0002; display the "Enter Mem page" screen
- LD DE, URSTR
- CALL CALL_
- DEFW DISPLAY
- LD BC, #0003
- LD DE, CHPAGE
- CALL CALL_
- DEFW DISPLAY
- LD B, 0
- WAIT:
- CALL GET_KEY
- CP 00
- JR Z, WAIT
- CP K_EXIT
- CALL JUMP_Z
- DEFW START
- CP K_ENTER
- JR Z, CONT
- ; this starts my ingenius routine that converts keycodes to ASCII, with a very small
- ; table (only 10 bytes)
- CP #12; elimanates keys under #12, but not #12, which is 3
- JR C, WAIT
- CP #25; elimanates keys over #25
- JR NC, WAIT
- SUB #12; if the key is 3, the value in A is 0, 6 is 1, and 9 is 2, 2-8, 5-9, 8-A, 0-F, 1-10, 4-11,7-12
- CP 3
- JR C, D_NMBR; if it is less than 3 goto the display routine
- SUB 3; now if the key is 2, A is 5, 5-6, 8-7, 0-C, 1-D, 4-11, 7-12
- CP 5; get rid of all keys less than 1A(original keycode)
- JR C, WAIT
- SUB 5; key-2, A-0, 5-1, 8-2, 0-7, 1-8, 4-9, 7-A
- CP 3; if it is under 3, goto the predisplay routine
- JR C, GOADD3
- CP 7; under 7(which is 0, here) is thrown back to the key get routine
- JR C, WAIT
- SUB 7; 0 is 0, 1-1, 4-2, 7-3
- CP #04; under 4, valid key goto a second predisplay routine
- JR C, GOADD6
- JR WAIT; otherwise go back to the key get routine
- GOADD3:
- ADD A, 3; this adds 3 to the middle set of keys to set the offset right: 2 is 3, 5 is 4, 8 is 5
- JR D_NMBR; goto display routine
- GOADD6:
- ADD A, 6; this adds 6 to the left set of keys to set the offset right:0 is 6, 1 is 7, 4 is 8, 7 is 9
- D_NMBR:
- CP 2; if A is 2, which is 9, go back to the key get routine-this is because there is no mem page 9
- JR Z, WAIT
- CP 5; same as above, but this is for key 8
- JR Z, WAIT
- LD HL, (PROGRAM_ADDR)
- LD DE, NMBR_TAB
- ADD HL, DE; point HL to the table of ASCII values
- LD D, 00
- LD E, A
- ADD HL, DE; HL now points to the correct ASCII value
- LD A, (HL)
- LD (TEXT_MEM), A; save the ASCII value for later use
- LD BC, #1203
- LD (CURSOR_ROW), BC
- CALL ROM_CALL
- DEFB TX_CHARPUT; display it
- CALL JUMP_
- DEFW WAIT
- CONT:
- LD DE, URVATN
- LD HL, (PROGRAM_ADDR)
- ADD HL, DE; HL now points to the VAT name
- PUSH HL
- LD DE, 0009
- ADD HL, DE
- LD A, (TEXT_MEM) ; get the saved value of the ROM page choice
- LD (HL), A; put it in the VAT name
- POP HL
- SUB #30; convert to a actual value
- OUT (5), A; set the mem page
- LD DE, #4000; point to the start of the dump
- PRESTART:
- PUSH DE
- RST #20; move the VAT name into OP1
- LD HL, #4002; this is the size of the string to allocate, #4000 for the dump, 2 for the size
- LD A, #0C; type code
- VATALLRC:
- CALL X2954; this is the routine to allocate the string
- EX DE, HL; HL now points to the data area where the string is at
- LD BC, #0040
- LD (HL), B
- INC HL
- LD (HL), C ; load the size into the 2 bytes before the actual string
- EX DE, HL; DE now points to the data entry
- INC DE; this is needed because DE points to 1 byte before the actual entry
- POP HL; HL now points to the source
- LD BC, #4000 # of bytes to copy
- LDIR; copy it
- CALL ROM_CALL
- DEFB CLEARLCD
- LD BC, #0000
- LD DE, DONE
- CALL CALL_
- DEFW DISPLAY
- HOLD:
- CALL GET_KEY
- CP 00
- JR Z, HOLD
- RET
-
-
- ;Error subroutines
-
- ERROR1:
- CALL ROM_CALL
- DEFB CLEARLCD
- LD BC, #0000
- LD DE, ERRORSTR1A
- CALL CALL_
- DEFW DISPLAY
- LD BC, #0002
- LD DE, ERRORSTR1B
- CALL CALL_
- DEFW DISPLAY
- LD BC, #0003
- LD DE, ERRORSTR1C
- CALL CALL_
- DEFW DISPLAY
- LD BC, #0004
- LD DE, ERRORSTR1D
- CALL CALL_
- DEFW DISPLAY
- JP PAQ
- ERROR2:
- CALL ROM_CALL
- DEFB CLEARLCD
- LD BC, #0000
- LD DE, ERRORSTR2A
- CALL CALL_
- DEFW DISPLAY
- LD BC, #0002
- LD DE, ERRORSTR2B
- CALL CALL_
- DEFW DISPLAY
- LD BC, #0003
- LD DE, ERRORSTR2C
- CALL CALL_
- DEFW DISPLAY
- PAQ:
- CALL GET_KEY
- CP K_ENTER
- JR NZ, PAQ
- RET
-
- ;DISPLAY Subroutine
- ;This routine I designed makes makes it so much easier to display strings
- ;Input:
- ;BC-XXYY:XX-Column, YY-Row
- ;DE-String to display
-
- DISPLAY:
- LD (#800C), BC; load cursor values into the proper memory area
- LD HL, (PROGRAM_ADDR); load the program address
- ADD HL, DE; add the offset and the ProgAddr to get the mem addr
- CALL ROM_CALL
- DEFB D_ZT_STR; display it. This can be changed to D_ZM_STR, etc.
- RET
-
-
- TITLE: DEFM "ROM Dump ver 1.0B2", 0
- DIVNM: DEFM "by Matt Butch", 0
- CHOOSE: DEFM "Choose ROM location", 0
- F1MENU: DEFM "F1:Lower 16K ROM", 0
- F1ADDR: DEFM "$0000-$3FFF", 0
- F2MENU: DEFM "F2:Upper 16K ROM", 0
- F2ADDR: DEFM "$4000-$7FFF w/8 pages", 0
- F5MENU: DEFM "F5:Quit", 0
- URSTR: DEFM "Upper ROM:$4000-$7FFF", 0
- CHPAGE: DEFM "Enter memory page:", 0
- ROMVER: DEFM "ROM version:", 0
- ERRORSTR1A: DEFM "ERROR 1:ROM VER ERROR", 0
- ERRORSTR1B: DEFM "Unable to recognise", 0
- ERRORSTR1C: DEFM "ROM ver. Need ROM ver", 0
- ERRORSTR1D: DEFM "3.0A-10.0", 0
- ERRORSTR2A: DEFM "ERROR 2:MEM NOT AVAIL", 0
- ERRORSTR2B: DEFM "Unable to allocate", 0
- ERRORSTR2C: DEFM "necessary 16KB of RAM", 0
- ROMVERTAB: DEFM "3.0A", 0, "4.0", 0, "5.0", 0, "6.0", 0, "8.0", 0, "9.0", 0, "10.0", 0
- NMBR_TAB: DEFM "3692580147"
- LRVATN:
- DEFB 00, 06
- DEFM "LWRROM"
- URVATN:
- DEFB 00, 08
- DEFM "UPRROMPX"
- DONE: DEFM "ROM dump complete", 0
-
- END
-