Classic Computer Magazine Archive COMPUTE! ISSUE 43 / DECEMBER 1983 / PAGE 10

Reading Commodore 1541 Disk Drive Memory

I own a 1541 Disk Drive. I wrote a small program so I could read the disk ROM and display the contents in hex format. Starting at location 00,I can get information for about 100 bytes. Then I get a repeating pattern: 0D,30,30,2C,20,4F,4B,2C,30,30,2C,30,30,0D. Other than location 00, no matter where I start, I get this same pattern.

Can you help me?

Larry Rieth

Jim Butterfield replies:

It's not hard to view disk ROM, once you get the commands right. The false pattern you were getting, by the way, is the 00,OK, 00,00 status message in ASCII. I find it easiest to call up the bytes one at a time.

The program here should do the job. There are some "cursor cosmetics" built in to aid with convenience of use; these are not essential, so you may want to eliminate them. Everything is in hexadecimal, since that's the most convenient way to read machine language. Again, change this if you wish.

I don't have any 1541 memory maps. I have been hanging back since Commodore has been known to change architecture from time to time. If you want to view disk ROM, start at $C000 and work up from there.

190 PRINT"INPUT MEMORY ADDRESS"
200 PRINT"IN HEXADECIMAL:":OPEN1,8,15
220 PRINT"{2 SPACES){4 RIGHT}{31 SPACES]
    {UP}"
230 Z$="XXXX":INPUTZ$
240 PRINT"{UP}";:IF LEN(Z$)<>4 THEN GOTO
    {SPACE}220
250 T=0:FOR J=l TO 4:Y=ASC(MID$(Z$, J) )
260 Y=Y+48*(Y<58)+55*(Y>64)
280 IF Y<0 OR Y>15 THEN GOTO 470
290 T=T*16+Y:NEXT J:K=0:PRINT"{6 RIGHT}";
300 V=INT(T/256):U=T-V*256
360 PRINT#1,"M-R";CHR$(U);CHR$(V)
370 GET#1,X$:IF X$=" " THEN X$=CHR$(0)
380 PRINT" ";:X=ASC(X$)/16
390 FOR J=l TO 2:GOSUB 500:NEXT J
420 T=T+1:K=K+1:IF K<8 GOTO 300
440 X=T/4096
450 PRINT:PRINT"{2 SPACES}";:FORJ=1 TO 4:
    GOSUB 500:NEXT J:PRINT"{UP}":GOTO 220
470 CLOSE 1:END
500 X%=X:X=(X-X%)*16:IF X%>9 THEN X%=X%+7
510 PRINT CHR$(X%+48);:RETURN