home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 1 / crawlyvol1.bin / program / books / 68k_book / arp_src / prg_9ar.doc < prev    next >
Text File  |  1985-11-20  |  4KB  |  74 lines

  1. April 14, 1989
  2.  
  3.      I have designed a software DONGLE for Switch/Back using data obtained
  4. from a disassembly listing of SW_1MEG.PRG.  The method I used to decode the
  5. SW_1MEG.PRG listing is as follows:
  6.  
  7.      1. Load SW_1MEG.PRX (or PRG) into the AssemPro debugger.
  8.      2. Put a breakpoint at the first DBRA D0 instruction.
  9.      3. Click on the Run Program button.
  10.      4. Remove the breakpoint.
  11.      5. Click the disassembled button off and on.  This step is probably
  12.         not necessary.
  13.      6. Put a breakpoint at the first statement following the first
  14.         DBRA D0 instruction.
  15.      7. Repeat step 3.
  16.      8. Repeat step 4.
  17.      9. Repeat step 5.
  18.     10. Move the PC cursor to the CLR.L D1 statement that is 8 statements
  19.         before the second DBRA D0 instruction.
  20.     11. Put a breakpoint at the second DBRA D0 instruction.
  21.     12. Repeat step 3.
  22.     13. Repeat step 4.
  23.     14. Repeat step 5.
  24.     15. Put a breakpoint at the first statement following the second
  25.         DBRA D0 instruction.
  26.     16. Repeat step 3.
  27.     17. Repeat step 4.
  28.     18. Repeat step 5.
  29.     19. Disassemble to file SW_1MEG.DSM.  The first statement in the program
  30.         as shown in the debugger yields the program end address.
  31.  
  32.      Using the disassembly listing, I was able to spot the MFPINT invocation,
  33. which begins 21st instruction.  This routine installs an interrupt handler
  34. for pin 11 of the parallel interface.  From looking at the DONGLE board, I
  35. already knew that the DONGLE switch pulses this pin.
  36.  
  37.      Using the AssemPro debugger, I obtained the actual address of the
  38. interrupt handler from address $100.  The interrupt handler address stored
  39. there was $D3F6.  The rte instruction for the handler was at address $D54A.
  40.  
  41.      I obtained a disassembly listing for the interrupt handler.  From it,
  42. I was able to deduce that the instructions which had to be executed to
  43. simulate the hardware dongle were the first 5 and the 14th through the RTE
  44. instruction.
  45.  
  46.      I prepared a custom trap #11 installer called DONGTRAP.S.  This program
  47. installs the trap which executes the first 5 instructions of the interrupt
  48. handler, then jumps to the address of the 14th instruction.  The RTE
  49. instruction in the interrupt handler serves to return control to the trap #11
  50. invoking program.  DONGTRAP.S is assembled in PC-relative mode, given a PRG
  51. extension and copied to the AUTO folder on the C partition of the hard disk.
  52.  
  53.      I then wrote a desk accessory to invoke the custom trap #11.  The name
  54. of that program is DONGLE.S; it is assembled in Relocatable mode, given a
  55. PRG extension that is changed to ACC from the desktop.  DONGLE.ACC is then
  56. copied to the C partition of the hard disk.
  57.  
  58.      The software dongle seems to work fine.  I tested it by booting up,
  59. letting SW_1MEG.PRG divide the system into 2 1 megabyte partitions.  I then
  60. executed 1st Word+, loaded in chapter 9, selected DONGLE from the accessory
  61. menu, then pressed the 'c' key to capture.  I quit 1st Word+, then from the
  62. desktop, executed the switch back buffer program to save the partition.
  63.  
  64.      I then powered down and back up, executed the buffer program to reinstall
  65. the saved partition.
  66.  
  67.      So far, everything seems to function as it does with the hardware dongle,
  68. except that the software dongle functions much smoother; no need to press a
  69. button 5 or 6 times to effect a capture or alternate.
  70.  
  71.      I have also tested the DONGLE with SW_512K.PRG; it functioned as
  72. required.
  73.   
  74.