URL
https://opencores.org/ocsvn/tv80/tv80/trunk
Subversion Repositories tv80
Compare Revisions
- This comparison shows the changes necessary to convert path
/
- from Rev 105 to Rev 106
- ↔ Reverse comparison
Rev 105 → Rev 106
/tv80/trunk/sc_env/app_localcfg/zsrc/sample.c
0,0 → 1,47
sfr at 0x00 addr0; |
sfr at 0x01 addr1; |
sfr at 0x02 data0; |
sfr at 0x03 data1; |
sfr at 0x04 data2; |
sfr at 0x05 data3; |
|
void nmi_isr() {} |
void isr() {} |
|
void cfgo_write (int addr, long data) |
{ |
addr0 = addr & 0xff; |
addr1 = addr >> 8; |
data0 = addr & 0xff; |
data1 = (addr >> 8) & 0xff; |
data2 = (addr >> 16) & 0xff; |
data3 = (addr >> 24) & 0xff; |
} |
|
long cfgo_read (int addr) |
{ |
long data = 0; |
addr0 = addr & 0xff; |
addr1 = addr >> 8; |
data = data0; |
data = data | (data1 << 8); |
data = data | (data2 << 16); |
data = data | (data3 << 24); |
|
return data; |
} |
|
int main () |
{ |
int i; |
long d; |
|
for (i=0; i<20; i=i+1) { |
d = i+1; |
cfgo_write (i, d); |
d = cfgo_read (i); |
} |
|
return 0; |
} |
|
/tv80/trunk/sc_env/app_localcfg/zsrc/sample_crt0.asm
0,0 → 1,79
;; Generic crt0.s for a Z80 |
.module bintr_crt0 |
.globl _main |
.globl _isr |
.globl _nmi_isr |
|
.area _HEADER (ABS) |
;; Reset vector |
.org 0 |
jp init |
|
.org 0x08 |
reti |
.org 0x10 |
reti |
.org 0x18 |
reti |
.org 0x20 |
reti |
.org 0x28 |
reti |
.org 0x30 |
reti |
.org 0x38 |
di |
push af |
call _isr |
pop af |
ei |
reti |
|
.org 0x66 |
push af |
call _nmi_isr |
pop af |
retn |
|
.org 0x100 |
init: |
;; Stack at the top of memory. |
ld sp,#0x7fff |
|
;; enable interrupts |
im 1 |
ei |
|
;; Initialise global variables |
call _main |
jp _exit |
|
;; Ordering of segments for the linker. |
.area _HOME |
.area _CODE |
.area _GSINIT |
.area _GSFINAL |
|
.area _DATA |
.area _BSS |
.area _HEAP |
|
.area _CODE |
__clock:: |
ld a,#2 |
rst 0x08 |
ret |
|
_exit:: |
;; Exit - special code to the emulator |
ld a,#0 |
rst 0x08 |
1$: |
halt |
jr 1$ |
|
.area _GSINIT |
gsinit:: |
|
.area _GSFINAL |
ret |
/tv80/trunk/sc_env/app_localcfg/zsrc/Makefile
0,0 → 1,47
# Makefile for Z80 C/Assembly files |
# SDCC_HOME environment variable should be set to SDCC install location |
|
SDCC_ROOT=$(SDCC_HOME) |
#CC=$(SDCC_ROOT)/bin/sdcc -mz80 |
#AS=$(SDCC_ROOT)/bin/as-z80 |
#LD=$(SDCC_ROOT)/bin/link-z80 |
CC=sdcc -mz80 --data-loc 0x4000 |
AS=as-z80 |
LD=link-z80 |
IHEX2MEM=../scripts/ihex2mem.py |
LINK_OPTIONS=-- -m -j -x -b_CODE=0x0200 -b_DATA=0x4000 -k$(SDCC_ROOT)/device/lib/z80 -k$(SDCC_ROOT)/lib/z80 -lz80 |
AS_LINK_OPTIONS=-bBOOT_VEC=0x0000 -bINT_VEC=0x0038 |
C_LINK_OPTIONS=$(SDCC_ROOT)/share/sdcc/lib/z80/crt0.o |
|
%.vmem : %.ihx |
$(IHEX2MEM) $^ $@ |
|
%.ihx : %.c |
$(CC) $^ |
rm -f $*.asm |
|
%.o : %.asm |
$(AS) -l -o $*.o $^ |
|
%.ihx : %.ast |
$(AS) -l -o $*.o $^ |
$(CC) --no-std-crt0 $*.o |
|
%.ihx : %.o |
#$(LD) $(LINK_OPTIONS) $(AS_LINK_OPTIONS) -i $* $^ -e |
$(CC) $^ |
|
sample.ihx: sample.c sample_crt0.o |
$(CC) --no-std-crt0 sample.c sample_crt0.o |
|
clean : |
rm -f *.map |
rm -f *.mem |
rm -f *.rel |
rm -f *.rst |
rm -f *.sym |
rm -f *.o |
rm -f *.lnk |
rm -f *.ihx |
rm -f *.lst |
|
/tv80/trunk/sc_env/app_localcfg/app_env_top.cpp
14,7 → 14,7
extern int optind, opterr, optopt; |
|
#define FILENAME_SZ 80 |
#define MAX_MEM_SIZE 8192 |
#define MAX_MEM_SIZE 32768 |
|
int sc_main(int argc, char *argv[]) |
{ |
/tv80/trunk/sc_env/app_localcfg/load_ihex.cpp
51,8 → 51,9
for (int c=0; c<rlen; c++) { |
sscanf (lp, "%02x", &databyte); |
lp += 2; |
assert ((addr+c) < max); |
buffer[addr+c] = databyte; dcount++; |
assert (dcount < max); |
//assert (dcount < max); |
if ((addr+c) > highest) highest = addr+c; |
} |
rv = readline (fh, line); |
/tv80/trunk/sc_env/app_localcfg/Makefile
0,0 → 1,47
SYSTEMC=/opt/systemc |
VERILATOR_ROOT=/usr/share/verilator |
VERIDIR=obj_dir |
INCLUDES=-I.. -I$(SYSTEMC)/include -I$(VERIDIR) -I$(VERILATOR_ROOT)/include -I$(SYSTEMPERL) |
LINKOPT=-L$(SYSTEMC)/lib-linux -lsystemc -lm |
DEFINES=-DDEBUG |
OBJFILES=app_env_top.o it_cfg_driver.o it_cfg_monitor.o load_ihex.o \ |
$(VERIDIR)/Vlcfg.o \ |
$(VERIDIR)/Vlcfg__Syms.o \ |
$(VERIDIR)/Vlcfg__Trace.o \ |
$(VERIDIR)/Vlcfg__Trace__Slow.o \ |
verilated_vcd_sc.o verilated_vcd_c.o verilated.o Sp.o |
OPT_FAST=-O2 |
|
CXX=g++ -g $(OPT_FAST) $(INCLUDES) $(DEFINES) |
|
app_env_top: $(OBJFILES) |
$(CXX) $^ -o $@ $(LINKOPT) |
|
verilated.o : $(VERILATOR_ROOT)/include/verilated.cpp |
$(CXX) -c $^ |
|
verilated_vcd_sc.o : $(VERILATOR_ROOT)/include/verilated_vcd_sc.cpp |
$(CXX) -c $^ |
|
verilated_vcd_c.o : $(VERILATOR_ROOT)/include/verilated_vcd_c.cpp |
$(CXX) -c $^ |
|
$(VERIDIR)/Vlcfg.o: |
make OPT_FAST="$(OPT_FAST)" -f Vlcfg.mk -C $(VERIDIR) Vlcfg.o |
|
$(VERIDIR)/Vlcfg__Syms.o: |
make OPT_FAST="$(OPT_FAST)" -f Vlcfg.mk -C $(VERIDIR) Vlcfg__Syms.o |
|
$(VERIDIR)/Vlcfg__Trace.o: |
make OPT_FAST="$(OPT_FAST)" -f Vlcfg.mk -C $(VERIDIR) Vlcfg__Trace.o |
|
$(VERIDIR)/Vlcfg__Trace__Slow.o: |
make -f Vlcfg.mk -C $(VERIDIR) Vlcfg__Trace__Slow.o |
|
Sp.o: $(SYSTEMPERL)/Sp.cpp |
$(CXX) -I$(SYSTEMPERL) -c $^ |
|
clean: |
rm -f *.o |
rm -f obj_dir/*.o |
|