To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.nqcOpen lugnet.robotics.rcx.nqc in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / NQC / 343
342  |  344
Subject: 
Re: NQC wishlist
Newsgroups: 
lugnet.robotics.rcx.nqc
Date: 
Thu, 6 Jan 2000 06:51:02 GMT
Viewed: 
2105 times
  
Dave,

So far, I've lived without ##, and I'm quite sure I can live without 4) and 5).

And can't 3) be replaced in many cases by arithmetic?

In my brief stint programming "lego assembler" for the Scout, (Assembler! I'm
embarrassed to admit how far that takes me back) I wished I could set up macros
that used 1) and 2).

See below for some ugly Scout code.

And since I've never come right out and said it,

    "Thanks, Dave, for NQC!!!"

-dk

Dave Baum wrote:

1) symbol ## symbol  -> new symbol  (e.g. foo ## bar)
2) symbol ## number  -> new symbol  (e.g.  foo ## 12)
3) number ## number -> new number   (e.g.  12 ## 34)
4) operator ## operator -> new operator  (e.g.  < ## =  or  + ## +)
5) symbol ## symbol -> keyword  (e.g.  br ## eak)



---------------------------------------------------------------------------

// Description: Runs through sound sets

// Requires "scoutdef.h" for shortcut commands like on, rwd, fwd.
// See Scout SDK documentation for formal assembler commands.

// Program:

#include "ScoutDef.h"

dels                          //  deletes all subroutines from memory
delt                           // deletes all tasks from memory


task 0                       // start of Task 0 (the first task in the Scout)

start 1
start 2
lp:
jmp lp


endt                           // end of Task 0



task 1
t1:

monex
mone SRC_CON, EVENT_T1PR, ps10
w10: jmp w10

ps10:
monex
mone SRC_CON, EVENT_T1RE, ss10

x10:
plays 10
wait 2,100
jmp x10
ss10:




monex
mone SRC_CON, EVENT_T1PR, ps11
w11: jmp w11

ps11:
monex
mone SRC_CON, EVENT_T1RE, ss11

x11:
plays 11
wait 2,100
jmp x11
ss11:




monex
mone SRC_CON, EVENT_T1PR, ps12
w12: jmp w12

ps12:
monex
mone SRC_CON, EVENT_T1RE, ss12

x12:
plays 12
wait 2,100
jmp x12
ss12:




monex
mone SRC_CON, EVENT_T1PR, ps13
w13: jmp w13

ps13:
monex
mone SRC_CON, EVENT_T1RE, ss13

x13:
plays 13
wait 2,100
jmp x13
ss13:




monex
mone SRC_CON, EVENT_T1PR, ps14
w14: jmp w14

ps14:
monex
mone SRC_CON, EVENT_T1RE, ss14

x14:
plays 14
wait 2,100
jmp x14
ss14:




monex
mone SRC_CON, EVENT_T1PR, ps15
w15: jmp w15

ps15:
monex
mone SRC_CON, EVENT_T1RE, ss15

x15:
plays 15
wait 2,100
jmp x15
ss15:


jmpl t1
endt



task 2

sound 1, 1, 1


w2: chk SRC_CON, TVAL_PRESSED, EQ, SRC_SENVAL, SEN_TOUCH2, g2
jmp w2
g2:
sound 1, 1, 2

x2: chk SRC_CON, TVAL_RELEASED, EQ, SRC_SENVAL, SEN_TOUCH2, y2
jmp x2
y2:






w3: chk SRC_CON, TVAL_PRESSED, EQ, SRC_SENVAL, SEN_TOUCH2, g3
jmp w3

g3: sound 1, 1, 3

x3: chk SRC_CON, TVAL_RELEASED, EQ, SRC_SENVAL, SEN_TOUCH2, y3
jmp x3
y3:



w4: chk SRC_CON, TVAL_PRESSED, EQ, SRC_SENVAL, SEN_TOUCH2, g4
jmp w4

g4: sound 1, 1, 4

x4: chk SRC_CON, TVAL_RELEASED, EQ, SRC_SENVAL, SEN_TOUCH2, y4
jmp x4
y4:



w5: chk SRC_CON, TVAL_PRESSED, EQ, SRC_SENVAL, SEN_TOUCH2, g5
jmp w5

g5: sound 1, 1, 5

x5: chk SRC_CON, TVAL_RELEASED, EQ, SRC_SENVAL, SEN_TOUCH2, y5
jmp x5
y5:




w1: chk SRC_CON, TVAL_PRESSED, EQ, SRC_SENVAL, SEN_TOUCH2, g1
jmp w1

g1: sound 1, 1, 1

x1: chk SRC_CON, TVAL_RELEASED, EQ, SRC_SENVAL, SEN_TOUCH2, y1
jmp x1
y1:




g1b:
jmp w2

endt



Message is in Reply To:
  Re: NQC wishlist
 
(...) I took a good look at the preprocessor code, and it shouldn't be too hard to implement ## aside from the problem of recovering original token text. Adding support for remembering the original token text is easy to do if you're willing to be a (...) (25 years ago, 6-Jan-00, to lugnet.robotics.rcx.nqc)

17 Messages in This Thread:







Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR