Browse code

Moved devices to second page

neauoire authored on 21/03/2021 20:58:32
Showing 6 changed files
... ...
@@ -20,5 +20,5 @@ cc -std=c89 -DDEBUG -Wall -Wno-unknown-pragmas -Wpedantic -Wshadow -Wextra -Werr
20 20
 # cc uxn.c emulator.c -std=c89 -Os -DNDEBUG -g0 -s -Wall -Wno-unknown-pragmas -L/usr/local/lib -lSDL2 -o bin/emulator
21 21
 
22 22
 # run
23
-./bin/assembler projects/software/noodle.usm bin/boot.rom
23
+./bin/assembler projects/software/left.usm bin/boot.rom
24 24
 ./bin/emulator bin/boot.rom
... ...
@@ -22,6 +22,8 @@
22 22
 %8/ { #0003 SFT2 } %8* { #0030 SFT2 }
23 23
 %8- { #0008 SUB2 } %8+ { #0008 ADD2 }
24 24
 
25
+( variables )
26
+
25 27
 ;lock { byte 1 }
26 28
 ;k { byte 1 } 
27 29
 ;l { byte 1 } 
... ...
@@ -37,7 +39,21 @@
37 39
 ;textarea { x1 2 y1 2 x2 2 y2 2 addr 2 cursor 1 }
38 40
 ;label { x 2 y 2 color 1 addr 2 } ( remove )
39 41
 
40
-|0100 @RESET
42
+( devices )
43
+
44
+|0100 ;Console { pad 8 char 1 byte 1 short 2 }
45
+|0110 ;Screen { width 2 height 2 pad 4 x 2 y 2 color 1 }
46
+|0120 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 }
47
+|0130 ;Controller { buttons 1 }
48
+|0140 ;Keys { key 1 }
49
+|0150 ;Mouse { x 2 y 2 state 1 chord 1 }
50
+|0160 ;File { pad 8 name 2 length 2 load 2 save 2 }
51
+|01F0 .RESET .FRAME .ERROR ( vectors )
52
+|01F8 [ ed0f 3d0f 3d0f ]   ( palette )
53
+
54
+( program )
55
+
56
+|0200 @RESET
41 57
 	
42 58
 	( load file )
43 59
 	,filepath ,load-file JSR2
... ...
@@ -702,15 +718,4 @@ RTN
702 718
 |3000 ;document { eof 2 body 8000 }
703 719
 |c000 ;clip { len 2 body 256 }
704 720
 
705
-|d000 @ERROR BRK 
706
-
707
-|FF00 ;Console { pad 8 char 1 byte 1 short 2 }
708
-|FF10 ;Screen { width 2 height 2 pad 4 x 2 y 2 color 1 }
709
-|FF20 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 }
710
-|FF30 ;Controller { buttons 1 }
711
-|FF40 ;Keys { key 1 }
712
-|FF50 ;Mouse { x 2 y 2 state 1 chord 1 }
713
-|FF60 ;File { pad 8 name 2 length 2 load 2 save 2 }
714
-
715
-|FFF0 .RESET .FRAME .ERROR ( vectors )
716
-|FFF8 [ ed0f 3d0f 3d0f ]   ( palette )
721
+|d000 @ERROR BRK 
717 722
\ No newline at end of file
... ...
@@ -17,6 +17,8 @@
17 17
 %8- { #0008 SUB2 } %8+ { #0008 ADD2 }
18 18
 %SFL { #40 SFT SFT }
19 19
 
20
+( variables )
21
+
20 22
 ;bankview { x 2 y 2 mode 1 addr 2 }
21 23
 ;tileview { x 2 y 2 addr 2 }
22 24
 ;rect { x1 2 y1 2 x2 2 y2 2 }
... ...
@@ -27,7 +29,20 @@
27 29
 ;addr { short 2 }
28 30
 ;pos { x 2 y 2 }
29 31
 
30
-|0100 @RESET
32
+( devices )
33
+
34
+|0110 ;Screen { width 2 height 2 pad 4 x 2 y 2 color 1 }
35
+|0120 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 }
36
+|0130 ;Controller { buttons 1 }
37
+|0140 ;Keys { key 1 }
38
+|0150 ;Mouse { x 2 y 2 state 1 chord 1 change 1 }
39
+|0160 ;File { pad 8 name 2 length 2 load 2 save 2 }
40
+|01F0 .RESET .FRAME .ERROR ( vectors )
41
+|01F8 [ e0fc 30cc 30ac ] ( palette )
42
+
43
+( program )
44
+
45
+|0200 @RESET
31 46
 	
32 47
 	~Screen.width 2/ #008a SUB2 =bankview.x 
33 48
 	~Screen.height 2/ #003f SUB2 =bankview.y 
... ...
@@ -512,14 +527,4 @@ RTN
512 527
 
513 528
 |E000 @bank [ ]	
514 529
 
515
-|FE00 @ERROR BRK 
516
-
517
-|FF10 ;Screen { width 2 height 2 pad 4 x 2 y 2 color 1 }
518
-|FF20 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 }
519
-|FF30 ;Controller { buttons 1 }
520
-|FF40 ;Keys { key 1 }
521
-|FF50 ;Mouse { x 2 y 2 state 1 chord 1 change 1 }
522
-|FF60 ;File { pad 8 name 2 length 2 load 2 save 2 }
523
-
524
-|FFF0 .RESET .FRAME .ERROR ( vectors )
525
-|FFF8 [ e0fc 30cc 30ac ] ( palette )
526 530
\ No newline at end of file
531
+|FE00 @ERROR BRK 
527 532
\ No newline at end of file
... ...
@@ -31,6 +31,8 @@
31 31
 %MOD8 { #0007 AND2  }
32 32
 %SFL { #40 SFT SFT }
33 33
 
34
+( variables )
35
+
34 36
 ;center { x 2 y 2 }
35 37
 ;toolbar { x1 2 y1 2 x2 2 y2 2 }
36 38
 ;cursor { x 2 y 2 x0 2 y0 2 size 1 patt 1 drag 1 mirror 1 }
... ...
@@ -43,7 +45,21 @@
43 45
 ;pt1 { x 2 y 2 }
44 46
 ;px { x 1 y 1 }
45 47
 
46
-|0100 @RESET 
48
+( devices )
49
+
50
+|0100 ;Console { pad 8 char 1 byte 1 short 2 }
51
+|0110 ;Screen { width 2 height 2 pad 4 x 2 y 2 color 1 }
52
+|0120 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 }
53
+|0130 ;Controller { buttons 1 }
54
+|0140 ;Keys { key 1 }
55
+|0150 ;Mouse { x 2 y 2 state 1 chord 1 }
56
+|0160 ;File { pad 8 name 2 length 2 load 2 save 2 }
57
+|01F0 .RESET .FRAME .ERROR ( vectors )
58
+|01F8 [ f07c f0e2 f0c2 ]   ( palette )
59
+
60
+( program )
61
+
62
+|0200 @RESET 
47 63
 	
48 64
 	( default canvas )
49 65
 	#002a =canvas.w #001a =canvas.h
... ...
@@ -682,15 +698,4 @@ RTN
682 698
 |2000 ;canvas { w 2 h 2 x1 2 y1 2 x2 2 y2 2 }
683 699
 |3000 @data [ ]
684 700
 
685
-|F000 @ERROR BRK 
686
-
687
-|FF00 ;Console { pad 8 char 1 byte 1 short 2 }
688
-|FF10 ;Screen { width 2 height 2 pad 4 x 2 y 2 color 1 }
689
-|FF20 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 }
690
-|FF30 ;Controller { buttons 1 }
691
-|FF40 ;Keys { key 1 }
692
-|FF50 ;Mouse { x 2 y 2 state 1 chord 1 }
693
-|FF60 ;File { pad 8 name 2 length 2 load 2 save 2 }
694
-
695
-|FFF0 .RESET .FRAME .ERROR ( vectors )
696
-|FFF8 [ f07c f0e2 f0c2 ]   ( palette )
697 701
\ No newline at end of file
702
+|F000 @ERROR BRK 
698 703
\ No newline at end of file
... ...
@@ -19,7 +19,7 @@ WITH REGARD TO THIS SOFTWARE.
19 19
 void   setflag(Uint8 *a, char flag, int b) { if(b) *a |= flag; else *a &= (~flag); }
