Forum

Reducing scripting ...
 
Notifications
Clear all

Reducing scripting friction, further enabling contributors

10 Posts
3 Users
3 Reactions
3,762 Views
Posts: 21
Topic starter
(@aadhoc4370)
Eminent Member
Joined: 7 months ago

The things you are working on sound useful! Should solve several of the issues I was starting to hit as I deep-evaluated the coding capabilities. Thanks for being responsive. You've got a good product idea and I (and others I know) are interested in seeing where it goes.

I've been seeing what I can do without changing the underlying existing opcode scripts syntax.
I made it pretty far, but discovered the 256 lines issue today, which took a little bit of experimentation to figure out.
Funny you mentioned it here and I hadn't seen it yet.

I was able to add some nice program flow and directives on top of your opcodes, even eliminating the unsued parameters.
I effectively have functions as well, but they are actually macro expansions, so each call makes a copy of the "function body".... so you see how I inadvertently went past the 256 line max.
I added a display mechanism allowing me to do a variety of PRINT() and PRINT_LINE() which tracks the cursor's position of the "current row". Including a PRINT_BUFFERED(), PRINT_LINE_BUFFERED(), SCREEN_REDRAW(), and more. This came with limitations, but I was going to suggest moving toward this type of simplified output.
I added readable IF statements as well.

Macros allow me to do A LOT for improving readability/maintainable, often for only a line-for-line tradeoff (rather than 1 macro becoming several opcodes). For example the IF statements:

#define EQUAL                   0x0
#define NOT_EQUAL               0x1
#define LESS_THAN               0x2
#define GREATER_THAN            0x3
#define LESS_THAN_OR_EQUAL      0x4
#define GREATER_THAN_OR_EQUAL   0x5

#define _IF_NOT_EQUAL(a, b) IF NOT_EQUAL a b;
#define _IF_EQUAL(a, b) IF EQUAL a b;
#define _IF_LESS_THAN(a, b) IF LESS_THAN a b;
#define _IF_GREATER_THAN(a, b) IF GREATER_THAN a b;
#define _IF_LESS_THAN_OR_EQUAL(a, b) IF LESS_THAN_OR_EQUAL a b;
#define _IF_GREATER_THAN_OR_EQUAL(a, b) IF GREATER_THAN_OR_EQUAL a b;
#define _ENDIF ENDIF 0x0 0x0 0x0;

I'll be posting more details and feedback for you, plus the "build file system" I've created so you can ponder. My code is merely a proof of concept to see how far I could push readability, with the assembly-language-looking opcodes format being the output that the Vetus can handle. My coding style may be different enough that examining it may be the quickest way to understand the goals and mechanisms I'd like to have and the community should have to contribute solid, readable and timely (i.e. many) test scripts.

For now, take a look at my final 74LS08 top-level test file.

74LS08.chipsrc

[chipfile]
type = single

[chips]

---

[meta]
name            = 74LS08
pins            = 14
type            = 4
imageIndex      = 2

[defines]

#define RESULT_X            0x46

#define CHECKING_STR        0x0
#define GOOD_STR            0x1
#define BAD_STR             0x2

#define GATE_REG_IDX        0x0
#define DEST_REG_IDX        0x1

#define _SETUP_AND_TEST_AND_GATE(src_pin1, src_pin2, dest_pin) \
    _IF_RETURN_CODE_PASS();                                         \
        _PRINT(CHECKING_STR);                                       \
        _TEST_AND_GATE(src_pin1, src_pin2, dest_pin, DEST_REG_IDX); \
                                                                    \
        _IF_RETURN_CODE_PASS();                                     \
            _PRINT_AT_X(GOOD_STR, RESULT_X);                        \
        _ENDIF;                                                     \
        _IF_RETURN_CODE_FAIL();                                     \
            _PRINT_AT_X(BAD_STR, RESULT_X);                         \
        _ENDIF;                                                     \
        _PRINT_LINE();                                              \
                                                                    \
        _REG_INC(GATE_REG_IDX);                                     \
    _ENDIF;

[code]

#include "includes/stddefs.h"
#include "includes/stdhelpers.h"
#include "includes/stddisplay.h"
#include "includes/stdopcodes.h"
#include "includes/stdtests.h"

/*
NOTES:
    #R0 : Displayed gate number
    #R1 : Temp storage for reading pins
*/

_TEST_INIT()

// Initial setup of state and hardware
_REG_LOAD(GATE_REG_IDX, 0x1);
_ALL_DIR(0x5B, 0x37);
_ALL_LEVEL(0x0, 0x1);

/*********************************************************
Gate 1  (pins 1,2 -> 3)
*******************************************************/
_SETUP_AND_TEST_AND_GATE(0x1, 0x2, 0x3);

/******************************************************
Gate 2  (pins 4,5 -> 6)
*******************************************************/
_SETUP_AND_TEST_AND_GATE(0x4, 0x5, 0x6);

/******************************************************
Gate 3  (pins 9,10 -> 8)
*******************************************************/
_SETUP_AND_TEST_AND_GATE(0x9, 0xA, 0x8);

/******************************************************
Gate 4  (pins 12,13 -> 11)
**********************************************************/
_SETUP_AND_TEST_AND_GATE(0xC, 0xD, 0xB);

// End of test
_TEST_DONE();

[strings]

0 = gate %d#R0: 
1 = good
2 = bad
3 =
4 =
5 =
6 =
7 =

[ENDCHIPS]

Which builds, becoming this preprocessed and usable test file.

74LS08.chip

[chipfile]
type = single

[chips]

---

[meta]
name            = 74LS08
pins            = 14
type            = 4
imageIndex      = 2

