;====================================================== ; Dump ;====================================================== ; Dump is a memory dump utility for the TI-85 ; calculator. To use Dump, CLEAR the screen (so the ; cursor is in the upper left hand corner), enter the ; page number and address to be dumped (in HEX), and ; select "Dump" from the CUSTOM menu. ;------------------------------------------------------ TEXT_ADDR .EQU $80DF ; Addr. of text memory VIDEO_ADDR .EQU $8641 ; Addr. of video memory QUIT_ADDR .EQU $0462 ; Addr. of QUIT LINE_LEN .EQU $15 ; # of chars on 1 line .ORG VIDEO_ADDR ; ; Set up the CUSTOM menu data structure ; .BYTE $41, $00, $07, $C3 .WORD Start .TEXT "Dump" .BYTE $00 Start: LD DE, $0000 LD HL, TEXT_ADDR CALL Parse_character CP $FF JR Z, Parse_loop OUT ($05), A Parse_loop CALL Parse_character CP $FF JR Z, Done LD B, $04 Shift_4: SLA E RL D DJNZ Shift_4 ADD A, E LD E, A JR Parse_loop Done: LD HL, TEXT_ADDR+LINE_LEN LD B, $07 Line_loop: PUSH BC ; ; Print out the address (4 characters) ; LD A, D CALL Print_byte LD A, E CALL Print_byte ; ; Print a space (1 character) ; CALL Print_space ; ; Print out 4 hexadecimal bytes (12 characters) ; PUSH DE LD B, $04 Hex_loop: LD A, (DE) CALL Print_byte CALL Print_space INC DE DJNZ Hex_loop ; ; Print out 4 ASCII characters (4 characters) ; POP DE LD B, $04 ASCII_loop: LD A, (DE) LD (HL), A INC DE INC HL DJNZ ASCII_loop POP BC DJNZ Line_loop JP QUIT_ADDR ;------------------------------------------------------ ; Parse the character at (HL). On return: ; A = 00-0F if character is a HEX digit ; A = FF if character is not a HEX digit ;------------------------------------------------------ Parse_character: LD A, (HL) INC HL SUB '0' JR C, Not_HEX CP $0A JR C, Less_10 SUB 7 CP $0A JR C, Not_HEX CP $10 JR NC, Not_HEX Less_10: RET Not_HEX: LD A, $FF RET ;------------------------------------------------------ ; Print a space character ;------------------------------------------------------ Print_space: LD A, ' ' LD (HL), A INC HL RET ;------------------------------------------------------ ; Print the byte in A ;------------------------------------------------------ Print_byte: PUSH AF SRL A SRL A SRL A SRL A CALL Print_nybble POP AF AND 0F CALL Print_nybble RET ;------------------------------------------------------ ; Print the low order nybble of A ;------------------------------------------------------ Print_nybble: ADD A, '0' CP $3A JR C, Less_0A ADD A, $07 Less_0A: LD (HL), A INC HL RET .END