Browse code

Added keyboard controls to nasu

neauoire authored on 05/03/2021 18:38:18
Showing 4 changed files
... ...
@@ -90,17 +90,6 @@ RTS
90 90
 
91 91
 - Load external disk in disk2
92 92
 - Build hex editor
93
-- Build sprite editor
94
-
95
-### Examples
96
-
97
-- Basics:
98
-	- Simple drag/drop redraw
99
-	- Window basics with open/close drag/drop redraw
100
-	- Example of button pointing to a subroutine
101
-- GUI:
102
-	- Line routine
103
-	- Extra frame buffer addressing? Mirror sprites?
104 93
 
105 94
 ### Assembler
106 95
 
107 96
deleted file mode 100644
... ...
@@ -1,45 +0,0 @@
1
-( app/hex )
2
-
3
-&Sprite     { pad 8 x 2 y 2 addr 2 color 1 }
4
-
5
-;color 1 ;addr 2 ;i 1
6
-
7
-|0100 @RESET
8
-
9
-	@loop
10
-		#00 ~i #0018 MUL2 #0008 ADD2 #0040 #01 ,font #00 ~i ADD2 ,draw-byte JSR
11
-		( incr ) ~i #01 ADD =i
12
-		,loop ~i #08 LTH JMP? POP2
13
-
14
-BRK
15
-
16
-|0200 @FRAME BRK 
17
-
18
-@draw-byte ( x y color addr )
19
-	
20
-	( load ) =addr =color =dev/sprite.y =dev/sprite.x
21
-	,font #00 ~addr LDR #f0 AND #04 ROR #08 MUL ADD2 =dev/sprite.addr #01 =dev/sprite.color
22
-	~dev/sprite.x #0008 ADD2 =dev/sprite.x
23
-	,font #00 ~addr LDR #0f AND #08 MUL ADD2 =dev/sprite.addr #01 =dev/sprite.color
24
-
25
-RTS
26
-
27
-@font ( 0-F ) 
28
-[
29
-	7c82 8282 8282 7c00 3010 1010 1010 1000
30
-	7c82 027c 8080 fe00 7c82 027c 0282 7c00
31
-	4282 82fe 0202 0200 fc82 807c 0282 7c00
32
-	7c82 80fc 8282 7c00 7c82 021e 0202 0200
33
-	7c82 827c 8282 7c00 7c82 827e 0202 0400
34
-	7c82 027e 8282 7e00 fc82 82fc 8282 fc00
35
-	7c82 8080 8082 7c00 fc82 8282 8282 fc00
36
-	7c82 80f0 8082 7c00 7c82 80f0 8080 8000
37
-]
38
-
39
-
40
-|d000 @ERROR BRK 
41
-
42
-|FF20 ;dev/sprite  Sprite
43
-
44
-|FFF0 .RESET .FRAME .ERROR ( vectors )
45
-|FFF8 [ 13fd 1ef3 1bf2 ] ( palette )
46 0
\ No newline at end of file
... ...
@@ -1,8 +1,15 @@
1 1
 ( app/nasu )
2 2
 
3
+(
4
+	arrows - move
5
+	click  - Paint/Select cell
6
+	1 2 3  - Select brush
7
+)
8
+
3 9
 &Screen     { width 2 height 2 pad 4 x 2 y 2 color 1 }
4 10
 &Sprite     { pad 8 x 2 y 2 addr 2 color 1 }
5 11
 &Controller { buttons 1 }
12
+&Keyboard   { key 1 }
6 13
 &Mouse      { x 2 y 2 state 1 chord 1 change 1 }
7 14
 &File       { pad 8 name 2 length 2 load 2 save 2 }
8 15
 
... ...
@@ -41,6 +48,16 @@ BRK
41 48
 
42 49
 	( keyboard controls )
43 50
 
51
+	,no-key ~dev/key #00 EQU JMP? POP2
52
+	
53
+		,no-key ~dev/key #31 LTH JMP? POP2
54
+		,no-key ~dev/key #33 GTH JMP? POP2
55
+		( select ) ~dev/key #31 SUB =bankview.mode
56
+		( release ) #00 =dev/key
57
+		,redraw JSR 
58
+
59
+	@no-key
60
+
44 61
 	,no-ctrl ~dev/ctrl.buttons #00 EQU JMP? POP2
45 62
 
46 63
 		,no-ctrl-up ~dev/ctrl.buttons #10 EQU JMP? POP2
... ...
@@ -69,7 +86,7 @@ BRK
69 86
 		,no-toolbar-click ~dev/mouse.y ~bankview.y #0010 SUB2 SUB2 #0008 DIV2 #0000 NEQ2 JMP? POP2
70 87
 
71 88
 			( brush )
72
-			
89
+
73 90
 			,no-brush-click ~dev/mouse.x ~bankview.x SUB2 #0008 DIV2 #000d LTH2 JMP? POP2