[code]
PASSFAIL 0x1 0x0 0x0
REGLOD 0xf 0x1 0x0
FILSCR 0x0 0x0 0x0
REGLOD 0xe 0x0 0x0
REGLOD 0x0 0x1 0x0
ALLDIR 0x5B 0x37 0x0
ALLEVEL 0x0 0x1 0x0
IF 0x0 #R15 0x1
SHOSTR 0x0 0x0 #R14
UDSCRN 0x0 0x0 0x0
DELMS 0xa 0x0 0x0
SETPIN 0x1 0x0 0x0
SETPIN 0x2 0x0 0x0
RDPIN 0x3 0x1 0x0
IF 0x1 #R1 0x0
REGLOD 0xf 0x0 0x0
ENDIF 0x0 0x0 0x0
IF 0x0 #R15 0x1
SETPIN 0x1 0x1 0x0
RDPIN 0x3 0x1 0x0
IF 0x1 #R1 0x0
REGLOD 0xf 0x0 0x0
ENDIF 0x0 0x0 0x0
IF 0x0 #R15 0x1
SETPIN 0x1 0x0 0x0
SETPIN 0x2 0x1 0x0
RDPIN 0x3 0x1 0x0
IF 0x1 #R1 0x0
REGLOD 0xf 0x0 0x0
ENDIF 0x0 0x0 0x0
IF 0x0 #R15 0x1
SETPIN 0x1 0x1 0x0
RDPIN 0x3 0x1 0x0
IF 0x1 #R1 0x1
REGLOD 0xf 0x0 0x0
ENDIF 0x0 0x0 0x0
ENDIF 0x0 0x0 0x0
ENDIF 0x0 0x0 0x0
ENDIF 0x0 0x0 0x0
IF 0x0 #R15 0x1
SHOSTR 0x1 0x46 #R14
UDSCRN 0x0 0x0 0x0
DELMS 0xa 0x0 0x0
ENDIF 0x0 0x0 0x0
IF 0x1 #R15 0x1
SHOSTR 0x2 0x46 #R14
UDSCRN 0x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 0x1
SETPIN 0xC 0x0 0x0
SETPIN 0xD 0x1 0x0
RDPIN 0xB 0x1 0x0
IF 0x1 #R1 0x0
REGLOD 0xf 0x0 0x0
ENDIF 0x0 0x0 0x0
IF 0x0 #R15 0x1
SETPIN 0xC 0x1 0x0
RDPIN 0xB 0x1 0x0
IF 0x1 #R1 0x1
REGLOD 0xf 0x0 0x0
ENDIF 0x0 0x0 0x0
ENDIF 0x0 0x0 0x0
ENDIF 0x0 0x0 0x0
ENDIF 0x0 0x0 0x0
IF 0x0 #R15 0x1
SHOSTR 0x1 0x46 #R14
UDSCRN 0x0 0x0 0x0
DELMS 0xa 0x0 0x0
ENDIF 0x0 0x0 0x0
IF 0x1 #R15 0x1
SHOSTR 0x2 0x46 #R14
UDSCRN 0x0 0x0 0x0
DELMS 0xa 0x0 0x0
ENDIF 0x0 0x0 0x0
ADD #R14 0xa 0xe
UDSCRN 0x0 0x0 0x0
DELMS 0xa 0x0 0x0
REGINC 0x0 0x0 0x0
ENDIF 0x0 0x0 0x0
IF 0x1 #R15 0x1
PASSFAIL 0x0 0x0 0x0
ENDIF 0x0 0x0 0x0
DELMS 0x7d0 0x0 0x0
ENDTEST 0x0 0x0 0x0
[strings]

0 = gate %d#R0: 
1 = good
2 = bad
3 =
4 =
5 =
6 =
7 =

[ENDCHIPS]

Reply
Posts: 102
Admin
(@nivbot)
Member
Joined: 11 months ago

Yeah, it's like old asm code like that, where functions don't really save space. Nah. I had to go in and add some code to the firmware to make sure functions only need to physically be in the code once. The new version is much more user friendly I think. 


Reply
Posts: 21
Topic starter
(@aadhoc4370)
Eminent Member
Joined: 7 months ago

Hi Kelvin,

Forgot to answer the other question... I'm AAron (yes I use that unique capitalization 🙂 )

Here's the build system and semi-organized thoughts I had while working with your chip tester and building a preprocessing layer. It will take you a while to absorb the code and README-Thoughts.txt file, but I think you'll find it all interesting.

I know you're working on substantial changes, and this zip file will be stale soon. If anyone else wants to play with it, consider ideas, help out, etc... have fun. Having the open discussion and leaving the artifacts around could be interesting or helpful to others that end up getting involved.

Ttyl


Reply
rbourque
Posts: 44
(@rbourque)
Trusted Member
Joined: 5 months ago

I'm behind this initiative 100%.  When I came across Vetus Pars on youtube I could see the potential and the big draw for me is being able to make my own tests.   I ordered it right away and it should be coming in today.

I've been coding for 30 years, and dabble in retro computers (It doesn't feel retro when I remember them as new when owned them as a teenager)

I'm here to help.    (Time permitting of course!)


Reply
1 Reply
Admin
(@nivbot)
Joined: 11 months ago

Member
Posts: 102

@rbourque Please feel free to ask any questions you have. The docs are a little outdated so you might have some questions. Read the update notes for the newest stuff. I'll be putting out updated docs this week and also some videos on coding and what each function does some time soon. I'll also be working on a Linux version and hopefully some QoL updates to the GUI as well.


Reply
Page 2 / 2
Share: