1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

MSX VRAM (2)

Last updated at Posted at 2018-07-09

screen 2でカラーとパターンジェネレータを登録する。
参考:z88dk\examples\msx\ex2.c

  • MSX-BASIC
smile2.bas
100 defint a-z
110 dim g(7)
120 for i=0 to 7:read d$:g(i)=val("&b"+d$):next
130 data 00111100
140 data 01000010
150 data 10100101
160 data 10000001
170 data 10100101
180 data 10011001
190 data 01000010
200 data 00111100
210 color 15,1,14:screen 2
220 for k=0 to 2
230  c=(2+k*3)*&h10+1
240  for j=0 to 255
250   p=(k*256+j)*8
260   for i=0 to 7:vpoke &h2000+p+i,c:next
270   for i=0 to 7:vpoke p+i,g(i):next
280 next j,k
290 if strig(0)=0 then 290
300 p=&h2000+int(rnd(1)*768)*8
310 c=int(rnd(1)*16)*&h10+1
320 for i=0 to 7:vpoke p+i,c:next
330 goto 300
  • z88dk
smile2.c
/*
zcc +msx -lndos -create-app smile2.c
bload"cas:",r
*/

# include <msx/gfx.h>

# define BYTE unsigned char

void main()
{
	BYTE g[] = {0x3c, 0x42, 0xa5, 0x81, 0xa5, 0x99, 0x42, 0x3c};

	set_color(15, 1, 1);
	set_mode(mode_2);

	// パターンジェネレータ
	for (int i = 0; i < MODE2_MAX; i += 8) {
		vwrite(g, i, 8);
	}

	while (! get_trigger(0)) {
		int c = rand() & 15;
		int addr = (rand() % MODE2_MAX) & ~(7);
		fill(MODE2_ATTR + addr, c << 4, 8);
	}
}

ROMカートリッジ版
http://webmsx.org/?rom=http://www.maroon.dti.ne.jp/lance/file/smile2.rom

MSX-BASICの実行例
WMSX Screen (1).png

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?