mirror of
				https://github.com/irmen/prog8.git
				synced 2025-11-03 19:16:13 +00:00 
			
		
		
		
	txt.setcc() is romable
This commit is contained in:
		@@ -388,27 +388,29 @@ asmsub  getclr  (ubyte col @A, ubyte row @Y) clobbers(Y) -> ubyte @ A {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
sub  setcc  (ubyte col, ubyte row, ubyte character, ubyte charcolor)  {
 | 
					sub  setcc  (ubyte col, ubyte row, ubyte character, ubyte charcolor)  {
 | 
				
			||||||
	; ---- set char+color at the given position on the screen
 | 
						; ---- set char+color at the given position on the screen
 | 
				
			||||||
    ; TODO: Romable
 | 
					 | 
				
			||||||
	%asm {{
 | 
						%asm {{
 | 
				
			||||||
 | 
					_charptr = P8ZP_SCRATCH_W1
 | 
				
			||||||
 | 
					_colorptr = P8ZP_SCRATCH_W2
 | 
				
			||||||
		lda  row
 | 
							lda  row
 | 
				
			||||||
		asl  a
 | 
							asl  a
 | 
				
			||||||
		tay
 | 
							tay
 | 
				
			||||||
		lda  setchr._screenrows+1,y
 | 
							lda  setchr._screenrows+1,y
 | 
				
			||||||
		sta  _charmod+2
 | 
							sta  _charptr+1
 | 
				
			||||||
		adc  #$d4
 | 
							adc  #$d4
 | 
				
			||||||
		sta  _colormod+2
 | 
							sta  _colorptr+1
 | 
				
			||||||
		lda  setchr._screenrows,y
 | 
							lda  setchr._screenrows,y
 | 
				
			||||||
		clc
 | 
							clc
 | 
				
			||||||
		adc  col
 | 
							adc  col
 | 
				
			||||||
		sta  _charmod+1
 | 
							sta  _charptr
 | 
				
			||||||
		sta  _colormod+1
 | 
							sta  _colorptr
 | 
				
			||||||
		bcc  +
 | 
							bcc  +
 | 
				
			||||||
		inc  _charmod+2
 | 
							inc  _charptr+1
 | 
				
			||||||
		inc  _colormod+2
 | 
							inc  _colorptr+1
 | 
				
			||||||
+		lda  character
 | 
					+		lda  character
 | 
				
			||||||
_charmod	sta  $ffff		; modified
 | 
							ldy  #0
 | 
				
			||||||
 | 
							sta  (_charptr),y
 | 
				
			||||||
		lda  charcolor
 | 
							lda  charcolor
 | 
				
			||||||
_colormod	sta  $ffff		; modified
 | 
							sta  (_colorptr),y
 | 
				
			||||||
		rts
 | 
							rts
 | 
				
			||||||
	}}
 | 
						}}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -391,27 +391,29 @@ asmsub  getclr  (ubyte col @A, ubyte row @Y) clobbers(Y) -> ubyte @ A {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
sub  setcc  (ubyte col, ubyte row, ubyte character, ubyte charcolor)  {
 | 
					sub  setcc  (ubyte col, ubyte row, ubyte character, ubyte charcolor)  {
 | 
				
			||||||
	; ---- set char+color at the given position on the screen
 | 
						; ---- set char+color at the given position on the screen
 | 
				
			||||||
    ; TODO: Romable
 | 
					 | 
				
			||||||
	%asm {{
 | 
						%asm {{
 | 
				
			||||||
 | 
					_charptr = P8ZP_SCRATCH_W1
 | 
				
			||||||
 | 
					_colorptr = P8ZP_SCRATCH_W2
 | 
				
			||||||
		lda  row
 | 
							lda  row
 | 
				
			||||||
		asl  a
 | 
							asl  a
 | 
				
			||||||
		tay
 | 
							tay
 | 
				
			||||||
		lda  setchr._screenrows+1,y
 | 
							lda  setchr._screenrows+1,y
 | 
				
			||||||
		sta  _charmod+2
 | 
							sta  _charptr+1
 | 
				
			||||||
		adc  #$d4
 | 
							adc  #$d4
 | 
				
			||||||
		sta  _colormod+2
 | 
							sta  _colorptr+1
 | 
				
			||||||
		lda  setchr._screenrows,y
 | 
							lda  setchr._screenrows,y
 | 
				
			||||||
		clc
 | 
							clc
 | 
				
			||||||
		adc  col
 | 
							adc  col
 | 
				
			||||||
		sta  _charmod+1
 | 
							sta  _charptr
 | 
				
			||||||
		sta  _colormod+1
 | 
							sta  _colorptr
 | 
				
			||||||
		bcc  +
 | 
							bcc  +
 | 
				
			||||||
		inc  _charmod+2
 | 
							inc  _charptr+1
 | 
				
			||||||
		inc  _colormod+2
 | 
							inc  _colorptr+1
 | 
				
			||||||
+		lda  character
 | 
					+		lda  character
 | 
				
			||||||
_charmod	sta  $ffff		; modified
 | 
							ldy  #0
 | 
				
			||||||
 | 
							sta  (_charptr),y
 | 
				
			||||||
		lda  charcolor
 | 
							lda  charcolor
 | 
				
			||||||
_colormod	sta  $ffff		; modified
 | 
							sta  (_colorptr),y
 | 
				
			||||||
		rts
 | 
							rts
 | 
				
			||||||
	}}
 | 
						}}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -202,23 +202,23 @@ sub  setclr  (ubyte col, ubyte row, ubyte color)  {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
sub  setcc  (ubyte col, ubyte row, ubyte character, ubyte charcolor)  {
 | 
					sub  setcc  (ubyte col, ubyte row, ubyte character, ubyte charcolor_ignored)  {
 | 
				
			||||||
	; ---- set char at the given position on the screen. charcolor is ignored on PET
 | 
						; ---- set char at the given position on the screen. charcolor is ignored on PET
 | 
				
			||||||
    ; TODO: Romable
 | 
					 | 
				
			||||||
	%asm {{
 | 
						%asm {{
 | 
				
			||||||
  		lda  row
 | 
					  		lda  row
 | 
				
			||||||
		asl  a
 | 
							asl  a
 | 
				
			||||||
		tay
 | 
							tay
 | 
				
			||||||
		lda  setchr._screenrows+1,y
 | 
							lda  setchr._screenrows+1,y
 | 
				
			||||||
		sta  _charmod+2
 | 
							sta  P8ZP_SCRATCH_W1+1
 | 
				
			||||||
		lda  setchr._screenrows,y
 | 
							lda  setchr._screenrows,y
 | 
				
			||||||
		clc
 | 
							clc
 | 
				
			||||||
		adc  col
 | 
							adc  col
 | 
				
			||||||
		sta  _charmod+1
 | 
							sta  P8ZP_SCRATCH_W1
 | 
				
			||||||
		bcc  +
 | 
							bcc  +
 | 
				
			||||||
		inc  _charmod+2
 | 
							inc  P8ZP_SCRATCH_W1+1
 | 
				
			||||||
+		lda  character
 | 
					+		lda  character
 | 
				
			||||||
_charmod	sta  $ffff		; modified
 | 
							ldy  #0
 | 
				
			||||||
 | 
							sta  (P8ZP_SCRATCH_W1),y
 | 
				
			||||||
		rts
 | 
							rts
 | 
				
			||||||
	}}
 | 
						}}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,8 +7,7 @@ main {
 | 
				
			|||||||
        txt.home()
 | 
					        txt.home()
 | 
				
			||||||
        for cx16.r11L in 0 to 20 {
 | 
					        for cx16.r11L in 0 to 20 {
 | 
				
			||||||
            for cx16.r10L in 0 to 30 {
 | 
					            for cx16.r10L in 0 to 30 {
 | 
				
			||||||
                txt.setchr(cx16.r10L, cx16.r11L, sc:'*')
 | 
					                txt.setcc(cx16.r10L, cx16.r11L, sc:'*', 7)
 | 
				
			||||||
                txt.setclr(cx16.r10L, cx16.r11L, txt.getclr(cx16.r10L, cx16.r11L)+1)
 | 
					 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user