The following short listing for the CBM 64 dumps the screen display to the Commodore printer. Although a program to do this is given in the CBM printer manual, it will not produce characters generated by reverse video.
This program will reproduce all CBM characters and it also shorter and, I believe, more efficient.
If a graphic screen is to be copied then the CHR$ value in 60030 should read 8. This is a short listing and should ideally be used as a subroutine within the main program. Conversion to the Vic 20 will require alterations to lines 60010 and 60105.
60000 REM*******SCREEN DUMP*******
60001 REM**** ****
60002 REM****BY D.K.TWINBERROW****
60010 AT$=""
60020 F=0:DIMAS$(80)
60030 OPEN4,4:PRINT#4,CHR$(15)
60100 FORX=1024TO2023STEP40
60105 FORS=0TO39
60110 CH=PEEK(X+S)
60120 IFCH>=0 AND CH<=31 THEN AS$(S)=AS$(S)+CHR$(CH+64)
60130 IFCH>=32 AND CH<=63 THEN AS$(S)=AS$(S)+CHR$(CH)
60140 IFCH>=64 AND CH<=95 THEN AS$(S)=AS$(S)+CHR$(CH+32)
60150 IFCH>=96 AND CH<=127 THEN AS$(S)=AS$(S)+CHR$(CH+64)
60160 IFCH>=128 THEN CH=CH-128:AS$(S)=AS$(S)+CHR$(18):F=1:GOTO60120
60170 IFF=1 THEN AS$(S)=AS$(S)+CHR$(146):F=0
60190 AT$=AT$+AS$(S):AS$(S)=""
60200 NEXTS
60210 PRINT#4,AT$
60220 AT$="":NEXTX
60230 CLOSE4:RETURN