+retroclouds Posted July 28, 2011 Share Posted July 28, 2011 I wrote a little utility for watching TI-99/4A CPU memory. Did that for testing some subroutines of the spectra2 library. Upon program startup 2 threads are started. Thread 0 is used for updating the memory location while navigating through memory (up/down=page up/down, left/right=line up/down) Thread 1 is where the action is. It takes the current memory location and dumps memory to the screen. The screen is constantly updated, so you'r kinda watching "realtime". http://www.youtube.com/watch?v=0ZIMwEkC_2I Here's the cartridge binary: memview.zip Here's the source code: ********@*****@*********************@************************** AORG >6000 *-------------------------------------------------------------- * Cartridge header *-------------------------------------------------------------- GRMHDR BYTE >AA,1,1,0,0,0 DATA PROG0 BYTE 0,0,0,0,0,0,0,0 PROG0 DATA 0 ; No more items following DATA RUNLIB MSG0 BYTE 13 TEXT 'MEMORY VIEWER' *-------------------------------------------------------------- * Include required files *-------------------------------------------------------------- COPY "D:\Projekte\spectra2\tms9900\runlib.a99" *-------------------------------------------------------------- * SPECTRA2 startup options *-------------------------------------------------------------- SPVMOD EQU GRAPH1 ; Video mode. See VIDTAB for details. SPFONT EQU FNOPT3 ; Font to load. See LDFONT for details. SPFCLR EQU >C0 ; Foreground/Background color for font. SPFBCK EQU >01 ; Screen background color. *-------------------------------------------------------------- * Variables *-------------------------------------------------------------- TIMERS EQU >8342 ; Address of timer table (8 bytes). Space for future slots reserved MEMORY EQU >8350 ; Current memory location MEMOLD EQU >8352 ; Backup memory location RAMBUF EQU >8354 ; Work buffer *************************************************************** * Main ********@*****@*********************@************************** MAIN BL @SETUP ; Setup screen JMP SETUP2 ; Start memory viewer *************************************************************** * GENERAL SETUP -- GENERAL SETUP -- GENERAL SETUP *************************************************************** * SETUP ..: *************************************************************** * SETUP - Set up CPU memory and VRAM ********@*****@*********************@************************** SETUP MOV R11,R3 ; Save R11 BL @SCROFF ; Turn off screen BL @CPYV2M DATA >0980,RAMBUF,10*8 ; Copy patterns of digit 0-9 from VRAM to RAM BL @CPYV2M DATA >0A08,RAMBUF+80,6*8 ; Copy patterns of letters A-F from VRAM to RAM BL @CPYM2V DATA >0800,RAMBUF,16*8 ; Copy patterns of 0-9,A-F to VRAM => set 1 BL @CPYM2V DATA >0880,RAMBUF,16*8 ; Copy patterns of 0-9,A-F to VRAM => set 2 BL @CPYM2V DATA >0F80,RAMBUF,16*8 ; Copy patterns of 0-9,A-F to VRAM => set 16 BL @CPYM2V DATA >0380,COLTAB,32 ; Load color table BL @FILV DATA >0000,32,32*24 ; Clear screen MOV @START,@MEMORY BL @SCRON ; Turn on screen B *R3 ; Return *-------------------------------------------------------------- * Some data used by subroutine *-------------------------------------------------------------- COLTAB BYTE >C0,>C0,>F0,>F0,>50,>50,>50,>50,>50,>50,>50,>50,>50,>50,>50,>50 BYTE >50,>50,>F0,>F0,>C0,>C0,>C0,>C0,>C0,>C0,>C0,>C0,>C0,>C0,>04,>04 T3 BYTE 8,>F0,>F1,>F2,>F3,>F4,>F5,>F6,>F7 START DATA >6000 ; Starting position * :.. *************************************************************** * MEMORY VIEWER -- MEMORY VIEWER -- MEMORY VIEWER *************************************************************** * SETUP2 ..: *************************************************************** * SETUP2 - Setup for memory viewer ********@*****@*********************@************************** SETUP2 BL @PUTAT DATA >0018,T3 ; Display 0..7 at Y=0 and X=24 LI R0,TIMERS MOV R0,@WTITAB LI R10,>0100 ; Set highest slot in use BL @MKSLOT DATA >0003,NAVI ; Start navigator task DATA >0103,DUMP,EOL ; Start memory dump task B @TMGR ; Run kernel task * :.. * NAVI ..: *************************************************************** * NAVI - Navigate through memory ********@*****@*********************@************************** NAVI DECT STACK MOV R11,*STACK ; Save R11 LI TMP1,22*8 MOV @WVRTKB,TMP0 ; Get keyboard flags COC @KEY1,TMP0 JEQ NAVIA COC @KEY2,TMP0 JEQ NAVIB LI TMP1,8 COC @KEY3,TMP0 JEQ NAVIA COC @KEY4,TMP0 JEQ NAVIB JMP NAVIZ NAVIA S TMP1,@MEMORY JMP NAVIZ NAVIB A TMP1,@MEMORY NAVIZ B @POPRT ; Exit KEY1 DATA K1UP ; Up KEY2 DATA K1DN ; Down KEY3 DATA K1LF ; Left KEY4 DATA K1RG ; Right * :.. * DUMP ..: *************************************************************** * DUMP - Take CPU memory dump ********@*****@*********************@************************** DUMP DECT STACK MOV R11,*STACK ; Save R11 MOV @MEMORY,@MEMOLD ; Take copy LI R2,23 ; 23 rows *-------------------------------------------------------------- * Do initialisation *-------------------------------------------------------------- MOV @MEMORY,R0 BL @PUTHEX ; Display current memory address DATA >0013,MEMORY,RAMBUF,16 MOV @ZTMP00,@WYX ; Set cursor start position *-------------------------------------------------------------- * Display byte values *-------------------------------------------------------------- DUMP1 LI R1,4 ; 4 Columns ORI CONFIG,>8000 ; Set display bit BL @MKHEX DATA MEMORY,RAMBUF,>F0 AB @BD4,@BX ; Next column DUMP2 MOV @MEMORY,R0 MOV *R0,R0 ; Display address ORI CONFIG,>C000 ; Set bit 0-1 (display bit, next charset bit) BL @MKHEX DATA R0HB,RAMBUF,0 ; Dump word AB @BD5,@BX INCT @MEMORY ; Next word DEC R1 JNE DUMP2 *-------------------------------------------------------------- * Display bytes as string *-------------------------------------------------------------- LI R1,8 ; Bytes to process MOV @MEMORY,R0 S R1,R0 LI TMP1,RAMBUF MOVB @BD8,*TMP1+ ; Set string length DUMP3 MOVB *R0+,TMP2 SRL TMP2,8 CI TMP2,33 JLT DUMP4 CI TMP2,127 JGT DUMP4 SWPB TMP2 JMP DUMP5 DUMP4 LI TMP2,>2E00 ; Display '.' character DUMP5 MOVB TMP2,*TMP1+ ; Write byte DEC R1 ; JNE DUMP3 ; Repeat until all bytes processed BL @PUTSTR ; Display string DATA RAMBUF *-------------------------------------------------------------- * Update position counters *-------------------------------------------------------------- AB @BD1,@BY ; Next row MOVB @BD0,@BX ; Start with column DEC R2 JNE DUMP1 MOV @MEMOLD,@MEMORY ; Restore current memory address DUMPZ B @POPRT ; Exit *-------------------------------------------------------------- * Some data used by subroutine *-------------------------------------------------------------- ZTMP00 DATA >0100 ; Display position Y=2, X=0 * :.. END Quote Link to comment Share on other sites More sharing options...
+retroclouds Posted July 28, 2011 Author Share Posted July 28, 2011 (edited) It gets interesting at 0:47 in the youtube video. When reaching the >9800 range you see a lot of changes. Are these the GROM ports? I verified it on my TI-99/4A and it behaves the same. The classic99 debugger does not show that behaviour. EDIT: Looking more closely it shows, that it's the GROM read data/read address being triggered. PAGE 0 9800 9802 PAGE 1 9804 9806 PAGE 2 9808 980A ..... Edited July 28, 2011 by retroclouds Quote Link to comment Share on other sites More sharing options...
+retroclouds Posted July 28, 2011 Author Share Posted July 28, 2011 (edited) This morning I dug out my old customized speech synthesizer. Some guy added a load interrupt switch to it back in the hay days. Never made use of it, so thought that today is a good day to give it a try I changed the program so that it can now attach itself to the load interrupt. Note that the program lives in the cartridge space (>6000). I always use an 8K supercart, but it should work the same when burned to (E)EPROM. Quite pleased with it Here's the updated binary and source code memview.zip ********@*****@*********************@************************** AORG >6000 *-------------------------------------------------------------- * Cartridge header *-------------------------------------------------------------- GRMHDR BYTE >AA,1,1,0,0,0 DATA PROG1 BYTE 0,0,0,0,0,0,0,0 PROG1 DATA PROG0 ; Address of next menu item DATA RUNINI TITLE1 BYTE 21 TEXT 'ATTACH LOAD INTERRUPT' PROG0 DATA 0 ; No more items following DATA RUNLIB TITLE0 BYTE 13 TEXT 'MEMORY VIEWER' *-------------------------------------------------------------- * Include required files *-------------------------------------------------------------- COPY "D:\Projekte\spectra2\tms9900\runlib.a99" *-------------------------------------------------------------- * SPECTRA2 startup options *-------------------------------------------------------------- SPVMOD EQU GRAPH1 ; Video mode. See VIDTAB for details. SPFONT EQU FNOPT3 ; Font to load. See LDFONT for details. SPFCLR EQU >C0 ; Foreground/Background color for font. SPFBCK EQU >01 ; Screen background color. *-------------------------------------------------------------- * Variables *-------------------------------------------------------------- TIMERS EQU >8342 ; Address of timer table (8 bytes) MEMORY EQU >8350 MEMOLD EQU >8352 RAMBUF EQU >8354 ; Work buffer *************************************************************** * Execute this before RUNLIB ********@*****@*********************@************************** RUNINI LI R0,>1234 ; Set flag for attaching to load interrupt MOV R0,@>8300 ; R0 in the SPECTRA2 workspace, not the GPL workspace (!) B @RUNLIB ; Initialize SPECTRA2 library *************************************************************** * Main ********@*****@*********************@************************** MAIN BL @SETUP ; Load fonts, etc. CI R0,>1234 ; Was flag set ? JEQ ATTACH ; Yes, attach to interrupt B @MVIEW ; No, so start memory viewer *************************************************************** * GENERAL SETUP -- GENERAL SETUP -- GENERAL SETUP *************************************************************** * SETUP ..: *************************************************************** * SETUP - Set up CPU memory and VRAM ********@*****@*********************@************************** SETUP MOV R11,R3 ; Save R11 BL @SCROFF ; Turn off screen BL @CPYV2M DATA >0980,RAMBUF,10*8 ; Copy patterns of digit 0-9 from VRAM to RAM BL @CPYV2M DATA >0A08,RAMBUF+80,6*8 ; Copy patterns of letters A-F from VRAM to RAM BL @CPYM2V DATA >0800,RAMBUF,16*8 ; Copy patterns of 0-9,A-F to VRAM => set 1 BL @CPYM2V DATA >0880,RAMBUF,16*8 ; Copy patterns of 0-9,A-F to VRAM => set 2 BL @CPYM2V DATA >0F80,RAMBUF,16*8 ; Copy patterns of 0-9,A-F to VRAM => set 16 BL @CPYM2V DATA >0380,COLTAB,32 ; Load color table BL @FILV DATA >0000,32,32*24 ; Clear screen MOV @START,@MEMORY BL @SCRON ; Turn on screen *-------------------------------------------------------------- * Prepare for timer table *-------------------------------------------------------------- LI TMP0,TIMERS MOV TMP0,@WTITAB LI R10,>0100 ; Set highest slot in use B *R3 ; Return *-------------------------------------------------------------- * Some data used by subroutine *-------------------------------------------------------------- COLTAB BYTE >C0,>C0,>F0,>F0,>50,>50,>50,>50,>50,>50,>50,>50,>50,>50,>50,>50 BYTE >50,>50,>F0,>F0,>C0,>C0,>C0,>C0,>C0,>C0,>C0,>C0,>C0,>C0,>04,>04 T3 BYTE 8,>F0,>F1,>F2,>F3,>F4,>F5,>F6,>F7 START DATA >6000 ; Starting position * :.. *************************************************************** * LOAD INTERRUPT -- LOAD INTERRUPT -- LOAD INTERRUPT *************************************************************** * ATTACH ..: *************************************************************** * ATTACH - Attach to load interrupt ********@*****@*********************@************************** ATTACH LI TMP0,WS1 ; spectra workspace at >8300 MOV TMP0,@>FFFC ; Set vector ATTAC0 LI TMP0,RUNLIB ; Entry point in spectra library MOV TMP0,@>FFFE ; Set vector C @>FFFC,@ATTACH+2 ; >8300 ? JNE ATTAC1 C @>FFFE,@ATTAC0+2 ; RUNLIB ? JNE ATTAC1 BL @PUTAT DATA >0503,MSG0 ; Successfully attached JMP ATTAC2 ATTAC1 BL @PUTAT DATA >0508,MSG1 ; Failed to attach ... ATTAC2 BL @PUTAT DATA >0805,MSG2 ; Press space bar to exit ... ATTAC3 BL @MKSLOT DATA >0001,EXIT,EOL ; Exit to title screen when key pressed ATTAC4 B @TMGR ; Start thread scheduler *-------------------------------------------------------------- * Background task *-------------------------------------------------------------- EXIT COC @ANYKEY,CONFIG ; Any key pressed ? JNE ATTAC4 ; No, check again BLWP @0 ; Exit MSG0 BYTE 26 TEXT 'ATTACHED TO LOAD INTERRUPT' MSG1 BYTE 16 TEXT 'FAILED TO ATTACH' MSG2 BYTE 23 TEXT 'PRESS SPACE BAR TO EXIT' * :.. *************************************************************** * MEMORY VIEWER -- MEMORY VIEWER -- MEMORY VIEWER *************************************************************** * MVIEW ..: *************************************************************** * MVIEW - Start memory viewer ********@*****@*********************@************************** MVIEW BL @PUTAT DATA >0018,T3 ; Display 0..7 at Y=0 and X=24 BL @MKSLOT DATA >0003,NAVI ; Start navigator task DATA >0103,DUMP,EOL ; Start memory dump task B @TMGR ; Run kernel task * :.. * NAVI ..: *************************************************************** * NAVI - Navigate through memory ********@*****@*********************@************************** NAVI LI TMP1,22*8 MOV @WVRTKB,TMP0 ; Get keyboard flags COC @KEY1,TMP0 JEQ NAVIA COC @KEY2,TMP0 JEQ NAVIB LI TMP1,8 COC @KEY3,TMP0 JEQ NAVIA COC @KEY4,TMP0 JEQ NAVIB JMP NAVIZ NAVIA S TMP1,@MEMORY JMP NAVIZ NAVIB A TMP1,@MEMORY NAVIZ B @SLOTOK ; Exit KEY1 DATA K1UP ; Up KEY2 DATA K1DN ; Down KEY3 DATA K1LF ; Left KEY4 DATA K1RG ; Right * :.. * DUMP ..: *************************************************************** * DUMP - Take CPU memory dump ********@*****@*********************@************************** DUMP MOV @MEMORY,@MEMOLD ; Take copy LI R2,23 ; 23 rows *-------------------------------------------------------------- * Do initialisation *-------------------------------------------------------------- MOV @MEMORY,R0 BL @PUTHEX ; Display current memory address DATA >0013,MEMORY,RAMBUF,16 MOV @ZTMP00,@WYX ; Set cursor start position *-------------------------------------------------------------- * Display byte values *-------------------------------------------------------------- DUMP1 LI R1,4 ; 4 Columns ORI CONFIG,>8000 ; Set display bit BL @MKHEX DATA MEMORY,RAMBUF,>F0 AB @BD4,@BX ; Next column DUMP2 MOV @MEMORY,R0 MOV *R0,R0 ; Display address ORI CONFIG,>C000 ; Set bit 0-1 (display bit, next charset bit) BL @MKHEX DATA R0HB,RAMBUF,0 ; Dump word AB @BD5,@BX INCT @MEMORY ; Next word DEC R1 JNE DUMP2 *-------------------------------------------------------------- * Display bytes as string *-------------------------------------------------------------- LI R1,8 ; Bytes to process MOV @MEMORY,R0 S R1,R0 LI TMP1,RAMBUF MOVB @BD8,*TMP1+ ; Set string length DUMP3 MOVB *R0+,TMP2 SRL TMP2,8 CI TMP2,33 JLT DUMP4 CI TMP2,127 JGT DUMP4 SWPB TMP2 JMP DUMP5 DUMP4 LI TMP2,>2E00 ; Display '.' character DUMP5 MOVB TMP2,*TMP1+ ; Write byte DEC R1 ; JNE DUMP3 ; Repeat until all bytes processed BL @PUTSTR ; Display string DATA RAMBUF *-------------------------------------------------------------- * Update position counters *-------------------------------------------------------------- AB @BD1,@BY ; Next row MOVB @BD0,@BX ; Start with column DEC R2 JNE DUMP1 MOV @MEMOLD,@MEMORY ; Restore current memory address DUMPZ B @SLOTOK ; Exit *-------------------------------------------------------------- * Some data used by subroutine *-------------------------------------------------------------- ZTMP00 DATA >0100 ; Display position Y=2, X=0 * :.. END Edited July 28, 2011 by retroclouds Quote Link to comment Share on other sites More sharing options...
+Ksarul Posted July 28, 2011 Share Posted July 28, 2011 Nice tool! I'll have to try this out when I get home from Hawaii... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.