Skip to content
This repository was archived by the owner on Jan 26, 2022. It is now read-only.

New functions #70

Open
PeterTillema opened this issue Jun 28, 2018 · 17 comments
Open

New functions #70

PeterTillema opened this issue Jun 28, 2018 · 17 comments

Comments

@PeterTillema
Copy link
Owner

PeterTillema commented Jun 28, 2018

LEFT( for bitshift left
RIGHT( for rightshift
ElseIf (instead of Else:If)
Stop

@Ti64CLi
Copy link
Contributor

Ti64CLi commented Jul 24, 2018

You didn't add the RIGHT( function?

@PeterTillema
Copy link
Owner Author

ICE/src/functions.c

Lines 660 to 707 in 9a0a180

// RIGHT(
else if (function2 == tRIGHT) {
bool shouldParseArguments = true;
bool shouldCallRoutine = true;
if (outputPrevType == TYPE_NUMBER) {
if (outputPrevPrevType == TYPE_VARIABLE) {
LD_HL_IND_IX_OFF(outputPrevPrevOperand);
shouldParseArguments = false;
if (outputPrevOperand & 0xFF) {
LD_A(outputPrevOperand);
} else {
shouldCallRoutine = false;
}
} else if (outputPrevPrevType == TYPE_CHAIN_ANS) {
if (!outputPrevOperand) {
shouldParseArguments = false;
shouldCallRoutine = false;
expr.outputReturnRegister = expr.outputRegister;
}
} else {
return E_SYNTAX;
}
}
if (shouldParseArguments) {
if ((res = parseFunction2Args(index, REGISTER_A, true)) != VALID) {
return res;
}
}
if (shouldCallRoutine) {
OR_A_A();
ProgramPtrToOffsetStack();
if (!ice.usedAlreadyMean) {
ice.programDataPtr -= SIZEOF_MEAN_DATA;
ice.MeanAddr = (uintptr_t)ice.programDataPtr;
memcpy(ice.programDataPtr, (uint8_t*)MeanData, SIZEOF_MEAN_DATA);
ice.usedAlreadyMean = true;
}
CALL_NZ(ice.MeanAddr + 3);
ResetHL();
ResetBC();
ResetA();
}
}

@Ti64CLi
Copy link
Contributor

Ti64CLi commented Jul 25, 2018

Then, why did you overlined the RIGHT( for rightshift ?

@PeterTillema
Copy link
Owner Author

Because it's implemented now, don't need to add it anymore :P

@Ti64CLi
Copy link
Contributor

Ti64CLi commented Jul 25, 2018

Oh, ok, sorry for that. So, I guess LEFT is also implemented?

@Ti64CLi
Copy link
Contributor

Ti64CLi commented Jul 25, 2018

It's so weird.
I saw that LEFT wasn't implemented yet
// LEFT( if (function2 == tLEFT) { }
But he works on my calc ^^'

@PeterTillema
Copy link
Owner Author

Sure it works, but it doesn't produce any code yet.

@Ti64CLi
Copy link
Contributor

Ti64CLi commented Jul 26, 2018

Though, when I compile that code :
Disp LEFT(4,1)
It displays 8

@PeterTillema
Copy link
Owner Author

Yes, because both arguments are numbers, and then it gets optimized:

ICE/src/parse.c

Lines 666 to 667 in a547470

} else if (function2 == tLEFT) {
temp = outputPrevPrevOperand << outputPrevOperand;

@Ti64CLi
Copy link
Contributor

Ti64CLi commented Jul 26, 2018

Ok, thank you

@Xenoxis
Copy link

Xenoxis commented Jan 13, 2019

Wait, Stop, DelVar, Menu( can be implemented ?
And if yes, will they be ?

@Xenoxis
Copy link

Xenoxis commented Jan 13, 2019

Will also be good if you can add switch statement with case

@PeterTillema
Copy link
Owner Author

Wait is essentially the same as Pause, Stop is a good one, DelVar is the same as 0->,Menu( is way too hard to implement, and switch / case looks too much like C.

@Xenoxis
Copy link

Xenoxis commented Jan 14, 2019

Is it bad if it looks like C ? Because switch can be interesting for some variables processing as interger and would be more efficient than lots of if, isen't it ?

@Ti64CLi
Copy link
Contributor

Ti64CLi commented Jan 18, 2019

I agree with Xenoxis, Menu( could be very useful ;)

@npease18
Copy link
Collaborator

I would argue against it, as it would be used on the main screen, not in the canvas mode. I, personally, do not see many ICE programs not use the drawing canvas, as ICE's main attraction is the use of the canvas to expand upon BASIC programs.

@PeterTillema
Copy link
Owner Author

Sure, Menu( is very useful, but it would be very large code, and you can 'easily' write it yourself.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants