'- - - - - - - - - - - - MEMORY EDITOR Ver 1.01 - - - - - - - - - - - - ' ' ' ' This program can read the first Megabyte of memory in the PC. It ' can also write data to locations that are writeable RAM, but ' !! BEWARE !! if you write data into certain areas of memory you ' can crash the computer. There are no safeties !!! ' ' ' The program accesses memory as 16 blocks of 64k addresses for a ' total of about 1.088 megs or so. Changing the segment address will ' let you select different blocks of memory as the segment address ' is added to the 64k block address to form the pointer into memory. ' ' For example. If the segment address is HEX 5000 then the address ' range of the display will be HEX 500000 thru 5FFFF. ' ' I haven't done a lot of testing on this program as it was really ' just an exercise in using pointers into memory for peeking and ' pokeing data, so BEWARE. If you find bugs let me know, and maybe ' I can update the progaram. ' ' ' Program by: William W. Sindel ' April 4, 2005 ' bsindel@yahoo.com ' ' Version 1.0 Released into the public domain April 21,2005 ' ' ' ' ' ' ' ' SUBROUTINES: ' ' READBLCK - Read a block of 512 bytes from memory ' PRNTMEM - PRINT the memory data to the screen ' UPARROW - Move the cursor up in the data array display ' DWNARROW - Move the cursor down ' LFTARROW - Move the cursor left ' RHTARROW - Move the cursor right ' PAGEUP - Scroll up thru memory 512 bytes ' PAGEDOWN - Scroll down thru memory 512 bytes ' WRITBYTE - Write to memory the data at the current cursor position ' SETSEG - Select which of the 16 memory segments to use ' PRINTMEM - Print the 512 bytes of data to the screen ' READBLCK - Read 512 bytes of data from the memory ' ' CLS DEFINT A-Z 'Make all single letter variables integers(saves typing) DIM MEMARRAY$(514)'This array holds the string data displayed on screen DIM MEMARRAY(514) AA& = 0 'Pointer for the current 512 byte of data DEF SEG = &H0 'Starting segment pointer GOSUB READBLCK 'Read in 512 bytes from memory GOSUB PRINTMEM 'Print the 512 byte data block to the screen N = 0 'Pointer to each of the 512 bytes displayed LP% = 0 'Pointer to which of the 16 bytes on a line are selected RR% = 2 'Row pointer for printing to the screen CC% = 6 'Column pointer for printing the hex data to the screen DD% = 54 'Data column pointer for printing to the screen SP% = 37 'For locating the row of the segment pointer display OP% = 10 'For locating the column of the segment pointer display COLOR 10, 0 'Set color green and print the column header info LOCATE 1, 1 PRINT "ADDR" LOCATE 1, 26 PRINT "HEX DATA" LOCATE 1, 57 PRINT "ASCII DATA" COLOR 30, 0 'Set color to blinking yellow and print the first HEX LOCATE RR%, CC% 'character in the data array to that color PRINT MEMARRAY$(N) COLOR 25, 0 'Set color to blinking blue and print the first LOCATE RR%, DD% 'ASCII character displayed to that color PRINT CHR$(MEMARRAY(N)) COLOR 14, 0 'Change the color to yellow and print the LOCATE 35, 1 'segment info column header PRINT "SEGMENT ADDRESS" COLOR 7, 8 'Change the color to white on black LOCATE 37, 1 'Print the rest of the segment info PRINT "HEX 0000" LOCATE 38, 1 PRINT "HEX 1000" LOCATE 39, 1 PRINT "HEX 2000" LOCATE 40, 1 PRINT "HEX 3000" LOCATE 41, 1 PRINT "HEX 4000" LOCATE 42, 1 PRINT "HEX 5000" LOCATE 43, 1 PRINT "HEX 6000" LOCATE 44, 1 PRINT "HEX 7000" LOCATE 37, 16 PRINT "HEX 8000" LOCATE 38, 16 PRINT "HEX 9000" LOCATE 39, 16 PRINT "HEX A000" LOCATE 40, 16 PRINT "HEX B000" LOCATE 41, 16 PRINT "HEX C000" LOCATE 42, 16 PRINT "HEX D000" LOCATE 43, 16 PRINT "HEX E000" LOCATE 44, 16 PRINT "HEX F000" COLOR 14, 0 'Set color to yellow blinking LOCATE 37, 10 PRINT "<==" 'Print the location of the current segment display LOCATE 37, 33 'Print the user help information PRINT "ARROWS KEYS TO MOVE THE CURSOR" LOCATE 38, 33 PRINT "PgUP/PgDOWN SCROLL 512 BYTES AT A TIME" LOCATE 39, 33 PRINT "F1 KEY TO SELECT THE SEGMENT" LOCATE 40, 33 PRINT "ENTER KEY TO ENTER NEW DATA OR SEGMENT" LOCATE 41, 33 PRINT "ESCAPE KEY TO EXIT THE PROGRAM" PROGRUN: KB$ = INKEY$ 'Main program loop starts here IF KB$ = CHR$(27) THEN DEF SEG : END 'Check if escape key pressed IF KB$ = CHR$(13) THEN GOTO PROGRUN 'Check for return/enter key 'since no data is entered yet 'do nothing KB = LEN(KB$) 'Check for special keys IF KB = 1 THEN GOTO KBIN 'Length 1 it's an ascii key KB$ = RIGHT$(KB$, 1) 'Strip off the leading zero IF KB$ = "H" THEN GOSUB UPARROW 'Go to the appropriate IF KB$ = "P" THEN GOSUB DWNARROW 'subroutine IF KB$ = "K" THEN GOSUB LFTARROW IF KB$ = "M" THEN GOSUB RHTARROW IF KB$ = "I" THEN GOSUB PAGEUP IF KB$ = "Q" THEN GOSUB PAGEDOWN IF KB$ = ";" THEN GOSUB SETSEG 'F1 key was pressed GOTO PROGRUN KBIN: 'HEX chars only IF ASC(KB$) >= 48 AND ASC(KB$) <= 58 THEN GOTO CONT1 '0-9 only IF ASC(KB$) >= 65 AND ASC(KB$) <= 71 THEN GOTO CONT1 'A-F only GOTO PROGRUN 'Not HEX char start over CONT1: LEFTCHR$ = KB$ 'First char of new HEX byte COLOR 12, 0 'Set color to red LOCATE RR%, CC% 'Locate on screen 1st HEX char PRINT LEFTCHR$ 'Print red character CC% = CC% + 1 'Move to next character RIGHTCHR$ = "" 'Set to no input in case KBINK: 'we have been here before RIGHTCHR$ = INKEY$ IF RIGHTCHR$ = "" THEN GOTO KBINK 'Get the second char of the HEX byte IF RIGHTCHR$ = CHR$(27) THEN DEF SEG : END 'Check if escape key IF RIGHTCHR$ = CHR$(13) THEN GOTO RESTART 'Restart if only one HEX 'char was typed IF ASC(RIGHTCHR$) >= 48 AND ASC(RIGHTCHR$) <= 58 THEN GOTO CONT2 IF ASC(RIGHTCHR$) >= 65 AND ASC(RIGHTCHR$) <= 71 THEN GOTO CONT2 GOTO KBINK 'If the second char wasn't CONT2: 'HEX keep trying until it is LOCATE RR%, CC% PRINT RIGHTCHR$ 'Locate on screen 2nd HEX char DOIT: WRTMEM$ = INKEY$ 'Get keyboard input IF WRTMEM$ = "" THEN GOTO DOIT 'Loop until input IF WRTMEM$ <> CHR$(13) THEN GOTO RESTART'Abort the write to memory if 'any key other than enter GOSUB WRITBYTE 'Write the byte to memory RESTART: COLOR 30, 0 'Set color to yellow blinking CC% = CC% - 1 'Locate the byte that was LOCATE RR%, CC% 'changed and print it to the PRINT MEMARRAY$(N) 'screen in blinking yellow COLOR 25, 0 'Set color to blue blinking LOCATE RR%, DD% 'Locate the new ascii data A$ = CHR$(MEMARRAY(N)) 'Read the new character value IF ASC(A$) < 33 OR ASC(A$) > 122 THEN A$ = "." 'Check letters and PRINT A$ 'numbers only will 'be printed else "." GOTO PROGRUN 'Go back to main loop END 'Just in case of problems '-------------------------------SUBROUTINES------------------------------- ' ' UPARROW: IF AA& <= 0 THEN RETURN 'Don't scroll below the start of memory COLOR 7, 8 'Set color to white in preparation for LOCATE RR%, CC% 'moving the cursor up to a new char PRINT MEMARRAY$(N) 'character LOCATE RR%, DD% 'Don't forget the ascii char A$ = CHR$(MEMARRAY(N)) IF ASC(A$) < 33 OR ASC(A$) > 122 THEN A$ = "." 'Only letters and PRINT A$ 'numbers else "." RR% = RR% - 1 'Move the row pointer up one row RETFLAG = 0 'Make sure flag value is zero IF RR% < 2 THEN GOSUB ADDLNU 'If the cursor is at the top of the 'data display scroll up one line IF RETFLAG = 1 THEN RETURN 'We scrolled up so go back to main loop COLOR 30, 0 'Set color to yellow blinking AA& = AA& - 16 'Move the addr pointer back 16 bytes N = N - 16 'Move the 512 byte pointer back 16 bytes LOCATE RR%, CC% 'Locate the new cursor position and PRINT MEMARRAY$(N) 'make the char blink yellow COLOR 25, 0 LOCATE RR%, DD% 'Don't forget the ascii data character A$ = CHR$(MEMARRAY(N)) IF ASC(A$) < 33 OR ASC(A$) > 122 THEN A$ = "." PRINT A$ RETURN ADDLNU: RETFLAG = 1 'Set flag=1 so we return to main loop 'when we're done AA& = AA& - 16 'Move address pointer back 16 bytes GOSUB READBLCK 'Get a new block of 512 bytes of data GOSUB PRINTMEM 'Print them to the screen RR% = RR% + 1 'Bump row counter +1 so we are at the COLOR 30, 0 'starting row of the data display, set LOCATE RR%, CC% 'color to blinking yellow, locate the PRINT MEMARRAY$(N) 'cursor position, and print the new COLOR 25, 0 'character. Don't forget the ascii LOCATE RR%, DD% 'data character A$ = CHR$(MEMARRAY(N)) IF ASC(A$) < 33 OR ASC(A$) > 122 THEN A$ = "." PRINT A$ RETURN 'Go back to the uparrow subroutine 'with retflag=1 so that we will go 'directly back to the main loop '-------------------------------SUBROUTINES------------------------------- DWNARROW: IF AA& >= 65520 THEN RETURN 'See comments for the uparrow COLOR 7, 8 'subroutine as the routines are LOCATE RR%, CC% 'essentially the same except for PRINT MEMARRAY$(N) 'a few different variables LOCATE RR%, DD% A$ = CHR$(MEMARRAY(N)) IF ASC(A$) < 33 OR ASC(A$) > 122 THEN A$ = "." PRINT A$ RR% = RR% + 1 RETFLAG = 0 IF RR% = 34 THEN GOSUB ADDLND IF RETFLAG = 1 THEN RETURN COLOR 30, 0 AA& = AA& + 16 N = N + 16 LOCATE RR%, CC% PRINT MEMARRAY$(N) COLOR 25, 0 LOCATE RR%, DD% A$ = CHR$(MEMARRAY(N)) IF ASC(A$) < 33 OR ASC(A$) > 122 THEN A$ = "." PRINT A$ RETURN 'Go back to the main program loop ADDLND: RETFLAG = 1 AA& = AA& - 480 GOSUB READBLCK GOSUB PRINTMEM AA& = AA& + 496 RR% = RR% - 1 COLOR 30, 0 LOCATE RR%, CC% PRINT MEMARRAY$(N) COLOR 25, 0 LOCATE RR%, DD% A$ = CHR$(MEMARRAY(N)) IF ASC(A$) < 33 OR ASC(A$) > 122 THEN A$ = "." PRINT A$ RETURN '-------------------------------SUBROUTINES------------------------------- LFTARROW: COLOR 7, 8 'Set the color to white so when we move LOCATE RR%, CC% 'the cursor one Hex byte the new char PRINT MEMARRAY$(N) 'will be the only blinking yellow char LOCATE RR%, DD% 'Don't forget the ascii char A$ = CHR$(MEMARRAY(N)) IF ASC(A$) < 33 OR ASC(A$) > 122 THEN A$ = "." PRINT A$ DD% = DD% - 1 'move cursor to new ascii char location CC% = CC% - 3 'Move cursor to new Hex char location N = N - 1 'Move the 512 byte pointer LP% = LP% - 1 'Move the 0-15 pointer IF CC% = 3 THEN DD% = DD% + 16'If we go past the beginning of the line IF CC% = 3 THEN N = N + 16 'wrap around to the end of the line of IF CC% = 3 THEN LP% = 15 'hex data we are looking at IF CC% = 3 THEN CC% = CC% + 48 COLOR 30, 0 'Set the color back to yellow blinking LOCATE RR%, CC% 'Locate the new character PRINT MEMARRAY$(N) 'and make it blink COLOR 25, 0 'Don't forget the ascii data LOCATE RR%, DD% A$ = CHR$(MEMARRAY(N)) IF ASC(A$) < 33 OR ASC(A$) > 122 THEN A$ = "." PRINT A$ RETURN 'Go back to the main program loop '-------------------------------SUBROUTINES------------------------------- RHTARROW: COLOR 7, 8 'See the comments for uparrow as the LOCATE RR%, CC% 'two subroutines are essentially the PRINT MEMARRAY$(N) 'same LOCATE RR%, DD% A$ = CHR$(MEMARRAY(N)) IF ASC(A$) < 33 OR ASC(A$) > 122 THEN A$ = "." PRINT A$ DD% = DD% + 1 CC% = CC% + 3 N = N + 1 LP% = LP% + 1 IF CC% = 54 THEN DD% = DD% - 16 IF CC% = 54 THEN N = N - 16 IF CC% = 54 THEN LP% = 0 IF CC% = 54 THEN CC% = CC% - 48 COLOR 30, 0 LOCATE RR%, CC% PRINT MEMARRAY$(N) COLOR 25, 0 LOCATE RR%, DD% A$ = CHR$(MEMARRAY(N)) IF ASC(A$) < 33 OR ASC(A$) > 122 THEN A$ = "." PRINT A$ RETURN 'Go back to main program loop '-------------------------------SUBROUTINES------------------------------- PAGEUP: 'Move the address pointer back 512 bytes AA& = AA& - 512 IF AA& < 512 THEN AA& = AA& + 512: RETURN 'Check if past begining of mem COLOR 7, 8 'Set color to white GOSUB READBLCK 'Get a new block of 512 characters GOSUB PRINTMEM 'Print them to the screen COLOR 30, 0 'Set color to yellow blinking LOCATE RR%, CC% 'Locate the cursor position PRINT MEMARRAY$(N) 'Make the character blink yellow LOCATE RR%, DD% 'Don't forget the ascii data COLOR 25, 0 A$ = CHR$(MEMARRAY(N)) IF ASC(A$) < 33 OR ASC(A$) > 122 THEN A$ = "." PRINT A$ RETURN 'Go back to the main program loop '-------------------------------SUBROUTINES------------------------------- PAGEDOWN: 'See the comments for pageup as the AA& = AA& + 512 'two subroutines are essentially alike IF AA& >= 65003 THEN AA& = AA& - 512: RETURN COLOR 7, 8 GOSUB READBLCK GOSUB PRINTMEM COLOR 30, 0 LOCATE RR%, CC% PRINT MEMARRAY$(N) LOCATE RR%, DD% COLOR 25, 0 A$ = CHR$(MEMARRAY(N)) IF ASC(A$) < 33 OR ASC(A$) > 122 THEN A$ = "." PRINT A$ RETURN 'Go back to the main program loop '- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ' ' ' ' WRITE THE MODIFIED BYTE TO MEMORY ' ' ' Here we have to take two ascii ' characters and convert them to a ' Hexidecimal number. I couldn't ' come up with an elegant algorythm ' so I did it with brute force and ' awkwardness ' ' WRITBYTE: FB$ = LEFTCHR$ 'Just to shorten the string name SB$ = RIGHTCHR$ IF FB$ = "0" THEN FB% = 0 'Determine the HEX value of the IF FB$ = "1" THEN FB% = 16 'first ascii character and make IF FB$ = "2" THEN FB% = 32 'it an integer number IF FB$ = "3" THEN FB% = 48 IF FB$ = "4" THEN FB% = 64 IF FB$ = "5" THEN FB% = 80 IF FB$ = "6" THEN FB% = 96 IF FB$ = "7" THEN FB% = 112 IF FB$ = "8" THEN FB% = 128 IF FB$ = "9" THEN FB% = 144 IF FB$ = "A" THEN FB% = 160 IF FB$ = "B" THEN FB% = 176 IF FB$ = "C" THEN FB% = 192 IF FB$ = "D" THEN FB% = 208 IF FB$ = "E" THEN FB% = 224 IF FB$ = "F" THEN FB% = 240 IF SB$ = "0" THEN SB% = 0 'Determine the HEX value of the IF SB$ = "1" THEN SB% = 1 'second ascii character and make IF SB$ = "2" THEN SB% = 2 'it an integer number IF SB$ = "3" THEN SB% = 3 IF SB$ = "4" THEN SB% = 4 IF SB$ = "5" THEN SB% = 5 IF SB$ = "6" THEN SB% = 6 IF SB$ = "7" THEN SB% = 7 IF SB$ = "8" THEN SB% = 8 IF SB$ = "9" THEN SB% = 9 IF SB$ = "A" THEN SB% = 10 IF SB$ = "B" THEN SB% = 11 IF SB$ = "C" THEN SB% = 12 IF SB$ = "D" THEN SB% = 13 IF SB$ = "E" THEN SB% = 14 IF SB$ = "F" THEN SB% = 15 MEMBYTE = FB% + SB% 'Add the two integers to get the POKE AA& + LP%, MEMBYTE 'character value and write it into 'memory MA$ = HEX$(MEMBYTE) 'Convert membyte to a string which 'represents the HEX value MALEN = LEN(MA$) 'Find the length of the Hex string IF MALEN = 1 THEN MA$ = "0" + MA$ 'If the lenth was 1 then add a 'zero so that two characters will 'always be printed to the screen MEMARRAY$(N) = MA$ 'Put the new character into the 512 MEMARRAY(N) = MEMBYTE 'byte array so we can see that memory 'was changed RETURN ' 'Go back to the main program loop ' '- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ' ' CHANGE THE SEGMENT POINTER ' SETSEG: COLOR 14, 0 'Stop blinking the cursor at the LOCATE RR%, CC% 'current character position PRINT MEMARRAY$(N) COLOR 9, 0 'Don't forget the ascii data LOCATE RR%, DD% A$ = CHR$(MEMARRAY(N)) IF ASC(A$) < 33 OR ASC(A$) > 122 THEN A$ = "." PRINT A$ COLOR 30, 0 'Set color to yellow blinking LOCATE SP%, OP% 'Locate the set segment pointer display PRINT "<==" 'Print the pointer SEGLOOP: KB$ = INKEY$ 'Get a key from the keyboard IF KB$ = CHR$(27) THEN END 'Check if escape key IF KB$ = CHR$(13) THEN GOTO EXITSS 'If enter key pressed we set the 'pointer location IF KB$ = "" THEN GOTO SEGLOOP 'Waiting for keyboard entry KB = LEN(KB$) IF KB = 1 THEN GOTO SEGLOOP 'If it wasn't a special key try again KB$ = RIGHT$(KB$, 1) 'Strip off the leading "0" IF KB$ = "P" THEN GOTO DWNPTR1'If down arrow key was pressed IF KB$ = "H" THEN GOTO UPPTR1 'If up arrow key was pressed GOTO SEGLOOP 'Try again '- - - - - - - - - - - 'Here again I couldn't come up with 'an elegant solution so brute force 'and awkwardness it is UPPTR1: IF SP% <> 44 THEN GOTO UPPTR2 'If SP% is 44 execute this code LOCATE SP%, OP% 'Set the location of the current PRINT " " 'segment display pointer and erase it SP% = SP% - 1 'Move the pointer location up 1 row LOCATE SP%, OP% 'Set the new pointer location PRINT "<==" 'and print the new pointer display IF OP% = 10 THEN DEF SEG = &H6000 'New segment value if in the 1st col IF OP% = 25 THEN DEF SEG = &HE000 'New segment value if in the 2nd col GOTO SETSEG 'Change the segment value '- - - - - - - - - - - UPPTR2: 'Etc. IF SP% <> 43 THEN GOTO UPPTR3 LOCATE SP%, OP% PRINT " " SP% = SP% - 1 LOCATE SP%, OP% PRINT "<==" IF OP% = 10 THEN DEF SEG = &H5000 IF OP% = 25 THEN DEF SEG = &HD000 GOTO SETSEG '- - - - - - - - - - - UPPTR3: 'Etc. IF SP% <> 42 THEN GOTO UPPTR4 LOCATE SP%, OP% PRINT " " SP% = SP% - 1 LOCATE SP%, OP% PRINT "<==" IF OP% = 10 THEN DEF SEG = &H4000 IF OP% = 25 THEN DEF SEG = &HC000 GOTO SETSEG '- - - - - - - - - - - UPPTR4: 'Etc. IF SP% <> 41 THEN GOTO UPPTR5 LOCATE SP%, OP% PRINT " " SP% = SP% - 1 LOCATE SP%, OP% PRINT "<==" IF OP% = 10 THEN DEF SEG = &H3000 IF OP% = 25 THEN DEF SEG = &HB000 GOTO SETSEG '- - - - - - - - - - - UPPTR5: 'Etc. IF SP% <> 40 THEN GOTO UPPTR6 LOCATE SP%, OP% PRINT " " SP% = SP% - 1 LOCATE SP%, OP% PRINT "<==" IF OP% = 10 THEN DEF SEG = &H2000 IF OP% = 25 THEN DEF SEG = &HA000 GOTO SETSEG '- - - - - - - - - - - UPPTR6: 'Etc. IF SP% <> 39 THEN GOTO UPPTR7 LOCATE SP%, OP% PRINT " " SP% = SP% - 1 LOCATE SP%, OP% PRINT "<==" IF OP% = 10 THEN DEF SEG = &H1000 IF OP% = 25 THEN DEF SEG = &H9000 GOTO SETSEG '- - - - - - - - - - - UPPTR7: 'Etc. IF SP% <> 38 THEN GOTO UPPTR8 LOCATE SP%, OP% PRINT " " SP% = SP% - 1 LOCATE SP%, OP% PRINT "<==" IF OP% = 10 THEN DEF SEG = &H0 IF OP% = 25 THEN DEF SEG = &H8000 GOTO SETSEG '- - - - - - - - - - - UPPTR8: IF OP% = 10 THEN GOTO SETSEG 'If we are at the top of the first LOCATE SP%, OP% 'column don't change anything just PRINT " " 'go back and check for another arrow OP% = 10 'key SP% = SP% + 7 LOCATE SP%, OP% PRINT "<==" 'Etc. DEF SEG = &H7000 GOTO SETSEG '- - - - - - - - - - - DWNPTR1: 'Etc. IF SP% <> 37 THEN GOTO DWNPTR2 LOCATE SP%, OP% PRINT " " SP% = SP% + 1 LOCATE SP%, OP% PRINT "<==" IF OP% = 10 THEN DEF SEG = &H1000 IF OP% = 25 THEN DEF SEG = &H9000 GOTO SETSEG '- - - - - - - - - - - DWNPTR2: 'Etc. IF SP% <> 38 THEN GOTO DWNPTR3 LOCATE SP%, OP% PRINT " " SP% = SP% + 1 LOCATE SP%, OP% PRINT "<==" IF OP% = 10 THEN DEF SEG = &H2000 IF OP% = 25 THEN DEF SEG = &HA000 GOTO SETSEG '- - - - - - - - - - - DWNPTR3: 'Etc. IF SP% <> 38 THEN GOTO DWNPTR4 LOCATE SP%, OP% PRINT " " SP% = SP% + 1 LOCATE SP%, OP% PRINT "<==" IF OP% = 10 THEN DEF SEG = &H3000 IF OP% = 25 THEN DEF SEG = &HB000 GOTO SETSEG '- - - - - - - - - - - DWNPTR4: 'Etc. IF SP% <> 39 THEN GOTO DWNPTR5 LOCATE SP%, OP% PRINT " " SP% = SP% + 1 LOCATE SP%, OP% PRINT "<==" IF OP% = 10 THEN DEF SEG = &H4000 IF OP% = 25 THEN DEF SEG = &HC000 GOTO SETSEG '- - - - - - - - - - - DWNPTR5: 'Etc. IF SP% <> 40 THEN GOTO DWNPTR6 LOCATE SP%, OP% PRINT " " SP% = SP% + 1 LOCATE SP%, OP% PRINT "<==" IF OP% = 10 THEN DEF SEG = &H5000 IF OP% = 25 THEN DEF SEG = &HD000 GOTO SETSEG '- - - - - - - - - - - DWNPTR6: 'Etc. IF SP% <> 41 THEN GOTO DWNPTR7 LOCATE SP%, OP% PRINT " " SP% = SP% + 1 LOCATE SP%, OP% PRINT "<==" IF OP% = 10 THEN DEF SEG = &H6000 IF OP% = 25 THEN DEF SEG = &HE000 GOTO SETSEG '- - - - - - - - - - - DWNPTR7: 'Etc. IF SP% <> 42 THEN GOTO DWNPTR8 LOCATE SP%, OP% PRINT " " SP% = SP% + 1 LOCATE SP%, OP% PRINT "<==" IF OP% = 10 THEN DEF SEG = &H7000 IF OP% = 25 THEN DEF SEG = &HF000 GOTO SETSEG '- - - - - - - - - - - DWNPTR8: 'Etc. IF SP% <> 43 THEN GOTO DWNPTR9 LOCATE SP%, OP% PRINT " " SP% = SP% + 1 LOCATE SP%, OP% PRINT "<==" IF OP% = 10 THEN DEF SEG = &H7000 IF OP% = 25 THEN DEF SEG = &HE000 GOTO SETSEG '- - - - - - - - - - - DWNPTR9: IF OP% = 25 THEN GOTO SETSEG 'If we are at the bottom of the 2nd LOCATE SP%, OP% 'column don't change anything just PRINT " " 'go back and check for arrow keys OP% = 25 SP% = SP% - 7 LOCATE SP%, OP% 'Etc. PRINT "<==" DEF SEG = &H8000 GOTO SETSEG EXITSS: COLOR 14, 0 'Set color to yellow LOCATE SP%, OP% 'Locate the set segment pointe display PRINT "<==" 'Print the pointer COLOR 7, 8 'Set the color to white GOSUB READBLCK 'Get 512 bytes from the new segment GOSUB PRINTMEM 'Print them to the screen COLOR 30, 0 'Set the color to yellow blinking LOCATE RR%, CC% 'Locate the current cursor location PRINT MEMARRAY$(N) 'Make the character blink yellow COLOR 25, 0 'Don't forget the ascii data LOCATE RR%, DD% A$ = CHR$(MEMARRAY(N)) IF ASC(A$) < 33 OR ASC(A$) > 122 THEN A$ = "." PRINT A$ RETURN 'Go back to the main program loop '- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - PRINTMEM: BC& = AA& / 16 'Each line of chars is 16 long so this 'will tell us what line we are on RRP% = 2 'Set the row pointer to 2 don't mess with RR% CCP% = 1 'Set the col pointer to 1 don't mess with CC% XX% = 0 'Start of a line value YY% = 15 'End of a line value FOR P = 1 TO 32 'Start of a loop to print 32 lines of data LOCATE RRP%, CCP% 'Locate the row and column to print BC$ = HEX$(BC&) 'Make a string character of the hex value of 'of the line we are on BC$ = "0000" + BC$ 'Add in some leading zeroes BC$ = RIGHT$(BC$, 4) 'Keep the right most 4 characters PRINT BC$; 'Print the 4 characters PRINT "-"; FOR J = XX% TO YY% 'Start the loop to print 16 HEX values PRINT MEMARRAY$(J); 'Print a character PRINT " "; 'Print two spaces NEXT J 'Loop til 16 chars are printed FOR J = XX% TO YY% 'Start the loop to print 16 ascii chars A$ = CHR$(MEMARRAY(J)) 'Don't forget the ascii data IF ASC(A$) < 33 OR ASC(A$) > 122 THEN A$ = "." PRINT A$; NEXT J 'Loop til 16 ascii chars are printed BC& = BC& + 1 'Next group of 16 address location RRP% = RRP% + 1 'Move to the next row XX% = XX% + 16 'Start of the next 16 characters to print YY% = YY% + 16 'End of the 16 characters NEXT P 'Loop til 32 lines are printed RETURN 'Go back to the main program loop '- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -' ' ' READ 512 MEMORY LOCATIONS ' ' COME HERE WITH AA& SET TO THE BLOCK OF MEMORY YOU WANT TO READ ' ' ' READBLCK: A = 0 'Could have done this as a loop BB& = AA& 'Use BB& so we don't mess with the 'address value in AA& READMEM: IF BB& > 65023 THEN RETURN 'Don't read past the end of memory C = PEEK(BB&) 'Get char value at the current address C$ = HEX$(C) 'Make a string representation of the HEX L = LEN(C$) IF L = 1 THEN C$ = "0" + C$ 'If the string is only 1 character add 'a leading zero so we always print two 'characters MEMARRAY$(A) = C$ 'Put the string into the 512 byte array MEMARRAY(A) = C 'Put char value into the 512 byte array BB& = BB& + 1 'Get the next address value A = A + 1 'Bump the character address counter IF A > 511 THEN RETURN 'Return when 512 bytes are read GOTO READMEM 'Loop for the next byte ' '