cleaned, updated build process

This commit is contained in:
cr0sd 2020-02-29 13:53:54 -06:00
parent 3c9e616178
commit 1ed3bc458d
5 changed files with 58 additions and 25 deletions

View File

@ -3,11 +3,11 @@ require'./inc.rb'
# Variables
# -----------------------------
$AS65 = 'xa'
$CC = 'cc'
$CFLAGS = '-Wfatal-errors'
$AS65 = 'xa'
$CC = 'cc'
$CFLAGS = '-Wfatal-errors'
$LDFLAGS = '-lncurses'
$OBJS = '65.o cpu.o ram.o rom.o disasm.o'
$OBJS = '65.o cpu.o ram.o rom.o disasm.o'
$stdout_mutex=Mutex.new

49
inc.rb
View File

@ -1,5 +1,8 @@
# Basic Rakefile functionality include file
require'fileutils'
require'pathname'
# Functions
# -----------------------------
# Remove file extension
@ -53,16 +56,56 @@ def c_o(x)
end
end
# Rule for .c65 to .nes
def c65_nes(x)
# Get base filename
y="#{Dir.getwd}/#{get_name(x)}"
# Run command if needed
if !FileUtils.uptodate?('#{y}.o',['#{y}.c65'])
thread_print"CC65\t#{y}.o"
`#{$CC65} #{y}.c65`
`#{$CCAS65} -b 0-10000 -o #{y}.o65 #{y}.s`
`#{$CAT} ines_header #{y}.o65 > #{y}.nes`
`#{$RM} #{y}.o65 #{y}.s`
else
thread_print"nothing to be done for #{x}"
end
end
# Test if file exists
def file_exists(x)
x="#{Dir.getwd}/#{x}"
begin
#puts"looking for \"#{x}\""
if Pathname.new(x).exist?
#puts"found file #{x}"
return true
end
rescue
#puts"error finding file #{x}"
end
#puts"error finding file #{x}"
return false
end
# Internal make method to allow
# multi-threaded builds
def thread_make(x)
case get_ext(x)
when 'o'
c_o(x)
when 'nes'
when 'o'
c_o(x)
when 'nes'
if file_exists("#{get_name(x)}.c65")
c65_nes(x)
elsif file_exists("#{get_name(x)}.a65")
a65_nes(x)
else
thread_print"No rule to make target \"#{x}\""
end
else
thread_print"No rule to make target \"#{x}\""
end
end

View File

@ -5,6 +5,7 @@ require'../inc.rb'
# -----------------------------
$AS65 = 'xa'
$CC = 'cc'
#$OBJS = 'nes.nes asciitest.nes asl.nes ctest.nes'
$OBJS = 'nes.nes asciitest.nes asl.nes'
$stdout_mutex=Mutex.new

View File

@ -6,5 +6,7 @@ int getone(void)
void main(void)
{
int m=getone();
int x=0;
if(getone())
x=5;
}

View File

@ -1,32 +1,19 @@
.byt "NES",0
.word 0,0,0,0,0,0
reg=$0102
.text
*=$8000
main:
ldx #$ff
txs
ldx #0
;jsr function
bne function
lda #$04
loo:
jsr function
cmp #9
lda #0
jmp *
.byt "string",0
function:
lda #$e1
jmp loo
;rts
rts