mirror of
https://git.sr.ht/~rabbits/uxn
synced 2024-11-22 22:05:11 +00:00
Added NIP optimisations
This commit is contained in:
parent
be360ffc1e
commit
93dae917fb
9 changed files with 20 additions and 20 deletions
|
@ -261,7 +261,7 @@ JMP2r
|
|||
#ff
|
||||
JMP2r
|
||||
&found
|
||||
SWP POP ( remove loop limit )
|
||||
NIP ( remove loop limit )
|
||||
DUP ;&src_i LDA NEQ ,&end JCN ( check if result is the same as index )
|
||||
POP #ff
|
||||
JMP2r
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
%4** { #20 SFT2 } %4// { #02 SFT2 }
|
||||
%8** { #30 SFT2 } %8// { #03 SFT2 }
|
||||
|
||||
%TOB { SWP POP } %TOS { #00 SWP }
|
||||
%TOB { NIP } %TOS { #00 SWP }
|
||||
%RTN { JMP2r }
|
||||
%MOD { DUP2 / * - }
|
||||
%LTS2 { #8000 ++ SWP2 #8000 ++ >> } %GTS2 { #8000 ++ SWP2 #8000 ++ << }
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
%++ { ADD2 } %-- { SUB2 } %** { MUL2 } %// { DIV2 }
|
||||
%<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 }
|
||||
|
||||
%TOS { #00 SWP } %TOB { SWP POP }
|
||||
%TOS { #00 SWP } %TOB { NIP }
|
||||
%RTN { JMP2r } %MOD { DUP2 / * - }
|
||||
%MOD8 { #07 AND } %MOD2 { #01 AND }
|
||||
%SFL { #40 SFT SFT }
|
||||
|
@ -20,8 +20,8 @@
|
|||
%BANK1 { #8000 } %BANK2 { #a000 }
|
||||
|
||||
%GET-SIZE { WIDTH TOS 8// HEIGHT TOS ** }
|
||||
%GET-ITERATORS { SWP2k POP SWP POP }
|
||||
%GET-ITER { OVR2 SWP POP OVR SWP }
|
||||
%GET-ITERATORS { SWP2k POP NIP }
|
||||
%GET-ITER { OVR2 NIP OVR SWP }
|
||||
|
||||
( devices )
|
||||
|
||||
|
@ -226,7 +226,7 @@ RTN
|
|||
@get-cell ( x y -- cell )
|
||||
|
||||
DUP2 ,get-index JSR LDA
|
||||
SWP POP SWP
|
||||
NIP SWP
|
||||
MOD8
|
||||
SFT MOD2
|
||||
|
||||
|
|
|
@ -135,10 +135,10 @@ RTN
|
|||
|
||||
;clear-notes JSR2
|
||||
( get note )
|
||||
#0e .Mouse/y DEI2 .trkframe/y1 LDZ2 SUB2 SWP POP #08 DIV SUB
|
||||
#0e .Mouse/y DEI2 .trkframe/y1 LDZ2 SUB2 NIP #08 DIV SUB
|
||||
.Mouse/state DEI #10 NEQ ,&no-erase JCN POP #00 &no-erase
|
||||
( edit note )
|
||||
TRACK #00 .Mouse/x DEI2 .trkframe/x1 LDZ2 SUB2 SWP POP #08 DIV ADD2 STA
|
||||
TRACK #00 .Mouse/x DEI2 .trkframe/x1 LDZ2 SUB2 NIP #08 DIV ADD2 STA
|
||||
( release ) #00 .Mouse/state DEO
|
||||
;draw-notes JSR2
|
||||
|
||||
|
@ -147,7 +147,7 @@ BRK
|
|||
@touch-chn ( -- )
|
||||
|
||||
;clear-notes JSR2
|
||||
( save ) .Mouse/y DEI2 .chnframe/y1 LDZ2 SUB2 SWP POP #08 DIV #01 SUB .track/active STZ
|
||||
( save ) .Mouse/y DEI2 .chnframe/y1 LDZ2 SUB2 NIP #08 DIV #01 SUB .track/active STZ
|
||||
( release ) #00 .Mouse/state DEO
|
||||
;draw-channels JSR2
|
||||
;draw-notes JSR2
|
||||
|
@ -157,7 +157,7 @@ BRK
|
|||
|
||||
@touch-ctl ( -- )
|
||||
|
||||
.Mouse/x DEI2 .ctlframe/x1 LDZ2 SUB2 8-- 8// SWP POP #02 DIV
|
||||
.Mouse/x DEI2 .ctlframe/x1 LDZ2 SUB2 8-- 8// NIP #02 DIV
|
||||
DUP ,&no-a JCN
|
||||
.Audio0/adsr .track/active LDZ #10 MUL ADD DEI
|
||||
#10 .Mouse/state DEI #10 EQU #e0 MUL ADD ADD
|
||||
|
@ -278,7 +278,7 @@ RTN
|
|||
;font_hex .Screen/addr DEO2
|
||||
#0000 #0100
|
||||
&loop
|
||||
OVR2 SWP POP #02 DIV #0f AND ,&skip JCN
|
||||
OVR2 NIP #02 DIV #0f AND ,&skip JCN
|
||||
OVR2 .trkframe/x1 LDZ2 ADD2 .Screen/x DEO2
|
||||
.trkframe/y1 LDZ2 #0010 SUB2 .Screen/y DEO2
|
||||
#02 .Screen/sprite DEO
|
||||
|
|
|
@ -123,7 +123,7 @@
|
|||
.lines/x2 LDZ2 .lines/x1 LDZ2 DUP2 .neralie/x STZ2 SUB2 .neralie/w STZ2
|
||||
.lines/y2 LDZ2 .lines/y1 LDZ2 DUP2 .neralie/y STZ2 SUB2 .neralie/h STZ2
|
||||
|
||||
;neralie/n4 SWP POP .neralie/n0123 LDZ2
|
||||
;neralie/n4 NIP .neralie/n0123 LDZ2
|
||||
DUP2 ;&h JSR2
|
||||
;&next JSR2 #0001 .Screen/x DEO2 .neralie/y LDZ2 #0003 SUB2 .Screen/y DEO2 ,digit JSR
|
||||
DUP2 ;&v JSR2
|
||||
|
|
|
@ -79,22 +79,22 @@ BRK
|
|||
DUP2 #0010 NEQ2 ,&no-touch-red JCN
|
||||
.Mouse/x DEI2 .window/x1 LDZ2 #0060 ADD2 LTH2 ,&no-touch-red JCN
|
||||
.Mouse/x DEI2 .window/x1 LDZ2 #009c ADD2 GTH2 ,&no-touch-red JCN
|
||||
( get new value ) .Mouse/x DEI2 .window/x1 LDZ2 SUB2 #0060 SUB2 4// SWP POP ;theme/r1 #00 .selection LDZ ADD2 STA
|
||||
( get new value ) .Mouse/x DEI2 .window/x1 LDZ2 SUB2 #0060 SUB2 4// NIP ;theme/r1 #00 .selection LDZ ADD2 STA
|
||||
&no-touch-red
|
||||
DUP2 #0020 NEQ2 ,&no-touch-green JCN
|
||||
.Mouse/x DEI2 .window/x1 LDZ2 #0060 ADD2 LTH2 ,&no-touch-green JCN
|
||||
.Mouse/x DEI2 .window/x1 LDZ2 #009c ADD2 GTH2 ,&no-touch-green JCN
|
||||
( get new value ) .Mouse/x DEI2 .window/x1 LDZ2 SUB2 #0060 SUB2 4// SWP POP ;theme/g1 #00 .selection LDZ ADD2 STA
|
||||
( get new value ) .Mouse/x DEI2 .window/x1 LDZ2 SUB2 #0060 SUB2 4// NIP ;theme/g1 #00 .selection LDZ ADD2 STA
|
||||
&no-touch-green
|
||||
DUP2 #0030 NEQ2 ,&no-touch-blue JCN
|
||||
.Mouse/x DEI2 .window/x1 LDZ2 #0060 ADD2 LTH2 ,&no-touch-blue JCN
|
||||
.Mouse/x DEI2 .window/x1 LDZ2 #009c ADD2 GTH2 ,&no-touch-blue JCN
|
||||
( get new value ) .Mouse/x DEI2 .window/x1 LDZ2 SUB2 #0060 SUB2 4// SWP POP ;theme/b1 #00 .selection LDZ ADD2 STA
|
||||
( get new value ) .Mouse/x DEI2 .window/x1 LDZ2 SUB2 #0060 SUB2 4// NIP ;theme/b1 #00 .selection LDZ ADD2 STA
|
||||
&no-touch-blue
|
||||
DUP2 #0040 NEQ2 ,&no-touch-radio JCN
|
||||
.Mouse/x DEI2 .window/x1 LDZ2 #0050 ADD2 LTH2 ,&no-touch-radio JCN
|
||||
.Mouse/x DEI2 .window/x1 LDZ2 #008c ADD2 GTH2 ,&no-touch-radio JCN
|
||||
.Mouse/x DEI2 .window/x1 LDZ2 SUB2 #0050 SUB2 STEP8 2// #0008 DIV2 SWP POP .selection STZ
|
||||
.Mouse/x DEI2 .window/x1 LDZ2 SUB2 #0050 SUB2 STEP8 2// #0008 DIV2 NIP .selection STZ
|
||||
&no-touch-radio
|
||||
POP2
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ RTN
|
|||
RTN
|
||||
|
||||
&digit
|
||||
SWP POP
|
||||
NIP
|
||||
DUP .number/started LDZ ORA #02 JCN
|
||||
POP JMP2r
|
||||
LIT '0 ADD .Console/write DEO
|
||||
|
|
|
@ -94,7 +94,7 @@ RTN
|
|||
&loop
|
||||
( incr ) #0001 ADD2 OVR2 OVR2 ADD2
|
||||
LDA ,&loop JCN
|
||||
SWP2 POP2
|
||||
NIP2
|
||||
|
||||
RTN
|
||||
|
||||
|
|
|
@ -370,7 +370,7 @@
|
|||
|
||||
( tree-offset* token-routine-ptr* / end* )
|
||||
STH2r ;asma/token STA2
|
||||
SWP2 POP2 LDA2
|
||||
NIP2 LDA2
|
||||
JMP2 ( tail call )
|
||||
|
||||
¬-found ( tree-offset* dummy* / end* )
|
||||
|
@ -523,7 +523,7 @@
|
|||
&flush ( ptr* -- start-of-buffer* )
|
||||
;asma-write-buffer SUB2k ( ptr* start* len* )
|
||||
;asma/flush-fn LDA2 JSR2
|
||||
SWP2 POP2 ( start* )
|
||||
NIP2 ( start* )
|
||||
,&after-flush JMP
|
||||
|
||||
@asma-output [ &ptr $2 &offset $2 &filename $2 ]
|
||||
|
|
Loading…
Reference in a new issue