[Coco] mess video bug

Robert Gault robert.gault at att.net
Wed Apr 4 08:38:23 EDT 2012


Earl Casper wrote:
> Th following program demonstrates a flaw in mess when placing the hi-res
> text buffer anywhere but $36
>

Well, that's as may be. :)  You program produces the same results on a real 512K 
Coco3 as with MESS configured for 512K memory. That latter is critical to 
actually have two different text screens.

Let's take a look at the errors in your program.

1) You do not "clear" the text screens. That means all kinds of visual garbage 
could be present depending on the state of memory before your program starts 
running.
2) You do not set the attribute bytes in the new screen at $5E000 which means 
any text written to the screen would have completely unpredictable colors, 
underlining, and flashing.
3) Your test for regA comes after you store regA to the text screen. That means 
you placed a $00 for a final character on the screen. I doubt that is what you 
intended.
4) This may be intentional, a typo, or an error. The second screen would be the 
default text screen location except for the 3 in $D803. So the video does not 
start in the usual location.

I have rewritten your assembly code to what I think you wanted. There is an 
option in EDTASM6309 to permit saving source code without line numbers. Makes it 
easier to cut and paste.

   ORG $5000
START LDA #$BC  SET VIDEO TO $5E000
  STA $FF9D
  LDA #$2F	SET FOR $5E000 AT $6000
  STA $FFA3
  BSR CLR
  LDU #$6000+20	CENTER TEXT ON TOP LINE
  BSR WRITE
  LDD #$D803	SET VIDEO TO $6C018. REALLY??
  STD $FF9D
  LDA #$36	SET $6C000 AT $6000
  STA $FFA3
  BSR CLR
  LDU #$6000+44
  BSR WRITE
  RTS

MESG FCC "THIS IS A TEST."
  FCB 0

WRITE LDX #MESG
  CLRB
LOOP LDA ,X+
  BEQ WAIT
  STD ,U++
  BRA LOOP
WAIT JSR [$A000]
  BEQ WAIT
  RTS

CLR LDU #$6000	SET REGu TO CLEAR ENTIRE SCREEN
  PSHS X
  LDD #$2000	"SPACE" + NO ATTRIBUTE PALETTE 0 FOR BOTH FORE AND BACKGROUND
  LDX #2000	SIZE OF WIDTH40 SCREEN
CLOOP STD ,U++
  LEAX -2,X
  BNE CLOOP
  PULS X,PC

  END START


> 10 CLEAR 200,&H5000:WIDTH 40:LOADM"TEST1:0":EXEC
>
> 00100  ORG $5000
> 00110 START LDA #$BC
> 00120  STA $FF9D
> 00130  LDA #$2F
> 00140  STA $FFA3
> 00150  LDX #MESG
> 00160  LDU #$6000+20
> 00170 LOOP LDA ,X+
> 00180  STA ,U++
> 00190  BNE LOOP
> 00200 WAIT JSR [$A000]
> 00210  BEQ WAIT
> 00220  LDD #$D803
> 00230  STD $FF9D
> 00240  LDA #$36
> 00250  STA $FFA3
> 00260  LDX #MESG
> 00270  LDU #$6000+20+24
> 00280 LOOP1 LDA ,X+
> 00290  STA ,U++
> 00300  BNE LOOP1
> 00310 WAIT1 JSR [$A000]
> 00320  BEQ WAIT1
> 00330  RTS
> 00340 MESG FCC /THIS IS A TEST./
> 00350  FCB 0
> 00360  END START
>



More information about the Coco mailing list