Re: C64 (or possible other CBMs too): PETSCII -> screen codes conversion table in ROM?

From: Ullrich von Bassewitz <uz_at_musoftware.de>
Date: Mon, 12 Dec 2011 19:05:21 +0100
Message-ID: <20111212180520.GA32280@trixie.musoftware.de>
On Mon, Dec 12, 2011 at 05:11:52PM +0100, Gábor Lénárt wrote:
> But I want to avoid the "overhead"
> of calling CHROUT, so my question is: can I found a conversion table
> somewhere in the ROM, I can use, like this?

There is no conversion table. The kernal does conversion by code, because the
necessary code is small than a table would be.

Here is the code from the cc65 library that does conversion from PETSCII to
screen codes:

---------------------------------------------------------------------------

        [...]

; Printable char of some sort

	cmp  	#' '
    	bcc  	cputdirect	; Other control char
    	tay
    	bmi  	L10
    	cmp  	#$60
    	bcc  	L2
    	and  	#$DF
    	bne  	cputdirect	; Branch always
L2: 	and  	#$3F

cputdirect:
  	jsr  	putchar		; Write the character to the screen

; Advance cursor position

        [...]
        rts

; Handle character if high bit set

L10:	and  	#$7F
       	cmp    	#$7E 	  	; PI?
	bne  	L11
	lda  	#$5E 	  	; Load screen code for PI
	bne  	cputdirect
L11:	ora  	#$40
	bne  	cputdirect

; Write one character to the screen without doing anything else, return X
; position in Y

putchar:
    	ora  	RVS             ; Set revers bit
       	ldy    	CURS_X
	sta  	(SCREEN_PTR),y	; Set char
	lda  	CHARCOLOR
	sta  	(CRAM_PTR),y	; Set color
	rts

---------------------------------------------------------------------------

Please note that cr and lf are handled somewhere else in the code.

Regards


        Uz


-- 
Ullrich von Bassewitz                                  uz@musoftware.de

       Message was sent through the cbm-hackers mailing list
Received on 2011-12-12 19:00:04

Archive generated by hypermail 2.2.0.