1
0

uploadToBDOS.sh 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/bin/bash
  2. # script for compiling a C program for BDOS, and upload it to the FPGC over the network, whithout running it
  3. if [ "$1" == "" ]
  4. then
  5. echo "No program to compile given"
  6. exit 1
  7. fi
  8. OUTFILE="file.out"
  9. if [ "$2" != "" ]
  10. then
  11. OUTFILE=$2
  12. fi
  13. echo "Processing: $1"
  14. # compile and upload
  15. echo "Compiling C code to B32P ASM"
  16. if (./bcc --bdos $1 ../Assembler/code.asm) # compile c code with BDOS flag and write compiled code to code.asm in Assembler folder
  17. then
  18. echo "C code successfully compiled"
  19. echo "Assembling B32P ASM code"
  20. if (cd ../Assembler && python3 Assembler.py bdos 0x400000 -O > ../Programmer/code.list) # assemble with offset for BDOS and write to code.list in Programmer folder
  21. then
  22. echo "B32P ASM code successfully assembled"
  23. # convert list to binary files and upload to FPGC
  24. (cd ../Programmer && bash compileROM.sh noPadding && cp code.bin $OUTFILE && echo "Uploading $OUTFILE to FPGC over Network" && python3 netUpload.py $OUTFILE && rm $OUTFILE)
  25. else # assemble failed, run again to show error
  26. echo "Failed to assemble B32P ASM code"
  27. cd ../Assembler && python3 Assembler.py bdos 0x400000 -O
  28. fi
  29. else # compile failed
  30. echo "Failed to compile C code"
  31. fi