Apple II Miscellaneous #1: 80-Column Screen Dump

Apple II Technical Notes Developer Technical Support

Revised by: Pete McDonald November 1988
Written by: Greg Seitz December 1984

This Technical Note presents an example assembly language program which dumps the contents of the 80-column text screen to whatever is connected to COUT.


0000: 1 * 0000: 2 * 80-column screen dump 0000: 3 * 0000: 4 * By 0000: 5 * Greg Seitz 0000: 6 * 12-Jul-84 0000: 7 * 0000: 8 * This program will allow you to dump the contents 0000: 9 * of your 80-column text screen to whatever device is 0000: 10 * connected through COUT. If it is still connected to 0000: 11 * the screen, you will obviously be printing back 0000: 12 * what you were reading. 0000: 13 * 0000: FBC1 14 BASCALC EQU $FBC1 ;convert A reg to line addr on scrn 0000: FDED 15 COUT EQU $FDED ;A register out as ASCII 0000: C001 16 SET80COL EQU $C001 ;enable page 1/2 switches to control aux 0000: C055 17 TXTPAGE2 EQU $C055 ;page 2 or Aux depending 0000: C054 18 TXTPAGE1 EQU $C054 ;page 1 or main depending 0000: 0028 19 BASL EQU $28 ;BASCALC puts base addr. here 0000: 0029 20 BASH EQU $29 ;and high byte here. 0000: 21 * 1000: 1000 22 ORG $1000 ;or anywhere 1000: 1000 23 SCREENDMP EQU * 1000:A2 00 24 LDX #0 ;START AT LINE 0 1002: 25 * 1002:8A 26 SCRNLP TXA ;CALL BASCALC 1003:20 C1 FB 27 JSR BASCALC ;FOR ADDRESS OF LINE X 1006:A0 00 28 LDY #00 ;DO 80 CHARS STARTING FROM CHARACTER 0 1008: 29 * 1008: 1008 30 SCRNLP2 EQU * 1008:8D 01 C0 31 STA SET80COL ;SET UP FOR MAIN/AUX SWITCHING 100B:8D 55 C0 32 STA TXTPAGE2 ;START ON AUX 100E:98 33 TYA ;GET CURRENT INDEX FOR DIVIDE BY 2 100F:48 34 PHA ;SAVE ACTUAL COLUMN NUM WE'RE ON 1010:4A 35 LSR ;COLUMN/2=ODD OR EVEN BRANCH IF EVEN 1011:90 03 1016 36 BCC SCRNDMP1 ;TAKEN IF EVEN SINCE STATE IS PROPER 1013:8D 54 C0 37 STA TXTPAGE1 ;ELSE IF ODD TURN ON MAIN MEM 1016: 38 * 1016: 1016 39 SCRNDMP1 EQU * 1016:A8 40 TAY ;USE COLUMN/2 FOR INDEX NOW 1017:B1 28 41 LDA (BASL),Y ;GRAB THE CHARACTER 1019:8D 54 C0 42 STA TXTPAGE1 ;SEL MAIN SO IT SEES RIGHT SCREEN HOLES 101C:20 ED FD 43 JSR COUT ;PRINT THE CHARACTER 101F:68 44 PLA ;RECOVER COLUMN NUM 1020:A8 45 TAY ;INTO Y FOR NEXT TRIP 1021:C8 46 INY ;NEXT COLUMN NUM 1022:C0 50 47 CPY #80 ;ANY MORE? 1024:90 E2 1008 48 BCC SCRNLP2 ;TAKEN IF YES 1026:A9 8D 49 LDA #$8D ;ELSE CARRIAGE RETURN 1028:20 ED FD 50 JSR COUT ;OUT 102B:A9 8A 51 LDA #$8A ;LINE FEED 102D:20 ED FD 52 JSR COUT ;OUT 1030:E8 53 INX ;NEXT LINE 1031:E0 18 54 CPX #24 ;ANYMORE? 1033:90 CD 1002 55 BCC SCRNLP ;TAKEN IF YES 1035:60 56 RTS

FBC1 BASCALC ? 29 BASH 28 BASL FDED COUT C054 TXTPAGE1 C055 TXTPAGE2 ?1000 SCREENDMP 1016 SCRNDMP1 1008 SCRNLP2 1002 SCRNLP C001 SET80COL ** SUCCESSFUL ASSEMBLY := NO ERRORS ** ASSEMBLER CREATED ON 15-JAN-84 21:28 ** TOTAL LINES ASSEMBLED 56 ** FREE SPACE PAGE COUNT 84