commit cabc34a
zzo38
·
2023-07-27 06:41:56 +0000 UTC
parent 626a594
Change the opacity of blend 0 to the newer specification, and add the -mu switch and a compatibility extension for use with older programs.
4 files changed,
+45,
-4
+11,
-1
1@@ -324,6 +324,8 @@ See the file extension.doc for the definition of the extensions.
2
3 * 80175132-e263-11ed-b8c9-002618745416
4
5+* 970b5a0c-2c44-11ee-ac3b-002618745416
6+
7
8 === Memory/device scripts ===
9
10@@ -336,7 +338,7 @@ number while the data is a sequence of bytes so the number of digits must
11 be an even number.
12
13 It can also optionally be @ and a file name, in which case the commands are
14-loaded from a file. The file cannot itself have @ commands, and it may have
15+loaded from a file. The file cannot itself have @ commands, but it may have
16 lines starting with # as comments.
17
18 The subcommands are:
19@@ -352,6 +354,14 @@ Device trigger (p)
20 Device set (s)
21 Same as device trigger but omit the trigger; only writes are done.
22
23+Extension set (u)
24+ The data is the same as the 03 expansion command but without the initial
25+ 03; it is automatically written into memory and executed as an expansion
26+ command. (This is a shortcut for the specific case of loading an
27+ extension that is not loaded by the uxn program itself, rather than
28+ having to use the -m and -mp switches. The address can be omitted,
29+ since the expansion command does not care about the address.)
30+
31 Execute (x)
32 Execute uxn code at the specified address, which must be nonzero, and
33 cannot be in expanded memory. (The data of this command is not used.)
+20,
-0
1@@ -22,6 +22,25 @@ happens if you then try to change colours using the colour ports after
2 doing this, is not specified.
3
4
5+=== 970b5a0c-2c44-11ee-ac3b-002618745416 (Screen compatibility flags) ===
6+
7+This extension defines compatibility flags for the screen device for use
8+with older varvara programs. It is not meant to be called by the uxn
9+program itself (although it can be); it is meant for use with the -mu flag.
10+
11+The device number should be 0x20, although the screen device ports will
12+continue to work as they do (except for the changes by the flags).
13+
14+There is one byte of data in this extension. It consists of a bit field,
15+where a bit which is clear means the older behaviour and a bit which is
16+set corresponds to newer behaviour, generally.
17+
18+* bit0 = clear if drawing sprites with colour mode 0 is opaque, or set if
19+it is transparent.
20+
21+Other bits are currently unused.
22+
23+
24 === c7e5d57e-1201-11ee-bee4-002618745416 (Sequencer) ===
25
26 (DRAFT)
27@@ -85,3 +104,4 @@ vector so that the next call will be at a different address.
28 If this extension is not available, then programs should use the screen
29 vector for audio timing.
30
31+
M
main.c
+13,
-2
1@@ -183,8 +183,8 @@ static SDL_Color colors[64]={
2 {0x99,0x22,0x44,0},
3 };
4
5-static const Uint8 blend[4][16]={
6- {0,0,0,0,1,4,1,1,2,2,4,2,3,3,3,4},
7+static Uint8 blend[4][16]={
8+ {4,0,0,0,1,4,1,1,2,2,4,2,3,3,3,4},
9 {0,1,2,3,0,1,2,3,0,1,2,3,0,1,2,3},
10 {1,2,3,1,1,2,3,1,1,2,3,1,1,2,3,1},
11 {2,3,1,2,2,3,1,2,2,3,1,2,2,3,1,2},
12@@ -233,6 +233,7 @@ static Uint8 layers;
13 static Uint8 palet=7;
14 static Uint8 touch_mode=0;
15 static SDL_cond*stdin_cond;
16+static Uint8 screencompat=0x01;
17
18 static Uint16 scriptc;
19 static Script*scriptv;
20@@ -880,6 +881,7 @@ static void run_audio(void) {
21
22 static void do_extension_by_uuid(Uint16 addr) {
23 static const Uint8 uuid_8color[]="\x80\x17\x51\x32\xE2\x63\x11\xED\xB8\xC9\x00\x26\x18\x74\x54\x16";
24+ static const Uint8 uuid_screencompat[]="\x97\x0B\x5A\x0C\x2C\x44\x11\xEE\xAC\x3B\x00\x26\x18\x74\x54\x16";
25 int i;
26 if(mem[addr+1]==0x00 && use_screen && !memcmp(mem+addr+2,uuid_8color,16)) {
27 for(i=0;i<8;i++) {
28@@ -892,6 +894,10 @@ static void do_extension_by_uuid(Uint16 addr) {
29 picture_changed=1;
30 }
31 mem[addr+18]=1;
32+ } else if(mem[addr+1]==0x20 && use_screen && !memcmp(mem+addr+2,uuid_screencompat,16)) {
33+ screencompat=mem[addr+19];
34+ blend[0][0]=(screencompat&0x01?4:0);
35+ mem[addr+18]=1;
36 }
37 }
38
39@@ -1617,6 +1623,11 @@ static void do_script(Uint8 stage) {
40 j++;
41 }
42 break;
43+ case 'u': // Extension set
44+ mem[o->addr]=3;
45+ memcpy(mem+o->addr+1,o->data,o->len);
46+ do_extension_by_uuid(o->addr);
47+ break;
48 case 'x': // Execute
49 run(o->addr);
50 break;
+1,
-1
1@@ -149,7 +149,7 @@ the data in the sprite, and the rest has the specified colour in the first
2 column and the result colour in the other columns (where - means it is
3 transparent); the last two columns are not used in 1bpp mode):
4 DATA 0 1 2 3
5- 0 0 0 1 2
6+ 0 - 0 1 2
7 1 0 1 2 3
8 2 0 2 3 1
9 3 0 3 1 2