mirror of
https://git.sr.ht/~rabbits/uxn
synced 2024-11-23 06:15:10 +00:00
Moved devices to second page
This commit is contained in:
parent
465b85d579
commit
3d59eafa3b
6 changed files with 56 additions and 41 deletions
2
build.sh
2
build.sh
|
@ -20,5 +20,5 @@ cc -std=c89 -DDEBUG -Wall -Wno-unknown-pragmas -Wpedantic -Wshadow -Wextra -Werr
|
|||
# cc uxn.c emulator.c -std=c89 -Os -DNDEBUG -g0 -s -Wall -Wno-unknown-pragmas -L/usr/local/lib -lSDL2 -o bin/emulator
|
||||
|
||||
# run
|
||||
./bin/assembler projects/software/noodle.usm bin/boot.rom
|
||||
./bin/assembler projects/software/left.usm bin/boot.rom
|
||||
./bin/emulator bin/boot.rom
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
%8/ { #0003 SFT2 } %8* { #0030 SFT2 }
|
||||
%8- { #0008 SUB2 } %8+ { #0008 ADD2 }
|
||||
|
||||
( variables )
|
||||
|
||||
;lock { byte 1 }
|
||||
;k { byte 1 }
|
||||
;l { byte 1 }
|
||||
|
@ -37,7 +39,21 @@
|
|||
;textarea { x1 2 y1 2 x2 2 y2 2 addr 2 cursor 1 }
|
||||
;label { x 2 y 2 color 1 addr 2 } ( remove )
|
||||
|
||||
|0100 @RESET
|
||||
( devices )
|
||||
|
||||
|0100 ;Console { pad 8 char 1 byte 1 short 2 }
|
||||
|0110 ;Screen { width 2 height 2 pad 4 x 2 y 2 color 1 }
|
||||
|0120 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 }
|
||||
|0130 ;Controller { buttons 1 }
|
||||
|0140 ;Keys { key 1 }
|
||||
|0150 ;Mouse { x 2 y 2 state 1 chord 1 }
|
||||
|0160 ;File { pad 8 name 2 length 2 load 2 save 2 }
|
||||
|01F0 .RESET .FRAME .ERROR ( vectors )
|
||||
|01F8 [ ed0f 3d0f 3d0f ] ( palette )
|
||||
|
||||
( program )
|
||||
|
||||
|0200 @RESET
|
||||
|
||||
( load file )
|
||||
,filepath ,load-file JSR2
|
||||
|
@ -702,15 +718,4 @@ RTN
|
|||
|3000 ;document { eof 2 body 8000 }
|
||||
|c000 ;clip { len 2 body 256 }
|
||||
|
||||
|d000 @ERROR BRK
|
||||
|
||||
|FF00 ;Console { pad 8 char 1 byte 1 short 2 }
|
||||
|FF10 ;Screen { width 2 height 2 pad 4 x 2 y 2 color 1 }
|
||||
|FF20 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 }
|
||||
|FF30 ;Controller { buttons 1 }
|
||||
|FF40 ;Keys { key 1 }
|
||||
|FF50 ;Mouse { x 2 y 2 state 1 chord 1 }
|
||||
|FF60 ;File { pad 8 name 2 length 2 load 2 save 2 }
|
||||
|
||||
|FFF0 .RESET .FRAME .ERROR ( vectors )
|
||||
|FFF8 [ ed0f 3d0f 3d0f ] ( palette )
|
||||
|d000 @ERROR BRK
|
|
@ -17,6 +17,8 @@
|
|||
%8- { #0008 SUB2 } %8+ { #0008 ADD2 }
|
||||
%SFL { #40 SFT SFT }
|
||||
|
||||
( variables )
|
||||
|
||||
;bankview { x 2 y 2 mode 1 addr 2 }
|
||||
;tileview { x 2 y 2 addr 2 }
|
||||
;rect { x1 2 y1 2 x2 2 y2 2 }
|
||||
|
@ -27,7 +29,20 @@
|
|||
;addr { short 2 }
|
||||
;pos { x 2 y 2 }
|
||||
|
||||
|0100 @RESET
|
||||
( devices )
|
||||
|
||||
|0110 ;Screen { width 2 height 2 pad 4 x 2 y 2 color 1 }
|
||||
|0120 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 }
|
||||
|0130 ;Controller { buttons 1 }
|
||||
|0140 ;Keys { key 1 }
|
||||
|0150 ;Mouse { x 2 y 2 state 1 chord 1 change 1 }
|
||||
|0160 ;File { pad 8 name 2 length 2 load 2 save 2 }
|
||||
|01F0 .RESET .FRAME .ERROR ( vectors )
|
||||
|01F8 [ e0fc 30cc 30ac ] ( palette )
|
||||
|
||||
( program )
|
||||
|
||||
|0200 @RESET
|
||||
|
||||
~Screen.width 2/ #008a SUB2 =bankview.x
|
||||
~Screen.height 2/ #003f SUB2 =bankview.y
|
||||
|
@ -512,14 +527,4 @@ RTN
|
|||
|
||||
|E000 @bank [ ]
|
||||
|
||||
|FE00 @ERROR BRK
|
||||
|
||||
|FF10 ;Screen { width 2 height 2 pad 4 x 2 y 2 color 1 }
|
||||
|FF20 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 }
|
||||
|FF30 ;Controller { buttons 1 }
|
||||
|FF40 ;Keys { key 1 }
|
||||
|FF50 ;Mouse { x 2 y 2 state 1 chord 1 change 1 }
|
||||
|FF60 ;File { pad 8 name 2 length 2 load 2 save 2 }
|
||||
|
||||
|FFF0 .RESET .FRAME .ERROR ( vectors )
|
||||
|FFF8 [ e0fc 30cc 30ac ] ( palette )
|
||||
|FE00 @ERROR BRK
|
|
@ -31,6 +31,8 @@
|
|||
%MOD8 { #0007 AND2 }
|
||||
%SFL { #40 SFT SFT }
|
||||
|
||||
( variables )
|
||||
|
||||
;center { x 2 y 2 }
|
||||
;toolbar { x1 2 y1 2 x2 2 y2 2 }
|
||||
;cursor { x 2 y 2 x0 2 y0 2 size 1 patt 1 drag 1 mirror 1 }
|
||||
|
@ -43,7 +45,21 @@
|
|||
;pt1 { x 2 y 2 }
|
||||
;px { x 1 y 1 }
|
||||
|
||||
|0100 @RESET
|
||||
( devices )
|
||||
|
||||
|0100 ;Console { pad 8 char 1 byte 1 short 2 }
|
||||
|0110 ;Screen { width 2 height 2 pad 4 x 2 y 2 color 1 }
|
||||
|0120 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 }
|
||||
|0130 ;Controller { buttons 1 }
|
||||
|0140 ;Keys { key 1 }
|
||||
|0150 ;Mouse { x 2 y 2 state 1 chord 1 }
|
||||
|0160 ;File { pad 8 name 2 length 2 load 2 save 2 }
|
||||
|01F0 .RESET .FRAME .ERROR ( vectors )
|
||||
|01F8 [ f07c f0e2 f0c2 ] ( palette )
|
||||
|
||||
( program )
|
||||
|
||||
|0200 @RESET
|
||||
|
||||
( default canvas )
|
||||
#002a =canvas.w #001a =canvas.h
|
||||
|
@ -682,15 +698,4 @@ RTN
|
|||
|2000 ;canvas { w 2 h 2 x1 2 y1 2 x2 2 y2 2 }
|
||||
|3000 @data [ ]
|
||||
|
||||
|F000 @ERROR BRK
|
||||
|
||||
|FF00 ;Console { pad 8 char 1 byte 1 short 2 }
|
||||
|FF10 ;Screen { width 2 height 2 pad 4 x 2 y 2 color 1 }
|
||||
|FF20 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 }
|
||||
|FF30 ;Controller { buttons 1 }
|
||||
|FF40 ;Keys { key 1 }
|
||||
|FF50 ;Mouse { x 2 y 2 state 1 chord 1 }
|
||||
|FF60 ;File { pad 8 name 2 length 2 load 2 save 2 }
|
||||
|
||||
|FFF0 .RESET .FRAME .ERROR ( vectors )
|
||||
|FFF8 [ f07c f0e2 f0c2 ] ( palette )
|
||||
|F000 @ERROR BRK
|
2
uxn.c
2
uxn.c
|
@ -19,7 +19,7 @@ WITH REGARD TO THIS SOFTWARE.
|
|||
void setflag(Uint8 *a, char flag, int b) { if(b) *a |= flag; else *a &= (~flag); }
|
||||
int getflag(Uint8 *a, char flag) { return *a & flag; }
|
||||
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; }
|
||||
void mempoke8(Uxn *u, Uint16 a, Uint8 b) { u->ram.dat[a] = a >= PAGE_DEVICE ? devpoke8(u, (a & 0xff) >> 4, a & 0xf, b) : b; }
|
||||
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; }
|
||||
Uint8 mempeek8(Uxn *u, Uint16 a) { return u->ram.dat[a]; }
|
||||
void mempoke16(Uxn *u, Uint16 a, Uint16 b) { mempoke8(u, a, b >> 8); mempoke8(u, a + 1, b); }
|
||||
Uint16 mempeek16(Uxn *u, Uint16 a) { return (mempeek8(u, a) << 8) + mempeek8(u, a + 1); }
|
||||
|
|
2
uxn.h
2
uxn.h
|
@ -20,7 +20,7 @@ typedef signed short Sint16;
|
|||
#define FLAG_SHORT 0x02
|
||||
#define FLAG_RETURN 0x04
|
||||
#define FLAG_COND 0x08
|
||||
#define PAGE_DEVICE 0xff00
|
||||
#define PAGE_DEVICE 0x0100
|
||||
|
||||
typedef struct {
|
||||
Uint8 ptr;
|
||||
|
|
Loading…
Reference in a new issue