Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not compile sample project on macOS #1

Open
vbauer opened this issue Aug 8, 2018 · 2 comments
Open

Could not compile sample project on macOS #1

vbauer opened this issue Aug 8, 2018 · 2 comments

Comments

@vbauer
Copy link

vbauer commented Aug 8, 2018

@thinkyhead Hello Scott, I've tried the following:

  1. Cloned https://github.com/thinkyhead/bAtariBasic
  2. Run: cd source && make // To compile bB
  3. Run: cd .. && mkdir bB
  4. Copied 2600basic, optimize, posprocess, preprocess tools to "bB" folder
  5. Copied "includes" folder to "bB" folder
  6. Copied 2600basic.sh to "bB" folder
  7. Changed all usages of tools to my compiled versions (ex: "posprocess" was changed to "./posprocess")
  8. Copied "samples/draw.bas" to "bB" folder
    10 Finally, run "./2600basic.sh draw.bas"

The result:

➜  bB git:(master) ✗ ./2600basic.sh draw.bas
Starting build of draw.bas
bAtariBASIC v1.1 (c)2005-2017
./2600basic.sh: line 9: 50042 Done                    ./preprocess < "$1"
     50043 Segmentation fault: 11  | ./2600basic -i . > bB.asm
Compilation failed.

Could you please help me with this issue?

@vbauer
Copy link
Author

vbauer commented Aug 9, 2018

I'm really sorry, maybe my question is extremely inappropriate.. I've tried to re-compile project using gcc with -g option to find the reason of segmentation fault (but I don't know c lang and gdb) and got the following result:

➜  bB git:(master) ✗ ./preprocess < draw.bas | gdb --args ./2600basic -i /Users/vbauer/Documents/workspace/atari2600/bAtariBasic/bB/bB  
GNU gdb (GDB) 8.1.1
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin17.7.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./2600basic...Reading symbols from /Users/vbauer/Documents/workspace/atari2600/bAtariBasic/bB/bB/2600basic.dSYM/Contents/Resources/DWARF/2600basic...done.
done.
(gdb) Undefined command: "include".  Try "help".
(gdb) A syntax error in expression, near `no_blank_lines'.
(gdb) Invalid number "8kSC".
(gdb) A syntax error in expression, near `on'.
(gdb) Undefined command: "const".  Try "help".
(gdb) Undefined command: "pfclear".  Try "help".
(gdb) Undefined command: "player0x".  Try "help".
(gdb) Undefined command: "player0".  Try "help".
(gdb) Undefined command: "".  Try "help".
(gdb) Undefined command: "".  Try "help".
(gdb) Undefined command: "".  Try "help".
(gdb) Undefined command: "".  Try "help".
(gdb) Undefined command: "".  Try "help".
(gdb) Undefined command: "".  Try "help".
(gdb) Undefined command: "".  Try "help".
(gdb) This command cannot be used at the top level.
(gdb) Undefined command: "gameloop".  Try "help".
(gdb) Undefined command: "COLUP0".  Try "help".
(gdb) Undefined command: "COLUPF".  Try "help".
(gdb)  >  >   >    >    >     >     >     >     >     >     >     >     >      >      >      >      >     >    >   >  > >No symbol "joy0left" in current context.
(gdb) quit

The same situation without gdb:

➜  bB git:(master) ✗ ./preprocess < draw.bas | ./2600basic -i /Users/vbauer/Documents/workspace/atari2600/bAtariBasic/bB/bB  
bAtariBASIC v1.1 (c)2005-2017
game
.L00 ;  include div_mul.asm

.L01 ;  set kernel_options no_blank_lines

.L02 ;  set romsize 8kSC

.L03 ;  set smartbranching on

.L04 ;  const pfres = 32

.L05 ;  pfclear

	LDA #0
	STA temp7
	LDA #>(ret_point1-1)
	PHA
	LDA #<(ret_point1-1)
	PHA
	LDA #>(pfclear-1)
	PHA
	LDA #<(pfclear-1)
	PHA
	LDA temp7
	PHA
	TXA
	PHA
	LDX #2
	JMP BS_jsr
ret_point1
.L06 ;  player0x = 10 : player0y = 7

	LDA #10
	STA player0x
	LDA #7
	STA player0y
.L07 ;  player0:

	LDA #<playerL07_0

	STA player0pointerlo
	LDA #>playerL07_0

	STA player0pointerhi
	LDA #7
	STA player0height
.gameloop
 ; gameloop

.L08 ;  COLUP0 = 15

	LDA #15
	STA COLUP0
.L09 ;  COLUPF = 203

	LDA #203
	STA COLUPF
.L010 ;  if joy0left then player0x = player0x - 1 : if player0x < 10 then player0x = 10

	LDA #$40
	BIT SWCHA
	BNE .skipL010
[1]    66304 done                ./preprocess < draw.bas | 
       66305 segmentation fault  ./2600basic -i /Users/vbauer/Documents/workspace/atari2600/bAtariBasic/bB/bB

Maybe, this information will be useful.. Probably I have some problem with "preprocessor" tool, but I'm not sure

@polluks
Copy link

polluks commented Feb 6, 2019

Well, you feed gdb with the output of preprocess, better run preprocess without pipe ./preprocess <draw.bas >draw.asm, start gdb alone run 2600basic <draw.asm and finally backtrace after the exception...
http://sourceware.org/gdb/onlinedocs/gdb/Backtrace.html

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

No branches or pull requests

2 participants