Page 1 of 1

Fix for CoCo Extended BASIC 1.0 PCLEAR bug

Posted: Wed Nov 17, 2010 2:25 pm
by zephyr
The following BASIC program pokes in a position independent machine code routine which gets round the PCLEAR bug in Extended Color BASIC 1.0. Steve Woolham asked if I would post it here as there does not appear to be any other routine available to do this anywhere on the internet. The routine works under all versions of Extended Color BASIC, and can also be used to do the equivalent of a 'PCLEAR 0' from within a CoCo BASIC program.

Regards,
Steve

Code: Select all

10 'COCO PCLEAR FIX V1.0
20 'FOR EXTENDED COLOR BASIC 1.0
30 'BY STEPHEN J WOOLHAM
40 '***************************
50 'BASIC EXAMPLE PROGRAM
60 '***************************
70 ADDR = 474 : MC$="D67686063DDBBC1E895C1F0293193406D31B1F013506D3A6DDA67E96B4"
80 FOR I = 1 TO 58 STEP 2 : H$ = MID$(MC$,I,2) : POKE ADDR,VAL("&H"+H$) : ADDR = ADDR + 1 : NEXT
90 '
100 'LOCATION 118 DETERMINES HOW
110 'MANY PAGES ARE CLEARED
120 '
130 'PCLEAR8 = POKE118,8:EXEC474
140 '
150 POKE118,8:EXEC474

Re: Fix for CoCo Extended BASIC 1.0 PCLEAR bug

Posted: Wed Nov 17, 2010 2:25 pm
by zephyr
Here's an alternative routine. Both of these routines also allow you to PCLEAR more than 8 pages, but is not recommended with the first routine.

Code: Select all

10 'COCO PCLEAR FIX V2.0
20 'FOR EXTENDED COLOR BASIC 1.0
30 'BY STEPHEN J WOOLHAM
40 '***************************
50 'BASIC EXAMPLE PROGRAM #2
60 '***************************
70 MC$="8606D6763DDBBC1E895C1F0293193406D3A6DDA63506D31B1F014C932124037E96B47EB44A"
80 X=1:FOR I=474TO510:POKE I,VAL("&H"+MID$(MC$,X,2)):X=X+2:NEXT
90 '
100 'LOCATION 118 DETERMINES HOW
110 'MANY PAGES ARE CLEARED
120 '
130 'PCLEAR8 = POKE118,8:EXEC474
140 '
150 POKE118,8:EXEC474

Re: Fix for CoCo Extended BASIC 1.0 PCLEAR bug

Posted: Tue May 01, 2012 11:28 pm
by zephyr
This second alternative patches out the bug by intercepting one of the BASIC RAM hooks. The machine code routine is position independent, and compatible with all versions of Extended Color BASIC.

Code: Select all

10 'COCO PCLEAR FIX V3.0
20 'FOR EXTENDED COLOR BASIC 1.0
30 'BY STEPHEN J WOOLHAM
40 '*************************
50 'BASIC EXAMPLE PROGRAM #1
60 '*************************
70 CLEAR200,PEEK(116)*256+PEEK(117)-46
80 E=PEEK(116)*256+PEEK(117)-1:S=E-45
90 FOR I=S TO E:READ MC$:X=VAL("&H"+MC$):POKE I,X:CS=CS+X:NEXT
100 IF CS=5129 THEN EXEC S ELSE PRINT"ERROR IN DATA LINES.":END
110 '
120 'TEST
130 '
140 PCLEAR8
150 PMODE3,2
160 SCREEN1,1
170 PCLS6
180 GOTO180
200 DATA B6,96,AE,26,12,30,8D,0,F,BC,1,9B,27,9,FC,1,9B,ED,88,16,BF,1,9B
210 DATA 39,8C,96,D1,26,10,DC,68,81,FF,27,A,10,9E,A6,BD,AE,B4,1F,20,D7,A7,7E

Code: Select all

10 'COCO PCLEAR FIX V3.0
20 'FOR EXTENDED COLOR BASIC 1.0
30 'BY STEPHEN J WOOLHAM
40 '*************************
50 'BASIC EXAMPLE PROGRAM #2
60 '*************************
70 CLEAR200,PEEK(116)*256+PEEK(117)-46
80 E=PEEK(116)*256+PEEK(117)-1:S=E-45
90 MC$="B696AE2612308D000FBC019B2709FC019BED8816BF019B398C96D12610DC6881FF270A109EA6BDAEB41F20D7A77E"
100 X=1:FOR I=S TO E:POKE I,VAL("&H"+MID$(MC$,X,2)):X=X+2:NEXT:EXEC S
110 '
120 'TEST
130 '
140 PCLEAR8
150 PMODE3,2
160 SCREEN1,1
170 PCLS6
180 GOTO180