build.sh: dialog-powered build frontend
This commit is contained in:
parent
6d2aa0f937
commit
04cc6c467c
3
Rakefile
3
Rakefile
|
@ -10,6 +10,9 @@ $stdout_mutex=Mutex.new
|
|||
|
||||
# Rules
|
||||
# -----------------------------
|
||||
task :all =>[:default] do
|
||||
end
|
||||
|
||||
task :default do
|
||||
thread_print'Entering directory src'
|
||||
thread_print`cd src; rake`
|
||||
|
|
53
build.sh
Executable file
53
build.sh
Executable file
|
@ -0,0 +1,53 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Build/UI options
|
||||
NV=20
|
||||
NH=50
|
||||
TMPFILE=._buildconfig
|
||||
NJOBS=4
|
||||
TARGET="all"
|
||||
JOBSOPT="-j"
|
||||
|
||||
# Check if dialog is found on system
|
||||
if [ $(which dialog > /dev/null) -ne 0 ]; then
|
||||
echo "$0: error: could not find dialog."
|
||||
fi
|
||||
|
||||
# Choose make vs. rake
|
||||
dialog --title "$0" --radiolist "Choose make utility" $NV $NH 10 \
|
||||
make "" on \
|
||||
rake "" off \
|
||||
2>$TMPFILE
|
||||
MAKECMD=$(cat .dialogtmpfile)
|
||||
|
||||
# Choose TARGET
|
||||
dialog --title "$0" --radiolist "Choose target" $NV $NH 10 \
|
||||
all "all" on \
|
||||
clean "clean" off \
|
||||
2>$TMPFILE
|
||||
TARGET=$(cat .dialogtmpfile)
|
||||
|
||||
# Choose multi-threading/jobs options
|
||||
dialog --title "$0" --radiolist "Choose number of jobs/threads" $NV $NH 10 \
|
||||
1 "1 thread (one job at a time)" off \
|
||||
2 "2 threads" off \
|
||||
4 "4 threads" on \
|
||||
8 "8 threads" off \
|
||||
2>$TMPFILE
|
||||
NJOBS=$(cat .dialogtmpfile)
|
||||
|
||||
# Confirm build options
|
||||
dialog --title "$0" --yesno "You chose to build $TARGET with $NJOBS jobs. Is this okay?\n\nPress No to cancel build." $NV $NH
|
||||
YESNO=$?
|
||||
if [ $YESNO -eq 0 ]; then
|
||||
if [ $MAKECMD = "rake" ]; then JOBSOPT=""; NJOBS=""; fi
|
||||
dialog --prgbox "$MAKECMD $TARGET $JOBSOPT $NJOBS" $NV $NH
|
||||
fi
|
||||
|
||||
# Remove temporary file
|
||||
rm -f $TMPFILE
|
||||
|
||||
# 'Clear screen' for niceness
|
||||
for x in {0..7}; do
|
||||
echo ""
|
||||
done
|
|
@ -53,11 +53,13 @@ int main(int argc,char**argv)
|
|||
refresh();
|
||||
}
|
||||
|
||||
puts("verifying ROM");
|
||||
// Verify ROM is loaded
|
||||
if(rom->rom)
|
||||
cpu->pc=PRGROM;
|
||||
else
|
||||
puterr("%s: No ROM loaded\n",__func__);
|
||||
puts("ROM verified");
|
||||
|
||||
// Render -----
|
||||
while(true)
|
||||
|
|
|
@ -25,6 +25,9 @@ $stdout_mutex=Mutex.new
|
|||
# Rules
|
||||
# -----------------------------
|
||||
|
||||
task :all => [:default] do
|
||||
end
|
||||
|
||||
task :default => [:_65db, :_65da, :_fes, :test] do
|
||||
|
||||
end
|
||||
|
|
32
src/rom.c
32
src/rom.c
|
@ -102,38 +102,12 @@ void rom_map(rom_t*rom,ram_t*ram,size_t offset)
|
|||
return;
|
||||
}
|
||||
|
||||
// ! TODO: The memmove below needs to copy all of the data in
|
||||
// ! ROM into RAM. It should stop when it reaches $FFFF or
|
||||
// ! all the ROM has been copied.
|
||||
// ! NOTE: Apparently we are loading from the $8000 offset of the
|
||||
// ! FILE ITSELF. That's not what we want.
|
||||
|
||||
uint32_t len;//=(0xffff>rom->data_len)?(0xffff-0x8000):(rom->data_len);
|
||||
if(0xffff-0x8000>rom->data_len)len=0x7fff;
|
||||
else if(rom->data_len>0xffff)len=0xffff;
|
||||
else len=rom->data_len;
|
||||
|
||||
//printf("copying %d (%04X) bytes from ROM into RAM\n",
|
||||
//len,len);
|
||||
//printf("data_len: %d (%04X)\n",rom->data_len,rom->data_len);
|
||||
//printf("$7fff>data_len?: %s\n",(0xffff>rom->data_len)?"yes":"no");
|
||||
//memmove(ram->ram,rom->rom,len);
|
||||
|
||||
// Copy rom data into ram memory
|
||||
// Put NES file header parsing here <---
|
||||
//printw("copying %u bytes into RAM from ROM\n",rom->data_len);
|
||||
|
||||
// NOTE: Substitution of copying entire data_len with copying
|
||||
// a smaller 'chunk' at a time was necessary on ArchLinux to prevent
|
||||
// SIGSEGV crashing the program
|
||||
|
||||
const size_t DATA_CHUNK=2048;
|
||||
// mov RAM, ROM * 2048
|
||||
//printf("%s: rom length: '%d'\n",__func__,rom->data_len);
|
||||
for(size_t len=rom->data_len;len>0;len-=(len>DATA_CHUNK)?DATA_CHUNK:len)
|
||||
//printf("memmove ram, rom ($%04X/$%04X)\n",rom->data_len-len,rom->data_len),
|
||||
memmove(ram->ram+offset,rom->rom,(len>DATA_CHUNK)?DATA_CHUNK:len);
|
||||
//memmove(ram->ram,rom->rom,rom->data_len);
|
||||
#define min(x,y) ((x<y)?(x):(y))
|
||||
memmove( ram->ram+offset, rom->rom, min(0x8000,rom->data_len));
|
||||
#undef min
|
||||
}
|
||||
|
||||
// Free memory allocated to ROM object
|
||||
|
|
Loading…
Reference in New Issue
Block a user