Allow device memory offsets in assembler
This commit is contained in:
parent
b43f973adb
commit
ef94053723
|
@ -2,6 +2,14 @@
|
||||||
|
|
||||||
%RTN { JMP2r }
|
%RTN { JMP2r }
|
||||||
|
|
||||||
|
( devices )
|
||||||
|
|
||||||
|
|10 @Console [ &pad $8 &char $1 ]
|
||||||
|
|
||||||
|
( variables )
|
||||||
|
|
||||||
|
|0000
|
||||||
|
|
||||||
( program )
|
( program )
|
||||||
|
|
||||||
|0100
|
|0100
|
||||||
|
@ -22,6 +30,3 @@ RTN
|
||||||
|
|
||||||
@hello-word [ 48 65 6c 6c 6f 20 57 6f 72 6c 64 21 ]
|
@hello-word [ 48 65 6c 6c 6f 20 57 6f 72 6c 64 21 ]
|
||||||
|
|
||||||
( devices )
|
|
||||||
|
|
||||||
|ff10 @Console [ &pad $8 &char $1 ]
|
|
||||||
|
|
|
@ -6,8 +6,17 @@
|
||||||
%=>SC/ADDR { .Screen/addr IOW2 }
|
%=>SC/ADDR { .Screen/addr IOW2 }
|
||||||
%->SC/COLR { .Screen/color IOW }
|
%->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 )
|
( variables )
|
||||||
|
|
||||||
|
|0000
|
||||||
|
|
||||||
@slime $1
|
@slime $1
|
||||||
|
|
||||||
|0100
|
|0100
|
||||||
|
@ -78,9 +87,3 @@ BRK
|
||||||
@right_icn [ 3c7e f7f8 f8f7 7e3c ]
|
@right_icn [ 3c7e f7f8 f8f7 7e3c ]
|
||||||
@slime_icn [ 0000 183c 3c18 0000 ]
|
@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 ]
|
|
||||||
|
|
|
@ -16,6 +16,19 @@
|
||||||
|
|
||||||
%MEMORY { #1000 }
|
%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 ]
|
@loadbtn [ &x $2 &y $2 ]
|
||||||
@output [ &x $2 &y $2 ]
|
@output [ &x $2 &y $2 ]
|
||||||
@pointer [ &x $2 &y $2 ]
|
@pointer [ &x $2 &y $2 ]
|
||||||
|
@ -192,11 +205,3 @@ RTN
|
||||||
0000 0032 4c00 0000 3c42 99a1 a199 423c
|
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 ]
|
|
||||||
|
|
|
@ -286,8 +286,6 @@ pass1(FILE *f)
|
||||||
while(fscanf(f, "%s", w) == 1) {
|
while(fscanf(f, "%s", w) == 1) {
|
||||||
if(skipblock(w, &ccmnt, '(', ')')) continue;
|
if(skipblock(w, &ccmnt, '(', ')')) continue;
|
||||||
if(w[0] == '|') {
|
if(w[0] == '|') {
|
||||||
if(shex(w + 1) < addr)
|
|
||||||
return error("Memory Overwrite", w);
|
|
||||||
addr = shex(w + 1);
|
addr = shex(w + 1);
|
||||||
} else if(w[0] == '%') {
|
} else if(w[0] == '%') {
|
||||||
if(!makemacro(w + 1, f))
|
if(!makemacro(w + 1, f))
|
||||||
|
@ -322,6 +320,8 @@ pass2(FILE *f)
|
||||||
if(skipblock(w, &ccmnt, '(', ')')) continue;
|
if(skipblock(w, &ccmnt, '(', ')')) continue;
|
||||||
if(skipblock(w, &ctemplate, '{', '}')) continue;
|
if(skipblock(w, &ctemplate, '{', '}')) continue;
|
||||||
if(w[0] == '|') {
|
if(w[0] == '|') {
|
||||||
|
if(p.length && shex(w + 1) < p.ptr)
|
||||||
|
return error("Memory Overwrite", w);
|
||||||
p.ptr = shex(w + 1);
|
p.ptr = shex(w + 1);
|
||||||
continue;
|
continue;
|
||||||
} else if(w[0] == '$') {
|
} else if(w[0] == '$') {
|
||||||
|
|
Loading…
Reference in New Issue