Jump to content

CTRL register's Character Width bit

Recommended Posts


Now that I have a concrete idea for a relatively small game that I would like to play on the 7800 (way too early to reveal,
I'd hate to end up on Trebor's Atari 7800 Homebrews and Hacks Thread "dormant" list ;-)), I've picked up 7800 programming again.

To see if I can wrap my head against MARIA's indirect character mode, I'm trying to hack Dan Boris' sprite demo code into a tiled mode demo (without sprites).

The 7800 programmer's guide says this (I've checked two versions):

The CTRL register is arranged as follows:
CK | DM1 | DM0 | CW | BC | KM | RM1 | RM0

CW - Character Width.
0 => Two (2) byte characters.
1 => Single byte characters.


When I setup the CTRL register with CW=1 (Single byte character):

	lda	#%01010011
	sta	CTRL

I get the (unexpected) output as attached (7800_cw_1.png)

While when I set it CW=0 (Two (2) byte characters), I get the output that I hoped to see, three smileys next to each other (7800_cw_0.png).


But don't understand why CW=0 works, I had expected CW=1 to produce the right result.


This is how I setup CHARBASE

	lda #$a0

Here's the relevant DL entry (xpos is contant with 0 value):

   	;Create DL entry for background
   	ldy	dlend,x		;Get the index to the end of this DL
   	lda	#$00				
	sta     (dlpnt),y	;Low byte of data address
	lda	#%01100000	;Mode 320x1
	sta     (dlpnt),y
	lda	#$b0
	sta     (dlpnt),y
	lda	#%00011101	;Palette 0, 1 byte wide
	sta     (dlpnt),y
	lda	xpos		;Horizontal position
        sta     (dlpnt),y
        sty	dlend,x

And this is the graphic data and the tile data:

;************** Graphic Data *****************************
        org $a000
        .byte     %00111100
        org $a100
        .byte     %00111100
        org $a200
        .byte     %01000010 
        org $a300
        .byte     %01000010 
        org $a400
        .byte     %10011001
        org $a500
        .byte     %10011001
        org $a600
        .byte     %10100101
        org $a700
        .byte     %10100101
        org $a800
        .byte     %10000001
        org $a900
        .byte     %10000001
        org $aA00
        .byte     %10100101
        org $aB00
        .byte     %10100101
        org $aC00
        .byte     %01000010
        org $aD00
        .byte     %01000010
        org $aE00
        .byte     %00111100
        org $aF00
        .byte     %00111100

;************** Character map *****************************

		org $b000
		.byte $0,$0,$0

Can somebody explain why two tiles are updated, while I tell the Maria chip that one character takes up 1 byte?


I have added my modified script, but it's an experiment and messy, as I left a lot of the original code of Dan Boris' sprite code in it.That's fully my fault, do not blame Dan for this ;-)

Thanks in advance for any help!





Edited by ArcadeAction
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...