Skip to content

Instantly share code, notes, and snippets.

@mrdoornbos
Created January 25, 2021 17:54
Show Gist options
  • Save mrdoornbos/e26f136c87e3600210689a04361daf7c to your computer and use it in GitHub Desktop.
Save mrdoornbos/e26f136c87e3600210689a04361daf7c to your computer and use it in GitHub Desktop.
Was chatting with @8BitShowAndTell about C64 startup states, so during a long con call this morning I played with dumping memory contents as decimal location, hex location, dec value, hex value. Too slow to be usable but was fun to do. #commodore #C64
5 REM FROM P 84 OF PROGRAMMING C64
10 S=53248:E=54000:REM START AND END ADDRESS
20 FOR X=STOE:PRINTX TAB(9);
30 L=X:GOSUB1000;:PRINTTAB(16);
40 L=PEEK(X)
50 PRINTL TAB(22);:GOSUB1000:PRINT" ":NEXT:END
560 REM SHORT SUBROUTINE TO CONVERT A STRING OF
565 REM 4 HEX DIGITS TO DECIMAL AND PRINT RESULT
575 REM EXAMPLE OF USE:
580 REM L$="ABCD": GOSUB 600 PRINTS 43981
590 REM USES VARIABLES H,J,L, AND L$
600 L=0:FORJ=1TO4:L%=ASC(MID$(L$,J)):L%=L%-48+(L%>64)*7:L=16*L+L%:NEXT:PRINTL
610 RETURN
1000 L=L/4096:FORJ=1TO4:L%=L:L$=CHR$(48+L%-(L%>9)*7)
1010 PRINTL$;:L=16*(L-L%):NEXTJ:RETURN
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment