Micheal D. Cranford instructions to patch 4051 vintageTEK MAXIROM/MAXIPACK
DEBUG ROM (DDT) to echo all DDT output characters to Option 01 RS-232 COMM
or 4051 Option10 RS-232 printer interface.
When the 4051 CALL "DEBUG" gets executed, it prints the actual starting
address where it was loaded into the destination string, on the DVST,
so there is no requirement to chase the links through the BASIC symbol
table to find the actual start of the string data in memory.
If your 4051 does not have Option 1 installed then a Printer Interface
ROMPACK could be used, but the ACIA port addresses shown below will need
to be modified.
The relevant steps for an Option 1 equipped 4051 follow below:
==============================================================
0. Set up your PC to be in terminal mode at 2400 BAUD, 8 data bits,
1 stop bit, and to save received characters into a text file.
You will likely need to append <LF> to send and received text since
the 4051 only uses <CR> and not <LF>.
I also set up the PC terminal mode to echo what I type on the PC
keyboard.
Since this step is so PC and terminal software dependent,
I will not go into details about how to do those steps.
All further steps shown below are on the 4051.
1. DEL ALL <== Clear memory and all previous 4051 setup
2. If you have a RAMPACK installed do:
FIND@51:141
OLD@51:
RUN
to do the Option 1 setup.
Otherwise do the below steps:
CALL "RATE",2400,1,2 <== Set up Option 1 serial port
CALL "BREAK",5,"Ctrl-S","Ctrl-Q"
CALL "MARGIN",1,0,0
CALL "TERMIN"
Verify that the PC and 4051 are communicating with each other by typing
on each keyboard are seeing the other end echo what you type.
If you cant get past this step, revisit the above steps.
To return to 4051 BASIC push UDF Key 5.
3. DIM A$(5632) <== Reserve string memory for DDT code
4. CALL "DEBUG", A$ <== The DDT loading address is displayed = LA
5. Verify the DDT loading address with <LA>;2/
After this step, you should see the below, but if you don't, you messed up:
LDA A #$15 <== This pushes a return address tag onto the stack
PSH A CALLs, JSRs, BSRs must do this for memory compression safety
6. Enter the following 6800 instructions at 7000H:
7000' LDA B 87C6 <== Wait for transmit register done
' AND B #02
' BEQ 7000
' STA A 87C5 <== Send next character
' JMP CBEE
7. Enter the following 6800 instructions at 7010H:
7010' LDA B 87C6 <== Wait for transmit register done
' AND B #02
' BEQ 7010
' LDA A #0D <== Special case control codes like <CR>
' STA A 87C5
' JMP C6EF
8. Add 5BAH to the LA saved in #4 above (add offline) and disassemble:
<LA+05BAH>;16'
JMP CBEE <== Change
TST 21A7
BPL 06
LDA A #01
LDA B #F8
BRA 02
CLR A
CLR B
STA A AA
ORA A #FC
STA A 8794
STA B AB
STA B 8796
LDA A #19
JMP FEB0
JSR C6EF <== Change
9. Change JMP CBEE to JMP 7000
7000' JMP 7000
10. Change JSR C6EF to JSR 7010
7010' JSR 7010
After these 2 last steps every character printed on the DVST will also
be echoed out the RS-232 serial port.
The 4051 MUST have Option 1 installed. It is at this point that I set up
the PC received text to go into a file.
You can elect to do that at the beginning, it just means that you will
need to edit out more junk in the disassembly text file.
11. Now disassemble whatever you want starting at the appropriate address:
<Starting Address>;1000/
or whatever length you want disassembled.
12. Repeat as required with ;1000/
or whatever length you want disassembled.
Paging the screen will generally be required unless "screen Full" (flashing write
thru "F") has been disabled.
13. Note that one or more idiots might have embedded local variable storage
within the code stream of any routines that specifically run in DRAM,
and as a result, the disassembly will get out of sync with the code
(i.e. mistaking a data byte as 2 or 3 byte instruction, etc.).
So you'll need to examine the resulting disassembly and go back to
disassemble starting at the proper addresses and then edit in the changes
to the saved text file.
This is similar to:
BRA 01
<DATA BYTE>
CLR A
Where <DATA> was mistaken for a 2 or 3 byte instruction, so the actual
instruction after <DATA> was not decoded correctly. Whenever that happens,
the disassembly can remain out of sync for many instructions, so beware.
DDT works this way, with idiot data storage embedded within the code,
making the disassembly more difficult. I doubt the difficulty was
intentional, but rather due to not ever thinking ahead, and ignoring
good programming practices.
14. When the disassembly has finished, close the text file on the PC,
and perform any required edits with your favorite text editor.
To disassemble a block of data, see the DDT instruction manual.