Progress on macros experiments

This commit is contained in:
neauoire 2021-04-22 15:57:40 -07:00
parent f58ce2882f
commit dad55324aa
3 changed files with 36 additions and 17 deletions

View File

@ -26,10 +26,20 @@ contexts:
scope: variable.control
pop: true
# constants
# structs
# Special
# templated
- match: '(\S+)\^\s?'
scope: storage.type
pop: true
- match: '(\S+)\=\s?'
scope: constant.numeric
pop: true
- match: '(\S+)\?\s?'
scope: storage.type
pop: true
- match: '(\S+)\!\s?'
scope: constant.numeric
pop: true
# Pushing to stack

View File

@ -6,6 +6,11 @@
%-- { #0001 SUB2 }
%ABS2 { DUP2 #000f SFT2 EQU #04 JNZ #ffff MUL2 }
(
%%^ { .% PEK } %%= { .% POK }
%%? { .% DEI } %%! { .% DEO }
)
%%^ { .% PEK2 } %%= { .% POK2 }
%%? { .% DEI2 } %%! { .% DEO2 }
@ -28,11 +33,12 @@
|0100 ( -> )
( theme )
#f0fd System/r!
#f003 System/g!
#f002 System/b!
#f0f0 System/r!
#f00f System/g!
#f000 System/b!
( vectors ) ;on-mouse Mouse/vector!
( vectors )
;on-mouse Mouse/vector!
BRK
@ -41,13 +47,10 @@ BRK
;draw-cursor JSR2
( on down )
.Mouse/state DEI #00 NEQ
.pointer/state PEK #00 EQU
#0101 EQU2 ,on-mouse-down JNZ
.Mouse/state DEI #00 NEQ .pointer/state PEK #00 EQU #0101 EQU2 ,on-mouse-down JNZ
( on drag )
.Mouse/state DEI
#00 NEQ ,on-mouse-drag JNZ
.Mouse/state DEI #00 NEQ ,on-mouse-drag JNZ
.Mouse/state DEI .pointer/state POK
@ -58,6 +61,7 @@ BRK
( record start position )
Mouse/x? DUP2 pointer/x= pointer/lastx=
Mouse/y? DUP2 pointer/y= pointer/lasty=
.Mouse/state DEI .pointer/state POK
BRK
@ -70,11 +74,12 @@ BRK
pointer/x^
pointer/y^
#01 ( add mouse state ) [ .Mouse/state DEI #10 EQU #02 MUL ADD ]
;hairline JSR2
;draw-line JSR2
( record last position )
Mouse/x? pointer/lastx=
Mouse/y? pointer/lasty=
.Mouse/state DEI .pointer/state POK
BRK
@ -102,7 +107,7 @@ BRK
RTN
@hairline ( x1 y1 x2 y2 color -- )
@draw-line ( x1 y1 x2 y2 color -- )
( load ) .color POK line/y0= line/x0= line/y= line/x=
line/x0^ line/x^ SUB2 ABS2 line/dx=
@ -111,7 +116,11 @@ RTN
#ffff #00 line/y^ line/y0^ LTS2 #0002 MUL2 ADD2 line/sy=
line/dx^ line/dy^ ADD2 line/e1=
&loop
line/x^ Screen/x! line/y^ Screen/y! .color PEK .Screen/color DEO
( draw )
line/x^ Screen/x!
line/y^ Screen/y!
.color PEK
.Screen/color DEO
line/x^ line/x0^ EQU2 line/y^ line/y0^ EQU2 #0101 EQU2 ,&end JNZ
line/e1^ #0002 MUL2 line/e2=
line/e2^ line/dy^ LTS2 ,&skipy JNZ

View File

@ -112,8 +112,8 @@ drawdebugger(Ppu *p, Uint8 *stack, Uint8 ptr)
Uint8 i, x, y, b;
for(i = 0; i < 0x20; ++i) { /* memory */
x = ((i % 8) * 3 + 1) * 8, y = (i / 8 + 1) * 8, b = stack[i];
puticn(p, p->bg, x, y, font[(b >> 4) & 0xf], 2 + (ptr == i));
puticn(p, p->bg, x + 8, y, font[b & 0xf], 2 + (ptr == i));
puticn(p, p->bg, x, y, font[(b >> 4) & 0xf], 1 + (ptr == i) * 0x7);
puticn(p, p->bg, x + 8, y, font[b & 0xf], 1 + (ptr == i) * 0x7);
}
for(x = 0; x < 0x20; ++x) {
drawpixel(p, x, p->height / 2, 2);