0
0
Fork 0
mirror of https://git.sr.ht/~rabbits/uxn synced 2024-12-17 22:10:14 +00:00

Allow device memory offsets in assembler

This commit is contained in:
Andrew Alderwick 2021-04-21 13:45:17 +01:00
parent b43f973adb
commit ef94053723
4 changed files with 32 additions and 19 deletions

View file

@ -2,6 +2,14 @@
%RTN { JMP2r }
( devices )
|10 @Console [ &pad $8 &char $1 ]
( variables )
|0000
( program )
|0100
@ -22,6 +30,3 @@ RTN
@hello-word [ 48 65 6c 6c 6f 20 57 6f 72 6c 64 21 ]
( devices )
|ff10 @Console [ &pad $8 &char $1 ]

View file

@ -6,8 +6,17 @@
%=>SC/ADDR { .Screen/addr IOW2 }
%->SC/COLR { .Screen/color IOW }
( devices )
|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]
|10 @Console [ &pad $8 &char $1 &byte $1 &short $2 &string $2 ]
|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &color $1 ]
|40 @Controller [ &vector $2 &button $1 &key $1 ]
( variables )
|0000
@slime $1
|0100
@ -78,9 +87,3 @@ BRK
@right_icn [ 3c7e f7f8 f8f7 7e3c ]
@slime_icn [ 0000 183c 3c18 0000 ]
( devices )
|ff00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]
|ff10 @Console [ &pad $8 &char $1 &byte $1 &short $2 &string $2 ]
|ff20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &color $1 ]
|ff40 @Controller [ &vector $2 &button $1 &key $1 ]

View file

@ -16,6 +16,19 @@
%MEMORY { #1000 }
( devices )
|00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]
|10 @Console [ &pad $8 &char $1 &byte $1 &short $2 &string $2 ]
|20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &color $1 ]
|40 @Controller [ &vector $2 &button $1 &key $1 ]
|60 @Mouse [ &vector $2 &x $2 &y $2 &state $1 &chord $1 ]
|70 @File [ &vector $2 &success $2 &offset $2 &pad $2 &name $2 &length $2 &load $2 &save $2 ]
( variables )
|0000
@loadbtn [ &x $2 &y $2 ]
@output [ &x $2 &y $2 ]
@pointer [ &x $2 &y $2 ]
@ -192,11 +205,3 @@ RTN
0000 0032 4c00 0000 3c42 99a1 a199 423c
]
( devices )
|ff00 @System [ &vector $2 &pad $6 &r $2 &g $2 &b $2 ]
|ff10 @Console [ &pad $8 &char $1 &byte $1 &short $2 &string $2 ]
|ff20 @Screen [ &vector $2 &width $2 &height $2 &pad $2 &x $2 &y $2 &addr $2 &color $1 ]
|ff40 @Controller [ &vector $2 &button $1 &key $1 ]
|ff60 @Mouse [ &vector $2 &x $2 &y $2 &state $1 &chord $1 ]
|ff70 @File [ &vector $2 &success $2 &offset $2 &pad $2 &name $2 &length $2 &load $2 &save $2 ]

View file

@ -286,8 +286,6 @@ pass1(FILE *f)
while(fscanf(f, "%s", w) == 1) {
if(skipblock(w, &ccmnt, '(', ')')) continue;
if(w[0] == '|') {
if(shex(w + 1) < addr)
return error("Memory Overwrite", w);
addr = shex(w + 1);
} else if(w[0] == '%') {
if(!makemacro(w + 1, f))
@ -322,6 +320,8 @@ pass2(FILE *f)
if(skipblock(w, &ccmnt, '(', ')')) continue;
if(skipblock(w, &ctemplate, '{', '}')) continue;
if(w[0] == '|') {
if(p.length && shex(w + 1) < p.ptr)
return error("Memory Overwrite", w);
p.ptr = shex(w + 1);
continue;
} else if(w[0] == '$') {