74 91
 			,no-brush-click ~dev/mouse.x ~bankview.x SUB2 #0008 DIV2 #000f GTH2 JMP? POP2
75 92
 				( select ) ~mouse.x ~bankview.x SUB2 #0008 DIV2 #000d SUB2 SWP POP =bankview.mode
... ...
@@ -694,6 +711,7 @@ RTS
694 711
 |FF10 ;dev/screen Screen
695 712
 |FF20 ;dev/sprite Sprite
696 713
 |FF30 ;dev/ctrl   Controller
714
+|FF40 ;dev/key     Keyboard
697 715
 |FF50 ;dev/mouse  Mouse
698 716
 |FF60 ;dev/file   File
699 717
 
700 718
deleted file mode 100644
... ...
@@ -1,95 +0,0 @@
1
-( sprite )
2
-
3
-:dev/r fff8 ( std read port )
4
-:dev/w fff9 ( std write port )
5
-
6
-&Point2d { x 2 y 2 }
7
-
8
-;mouse Point2d
9
-;state 1 ;color 1 ;brush 2
10
-
11
-|0100 @RESET 
12
-
13
-	#05 =dev/r ( set dev/read mouse )
14
-	#02 =dev/w ( set dev/write to sprite ) 
15
-
16
-	#05 =color ( select a default color )
17
-	,brush_large =brush ( select a default brush )
18
-
19
-	,draw-interface JSR 
20
-
21
-BRK
22
-
23
-|c000 @FRAME
24
-	
25
-	( clear last cursor )
26
-	#10 ,clear_icn ~mouse.x ~mouse.y ,draw-sprite JSR
27
-	( record mouse values )
28
-	#00 IOR2 =mouse.x #02 IOR2 =mouse.y
29
-	#04 IOR #11 ADD =state
30
-	~state ,cursor_icn ~mouse.x ~mouse.y ,draw-sprite JSR
31
-
32
-	( check click )
33
-	#04 IOR #00 EQU ,end-touch ROT JMP? POP2
34
-
35
-		( check interface )
36
-		#00 IOR2 #0008 DIV2 #0001 NEQ2 ,end-interface ROT JMP? POP2
37
-
38
-			@option0
39
-			#02 IOR2 #0008 DIV2 #0004 NEQ2 ,option1 ROT JMP? POP2
40
-				,brush_large =brush BRK
41
-			@option1
42
-			#02 IOR2 #0008 DIV2 #0005 NEQ2 ,option2 ROT JMP? POP2
43
-				,brush_small =brush BRK
44
-			@option2
45
-			#02 IOR2 #0008 DIV2 #0006 NEQ2 ,option3 ROT JMP? POP2
46
-				,brush_tiny =brush BRK
47
-			@option3
48
-			#02 IOR2 #0008 DIV2 #000b NEQ2 ,option4 ROT JMP? POP2
49
-				#05 =color BRK
50
-			@option4
51
-			#02 IOR2 #0008 DIV2 #000c NEQ2 ,option5 ROT JMP? POP2
52
-				#0a =color BRK
53
-			@option5
54
-			#02 IOR2 #0008 DIV2 #000d NEQ2 ,option6 ROT JMP? POP2
55
-				#0f =color BRK
56
-			@option6
57
-
58
-			BRK
59
-		@end-interface
60
-
61
-		~color ~brush ~mouse.x #0004 SUB2 ~mouse.y #0004 SUB2 ,draw-sprite JSR
62
-	@end-touch
63
-
64
-BRK
65
-
66
-@draw-interface
67
-	#05 ,brush_large #0008 #0020 ,draw-sprite JSR
68
-	#05 ,brush_small #0008 #0028 ,draw-sprite JSR
69
-	#05 ,brush_tiny  #0008 #0030 ,draw-sprite JSR
70
-	#05 ,brush_large #0008 #0058 ,draw-sprite JSR
71
-	#0a ,brush_large #0008 #0060 ,draw-sprite JSR
72
-	#0f ,brush_large #0008 #0068 ,draw-sprite JSR
73
-	RTS
74
-
75
-@draw-sprite
76
-	IOW2 ( y byte )
77
-	IOW2 ( x byte )
78
-	IOW2 ( sprite address )
79
-	IOW ( layer-color )
80
-	RTS
81
-
82
-|0200 @SPRITESHEET
83
-
84
-@cursor_icn  [ 80c0 e0f0 f8e0 1000 ]
85
-@clear_icn   [ 0000 0000 0000 0000 ]
86
-@brush_large [ 387c fefe fe7c 3800 ]
87
-@brush_small [ 0038 7c7c 7c38 0000 ]
88
-@brush_tiny  [ 0000 1038 1000 0000 ]
89
-
90
-BRK
91
-
92
-|d000 @ERROR BRK 
93
-
94
-|FFF0 .RESET .FRAME .ERROR
95
-|FFF8 [ f1c3 f12e f12a ] ( palette )