Coder Social home page Coder Social logo

xc-basic3's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

xc-basic3's Issues

Compiler error

re-factoring some C64 Dir code.

Please submit this bug to https://github.com/neilsf/xc-basic3/issues

exit status: 1
cd C:\xcbasic3
C:\xcbasic3\bin\Windows\xcbasic3.exe "disk.bas" "disk.prg"
disk.bas:20.0: WARNING: Downcasting from int to byte truncates value
disk.bas:49.0: WARNING: Downcasting from int to byte truncates value
** ERROR ** There has been an error while trying to execute DASM, please see the bellow message.
Tried to execute: "dasm.exe" "C:\Users\jakeb\AppData\Local\Temp\xcbtmp_9C2A7B4B.asm" -o"disk.prg"

disk.zip

Please submit this bug to https://github.com/neilsf/xc-basic3/issues

exit status: 1

symbol copy error during compile

I'm always getting the following error when compiling:

std.file.FileException@std\file.d(4318): Copy from C:\Users\thrak\AppData\Local\Temp\xcbtmp_33677BC2.sym to "test2.symbols.txt": The filename, directory name, or volume label syntax is incorrect.

Compile error - Input# statement

Please submit this bug to https://github.com/neilsf/xc-basic3/issues

exit status: 1
cd C:\xcbasic3
C:\xcbasic3\bin\Windows\xcbasic3.exe "6.bas" "6.prg"
6.bas:68.0: WARNING: Downcasting from int to byte truncates value
** ERROR ** There has been an error while trying to execute DASM, please see the bellow message.
Tried to execute: "dasm.exe" "C:\Users\jakeb\AppData\Local\Temp\xcbtmp_7C5995A0.asm" -o"6.prg
6.zip
"

Set the length of a string by assigning a value to it

At the moment you have to set the length of a string, and then give a value:

dim myString as string * 9
myString = "some text"

It would be a nice feature if it could be done in one line, something like
dim myString as string = "some text"

Or possibly even dim myString as "some text with the compiler detecting it's a string, and setting the length automatically.

Compile error - input#

Grabbed the latest version to compile. Seems we have a new input bug

exit status: 0
cd C:\xcbasic3
C:\xcbasic3\bin\Windows\xcbasic3.exe "main.bas" "main.prg"
** ERROR ** There has been an error while trying to execute DASM, please see the bellow message.
Tried to execute: "dasm.exe" "C:\Users\jakeb\AppData\Local\Temp\xcbtmp_98165EC8.asm" -o"main.prg
main.zip
"

Error when setting array size with a byte constant

If you try and set an array size using a byte constant, you receive an error.

const SIZE! = 10
dim myArray[SIZE!]

Throws the error core.exception.SwitchError@source\language\number.d(28): No appropriate switch clause found

It works fine with normal integer constants though.

Optimize for size

Those routines (built-in routines, procedures and functions) that are never called should be excluded from the output in order to make the compiled program as compact as possible.

fp arithmetics are failing

DIM f AS FLOAT
f = 1.0 + 0.1
print f

f = 1.0 - 0.1
print f

f = 1.0 * 0.1
print f

f = 1.0 / 0.1
print f

First three provide wrong values and division hangs c64.
image

XC=BASIC library was not found in "/usr/lib

Using Mac Monterey 12.1

So I created a symbolic link to xcbasic3 as directed

$ sudo ln /Users/x/source/xc-basic3/bin/macOS/xcbasic3 /usr/local/bin/xcbasic3

$ ls -la /usr/local/bin/xcbasic3 
-rwxr-xr-x  2 d  staff  16329472 Jan  4 23:01 /usr/local/bin/xcbasic3

/usr/local/bin is in my path.

However when I execute xcbasic complains about the lib folder missing

$ xcbasic3 
XC=BASIC library was not found in "/usr/lib". Please make sure the directory exists and contains the library files.

I've left the lib folder in the original location as advised here https://xc-basic.net/doku.php?id=v3:installation_and_usage
To run properly, XC=BASIC needs the lib/ directory as well and it must be in the same folder where the bin/ directory is. Just leave them as they are.

Is /usr/lib hardcored as xc basic appears to be expecting the libs there?

Compile error.

Please submit this bug to https://github.com/neilsf/xc-basic3/issues

exit status: 1
cd C:\xcbasic3
C:\xcbasic3\bin\Windows\xcbasic3.exe "6.bas" "6.prg"
6.bas:39.0: WARNING: Downcasting from int to byte truncates value
** ERROR ** There has been an error while trying to execute DASM, please see the bellow message.
Tried to execute: "dasm.exe" "C:\Users\jakeb\AppData\Local\Temp\xcbtmp_F9CFF990.asm" -o"6.prg
6.zip
"

Emit warning if local variable shadows global variable with same name

According to documentation inside a proc i can usa a global variable with modifier ''
But whit arrays the compiler doesn't seem that careful.
the following piece of code does not emit compile error "undefined variable" that i excpected.

Rem Test
data yFires![] = 0,0,0
let count! = 0

proc foo
if \yFires![\count!] > 0 then :Rem removing global modifier Compiler emit Compile-error
yFires![\count!] = 0: Rem No global modifier \ - Compiler have does not emit error in compile time
endif

endproc

No way to seed random numbers

It would be a useful feature to be able to seed the random number generator, possibly by putting the seed value as an argument of the rnd function.

Also, how is the initial random number seed selected? I always get the same sequence of numbers when running my code in an emulator.

Crash when running in C64

(Sorry, I originally posted this to XC-Basic project -> wrong one)
c64 consistently crashes when executing this code (I tried to isolate the problem into small snippet):

DIM i AS INT

SUB calc_mod(s0 AS INT, s1 AS INT) STATIC
    i = s0 MOD s1
END SUB

CALL calc_mod(0, 255)

Add string functions similar to BASIC

String functions should be added that implement a lot of the standard BASIC string functions without having to do workarounds with array buffers.

"address of" operator does not work with variable in array index

TYPE coordinates
    x AS LONG
    y AS LONG
END TYPE

DIM position(10) AS coordinates

DIM a1 AS WORD
DIM a2 AS WORD

DIM i AS BYTE
i = 5
a1 = @position(i).x
a2 = @position(i).y
print a1, a2
REM output is 2629 2629 <- WRONG

a1 = @position(5).x
a2 = @position(5).y
print a1, a2
REM output is 2629 2632 <- CORRECT

Using MID$ seems to corrupt something

DIM t AS STRING*12
t = "  hello!  "
DIM length AS BYTE: length = len(t)
t = MID$(t, 1, length - 1)
PRINT t

I'm not sure exactly what is causing corruption, but this program does something bad causing the C64 in VICE to crash.

Can't compile the fibonacci series example

I just downloaded the repo (git clone) and compiled the following as test.bas:

rem ** fibonacci series **
let max = 32767
let t1 = 0
let t2 = 1
print "fibonacci series:"
loop:
	print t1, " "
	let nx = t1 + t2
	let t1 = t2
	let t2 = nx
	if nx < max then goto loop
end

The build fails with:

C:\code\Fun\C64\XCBasic\xc-basic3\bin\Windows>xcbasic3.exe test.bas test.prg
test.bas:2.0: NOTICE: Variable "max" implicitly defined as int
test.bas:3.0: NOTICE: Variable "t1" implicitly defined as byte
test.bas:4.0: NOTICE: Variable "t2" implicitly defined as byte
test.bas:8.0: NOTICE: Variable "nx" implicitly defined as byte
C:\Users\thrak\AppData\Local\Temp\xcbtmp_B1F1E3D.asm (22): error: Unknown Mnemonic 'xbegin'.
C:\Users\thrak\AppData\Local\Temp\xcbtmp_B1F1E3D.asm (24): error: Unknown Mnemonic 'pint'.
C:\Users\thrak\AppData\Local\Temp\xcbtmp_B1F1E3D.asm (27): error: Unknown Mnemonic 'plintvar'.
C:\Users\thrak\AppData\Local\Temp\xcbtmp_B1F1E3D.asm (30): error: Unknown Mnemonic 'pbyte'.
C:\Users\thrak\AppData\Local\Temp\xcbtmp_B1F1E3D.asm (33): error: Unknown Mnemonic 'plbytevar'.
C:\Users\thrak\AppData\Local\Temp\xcbtmp_B1F1E3D.asm (36): error: Unknown Mnemonic 'pbyte'.
C:\Users\thrak\AppData\Local\Temp\xcbtmp_B1F1E3D.asm (39): error: Unknown Mnemonic 'plbytevar'.
C:\Users\thrak\AppData\Local\Temp\xcbtmp_B1F1E3D.asm (40): error: Unknown Mnemonic 'pstringvar'.
C:\Users\thrak\AppData\Local\Temp\xcbtmp_B1F1E3D.asm (41): error: Unknown Mnemonic 'printstring'.
C:\Users\thrak\AppData\Local\Temp\xcbtmp_B1F1E3D.asm (42): error: Unknown Mnemonic 'printnl'.
C:\Users\thrak\AppData\Local\Temp\xcbtmp_B1F1E3D.asm (46): error: Unknown Mnemonic 'pbytevar'.
C:\Users\thrak\AppData\Local\Temp\xcbtmp_B1F1E3D.asm (49): error: Unknown Mnemonic 'printbyte'.
C:\Users\thrak\AppData\Local\Temp\xcbtmp_B1F1E3D.asm (50): error: Unknown Mnemonic 'printtab'.
C:\Users\thrak\AppData\Local\Temp\xcbtmp_B1F1E3D.asm (51): error: Unknown Mnemonic 'pstringvar'.
C:\Users\thrak\AppData\Local\Temp\xcbtmp_B1F1E3D.asm (52): error: Unknown Mnemonic 'printstring'.
C:\Users\thrak\AppData\Local\Temp\xcbtmp_B1F1E3D.asm (53): error: Unknown Mnemonic 'printnl'.
C:\Users\thrak\AppData\Local\Temp\xcbtmp_B1F1E3D.asm (56): error: Unknown Mnemonic 'opt_pbytevar_pbytevar_addbyte'.
C:\Users\thrak\AppData\Local\Temp\xcbtmp_B1F1E3D.asm (59): error: Unknown Mnemonic 'plbytevar'.
C:\Users\thrak\AppData\Local\Temp\xcbtmp_B1F1E3D.asm (62): error: Unknown Mnemonic 'pbytevar'.
C:\Users\thrak\AppData\Local\Temp\xcbtmp_B1F1E3D.asm (65): error: Unknown Mnemonic 'plbytevar'.
C:\Users\thrak\AppData\Local\Temp\xcbtmp_B1F1E3D.asm (68): error: Unknown Mnemonic 'pbytevar'.
C:\Users\thrak\AppData\Local\Temp\xcbtmp_B1F1E3D.asm (71): error: Unknown Mnemonic 'plbytevar'.
C:\Users\thrak\AppData\Local\Temp\xcbtmp_B1F1E3D.asm (73): error: Unknown Mnemonic 'pbytevar'.
C:\Users\thrak\AppData\Local\Temp\xcbtmp_B1F1E3D.asm (74): error: Unknown Mnemonic 'F_cint_byte'.
C:\Users\thrak\AppData\Local\Temp\xcbtmp_B1F1E3D.asm (75): error: Unknown Mnemonic 'pintvar'.
C:\Users\thrak\AppData\Local\Temp\xcbtmp_B1F1E3D.asm (77): error: Unknown Mnemonic 'cmpintlt'.
C:\Users\thrak\AppData\Local\Temp\xcbtmp_B1F1E3D.asm (80): error: Unknown Mnemonic 'cond_stmt'.
C:\Users\thrak\AppData\Local\Temp\xcbtmp_B1F1E3D.asm (83): error: Unknown Mnemonic 'xend'.
C:\Users\thrak\AppData\Local\Temp\xcbtmp_B1F1E3D.asm (84): error: Unknown Mnemonic 'xend'.

Unrecoverable error(s) in pass, aborting assembly!
Complete.

v3.1 feature list

This is the list of planned features for version 3.1. Please add your thoughts and wishes.

Sprites

(Highly inspired by Hesware's Graphics BASIC)

SPRITE n ON|OFF
         AT x, y
         COLOR c
         HIRES|MULTI
         ON|UNDER BACKGROUND
         SHAPE s
         XYSIZE xs, ys
SPRITE CLEAR HIT
SPRITE MULTICOLOR c1, c2
SPRITEHIT(n)
SPRITEHITBG(n)

Joystick

JOY(n)
JOYUP(n)
JOYDOWN(n)
JOYLEFT(n)
JOYRIGHT(n)
JOYFIRE(n)

Interrupts

ON INTERRUPT n GOTO label
INTERRUPT ON|OFF
          WITH|WITHOUT KERNAL

Sound

(Highly inspired by Hesware's Graphics BASIC)

SOUND CLEAR
VOICE   n
        [ON|OFF]
        [ADSR a, d, s, r]
        [TONE f]
        [WAVE SAW|TRI|PULSE|NOISE]
        [PULSE p]
FILTER  [f]
        [LOW|BAND|HIGH]
        [VOICE 1]
        [VOICE 2]
        [VOICE 3]
VOLUME v

TEXTAT not using PET codes.

I did not title that right. Anyway...
this line
I believe should change the text to white

TEXTAT 10, 10, "{WHITE}text in white"

It is doing this: No white color.

image

SELECT CASE blocks

Implement SELECT ... CASE ... ENDSELECT blocks in the style of QB or similar, for example:

SELECT <expression>
  CASE expression1
    [statements]
  CASE expression2
    [statements]
  DEFAULT
    [statements]
ENDSELECT

Compiler option to protect high memory

A compiler option should be added to halt compilation if the program exceeds a certain size to be able to define user memory space in the high area, e. g.

REM This would protect the RAM from C000-CFFF
PRAGMA memory_limit = $BFFF

Long + int arithmetic problems

Test code:

DIM l AS LONG

l = 0
l = l + 256
print hex(l)

outputs: $46e1e9 (value after zero assignment is correctly $000000)

I believe that this problem affects most of the operators +, -, *, / but I have tested only addition.

Something with manipulating the string return value of a function, doesn't work.

I can't seem to adjust the return string directly. In the example below, the length of the string is always 0. It seems for the purpose of a poke, you can't reference @str_Strings. The value always seems to be 0 in the following example.

FUNCTION str_Strings AS STRING*96 (count AS BYTE, character AS BYTE) STATIC SHARED

  print peek(@str_Strings)
  POKE @str_Strings, count
  print peek(@str_Strings)

END FUNCTION

unary NOT is not working

Examples:

DIM i AS INT
i = 1

print NOT (i) <- COMPILE ERROR
print NOT 1 <- COMPILE ERROR
print NOT i <- WRONG RESULT $46E1

Comments not allowed inside of TYPE blocks

I'm not sure if this is a bug or an ER, but code like:

type location
	x               as int: ' the column
	y               as int: ' the row
end type	

...generates the error:
ERROR: TYPE blocks can only contain field or method definitions
It fails for either ' or REM, and fails whether located at the beginning of the line, or after a ":"

Surely we want to be able to comment the fields and procedures in a TYPE, right?

Option to compile DATA statements at the current origin

This is my first test with xc-basic, so there is a high probability that I have misunderstood something ๐Ÿ˜„

This is the code

GOTO START

ORIGIN 2112
DATA AS BYTE 0,1,2,3,4,5,6,7

START:
DIM values(8) AS BYTE @2112
PRINT values(3)

Compiling and running this in VICE prints 32, but I would expect it to print 3. I also find the syntax @2112 a little surprising (the need for @ sign specifically).

Question: How are random floats generated

...is it like

  1. set sign bit 0, create random 23 bit mantissa and set exp to 81
  2. subtract 1.0

Sorry for misusing the issue for question, but I was trying to test random floats as a continuation to random integer floats issue.

Support 3D arrays

The current implementation of arrays only support 2 dimensions. At least 3 should be supported.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.