Jump to content
IGNORED

INTYBASIC 1.2 problems


artrag

Recommended Posts

Developing the compiler is not up to you (nor to me) but to Oscar who will decide as he likes.

 

 

Oscar can do whatever he wants, but he's also intelligent and reasonable and solicits feedback from the community pretty much continuously. If people want something, he'll try to implement it. And if people DON'T want something, he'll probably avoid it. This ain't a democracy, but he's very good about listening to those who use the product, and those that simply have good ideas. There are a lot of technical experts here who may not actually use the compiler very much, but they have a wealth of experience with compiler and language design - and they've helped make it better.

 

Cluttering up the language with a hundred new constructs and writing off concerns with "newbies don't have to use it" is how we end up with things that no one uses. Because newbies inevitably end up getting burned with these cool-looking and extremely dangerous features, and stop their work entirely. The language is already complex enough that I'm seeing people coming up with 10 different ways to skin every cat. At least right now they're not tripping over their own toes, but that'll start to happen once people get over-fancy with macro definitions.

 

I'd rather see some more abstract data structure support (a lot of people seem keen on string support, and if done efficiently, so would I) and perhaps some improvements on the current bit-banging that is SOUND, before we worry about convoluted manual memory management with the tiny handful of bytes we have available. But that's just me. I like things simple.

Be happy that I'm not about to suggest strict Python-style formatting. I'm becoming a HUGE fan - it would immensely help readability of some of my more complex ifelifelif blocks - and man, IntyBASIC would look slick with it. But a lot of people would crucify me. :lol:

  • Like 3
Link to comment
Share on other sites

Add a label in the generated asm with the fixed address of the variable. That's it all.

As you said it is a feature of the assembler so supporting it from the compiler is effortless.

 

I still say manual management of memory locations for variables is dangerous to everybody except those skilled enough to use the other alternatives we have suggested.

 

Developing the compiler is not up to you (nor to me) but to Oscar who will decide as he likes.

 

Very true. I wish you luck getting Oscar to add your pet feature to the language. I wouldn't hold my breath, though.

 

This discussion is drifting to idiotic contraposition of theories. For me the discussion ends here.

That's only because you keep insisting on a feature that nobody wants, and refuse to accept the perfectly reasonable facsimile offered by the language extensions Oscar added precisely to let power users take advantage of assembly tricks without having to pollute the language with complex or esoteric features.

 

It really shouldn't have turned into such a big deal.

 

I know I asked for a macro mechanism specifically to do things like this; and in my opinion at least, the ASM directive with a macro wrapper is the most powerful combination ever, which lets me expand the language with my own bespoke functions and directives. Why not embrace this?

 

dZ.

Link to comment
Share on other sites

Looking at the code generated by the compiler I see under certain conditions twice DEC R0 and under others SUBI #2,R0

This is from the LS file

;[163]  WSCR(X,Y-1,1)
SRCFILE "C:\Users\Admin\Documents\IntyBASIC SDK\Projects\test\test.BAS",163
MVI V1,R0
DECR R0
DECR R0
MULT R0,R4,20
MVI V2,R1
DECR R1
ADDR R1,R0
ADDI #512,R0
PSHR R0
MVII #1,R0
PULR R4
MVO@ R0,R4
;[164]  Y=Y-2
SRCFILE "C:\Users\Admin\Documents\IntyBASIC SDK\Projects\test\test.BAS",164
MVI V1,R0
SUBI #2,R0
MVO R0,V1
;[165]  GOTO L440

Which is the optimal solution ? This should removed by peephole optimization

The bas and the rom are in attach

test.rom

test.bas

Edited by artrag
Link to comment
Share on other sites

 

Looking at the code generated by the compiler I see under certain conditions twice DEC R0 and under others SUBI #2,R0

This is from the LS file

 

;[163] WSCR(X,Y-1,1)
SRCFILE "C:\Users\Admin\Documents\IntyBASIC SDK\Projects\test\test.BAS",163
MVI V1,R0
DECR R0
DECR R0
MULT R0,R4,20
MVI V2,R1
DECR R1
ADDR R1,R0
ADDI #512,R0
PSHR R0
MVII #1,R0
PULR R4
MVO@ R0,R4
;[164] Y=Y-2
SRCFILE "C:\Users\Admin\Documents\IntyBASIC SDK\Projects\test\test.BAS",164
MVI V1,R0
SUBI #2,R0
MVO R0,V1
;[165] GOTO L440
Which is the optimal solution ?

 

 

SUBI is cheaper, only 8 clock cycles in immediate mode, while each DECR costs 6 cycles. It must be an artefact of the code expression processor.

 

By the way, why is Y (V1) being decremented twice when the first expression says "Y-1"? Can you post the macro?

 

 

-dZ.

Edited by DZ-Jay
Link to comment
Share on other sites

Developing the compiler is not up to you (nor to me) but to Oscar who will decide as he likes.

This discussion is drifting to idiotic contraposition of theories. For me the discussion ends here.

It is strange that you word it that way. Oscar has been very open since his first release to adding features suggested by the community. Both from people new to the Intellivision's capabilities (as I was 2 years ago) and from the undisputed low level experts (like DZJay, Groovybee and Intvnut.) Oscar does have a good handle on what is useful and what isnt while balancing the needs of the amateurs with the needs of the experts. In fact, there are many non-public discussions going on around technical features like this. He maintains a to-do/to-think-about list. You are getting push back from people very experienced with IntyBasic, including a few people that Oscar has trusted with things that would never be discussed in a public forum. These kind of technical debates are quite entertaining and can go on for weeks and reveal the personal bias around programming styles but are generally very civil.

 

For your specific thought around what I'm interpreting as a Overlapping Variables (or a ReDIM), I think many of us that have been with IntyBasic from the beginning see that as a non-issue, maybe because we are used to manually editing the Prologue, or even the .asm file before it is compiled.

 

Right now, we can

DIM GeneralPurposeArray(100)

And use only the first 20 slots for something, then empty it and use the first 30 for something else later. Other than readability of code, it is the same thing. Given the limited memory available to 8 bit and 16 bit variables, I'd hate any kind of ReDim or garbage collection or memory hole management overhead to add to the complexity of the generated code. Reading above, I think everyone understands what you are asking for, they just don't agree on it's priority compared to other BASIC language features like STRING handling.

Edited by Tarzilla
Link to comment
Share on other sites

Which is the optimal solution?

Start your loops at 0 and treat the upper left BACKTAB corner as being at coordinate 0,0 and the lower right corner as 19,11. Then you can remove the "-1" from your DEF FN :-

 

	DEF FN WSCR(x,y,n) = POKE SCREENADDR((x-1),(y-1)),n
Given that you won't be generating the maze at 60 FPS I wouldn't worry too much about its performance.
  • Like 1
Link to comment
Share on other sites

I just remember this comment:

 

In this case maybe supporting natively two dimensional arrays could help even more

 

This can easily be simulated with a unidimensional array and a macro to compute the index based on X, Y coordinates of the matrix:

DIM Array1D(100) ' Array1D(10, 10)

DEF FN Array2D(x,y) = Array1D((y * 10) + x)
  • Like 2
Link to comment
Share on other sites

The function WSCR has another -1 inside while converting from 2d to linear coordinates.

The expansion of

WSR(x,y-1,1)

is

poke screenaddr (x-1,y-2),1

The compiler could optimise the expression or at the function replacement or while executing peephole optimisation

 

I see. Well, it won't happen during macro expansion, since the nature of such things is to do a verbatim replacement in situ; but it could happen during the final expression processing.

 

It seems that after the macro expansion, you are left with "y-1-1" and instead of optimising the subtraction, it just decrements twice. I'm sure Oscar can look into that for improvements.

 

I agree with GroovyBee in that those extra 4 clock cycles are going to have absolutely no impact on your performance, at least in this particular use case; since you will not be calculating the maze dimensions at 60 FPS.

 

-dZ.

Link to comment
Share on other sites

The final expression processing has some small performance issues in simplifying the results.

Q6:	;[78] 	i = (frame + 1)-1
	SRCFILE "C:\Users\Admin\Documents\IntyBASIC SDK\Projects\test\test.BAS",78
	MVI _frame,R0
	INCR R0
	DECR R0
	MVO R0,V8
	;[79] 	i = frame + 1-1
	SRCFILE "C:\Users\Admin\Documents\IntyBASIC SDK\Projects\test\test.BAS",79
	MVI _frame,R0
	INCR R0
	DECR R0
	MVO R0,V8
 

Usually you would not code these expressions but using extensively functions they can occur

 

PS

test.bas is for testing the compiler, no worries about its performance

Edited by artrag
Link to comment
Share on other sites

The label generation problem has probably to do with the new constructions you added

The optimization problems could be present also in previous versions.

 

Just solved, please re-download compiler at: http://atariage.com/forums/topic/241446-intybasic-compiler-v12-the-good-things-are-now-better/

 

Added #BACKTAB option to access directly screen and optimized POKE statement code generation.

 

Also added options -fx and -fy for IntyColor (flip imagen in X/Y directions).

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

A very minor problem: in attached file the compiler does not return a specific error for line 37 where I call an non existent function abx() instead of abs()

I get only an error in the summary but without details

 

 

C:\Users\Admin\Documents\IntyBASIC SDK\Projects\gorf>intytest gorf
IntyBASIC Build Script (INTYBUILD.BAT)
Created by: DZ-Jay
Last updated: 07/13/2015
IntyBASIC compiler v1.2 Aug/19/2015
© 2014-2015 Oscar Toledo G. http://nanochess.org/
7 used 8-bit variables of 228 available
0 used 16-bit variables of 47 available
Compilation finished
Assembling...
ERROR SUMMARY - ERRORS DETECTED 1
- WARNINGS 0
AS1600 assemblage failed.
Program build aborted.
jzIntv Debugger Run Script (INTYDBUG.BAT)
Created by: DZ-Jay
Last updated: 07/13/2015
Could not find any of these candidate files:
bin\gorf
bin\gorf.rom
bin\gorf.cc3
bin\gorf.bin
bin\gorf.int
bin\gorf.itv
Search path:
.
C:\Users\Admin\Documents\IntyBASIC SDK\bin\..\rom
ERROR: Failed to initialize game
jzIntv execution failed.
Emulator execution aborted.
C:\Users\Admin\Documents\IntyBASIC SDK\Projects\gorf>

gorf.bas

Link to comment
Share on other sites

The error is caught by the Assembly stage, not by the compiler. There will be a file called Gorf.LST in the BIN folder under your project, It will contain the details of these errors.

 

Open in a text editor and Search for "error"

 

50E2 0240 0112 MVO R0,V7
;[36] if abx(dx)>10 then ddx=-ddx
SRCFILE "gorfspin.bas",36
MVII #Q4,R3
gorf.asm:2906: ERROR - undefined symbol Q4
Link to comment
Share on other sites

Also, I noticed that the "INTYTEST" tool did not detect the failure in the assembler and proceeded to execute the debugger. I will try to fix that in the next version of the SDK.

 

As for the error, I believe the latest version of IntyBASIC does check for those things.

 

dZ.

  • Like 1
Link to comment
Share on other sites

A very minor problem: in attached file the compiler does not return a specific error for line 37 where I call an non existent function abx() instead of abs()

I get only an error in the summary but without details

Please update to 1.2.2 (available in the 1.2 thread). These kinds of errors are now detected.

  • Like 1
Link to comment
Share on other sites

 

The error is caught by the Assembly stage, not by the compiler. There will be a file called Gorf.LST in the BIN folder under your project, It will contain the details of these errors.

 

Open in a text editor and Search for "error"

 

50E2 0240 0112 MVO R0,V7
;[36] if abx(dx)>10 then ddx=-ddx
SRCFILE "gorf.bas",36
MVII #Q4,R3
gorf.asm:2906: ERROR - undefined symbol Q4

 

 

It reports only a generic error, not where it is. I pasted what it gives

The lst file tells you exactly which line in the souirce has the error, in this case line 36. Granted it doesn't say LINE 36 and it appears 2 lines up from the actual ERROR but it is there. 1.2.2 is supposed to make it friendlier

 

SRCFILE "gorf.bas",36

Link to comment
Share on other sites

 

Yes, thanks to the new error reporting feature for labels you now can search easily for the offending label without checking the LST file.

 

BTW, the newest compiler is marked Aug/24.

 

ok in version Aug/24 the compiler detects the missing function and reports the line where it appears. Version Aug/19 gives a generic error and you need to look in the .LS file to see what went wrong.

 

Another issue about version Aug/24.

Doing this assignment

ddx =-1
ddy =-1
I get these warnings
IntyBASIC compiler v1.2 Aug/24/2015
© 2014-2015 Oscar Toledo G. http://nanochess.org/
Warning: assigning value bigger than 8-bits in line 22
Warning: assigning value bigger than 8-bits in line 23

It seems that the compiler expects an explicit cast for integer constants to char (or assumes that the byte type supports only positive numbers). How to tell to the compiler that a constant is char and not integer (and make the warning disappear)?

 

Probably for negative constants the compiler should test if they are in the range -128,127 before warning the user.

 

BTW does the compiler allows unsigned bytes dealing with values in 0,255 (and unsigned integers in 0,65535 )?

Edited by artrag
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...