20 20
 int    getflag(Uint8 *a, char flag) { return *a & flag; }
21 21
 Uint8  devpoke8(Uxn *u, Uint8 id, Uint8 b0, Uint8 b1){ return id < u->devices ? u->dev[id].poke(u->ram.dat, PAGE_DEVICE + id * 0x10, b0, b1) : b1; }
22
-void   mempoke8(Uxn *u, Uint16 a, Uint8 b) { u->ram.dat[a] = a >= PAGE_DEVICE ? devpoke8(u, (a & 0xff) >> 4, a & 0xf, b) : b; }
22
+void   mempoke8(Uxn *u, Uint16 a, Uint8 b) { u->ram.dat[a] = (a & 0xff00) == PAGE_DEVICE ? devpoke8(u, (a & 0xff) >> 4, a & 0xf, b) : b; }
23 23
 Uint8  mempeek8(Uxn *u, Uint16 a) { return u->ram.dat[a]; }
24 24
 void   mempoke16(Uxn *u, Uint16 a, Uint16 b) { mempoke8(u, a, b >> 8); mempoke8(u, a + 1, b); }
25 25
 Uint16 mempeek16(Uxn *u, Uint16 a) { return (mempeek8(u, a) << 8) + mempeek8(u, a + 1); }
... ...
@@ -20,7 +20,7 @@ typedef signed short Sint16;
20 20
 #define FLAG_SHORT 0x02
21 21
 #define FLAG_RETURN 0x04
22 22
 #define FLAG_COND 0x08
23
-#define PAGE_DEVICE 0xff00
23
+#define PAGE_DEVICE 0x0100
24 24
 
25 25
 typedef struct {
26 26
 	Uint8 ptr;