home *** CD-ROM | disk | FTP | other *** search
/ SPACE 2 / SPACE - Library 2 - Volume 1.iso / demos / 26 / general / stmemmap.doc < prev    next >
Encoding:
Text File  |  1986-06-19  |  7.6 KB  |  163 lines

  1.  
  2.  
  3. Enclosed with my new version of 4XFORTH from the Dragon Group is a little
  4. thing that  I'm going to retype for the BBS.  I THINK YOU ARE GOING TO BE 
  5. PLEASED!
  6. OF MICE AND GEM (hacking the Jackie) by Lt. (j.g.) Christopher Biow, 1924 
  7. Slalom Dr., Virginia Beach, VA 23456 (804) 468-1453
  8. The Jackintosh may be a semi-closed hardware device, but there is no way 
  9. Atari, DRI, or anyone else will be able to close the software.  They have 
  10. tried.  After investing a fair chunk of the 520ST's price in a windowing 
  11. operating system with a mouse, ATARI decided to keep the memory addresses 
  12. containing the mouses's absolute secret.  Or, maybe DRI didn't even tell 
  13. Atari.  In any case, the only provision for using the mouse in programs was a 
  14. C primitive.  However, Atari did give us a bit mapped, high resolution screen, 
  15. which makes finding the mouse location simple.
  16. Briefly, here are the addresses:
  17.           HEX   DECIMAL        INFORMATION
  18. Byte at  2418   9240    Least significant bit--Left button
  19.                         Second least significant bit--Right button
  20. Word at 241c    9244    X position of mouse--0 to 639
  21. Word at 241e    9246    Y position of mouse--0 to 399
  22. Word at 242e    9262    YX position of mouse--8000 HEX to FCFE HEX
  23.                         (32768-64766).  This is row-major or
  24.                         raster position on the screen.
  25. Words are 16 bit quantities.
  26. How did that high-res screen help me find this?  Well, the screen is mapped to 
  27. the top 32000 (not 32K--400 rows * 640 col / 8 bits per byte = 32000) bytes of 
  28. memory.  512K = 524,288 - 32,000 = 492,288 (78300 HEX), which is the base 
  29. location of video memory.  By simply moving a block of up to 32,000 bytes of 
  30. memory into this area, it is possible to look at each bit of that memory, 
  31. since each bit is a pixel on the screen.  Doing this a few times per second 
  32. makes those bits which change stand out as "motion" on the screen.  So I wrote 
  33. a two-line program in a fast language (4XFORTH--sorry, Felgercarb) which would 
  34. move 20,000 bytes of memory to the screen about five times per second, and 
  35. then I watched which pixels changed.  Looking at the first 20,000 bytes of 
  36. memory, the areas of memory used by GEM for the real time clock soon became 
  37. apparent (I could see the bits counting up).  Then, I moved the mouse on the 
  38. table, and watched for new changes on the screen.  There, about two inches 
  39. down the screen, were pixels which only changed when the mouse moved.  
  40. Estimating the position of these pixels within that 20,000, I narrowed down 
  41. the location to within about 100 bytes, and then modified the program to 
  42. display only those 100 bytes (at many times per second).  This resulted in 
  43. about a line and a half of pixels, and allowed me to estimate to within ten 
  44. bytes.  Repeatedly dumping these bytes to screen in hexadecimal form revealed 
  45. the individual locations.
  46. Also identifiable are the locations which contain the video "under" the mouse 
  47. icon, which immediately follow the mouse position addresses.  Also, in byte 
  48. 2418 are bits indicating the last button pushed.  And, there is probably a bit 
  49. that is set high every time the mouse is moved.  I've not had time or need to 
  50. identify these.
  51. This method should work for identifying the locations used by any 
  52. interrupt-driven routine.  Or, by writing the program as an interrupt-driven 
  53. routine, we should be able to hack into any GEM function.  Let's here it for 
  54. the Hacker's Jack!
  55. Note: Here is the FORTH code for dumping the bottom 20,000 to the screen.
  56. : PIX 20000 0 DO I @ I 492288 + ! 4 +LOOP ;
  57. : PIXES 0 DO PIX LOOP ;
  58. 500 PIXES
  59. ATARI 520 ST MEMORY MAP
  60. FF8000-FFFFFF           I/O ASSIGNMENTS
  61.  FFFC06       6580 ACIA #2 (MIDI)
  62.  FFFC00       6580 ACIA #1
  63.  FFFA00       MFP 68901 Peripheral Controller
  64.  FF8800       YM2149 (AY-3-8910) Sound
  65.  FF8600       3H-2130 DMA/FDC
  66.  FF8400       RESERVED
  67.  FF8200       2H-2123 Video Controller
  68.  FF8000       Data Configuration
  69. FF0000-FF7FFF           UNUSED
  70. FC0000-FEFFFF           192K System Rom
  71. FA0000-FBFFFF           128K Expansion Cartridge
  72. 080000-F9FFFF           UNUSED
  73. 000000-07FFFF           512K RAM
  74.  078300-07FFFF          32K Video Memory
  75.  00242eW      YX Postion of mouse
  76.  00241eW      Y position of mouse
  77.  00241cW      X position of mouse
  78.  002418B      Left/Right mouse buttons
  79.  0004c4       _drvbits = 3 if floppies
  80.  0004bc       _hz_200 = 200 Hz timer tick
  81.  0004b4       buf1 (2 buffer-list pointers)
  82.  0004a6W      _nflops = 0,1, or 2 floppies
  83.  0004a2       savptr
  84.  00049ew      _____md  (for GEMDOS)
  85.  00048e       themd
  86.  000484B      conterm  attribute bits
  87.               # 0 enable keyclick
  88.               # 1 enable key-repeat
  89.               # 2 enable bell on ^G
  90.  000482W      _cadload
  91.  00047e       hdv_mediach (h.disk media cha)
  92.  00047a       hdv_boot (to boot from h.disk)
  93.  000476       hdv_rw (h.disk read/write)
  94.  000472       hdv_bpb (h.disk bios param bl)
  95.  00046e       hdv_dsb (h.disk state block)
  96.  00046a       hdv_init (h.disk initialize)
  97.  000466       _frclock (vert. blank count)
  98.  000462       _vbclock (vert/bl/int/count)
  99.  00045e       screenpt nextptr b/screen mem
  100.  00045a       colorptr pointer to pallette
  101.  000456       _vblqueue pointer to vblank
  102.  000454W      nvbls number of pointers " "
  103.  000452W      vblsem vert/blank semaphore
  104.  00044e       _v_bas_ad  ptr base screen mem
  105.  00044cW      sshiftmd  shadow for shiftmd
  106.               =0 320x200x4 (low res)
  107.               =1 640x200x2 (med res)
  108.               =2 640x400x1 (hi res mono)
  109.  00044aB      defshiftmd default video res
  110.  000448W      palmode=0 NTSC, =1 PAL video
  111.  000446W      _bootdev  device # booted from
  112.  000444W      _fverify  floppy verify flag
  113.  000442W      _timr_ms  =$14=20d (50Hz)
  114.  000440W      seekrate default floppy seek
  115.               =0 6ms, =1 12ms,
  116.               =2 2ms, =3  3ms (default)
  117.  00043a       memval2 = $237698aa
  118.  000436       _memtop top of available mem
  119.  000432       _membot bottom of "       "
  120.  00043a       memval2 = $237698aa
  121.  000436       _memtop top of available mem
  122.  000432       _membot bottom of "       "
  123.  00042e       phystop physical top of RAM
  124.  00042a       resvector reset bailout vector
  125.  000426       resvalid = $31415926
  126.  000424B      memcntlr memory configuration
  127.               =0 256K, =4 512K
  128.               =5 1024K (2 banks)
  129.  000420       memvalid = $752019f3
  130.  00040c       etv_xtra log.vectors $103-107
  131.  000408       etv_term process/term $102
  132.  000404       etv_critic critcal/err $101
  133.  000400       etv_timer timer handoff $100
  134. All addresses are for longwords (32 bits)
  135. unless suffixed with W (word=16bits) or
  136. B (byte=8bits).
  137. 000000-00003ff     Exception Vectors
  138.   000100-0003ff    192 User-Defined Vectors
  139.   0000c0-0000ff    Unassigned, Reserved
  140.   000080-0000bf    Trap #0-15 Instr Vectors
  141.   000064-00007f    Level 1-7 Interr Vectors
  142.   000060           Spurious Interrupt
  143.   000030-00005f    Unassigned, Reserved
  144.   00002c           Opcode 1111 Emulation
  145.   000028           Opcode 1010 Emulation
  146.   000024           Vector 9 - Trace
  147.   000020           Vector 8 - Privilege Violation
  148.   00001c           Vector 7 - TRAPV instruction
  149.   000018           Vector 6 - CHK instruction
  150.   000014           Vector 5 - Divide by Zero
  151.   000010           Vector 4 - Illegal Instruction
  152.   00000c           Vector 3 - Address Error
  153.   000008           Vector 2 - Bus Error
  154.   000004           Reset-Initial Program Counter
  155.   000000           Reset-Initial Stack Pointer
  156. Thank you, Lt. (j.g.) Christopher Biow
  157. Let me know if you are just sure I've made some typos.
  158. Don E. Farmer
  159.     
  160.  
  161. Download complete.  Turn off Capture File.
  162.  
  163. Download another file (Y/N)?FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF