├── sdcc ├── .version ├── bin │ └── .placeholder ├── doc │ ├── holder.pdf │ ├── sdccman.html │ │ ├── next_motif.gif │ │ ├── up_motif.gif │ │ ├── index_motif.gif │ │ ├── up_motif_gr.gif │ │ ├── contents_motif.gif │ │ ├── next_motif_gr.gif │ │ ├── previous_motif.gif │ │ ├── previous_motif_gr.gif │ │ └── WARNINGS │ ├── test_suite_spec.html │ │ ├── WARNINGS │ │ ├── up_motif_gr.gif │ │ ├── previous_motif_gr.gif │ │ └── next_group_motif_gr.gif │ ├── z80 │ │ ├── README │ │ └── Makefile │ ├── KNOWNBUGS.txt │ ├── clean.mk │ ├── bccinst.txt │ └── Makefile ├── support │ ├── cpp2 │ │ ├── options.h │ │ ├── specs.h │ │ ├── libiberty.h │ │ ├── config.h │ │ ├── version.h │ │ ├── version.c │ │ ├── intl.c │ │ ├── borland.h │ │ ├── sdcc.h │ │ ├── Makefile.bcc │ │ └── clean.mk │ ├── regression │ │ ├── ports │ │ │ ├── mcs51 │ │ │ │ ├── uCsim.cmd │ │ │ │ ├── timeout.c │ │ │ │ └── support.c │ │ │ ├── z80 │ │ │ │ └── support.asm │ │ │ ├── gbz80 │ │ │ │ ├── support.asm │ │ │ │ └── spec.mk │ │ │ └── host │ │ │ │ ├── support.c │ │ │ │ └── spec.mk │ │ ├── tests │ │ │ ├── constmodifiers.c │ │ │ ├── bug-448984.c │ │ │ ├── bug-469671.c │ │ │ ├── longor.c │ │ │ ├── increment.c │ │ │ ├── longlit.c │ │ │ ├── bug-435068.c │ │ │ ├── bug-223113.c │ │ │ ├── packcast.c │ │ │ ├── bug-221168.c │ │ │ ├── scott-while.c │ │ │ ├── bug-408972.c │ │ │ ├── pow2shifts.c │ │ │ ├── uminus.c │ │ │ ├── bug-460010.c │ │ │ ├── stacks.c │ │ │ ├── bug-227710.c │ │ │ ├── bug-441448.c │ │ │ ├── scott-for.c │ │ │ ├── structidx.c │ │ │ ├── scott-b.c │ │ │ ├── bug-221100.c │ │ │ ├── fetchoverlap.c │ │ │ ├── bug-477927.c │ │ │ ├── bug-460000.c │ │ │ ├── bug-426632.c │ │ │ ├── scott-pointer1.c │ │ │ ├── funptrs.c │ │ │ ├── bug-221220.c │ │ │ └── scott-call1.c │ │ ├── FAILURES │ │ ├── failing │ │ │ └── bug-435214.c │ │ ├── fwk │ │ │ └── include │ │ │ │ └── testfwk.h │ │ └── collate-results.py │ ├── tests │ │ ├── internal │ │ │ ├── stubs.c │ │ │ └── Makefile │ │ └── dhrystone │ │ │ ├── tini.mak │ │ │ └── Makefile │ ├── README │ ├── makebin │ │ ├── Makefile │ │ └── clean.mk │ └── scripts │ │ └── Makefile.snapshot ├── sim │ ├── ucsim │ │ ├── .version │ │ ├── conf │ │ ├── s51.src │ │ │ ├── debugger │ │ │ ├── start1 │ │ │ ├── start2 │ │ │ ├── monitor1-2 │ │ │ ├── monitor2-1 │ │ │ ├── test_stack.c │ │ │ ├── conf.mk │ │ │ ├── test_extit.c │ │ │ ├── lst2ls │ │ │ ├── test_idlepd.c │ │ │ └── clean.mk │ │ ├── doc │ │ │ ├── cpu.gif │ │ │ ├── new.gif │ │ │ ├── UCsim.jpg │ │ │ ├── burst.gif │ │ │ ├── post.jpg │ │ │ ├── wins.gif │ │ │ ├── index.html │ │ │ ├── serial1.gif │ │ │ ├── serial2.gif │ │ │ ├── timers.gif │ │ │ ├── interrupt.gif │ │ │ ├── term_cpuopt.gif │ │ │ ├── conf.mk │ │ │ ├── wins.html │ │ │ ├── timers.html │ │ │ ├── clean.mk │ │ │ ├── interrupt.html │ │ │ └── obsolete.html │ │ ├── z80.src │ │ │ ├── instcl.h │ │ │ ├── conf.mk │ │ │ └── clean.mk │ │ ├── INSTALL │ │ ├── avr.src │ │ │ ├── test_call.asm │ │ │ ├── instcl.h │ │ │ ├── conf.mk │ │ │ ├── logic_cl.h │ │ │ ├── jump_cl.h │ │ │ ├── bit_cl.h │ │ │ ├── test_jmp.asm │ │ │ ├── clean.mk │ │ │ └── info_1111.txt │ │ ├── sim.src │ │ │ ├── conf.mk │ │ │ └── clean.mk │ │ ├── gui.src │ │ │ ├── conf.mk │ │ │ ├── serio.src │ │ │ │ ├── conf.mk │ │ │ │ ├── USAGE │ │ │ │ ├── config.h │ │ │ │ ├── fileio.hh │ │ │ │ ├── posix_signal.hh │ │ │ │ └── clean.mk │ │ │ └── obsolete │ │ │ │ └── portmon.src │ │ │ │ ├── conf.mk │ │ │ │ └── clean.mk │ │ ├── cmd.src │ │ │ ├── conf.mk │ │ │ └── clean.mk │ │ ├── conf.mk │ │ ├── TODO │ │ └── clean.mk │ └── README ├── device │ ├── lib │ │ ├── incl.mk │ │ ├── ds390 │ │ │ ├── examples │ │ │ │ └── MOVED │ │ │ └── Makefile │ │ ├── libint.lib │ │ ├── gbz80 │ │ │ ├── README │ │ │ ├── putchar.s │ │ │ ├── Makefile │ │ │ └── string.c │ │ ├── mcs51 │ │ │ └── README │ │ ├── liblong.lib │ │ ├── _sint2fs.c │ │ ├── _schar2fs.c │ │ ├── _uint2fs.c │ │ ├── _uchar2fs.c │ │ ├── _slong2fs.c │ │ ├── z80 │ │ │ ├── README │ │ │ ├── putchar.s │ │ │ ├── Makefile │ │ │ └── string.c │ │ ├── _fs2uint.c │ │ ├── _fs2uchar.c │ │ ├── conf.mk │ │ ├── assert.c │ │ ├── _fs2sint.c │ │ ├── libfloat.lib │ │ ├── _fs2schar.c │ │ ├── _fs2slong.c │ │ ├── libsdcc.lib │ │ └── gets.c │ ├── examples │ │ ├── mcs51 │ │ │ ├── simple │ │ │ │ ├── go │ │ │ │ ├── test.bat │ │ │ │ ├── test │ │ │ │ └── go.bat │ │ │ ├── simple2 │ │ │ │ ├── go │ │ │ │ ├── test.bat │ │ │ │ ├── test │ │ │ │ └── go.bat │ │ │ ├── clock │ │ │ │ ├── hw.h │ │ │ │ ├── Makefile │ │ │ │ └── clock.c │ │ │ └── asmblink │ │ │ │ ├── blink_lnk │ │ │ │ ├── go_dos.bat │ │ │ │ └── Makefile │ │ ├── ds390 │ │ │ ├── ow390 │ │ │ │ ├── temp10.h │ │ │ │ ├── cnt1d.h │ │ │ │ └── swt12.h │ │ │ ├── i2c390 │ │ │ │ ├── ds1621.h │ │ │ │ ├── pcf8591.h │ │ │ │ ├── i2c390.c │ │ │ │ ├── Makefile │ │ │ │ └── pcf8591.c │ │ │ ├── hello390 │ │ │ │ ├── hello390.c │ │ │ │ └── Makefile │ │ │ ├── readmac │ │ │ │ ├── crcutil.h │ │ │ │ ├── Makefile │ │ │ │ └── ow.h │ │ │ ├── Makefile │ │ │ ├── test390 │ │ │ │ └── Makefile │ │ │ ├── rtc390 │ │ │ │ └── Makefile │ │ │ └── clock390 │ │ │ │ └── Makefile │ │ ├── test2.c │ │ ├── crc.c │ │ ├── crcs.c │ │ ├── startupcode │ │ │ ├── c.bat │ │ │ ├── inc │ │ │ │ └── startup_code.h │ │ │ └── src │ │ │ │ ├── startup_code.c │ │ │ │ ├── makefile.dep │ │ │ │ └── makefile │ │ ├── serialcomm │ │ │ └── windows │ │ │ │ ├── serial.h │ │ │ │ └── test_serialcomm.cpp │ │ └── clean.mk │ ├── include │ │ ├── z80 │ │ │ ├── README │ │ │ ├── stdio.h │ │ │ ├── types.h │ │ │ └── string.h │ │ ├── mcs51 │ │ │ └── README │ │ ├── serial390.h │ │ ├── asm │ │ │ ├── default │ │ │ │ └── features.h │ │ │ ├── gbz80 │ │ │ │ └── features.h │ │ │ └── z80 │ │ │ │ └── features.h │ │ ├── conf.mk │ │ ├── sdcc-lib.h │ │ ├── serial.h │ │ └── clean.mk │ └── README ├── as │ ├── mcs51 │ │ ├── .cvsignore │ │ ├── alloc.h │ │ ├── conf.mk │ │ ├── i51ext.c │ │ └── clean.mk │ ├── clean.mk │ ├── README │ ├── z80 │ │ ├── incld1.asm │ │ ├── incld2.asm │ │ ├── incld3.asm │ │ ├── incld4.asm │ │ ├── incld5.asm │ │ ├── alloc.h │ │ ├── string.h │ │ ├── z80ext.c │ │ ├── conf.mk │ │ └── clean.mk │ └── Makefile ├── debugger │ └── mcs51 │ │ ├── .cvsignore │ │ ├── conf.mk │ │ └── clean.mk ├── README ├── src │ ├── avr │ │ ├── Makefile │ │ ├── main.h │ │ └── Makefile.bcc │ ├── izt │ │ ├── Makefile │ │ ├── util.c │ │ ├── Makefile.bcc │ │ ├── izt.h │ │ ├── gen.h │ │ └── aop.h │ ├── pic │ │ ├── Makefile │ │ ├── main.h │ │ └── Makefile.bcc │ ├── z80 │ │ ├── Makefile │ │ ├── peeph-z80.def │ │ ├── support.h │ │ ├── z80.h │ │ ├── Makefile.bcc │ │ ├── peeph-gbz80.def │ │ └── support.c │ ├── ds390 │ │ ├── Makefile │ │ ├── main.h │ │ └── Makefile.bcc │ ├── mcs51 │ │ ├── Makefile │ │ ├── main.h │ │ └── Makefile.bcc │ ├── .cvsignore │ ├── port-clean.mk │ ├── conf.mk │ ├── README │ ├── SDCCpeeph.awk │ ├── regression │ │ ├── create_stc │ │ ├── rt.sh │ │ ├── simulate │ │ ├── while.c │ │ ├── xor.c │ │ └── b.c │ ├── spawn.h │ ├── common.h │ ├── SDCCalloc.h │ └── asm.h ├── link │ ├── clean.mk │ ├── README │ ├── Makefile │ └── z80 │ │ ├── clean.mk │ │ └── conf.mk ├── packihx │ ├── clean.mk │ ├── config_in.h │ ├── config.h │ ├── Makefile.bcc │ └── config.log ├── tinitalk │ ├── Makefile │ ├── Makefile.bcc │ ├── tinitalk.h │ └── tinitalk.dsw ├── Bcc.inc ├── conf.mk ├── clean.mk ├── Makefile.bcc └── sdccconf_in.h ├── gbdk-lib ├── include │ ├── consolez80 │ │ └── README │ ├── stdio.h │ ├── asm │ │ ├── z80 │ │ │ ├── provides.h │ │ │ ├── types.h │ │ │ └── stdarg.h │ │ └── gbz80 │ │ │ ├── provides.h │ │ │ ├── stdarg.h │ │ │ └── types.h │ ├── libc.dox │ ├── gb │ │ ├── gb.dox │ │ ├── sgb.h │ │ ├── sample.h │ │ └── console.h │ ├── stdarg.h │ ├── Makefile │ ├── ctype.h │ ├── types.h │ └── time.h ├── examples │ └── gb │ │ ├── gb-dtmf │ │ ├── make.bat │ │ ├── brk_btn.gbr │ │ ├── cursor.gbr │ │ ├── dtmf_lcd.gbr │ │ ├── frm_lcd.gbr │ │ ├── key_num.gbr │ │ ├── prs_btn.gbr │ │ └── Makefile │ │ ├── bank_0.c │ │ ├── dscan │ │ ├── bkg.gbr │ │ ├── bkg_c.gbm │ │ ├── bkg_m.gbm │ │ ├── fore.gbr │ │ ├── make.bat │ │ └── Makefile │ │ ├── colorbar │ │ ├── bar_c.gbr │ │ ├── bar_m.gbm │ │ ├── make.bat │ │ ├── bar_m.h │ │ └── Makefile │ │ ├── banked │ │ ├── bank3.c │ │ ├── bank.h │ │ ├── main.c │ │ ├── bank2.c │ │ └── Makefile │ │ ├── bank_1.c │ │ ├── bank_2.c │ │ └── bank_3.c ├── libc │ ├── gb │ │ ├── digits.c │ │ ├── wait_hbl.mh │ │ ├── gprint.c │ │ ├── mv_win.s │ │ ├── mv_bkg.s │ │ ├── stubs.rasm │ │ ├── scroll_b.s │ │ ├── scroll_w.s │ │ ├── gprintn.c │ │ ├── gprintln.c │ │ ├── get_bk_t.s │ │ ├── set_bk_t.s │ │ ├── get_wi_t.s │ │ ├── set_wi_t.s │ │ ├── get_spr.s │ │ ├── get_prop.s │ │ ├── set_spr.s │ │ ├── set_prop.s │ │ ├── mv_spr.s │ │ ├── hiramcpy.s │ │ ├── scroll_s.s │ │ ├── cpy_data.s │ │ ├── serial.s │ │ ├── init_tt.s │ │ └── Makefile │ ├── tolower.c │ ├── toupper.c │ ├── puts.c │ ├── isdigit.c │ ├── islower.c │ ├── isupper.c │ ├── abs.c │ ├── isspace.c │ ├── labs.c │ ├── isalpha.c │ ├── consolez80 │ │ ├── putchar.s │ │ ├── Makefile │ │ └── crt0.s │ ├── Makefile.platform │ ├── strlen.c │ ├── rrgb │ │ ├── Makefile │ │ ├── putchar.s │ │ └── crt0.s │ ├── asm │ │ ├── z80 │ │ │ └── Makefile │ │ ├── Makefile.port │ │ └── gbz80 │ │ │ └── Makefile │ ├── rules-asxxxx.mk │ ├── calloc.c │ ├── reverse.c │ ├── strcat.c │ ├── strncmp.c │ ├── time.c │ ├── itoa.c │ ├── ltoa.c │ ├── strncpy.c │ ├── strncat.c │ ├── atol.c │ ├── atoi.c │ ├── Makefile.rules │ ├── rules-rgbds.mk │ └── string.c ├── Makefile ├── ChangeLog └── Makefile.common ├── gbdk-support └── lcc │ └── Makefile ├── maccer └── test-1.ms └── .github └── workflows └── c-cpp.yml /sdcc/.version: -------------------------------------------------------------------------------- 1 | 2.3.1 2 | -------------------------------------------------------------------------------- /sdcc/bin/.placeholder: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /sdcc/doc/holder.pdf: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /sdcc/support/cpp2/options.h: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /sdcc/support/cpp2/specs.h: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /gbdk-lib/include/consolez80/README: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /sdcc/sim/ucsim/.version: -------------------------------------------------------------------------------- 1 | 0.3.2-pre1 2 | -------------------------------------------------------------------------------- /sdcc/support/cpp2/libiberty.h: -------------------------------------------------------------------------------- 1 | /* nada */ 2 | -------------------------------------------------------------------------------- /sdcc/device/lib/incl.mk: -------------------------------------------------------------------------------- 1 | MODELS = small large 2 | -------------------------------------------------------------------------------- /sdcc/as/mcs51/.cvsignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | Makefile.dep 3 | -------------------------------------------------------------------------------- /sdcc/debugger/mcs51/.cvsignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | Makefile.dep 3 | -------------------------------------------------------------------------------- /sdcc/sim/ucsim/conf: -------------------------------------------------------------------------------- 1 | ./configure --prefix=${HOME}/local "$@" 2 | -------------------------------------------------------------------------------- /sdcc/sim/ucsim/s51.src/debugger: -------------------------------------------------------------------------------- 1 | sdcdb -s /dev/ttyp1 "$@" 2 | -------------------------------------------------------------------------------- /sdcc/README: -------------------------------------------------------------------------------- 1 | This file is depreciated. Please see doc/README.txt. 2 | -------------------------------------------------------------------------------- /sdcc/device/examples/mcs51/simple/go: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | sdcc hi.c 3 | 4 | -------------------------------------------------------------------------------- /sdcc/device/examples/mcs51/simple2/go: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | sdcc hi.c 3 | 4 | -------------------------------------------------------------------------------- /sdcc/device/examples/mcs51/simple2/test.bat: -------------------------------------------------------------------------------- 1 | s51 -k 5678 hi.ihx 2 | 3 | 4 | -------------------------------------------------------------------------------- /sdcc/src/avr/Makefile: -------------------------------------------------------------------------------- 1 | # Make all in this directory 2 | include ../port.mk 3 | -------------------------------------------------------------------------------- /sdcc/src/izt/Makefile: -------------------------------------------------------------------------------- 1 | # Make all in this directory 2 | include ../port.mk 3 | -------------------------------------------------------------------------------- /sdcc/src/pic/Makefile: -------------------------------------------------------------------------------- 1 | # Make all in this directory 2 | include ../port.mk 3 | -------------------------------------------------------------------------------- /sdcc/src/z80/Makefile: -------------------------------------------------------------------------------- 1 | # Make all in this directory 2 | include ../port.mk 3 | -------------------------------------------------------------------------------- /sdcc/support/cpp2/config.h: -------------------------------------------------------------------------------- 1 | #include "auto-host.h" 2 | #include "sdcc.h" 3 | -------------------------------------------------------------------------------- /sdcc/device/include/z80/README: -------------------------------------------------------------------------------- 1 | sdcc/device/lib/z80 2 | --------------------- 3 | -------------------------------------------------------------------------------- /sdcc/src/ds390/Makefile: -------------------------------------------------------------------------------- 1 | # Make all in this directory 2 | include ../port.mk 3 | -------------------------------------------------------------------------------- /sdcc/src/mcs51/Makefile: -------------------------------------------------------------------------------- 1 | # Make all in this directory 2 | include ../port.mk 3 | -------------------------------------------------------------------------------- /sdcc/as/mcs51/alloc.h: -------------------------------------------------------------------------------- 1 | /* alloc.h */ 2 | /* DECUS C */ 3 | 4 | #include 5 | -------------------------------------------------------------------------------- /sdcc/device/examples/mcs51/simple/test.bat: -------------------------------------------------------------------------------- 1 | s51 -Sout=serial.txt hi.ihx 2 | 3 | 4 | -------------------------------------------------------------------------------- /sdcc/device/examples/mcs51/simple2/test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | s51 -k 5678 hi.ihx 4 | 5 | -------------------------------------------------------------------------------- /sdcc/device/include/mcs51/README: -------------------------------------------------------------------------------- 1 | sdcc/device/lib/mcs51 2 | --------------------- 3 | -------------------------------------------------------------------------------- /sdcc/support/regression/ports/mcs51/uCsim.cmd: -------------------------------------------------------------------------------- 1 | break xram r 0x7654 2 | run 3 | quit 4 | -------------------------------------------------------------------------------- /gbdk-lib/examples/gb/gb-dtmf/make.bat: -------------------------------------------------------------------------------- 1 | ..\..\bin\lcc -Wa-l -Wl-m -o gb-dtmf.gb gb-dtmf.c 2 | -------------------------------------------------------------------------------- /sdcc/device/lib/ds390/examples/MOVED: -------------------------------------------------------------------------------- 1 | Moved and unpacked to sdcc/device/examples/ds390 2 | -------------------------------------------------------------------------------- /sdcc/device/lib/libint.lib: -------------------------------------------------------------------------------- 1 | _divsint 2 | _divuint 3 | _modsint 4 | _moduint 5 | _mulint 6 | -------------------------------------------------------------------------------- /sdcc/link/clean.mk: -------------------------------------------------------------------------------- 1 | clean: 2 | $(MAKE) -C z80 -f clean.mk clean 3 | 4 | distclean: clean 5 | -------------------------------------------------------------------------------- /gbdk-lib/include/stdio.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gheja/gbdk/HEAD/gbdk-lib/include/stdio.h -------------------------------------------------------------------------------- /sdcc/device/examples/ds390/ow390/temp10.h: -------------------------------------------------------------------------------- 1 | extern int ReadTemperature(int, uchar *, float *); 2 | -------------------------------------------------------------------------------- /sdcc/sim/ucsim/doc/cpu.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gheja/gbdk/HEAD/sdcc/sim/ucsim/doc/cpu.gif -------------------------------------------------------------------------------- /sdcc/sim/ucsim/doc/new.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gheja/gbdk/HEAD/sdcc/sim/ucsim/doc/new.gif -------------------------------------------------------------------------------- /gbdk-lib/examples/gb/bank_0.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int var_0; /* In external RAM bank 0 */ 4 | -------------------------------------------------------------------------------- /sdcc/device/examples/test2.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gheja/gbdk/HEAD/sdcc/device/examples/test2.c -------------------------------------------------------------------------------- /sdcc/sim/README: -------------------------------------------------------------------------------- 1 | sdcc/simulator 2 | -------------- 3 | 4 | I have no idea :) 5 | 6 | -- Michael 7 | -------------------------------------------------------------------------------- /sdcc/sim/ucsim/doc/UCsim.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gheja/gbdk/HEAD/sdcc/sim/ucsim/doc/UCsim.jpg -------------------------------------------------------------------------------- /sdcc/sim/ucsim/doc/burst.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gheja/gbdk/HEAD/sdcc/sim/ucsim/doc/burst.gif -------------------------------------------------------------------------------- /sdcc/sim/ucsim/doc/post.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gheja/gbdk/HEAD/sdcc/sim/ucsim/doc/post.jpg -------------------------------------------------------------------------------- /sdcc/sim/ucsim/doc/wins.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gheja/gbdk/HEAD/sdcc/sim/ucsim/doc/wins.gif -------------------------------------------------------------------------------- /gbdk-lib/include/asm/z80/provides.h: -------------------------------------------------------------------------------- 1 | #undef USE_C_MEMCPY 2 | #undef USE_C_STRCPY 3 | #undef USE_C_STRCMP 4 | -------------------------------------------------------------------------------- /gbdk-lib/libc/gb/digits.c: -------------------------------------------------------------------------------- 1 | #pragma bank=BASE 2 | 3 | const char * const digits = "0123456789ABCDEF"; 4 | -------------------------------------------------------------------------------- /gbdk-lib/libc/gb/wait_hbl.mh: -------------------------------------------------------------------------------- 1 | WAIT_HBL MACRO 2 | ldh a,(.STAT) 3 | bit 1,a 4 | jr nz,#.-4 5 | ENDM 6 | -------------------------------------------------------------------------------- /sdcc/device/lib/gbz80/README: -------------------------------------------------------------------------------- 1 | sdcc/device/lib/z80 2 | ------------------- 3 | 4 | Z80 specific routines. 5 | -------------------------------------------------------------------------------- /sdcc/sim/ucsim/doc/index.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gheja/gbdk/HEAD/sdcc/sim/ucsim/doc/index.html -------------------------------------------------------------------------------- /sdcc/sim/ucsim/doc/serial1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gheja/gbdk/HEAD/sdcc/sim/ucsim/doc/serial1.gif -------------------------------------------------------------------------------- /sdcc/sim/ucsim/doc/serial2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gheja/gbdk/HEAD/sdcc/sim/ucsim/doc/serial2.gif -------------------------------------------------------------------------------- /sdcc/sim/ucsim/doc/timers.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gheja/gbdk/HEAD/sdcc/sim/ucsim/doc/timers.gif -------------------------------------------------------------------------------- /sdcc/sim/ucsim/s51.src/start1: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | s51 -Sin=tee_1,out=1_tee "$@" 4 | 5 | # End of start1 6 | -------------------------------------------------------------------------------- /sdcc/sim/ucsim/s51.src/start2: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | s51 -Sin=tee_2,out=2_tee "$@" 4 | 5 | # End of start2 6 | -------------------------------------------------------------------------------- /sdcc/src/.cvsignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | Makefile.dep 3 | SDCCy.c 4 | SDCCy.h 5 | SDCCy.output 6 | SDCClex.c 7 | -------------------------------------------------------------------------------- /sdcc/device/lib/mcs51/README: -------------------------------------------------------------------------------- 1 | sdcc/device/lib/mcs51 2 | ------------------- 3 | 4 | mcs51 specific routines. 5 | -------------------------------------------------------------------------------- /sdcc/sim/ucsim/doc/interrupt.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gheja/gbdk/HEAD/sdcc/sim/ucsim/doc/interrupt.gif -------------------------------------------------------------------------------- /gbdk-lib/examples/gb/dscan/bkg.gbr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gheja/gbdk/HEAD/gbdk-lib/examples/gb/dscan/bkg.gbr -------------------------------------------------------------------------------- /gbdk-lib/examples/gb/dscan/bkg_c.gbm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gheja/gbdk/HEAD/gbdk-lib/examples/gb/dscan/bkg_c.gbm -------------------------------------------------------------------------------- /gbdk-lib/examples/gb/dscan/bkg_m.gbm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gheja/gbdk/HEAD/gbdk-lib/examples/gb/dscan/bkg_m.gbm -------------------------------------------------------------------------------- /gbdk-lib/examples/gb/dscan/fore.gbr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gheja/gbdk/HEAD/gbdk-lib/examples/gb/dscan/fore.gbr -------------------------------------------------------------------------------- /sdcc/device/examples/ds390/i2c390/ds1621.h: -------------------------------------------------------------------------------- 1 | #define DS1621_ID 0x90 2 | 3 | extern float ReadDS1621(char address); 4 | -------------------------------------------------------------------------------- /sdcc/device/examples/ds390/ow390/cnt1d.h: -------------------------------------------------------------------------------- 1 | extern int ReadCounter(int, uchar *SerialNum, int, unsigned long *); 2 | -------------------------------------------------------------------------------- /sdcc/device/lib/liblong.lib: -------------------------------------------------------------------------------- 1 | _divslong.rel 2 | _divulong.rel 3 | _modslong.rel 4 | _modulong.rel 5 | _mullong.rel 6 | -------------------------------------------------------------------------------- /sdcc/doc/sdccman.html/next_motif.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gheja/gbdk/HEAD/sdcc/doc/sdccman.html/next_motif.gif -------------------------------------------------------------------------------- /sdcc/doc/sdccman.html/up_motif.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gheja/gbdk/HEAD/sdcc/doc/sdccman.html/up_motif.gif -------------------------------------------------------------------------------- /sdcc/sim/ucsim/doc/term_cpuopt.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gheja/gbdk/HEAD/sdcc/sim/ucsim/doc/term_cpuopt.gif -------------------------------------------------------------------------------- /sdcc/sim/ucsim/s51.src/monitor1-2: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cat 1_tee|tee /dev/tty >tee_2 4 | 5 | # End of monitor1-2 6 | -------------------------------------------------------------------------------- /sdcc/sim/ucsim/s51.src/monitor2-1: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cat 2_tee|tee /dev/tty >tee_1 4 | 5 | # End of monitor2-1 6 | -------------------------------------------------------------------------------- /gbdk-lib/include/asm/gbz80/provides.h: -------------------------------------------------------------------------------- 1 | #define USE_C_MEMCPY 1 2 | #define USE_C_STRCPY 1 3 | #define USE_C_STRCMP 1 4 | 5 | -------------------------------------------------------------------------------- /sdcc/doc/sdccman.html/index_motif.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gheja/gbdk/HEAD/sdcc/doc/sdccman.html/index_motif.gif -------------------------------------------------------------------------------- /sdcc/doc/sdccman.html/up_motif_gr.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gheja/gbdk/HEAD/sdcc/doc/sdccman.html/up_motif_gr.gif -------------------------------------------------------------------------------- /gbdk-lib/examples/gb/colorbar/bar_c.gbr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gheja/gbdk/HEAD/gbdk-lib/examples/gb/colorbar/bar_c.gbr -------------------------------------------------------------------------------- /gbdk-lib/examples/gb/colorbar/bar_m.gbm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gheja/gbdk/HEAD/gbdk-lib/examples/gb/colorbar/bar_m.gbm -------------------------------------------------------------------------------- /gbdk-lib/examples/gb/gb-dtmf/brk_btn.gbr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gheja/gbdk/HEAD/gbdk-lib/examples/gb/gb-dtmf/brk_btn.gbr -------------------------------------------------------------------------------- /gbdk-lib/examples/gb/gb-dtmf/cursor.gbr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gheja/gbdk/HEAD/gbdk-lib/examples/gb/gb-dtmf/cursor.gbr -------------------------------------------------------------------------------- /gbdk-lib/examples/gb/gb-dtmf/dtmf_lcd.gbr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gheja/gbdk/HEAD/gbdk-lib/examples/gb/gb-dtmf/dtmf_lcd.gbr -------------------------------------------------------------------------------- /gbdk-lib/examples/gb/gb-dtmf/frm_lcd.gbr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gheja/gbdk/HEAD/gbdk-lib/examples/gb/gb-dtmf/frm_lcd.gbr -------------------------------------------------------------------------------- /gbdk-lib/examples/gb/gb-dtmf/key_num.gbr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gheja/gbdk/HEAD/gbdk-lib/examples/gb/gb-dtmf/key_num.gbr -------------------------------------------------------------------------------- /gbdk-lib/examples/gb/gb-dtmf/prs_btn.gbr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gheja/gbdk/HEAD/gbdk-lib/examples/gb/gb-dtmf/prs_btn.gbr -------------------------------------------------------------------------------- /sdcc/doc/sdccman.html/contents_motif.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gheja/gbdk/HEAD/sdcc/doc/sdccman.html/contents_motif.gif -------------------------------------------------------------------------------- /sdcc/doc/sdccman.html/next_motif_gr.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gheja/gbdk/HEAD/sdcc/doc/sdccman.html/next_motif_gr.gif -------------------------------------------------------------------------------- /sdcc/doc/sdccman.html/previous_motif.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gheja/gbdk/HEAD/sdcc/doc/sdccman.html/previous_motif.gif -------------------------------------------------------------------------------- /sdcc/as/clean.mk: -------------------------------------------------------------------------------- 1 | clean: 2 | $(MAKE) -C z80 -f clean.mk clean 3 | 4 | distclean: 5 | $(MAKE) -C z80 -f clean.mk distclean 6 | 7 | -------------------------------------------------------------------------------- /sdcc/doc/sdccman.html/previous_motif_gr.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gheja/gbdk/HEAD/sdcc/doc/sdccman.html/previous_motif_gr.gif -------------------------------------------------------------------------------- /sdcc/doc/test_suite_spec.html/WARNINGS: -------------------------------------------------------------------------------- 1 | No implementation found for style `fontenc' 2 | No implementation found for style `url' 3 | -------------------------------------------------------------------------------- /gbdk-lib/Makefile: -------------------------------------------------------------------------------- 1 | # Top level Makefile 2 | 3 | all: 4 | make -C libc 5 | 6 | clean: 7 | rm -rf build *~ 8 | make -C libc clean 9 | -------------------------------------------------------------------------------- /sdcc/device/include/z80/stdio.h: -------------------------------------------------------------------------------- 1 | /** Dumb stdio.h 2 | Z80 temp hack. 3 | */ 4 | 5 | void printf(const char *szFormat, ...); 6 | 7 | -------------------------------------------------------------------------------- /sdcc/doc/test_suite_spec.html/up_motif_gr.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gheja/gbdk/HEAD/sdcc/doc/test_suite_spec.html/up_motif_gr.gif -------------------------------------------------------------------------------- /sdcc/sim/ucsim/s51.src/test_stack.c: -------------------------------------------------------------------------------- 1 | void jaj(void) 2 | { 3 | jaj(); 4 | } 5 | 6 | void main(void) 7 | { 8 | jaj(); 9 | } 10 | -------------------------------------------------------------------------------- /sdcc/sim/ucsim/z80.src/instcl.h: -------------------------------------------------------------------------------- 1 | /* avr.src/instcl.h */ 2 | 3 | virtual int nop(t_mem code); 4 | 5 | /* End of avr.src/instcl.h */ 6 | -------------------------------------------------------------------------------- /sdcc/src/port-clean.mk: -------------------------------------------------------------------------------- 1 | clean: 2 | rm -f $(LIB) *.o *~ port.a *.lst *.asm *.sym *~ *.cdb *.dep *.rul 3 | 4 | distclean: clean 5 | 6 | -------------------------------------------------------------------------------- /sdcc/support/regression/ports/mcs51/timeout.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gheja/gbdk/HEAD/sdcc/support/regression/ports/mcs51/timeout.c -------------------------------------------------------------------------------- /gbdk-lib/examples/gb/dscan/make.bat: -------------------------------------------------------------------------------- 1 | ..\..\bin\lcc -Wa-l -c -o dscan.o dscan.c 2 | ..\..\bin\lcc -Wl-m -Wl-yp0x143=0x80 -o dscan.gb dscan.o 3 | -------------------------------------------------------------------------------- /gbdk-lib/libc/tolower.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | char tolower(char c) 4 | { 5 | return ((c >= 'A' && c <= 'Z') ? c + 32: c); 6 | } 7 | -------------------------------------------------------------------------------- /gbdk-lib/libc/toupper.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | char toupper(char c) 4 | { 5 | return ((c >= 'a' && c <= 'z') ? c - 32: c); 6 | } 7 | -------------------------------------------------------------------------------- /sdcc/device/examples/ds390/i2c390/pcf8591.h: -------------------------------------------------------------------------------- 1 | #define PCF8591_ID 0x90 2 | 3 | extern unsigned char ReadPCF8591(char address, char channel); 4 | -------------------------------------------------------------------------------- /gbdk-lib/libc/gb/gprint.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void gprint(char *str) NONBANKED 4 | { 5 | while(*str) 6 | wrtchr(*str++); 7 | } 8 | -------------------------------------------------------------------------------- /sdcc/doc/test_suite_spec.html/previous_motif_gr.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gheja/gbdk/HEAD/sdcc/doc/test_suite_spec.html/previous_motif_gr.gif -------------------------------------------------------------------------------- /sdcc/as/README: -------------------------------------------------------------------------------- 1 | sdcc/as 2 | ------- 3 | 4 | Both the z80 and mcs51 assemblers are derrived from the same tree. One 5 | day they may be re-combined. 6 | -------------------------------------------------------------------------------- /sdcc/doc/test_suite_spec.html/next_group_motif_gr.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gheja/gbdk/HEAD/sdcc/doc/test_suite_spec.html/next_group_motif_gr.gif -------------------------------------------------------------------------------- /gbdk-lib/examples/gb/banked/bank3.c: -------------------------------------------------------------------------------- 1 | #include "bank.h" 2 | #pragma bank=3 3 | 4 | void bank3(void) BANKED 5 | { 6 | puts(" In bank 3!"); 7 | } 8 | 9 | -------------------------------------------------------------------------------- /gbdk-lib/examples/gb/colorbar/make.bat: -------------------------------------------------------------------------------- 1 | ..\..\bin\lcc -Wa-l -c -o colorbar.o colorbar.c 2 | ..\..\bin\lcc -Wl-m -Wl-yp0x143=0x80 -o colorbar.gb colorbar.o 3 | -------------------------------------------------------------------------------- /sdcc/device/examples/ds390/hello390/hello390.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void main (void) { 4 | printf ("\nHello from 390.\nSee you, bye..."); 5 | } 6 | -------------------------------------------------------------------------------- /sdcc/sim/ucsim/INSTALL: -------------------------------------------------------------------------------- 1 | uCsim 2 | Microcontroller simulator 3 | 4 | 5 | See HTML documents in doc subdirectory for instructions how to install 6 | uCsim. 7 | -------------------------------------------------------------------------------- /sdcc/support/cpp2/version.h: -------------------------------------------------------------------------------- 1 | #ifndef GCC_VERSION_H 2 | #define GCC_VERSION_H 3 | extern const char *const version_string; 4 | #endif /* ! GCC_VERSION_H */ 5 | -------------------------------------------------------------------------------- /sdcc/support/tests/internal/stubs.c: -------------------------------------------------------------------------------- 1 | int fatalError; 2 | int lineno; 3 | char *filename = "tests"; 4 | char buffer[4096]; 5 | char scratchFileName[4096]; 6 | -------------------------------------------------------------------------------- /gbdk-lib/libc/puts.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void puts(const char *s) NONBANKED 4 | { 5 | while (*s) 6 | putchar(*s++); 7 | putchar('\n'); 8 | } 9 | -------------------------------------------------------------------------------- /sdcc/device/README: -------------------------------------------------------------------------------- 1 | sdcc/device 2 | ----------- 3 | 4 | This directory contains all device only files i.e. a basic C library, 5 | headers, and set of examples. 6 | -------------------------------------------------------------------------------- /sdcc/device/lib/_sint2fs.c: -------------------------------------------------------------------------------- 1 | /* convert signed int to float */ 2 | float __sint2fs (signed int si) { 3 | signed long sl=si; 4 | return __slong2fs(sl); 5 | } 6 | -------------------------------------------------------------------------------- /sdcc/support/README: -------------------------------------------------------------------------------- 1 | sdcc/support 2 | ------------ 3 | 4 | This directory contains support programs and libraries that may 5 | not be provided by your system. 6 | -------------------------------------------------------------------------------- /sdcc/support/cpp2/version.c: -------------------------------------------------------------------------------- 1 | #include "ansidecl.h" 2 | #include "version.h" 3 | 4 | const char *const version_string = "3.1 20010625 (experimental) + SDCC"; 5 | -------------------------------------------------------------------------------- /gbdk-lib/include/libc.dox: -------------------------------------------------------------------------------- 1 | PROJECT_NAME = "gbdk-lib" 2 | OUTPUT_DIRECTORY = "../doc/libc" 3 | RECURSIVE = yes 4 | INPUT = . 5 | PREDEFINED = "NONBANKED= BANKED=" 6 | -------------------------------------------------------------------------------- /sdcc/device/lib/_schar2fs.c: -------------------------------------------------------------------------------- 1 | /* convert signed char to float */ 2 | float __schar2fs (signed char sc) { 3 | signed long sl=sc; 4 | return __slong2fs(sl); 5 | } 6 | -------------------------------------------------------------------------------- /sdcc/device/lib/_uint2fs.c: -------------------------------------------------------------------------------- 1 | /* convert unsigned int to float */ 2 | float __uint2fs (unsigned int ui) { 3 | unsigned long ul=ui; 4 | return __ulong2fs(ul); 5 | } 6 | -------------------------------------------------------------------------------- /sdcc/doc/z80/README: -------------------------------------------------------------------------------- 1 | For more information on the z80 port, see: 2 | 3 | http://earthling.net.nz/michaelh/ 4 | 5 | -- Michael Hope 6 | michaelh@earthling.net 7 | -------------------------------------------------------------------------------- /sdcc/device/lib/_uchar2fs.c: -------------------------------------------------------------------------------- 1 | /* convert unsigned char to float */ 2 | float __uchar2fs (unsigned char uc) { 3 | unsigned long ul=uc; 4 | return __ulong2fs(ul); 5 | } 6 | -------------------------------------------------------------------------------- /gbdk-lib/include/gb/gb.dox: -------------------------------------------------------------------------------- 1 | PROJECT_NAME = "gbdk" 2 | OUTPUT_DIRECTORY = "html" 3 | INPUT = gb.h cgb.h console.h drawing.h font.h hardware.h \ 4 | malloc.h sample.h sgb.h 5 | -------------------------------------------------------------------------------- /gbdk-lib/libc/isdigit.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | BOOLEAN isdigit(char c) 4 | { 5 | if(c >= '0' && c <= '9') 6 | return 1; 7 | else 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /gbdk-lib/libc/islower.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | BOOLEAN islower(char c) 4 | { 5 | if(c >= 'a' && c <= 'z') 6 | return 1; 7 | else 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /gbdk-lib/libc/isupper.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | BOOLEAN isupper(char c) 4 | { 5 | if(c >= 'A' && c <= 'Z') 6 | return 1; 7 | else 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /sdcc/packihx/clean.mk: -------------------------------------------------------------------------------- 1 | clean: 2 | rm -f *core *[%~] *.[oa] *.output 3 | rm -f .[a-z]*~ \#* 4 | rm -f packihx 5 | 6 | distclean realclean: clean 7 | rm -f config.* Makefile 8 | -------------------------------------------------------------------------------- /gbdk-lib/libc/abs.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int abs(int num) 5 | { 6 | if(num < 0) 7 | return -num; 8 | else 9 | return num; 10 | } 11 | -------------------------------------------------------------------------------- /sdcc/tinitalk/Makefile: -------------------------------------------------------------------------------- 1 | CFLAGS=-Wall -g 2 | 3 | tinitalk: tinitalk.c tinitalk.h 4 | cc -o $@ $(CFLAGS) $< 5 | cp $@ /usr/local/bin 6 | 7 | clean: 8 | rm -f core *~ *.o tinitalk \#* 9 | -------------------------------------------------------------------------------- /gbdk-lib/libc/isspace.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | BOOLEAN isspace(char c) 4 | { 5 | if(c == ' ' || c == '\t' || c == '\n') 6 | return 1; 7 | else 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /gbdk-lib/libc/labs.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | long labs(long num) 5 | { 6 | if(num < 0) 7 | return -num; 8 | else 9 | return num; 10 | } 11 | -------------------------------------------------------------------------------- /sdcc/support/cpp2/intl.c: -------------------------------------------------------------------------------- 1 | /* intl.c - internationalization */ 2 | 3 | #include "auto-host.h" 4 | #include "ansidecl.h" 5 | #include "intl.h" 6 | 7 | const char localedir[] = LOCALEDIR; 8 | -------------------------------------------------------------------------------- /sdcc/as/z80/incld1.asm: -------------------------------------------------------------------------------- 1 | xxx ;1 2 | .include "incld2.asm" ;2 3 | ;3 4 | ;4 5 | ;5 6 | xxx ;6 7 | ;7 8 | ;8 9 | ;9 10 | ;10 11 | -------------------------------------------------------------------------------- /sdcc/as/z80/incld2.asm: -------------------------------------------------------------------------------- 1 | ;1 2 | xxx ;2 3 | .include "incld3.asm" ;3 4 | ;4 5 | ;5 6 | ;6 7 | xxx ;7 8 | ;8 9 | ;9 10 | ;10 11 | -------------------------------------------------------------------------------- /sdcc/as/z80/incld3.asm: -------------------------------------------------------------------------------- 1 | ;1 2 | ;2 3 | xxx ;3 4 | .include "incld4.asm" ;4 5 | ;5 6 | ;6 7 | ;7 8 | xxx ;8 9 | ;9 10 | ;10 11 | -------------------------------------------------------------------------------- /sdcc/as/z80/incld4.asm: -------------------------------------------------------------------------------- 1 | ;1 2 | ;2 3 | ;3 4 | xxx ;4 5 | .include "incld5.asm" ;5 6 | ;6 7 | ;7 8 | ;8 9 | xxx ;9 10 | ;10 11 | -------------------------------------------------------------------------------- /sdcc/as/z80/incld5.asm: -------------------------------------------------------------------------------- 1 | ;1 2 | ;2 3 | ;3 4 | ;4 5 | xxx ;5 6 | .include "incldx.asm" ;6 7 | ;7 8 | ;8 9 | ;9 10 | xxx ;10 11 | -------------------------------------------------------------------------------- /sdcc/device/examples/mcs51/clock/hw.h: -------------------------------------------------------------------------------- 1 | #define OSCILLATOR 11059200 2 | #define BAUD 19200 3 | 4 | void ClockIrqHandler (void) interrupt 1 using 3; 5 | unsigned long ClockTicks(void); 6 | 7 | -------------------------------------------------------------------------------- /gbdk-lib/examples/gb/banked/bank.h: -------------------------------------------------------------------------------- 1 | #ifndef BANK_INCLUDE 2 | #define BANK_INCLUDE 3 | 4 | #include 5 | 6 | int bank2(int i) BANKED; 7 | void bank3(void) BANKED; 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /sdcc/device/include/serial390.h: -------------------------------------------------------------------------------- 1 | #ifndef SERIAL390_H 2 | #define SERIAL390_H 3 | 4 | #warning "Please use instead of " 5 | #include 6 | 7 | #endif SERIAL390_H 8 | -------------------------------------------------------------------------------- /sdcc/doc/KNOWNBUGS.txt: -------------------------------------------------------------------------------- 1 | SDCC known bugs 2 | --------------- 3 | $Id: KNOWNBUGS.txt,v 1.3 2001/09/19 18:32:39 michaelh Exp $ 4 | 5 | ds390 port: 6 | * The linker does not yet supports segments >64k. 7 | -------------------------------------------------------------------------------- /gbdk-lib/libc/isalpha.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | BOOLEAN isalpha(char c) 4 | { 5 | if((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) 6 | return 1; 7 | else 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /sdcc/device/lib/_slong2fs.c: -------------------------------------------------------------------------------- 1 | /* convert signed long to float */ 2 | float __slong2fs (signed long sl) { 3 | if (sl<0) 4 | return -__ulong2fs(-sl); 5 | else 6 | return __ulong2fs(sl); 7 | } 8 | -------------------------------------------------------------------------------- /sdcc/device/examples/mcs51/asmblink/blink_lnk: -------------------------------------------------------------------------------- 1 | -muxi 2 | -z 3 | -b CODE = 0x00000 4 | -b DSEG = 0x0030 5 | -b XSEG = 0x160000 6 | -b ISEG = 0x0080 7 | -b BSEG = 0x0000 8 | blink 9 | -e 10 | 11 | 12 | -------------------------------------------------------------------------------- /sdcc/device/examples/mcs51/asmblink/go_dos.bat: -------------------------------------------------------------------------------- 1 | rem DOS CVS access does not like .lnk files, so this is workaround. 2 | copy blink_lnk blink.lnk 3 | asx8051.exe -los blink.asm 4 | aslink -f blink.lnk 5 | 6 | 7 | -------------------------------------------------------------------------------- /sdcc/src/avr/main.h: -------------------------------------------------------------------------------- 1 | #ifndef MAIN_INCLUDE 2 | #define MAIN_INCLUDE 3 | 4 | bool x_parseOptions (char **argv, int *pargc); 5 | void x_setDefaultOptions (void); 6 | void x_finaliseOptions (void); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /sdcc/src/pic/main.h: -------------------------------------------------------------------------------- 1 | #ifndef MAIN_INCLUDE 2 | #define MAIN_INCLUDE 3 | 4 | bool x_parseOptions (char **argv, int *pargc); 5 | void x_setDefaultOptions (void); 6 | void x_finaliseOptions (void); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /gbdk-lib/libc/consolez80/putchar.s: -------------------------------------------------------------------------------- 1 | .area _CODE 2 | _putchar:: 3 | push ix 4 | ld ix,#0 5 | add ix,sp 6 | 7 | ld l,4(ix) 8 | ld a,#0 9 | out (0xff),a 10 | 11 | pop ix 12 | ret 13 | 14 | 15 | -------------------------------------------------------------------------------- /sdcc/src/ds390/main.h: -------------------------------------------------------------------------------- 1 | #ifndef MAIN_INCLUDE 2 | #define MAIN_INCLUDE 3 | 4 | bool x_parseOptions (char **argv, int *pargc); 5 | void x_setDefaultOptions (void); 6 | void x_finaliseOptions (void); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /sdcc/src/mcs51/main.h: -------------------------------------------------------------------------------- 1 | #ifndef MAIN_INCLUDE 2 | #define MAIN_INCLUDE 3 | 4 | bool x_parseOptions (char **argv, int *pargc); 5 | void x_setDefaultOptions (void); 6 | void x_finaliseOptions (void); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /sdcc/as/z80/alloc.h: -------------------------------------------------------------------------------- 1 | /* alloc.h */ 2 | /* DECUS C */ 3 | 4 | #ifndef SDK 5 | //extern char *alloc(); 6 | //extern char *malloc(); 7 | //extern char *calloc(); 8 | //extern char *realloc(); 9 | #endif 10 | 11 | -------------------------------------------------------------------------------- /sdcc/link/README: -------------------------------------------------------------------------------- 1 | sdcc/link 2 | --------- 3 | 4 | In gbdk the linker and assembler were split into seperate packages. 5 | 6 | For now I'm keeping that split, and leaving the mcs51 version as is. 7 | 8 | -- Michael 9 | -------------------------------------------------------------------------------- /gbdk-lib/examples/gb/bank_1.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int var_1; /* In external RAM bank 1 */ 5 | 6 | void bank_1() NONBANKED /* In ROM bank 1 */ 7 | { 8 | puts("I'm in ROM bank 1"); 9 | } 10 | -------------------------------------------------------------------------------- /gbdk-lib/examples/gb/bank_2.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int var_2; /* In external RAM bank 2 */ 5 | 6 | void bank_2() NONBANKED /* In ROM bank 2 */ 7 | { 8 | puts("I'm in ROM bank 2"); 9 | } 10 | -------------------------------------------------------------------------------- /gbdk-lib/examples/gb/bank_3.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int var_3; /* In external RAM bank 3 */ 5 | 6 | void bank_3() NONBANKED /* In ROM bank 3 */ 7 | { 8 | puts("I'm in ROM bank 3"); 9 | } 10 | -------------------------------------------------------------------------------- /gbdk-lib/libc/Makefile.platform: -------------------------------------------------------------------------------- 1 | # Shared Makefile for all the platforms. 2 | # Provides a way of building the lib with little brains. 3 | 4 | all: platform 5 | 6 | platform: $(LIB) 7 | 8 | include $(TOPDIR)/libc/Makefile.rules 9 | -------------------------------------------------------------------------------- /sdcc/device/lib/z80/README: -------------------------------------------------------------------------------- 1 | sdcc/device/lib/z80 2 | ------------------- 3 | 4 | Z80 specific routines. 5 | 6 | Notes: 7 | * Cost of ld r,(ix+n): 19 8 | * Cost of ld r,(hl); inc hl: 7+6 = 13 and you don't have to pop ix 9 | -------------------------------------------------------------------------------- /sdcc/support/regression/ports/z80/support.asm: -------------------------------------------------------------------------------- 1 | .area _CODE 2 | .globl _putchar 3 | .globl _exit 4 | 5 | __putchar:: 6 | jp _putchar 7 | 8 | __exitEmu:: 9 | jp _exit 10 | -------------------------------------------------------------------------------- /gbdk-lib/examples/gb/banked/main.c: -------------------------------------------------------------------------------- 1 | #include "bank.h" 2 | 3 | int main(void) 4 | { 5 | puts("Testing 1,2,3..."); 6 | puts("Calling bank2()"); 7 | bank2(3); 8 | puts("Back to main()"); 9 | return 0; 10 | } 11 | -------------------------------------------------------------------------------- /sdcc/Bcc.inc: -------------------------------------------------------------------------------- 1 | #Generic rules and options for building with Borland C++ 2 | 3 | SLIB = $(PRJDIR)/support/Util 4 | 5 | OFLAGS = -6 -O2 -g0 -w-proto 6 | 7 | .c.obj: 8 | BCC32 -c -o$@ $(OFLAGS) $(CFLAGS) $(CPPFLAGS) -I$(SLIB) $< 9 | -------------------------------------------------------------------------------- /sdcc/device/include/z80/types.h: -------------------------------------------------------------------------------- 1 | /** Silly types.h 2 | Z80 specific hack 3 | */ 4 | 5 | #ifndef TYPES_INCLUDE 6 | #define TYPES_INCLUDE 7 | 8 | typedef unsigned char BYTE; 9 | typedef unsigned WORD; 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /sdcc/support/regression/ports/gbz80/support.asm: -------------------------------------------------------------------------------- 1 | .area _CODE 2 | .globl _putchar 3 | .globl _exit 4 | 5 | __putchar:: 6 | jp _putchar 7 | 8 | __exitEmu:: 9 | jp _exit 10 | -------------------------------------------------------------------------------- /gbdk-lib/ChangeLog: -------------------------------------------------------------------------------- 1 | 2001-11-03 Michael Hope 2 | 3 | * examples/gb/gb-dtmf/gb-dtmf.c (main): Changed printf to %u as the arg was a int. 4 | 5 | * examples/gb/ram_fn.c (print_counter): Made ANSI compliant. 6 | 7 | -------------------------------------------------------------------------------- /gbdk-lib/libc/strlen.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /* Return length of string */ 4 | 5 | int strlen(const char *s) NONBANKED 6 | { 7 | int i; 8 | 9 | i = 0; 10 | while(*s++) 11 | i++; 12 | return i; 13 | } 14 | -------------------------------------------------------------------------------- /sdcc/sim/ucsim/avr.src/test_call.asm: -------------------------------------------------------------------------------- 1 | nop 2 | ldi r16,$ff 3 | out $3d,r16 4 | ldi r16,$01 5 | out $3e,r16 6 | nop 7 | call sub1 8 | nop 9 | 10 | sub1: nop 11 | ret 12 | 13 | copyright: 14 | .db "(c) 2000 talker Bt." 15 | -------------------------------------------------------------------------------- /gbdk-lib/libc/gb/mv_win.s: -------------------------------------------------------------------------------- 1 | .include "global.s" 2 | 3 | ;; BANKED: checked 4 | .area _BASE 5 | 6 | _move_win:: 7 | LDA HL,2(SP) ; Skip return address 8 | LD A,(HL+) 9 | LDH (.WX),A 10 | LD A,(HL+) 11 | LDH (.WY),A 12 | RET 13 | -------------------------------------------------------------------------------- /gbdk-lib/libc/rrgb/Makefile: -------------------------------------------------------------------------------- 1 | # GB specific Makefile 2 | 3 | TOPDIR = ../.. 4 | 5 | include $(TOPDIR)/Makefile.common 6 | 7 | THIS = rrgb 8 | OBJ = crt0.o putchar.o 9 | AS = $(AS_GBZ80) 10 | 11 | include ../Makefile.platform 12 | 13 | -------------------------------------------------------------------------------- /sdcc/sim/ucsim/avr.src/instcl.h: -------------------------------------------------------------------------------- 1 | /* avr.src/instcl.h */ 2 | 3 | virtual int nop(t_mem code); 4 | virtual int sleep(t_mem code); 5 | virtual int wdr(t_mem code); 6 | virtual int ser_Rd(t_mem code); 7 | 8 | /* End of avr.src/instcl.h */ 9 | -------------------------------------------------------------------------------- /sdcc/device/include/asm/default/features.h: -------------------------------------------------------------------------------- 1 | /** Z80 specific features. 2 | */ 3 | #ifndef __SDC51_ASM_Z80_FEATURES_H 4 | #define __SDC51_ASM_Z80_FEATURES_H 1 5 | 6 | #define _REENTRANT reentrant 7 | #define _CODE code 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /sdcc/device/lib/_fs2uint.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /* convert float to unsigned int */ 4 | unsigned int __fs2uint (float f) { 5 | unsigned long ul=__fs2ulong(f); 6 | if (ul>=UINT_MAX) return UINT_MAX; 7 | return ul; 8 | } 9 | 10 | -------------------------------------------------------------------------------- /sdcc/src/conf.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile targets to remake configuration 3 | # 4 | 5 | freshconf: Makefile 6 | 7 | Makefile: $(srcdir)/Makefile.in $(PRJDIR)/configure.in 8 | cd $(PRJDIR) && $(SHELL) ./config.status 9 | 10 | # End of conf.mk 11 | -------------------------------------------------------------------------------- /sdcc/support/regression/ports/host/support.c: -------------------------------------------------------------------------------- 1 | /** Host specific support routines. 2 | */ 3 | #include 4 | 5 | void _putchar(char c) 6 | { 7 | putchar(c); 8 | } 9 | 10 | void _exitEmu(void) 11 | { 12 | exit(0); 13 | } 14 | -------------------------------------------------------------------------------- /gbdk-lib/examples/gb/banked/bank2.c: -------------------------------------------------------------------------------- 1 | #include "bank.h" 2 | #pragma bank=2 3 | 4 | 5 | int bank2(int i) BANKED 6 | { 7 | int j; 8 | puts(" In bank 2"); 9 | for (j=0; j>1)) + val; 8 | 9 | return (byte)tmp + ((byte) (tmp>>8) & 1); 10 | } 11 | -------------------------------------------------------------------------------- /sdcc/device/lib/_fs2uchar.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /* convert float to unsigned char */ 4 | unsigned char __fs2uchar (float f) { 5 | unsigned long ul=__fs2ulong(f); 6 | if (ul>=UCHAR_MAX) return UCHAR_MAX; 7 | return ul; 8 | } 9 | 10 | -------------------------------------------------------------------------------- /sdcc/device/lib/conf.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile targets to remake configuration 3 | # 4 | 5 | freshconf: Makefile 6 | 7 | Makefile: $(srcdir)/Makefile.in $(PRJDIR)/configure.in 8 | cd $(PRJDIR) && $(SHELL) ./config.status 9 | 10 | # End of conf.mk 11 | -------------------------------------------------------------------------------- /sdcc/support/regression/tests/constmodifiers.c: -------------------------------------------------------------------------------- 1 | /* Tests usage of constant modifiers. 2 | */ 3 | #include 4 | 5 | void 6 | testUMod(void) 7 | { 8 | volatile unsigned char a = 0; 9 | 10 | ASSERT((a |= 0xFFL) == 0xFFL); 11 | } 12 | -------------------------------------------------------------------------------- /gbdk-lib/libc/asm/Makefile.port: -------------------------------------------------------------------------------- 1 | # Shared Makefile for all the ports. 2 | # Provides a way of building the lib with little brains. 3 | 4 | LIB_APPEND = 1 5 | 6 | all: port 7 | 8 | include $(TOPDIR)/libc/Makefile.rules 9 | 10 | port: $(LIB) 11 | 12 | -------------------------------------------------------------------------------- /gbdk-lib/libc/gb/stubs.rasm: -------------------------------------------------------------------------------- 1 | GLOBAL STACK 2 | GLOBAL OAM 3 | GLOBAL refresh_OAM 4 | 5 | SECTION "stubs_1", BSS[$C000] 6 | OAM: 7 | DS $A0 8 | SECTION "stubs_2", HRAM[$FF80] 9 | refresh_OAM: 10 | SECTION "stubs_4", BSS[$E000] 11 | STACK: 12 | -------------------------------------------------------------------------------- /sdcc/debugger/mcs51/conf.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile targets to remake configuration 3 | # 4 | 5 | freshconf: Makefile 6 | 7 | Makefile: $(srcdir)/Makefile.in $(PRJDIR)/configure.in 8 | cd $(PRJDIR) && $(SHELL) ./config.status 9 | 10 | # End of conf.mk 11 | -------------------------------------------------------------------------------- /sdcc/device/include/conf.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile targets to remake configuration 3 | # 4 | 5 | freshconf: Makefile 6 | 7 | Makefile: $(srcdir)/Makefile.in $(PRJDIR)/configure.in 8 | cd $(PRJDIR) && $(SHELL) ./config.status 9 | 10 | # End of conf.mk 11 | -------------------------------------------------------------------------------- /sdcc/sim/ucsim/doc/conf.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile targets to remake configuration 3 | # 4 | 5 | freshconf: Makefile 6 | 7 | Makefile: $(srcdir)/Makefile.in $(PRJDIR)/configure.in 8 | cd $(PRJDIR) && $(SHELL) ./config.status 9 | 10 | # End of conf.mk 11 | -------------------------------------------------------------------------------- /gbdk-lib/include/gb/sgb.h: -------------------------------------------------------------------------------- 1 | /** @file gb/sgb.h 2 | Super Gameboy definitions. 3 | */ 4 | #ifndef _SGB_H 5 | #define _SGB_H 6 | 7 | /** Return a non-null value if running on Super GameBoy */ 8 | UINT8 9 | sgb_check(void); 10 | 11 | #endif /* _SGB_H */ 12 | -------------------------------------------------------------------------------- /gbdk-lib/libc/consolez80/Makefile: -------------------------------------------------------------------------------- 1 | # ConsoleZ80 specific Makefile 2 | 3 | TOPDIR = ../.. 4 | 5 | include $(TOPDIR)/Makefile.common 6 | 7 | THIS = consolez80 8 | OBJ = crt0.o putchar.o 9 | AS = $(AS_Z80) 10 | 11 | include ../Makefile.platform 12 | 13 | -------------------------------------------------------------------------------- /sdcc/device/examples/mcs51/simple/test: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Try out the simulator. Route serial port output to a text file. 4 | # After simulator is started, you need to type: 5 | # run 6 | # stop 7 | # quit 8 | 9 | s51 -Sout=serial.txt hi.ihx 10 | 11 | -------------------------------------------------------------------------------- /sdcc/sim/ucsim/sim.src/conf.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile targets to remake configuration 3 | # 4 | 5 | freshconf: Makefile 6 | 7 | Makefile: $(srcdir)/Makefile.in $(PRJDIR)/configure.in 8 | cd $(PRJDIR) && $(SHELL) ./config.status 9 | 10 | # End of conf.mk 11 | -------------------------------------------------------------------------------- /sdcc/sim/ucsim/z80.src/conf.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile targets to remake configuration 3 | # 4 | 5 | freshconf: Makefile 6 | 7 | Makefile: $(srcdir)/Makefile.in $(PRJDIR)/configure.in 8 | cd $(PRJDIR) && $(SHELL) ./config.status 9 | 10 | # End of z80.src/conf.mk 11 | -------------------------------------------------------------------------------- /gbdk-lib/include/stdarg.h: -------------------------------------------------------------------------------- 1 | #ifndef STDARG_INCLUDE 2 | #define STDARG_INCLUDE 3 | 4 | #if SDCC_PORT==gbz80 5 | #include 6 | #elif SDCC_PORT==z80 7 | #include 8 | #else 9 | #error Unrecognised port. 10 | #endif 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /gbdk-lib/libc/rules-asxxxx.mk: -------------------------------------------------------------------------------- 1 | $(LIB): pre $(OBJ) 2 | cd $(BUILD); ls *.o > `basename $(LIB)` 3 | 4 | pre: set-model build-dir 5 | 6 | $(BUILD)/%.o: %.c 7 | $(CC) $(CFLAGS) -c $< 8 | mv `basename $< .c`.o $@ 9 | 10 | $(BUILD)/%.o: %.s 11 | $(AS) -plosgff $@ $< 12 | -------------------------------------------------------------------------------- /sdcc/device/examples/crcs.c: -------------------------------------------------------------------------------- 1 | #include <8051.h> 2 | typedef unsigned char byte; 3 | 4 | byte accum_checksum(byte cs, byte val) 5 | { 6 | register unsigned char tmp; 7 | 8 | tmp = ((cs<<1) | (cs>>7)) + val; 9 | 10 | return (CY ? ( tmp + 1 ) : tmp); 11 | } 12 | -------------------------------------------------------------------------------- /sdcc/device/lib/assert.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void _assert(char *expr, const char *filename, unsigned int linenumber) 5 | { 6 | printf("Assert(%s) failed at line %u in file %s.\n", 7 | expr, linenumber, filename); 8 | while(1); 9 | } 10 | -------------------------------------------------------------------------------- /sdcc/support/regression/FAILURES: -------------------------------------------------------------------------------- 1 | ASSERT(result == (char)((char)-1560000000 << 1)); 2 | 3 | Complains: 4 | gen/z80/shifts/shifts_attr_volatile_storage_none_type_char_vals_-1560000000.c(61):warning *** constant is out of range compare operation 5 | 6 | despite the cast. 7 | 8 | -------------------------------------------------------------------------------- /sdcc/device/examples/ds390/readmac/crcutil.h: -------------------------------------------------------------------------------- 1 | #ifndef CRCUTIL_H_ 2 | #define CRCUTIL_H_ 3 | 4 | #ifdef WANT_CRC_16 5 | unsigned int docrc16(unsigned int oldCrc, unsigned int byte); 6 | #endif 7 | 8 | unsigned char docrc8(unsigned char oldCrc, unsigned char x); 9 | #endif 10 | -------------------------------------------------------------------------------- /sdcc/support/regression/ports/mcs51/support.c: -------------------------------------------------------------------------------- 1 | // #define MICROCONTROLLER_8051 2 | #include 3 | 4 | void 5 | _putchar (char c) 6 | { 7 | SBUF = c; 8 | } 9 | 10 | void 11 | _exitEmu (void) 12 | { 13 | * (char idata *) 0 = * (char xdata *) 0x7654; 14 | } 15 | -------------------------------------------------------------------------------- /gbdk-lib/libc/asm/gbz80/Makefile: -------------------------------------------------------------------------------- 1 | # gbz80 specific Makefile 2 | 3 | TOPDIR = ../../.. 4 | 5 | THIS = gbz80 6 | ASSRC = mul.s div.s shift.s stubs.s crt0_rle.s 7 | 8 | include $(TOPDIR)/Makefile.common 9 | 10 | AS = $(AS_GBZ80) 11 | 12 | include ../Makefile.port 13 | 14 | 15 | -------------------------------------------------------------------------------- /sdcc/device/lib/_fs2sint.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /* convert float to signed int */ 4 | signed int __fs2sint (float f) { 5 | signed long sl=__fs2slong(f); 6 | if (sl>=INT_MAX) 7 | return INT_MAX; 8 | if (sl<=INT_MIN) 9 | return -INT_MIN; 10 | return sl; 11 | } 12 | -------------------------------------------------------------------------------- /sdcc/device/lib/libfloat.lib: -------------------------------------------------------------------------------- 1 | _fsadd 2 | _fsdiv 3 | _fseq 4 | _fsgt 5 | _fslt 6 | _fsmul 7 | _fsneq 8 | _fssub 9 | _uchar2fs 10 | _uint2fs 11 | _ulong2fs 12 | _schar2fs 13 | _sint2fs 14 | _slong2fs 15 | _fs2uchar 16 | _fs2uint 17 | _fs2ulong 18 | _fs2schar 19 | _fs2sint 20 | _fs2slong 21 | -------------------------------------------------------------------------------- /sdcc/sim/ucsim/avr.src/conf.mk: -------------------------------------------------------------------------------- 1 | # avr.src/conf.mk 2 | # 3 | # Makefile targets to remake configuration 4 | # 5 | 6 | freshconf: Makefile 7 | 8 | Makefile: $(srcdir)/Makefile.in $(PRJDIR)/configure.in 9 | cd $(PRJDIR) && $(SHELL) ./config.status 10 | 11 | # End of avr.src/conf.mk 12 | -------------------------------------------------------------------------------- /sdcc/src/README: -------------------------------------------------------------------------------- 1 | sdcc/src 2 | -------- 3 | 4 | C compiler source. 5 | 6 | Everything shared is in this directory. Port specific files like the 7 | code generator (gen.c), register allocator (ralloc.c) and support 8 | functions are in the appropriate port directory (ie mcs51 for the 8051). 9 | -------------------------------------------------------------------------------- /sdcc/support/regression/tests/bug-448984.c: -------------------------------------------------------------------------------- 1 | /* bug-448984.c 2 | */ 3 | #include 4 | 5 | void 6 | testRshRem(void) 7 | { 8 | volatile int rem, quot; 9 | 10 | quot = 4; 11 | rem = 5000; 12 | 13 | rem = rem - (quot*1024); 14 | 15 | ASSERT(rem == 904); 16 | } 17 | -------------------------------------------------------------------------------- /sdcc/device/include/z80/string.h: -------------------------------------------------------------------------------- 1 | /* Silly string.h 2 | * Z80 specific hack 3 | */ 4 | 5 | #include 6 | 7 | char *strcpy(char *dest, const char *src); 8 | 9 | int strcmp(const char *s1, const char *s2); 10 | 11 | void *memcpy(void *dest, const void *src, WORD wLen); 12 | 13 | -------------------------------------------------------------------------------- /sdcc/sim/ucsim/s51.src/conf.mk: -------------------------------------------------------------------------------- 1 | # uCsim s51.src/conf.mk 2 | # 3 | # Makefile targets to remake configuration 4 | # 5 | 6 | freshconf: Makefile 7 | 8 | Makefile: $(srcdir)/Makefile.in $(PRJDIR)/configure.in 9 | cd $(PRJDIR) && $(SHELL) ./config.status 10 | 11 | # End of s51.src/conf.mk 12 | -------------------------------------------------------------------------------- /sdcc/device/lib/_fs2schar.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /* convert float to signed char */ 4 | signed char __fs2schar (float f) { 5 | signed long sl=__fs2slong(f); 6 | if (sl>=CHAR_MAX) 7 | return CHAR_MAX; 8 | if (sl<=CHAR_MIN) 9 | return -CHAR_MIN; 10 | return sl; 11 | } 12 | -------------------------------------------------------------------------------- /sdcc/packihx/config_in.h: -------------------------------------------------------------------------------- 1 | #ifndef PACKIHX_HEADER 2 | #define PACKIHX_HEADER 3 | 4 | #undef TYPE_BYTE 5 | #undef TYPE_WORD 6 | #define TYPE_UBYTE unsigned TYPE_BYTE 7 | #define TYPE_UWORD unsigned TYPE_WORD 8 | 9 | typedef TYPE_UBYTE Uint8; 10 | typedef TYPE_UWORD Uint16; 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /sdcc/sim/ucsim/gui.src/conf.mk: -------------------------------------------------------------------------------- 1 | # uCsim gui.src/conf.mk 2 | 3 | # 4 | # Makefile targets to remake configuration 5 | # 6 | 7 | freshconf: Makefile 8 | 9 | Makefile: $(srcdir)/Makefile.in $(PRJDIR)/configure.in 10 | cd $(PRJDIR) && $(SHELL) ./config.status 11 | 12 | # End of gui.src/conf.mk 13 | -------------------------------------------------------------------------------- /sdcc/doc/sdccman.html/WARNINGS: -------------------------------------------------------------------------------- 1 | No implementation found for style `fontenc' 2 | No implementation found for style `fancyhdr' 3 | No implementation found for style `url' 4 | 5 | redefining command \url 6 | 7 | previous meaning of \url will be lost 8 | 9 | There is no author for this document. 10 | -------------------------------------------------------------------------------- /sdcc/sim/ucsim/cmd.src/conf.mk: -------------------------------------------------------------------------------- 1 | # 2 | # ucsim cmd.src/conf.mk 3 | # 4 | # Makefile targets to remake configuration 5 | # 6 | 7 | freshconf: Makefile 8 | 9 | Makefile: $(srcdir)/Makefile.in $(PRJDIR)/configure.in 10 | cd $(PRJDIR) && $(SHELL) ./config.status 11 | 12 | # End of cmd.src/conf.mk 13 | -------------------------------------------------------------------------------- /sdcc/src/SDCCpeeph.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | print "/* Generated file, DO NOT Edit! */" 3 | print "/* To Make changes to rules edit */" 4 | print "/* /peeph.def instead. */" 5 | } 6 | 7 | /^\/\// { next} 8 | 9 | { printf "\"" ; 10 | printf "%s",$0; 11 | print "\\n\""; 12 | } 13 | 14 | 15 | -------------------------------------------------------------------------------- /gbdk-lib/libc/rrgb/putchar.s: -------------------------------------------------------------------------------- 1 | .area _CODE 2 | _putchar:: 3 | lda hl,2(sp) 4 | ld l,(hl) 5 | ld a,#0 6 | rst 0x00 7 | ret 8 | 9 | .if 0 10 | _putchar:: 11 | push ix 12 | ld ix,#0 13 | add ix,sp 14 | 15 | ld l,4(ix) 16 | ld a,#0 17 | out (0xff),a 18 | 19 | pop ix 20 | ret 21 | .endif 22 | 23 | -------------------------------------------------------------------------------- /sdcc/sim/ucsim/avr.src/logic_cl.h: -------------------------------------------------------------------------------- 1 | /* avr.src/logic_cl.h */ 2 | 3 | virtual int ori_Rd_K(t_mem code); 4 | virtual int andi_Rd_K(t_mem code); 5 | virtual int and_Rd_Rr(t_mem code); 6 | virtual int eor_Rd_Rr(t_mem code); 7 | virtual int or_Rd_Rr(t_mem code); 8 | 9 | /* End of avr.src/logic_cl.h */ 10 | -------------------------------------------------------------------------------- /sdcc/device/examples/startupcode/c.bat: -------------------------------------------------------------------------------- 1 | set SDCCFLAGS=--debug --stack-after-data --model-large 2 | cls 3 | cd src 4 | sdcc --version 5 | sdcc %SDCCFLAGS% --compile-only startup_code.c 6 | sdcc %SDCCFLAGS% --compile-only cpu_c515a.c 7 | sdcc %SDCCFLAGS% startup_code.rel cpu_c515a.rel 8 | cd .. 9 | pause 10 | c.bat 11 | -------------------------------------------------------------------------------- /sdcc/sim/ucsim/s51.src/test_extit.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | sfr at 0xa6 WDTRST; 4 | 5 | void jaj() interrupt 0 { P2= P0; P0++; } 6 | 7 | void main() 8 | { 9 | IT0=0; /* low level triggered */ 10 | IT0=1; /* falling edge triggered */ 11 | EX0=1; /* enable ex #0 */ 12 | EA=1; 13 | P0=0; 14 | for(;;); 15 | } 16 | -------------------------------------------------------------------------------- /sdcc/device/examples/mcs51/asmblink/Makefile: -------------------------------------------------------------------------------- 1 | # makefile for Linux 2 | 3 | all : blink.ihx 4 | 5 | blink.ihx : blink.lnk 6 | asx8051 -los blink.asm 7 | aslink -f blink.lnk 8 | 9 | blink.lnk : blink_lnk 10 | cp blink_lnk blink.lnk 11 | 12 | clean: 13 | rm -f mon.ihx *.lst *.rel *.rst *.sym *.cdb *.map *.ihx 14 | 15 | -------------------------------------------------------------------------------- /sdcc/device/examples/mcs51/simple/go.bat: -------------------------------------------------------------------------------- 1 | ; this is a windows batch file to compile hi.c 2 | 3 | ; set SDCCINC=c:\usr\local\sdcc\device\include 4 | ; set SDCCLIBS=c:\usr\local\sdcc\device\lib\small 5 | 6 | set SDCCINC=c:\sdcc\include 7 | set SDCCLIBS=c:\sdcc\lib\small 8 | 9 | sdcc -I %SDCCINC% -L %SDCCLIBS% hi.c 10 | 11 | -------------------------------------------------------------------------------- /sdcc/sim/ucsim/gui.src/serio.src/conf.mk: -------------------------------------------------------------------------------- 1 | # uCsim gui.src/serio.src/conf.mk 2 | 3 | # 4 | # Makefile targets to remake configuration 5 | # 6 | 7 | freshconf: Makefile 8 | 9 | Makefile: $(srcdir)/Makefile.in $(PRJDIR)/configure.in 10 | cd $(PRJDIR) && $(SHELL) ./config.status 11 | 12 | # End of gui.src/serio.src/conf.mk 13 | -------------------------------------------------------------------------------- /sdcc/support/regression/failing/bug-435214.c: -------------------------------------------------------------------------------- 1 | /* bug-435214.c 2 | */ 3 | #include 4 | 5 | static 6 | unsigned int divide(long a) 7 | { 8 | return a/512ul; 9 | } 10 | 11 | static void 12 | testDivide() 13 | { 14 | assert(divide(1300) == 2); 15 | assert(divide(0x12345678) == 0x91A2B); 16 | } 17 | 18 | -------------------------------------------------------------------------------- /sdcc/device/examples/ds390/hello390/Makefile: -------------------------------------------------------------------------------- 1 | hello390.hex: hello390.c 2 | sdcc -mds390 --xram-loc 0x100080 --code-loc 0x10000 \ 3 | -Wl-r hello390.c 4 | packihx hello390.ihx >hello390.hex 5 | #tinitalk -c execute hello390.hex 6 | 7 | clean: 8 | rm -f *~ \#* *.asm *.cdb *.rel *.hex *.ihx *.lst *.map *.rst *.sym *.lnk core *.dump* 9 | -------------------------------------------------------------------------------- /sdcc/support/regression/tests/bug-469671.c: -------------------------------------------------------------------------------- 1 | /* bug 469671.c 2 | 3 | storage: static, 4 | */ 5 | #include 6 | 7 | void 8 | testMul(void) 9 | { 10 | {storage} volatile int a, b; 11 | 12 | a = 5; 13 | b = a*2; 14 | ASSERT(b == 10); 15 | 16 | a = -33; 17 | b = a*2; 18 | ASSERT(b == -66); 19 | } 20 | -------------------------------------------------------------------------------- /gbdk-lib/libc/calloc.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | void *calloc( int nmem, int size ) 6 | { 7 | void *malloced; 8 | 9 | malloced = malloc( nmem*size ); 10 | if (malloced!=NULL) { 11 | memset( malloced, 0, nmem*size ); 12 | return malloced; 13 | } 14 | return NULL; 15 | } 16 | -------------------------------------------------------------------------------- /sdcc/device/examples/mcs51/simple2/go.bat: -------------------------------------------------------------------------------- 1 | ; this is a windows batch file to compile hi.c 2 | 3 | ; set SDCCINC=c:\usr\local\sdcc\device\include 4 | ; set SDCCLIBS=c:\usr\local\sdcc\device\lib\small 5 | 6 | set SDCCINC=c:\sdcc\include 7 | set SDCCLIBS=c:\sdcc\lib\small 8 | 9 | sdcc -I %SDCCINC% -L %SDCCLIBS% hi.c 10 | 11 | -------------------------------------------------------------------------------- /sdcc/sim/ucsim/gui.src/obsolete/portmon.src/conf.mk: -------------------------------------------------------------------------------- 1 | # uCsim gui.src/portmon.src/conf.mk 2 | 3 | # 4 | # Makefile targets to remake configuration 5 | # 6 | 7 | freshconf: Makefile 8 | 9 | Makefile: $(srcdir)/Makefile.in $(PRJDIR)/configure.in 10 | cd $(PRJDIR) && $(SHELL) ./config.status 11 | 12 | # End of gui.src/portmon.src/conf.mk 13 | -------------------------------------------------------------------------------- /sdcc/sim/ucsim/conf.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile targets to remake configuration 3 | # 4 | 5 | freshconf: main.mk ddconfig.h 6 | 7 | main.mk: $(srcdir)/main_in.mk config.status 8 | $(SHELL) ./config.status 9 | 10 | ddconfig.h: ddconfig_in.h config.status 11 | @echo "Re-making ddconfig.h" 12 | $(SHELL) ./config.status 13 | 14 | # End of conf.mk 15 | -------------------------------------------------------------------------------- /sdcc/support/regression/tests/longor.c: -------------------------------------------------------------------------------- 1 | /** Test long OR. 2 | Was a bug where 1 was turned into 0x10000 on PPC. 3 | */ 4 | #include 5 | 6 | void 7 | testLongOR(void) 8 | { 9 | volatile unsigned long l; 10 | 11 | l = 0; 12 | l |= 1L; 13 | ASSERT(l == 1); 14 | 15 | l = 0; 16 | l |= 1; 17 | ASSERT(l == 1); 18 | } 19 | -------------------------------------------------------------------------------- /gbdk-lib/libc/reverse.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | char *reverse(char *s) 6 | { 7 | UINT8 i, j; 8 | char c; 9 | 10 | i = 0; 11 | j = strlen(s) - 1; 12 | while(i < j) { 13 | c = s[i]; 14 | s[i] = s[j]; 15 | s[j] = c; 16 | i++; 17 | j--; 18 | } 19 | return(s); 20 | } 21 | -------------------------------------------------------------------------------- /gbdk-support/lcc/Makefile: -------------------------------------------------------------------------------- 1 | # Simple Makefile for the lcc frontend. 2 | 3 | ifndef TARGETDIR 4 | TARGETDIR = /opt/gbdk 5 | endif 6 | 7 | CC = $(TOOLSPREFIX)gcc 8 | CFLAGS = -ggdb -O -Wall -DGBDKLIBDIR=\"$(TARGETDIR)\" 9 | OBJ = lcc.o gb.o 10 | BIN = lcc 11 | 12 | all: $(BIN) 13 | 14 | $(BIN): $(OBJ) 15 | 16 | clean: 17 | rm -f *.o $(BIN) *~ 18 | -------------------------------------------------------------------------------- /sdcc/sim/ucsim/gui.src/serio.src/USAGE: -------------------------------------------------------------------------------- 1 | *note: tested on: 2 | Solaris 7 using gcc version 2.95.1 19990816 (release) 3 | with ncurses 4 | should work with curses although not guranteed 5 | 6 | Start serialview 7 | Start the s51 simulator with the following command line options: 8 | -S out=/tmp/out,in=/tmp/in 9 | or whatever pipes you wish to use 10 | -------------------------------------------------------------------------------- /sdcc/support/regression/tests/increment.c: -------------------------------------------------------------------------------- 1 | /** Simple test for increment 2 | 3 | type: signed char, int, long 4 | storage: static, 5 | attr: volatile 6 | */ 7 | #include 8 | 9 | static void 10 | testIncrement(void) 11 | { 12 | {attr} {storage} {type} i; 13 | i = 0; 14 | i--; 15 | ASSERT(i == -1); 16 | } 17 | -------------------------------------------------------------------------------- /sdcc/support/regression/tests/longlit.c: -------------------------------------------------------------------------------- 1 | /* Testing arithmetics with long litterals 2 | */ 3 | 4 | #include 5 | 6 | #define OSCILLATOR 11059200 7 | #define BAUD 19200 8 | 9 | #define T1_RELOAD_VALUE -(2*OSCILLATOR)/(32*12*BAUD) 10 | 11 | unsigned char T1=T1_RELOAD_VALUE; 12 | 13 | void test (void) { 14 | ASSERT(T1==0xfd); 15 | } 16 | -------------------------------------------------------------------------------- /sdcc/device/examples/ds390/ow390/swt12.h: -------------------------------------------------------------------------------- 1 | typedef struct tagSRAM 2 | { 3 | uchar Supply; 4 | uchar Chan_B; 5 | uchar Chan_A; 6 | uchar Chan_Sel; 7 | uchar Sour_Sel; 8 | uchar Polarity; 9 | } SwitchProps; 10 | 11 | int ReadSwitch12(int,int); 12 | int SetSwitch12(int,uchar *,SwitchProps*); 13 | int SwitchStateToString12(int,char *); 14 | -------------------------------------------------------------------------------- /sdcc/src/regression/create_stc: -------------------------------------------------------------------------------- 1 | # Create gpsim script file 2 | # 3 | 4 | USAGE="Usage: `basename $0` COD_FILE GPSIM_SCRIPT" 5 | 6 | if [ $# -lt 2 ] ; then 7 | echo "$USAGE" 8 | exit 1 9 | fi 10 | 11 | 12 | echo "load s $1" > $2 13 | echo "break e _done" >> $2 14 | echo "run" >> $2 15 | echo "x _success" >> $2 16 | echo "abort_gpsim_now" >> $2 17 | -------------------------------------------------------------------------------- /sdcc/support/regression/tests/bug-435068.c: -------------------------------------------------------------------------------- 1 | /* bug-435068.c 2 | */ 3 | #include 4 | 5 | char c, d; 6 | 7 | static void 8 | testQuestion(void) 9 | { 10 | volatile char c, d; 11 | 12 | c = (0x100 & 0x100) ? 4 : 8; // ok 13 | d = ((0x100 & 0x100) ? 4 : 8) + 1; 14 | 15 | ASSERT(c == 4); 16 | ASSERT(d == 5); 17 | } 18 | -------------------------------------------------------------------------------- /gbdk-lib/libc/strcat.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /* 4 | * Concatenate s2 on the end of s1. s1 must be large enough. 5 | * Return s1. 6 | */ 7 | 8 | char *strcat(char *s1, const char *s2) NONBANKED 9 | { 10 | char *os1; 11 | 12 | os1 = s1; 13 | while(*s1++) 14 | ; 15 | --s1; 16 | while(*s1++ = *s2++) 17 | ; 18 | return os1; 19 | } 20 | -------------------------------------------------------------------------------- /gbdk-lib/examples/gb/gb-dtmf/Makefile: -------------------------------------------------------------------------------- 1 | CC = ../../../bin/lcc -Wa-l -Wl-m -DGBDK_2_COMPAT=1 2 | 3 | BINS = gb-dtmf.gb 4 | 5 | all: $(BINS) 6 | 7 | %.s: %.c 8 | $(CC) -S -o $@ $< 9 | 10 | %.o: %.c 11 | $(CC) -c -o $@ $< 12 | 13 | %.o: %.s 14 | $(CC) -c -o $@ $< 15 | 16 | %.gb: %.o 17 | $(CC) -o $@ $< 18 | 19 | clean: 20 | rm -f *.o *.lst *.map *.gb 21 | -------------------------------------------------------------------------------- /sdcc/packihx/config.h: -------------------------------------------------------------------------------- 1 | /* config.h. Generated automatically by configure. */ 2 | #ifndef PACKIHX_HEADER 3 | #define PACKIHX_HEADER 4 | 5 | #define TYPE_BYTE char 6 | #define TYPE_WORD short 7 | #define TYPE_UBYTE unsigned TYPE_BYTE 8 | #define TYPE_UWORD unsigned TYPE_WORD 9 | 10 | typedef TYPE_UBYTE Uint8; 11 | typedef TYPE_UWORD Uint16; 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /sdcc/as/z80/string.h: -------------------------------------------------------------------------------- 1 | /* STRING.H */ 2 | /* DECUC C */ 3 | 4 | extern char * strcat(); 5 | extern char * strchr(); 6 | extern int strcmp(); 7 | extern char * strcpy(); 8 | extern int streq(); 9 | extern int strlen(); 10 | extern char * strncat(); 11 | extern int strncmp(); 12 | extern char * strncpy(); 13 | extern int strneq(); 14 | extern char * strrchr(); 15 | 16 | -------------------------------------------------------------------------------- /sdcc/support/makebin/Makefile: -------------------------------------------------------------------------------- 1 | PRJDIR = ../.. 2 | 3 | SOURCES = makebin.c 4 | BIN = $(PRJDIR)/bin/makebin 5 | 6 | include $(PRJDIR)/Makefile.common 7 | 8 | all: $(BIN) 9 | 10 | $(BIN): $(OBJ) 11 | $(CC) -o $(BIN) $(OBJ) 12 | 13 | install: all 14 | mkdir -p $(bindir) 15 | $(INSTALL) $(BIN) `echo $(bindir)/makebin|sed '$(transform)'` 16 | 17 | include clean.mk 18 | -------------------------------------------------------------------------------- /sdcc/src/regression/rt.sh: -------------------------------------------------------------------------------- 1 | # test Script 2 | 3 | USAGE="Usage: `basename $0` BASENAME" 4 | 5 | if [ $# -lt 1 ] ; then 6 | echo "$USAGE" 7 | exit 1 8 | fi 9 | 10 | # compile 11 | ../../bin/sdcc -c -mpic14 $1.c 12 | gpasm -c -I /usr/local/share/gpasm/header $1.asm 13 | ./create_stc $1.cod $1.stc 14 | ./simulate $1.stc garbage.log 15 | cat garbage.log 16 | rm garbage.log -------------------------------------------------------------------------------- /sdcc/device/examples/ds390/i2c390/i2c390.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "ds1621.h" 4 | #include "pcf8591.h" 5 | 6 | 7 | void main (void) { 8 | 9 | while(1) { 10 | printf ("% 5.2f %03u %03u %03u %03u\n\r", 11 | ReadDS1621(2), 12 | ReadPCF8591(0,0), 13 | ReadPCF8591(0,1), 14 | ReadPCF8591(0,2), 15 | ReadPCF8591(0,3)); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /sdcc/doc/z80/Makefile: -------------------------------------------------------------------------------- 1 | # Very simple Makefile for converting the design doc into something useful. 2 | TEX = latex 3 | 4 | S = combined_i186_z80_design.tex 5 | PDF = $(S:.tex=.pdf) 6 | PS = $(S:.tex=.ps) 7 | 8 | all: $(PS) $(PDF) 9 | 10 | %.ps: %.dvi 11 | dvips -f.ps $< > $@ 12 | 13 | %.pdf: %.dvi 14 | dvipdf $< $@ 15 | 16 | clean: 17 | rm -f $(PS) $(PDF) *.log *.aux *~ 18 | -------------------------------------------------------------------------------- /sdcc/sim/ucsim/s51.src/lst2ls: -------------------------------------------------------------------------------- 1 | FNAME=$1 2 | 3 | awk -v FNAME=$FNAME 'BEGIN { 4 | cfname= FNAME ".c"; 5 | i= 1; 6 | while (getline csrc[i] ${FNAME}.ls 21 | 22 | # End of lst2ls 23 | 24 | -------------------------------------------------------------------------------- /sdcc/device/examples/ds390/Makefile: -------------------------------------------------------------------------------- 1 | TARGETS = clock390 hello390 i2c390 readmac rtc390 ow390 2 | 3 | all: $(TARGETS) 4 | for target in $(TARGETS); do \ 5 | (cd $$target; $(MAKE)); \ 6 | done; 7 | 8 | clean: $(TARGETS) 9 | rm -f *~ \#* *.asm *.cdb *.rel *.hex *.ihx *.lst *.map *.rst *.sym *.lnk 10 | for target in $(TARGETS); do \ 11 | (cd $$target; $(MAKE) clean); \ 12 | done; 13 | -------------------------------------------------------------------------------- /sdcc/device/lib/gbz80/putchar.s: -------------------------------------------------------------------------------- 1 | .area _CODE 2 | _putchar:: 3 | _putchar_rr_s:: 4 | ld hl,#2 5 | add hl,sp 6 | 7 | ld l,(hl) 8 | ld a,#1 9 | rst 0x08 10 | 11 | ret 12 | 13 | _putchar_rr_dbs:: 14 | ld l,e 15 | ld a,#1 16 | rst 0x08 17 | 18 | ret 19 | -------------------------------------------------------------------------------- /sdcc/device/lib/_fs2slong.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /* convert float to signed long */ 4 | signed long __fs2slong (float f) { 5 | 6 | if (!f) 7 | return 0; 8 | 9 | if (f<0) { 10 | if (f<=LONG_MIN) 11 | return LONG_MIN; 12 | return -__fs2ulong(-f); 13 | } else { 14 | if (f>=LONG_MAX) 15 | return LONG_MAX; 16 | return __fs2ulong(f); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /sdcc/tinitalk/Makefile.bcc: -------------------------------------------------------------------------------- 1 | PRJDIR = .. 2 | 3 | OBJECTS = tinitalk.obj 4 | 5 | TARGET = tinitalk.exe 6 | 7 | # Compiling entire program or any subproject 8 | # ------------------------------------------ 9 | all: $(TARGET) 10 | 11 | 12 | # My rules 13 | # -------- 14 | $(TARGET): $(OBJECTS) 15 | bcc32 -e$(TARGET) $(OBJECTS) 16 | 17 | !include ..\Bcc.inc 18 | 19 | -------------------------------------------------------------------------------- /gbdk-lib/libc/strncmp.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /* 4 | * Compare strings (at most n bytes): 5 | * s1>s2: >0 6 | * s1==s2: 0 7 | * s1 0 && *s1 == *s2++) { 13 | if(*s1++ == '\0') 14 | return 0; 15 | n--; 16 | } 17 | return (n == 0 ? 0 : *s1 - *--s2); 18 | } 19 | -------------------------------------------------------------------------------- /sdcc/device/lib/z80/putchar.s: -------------------------------------------------------------------------------- 1 | .area _CODE 2 | _putchar:: 3 | _putchar_rr_s:: 4 | ld hl,#2 5 | add hl,sp 6 | 7 | ld l,(hl) 8 | ld a,#1 9 | rst 0x08 10 | 11 | ret 12 | 13 | _putchar_rr_dbs:: 14 | ld l,e 15 | ld a,#1 16 | rst 0x08 17 | 18 | ret 19 | 20 | -------------------------------------------------------------------------------- /sdcc/packihx/Makefile.bcc: -------------------------------------------------------------------------------- 1 | PRJDIR = .. 2 | 3 | OBJECTS = packihx.obj 4 | 5 | TARGET = $(PRJDIR)/bin/packihx.exe 6 | 7 | # Compiling entire program or any subproject 8 | # ------------------------------------------ 9 | all: $(TARGET) 10 | 11 | 12 | # My rules 13 | # -------- 14 | $(TARGET): $(OBJECTS) 15 | bcc32 -e$(TARGET) $(OBJECTS) 16 | 17 | !include ..\Bcc.inc 18 | 19 | -------------------------------------------------------------------------------- /gbdk-lib/libc/time.c: -------------------------------------------------------------------------------- 1 | /* 2 | time.c 3 | Simple, not completly conformant implementation of time routines 4 | */ 5 | 6 | /* clock() is in clock.s */ 7 | #include 8 | 9 | time_t time(time_t *t) 10 | { 11 | UINT16 ret; 12 | 13 | /* Should be relative to 0:00 1970 GMT but hey */ 14 | ret = clock() / CLOCKS_PER_SEC; 15 | 16 | if (t) 17 | *t = ret; 18 | 19 | return ret; 20 | } 21 | -------------------------------------------------------------------------------- /sdcc/doc/clean.mk: -------------------------------------------------------------------------------- 1 | # remove intermediate file, not the final pdf's and html's 2 | # because these are needed for the distribution 3 | clean: 4 | rm -rf *.tex *.aux *.dvi *.idx *.ilg *.ind *.log *.toc *~ \#* \ 5 | *.ps */*.css */*.pl *.gif core 6 | 7 | # now get rid of the generated pdf's and html's as well 8 | superclean: clean 9 | rm -rf *.pdf $(MANUAL).html $(TSS).html 10 | 11 | distclean: superclean 12 | -------------------------------------------------------------------------------- /sdcc/src/spawn.h: -------------------------------------------------------------------------------- 1 | #ifdef __DJGPP__ 2 | /* They exist in DOS */ 3 | #include 4 | #else 5 | /* Specially defined for UNIX and Cygwin */ 6 | int spawnv (int mode, const char *path, char *const argv[]); 7 | int spawnvp (int mode, const char *path, char *const argv[]); 8 | 9 | #define P_WAIT 1 10 | #define P_NOWAIT 2 /* always generates error for DJGPP! */ 11 | #define P_OVERLAY 3 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /sdcc/conf.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile targets to remake configuration 3 | # 4 | 5 | freshconf: $(srcdir)/configure main.mk 6 | 7 | $(srcdir)/configure: $(srcdir)/configure.in 8 | cd $(srcdir) && $(SHELL) autoconf 9 | 10 | main.mk: $(srcdir)/main_in.mk $(srcdir)/configure.in 11 | $(SHELL) ./config.status 12 | 13 | config.status: $(srcdir)/configure 14 | $(SHELL) ./config.status --recheck 15 | 16 | # End of conf.mk 17 | -------------------------------------------------------------------------------- /sdcc/device/examples/ds390/test390/Makefile: -------------------------------------------------------------------------------- 1 | 2 | all : test390.ihx 3 | 4 | test390.ihx : test390.c 5 | sdcc -mds390 test390.c 6 | 7 | normal : 8 | sdcc -mds390 --model-large test390.c 9 | 10 | clean: 11 | rm mon.ihx *.lst *.rel *.rst *.sym *.cdb *.map *.ihx *.lnk *.asm 12 | 13 | sim: 14 | ./s51 -t DS390F -Sout=test.lst test390.ihx 15 | 16 | sim_norm: 17 | ./s51 -t DS390 -Sout=test.lst test390.ihx 18 | 19 | -------------------------------------------------------------------------------- /sdcc/src/z80/peeph-z80.def: -------------------------------------------------------------------------------- 1 | replace restart { 2 | ld a,%1(%2) 3 | bit %3,a 4 | jp %4,%5 5 | } by { 6 | bit %3,%1(%2) 7 | jp %4,%5 8 | } 9 | replace { 10 | ld %1,%2) 11 | ld a,%2) 12 | } by { 13 | ld %1,%2) 14 | ld a,%1 15 | } 16 | replace { 17 | ld %1),a 18 | xor a,a 19 | or a,%1) 20 | jp z,%2 21 | } by { 22 | ld %1),a 23 | or a,a 24 | jp z,%2 25 | } 26 | -------------------------------------------------------------------------------- /sdcc/device/examples/startupcode/inc/startup_code.h: -------------------------------------------------------------------------------- 1 | // INCLUDES & DEFINES =============================================== 2 | // here are some definition about the CPU type 3 | 4 | #ifndef __FILE_WSI_128KFLASH_H 5 | #define __FILE_WSI_128KFLASH_H 6 | 7 | #include "..\inc\hardware_description.h" 8 | 9 | // place all 8051-CPU depending tools ISR and functions here 10 | 11 | //include "..\inc\another_header.h" 12 | #endif -------------------------------------------------------------------------------- /gbdk-lib/libc/itoa.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | char *itoa(int n, char *s) 6 | { 7 | UINT8 i, sign; 8 | 9 | if(n < 0) { 10 | sign = 1; 11 | n = -n; 12 | } else 13 | sign = 0; 14 | i = 0; 15 | do { 16 | s[i++] = n % 10 + '0'; 17 | } while((n = n/10) > 0); 18 | if(sign) 19 | s[i++] = '-'; 20 | s[i] = 0; 21 | reverse(s); 22 | return s; 23 | } 24 | -------------------------------------------------------------------------------- /gbdk-lib/libc/ltoa.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | char *ltoa(long n, char *s) 6 | { 7 | UINT8 i, sign; 8 | 9 | if(n < 0) { 10 | sign = 1; 11 | n = -n; 12 | } else 13 | sign = 0; 14 | i = 0; 15 | do { 16 | s[i++] = n % 10 + '0'; 17 | } while((n = n/10) > 0); 18 | if(sign) 19 | s[i++] = '-'; 20 | s[i] = 0; 21 | reverse(s); 22 | return s; 23 | } 24 | -------------------------------------------------------------------------------- /gbdk-lib/include/Makefile: -------------------------------------------------------------------------------- 1 | VER = 2.94 2 | 3 | doc: 4 | mkdir -p ../doc 5 | doxygen libc.dox 6 | make -C ../doc/libc/latex pdf 7 | 8 | dist: 9 | mkdir -p ../build/doc 10 | cd ../doc/libc; tar czf ../../build/doc/gbdk-doc-html-$(VER).tar.gz html 11 | cp ../doc/libc/latex/refman.pdf ../build/doc/gbdk-doc-$(VER).pdf 12 | gzip ../build/doc/gbdk-doc-$(VER).pdf 13 | (cd ../doc/libc; tar cf - html) | (cd ../build/doc; tar xf -) 14 | 15 | -------------------------------------------------------------------------------- /sdcc/sim/ucsim/TODO: -------------------------------------------------------------------------------- 1 | prompt command to set diff prompt for any console 2 | Tue Aug 17 1999 3 | 4 | timer val id value 5 | Tue Aug 17 1999 6 | Done: Tue Aug 17 1999 7 | 8 | stop should report stop address on `go' console 9 | Tue Aug 17 1999 10 | Done: Tue Aug 17 1999 11 | 12 | dis command prints out short lists repeatedly. It should remember addresses 13 | printed out and stop if an already used address comes. 14 | Thu Sep 30 1999 15 | -------------------------------------------------------------------------------- /gbdk-lib/libc/gb/scroll_b.s: -------------------------------------------------------------------------------- 1 | .include "global.s" 2 | 3 | ;; BANKED: checked, imperfect 4 | .area _BASE 5 | 6 | _scroll_bkg:: 7 | LDA HL,2(SP) ; Skip return address 8 | XOR A 9 | CP (HL) ; Is x != 0 10 | JR Z,1$ 11 | 12 | LDH A,(.SCX) ; Yes 13 | ADD (HL) 14 | LDH (.SCX),A 15 | 1$: 16 | INC HL 17 | XOR A 18 | CP (HL) ; Is y != 0 19 | JR Z,2$ 20 | 21 | LDH A,(.SCY) ; Yes 22 | ADD (HL) 23 | LDH (.SCY),A 24 | 2$: 25 | RET 26 | -------------------------------------------------------------------------------- /gbdk-lib/libc/gb/scroll_w.s: -------------------------------------------------------------------------------- 1 | .include "global.s" 2 | 3 | ;; BANKED: checked, imperfect 4 | .area _BASE 5 | 6 | _scroll_win:: 7 | LDA HL,2(SP) ; Skip return address 8 | XOR A 9 | CP (HL) ; Is x != 0 10 | JR Z,1$ 11 | 12 | LDH A,(.WX) ; Yes 13 | ADD (HL) 14 | LDH (.WX),A 15 | 1$: 16 | INC HL 17 | XOR A 18 | CP (HL) ; Is y != 0 19 | JR Z,2$ 20 | 21 | LDH A,(.WY) ; Yes 22 | ADD (HL) 23 | LDH (.WY),A 24 | 2$: 25 | RET 26 | -------------------------------------------------------------------------------- /sdcc/device/include/sdcc-lib.h: -------------------------------------------------------------------------------- 1 | /** Top level header file for the sdcc libraries that enables target 2 | specific features. 3 | */ 4 | #ifndef __SDC51_SDCC_LIB_H 5 | #define __SDC51_SDCC_LIB_H 1 6 | 7 | #if defined(__z80) 8 | #include 9 | 10 | #elif defined(__gbz80) 11 | #include 12 | 13 | #else 14 | /* PENDING */ 15 | #include 16 | 17 | #endif 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /sdcc/as/mcs51/i51ext.c: -------------------------------------------------------------------------------- 1 | /* i51ext.c */ 2 | 3 | /* 4 | * (C) Copyright 1989,1990 5 | * All Rights Reserved 6 | * 7 | * Alan R. Baldwin 8 | * 721 Berkeley St. 9 | * Kent, Ohio 44240 10 | * 11 | * Ported from 8085 to 8051 by John Hartman 30-Apr-1995 12 | */ 13 | 14 | #include 15 | #include 16 | #include "asm.h" 17 | #include "i8051.h" 18 | 19 | char *cpu = "Intel 8051"; 20 | int hilo = 1; 21 | char *dsft = "ASM"; 22 | -------------------------------------------------------------------------------- /sdcc/support/regression/tests/bug-223113.c: -------------------------------------------------------------------------------- 1 | /* bug-223113.c 2 | PENDING 3 | */ 4 | #include 5 | 6 | int putch( int Ch ) 7 | { 8 | return( Ch ); 9 | } 10 | 11 | int puts( char *Str ) 12 | { 13 | char *Ptr; 14 | 15 | for( Ptr = Str; *Ptr != '\0'; Ptr++ ) { 16 | putch( *Ptr ); 17 | } 18 | 19 | return( (Ptr - Str) ); 20 | } 21 | 22 | void __main( void ) 23 | { 24 | puts( "hello world\n" ); 25 | } 26 | -------------------------------------------------------------------------------- /sdcc/support/regression/tests/packcast.c: -------------------------------------------------------------------------------- 1 | /* Tests that a cast used as a parameter gets packed into 2 | HL 3 | */ 4 | #include 5 | 6 | void 7 | spoil(int a) 8 | { 9 | UNUSED(a); 10 | } 11 | 12 | void 13 | testCastPack(char x) 14 | { 15 | int i, j; 16 | volatile char a = x; 17 | 18 | for (i = 0; i < 5; i++) 19 | { 20 | for (j = 0; j < 5; j++) 21 | { 22 | spoil(a); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /gbdk-lib/include/asm/z80/types.h: -------------------------------------------------------------------------------- 1 | #ifndef ASM_Z80_TYPES_INCLUDE 2 | #define ASM_Z80_TYPES_INCLUDE 3 | 4 | #if SDCC_PORT!=z80 5 | #error z80 only. 6 | #endif 7 | 8 | typedef char INT8; 9 | typedef unsigned char UINT8; 10 | typedef int INT16; 11 | typedef unsigned int UINT16; 12 | typedef long INT32; 13 | typedef unsigned long UINT32; 14 | 15 | typedef int size_t; 16 | typedef UINT16 clock_t; 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /gbdk-lib/libc/strncpy.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /* 4 | * Copy s2 to s1, truncating or null-padding to always copy n bytes. 5 | * Return s1. 6 | */ 7 | 8 | char *strncpy(char *s1, const char *s2, int n) NONBANKED 9 | { 10 | int i; 11 | char *os1; 12 | 13 | os1 = s1; 14 | for(i = 0; i < n; i++) 15 | if((*s1++ = *s2++) == '\0') { 16 | while(++i < n) 17 | *s1++ = '\0'; 18 | return os1; 19 | } 20 | return os1; 21 | } 22 | -------------------------------------------------------------------------------- /gbdk-lib/libc/gb/gprintn.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /* Print a number in any radix */ 4 | 5 | extern char *digits; 6 | 7 | void gprintn(BYTE number, BYTE radix, BYTE signed_value) 8 | { 9 | UBYTE i; 10 | 11 | if(number < 0 && signed_value) { 12 | wrtchr('-'); 13 | number = -number; 14 | } 15 | if((i = (UBYTE)number / (UBYTE)radix) != 0) 16 | gprintn(i, radix, UNSIGNED); 17 | wrtchr(digits[(UBYTE)number % (UBYTE)radix]); 18 | } 19 | -------------------------------------------------------------------------------- /sdcc/src/z80/support.h: -------------------------------------------------------------------------------- 1 | /** @file z80/support.h 2 | Support functions for the z80 port. 3 | */ 4 | #ifndef Z80_SUPPORT_INCLUDE 5 | #define Z80_SUPPORT_INCLUDE 6 | 7 | typedef unsigned short WORD; 8 | typedef unsigned char BYTE; 9 | 10 | typedef struct 11 | { 12 | WORD w[2]; 13 | BYTE b[4]; 14 | } 15 | Z80_FLOAT; 16 | 17 | /** Convert a native float into 'z80' format */ 18 | int convertFloat (Z80_FLOAT * f, double native); 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /gbdk-lib/include/ctype.h: -------------------------------------------------------------------------------- 1 | /** @file ctype.h 2 | Character type functions. 3 | */ 4 | #ifndef _CTYPE_H 5 | #define _CTYPE_H 6 | 7 | #include 8 | 9 | BOOLEAN 10 | isalpha(char c); 11 | 12 | BOOLEAN 13 | isupper(char c); 14 | 15 | BOOLEAN 16 | islower(char c); 17 | 18 | BOOLEAN 19 | isdigit(char c); 20 | 21 | BOOLEAN 22 | isspace(char c); 23 | 24 | char 25 | toupper(char c); 26 | 27 | char 28 | tolower(char c); 29 | 30 | #endif /* _CTYPE_H */ 31 | -------------------------------------------------------------------------------- /sdcc/src/izt/util.c: -------------------------------------------------------------------------------- 1 | /** @file izt/util.c 2 | */ 3 | #include "izt.h" 4 | 5 | int izt_util_binLog(int i) 6 | { 7 | static const int lookup[] = { 8 | 0, 0, 1, -1, 2, -1, -1, -1, 3 9 | }; 10 | 11 | if (i < NUM_OF(lookup)) { 12 | if (lookup[i] != -1) { 13 | return lookup[i]; 14 | } 15 | else { 16 | // Unsupported. 17 | wassert(0); 18 | } 19 | } 20 | else { 21 | // Unsupported. 22 | wassert(0); 23 | } 24 | return 0; 25 | } 26 | -------------------------------------------------------------------------------- /gbdk-lib/examples/gb/dscan/Makefile: -------------------------------------------------------------------------------- 1 | CC = ../../../bin/lcc -Wa-l -Wl-m 2 | 3 | BINS = dscan.gb 4 | 5 | all: $(BINS) 6 | 7 | %.o: %.c 8 | $(CC) -c -o $@ $< 9 | 10 | %.s: %.c 11 | $(CC) -S -o $@ $< 12 | 13 | %.o: %.s 14 | $(CC) -c -o $@ $< 15 | 16 | %.gb: %.o 17 | $(CC) -o $@ $< 18 | 19 | clean: 20 | rm -f *.o *.lst *.map *.gb 21 | 22 | # Link file, and write 0x80 at position 0x143 in header 23 | dscan.gb: dscan.o 24 | $(CC) -Wl-yp0x143=0x80 -o dscan.gb dscan.o 25 | -------------------------------------------------------------------------------- /gbdk-lib/include/types.h: -------------------------------------------------------------------------------- 1 | /** @file types.h 2 | Basic types. 3 | Directly include the port specific file. 4 | */ 5 | #ifndef TYPES_INCLUDE 6 | #define TYPES_INCLUDE 7 | 8 | #include 9 | 10 | /** Good 'ol NULL. 11 | */ 12 | #define NULL 0 13 | 14 | /** A 'false' value. 15 | */ 16 | #define FALSE 0 17 | /** A 'true' value. 18 | */ 19 | #define TRUE 1 20 | 21 | /** No longer used. 22 | */ 23 | typedef void * POINTER; 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /gbdk-lib/libc/gb/gprintln.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /* Print a long number in any radix */ 4 | 5 | extern char *digits; 6 | 7 | void gprintln(INT16 number, INT8 radix, INT8 signed_value) 8 | { 9 | UINT16 l; 10 | 11 | if(number < 0 && signed_value) { 12 | wrtchr('-'); 13 | number = -number; 14 | } 15 | if((l = (UINT16)number / (UINT16)radix) != 0) 16 | gprintln(l, radix, UNSIGNED); 17 | wrtchr(digits[(UINT16)number % (UINT16)radix]); 18 | } 19 | -------------------------------------------------------------------------------- /sdcc/support/regression/tests/bug-221168.c: -------------------------------------------------------------------------------- 1 | /* bug-221168.c 2 | */ 3 | #include 4 | 5 | #ifdef __mcs51 6 | # define XDATA xdata 7 | #else 8 | # define XDATA 9 | #endif 10 | 11 | XDATA static char x[10][20]; 12 | 13 | XDATA char * 14 | getAddrOfCell(unsigned char y, unsigned char z) 15 | { 16 | return &x[y][z]; 17 | } 18 | 19 | static void 20 | testMultiDimensionalAddress(void) 21 | { 22 | ASSERT(getAddrOfCell(5, 6) == (char XDATA *)x + 106); 23 | } 24 | -------------------------------------------------------------------------------- /sdcc/support/regression/tests/scott-while.c: -------------------------------------------------------------------------------- 1 | /* 2 | */ 3 | #include 4 | 5 | unsigned int aint0 = 0; 6 | unsigned int aint1 = 0; 7 | unsigned char achar0 = 0; 8 | unsigned char achar1 = 0; 9 | 10 | void 11 | while1 (void) 12 | { 13 | unsigned char i = 10; 14 | 15 | do 16 | { 17 | achar0++; 18 | } 19 | while (--i); 20 | 21 | ASSERT (!(achar0 != 10)); 22 | 23 | } 24 | 25 | 26 | void 27 | testWhile (void) 28 | { 29 | while1 (); 30 | } 31 | -------------------------------------------------------------------------------- /sdcc/src/regression/simulate: -------------------------------------------------------------------------------- 1 | # SDCC test script for the PIC Port 2 | # 3 | USAGE="Usage: `basename $0` GPSIM_SCRIPT OUTPUT" 4 | 5 | if [ $# -lt 2 ] ; then 6 | echo "$USAGE" 7 | exit 1 8 | fi 9 | 10 | 11 | GPSIM_SCRIPT=$1 12 | LOGFILE=$2 13 | touch $2 14 | echo "Test $GPSIM_SCRIPT" >> $LOGFILE 15 | gpsim --cli -c $GPSIM_SCRIPT $2> test 16 | grep "success " test | grep "= 0x0" 17 | if [ $? -eq 0 ] ; then 18 | echo "PASSED" >> $LOGFILE 19 | else 20 | echo "FAILED" >> $LOGFILE 21 | fi -------------------------------------------------------------------------------- /gbdk-lib/libc/strncat.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | /* 4 | * Concatenate s2 on the end of s1. s1 must be large enough. 5 | * At most n characters are moved. 6 | * Return s1. 7 | */ 8 | 9 | char *strncat(char *s1, const char *s2, int n) NONBANKED 10 | { 11 | char *os1; 12 | 13 | os1 = s1; 14 | while(*s1++) 15 | ; 16 | --s1; 17 | while(*s1++ = *s2++) { 18 | if(n == 0) { 19 | *--s1 = '\0'; 20 | break; 21 | } 22 | n--; 23 | } 24 | return os1; 25 | } 26 | -------------------------------------------------------------------------------- /gbdk-lib/libc/gb/get_bk_t.s: -------------------------------------------------------------------------------- 1 | .include "global.s" 2 | 3 | .globl .get_xy_btt 4 | ;; BANKED: checked 5 | .area _BASE 6 | 7 | _get_bkg_tiles:: 8 | PUSH BC 9 | 10 | LDA HL,4(SP) ; Skip return address and registers 11 | LD D,(HL) ; D = x 12 | INC HL 13 | LD E,(HL) ; E = y 14 | LDA HL,9(SP) 15 | LD B,(HL) ; BC = tiles 16 | DEC HL 17 | LD C,(HL) 18 | DEC HL 19 | LD A,(HL-) ; A = h 20 | LD H,(HL) ; H = w 21 | LD L,A ; L = h 22 | 23 | CALL .get_xy_btt 24 | 25 | POP BC 26 | RET 27 | -------------------------------------------------------------------------------- /gbdk-lib/libc/gb/set_bk_t.s: -------------------------------------------------------------------------------- 1 | .include "global.s" 2 | 3 | .globl .set_xy_btt 4 | ;; BANKED: checked 5 | .area _BASE 6 | 7 | _set_bkg_tiles:: 8 | PUSH BC 9 | 10 | LDA HL,4(SP) ; Skip return address and registers 11 | LD D,(HL) ; D = x 12 | INC HL 13 | LD E,(HL) ; E = y 14 | LDA HL,9(SP) 15 | LD B,(HL) ; BC = tiles 16 | DEC HL 17 | LD C,(HL) 18 | DEC HL 19 | LD A,(HL-) ; A = h 20 | LD H,(HL) ; H = w 21 | LD L,A ; L = h 22 | 23 | CALL .set_xy_btt 24 | 25 | POP BC 26 | RET 27 | -------------------------------------------------------------------------------- /sdcc/support/regression/tests/bug-408972.c: -------------------------------------------------------------------------------- 1 | /* Fake header. 2 | */ 3 | #include 4 | 5 | long leftShiftLong (long l) { 6 | /* PENDING: Disabled. 7 | return (l << 3); 8 | */ 9 | return l; 10 | } 11 | 12 | 13 | int leftShiftIntMasked (int v) { 14 | return ((v & 0xff00U) << 3); 15 | } 16 | 17 | int leftShiftIntMasked2 (int v) { 18 | return ((v & 0xff) << 8); 19 | } 20 | 21 | 22 | int leftShiftIntMasked3 (int v) { 23 | return ((v & 0xff) << 3); 24 | } 25 | -------------------------------------------------------------------------------- /sdcc/device/examples/ds390/rtc390/Makefile: -------------------------------------------------------------------------------- 1 | CC = sdcc 2 | 3 | MFLAGS = -mds390 4 | LFLAGS = --xram-loc 0x100080 --code-loc 0x10000 -Wl-r 5 | 6 | OBJECTS = rtc390.rel 7 | 8 | all: rtc390.hex 9 | 10 | clean: 11 | rm -f *~ \#* *.asm *.cdb *.rel *.hex *.ihx *.lst *.map *.rst *.sym *.lnk core *.dump* 12 | 13 | rtc390.hex: $(OBJECTS) 14 | $(CC) $(MFLAGS) $(LFLAGS) $(OBJECTS) 15 | packihx rtc390.ihx >rtc390.hex 16 | #tinitalk -c execute rtc390.hex 17 | 18 | %.rel: %.c 19 | $(CC) -c $(MFLAGS) -I . $< 20 | -------------------------------------------------------------------------------- /gbdk-lib/libc/gb/get_wi_t.s: -------------------------------------------------------------------------------- 1 | .include "global.s" 2 | 3 | .globl .get_xy_wtt 4 | ;; BANKED: checked, imperfect 5 | .area _BASE 6 | 7 | _get_win_tiles:: 8 | PUSH BC 9 | 10 | LDA HL,4(SP) ; Skip return address and registers 11 | LD D,(HL) ; D = x 12 | INC HL 13 | LD E,(HL) ; E = y 14 | LDA HL,9(SP) 15 | LD B,(HL) ; BC = tiles 16 | DEC HL 17 | LD C,(HL) 18 | DEC HL 19 | LD A,(HL-) ; A = h 20 | LD H,(HL) ; H = w 21 | LD L,A ; L = h 22 | 23 | CALL .get_xy_wtt 24 | 25 | POP BC 26 | RET 27 | -------------------------------------------------------------------------------- /gbdk-lib/examples/gb/colorbar/bar_m.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | BAR_M.H 4 | 5 | Map Include File. 6 | 7 | Info: 8 | Section : 9 | Bank : 0 10 | Map size : 20 x 18 11 | Tile set : C:\SDK\gb-gb\tmp\bar_c.gbr 12 | Plane count : 1 plane (8 bits) 13 | Plane order : Tiles are continues 14 | 15 | This file was generated by GBMB v0.8 16 | 17 | */ 18 | 19 | #define bar_mWidth 20 20 | #define bar_mHeight 18 21 | 22 | extern unsigned char bar_m[]; 23 | 24 | /* End of BAR_M.H */ 25 | -------------------------------------------------------------------------------- /gbdk-lib/libc/gb/set_wi_t.s: -------------------------------------------------------------------------------- 1 | .include "global.s" 2 | 3 | .globl .set_xy_wtt 4 | 5 | ;; BANKED: checked, imperfect 6 | .area _BASE 7 | 8 | _set_win_tiles:: 9 | PUSH BC 10 | 11 | LDA HL,4(SP) ; Skip return address and registers 12 | LD D,(HL) ; D = x 13 | INC HL 14 | LD E,(HL) ; E = y 15 | LDA HL,9(SP) 16 | LD B,(HL) ; BC = tiles 17 | DEC HL 18 | LD C,(HL) 19 | DEC HL 20 | LD A,(HL-) ; A = h 21 | LD H,(HL) ; H = w 22 | LD L,A ; L = h 23 | 24 | CALL .set_xy_wtt 25 | 26 | POP BC 27 | RET 28 | -------------------------------------------------------------------------------- /sdcc/device/examples/ds390/clock390/Makefile: -------------------------------------------------------------------------------- 1 | CC = sdcc 2 | 3 | MFLAGS = -mds390 4 | LFLAGS = --xram-loc 0x100080 --code-loc 0x10000 -Wl-r 5 | 6 | OBJECTS = clock390.rel 7 | 8 | all: clock390.hex 9 | 10 | clean: 11 | rm -f *~ \#* *.asm *.cdb *.rel *.hex *.ihx *.lst *.map *.rst *.sym *.lnk core *.dump* 12 | 13 | clock390.hex: $(OBJECTS) 14 | $(CC) $(MFLAGS) $(LFLAGS) $(OBJECTS) 15 | packihx clock390.ihx >clock390.hex 16 | #tinitalk -c execute clock390.hex 17 | 18 | %.rel: %.c 19 | $(CC) -c $(MFLAGS) $< 20 | -------------------------------------------------------------------------------- /sdcc/src/avr/Makefile.bcc: -------------------------------------------------------------------------------- 1 | PRJDIR = ../.. 2 | 3 | # !include $(PRJDIR)/Makefile.common 4 | 5 | OBJ = gen.obj ralloc.obj main.obj 6 | LIB = port.lib 7 | 8 | !include ..\..\Bcc.inc 9 | CFLAGS = -I.. -I. -I..\.. -I..\..\support 10 | 11 | all: $(LIB) 12 | 13 | main.obj: main.c peeph.rul 14 | 15 | $(LIB): peeph.rul $(OBJ) 16 | del $(LIB) 17 | tlib /a $(LIB) +gen.obj +ralloc.obj +main.obj 18 | 19 | peeph.rul: peeph.def 20 | gawk -f ../SDCCpeeph.awk peeph.def > peeph.rul 21 | 22 | # include clean.mk 23 | -------------------------------------------------------------------------------- /sdcc/src/ds390/Makefile.bcc: -------------------------------------------------------------------------------- 1 | PRJDIR = ../.. 2 | 3 | # !include $(PRJDIR)/Makefile.common 4 | 5 | OBJ = gen.obj ralloc.obj main.obj 6 | LIB = port.lib 7 | 8 | !include ..\..\Bcc.inc 9 | CFLAGS = -I.. -I. -I..\.. -I..\..\support 10 | 11 | all: $(LIB) 12 | 13 | main.obj: main.c peeph.rul 14 | 15 | $(LIB): peeph.rul $(OBJ) 16 | del $(LIB) 17 | tlib /a $(LIB) +gen.obj +ralloc.obj +main.obj 18 | 19 | peeph.rul: peeph.def 20 | gawk -f ../SDCCpeeph.awk peeph.def > peeph.rul 21 | 22 | # include clean.mk 23 | -------------------------------------------------------------------------------- /sdcc/src/mcs51/Makefile.bcc: -------------------------------------------------------------------------------- 1 | PRJDIR = ../.. 2 | 3 | # !include $(PRJDIR)/Makefile.common 4 | 5 | OBJ = gen.obj ralloc.obj main.obj 6 | LIB = port.lib 7 | 8 | !include ..\..\Bcc.inc 9 | CFLAGS = -I.. -I. -I..\.. -I..\..\support 10 | 11 | all: $(LIB) 12 | 13 | main.obj: main.c peeph.rul 14 | 15 | $(LIB): peeph.rul $(OBJ) 16 | del $(LIB) 17 | tlib /a $(LIB) +gen.obj +ralloc.obj +main.obj 18 | 19 | peeph.rul: peeph.def 20 | gawk -f ../SDCCpeeph.awk peeph.def > peeph.rul 21 | 22 | # include clean.mk 23 | -------------------------------------------------------------------------------- /gbdk-lib/libc/atol.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | long atol(const char *s) NONBANKED 5 | { 6 | UINT8 i, sign = 0; 7 | long n; 8 | 9 | for(i = 0; (s[i] == ' ') || (s[i] == '\n') || (s[i] == '\t'); ++i) 10 | ; 11 | switch(s[i]) 12 | { 13 | case '-': 14 | sign++; 15 | /* and fall through */ 16 | case '+': 17 | ++i; 18 | break; 19 | } 20 | for(n = 0; isdigit(s[i]); ++i) 21 | n = 10 * n + s[i] - '0'; 22 | return (sign == 0 ? n : -n); 23 | } 24 | -------------------------------------------------------------------------------- /sdcc/support/tests/internal/Makefile: -------------------------------------------------------------------------------- 1 | TOPDIR = ../../.. 2 | 3 | LIBSOURCE = \ 4 | $(TOPDIR)/src/SDCCutil.c \ 5 | $(TOPDIR)/src/SDCChasht.c \ 6 | $(TOPDIR)/support/Util/NewAlloc.c \ 7 | $(TOPDIR)/support/Util/SDCCerr.c \ 8 | $(TOPDIR)/src/SDCCmacro.c \ 9 | stubs.c 10 | 11 | SOURCES = testpaths.c $(LIBSOURCE) 12 | 13 | include $(TOPDIR)/Makefile.common 14 | 15 | CFLAGS += -I$(TOPDIR)/src -I$(TOPDIR)/support/Util -I$(TOPDIR) 16 | 17 | all: all-tests 18 | 19 | all-tests: $(OBJ) 20 | $(CC) -o $@ $(OBJ) 21 | 22 | -------------------------------------------------------------------------------- /sdcc/device/examples/ds390/i2c390/Makefile: -------------------------------------------------------------------------------- 1 | CC = sdcc 2 | 3 | MFLAGS = -mds390 4 | LFLAGS = --xram-loc 0x100080 --code-loc 0x10000 -Wl-r 5 | 6 | OBJECTS = i2c390.rel ds1621.rel pcf8591.rel 7 | 8 | all: i2c390.hex 9 | 10 | clean: 11 | rm -f *~ \#* *.asm *.cdb *.rel *.hex *.ihx *.lst *.map *.rst *.sym *.lnk core *.dump* 12 | 13 | i2c390.hex: $(OBJECTS) 14 | $(CC) $(MFLAGS) $(LFLAGS) $(OBJECTS) 15 | packihx i2c390.ihx >i2c390.hex 16 | #tinitalk -c execute i2c390.hex 17 | 18 | %.rel: %.c 19 | $(CC) -c $(MFLAGS) $< 20 | -------------------------------------------------------------------------------- /sdcc/device/examples/ds390/readmac/Makefile: -------------------------------------------------------------------------------- 1 | CC = sdcc 2 | 3 | MFLAGS = -mds390 4 | LFLAGS = --xram-loc 0x180080 --code-loc 0x10000 -Wl-r 5 | 6 | OBJECTS = readmac.rel ow.rel crcutil.rel 7 | 8 | all: readmac.hex 9 | 10 | clean: 11 | rm -f *~ \#* *.asm *.cdb *.rel *.hex *.ihx *.lst *.map *.rst *.sym *.lnk core *.dump* 12 | 13 | readmac.hex: readmac.ihx 14 | packihx readmac.ihx >readmac.hex 15 | 16 | readmac.ihx: $(OBJECTS) 17 | $(CC) $(MFLAGS) $(LFLAGS) $(OBJECTS) 18 | 19 | %.rel: %.c 20 | $(CC) -c $(MFLAGS) $< 21 | -------------------------------------------------------------------------------- /sdcc/link/Makefile: -------------------------------------------------------------------------------- 1 | PRJDIR = .. 2 | 3 | include $(PRJDIR)/Makefile.common 4 | 5 | PORTS = z80 gbz80 6 | 7 | all: 8 | $(MAKE) -C z80 _link-z80 _link-gbz80 E=$(E) BUILDDIR=../../bin/ 9 | 10 | install: all 11 | $(INSTALL) $(PRJDIR)/bin/link-z80 `echo $(bindir)/link-z80|sed '$(transform)'` 12 | $(STRIP) `echo $(bindir)/link-z80|sed '$(transform)'` 13 | $(INSTALL) $(PRJDIR)/bin/link-gbz80 `echo $(bindir)/link-gbz80|sed '$(transform)'` 14 | $(STRIP) `echo $(bindir)/link-gbz80|sed '$(transform)'` 15 | 16 | include clean.mk 17 | -------------------------------------------------------------------------------- /maccer/test-1.ms: -------------------------------------------------------------------------------- 1 | .area _CODE 2 | 1$: 3 | _main:: 4 | load16 .label,0x1234 5 | ret 6 | 7 | 8 | INCBIN "test-1.S" ; Include a binary file 9 | ; Comment 10 | 11 | load16 MACRO address,val 12 | ld a,#val 15 | ld (address+1),a 16 | ENDM 17 | 18 | comment MACRO comm 19 | .ascii comm 20 | ENDM 21 | 22 | writeato MACRO address 23 | ld (address),a 24 | ENDM 25 | 26 | writenumto MACRO addr,val 27 | ld a,#val 28 | writeato addr 29 | ENDM 30 | 31 | .area _BSS 32 | .label: 33 | .ds 2 34 | -------------------------------------------------------------------------------- /sdcc/support/regression/tests/pow2shifts.c: -------------------------------------------------------------------------------- 1 | /* Test power of 2 based shifts. 2 | sign: signed, unsigned 3 | */ 4 | #include 5 | 6 | void 7 | testIntShift(void) 8 | { 9 | volatile {sign} int left; 10 | 11 | left = 4; 12 | ASSERT(left * 1024 == 4096); 13 | ASSERT(left * 2048 == 8192); 14 | ASSERT(left * 256 == 1024); 15 | ASSERT(left * 64 == 256); 16 | 17 | left = 4096; 18 | ASSERT(left / 1024 == 4); 19 | ASSERT(left / 2048 == 2); 20 | ASSERT(left / 256 == 16); 21 | ASSERT(left / 4 == 1024); 22 | } 23 | -------------------------------------------------------------------------------- /sdcc/support/regression/tests/uminus.c: -------------------------------------------------------------------------------- 1 | /* Test unary minus 2 | 3 | lefttype: int, char, short, long 4 | resulttype: int, char, short, long 5 | storage: static, 6 | attr: volatile, 7 | */ 8 | #include 9 | 10 | void 11 | testUMinus(void) 12 | { 13 | {storage} {attr} {lefttype} left; 14 | {storage} {attr} {resulttype} result; 15 | 16 | left = 53; 17 | result = -left; 18 | 19 | ASSERT(result == -53); 20 | 21 | left = -76; 22 | result = -left; 23 | 24 | ASSERT(result == 76); 25 | } 26 | 27 | -------------------------------------------------------------------------------- /sdcc/support/tests/dhrystone/tini.mak: -------------------------------------------------------------------------------- 1 | CC = sdcc 2 | 3 | MFLAGS = -mds390 --model-flat24 --stack-10bit 4 | MFLAGS += -DREG= -DNOSTRUCTASSIGN -DNOENUM 5 | LFLAGS = --xram-loc 0x100080 --code-loc 0x10000 -Wl-r 6 | 7 | OBJECTS = dhry.rel 8 | 9 | all: dhry.hex 10 | 11 | clean: 12 | rm -f *~ \#* *.asm *.cdb *.rel *.hex *.ihx *.lst *.map *.rst *.sym *.lnk 13 | 14 | dhry.hex: dhry.ihx 15 | packihx dhry.ihx >dhry.hex 16 | 17 | dhry.ihx: $(OBJECTS) 18 | $(CC) $(MFLAGS) $(LFLAGS) $(OBJECTS) 19 | 20 | %.rel: %.c 21 | $(CC) -c $(MFLAGS) $< 22 | -------------------------------------------------------------------------------- /gbdk-lib/libc/atoi.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int atoi(const char *s) NONBANKED 6 | { 7 | UINT8 i, sign = 0; 8 | INT8 n; 9 | 10 | for(i = 0; (s[i] == ' ') || (s[i] == '\n') || (s[i] == '\t'); ++i) 11 | ; 12 | switch(s[i]) 13 | { 14 | case '-': 15 | sign++; 16 | /* and fall through */ 17 | case '+': 18 | ++i; 19 | break; 20 | } 21 | for(n = 0; isdigit(s[i]); ++i) 22 | n = 10 * n + s[i] - '0'; 23 | return (sign == 0 ? n : -n); 24 | } 25 | -------------------------------------------------------------------------------- /gbdk-lib/libc/Makefile.rules: -------------------------------------------------------------------------------- 1 | # Maccer rule 2 | MACCERDIR = ../../../maccer 3 | 4 | %.s: %.ms 5 | $(MACCERDIR)/maccer -o $@ $< 6 | 7 | ifeq ($(MODEL),small) 8 | NEAR_CALLS = 1 9 | else 10 | NEAR_CALLS = 0 11 | endif 12 | 13 | include $(TOPDIR)/libc/rules-$(ASM).mk 14 | 15 | clean: 16 | rm -f $(OBJ) $(CLEANSPEC) 17 | 18 | set-model: 19 | if [ -e global.s ]; then \ 20 | sed -e "s/.NEAR_CALLS\W=\W[0-9]\+/.NEAR_CALLS = $(NEAR_CALLS)/" global.s > tmp1.txt ;\ 21 | mv tmp1.txt global.s; \ 22 | fi 23 | 24 | build-dir: 25 | mkdir -p $(BUILD) 26 | -------------------------------------------------------------------------------- /sdcc/as/z80/z80ext.c: -------------------------------------------------------------------------------- 1 | /* z80ext.c */ 2 | 3 | /* 4 | * (C) Copyright 1989-1995 5 | * All Rights Reserved 6 | * 7 | * Alan R. Baldwin 8 | * 721 Berkeley St. 9 | * Kent, Ohio 44240 10 | */ 11 | 12 | /* 13 | * Extensions: P. Felber 14 | */ 15 | 16 | #include 17 | #include 18 | #include "asm.h" 19 | #include "z80.h" 20 | 21 | #ifndef GAMEBOY 22 | char *cpu = "Zilog Z80 / Hitachi HD64180"; 23 | #else /* GAMEBOY */ 24 | char *cpu = "GameBoy Z80-like CPU"; 25 | #endif /* GAMEBOY */ 26 | int hilo = 0; 27 | char *dsft = "ASM"; 28 | -------------------------------------------------------------------------------- /sdcc/support/regression/tests/bug-460010.c: -------------------------------------------------------------------------------- 1 | /* bug 460010 2 | */ 3 | #include 4 | 5 | #ifdef __mcs51 6 | #define XDATA xdata 7 | #else 8 | #define XDATA 9 | #endif 10 | 11 | void 12 | func( unsigned char a ) 13 | { 14 | UNUSED(a); 15 | } 16 | 17 | void 18 | testBadPromotion(void) 19 | { 20 | unsigned char c=*((unsigned XDATA char*)(0xa000)); 21 | 22 | func(c); 23 | 24 | c+='0'; /* is evaluated as an 8-bit expr */ 25 | 26 | func(c); 27 | 28 | c+='A'-'0'; /* is a 16-bit expr ??? */ 29 | 30 | func(c); 31 | } 32 | -------------------------------------------------------------------------------- /gbdk-lib/libc/gb/get_spr.s: -------------------------------------------------------------------------------- 1 | .include "global.s" 2 | 3 | ;; BANKED: checked, imperfect 4 | .area _BASE 5 | 6 | ;; Get tile of sprite number C 7 | .get_sprite_tile:: 8 | LD HL,#.OAM+2 ; Calculate origin of sprite info 9 | 10 | SLA C ; Multiply C by 4 11 | SLA C 12 | LD B,#0x00 13 | ADD HL,BC 14 | 15 | LD A,(HL) ; Get sprite number 16 | LD E,A 17 | RET 18 | 19 | _get_sprite_tile:: 20 | PUSH BC 21 | 22 | LDA HL,4(SP) ; Skip return address and registers 23 | LD C,(HL) ; C = nb 24 | 25 | CALL .get_sprite_tile 26 | 27 | POP BC 28 | RET 29 | -------------------------------------------------------------------------------- /gbdk-lib/libc/gb/get_prop.s: -------------------------------------------------------------------------------- 1 | .include "global.s" 2 | ;; BANKED: checked, imperfect 3 | .area _BASE 4 | 5 | ;; Get properties of sprite number C 6 | .get_sprite_prop:: 7 | LD HL,#.OAM+3 ; Calculate origin of sprite info 8 | 9 | SLA C ; Multiply C by 4 10 | SLA C 11 | LD B,#0x00 12 | ADD HL,BC 13 | 14 | LD A,(HL) ; Get sprite properties 15 | LD E,A 16 | RET 17 | 18 | _get_sprite_prop:: 19 | PUSH BC 20 | 21 | LDA HL,4(SP) ; Skip return address and registers 22 | LD C,(HL) ; C = nb 23 | 24 | CALL .get_sprite_prop 25 | 26 | POP BC 27 | RET 28 | -------------------------------------------------------------------------------- /gbdk-lib/libc/rules-rgbds.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(ASM),rgbds) 2 | CFLAGS += --asm=rgbds 3 | # Override the default rule 4 | %.o: %.s 5 | 6 | $(LIB): pre $(OBJ) $(CRT0) 7 | mkdir -p $(BUILD) 8 | ifneq ($(LIB_APPEND), 1) 9 | rm -f $(LIB) 10 | endif 11 | xlib $(LIB) a $(OBJ) 12 | ifdef CRT0 13 | cp -f $(CRT0) $(BUILD) 14 | endif 15 | 16 | pre: set-model 17 | -astorgb.pl global.s > global.asm 18 | 19 | %.o: %.c 20 | $(CC) $(CFLAGS) -c $< 21 | 22 | %.asm: %.s 23 | astorgb.pl $< > $@ 24 | 25 | %.o: %.rasm 26 | rgbasm -o$@ $< 27 | 28 | %.o: %.asm 29 | rgbasm -o$@ $< 30 | 31 | -------------------------------------------------------------------------------- /sdcc/support/regression/tests/stacks.c: -------------------------------------------------------------------------------- 1 | /* 2 | size: 126, 127, 128, 129 3 | */ 4 | #include 5 | 6 | void 7 | spoil(char a) 8 | { 9 | UNUSED(a); 10 | } 11 | 12 | void 13 | spoilPtr(volatile char *p) 14 | { 15 | UNUSED(p); 16 | } 17 | 18 | void 19 | testStack(void) 20 | { 21 | volatile char above; 22 | volatile char above2; 23 | volatile char ac[{size}]; 24 | volatile char below; 25 | volatile char * volatile p; 26 | 27 | spoil(ac[0]); 28 | spoilPtr(&above); 29 | spoilPtr(&below); 30 | 31 | p = &above2; 32 | spoilPtr(p); 33 | } 34 | -------------------------------------------------------------------------------- /sdcc/src/z80/z80.h: -------------------------------------------------------------------------------- 1 | /** @file z80/z80.h 2 | Common definitions between the z80 and gbz80 parts. 3 | */ 4 | #include "common.h" 5 | #include "ralloc.h" 6 | #include "support.h" 7 | 8 | typedef enum 9 | { 10 | SUB_Z80, 11 | SUB_GBZ80 12 | } 13 | Z80_SUB_PORT; 14 | 15 | typedef struct 16 | { 17 | Z80_SUB_PORT sub; 18 | } 19 | Z80_OPTS; 20 | 21 | extern Z80_OPTS z80_opts; 22 | 23 | #define IS_GB (z80_opts.sub == SUB_GBZ80) 24 | #define IS_Z80 (z80_opts.sub == SUB_Z80) 25 | 26 | enum 27 | { 28 | ACCUSE_A = 1, 29 | ACCUSE_SCRATCH 30 | }; 31 | -------------------------------------------------------------------------------- /gbdk-lib/examples/gb/colorbar/Makefile: -------------------------------------------------------------------------------- 1 | CC = ../../../bin/lcc -Wa-l -Wl-m 2 | 3 | CFLAGS = -DGBDK_2_COMPAT 4 | 5 | BINS = colorbar.gb 6 | 7 | all: $(BINS) 8 | 9 | %.o: %.c 10 | $(CC) $(CFLAGS) -c -o $@ $< 11 | 12 | %.o: %.s 13 | $(CC) $(CFLAGS) -c -o $@ $< 14 | 15 | %.s: %.c 16 | $(CC) $(CFLAGS) -S -o $@ $< 17 | 18 | %.gb: %.o 19 | $(CC) $(CFLAGS) -o $@ $< 20 | 21 | clean: 22 | rm -f *.o *.lst *.map *.gb 23 | 24 | # Link file, and write 0x80 at position 0x143 in header 25 | colorbar.gb: colorbar.o 26 | $(CC) $(CFLAGS) -Wl-yp0x143=0x80 -o colorbar.gb colorbar.o 27 | -------------------------------------------------------------------------------- /sdcc/support/regression/tests/bug-227710.c: -------------------------------------------------------------------------------- 1 | /* bug-227710.c 2 | */ 3 | #include 4 | 5 | static unsigned char __data[] = { 6 | 1, 2, 3, 4 7 | }; 8 | 9 | unsigned char *p; 10 | 11 | struct { 12 | unsigned char index; 13 | } s; 14 | 15 | unsigned char 16 | foo(void) 17 | { 18 | // BUG, there will be a PRE-increment 19 | return p[s.index++]; 20 | } 21 | 22 | void 23 | testPostIncrement(void) 24 | { 25 | p = __data; 26 | ASSERT(foo() == 1); 27 | ASSERT(foo() == 2); 28 | ASSERT(foo() == 3); 29 | ASSERT(foo() == 4); 30 | } 31 | -------------------------------------------------------------------------------- /sdcc/device/include/asm/gbz80/features.h: -------------------------------------------------------------------------------- 1 | /** Z80 specific features. 2 | */ 3 | #ifndef __SDC51_ASM_Z80_FEATURES_H 4 | #define __SDC51_ASM_Z80_FEATURES_H 1 5 | 6 | #define _REENTRANT 7 | #define _CODE 8 | 9 | #define _SDCC_MANGLES_SUPPORT_FUNS 1 10 | #define _SDCC_Z80_STYLE_LIB_OPT 1 11 | 12 | /* The following are disabled to make the dhrystone test more authentic. 13 | */ 14 | #define _SDCC_PORT_PROVIDES_MEMCPY 0 15 | #define _SDCC_PORT_PROVIDES_STRCMP 0 16 | /* Register allocator is as good as hand coded asm. Cool. */ 17 | #define _SDCC_PORT_PROVIDES_STRCPY 0 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /sdcc/device/include/asm/z80/features.h: -------------------------------------------------------------------------------- 1 | /** Z80 specific features. 2 | */ 3 | #ifndef __SDC51_ASM_Z80_FEATURES_H 4 | #define __SDC51_ASM_Z80_FEATURES_H 1 5 | 6 | #define _REENTRANT 7 | #define _CODE 8 | 9 | #define _SDCC_MANGLES_SUPPORT_FUNS 1 10 | #define _SDCC_Z80_STYLE_LIB_OPT 1 11 | 12 | /* The following are disabled to make the dhrystone test more authentic. 13 | */ 14 | #define _SDCC_PORT_PROVIDES_MEMCPY 0 15 | #define _SDCC_PORT_PROVIDES_STRCMP 0 16 | /* Register allocator is as good as hand coded asm. Cool. */ 17 | #define _SDCC_PORT_PROVIDES_STRCPY 0 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /sdcc/device/examples/ds390/i2c390/pcf8591.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "pcf8591.h" 4 | 5 | unsigned char ReadPCF8591(char address, char channel) { 6 | 7 | unsigned char id=PCF8591_ID+(address<<1); 8 | 9 | while (!I2CReset()) { 10 | //fprintf (stderr, "I2C bus busy, retrying.\n"); 11 | } 12 | 13 | // set output enable, no autoincrement 14 | i2cTransmitBuffer[0]=(channel&0x03)+0x40; 15 | 16 | // read 2 bytes, since the first one is the old value 17 | if (I2CSendReceive(id, 1, 2)) 18 | return 0; 19 | 20 | return i2cReceiveBuffer[1]; 21 | } 22 | 23 | -------------------------------------------------------------------------------- /gbdk-lib/libc/gb/set_spr.s: -------------------------------------------------------------------------------- 1 | .include "global.s" 2 | 3 | ;; BANKED: checked, imperfect 4 | .area _BASE 5 | 6 | ;; Set sprite number C to tile D 7 | .set_sprite_tile:: 8 | LD HL,#.OAM+2 ; Calculate origin of sprite info 9 | 10 | SLA C ; Multiply C by 4 11 | SLA C 12 | LD B,#0x00 13 | ADD HL,BC 14 | 15 | LD A,D ; Set sprite number 16 | LD (HL),A 17 | RET 18 | 19 | _set_sprite_tile:: 20 | PUSH BC 21 | 22 | LDA HL,4(SP) ; Skip return address and registers 23 | LD C,(HL) ; C = nb 24 | INC HL 25 | LD D,(HL) ; D = tile 26 | 27 | CALL .set_sprite_tile 28 | 29 | POP BC 30 | RET 31 | -------------------------------------------------------------------------------- /sdcc/device/lib/gbz80/Makefile: -------------------------------------------------------------------------------- 1 | # libc/z80 Makefile 2 | 3 | TOPDIR = ../../.. 4 | 5 | SCC = $(TOPDIR)/bin/sdcc -mgbz80 6 | SAS = $(TOPDIR)/bin/as-gbz80 7 | 8 | OBJ = div.o mul.o putchar.o printf.o shift.o stubs.o crt0_rle.o 9 | 10 | LIB = gbz80.lib 11 | CC = $(SCC) 12 | AS = $(SAS) 13 | CFLAGS = -I../../include -I. 14 | 15 | all: $(LIB) crt0.o 16 | 17 | $(LIB): $(OBJ) Makefile _dummy 18 | rm -f $(LIB) 19 | for i in $(OBJ); do echo $$i >> $(LIB); done 20 | 21 | .c.o: 22 | $(CC) $(CFLAGS) -c $< 23 | 24 | _dummy: 25 | 26 | clean: 27 | rm -f *.o *.sym *.lst *~ $(CLEANSPEC) *.dump* *.asm *.lib 28 | -------------------------------------------------------------------------------- /sdcc/device/examples/startupcode/src/startup_code.c: -------------------------------------------------------------------------------- 1 | // INCLUDES & DEFINES =============================================== 2 | 3 | #define __FILE_STARTUP_CODE_C 4 | // All that has to be included and / or defined is done here 5 | 6 | #include "../inc/startup_code.h" 7 | 8 | // END INCLUDES & DEFINES =========================================== 9 | 10 | void main() 11 | { 12 | // Init Hardware muss als erstes erfolgen 13 | InitHardware(); 14 | 15 | printf( "\n\rSoftware vom : "); 16 | printf( __DATE__ ); 17 | printf(" "); 18 | printf( __TIME__ ); 19 | 20 | while( 1 ); 21 | } 22 | -------------------------------------------------------------------------------- /gbdk-lib/libc/gb/set_prop.s: -------------------------------------------------------------------------------- 1 | .include "global.s" 2 | 3 | ;; BANKED: checked, imperfect 4 | .area _BASE 5 | 6 | ;; Set properties of sprite number C to D 7 | .set_sprite_prop:: 8 | LD HL,#.OAM+3 ; Calculate origin of sprite info 9 | 10 | SLA C ; Multiply C by 4 11 | SLA C 12 | LD B,#0x00 13 | ADD HL,BC 14 | 15 | LD A,D ; Set sprite properties 16 | LD (HL),A 17 | RET 18 | 19 | _set_sprite_prop:: 20 | PUSH BC 21 | 22 | LDA HL,4(SP) ; Skip return address and registers 23 | LD C,(HL) ; C = nb 24 | INC HL 25 | LD D,(HL) ; D = prop 26 | 27 | CALL .set_sprite_prop 28 | 29 | POP BC 30 | RET 31 | -------------------------------------------------------------------------------- /sdcc/device/lib/libsdcc.lib: -------------------------------------------------------------------------------- 1 | _iscntrl 2 | _isdigit 3 | _isgraph 4 | _islower 5 | _isprint 6 | _ispunct 7 | _isspace 8 | _isupper 9 | _isxdigit 10 | _strchr 11 | _strcmp 12 | _strcpy 13 | _strcspn 14 | _strlen 15 | _strcat 16 | _strncat 17 | _strncmp 18 | _strncpy 19 | _strpbrk 20 | _strrchr 21 | _strspn 22 | _strstr 23 | _strtok 24 | _memcmp 25 | _memcpy 26 | _memset 27 | _gptrget 28 | _gptrput 29 | _decdptr 30 | _bp 31 | _spx 32 | _atoi 33 | _atol 34 | malloc 35 | serial 36 | _autobaud 37 | _startup 38 | _ser 39 | puts 40 | gets 41 | printfl 42 | printf_large 43 | printf_fast 44 | vprintf 45 | assert 46 | time 47 | -------------------------------------------------------------------------------- /sdcc/sim/ucsim/doc/wins.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Simulator for MCS51 4 | 5 | 6 | 7 | 8 |

Software simulator for MCS51

9 | 10 | This screenshot demonstrates some kind of windows that can be opened 11 | using commands in View menu. Every windows including CPU window 12 | can be resized and moved on the desktop area. Every windows are active 13 | which means that value of displayed data can be changed at any time 14 | including execution of the simulated program. 15 | 16 |

17 | 18 |


19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /sdcc/src/izt/Makefile.bcc: -------------------------------------------------------------------------------- 1 | PRJDIR = ../.. 2 | 3 | # !include $(PRJDIR)/Makefile.common 4 | 5 | OBJ = i186.obj ralloc.obj gen.obj tlcs900h.obj gen_generic.obj aop.obj util.obj 6 | LIB = port.lib 7 | 8 | !include ..\..\Bcc.inc 9 | CFLAGS = -I.. -I. -I..\.. -I..\..\support 10 | 11 | all: $(LIB) 12 | 13 | i186.obj: i186.c i186_mappings.i 14 | 15 | $(LIB): $(OBJ) 16 | del $(LIB) 17 | tlib /a $(LIB) +i186.obj +ralloc.obj +gen.obj +tlcs900h.obj 18 | tlib /a $(LIB) +gen_generic.obj +aop.obj +util.obj 19 | 20 | .def.rul: 21 | gawk -f ../SDCCpeeph.awk $< > $@ 22 | 23 | # include clean.mk 24 | -------------------------------------------------------------------------------- /sdcc/tinitalk/tinitalk.h: -------------------------------------------------------------------------------- 1 | extern char *globalStringSpace; 2 | 3 | extern int TiniOpen(char *argPort, int argBaud); 4 | extern int TiniBaudRate(int baud); 5 | extern int TiniReset(int toBootLoader); 6 | extern int TiniRead(char*, int); 7 | extern int TiniWrite(char*, int); 8 | extern int TiniWait(char promptChar); 9 | extern int TiniWriteAndWait(char *buffer, int n, char promptChar); 10 | extern void TiniFlush(void); 11 | extern void TiniDrain(void); 12 | extern void TiniConnect(int baud); 13 | extern void TiniClose(void); 14 | 15 | extern int LoadHexFile(char *path); 16 | extern int SaveHexFile(char *path); 17 | -------------------------------------------------------------------------------- /sdcc/sim/ucsim/gui.src/serio.src/config.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * to emulate the serial input and output of an 8051 controller * 3 | * config.h - general defintions * 4 | ******************************************************************************/ 5 | 6 | #ifndef DEF_INFILE 7 | // the processors serial output 8 | #define DEF_INFILE "/tmp/out" 9 | #endif 10 | 11 | #ifndef DEF_OUTFILE 12 | // the processors serial input 13 | #define DEF_OUTFILE "/tmp/in" 14 | #endif 15 | 16 | #define MAX_SIZ 1024 17 | -------------------------------------------------------------------------------- /sdcc/support/regression/tests/bug-441448.c: -------------------------------------------------------------------------------- 1 | /* bug-441448.c 2 | PENDING 3 | */ 4 | #include 5 | 6 | #define DATA 7 | 8 | typedef struct 9 | { 10 | unsigned char buffer[0x18]; 11 | unsigned char OutPtr, InPtr; 12 | unsigned char Count; 13 | } Fifo; 14 | 15 | DATA Fifo TxFifo={"ABCD", 0, 0, 0}, RxFifo={"FGHI", 0, 0, 0}; 16 | DATA unsigned char dummy1, dummy2; 17 | 18 | void 19 | testPrePostIncrement(void) 20 | { 21 | dummy2 = TxFifo.buffer[++TxFifo.OutPtr]; 22 | dummy1 = RxFifo.buffer[RxFifo.OutPtr++]; 23 | 24 | ASSERT(dummy2 == 'B'); 25 | ASSERT(dummy1 == 'F'); 26 | } 27 | -------------------------------------------------------------------------------- /gbdk-lib/include/asm/gbz80/stdarg.h: -------------------------------------------------------------------------------- 1 | #ifndef ASM_GBZ80_STDARG_INCLUDE 2 | #define ASM_GBZ80_STDARG_INCLUDE 3 | 4 | /* sdcc pushes right to left with the real sizes, not cast up 5 | to an int. 6 | so printf(int, char, long) 7 | results in push long, push char, push int 8 | On the z80 the stack grows down, so the things seem to be in 9 | the correct order. 10 | */ 11 | 12 | typedef unsigned char * va_list; 13 | #define va_start(list, last) list = (unsigned char *)&last + sizeof(last) 14 | #define va_arg(list, type) *((type *)((list += sizeof(type)) - sizeof(type))) 15 | 16 | #define va_end(list) 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /gbdk-lib/include/gb/sample.h: -------------------------------------------------------------------------------- 1 | /** @file gb/sample.h 2 | Playback raw sound sample with length len from start at 8192Hz rate. 3 | len defines the length of the sample in samples/32 or bytes/16. 4 | The format of the data is unsigned 4-bit samples, 5 | 2 samples per byte, upper 4-bits played before lower 4 bits. 6 | 7 | Adaption for GBDK by Lars Malmborg. 8 | Original code by Jeff Frohwein. 9 | */ 10 | #ifndef _SAMPLE_H 11 | #define _SAMPLE_H 12 | 13 | /** Play the given, appropriatly formatted sample. 14 | */ 15 | void 16 | play_sample(UINT8 *start, UINT16 len) NONBANKED; 17 | 18 | #endif /* _SAMPLE_H */ 19 | -------------------------------------------------------------------------------- /sdcc/support/regression/tests/scott-for.c: -------------------------------------------------------------------------------- 1 | /* 2 | */ 3 | #include 4 | 5 | unsigned int aint0 = 0; 6 | unsigned int aint1 = 0; 7 | unsigned char achar0 = 0; 8 | unsigned char achar1 = 0; 9 | 10 | unsigned char call3(void); 11 | 12 | void for1(void) 13 | { 14 | unsigned char i=0; 15 | 16 | for(i=0; i<10; i++) 17 | achar0++; 18 | 19 | ASSERT(!(achar0 != 10)); 20 | 21 | } 22 | 23 | void for2(void) 24 | { 25 | unsigned char i=0; 26 | 27 | for(i=0; i<10; i++) 28 | achar0++; 29 | 30 | ASSERT(!(i < 10)); 31 | 32 | } 33 | 34 | void 35 | testFor(void) 36 | { 37 | for1(); 38 | for2(); 39 | } 40 | -------------------------------------------------------------------------------- /gbdk-lib/libc/gb/mv_spr.s: -------------------------------------------------------------------------------- 1 | .include "global.s" 2 | 3 | ;; BANKED: checked 4 | .area _BASE 5 | 6 | ;; Move sprite number C at XY = DE 7 | .mv_sprite:: 8 | LD HL,#.OAM ; Calculate origin of sprite info 9 | SLA C ; Multiply C by 4 10 | SLA C 11 | LD B,#0x00 12 | ADD HL,BC 13 | 14 | LD A,E ; Set Y 15 | LD (HL+),A 16 | 17 | LD A,D ; Set X 18 | LD (HL+),A 19 | RET 20 | 21 | _move_sprite:: 22 | PUSH BC 23 | 24 | LDA HL,4(SP) ; Skip return address and registers 25 | LD C,(HL) ; C = nb 26 | INC HL 27 | LD D,(HL) ; D = x 28 | INC HL 29 | LD E,(HL) ; E = y 30 | 31 | CALL .mv_sprite 32 | 33 | POP BC 34 | RET 35 | -------------------------------------------------------------------------------- /sdcc/support/regression/ports/host/spec.mk: -------------------------------------------------------------------------------- 1 | # Port specification for compiling on the host machines version of gcc 2 | SDCC = gcc 3 | SDCCFLAGS = -Wall -fsigned-char -DREENTRANT= 4 | 5 | EXEEXT = .bin 6 | 7 | # Required extras 8 | EXTRAS = fwk/lib/testfwk$(OBJEXT) ports/$(PORT)/support$(OBJEXT) 9 | 10 | %.out: %$(EXEEXT) 11 | mkdir -p `dirname $@` 12 | -$< > $@ 13 | -grep -n FAIL $@ /dev/null || true 14 | 15 | %$(EXEEXT): %$(OBJEXT) $(EXTRAS) 16 | $(SDCC) $(SDCCFLAGS) -o $@ $< $(EXTRAS) 17 | 18 | %$(OBJEXT): %.c fwk/include/*.h 19 | $(SDCC) $(SDCCFLAGS) -c $< -o $@ 20 | 21 | _clean: 22 | rm -f ports/$(PORT)/support.o 23 | 24 | -------------------------------------------------------------------------------- /sdcc/sim/ucsim/doc/timers.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Simulator for MCS51 4 | 5 | 6 | 7 | 8 |

Software simulator for MCS51

9 | 10 | This screenshot demonstrates timer/counter window. The window displays 11 | value of the timer and control bits related to the timer/counter 12 | unit. Different windows can be opened to display information about 13 | different timers. Note that Timer2 of 8X52 is not implemented. Value 14 | of the timer or control bits can be changed using these windows or SFR 15 | window. 16 | 17 |

18 | 19 |


20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /sdcc/device/lib/gets.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | char * gets(const char *str) { 4 | char *s=str; 5 | char c; 6 | unsigned int count=0; 7 | 8 | while (1) { 9 | c=getchar(); 10 | switch(c) { 11 | case '\b': // backspace 12 | if (count) { 13 | putchar ('\b'); 14 | putchar (' '); 15 | putchar ('\b'); 16 | s--; 17 | count--; 18 | } 19 | break; 20 | case '\n': 21 | case '\r': // CR or LF 22 | putchar('\r'); 23 | putchar('\n'); 24 | *s=0; 25 | return str; 26 | default: 27 | *s++=c; 28 | count++; 29 | putchar(c); 30 | break; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /sdcc/device/examples/mcs51/clock/Makefile: -------------------------------------------------------------------------------- 1 | CC = sdcc 2 | #CFLAGS = -V 3 | MFLAGS = --model-small --stack-after-data 4 | #MFLAGS = --model-large --stack-after-data 5 | LFLAGS = --xram-loc 0x4000 --code-loc 0x0000 6 | 7 | all: clock.bin 8 | 9 | OBJECTS = clock.rel hwinit.rel 10 | 11 | clock.bin: clock.ihx 12 | hex2bin clock.bin 13 | cat clock.bin >/dev/par0 14 | cu -l /dev/ttyS0 -s 19200 dir 15 | 16 | clock.ihx: $(OBJECTS) 17 | $(CC) $(MFLAGS) $(LFLAGS) $(OBJECTS) 18 | 19 | clean: 20 | rm -f core *~ \#* *.asm *.cdb *.rel *.hex *.ihx *.lst *.map \ 21 | *.rst *.sym *.lnk *.lib *.bin 22 | 23 | %.rel: %.c hw.h 24 | $(CC) -c $(CFLAGS) $(MFLAGS) $< 25 | -------------------------------------------------------------------------------- /sdcc/sim/ucsim/s51.src/test_idlepd.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | sfr at 0xa6 WDTRST; 4 | 5 | void jaj_ex0() interrupt 0 { P2= P0; } 6 | 7 | void jaj_t0() interrupt 1 { P2= P0; } 8 | 9 | void main() 10 | { 11 | TH0= 0x80; 12 | TL0= 0x80; 13 | TMOD= 0x02; 14 | 15 | IT0=0; /* low level triggered */ 16 | IT0=1; /* falling edge triggered */ 17 | EX0=1; /* enable ex #0 */ 18 | ET0=1; /* en t0 */ 19 | 20 | TR0= 1; 21 | 22 | EA=1; 23 | P0=0; 24 | while (1) 25 | { 26 | P0= 0; 27 | PCON|= 1;/*idle*/ 28 | P0++; 29 | P0++; 30 | P0++; 31 | } 32 | WDTRST= 0x1e; 33 | WDTRST= 0xe1; 34 | PCON|= 2;/*pd*/ 35 | } 36 | -------------------------------------------------------------------------------- /sdcc/src/pic/Makefile.bcc: -------------------------------------------------------------------------------- 1 | PRJDIR = ../.. 2 | 3 | # !include $(PRJDIR)/Makefile.common 4 | 5 | OBJ = gen.obj genarith.obj ralloc.obj main.obj glue.obj pcode.obj pcodepeep.obj 6 | LIB = port.lib 7 | 8 | !include ..\..\Bcc.inc 9 | CFLAGS = -I.. -I. -I..\.. -I..\..\support -D__FUNCTION__=__FILE__ 10 | 11 | all: $(LIB) 12 | 13 | main.obj: main.c peeph.rul 14 | 15 | $(LIB): peeph.rul $(OBJ) 16 | del $(LIB) 17 | tlib /a $(LIB) +gen.obj +genarith.obj +ralloc.obj +main.obj +glue.obj 18 | tlib /a $(LIB) +pcode.obj +pcodepeep.obj 19 | 20 | peeph.rul: peeph.def 21 | gawk -f ../SDCCpeeph.awk peeph.def > peeph.rul 22 | 23 | # include clean.mk 24 | -------------------------------------------------------------------------------- /sdcc/device/examples/serialcomm/windows/serial.h: -------------------------------------------------------------------------------- 1 | // Flow control flags 2 | 3 | #define FC_DTRDSR 0x01 4 | #define FC_RTSCTS 0x02 5 | #define FC_XONXOFF 0x04 6 | 7 | // ascii definitions 8 | 9 | #define ASCII_BEL 0x07 10 | #define ASCII_BS 0x08 11 | #define ASCII_LF 0x0A 12 | #define ASCII_CR 0x0D 13 | #define ASCII_XON 0x11 14 | #define ASCII_XOFF 0x13 15 | 16 | 17 | HANDLE SerialInit(char*, int); 18 | 19 | char SerialGetc(HANDLE*); 20 | 21 | void SerialPutc(HANDLE*, char); 22 | 23 | char* SerialGets(HANDLE*); 24 | 25 | void SerialPuts(HANDLE*, char*); 26 | 27 | void sleep(int); 28 | -------------------------------------------------------------------------------- /sdcc/device/lib/z80/Makefile: -------------------------------------------------------------------------------- 1 | # libc/z80 Makefile 2 | 3 | TOPDIR = ../../.. 4 | 5 | SCC = $(TOPDIR)/bin/sdcc -mz80 6 | SAS = $(TOPDIR)/bin/as-z80 7 | 8 | OBJ = div.o mul.o putchar.o printf.o shift.o stubs.o crt0_rle.o 9 | 10 | LIB = z80.lib 11 | CC = $(SCC) 12 | AS = $(SAS) 13 | ASFLAGS = -plosgff 14 | 15 | CFLAGS = -I../../include -I. 16 | 17 | all: $(LIB) crt0.o 18 | 19 | $(LIB): $(OBJ) Makefile _dummy 20 | rm -f $(LIB) 21 | for i in $(OBJ); do echo $$i >> $(LIB); done 22 | 23 | .c.o: 24 | $(CC) $(CFLAGS) -c $< 25 | 26 | .s.o: 27 | $(AS) $(ASFLAGS) $@ $< 28 | 29 | _dummy: 30 | 31 | clean: 32 | rm -f *.o *.sym *.lst *~ $(CLEANSPEC) *.dump* *.asm *.lib 33 | -------------------------------------------------------------------------------- /.github/workflows/c-cpp.yml: -------------------------------------------------------------------------------- 1 | name: C/C++ CI 2 | 3 | on: 4 | push: 5 | branches: [ "main", "master" ] 6 | pull_request: 7 | branches: [ "main", "master" ] 8 | 9 | jobs: 10 | build: 11 | strategy: 12 | matrix: 13 | os: [ "ubuntu-20.04", "ubuntu-22.04", "ubuntu-24.04" ] 14 | runs-on: ${{ matrix.os }} 15 | steps: 16 | - uses: actions/checkout@v4 17 | - name: install dependencies 18 | run: sudo apt-get -y install make gcc g++ bison flex 19 | - name: make 20 | run: make 21 | - name: sudo make install 22 | run: sudo make install 23 | - name: make examples 24 | run: cd gbdk-lib/examples/gb && make 25 | -------------------------------------------------------------------------------- /gbdk-lib/libc/gb/hiramcpy.s: -------------------------------------------------------------------------------- 1 | .include "global.s" 2 | 3 | ;; BANKED: checked 4 | .area _BASE 5 | 6 | ;; Copy memory zone to HIRAM 7 | ;; 8 | ;; Entry conditions 9 | ;; C = destination 10 | ;; B = length 11 | ;; HL = source 12 | ;; 13 | ;; Register used: AF, BC, HL 14 | .hiramcpy:: 15 | 1$: 16 | LD A,(HL+) 17 | LDH (C),A 18 | INC C 19 | DEC B 20 | JR NZ,1$ 21 | RET 22 | 23 | _hiramcpy:: 24 | PUSH BC 25 | 26 | LDA HL,4(SP) ; Skip return address and registers 27 | LD C,(HL) ; C = dst 28 | LDA HL,7(SP) 29 | LD B,(HL) ; B = n 30 | DEC HL 31 | LD A,(HL-) ; HL = src 32 | LD L,(HL) 33 | LD H,A 34 | CALL .hiramcpy 35 | 36 | POP BC 37 | RET 38 | -------------------------------------------------------------------------------- /gbdk-lib/libc/gb/scroll_s.s: -------------------------------------------------------------------------------- 1 | .include "global.s" 2 | 3 | ;; BANKED: checked, imperfect 4 | .area _BASE 5 | 6 | ;; Move sprite number C at XY = DE 7 | .scroll_sprite:: 8 | LD HL,#.OAM ; Calculate origin of sprite info 9 | SLA C ; Multiply C by 4 10 | SLA C 11 | LD B,#0x00 12 | ADD HL,BC 13 | 14 | LD A,(HL) 15 | ADD E ; Set Y 16 | LD (HL+),A 17 | 18 | LD A,(HL) 19 | ADD D ; Set X 20 | LD (HL+),A 21 | RET 22 | 23 | _scroll_sprite:: 24 | PUSH BC 25 | 26 | LDA HL,4(SP) ; Skip return address and registers 27 | LD C,(HL) ; C = nb 28 | INC HL 29 | LD D,(HL) ; D = x 30 | INC HL 31 | LD E,(HL) ; E = y 32 | 33 | CALL .scroll_sprite 34 | 35 | POP BC 36 | RET 37 | -------------------------------------------------------------------------------- /gbdk-lib/include/asm/z80/stdarg.h: -------------------------------------------------------------------------------- 1 | #ifndef ASM_Z80_STDARG_INCLUDE 2 | #define ASM_Z80_STDARG_INCLUDE 3 | 4 | /* sdcc pushes right to left with the real sizes, not cast up 5 | to an int. 6 | so printf(int, char, long) 7 | results in push long, push char, push int 8 | On the z80 the stack grows down, so the things seem to be in 9 | the correct order. 10 | */ 11 | 12 | typedef char * va_list; 13 | #define va_start(list, last) list = (char *)&last + sizeof(last) 14 | #ifdef STDIO_INCLUDE 15 | #define va_arg(list, type) *(type *)list; list + sizeof(type) 16 | #else 17 | #define va_arg(list, type) (list + sizeof(type), *(type *)(list - sizeof(type))) 18 | #endif 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /sdcc/device/examples/mcs51/clock/clock.c: -------------------------------------------------------------------------------- 1 | #include <8051.h> 2 | #include 3 | 4 | #include "hw.h" 5 | 6 | void main(void) { 7 | unsigned long ms; 8 | unsigned int seconds, oldseconds=ClockTicks()/1000; 9 | 10 | printf ("Example using the core timer to generate seconds.\n"); 11 | 12 | while (1) { 13 | ms=ClockTicks(); 14 | seconds=ms/1000; 15 | if (oldseconds!=seconds) { 16 | oldseconds=seconds; 17 | printf ("%02d:%02d.%02d %ld\n", 18 | (int)seconds/3600, (int)(seconds/60)%60, 19 | (int)seconds%60, ms); 20 | } 21 | if (RI) { 22 | putchar(getchar()); 23 | printf("%ld\n\r", ClockTicks()); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /sdcc/tinitalk/tinitalk.dsw: -------------------------------------------------------------------------------- 1 | Microsoft Developer Studio Workspace File, Format Version 5.00 2 | # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! 3 | 4 | ############################################################################### 5 | 6 | Project: "tinitalk"=.\tinitalk.dsp - Package Owner=<4> 7 | 8 | Package=<5> 9 | {{{ 10 | }}} 11 | 12 | Package=<4> 13 | {{{ 14 | }}} 15 | 16 | ############################################################################### 17 | 18 | Global: 19 | 20 | Package=<5> 21 | {{{ 22 | }}} 23 | 24 | Package=<3> 25 | {{{ 26 | }}} 27 | 28 | ############################################################################### 29 | 30 | -------------------------------------------------------------------------------- /sdcc/src/regression/while.c: -------------------------------------------------------------------------------- 1 | //#include "p16c84.h" 2 | 3 | unsigned char success = 0; 4 | unsigned char failures = 0; 5 | unsigned char dummy = 0; 6 | 7 | bit bit0 = 0; 8 | unsigned int aint0 = 0; 9 | unsigned int aint1 = 0; 10 | unsigned char achar0 = 0; 11 | unsigned char achar1 = 0; 12 | 13 | 14 | void 15 | done () 16 | { 17 | 18 | dummy++; 19 | 20 | } 21 | 22 | void 23 | while1 (void) 24 | { 25 | unsigned char i = 10; 26 | 27 | do 28 | { 29 | achar0++; 30 | } 31 | while (--i); 32 | 33 | if (achar0 != 10) 34 | failures++; 35 | 36 | } 37 | 38 | 39 | void 40 | main (void) 41 | { 42 | while1 (); 43 | 44 | 45 | success = failures; 46 | done (); 47 | } 48 | -------------------------------------------------------------------------------- /gbdk-lib/include/time.h: -------------------------------------------------------------------------------- 1 | /** @file time.h 2 | Sort of ANSI compliant time functions. 3 | */ 4 | #ifndef TIME_INCLUDE 5 | #define TIME_INCLUDE 6 | 7 | #include 8 | 9 | #if SDCC_PLAT==consolez80 10 | #define CLOCKS_PER_SEC 100 11 | #else 12 | /** For now... */ 13 | #error 14 | #define CLOCKS_PER_SEC 50 15 | #endif 16 | 17 | typedef UINT16 time_t; 18 | 19 | /** The clock() function returns an approximation of processor time 20 | used by the program. The value returned is the CPU time used so far 21 | as a clock_t; to get the number of seconds used, divide by 22 | CLOCKS_PER_SEC. 23 | */ 24 | clock_t clock(void) NONBANKED; 25 | 26 | time_t time(time_t *t); 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /gbdk-lib/libc/gb/cpy_data.s: -------------------------------------------------------------------------------- 1 | .include "global.s" 2 | 3 | ;; BANKED: checked 4 | .area _BASE 5 | ;; Copy part (size = DE) of the VRAM from (BC) to (HL) 6 | .copy_vram:: 7 | 1$: 8 | LDH A,(.STAT) 9 | AND #0x02 10 | JR NZ,1$ 11 | 12 | LD A,(BC) 13 | LD (HL+),A 14 | INC BC 15 | DEC DE 16 | LD A,D 17 | OR E 18 | JR NZ,1$ 19 | RET 20 | 21 | _set_data:: 22 | _get_data:: 23 | PUSH BC 24 | 25 | LDA HL,9(SP) ; Skip return address and registers 26 | LD D,(HL) ; DE = len 27 | DEC HL 28 | LD E,(HL) 29 | DEC HL 30 | LD B,(HL) ; BC = src 31 | DEC HL 32 | LD C,(HL) 33 | DEC HL 34 | LD A,(HL-) ; HL = dst 35 | LD L,(HL) 36 | LD H,A 37 | 38 | CALL .copy_vram 39 | 40 | POP BC 41 | RET 42 | -------------------------------------------------------------------------------- /sdcc/sim/ucsim/gui.src/serio.src/fileio.hh: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * to emulate the serial input and output of an 8051 controller * 3 | * fileio.hh - file input and output * 4 | ******************************************************************************/ 5 | #include "config.h" 6 | 7 | class FileIO 8 | { 9 | public: 10 | FileIO(); 11 | FileIO(char *infile, char *outfile); 12 | ~FileIO(); 13 | 14 | int SendByte(char b); 15 | int RecvByte(char *b); 16 | int SendStr(char *str); 17 | int RecvStr(char *str); 18 | 19 | private: 20 | int fdin; 21 | int fdout; 22 | }; 23 | -------------------------------------------------------------------------------- /sdcc/support/cpp2/borland.h: -------------------------------------------------------------------------------- 1 | #ifndef CPP2_BORLAND_H_ 2 | #define CPP2_BORLAND_H_ 3 | 4 | /* Define values for Borland makefile which are detected by configure 5 | * on better behaved platforms. 6 | * 7 | * This is the equivalent of auto-host.h. 8 | */ 9 | 10 | #include "sdcc.h" 11 | 12 | #define HAVE_STRINGIZE 13 | #define STDC_HEADERS 14 | #define PACKAGE "sdcc" 15 | #define LOCALEDIR "" 16 | #define PREFIX "" 17 | #define inline 18 | #define SIZEOF_INT 4 19 | #define SIZEOF_LONG 4 20 | #define HAVE_TIME_H 1 21 | #define HAVE_STRING_H 1 22 | #define HAVE_SYS_STAT_H 1 23 | #define HAVE_STDLIB_H 1 24 | #define ssize_t int 25 | #define __STDC__ 1 26 | #define alloca(x) calloc(1,(x)) 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /sdcc/support/regression/tests/structidx.c: -------------------------------------------------------------------------------- 1 | /* Code to generate code to see how structure indexs are evaluated. 2 | Originally part of gbdk/examples/gb/paint.c 3 | 4 | */ 5 | #include 6 | 7 | typedef unsigned char UBYTE; 8 | 9 | typedef struct cursor_info_ 10 | { 11 | UBYTE data_idx; 12 | UBYTE w, h; 13 | UBYTE hot_x, hot_y; 14 | } cursor_info; 15 | 16 | const cursor_info cursors[] = 17 | { 18 | { 0, 1, 1, 0, 0 }, 19 | { 1, 2, 2, 0, 15 }, 20 | { 5, 2, 2, 0, 15 }, 21 | { 9, 2, 2, 2, 15 }, 22 | { 13, 2, 2, 0, 15 }, 23 | { 17, 2, 2, 5, 10 } 24 | }; 25 | 26 | UBYTE current_cursor; 27 | 28 | UBYTE 29 | getWidth(void) 30 | { 31 | return cursors[current_cursor].w; 32 | } 33 | -------------------------------------------------------------------------------- /sdcc/as/Makefile: -------------------------------------------------------------------------------- 1 | PRJDIR = .. 2 | include $(PRJDIR)/Makefile.common 3 | 4 | PORTS = z80 gbz80 5 | DOCS = README abstra.doc appendk.txt asmlnk.doc asxhtm.html format.txt 6 | 7 | all: 8 | $(MAKE) -C z80 _as-z80 _as-gbz80 E=$(E) BUILDDIR=../../bin/ 9 | 10 | install: all install-doc 11 | $(INSTALL) $(PRJDIR)/bin/as-z80 `echo $(bindir)/as-z80|sed '$(transform)'` 12 | $(STRIP) `echo $(bindir)/as-z80|sed '$(transform)'` 13 | $(INSTALL) $(PRJDIR)/bin/as-gbz80 `echo $(bindir)/as-gbz80|sed '$(transform)'` 14 | $(STRIP) `echo $(bindir)/as-gbz80|sed '$(transform)'` 15 | 16 | install-doc: 17 | $(INSTALL) -d $(docdir)/aslink 18 | cp -f `find doc -maxdepth 1 -not -type d` $(docdir)/aslink 19 | 20 | include clean.mk 21 | -------------------------------------------------------------------------------- /sdcc/src/izt/izt.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include "gen.h" 3 | #include "regs.h" 4 | #include "aop.h" 5 | 6 | #define TEST(_d, _a) \ 7 | (_a) ? (void)0 : (failures++, printf("Test %s \"%s\" failed.\n", #_a, _d), _dumpRegs()) 8 | 9 | #define NUM_OF(_a) (sizeof(_a)/sizeof(*(_a))) 10 | 11 | typedef struct { 12 | REG *regs; 13 | /// One for each size {1, 2, 4} 14 | REG *returnRegs[3]; 15 | REG *scratch; 16 | REG *base_ptr; 17 | } IZT_PORT; 18 | 19 | IZT_PORT *izt_port; 20 | 21 | void izt_init(IZT_PORT *port); 22 | void izt_assignRegisters (eBBlock **ebbs, int count); 23 | void izt_gen(iCode *ic); 24 | /// Return the base 2 log of i, providing i is a power of 2. 25 | int izt_util_binLog(int i); 26 | -------------------------------------------------------------------------------- /gbdk-lib/examples/gb/banked/Makefile: -------------------------------------------------------------------------------- 1 | SRC = main.c bank2.c bank3.c 2 | BIN = banked.gb 3 | 4 | TOPDIR = ../../.. 5 | GBLIB = $(TOPDIR)/lib/medium/rgbds 6 | 7 | LIB = $(GBLIB)/gbz80/gbz80.lib $(GBLIB)/gb/gb.lib 8 | CRT0 = $(GBLIB)/gb/crt0.o 9 | 10 | OBJ = $(SRC:.c=.o) 11 | 12 | CC = $(TOPDIR)/bin/sdcc -mgbz80 --asm=rgbds -I $(TOPDIR)/include 13 | 14 | all: $(BIN) 15 | 16 | clean: 17 | rm $(OBJ) 18 | 19 | %.o: %.s 20 | 21 | $(BIN): $(OBJ) 22 | $(CC) -v $(CRT0) $(OBJ) $(LIB) 23 | rgbfix -p -v a.gb 24 | 25 | $(LIB): $(LIBOBJ) 26 | xlib $@ a $(LIBOBJ) 27 | 28 | %.o: %.c 29 | $(CC) -c $< 30 | 31 | %.asm: %.s 32 | astorgb.pl $< > $@ 33 | 34 | %.o: %.asm 35 | rgbasm -o$@ $< 36 | 37 | %.s: %.ms 38 | maccer -o $@ $< 39 | -------------------------------------------------------------------------------- /sdcc/device/include/serial.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------- 2 | //Written by Dmitry S. Obukhov, 1996 3 | // dso@usa.net 4 | //---------------------------------------------------------------------------- 5 | //This module implements serial interrupt handler and IO routinwes using 6 | //two 256 byte cyclic buffers. Bit variables can be used as flags for 7 | //real-time kernel tasks 8 | //Last modified 6 Apr 97 9 | //---------------------------------------------------------------------------- 10 | 11 | void serial_init(void); 12 | void serial_interrupt_handler(void) interrupt 4 using 1; 13 | void serial_putc(unsigned char); 14 | unsigned char serial_getc(void); 15 | void autobaud(); 16 | -------------------------------------------------------------------------------- /sdcc/support/regression/tests/scott-b.c: -------------------------------------------------------------------------------- 1 | /* 2 | */ 3 | #include 4 | 5 | unsigned char uchar0=0; 6 | unsigned char uchar1=0; 7 | unsigned char uchar2=0; 8 | 9 | void inc(unsigned char k) 10 | { 11 | uchar0 = uchar0 + k; 12 | } 13 | 14 | void f1(void) 15 | { 16 | 17 | uchar2++; 18 | } 19 | 20 | void nested_call(unsigned char u) 21 | { 22 | 23 | f1(); 24 | uchar1 = uchar1 + u; 25 | inc(uchar1); 26 | 27 | } 28 | // uchar1 = uchar1 + uchar0; 29 | // uchar2 = uchar1 + k; 30 | 31 | void 32 | testB(void) 33 | { 34 | 35 | uchar0=1; 36 | inc(uchar0); 37 | ASSERT(uchar0 == 2); 38 | 39 | uchar0 = 2; 40 | uchar1 = 1; 41 | uchar2 = 1; 42 | nested_call(uchar2); 43 | 44 | ASSERT(uchar0 == 4); 45 | } 46 | -------------------------------------------------------------------------------- /sdcc/support/tests/dhrystone/Makefile: -------------------------------------------------------------------------------- 1 | # Simple Makefile for dhrystone and sdcc 2 | TOPDIR = ../../.. 3 | 4 | PROC = z80 5 | 6 | CC = $(TOPDIR)/bin/sdcc 7 | 8 | # -DNOENUM is here to make the results more predictable 9 | CFLAGS += -DREG= -DNOSTRUCTASSIGN -DNOENUM -V -m$(PROC) --profile --dumpall --stack-auto 10 | 11 | OBJ = dhry.o 12 | 13 | all: dhry.bin 14 | 15 | dhry.ihx: dhry.c 16 | $(CC) $(CFLAGS) dhry.c 17 | 18 | dhry.gb: dhry.c 19 | $(CC) $(CFLAGS) dhry.c 20 | 21 | dhry.c: dhry.h 22 | 23 | dhry.bin: dhry.ihx 24 | cat $< | $(TOPDIR)/bin/makebin > $@ 25 | 26 | native: 27 | gcc -g -O2 -DREG= -DNOSTRUCTASSIGN -DNOENUM -o dhry dhry.c 28 | 29 | clean: 30 | rm -f *~ dhry *.o *.gb *.ihx *.rel *.dump* *.lst *.sym *.map *.asm *.bin *.gb 31 | -------------------------------------------------------------------------------- /sdcc/support/regression/fwk/include/testfwk.h: -------------------------------------------------------------------------------- 1 | #ifndef __TESTFWK_H 2 | #define __TESTFWK_H 1 3 | 4 | extern int __numTests; 5 | 6 | void __fail(const char *szMsg, const char *szCond, const char *szFile, int line); 7 | void __printf(const char *szFormat, ...) REENTRANT; 8 | 9 | #define ASSERT(_a) (__numTests++, (_a) ? (void)0 : __fail("Assertion failed", #_a, __FILE__, __LINE__)) 10 | #define LOG(_a) __printf _a 11 | #define FAIL() FAILM("Failure") 12 | #define FAILM(_a) __fail(_a, #_a, __FILE__, __LINE__) 13 | 14 | typedef void (*TESTFUNP)(void); 15 | 16 | // Provided by the suite 17 | TESTFUNP * 18 | suite(void); 19 | 20 | const char * 21 | getSuiteName(void); 22 | 23 | #define NULL 0 24 | 25 | #define UNUSED(_a) if (_a) { } 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /sdcc/sim/ucsim/avr.src/jump_cl.h: -------------------------------------------------------------------------------- 1 | /* avr.src/jump_cl.h */ 2 | 3 | virtual int ijmp(t_mem code); 4 | virtual int eijmp(t_mem code); 5 | virtual int icall(t_mem code); 6 | virtual int eicall(t_mem code); 7 | virtual int ret(t_mem code); 8 | virtual int reti(t_mem code); 9 | virtual int rjmp_k(t_mem code); 10 | virtual int rcall_k(t_mem code); 11 | virtual int cpse_Rd_Rr(t_mem code); 12 | virtual int jmp_k(t_mem code); 13 | virtual int call_k(t_mem code); 14 | virtual int brbs_s_k(t_mem code); 15 | virtual int brbc_s_k(t_mem code); 16 | virtual int sbrc_Rr_b(t_mem code); 17 | virtual int sbrs_Rr_b(t_mem code); 18 | virtual int sbic_P_b(t_mem code); 19 | virtual int sbis_P_b(t_mem code); 20 | 21 | /* End of avr.src/jump_cl.h */ 22 | -------------------------------------------------------------------------------- /sdcc/device/lib/z80/string.c: -------------------------------------------------------------------------------- 1 | /* Dumb strings stub. 2 | Wanted a quick hack for now - will use the libc version later. 3 | */ 4 | char *strcpy(char *dest, const char *source) 5 | { 6 | char *d = dest; 7 | const char *s = source; 8 | while (*d++ = *s++); 9 | return dest; 10 | } 11 | 12 | void *memcpy(void *dest, const void *source, int count) 13 | { 14 | char *d = dest; 15 | const char *s = source; 16 | while (count--) 17 | *d++ = *s++; 18 | 19 | return dest; 20 | } 21 | 22 | int strcmp(const char *s1, const char *s2) 23 | { 24 | char ret = 0; 25 | 26 | while (!(ret = *s1 - *s2) && *s2) 27 | ++s1, ++s2; 28 | 29 | if (ret < 0) 30 | return -1; 31 | else if (ret > 0) 32 | return 1; 33 | return 0; 34 | } 35 | -------------------------------------------------------------------------------- /gbdk-lib/include/gb/console.h: -------------------------------------------------------------------------------- 1 | /** @file gb/console.h 2 | Console functions that work like Turbo C's. 3 | Note that the font is 8x8, making the screen 20x18 characters. 4 | */ 5 | #ifndef _CONSOLE_H 6 | #define _CONSOLE_H 7 | 8 | #include 9 | 10 | /** Move the cursor to an absolute position. 11 | */ 12 | void 13 | gotoxy(UINT8 x, 14 | UINT8 y); 15 | 16 | /** Get the current X position of the cursor. 17 | */ 18 | UINT8 19 | posx(void); 20 | 21 | /** Get the current Y position of the cursor. 22 | */ 23 | UINT8 24 | posy(void); 25 | 26 | /** Writes out a single character at the current cursor 27 | position. 28 | Does not update the cursor or interpret the character. 29 | */ 30 | void 31 | setchar(char c); 32 | 33 | #endif /* _CONSOLE_H */ 34 | -------------------------------------------------------------------------------- /sdcc/support/scripts/Makefile.snapshot: -------------------------------------------------------------------------------- 1 | # Simple weekly tarball generator 2 | CVSROOT = :pserver:anonymous@cvs.sdcc.sourceforge.net:/cvsroot/sdcc 3 | CVSOPTS = -z6 4 | DATE = `date +%Y%m%d` 5 | WWWROOT = /home/michaelh/www 6 | SNAP = $(WWWROOT)/snapshots 7 | 8 | REVISION = 1 9 | 10 | all: _sdcc 11 | 12 | _sdcc: 13 | mkdir -p $(SNAP) 14 | cd /tmp; \ 15 | mkdir -p sdcc-$(DATE); \ 16 | cd sdcc-$(DATE); \ 17 | cvs $(CVSOPTS) -d$(CVSROOT) checkout sdcc; \ 18 | tar czf $(SNAP)/sdcc-$(DATE)-$(REVISION).tar.gz sdcc; \ 19 | tar cIf $(SNAP)/sdcc-$(DATE)-$(REVISION).tar.bz2 sdcc 20 | cd $(SNAP); \ 21 | md5sum sdcc-$(DATE)-$(REVISION).tar.gz > sdcc-$(DATE)-$(REVISION).md5sums 22 | cd $(SNAP); \ 23 | md5sum sdcc-$(DATE)-$(REVISION).tar.bz2 >> sdcc-$(DATE)-$(REVISION).md5sums 24 | -------------------------------------------------------------------------------- /sdcc/src/izt/gen.h: -------------------------------------------------------------------------------- 1 | // izt specific gen functions. 2 | #ifndef IZT_GEN_INCLUDE 3 | #define IZT_GEN_INCLUDE 4 | 5 | // Emit a line of code. 6 | void iemit (const char *format,...); 7 | 8 | // Generic descripter for a function that can emit a type of iCode. 9 | typedef struct 10 | { 11 | int op; 12 | void (*emit) (iCode * ic); 13 | } 14 | EMITTER; 15 | 16 | // Call the base izt handler to handle this iCode. 17 | void izt_baseEmitter (iCode * ic); 18 | // Initialise the base emitter table. 19 | void izt_initBaseEmitters (hTab ** into); 20 | // Add a NULL terminated array of emitters into the given hash table. 21 | void izt_addEmittersToHTab (hTab ** into, EMITTER _base_emitters[]); 22 | // Initialise the emitter tables. 23 | void izt_initEmitters (void); 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /gbdk-lib/libc/gb/serial.s: -------------------------------------------------------------------------------- 1 | .include "global.s" 2 | 3 | ;; BANKED: checked 4 | .area _CODE 5 | 6 | ;; Send byte in __io_out to the serial port 7 | .send_byte: 8 | _send_byte:: ; Banked 9 | LD A,#.IO_SENDING 10 | LD (__io_status),A ; Store status 11 | LD A,#0x01 12 | LDH (.SC),A ; Use internal clock 13 | LD A,(__io_out) 14 | LDH (.SB),A ; Send data byte 15 | LD A,#0x81 16 | LDH (.SC),A ; Use internal clock 17 | RET 18 | 19 | ;; Receive byte from the serial port in __io_in 20 | .receive_byte: 21 | _receive_byte:: ; Banked 22 | LD A,#.IO_RECEIVING 23 | LD (__io_status),A ; Store status 24 | XOR A 25 | LDH (.SC),A ; Use external clock 26 | LD A,#.DT_RECEIVING 27 | LDH (.SB),A ; Send RECEIVING byte 28 | LD A,#0x80 29 | LDH (.SC),A ; Use external clock 30 | RET 31 | -------------------------------------------------------------------------------- /sdcc/sim/ucsim/doc/clean.mk: -------------------------------------------------------------------------------- 1 | # Deleting all files created by building the program 2 | # -------------------------------------------------- 3 | clean: 4 | rm -f *core *[%~] *.[oa] 5 | rm -f .[a-z]*~ 6 | 7 | 8 | # Deleting all files created by configuring or building the program 9 | # ----------------------------------------------------------------- 10 | distclean: clean 11 | rm -f Makefile *.dep 12 | 13 | 14 | # Like clean but some files may still exist 15 | # ----------------------------------------- 16 | mostlyclean: clean 17 | 18 | 19 | # Deleting everything that can reconstructed by this Makefile. It deletes 20 | # everything deleted by distclean plus files created by bison, etc. 21 | # ----------------------------------------------------------------------- 22 | realclean: distclean 23 | -------------------------------------------------------------------------------- /sdcc/src/z80/Makefile.bcc: -------------------------------------------------------------------------------- 1 | PRJDIR = ../.. 2 | 3 | # !include $(PRJDIR)/Makefile.common 4 | 5 | OBJ = gen.obj ralloc.obj main.obj support.obj 6 | LIB = port.lib 7 | 8 | !include ..\..\Bcc.inc 9 | CFLAGS = -I.. -I. -I..\.. -I..\..\support 10 | 11 | all: $(LIB) 12 | 13 | main.obj: main.c peeph.rul peeph-z80.rul peeph-gbz80.rul 14 | 15 | $(LIB): peeph.rul $(OBJ) 16 | del $(LIB) 17 | tlib /a $(LIB) +gen.obj +ralloc.obj +main.obj +support.obj 18 | 19 | peeph.rul: peeph.def 20 | gawk -f ../SDCCpeeph.awk peeph.def > peeph.rul 21 | 22 | peeph-gbz80.rul: peeph-gbz80.def 23 | gawk -f ../SDCCpeeph.awk peeph-gbz80.def > peeph-gbz80.rul 24 | 25 | peeph-z80.rul: peeph-z80.def 26 | gawk -f ../SDCCpeeph.awk peeph-z80.def > peeph-z80.rul 27 | 28 | # include clean.mk 29 | -------------------------------------------------------------------------------- /sdcc/support/regression/tests/bug-221100.c: -------------------------------------------------------------------------------- 1 | /* bug-221100.c 2 | 3 | If test_index is char, loses high bit when indexes table 4 | workaround is to use [(unsigned int) test_index] 5 | */ 6 | #include 7 | 8 | #ifdef __mcs51 9 | xdata 10 | #endif 11 | static unsigned int 12 | testArray[130]; 13 | 14 | static unsigned int test_int ; 15 | static unsigned char test_index ; 16 | 17 | static void 18 | fetch(void) 19 | { 20 | test_int = testArray [test_index] ; 21 | } 22 | 23 | static void 24 | testUnsignedCharIndex(void) 25 | { 26 | int i; 27 | for (i = 0; i < 130; i++) { 28 | testArray[i] = i; 29 | } 30 | 31 | test_index = 5; 32 | fetch(); 33 | ASSERT(test_int == 5); 34 | 35 | test_index = 129; 36 | fetch(); 37 | ASSERT(test_int == 129); 38 | } 39 | -------------------------------------------------------------------------------- /sdcc/device/include/clean.mk: -------------------------------------------------------------------------------- 1 | # Deleting all files created by building the program 2 | # -------------------------------------------------- 3 | clean: 4 | rm -f *core *[%~] *.[oa] 5 | rm -f .[a-z]*~ 6 | 7 | 8 | # Deleting all files created by configuring or building the program 9 | # ----------------------------------------------------------------- 10 | distclean: clean 11 | rm -f Makefile *.dep 12 | 13 | 14 | # Like clean but some files may still exist 15 | # ----------------------------------------- 16 | mostlyclean: clean 17 | 18 | 19 | # Deleting everything that can reconstructed by this Makefile. It deletes 20 | # everything deleted by distclean plus files created by bison, etc. 21 | # ----------------------------------------------------------------------- 22 | realclean: distclean 23 | -------------------------------------------------------------------------------- /sdcc/doc/bccinst.txt: -------------------------------------------------------------------------------- 1 | Building SDCC with Borland C++ under Windows 2 | 3 | 1: Build SDCC under Cygwin as documented in cygwininst.txt (this is 4 | necessary in order to run all the necessary configuration steps). 5 | 6 | 2: From the sdcc directory, run the command "make -f Makefile.bcc". This 7 | should regenerate all the .exe files in the bin directory except for 8 | sdcdb.exe (which currently doesn't build under Borland C++). 9 | 10 | 3: If you modify any source files and need to rebuild, be aware that the 11 | dependancies may not be correctly calculated. The safest option is to 12 | delete all .obj files and run the build again. From a Cygwin BASH 13 | prompt, this can easily be done with the commmand: 14 | 15 | 'find . -name "*.obj" -print | xargs rm' 16 | 17 | from the sdcc directory. 18 | -------------------------------------------------------------------------------- /sdcc/sim/ucsim/clean.mk: -------------------------------------------------------------------------------- 1 | # PENDING: Delegate up to the Makefile 2 | 3 | # Deleting all files created by building the program 4 | # -------------------------------------------------- 5 | clean: 6 | make clean 7 | 8 | # Deleting all files created by configuring or building the program 9 | # ----------------------------------------------------------------- 10 | distclean: 11 | make distclean 12 | 13 | # Like clean but some files may still exist 14 | # ----------------------------------------- 15 | mostlyclean: 16 | make mostlyclean 17 | 18 | # Deleting everything that can reconstructed by this Makefile. It deletes 19 | # everything deleted by distclean plus files created by bison, etc. 20 | # ----------------------------------------------------------------------- 21 | realclean: 22 | make realclean -------------------------------------------------------------------------------- /sdcc/support/cpp2/sdcc.h: -------------------------------------------------------------------------------- 1 | /* Various stuff needed to hack the build for SDCC. */ 2 | #define xmalloc(s) malloc(s) 3 | #define xstrdup(s) strdup(s) 4 | #define xrealloc(p,s) realloc(p,s) 5 | #define xcalloc(n,e) calloc(n,e) 6 | #define xmalloc_set_program_name(n) /* nada */ 7 | #define xstrerror(e) strerror(e) 8 | 9 | extern char *lbasename(const char *path); 10 | 11 | /* Define results of standard character escape sequences. */ 12 | #define TARGET_BELL 007 13 | #define TARGET_BS 010 14 | #define TARGET_TAB 011 15 | #define TARGET_NEWLINE 012 16 | #define TARGET_VT 013 17 | #define TARGET_FF 014 18 | #define TARGET_CR 015 19 | 20 | #define CHAR_TYPE_SIZE 8 21 | #define WCHAR_TYPE_SIZE 32 /* ? maybe ? */ 22 | 23 | #define SUPPORTS_ONE_ONLY 0 24 | 25 | #define TARGET_OBJECT_SUFFIX ".rel" 26 | 27 | -------------------------------------------------------------------------------- /sdcc/support/regression/tests/fetchoverlap.c: -------------------------------------------------------------------------------- 1 | /* Test to reproduce a bug in the z80 compiler where A is used as the 2 | left and right of an operand. 3 | */ 4 | #include 5 | #include 6 | 7 | /* In the previous bug, both *p and val in the compare operation were 8 | assigned into A due to *p being packed for ACC use into A. 9 | */ 10 | int 11 | verifyBlock(char *p, char val, int len) 12 | { 13 | while (len--) { 14 | if (*p++ != val) { 15 | return 0; 16 | } 17 | } 18 | return 1; 19 | } 20 | 21 | void 22 | testOverlap(void) 23 | { 24 | char buf[20]; 25 | memset(buf, 12, sizeof(buf)); 26 | 27 | buf[12] = 13; 28 | ASSERT(!verifyBlock(buf, 12, sizeof(buf))); 29 | 30 | buf[12] = 12; 31 | ASSERT(verifyBlock(buf, 12, sizeof(buf))); 32 | } 33 | 34 | -------------------------------------------------------------------------------- /sdcc/support/makebin/clean.mk: -------------------------------------------------------------------------------- 1 | # Deleting all files created by building the program 2 | # -------------------------------------------------- 3 | clean: 4 | rm -rf obj 5 | rm -f *core *[%~] *.[oa] makebin 6 | rm -f *.[a-z]*~ 7 | 8 | # Deleting all files created by configuring or building the program 9 | # ----------------------------------------------------------------- 10 | distclean: clean 11 | rm -f *.dep 12 | 13 | 14 | # Like clean but some files may still exist 15 | # ----------------------------------------- 16 | mostlyclean: clean 17 | 18 | 19 | # Deleting everything that can reconstructed by this Makefile. It deletes 20 | # everything deleted by distclean plus files created by bison, etc. 21 | # ----------------------------------------------------------------------- 22 | realclean: distclean 23 | -------------------------------------------------------------------------------- /sdcc/device/examples/ds390/readmac/ow.h: -------------------------------------------------------------------------------- 1 | #ifndef OW_H_ 2 | #define OW_H_ 3 | 4 | #ifndef FALSE 5 | #define FALSE 0 6 | #endif 7 | #ifndef TRUE 8 | #define TRUE 1 9 | #endif 10 | 11 | unsigned char owFirst(unsigned char,unsigned char); 12 | unsigned char owNext(unsigned char,unsigned char); 13 | void owSerialNum(unsigned char *,unsigned char); 14 | 15 | /* Low level functions */ 16 | unsigned char owTouchReset(void); 17 | unsigned char owTouchBit(unsigned char); 18 | unsigned char owTouchByte(unsigned char); 19 | unsigned char owWriteByte(unsigned char); 20 | unsigned char owReadByte(void); 21 | void msDelay(unsigned int); 22 | 23 | unsigned char owBlock(unsigned char do_reset, 24 | unsigned char *tran_buf, 25 | unsigned char tran_len); 26 | #endif 27 | -------------------------------------------------------------------------------- /sdcc/device/lib/gbz80/string.c: -------------------------------------------------------------------------------- 1 | /* Dumb strings stub. 2 | Wanted a quick hack for now - will use the libc version later. 3 | */ 4 | char *_strcpy(char *dest, const char *source) 5 | { 6 | char *d = dest; 7 | const char *s = source; 8 | while (*d = *s) 9 | d++, s++; 10 | 11 | return dest; 12 | } 13 | 14 | void *_memcpy(void *dest, const void *source, int count) 15 | { 16 | char *d = dest; 17 | const char *s = source; 18 | while (count--) { 19 | *d = *s; 20 | d++; 21 | s++; 22 | } 23 | 24 | return dest; 25 | } 26 | 27 | int _strcmp(const char *s1, const char *s2) 28 | { 29 | char ret = 0; 30 | 31 | while (!(ret = *s1 - *s2) && *s2) 32 | ++s1, ++s2; 33 | 34 | if (ret < 0) 35 | return -1; 36 | else if (ret > 0) 37 | return 1; 38 | return 0; 39 | } 40 | -------------------------------------------------------------------------------- /sdcc/sim/ucsim/sim.src/clean.mk: -------------------------------------------------------------------------------- 1 | # Deleting all files created by building the program 2 | # -------------------------------------------------- 3 | clean: 4 | rm -f *core *[%~] *.[oa] test_mem_speed 5 | rm -f .[a-z]*~ 6 | 7 | 8 | # Deleting all files created by configuring or building the program 9 | # ----------------------------------------------------------------- 10 | distclean: clean 11 | rm -f Makefile *.dep 12 | 13 | 14 | # Like clean but some files may still exist 15 | # ----------------------------------------- 16 | mostlyclean: clean 17 | 18 | 19 | # Deleting everything that can reconstructed by this Makefile. It deletes 20 | # everything deleted by distclean plus files created by bison, etc. 21 | # ----------------------------------------------------------------------- 22 | realclean: distclean 23 | -------------------------------------------------------------------------------- /sdcc/sim/ucsim/gui.src/serio.src/posix_signal.hh: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * posix_signal.hh - A signal handleing class for linux + solaris * 3 | * to convert posix into somthing easier to use * 4 | * Tim Hurman - t.hurman@virgin.net * 5 | * Last edited on 01th Oct 1999 * 6 | ******************************************************************************/ 7 | typedef void(*SIG_PF)(int); 8 | class SigHandler 9 | { 10 | public: 11 | SigHandler(); 12 | ~SigHandler(); 13 | int SetSignal(int SIGNAL, SIG_PF ACTION); 14 | int BlockSignal(int SIGNAL); 15 | int UnBlockSignal(int SIGNAL); 16 | 17 | private: 18 | 19 | }; 20 | -------------------------------------------------------------------------------- /sdcc/as/z80/conf.mk: -------------------------------------------------------------------------------- 1 | # Deleting all files created by building the program 2 | # -------------------------------------------------- 3 | clean: 4 | rm -f *core *[%~] *.[oa] 5 | rm -f .[a-z]*~ 6 | rm -f $(PRJDIR)/as-z80 as-z80 7 | 8 | 9 | # Deleting all files created by configuring or building the program 10 | # ----------------------------------------------------------------- 11 | distclean: clean 12 | rm -f Makefile *.dep 13 | 14 | 15 | # Like clean but some files may still exist 16 | # ----------------------------------------- 17 | mostlyclean: clean 18 | 19 | 20 | # Deleting everything that can reconstructed by this Makefile. It deletes 21 | # everything deleted by distclean plus files created by bison, etc. 22 | # ----------------------------------------------------------------------- 23 | realclean: distclean 24 | -------------------------------------------------------------------------------- /sdcc/sim/ucsim/avr.src/bit_cl.h: -------------------------------------------------------------------------------- 1 | /* avr.src/bit_cl.h */ 2 | 3 | virtual int sec(t_mem code); 4 | virtual int clc(t_mem code); 5 | virtual int sen(t_mem code); 6 | virtual int cln(t_mem code); 7 | virtual int sez(t_mem code); 8 | virtual int clz(t_mem code); 9 | virtual int sei(t_mem code); 10 | virtual int cli(t_mem code); 11 | virtual int ses(t_mem code); 12 | virtual int cls(t_mem code); 13 | virtual int sev(t_mem code); 14 | virtual int clv(t_mem code); 15 | virtual int set(t_mem code); 16 | virtual int clt(t_mem code); 17 | virtual int seh(t_mem code); 18 | virtual int clh(t_mem code); 19 | virtual int cbi_A_b(t_mem code); 20 | virtual int sbi_A_b(t_mem code); 21 | virtual int bld_Rd_b(t_mem code); 22 | virtual int bst_Rd_b(t_mem code); 23 | 24 | /* End of avr.src/bit_cl.h */ 25 | -------------------------------------------------------------------------------- /sdcc/as/z80/clean.mk: -------------------------------------------------------------------------------- 1 | # Deleting all files created by building the program 2 | # -------------------------------------------------- 3 | clean: 4 | rm -rf obj 5 | rm -f *core *[%~] *.[oa] 6 | rm -f .[a-z]*~ 7 | rm -f $(PRJDIR)/as-z80 as-z80 8 | 9 | # Deleting all files created by configuring or building the program 10 | # ----------------------------------------------------------------- 11 | distclean: clean 12 | rm -f *.dep 13 | 14 | 15 | # Like clean but some files may still exist 16 | # ----------------------------------------- 17 | mostlyclean: clean 18 | 19 | 20 | # Deleting everything that can reconstructed by this Makefile. It deletes 21 | # everything deleted by distclean plus files created by bison, etc. 22 | # ----------------------------------------------------------------------- 23 | realclean: distclean 24 | -------------------------------------------------------------------------------- /sdcc/link/z80/clean.mk: -------------------------------------------------------------------------------- 1 | # Deleting all files created by building the program 2 | # -------------------------------------------------- 3 | clean: 4 | rm -f *core *[%~] *.[oa] 5 | rm -f .[a-z]*~ 6 | rm -f $(PRJDIR)/link-z80 link-z80 7 | rm -f *.dep 8 | rm -rf obj 9 | 10 | # Deleting all files created by configuring or building the program 11 | # ----------------------------------------------------------------- 12 | distclean: clean 13 | 14 | 15 | # Like clean but some files may still exist 16 | # ----------------------------------------- 17 | mostlyclean: clean 18 | 19 | # Deleting everything that can reconstructed by this Makefile. It deletes 20 | # everything deleted by distclean plus files created by bison, etc. 21 | # ----------------------------------------------------------------------- 22 | realclean: distclean 23 | -------------------------------------------------------------------------------- /sdcc/link/z80/conf.mk: -------------------------------------------------------------------------------- 1 | # Deleting all files created by building the program 2 | # -------------------------------------------------- 3 | clean: 4 | rm -f *core *[%~] *.[oa] 5 | rm -f .[a-z]*~ 6 | rm -f $(PRJDIR)/link-z80 link-z80 7 | 8 | 9 | # Deleting all files created by configuring or building the program 10 | # ----------------------------------------------------------------- 11 | distclean: clean 12 | rm -f Makefile *.dep 13 | 14 | 15 | # Like clean but some files may still exist 16 | # ----------------------------------------- 17 | mostlyclean: clean 18 | 19 | 20 | # Deleting everything that can reconstructed by this Makefile. It deletes 21 | # everything deleted by distclean plus files created by bison, etc. 22 | # ----------------------------------------------------------------------- 23 | realclean: distclean 24 | -------------------------------------------------------------------------------- /sdcc/src/common.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | #if defined(__APPLE__) && (__MACH__) 8 | #ifdef _G 9 | #undef _G 10 | #endif 11 | #endif 12 | 13 | #include "SDCCglobl.h" 14 | #include "SDCCmem.h" 15 | #include "SDCCast.h" 16 | #include "SDCCy.h" 17 | #include "SDCChasht.h" 18 | #include "SDCCbitv.h" 19 | #include "SDCCset.h" 20 | #include "SDCCicode.h" 21 | #include "SDCClabel.h" 22 | #include "SDCCBBlock.h" 23 | #include "SDCCloop.h" 24 | #include "SDCCcse.h" 25 | #include "SDCCcflow.h" 26 | #include "SDCCdflow.h" 27 | #include "SDCClrange.h" 28 | #include "SDCCptropt.h" 29 | #include "SDCCopt.h" 30 | #include "SDCCglue.h" 31 | #include "SDCCpeeph.h" 32 | 33 | #include "asm.h" 34 | #include "port.h" 35 | 36 | #include "newalloc.h" 37 | -------------------------------------------------------------------------------- /sdcc/support/regression/tests/bug-477927.c: -------------------------------------------------------------------------------- 1 | /* Tests an uninitalised variable bug. 2 | t is not initalised in all paths in the do loop, causing the while 3 | conditional to fail unpredictably. 4 | 5 | Doesn't actually test, is really an example. 6 | */ 7 | #include 8 | 9 | typedef unsigned char UBYTE; 10 | 11 | UBYTE 12 | randish(void) 13 | { 14 | static int count; 15 | 16 | if ((++count)&3) { 17 | return 1; 18 | } 19 | else { 20 | return 0; 21 | } 22 | } 23 | 24 | void 25 | spoil(UBYTE ignored) 26 | { 27 | UNUSED(ignored); 28 | } 29 | 30 | UBYTE accu[2]; 31 | 32 | void 33 | testLoopInit(void) 34 | { 35 | UBYTE t, r; 36 | 37 | do { 38 | r = randish(); 39 | 40 | if(r != 1) { 41 | t = ++accu[r]; 42 | spoil(t); 43 | } 44 | } 45 | while(t != 3); 46 | } 47 | 48 | 49 | -------------------------------------------------------------------------------- /sdcc/support/regression/tests/bug-460000.c: -------------------------------------------------------------------------------- 1 | /* bug 460000 2 | */ 3 | #include 4 | 5 | int 6 | func( int a ) 7 | { 8 | return a; 9 | } 10 | 11 | int x = -1024; 12 | 13 | void 14 | testByteShift(void) 15 | { 16 | ASSERT(func( x >> 8 ) == -4); 17 | ASSERT(func( x / 256 ) == -4); 18 | } 19 | 20 | void 21 | testOtherSignedShifts(void) 22 | { 23 | volatile int left; 24 | 25 | left = -2345; 26 | ASSERT(left >> 3 == (-2345>>3)); 27 | ASSERT(left >> 8 == (-2345>>8)); 28 | ASSERT(left >> 9 == (-2345>>9)); 29 | } 30 | 31 | void 32 | testShiftByParam(void) 33 | { 34 | volatile int left, count; 35 | 36 | left = -2345; 37 | 38 | count = 3; 39 | ASSERT(left >> count == (-2345>>3)); 40 | count = 8; 41 | ASSERT(left >> count == (-2345>>8)); 42 | count = 9; 43 | ASSERT(left >> count == (-2345>>9)); 44 | } 45 | -------------------------------------------------------------------------------- /gbdk-lib/libc/gb/init_tt.s: -------------------------------------------------------------------------------- 1 | .include "global.s" 2 | 3 | ;; BANKED: checked 4 | .area _BASE 5 | 6 | ;; Initialize part (size = DE) of the VRAM at (HL) with B 7 | .init_vram:: 8 | 1$: 9 | LDH A,(.STAT) 10 | AND #0x02 11 | JR NZ,1$ 12 | 13 | LD (HL),B 14 | INC HL 15 | DEC DE 16 | LD A,D 17 | OR E 18 | JR NZ,1$ 19 | RET 20 | ;; Initialize window tile table with B 21 | .init_wtt:: 22 | LDH A,(.LCDC) 23 | BIT 6,A 24 | JR NZ,1$ 25 | LD HL,#0x9800 ; HL = origin 26 | JR .init_tt 27 | 1$: 28 | LD HL,#0x9C00 ; HL = origin 29 | JR .init_tt 30 | ;; Initialize background tile table with B 31 | .init_btt:: 32 | LDH A,(.LCDC) 33 | BIT 3,A 34 | JR NZ,1$ 35 | LD HL,#0x9800 ; HL = origin 36 | JR .init_tt 37 | 1$: 38 | LD HL,#0x9C00 ; HL = origin 39 | ; JR .init_tt 40 | .init_tt:: 41 | LD DE,#0x0400 ; One whole GB Screen 42 | JP .init_vram 43 | -------------------------------------------------------------------------------- /sdcc/as/mcs51/clean.mk: -------------------------------------------------------------------------------- 1 | # Deleting all files created by building the program 2 | # -------------------------------------------------- 3 | clean: 4 | rm -f *core *[%~] *.[oa] 5 | rm -f .[a-z]*~ 6 | rm -f $(PRJDIR)/asx8051 $(PRJDIR)/aslink asx8051 aslink 7 | 8 | 9 | # Deleting all files created by configuring or building the program 10 | # ----------------------------------------------------------------- 11 | distclean: clean 12 | rm -f Makefile *.dep 13 | 14 | 15 | # Like clean but some files may still exist 16 | # ----------------------------------------- 17 | mostlyclean: clean 18 | 19 | 20 | # Deleting everything that can reconstructed by this Makefile. It deletes 21 | # everything deleted by distclean plus files created by bison, etc. 22 | # ----------------------------------------------------------------------- 23 | realclean: distclean 24 | -------------------------------------------------------------------------------- /sdcc/support/regression/tests/bug-426632.c: -------------------------------------------------------------------------------- 1 | /* bug-436632.c 2 | PENDING 3 | */ 4 | #include 5 | 6 | typedef struct { 7 | unsigned char year; /* Current year (with offset 1900) */ 8 | unsigned char month; /* Month (1 = Jan., ..., 12 = Dec.) */ 9 | unsigned char day; /* Day of month (1 to 31) */ 10 | } DATE_STRUCT; 11 | 12 | unsigned char year; 13 | unsigned char month; 14 | unsigned char day; 15 | 16 | void *__main() 17 | { 18 | float i; 19 | float y; 20 | void *p; 21 | DATE_STRUCT d; 22 | DATE_STRUCT *date_ptr; 23 | 24 | date_ptr = &d; 25 | 26 | year = date_ptr->year; 27 | month = date_ptr->month; 28 | day = date_ptr->day; 29 | 30 | i = 1.35; 31 | i += 2; 32 | y = 1; 33 | y = y+i; 34 | i = y; 35 | p = &y; 36 | return p; 37 | } 38 | -------------------------------------------------------------------------------- /gbdk-lib/Makefile.common: -------------------------------------------------------------------------------- 1 | # Common settings 2 | ifndef ASM 3 | ASM = asxxxx 4 | endif 5 | 6 | ifndef MODEL 7 | MODEL = small 8 | endif 9 | 10 | ifndef PORTS 11 | PORTS = gbz80 z80 12 | endif 13 | ifndef PLATFORMS 14 | PLATFORMS = gb consolez80 rrgb 15 | endif 16 | 17 | ifndef SDCCLIB 18 | SDCCLIB = /home/michaelh/projects/sdcc 19 | endif 20 | 21 | SCC = $(SDCCLIB)/bin/sdcc 22 | GBCC = $(SDCCLIB)/bin/lcc 23 | 24 | AS_Z80 = $(SDCCLIB)/bin/as-z80 25 | ifeq ($(RGBDS),1) 26 | AS_GBZ80 = rgbasm 27 | else 28 | AS_GBZ80 = $(SDCCLIB)/bin/as-gbz80 29 | endif 30 | 31 | CLEANSPEC = *.o *.cdb *.sym *.lst *~ *.asm 32 | 33 | CFLAGS = -I$(TOPDIR)/include --model-$(MODEL) 34 | CFLAGS += -m$(PORT) -DGBDK=1 35 | CC = $(SCC) 36 | BUILD = $(TOPDIR)/build/$(MODEL)/$(ASM)/$(THIS) 37 | LIB = $(BUILD)/$(THIS).lib 38 | 39 | OBJ = $(CSRC:%.c=$(BUILD)/%.o) $(ASSRC:%.s=$(BUILD)/%.o) 40 | -------------------------------------------------------------------------------- /sdcc/packihx/config.log: -------------------------------------------------------------------------------- 1 | This file contains any messages produced by compilers while 2 | running configure, to aid debugging if configure makes a mistake. 3 | 4 | configure:531: checking for gcc 5 | configure:644: checking whether the C compiler (i586-mingw32msvc-gcc ) works 6 | configure:660: i586-mingw32msvc-gcc -o conftest conftest.c 1>&5 7 | configure:686: checking whether the C compiler (i586-mingw32msvc-gcc ) is a cross-compiler 8 | configure:691: checking whether we are using GNU C 9 | configure:719: checking whether i586-mingw32msvc-gcc accepts -g 10 | configure:757: checking size of char 11 | configure:797: checking size of short 12 | configure:837: checking size of int 13 | configure:877: checking size of long 14 | configure:917: checking size of long long 15 | configure:983: checking type name for byte 16 | configure:987: checking type name for word 17 | -------------------------------------------------------------------------------- /sdcc/support/regression/tests/scott-pointer1.c: -------------------------------------------------------------------------------- 1 | /* 2 | Pointer tests 3 | */ 4 | #include 5 | 6 | unsigned int aint0 = 0; 7 | unsigned int aint1 = 0; 8 | unsigned char achar0 = 0; 9 | unsigned char achar1 = 0; 10 | unsigned char *acharP = 0; 11 | 12 | void 13 | f1 (unsigned char *ucP) 14 | { 15 | 16 | if (ucP == 0) 17 | { 18 | ASSERT(0); 19 | return; 20 | } 21 | 22 | ASSERT (!(*ucP)); 23 | } 24 | 25 | void 26 | f2 (unsigned int *uiP) 27 | { 28 | 29 | if (uiP == 0) 30 | { 31 | ASSERT(0); 32 | return; 33 | } 34 | 35 | ASSERT (!(*uiP)); 36 | 37 | } 38 | 39 | unsigned char * 40 | f3 (void) 41 | { 42 | 43 | return &achar0; 44 | } 45 | 46 | void 47 | testPointer1 (void) 48 | { 49 | f1 (&achar0); 50 | f2 (&aint0); 51 | 52 | acharP = f3 (); 53 | ASSERT (!((acharP == 0) || (*acharP))); 54 | } 55 | -------------------------------------------------------------------------------- /sdcc/sim/ucsim/avr.src/test_jmp.asm: -------------------------------------------------------------------------------- 1 | nop 2 | jmp skip 3 | nop 4 | skip: 5 | ldi r16,12 6 | ldi r17,13 7 | cpse r16,r17 8 | inc r16 9 | cpse r16,r17 10 | inc r16 11 | inc r16 12 | nop 13 | nop 14 | ldi r16,0 15 | sbrc r16,0 16 | nop 17 | sbrc r16,1 18 | jmp 0 19 | sbrs r16,2 20 | ldi r16,$ff 21 | sbrs r16,7 22 | nop 23 | sbrs r16,6 24 | jmp 0 25 | nop 26 | t0: 27 | ; rjmp -$100 28 | bclr 0 29 | brbs 0,b0_1 30 | brbc 0,b0_1 31 | nop 32 | b2_0: 33 | nop 34 | b1_0: 35 | bclr 1 36 | brbs 1,b1_1 37 | brbc 1,b1_1 38 | nop 39 | b0_1: 40 | bset 0 41 | brbc 0,b1_0 42 | brbs 0,b1_0 43 | nop 44 | b1_1: 45 | bset 1 46 | brbc 1,b2_0 47 | brbs 1,b2_0 48 | nop 49 | t1: 50 | ldi r30,low(t11) 51 | ldi r31,high(t11) 52 | ijmp 53 | nop 54 | t11: 55 | rjmp t2 56 | nop 57 | t2: 58 | rjmp t0 59 | nop 60 | 61 | copyright: 62 | .db "(c) 2000 talker Bt." 63 | -------------------------------------------------------------------------------- /gbdk-lib/include/asm/gbz80/types.h: -------------------------------------------------------------------------------- 1 | /** @file asm/gbz80/types.h 2 | Types definitions for the gb. 3 | */ 4 | #ifndef ASM_GBZ80_TYPES_INCLUDE 5 | #define ASM_GBZ80_TYPES_INCLUDE 6 | 7 | #if SDCC_PORT!=gbz80 8 | #error gbz80 only. 9 | #endif 10 | 11 | #define NONBANKED nonbanked 12 | #define BANKED banked 13 | 14 | /** Signed eight bit. 15 | */ 16 | typedef char INT8; 17 | /** Unsigned eight bit. 18 | */ 19 | typedef unsigned char UINT8; 20 | /** Signed sixteen bit. 21 | */ 22 | typedef int INT16; 23 | /** Unsigned sixteen bit. 24 | */ 25 | typedef unsigned int UINT16; 26 | /** Signed 32 bit. 27 | */ 28 | typedef long INT32; 29 | /** Unsigned 32 bit. 30 | */ 31 | typedef unsigned long UINT32; 32 | 33 | typedef int size_t; 34 | 35 | /** Returned from clock 36 | @see clock 37 | */ 38 | typedef UINT16 clock_t; 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /sdcc/src/izt/aop.h: -------------------------------------------------------------------------------- 1 | /** @file izt/aop.h 2 | */ 3 | #ifndef IZT_AOP_INCLUDE 4 | #define IZT_AOP_INCLUDE 5 | 6 | typedef enum { 7 | AOP_TYPE_REG, 8 | AOP_TYPE_CARRY, 9 | AOP_TYPE_LITERAL, 10 | AOP_TYPE_STACK, 11 | AOP_TYPE_SCRATCH_PTR, 12 | AOP_TYPE_IMMEDIATE 13 | } AOP_TYPE; 14 | 15 | typedef struct asmop { 16 | AOP_TYPE type; 17 | int size; 18 | union { 19 | value *literal; 20 | REG *reg; 21 | int stack; 22 | const char *immediate; 23 | const char *scratch; 24 | } u; 25 | } asmop; 26 | 27 | #define AOP(op) op->aop 28 | #define AOP_TYPE(op) AOP(op)->type 29 | #define AOP_SIZE(op) AOP(op)->size 30 | 31 | /** Bind a new AOP to the given operand. 32 | */ 33 | void izt_bindAop(operand *op, iCode *ic); 34 | 35 | /** Creates a new asmop that wraps the return value registers. 36 | */ 37 | asmop *izt_getAopForReturn(int size); 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /sdcc/support/regression/ports/gbz80/spec.mk: -------------------------------------------------------------------------------- 1 | # Port specification for the gbz80 port. 2 | 3 | EMU = $(SDCC_EXTRA_DIR)/emu/rrgb/rrgb 4 | 5 | SDCCFLAGS += --lesspedantic -DREENTRANT= 6 | 7 | EXEEXT = .gb 8 | 9 | # Needs parts of gbdk-lib, namely the internal mul/div/mod functions. 10 | EXTRAS = fwk/lib/testfwk$(OBJEXT) ports/$(PORT)/support$(OBJEXT) 11 | 12 | # Rule to link into .ihx 13 | %.gb: %.c $(EXTRAS) 14 | $(SDCC) $(SDCCFLAGS) $< $(EXTRAS) 15 | 16 | %$(OBJEXT): %.asm 17 | ../../bin/as-gbz80 -plosgff $@ $< 18 | 19 | %$(OBJEXT): %.s 20 | ../../bin/as-gbz80 -plosgff $@ $< 21 | 22 | %$(OBJEXT): %.c 23 | $(SDCC) $(SDCCFLAGS) -c $< 24 | 25 | # PENDING: Path to sdcc-extra 26 | %.out: %$(EXEEXT) 27 | mkdir -p `dirname $@` 28 | $(EMU) -m $< > $@ 29 | -grep -n FAIL $@ /dev/null || true 30 | 31 | _clean: 32 | rm -f ports/$(PORT)/*.lst ports/$(PORT)/*.o ports/$(PORT)/*.sym 33 | 34 | -------------------------------------------------------------------------------- /sdcc/clean.mk: -------------------------------------------------------------------------------- 1 | # Deleting all files created by building the program 2 | # -------------------------------------------------- 3 | clean: 4 | rm -f *core *[%~] *.[oa] 5 | rm -f .[a-z]*~ 6 | -rm -f bin/* 7 | 8 | # Deleting all files created by configuring or building the program 9 | # ----------------------------------------------------------------- 10 | distclean: clean 11 | rm -f config.cache config.log config.status Makefile.common 12 | rm -f sdccconf.h main.mk *.dep 13 | rm -f ports.all ports.build 14 | 15 | # Like clean but some files may still exist 16 | # ----------------------------------------- 17 | mostlyclean: clean 18 | 19 | 20 | # Deleting everything that can reconstructed by this Makefile. It deletes 21 | # everything deleted by distclean plus files created by bison, etc. 22 | # ----------------------------------------------------------------------- 23 | realclean: distclean 24 | -------------------------------------------------------------------------------- /sdcc/sim/ucsim/z80.src/clean.mk: -------------------------------------------------------------------------------- 1 | # Deleting all files created by building the program 2 | # -------------------------------------------------- 3 | clean: 4 | rm -f *core *[%~] *.[oa] 5 | rm -f .[a-z]*~ 6 | rm -f sz80 7 | 8 | 9 | # Deleting all files created by configuring or building the program 10 | # ----------------------------------------------------------------- 11 | distclean: clean 12 | rm -f config.cache config.log config.status 13 | rm -f Makefile *.dep 14 | 15 | 16 | # Like clean but some files may still exist 17 | # ----------------------------------------- 18 | mostlyclean: clean 19 | 20 | 21 | # Deleting everything that can reconstructed by this Makefile. It deletes 22 | # everything deleted by distclean plus files created by bison, etc. 23 | # ----------------------------------------------------------------------- 24 | realclean: distclean 25 | 26 | # End of z80.src/clean.mk 27 | -------------------------------------------------------------------------------- /sdcc/support/cpp2/Makefile.bcc: -------------------------------------------------------------------------------- 1 | PRJDIR = ..\.. 2 | 3 | OBJECTS = cppmain.obj intl.obj \ 4 | cpplib.obj cpplex.obj cppmacro.obj cppexp.obj cppfiles.obj \ 5 | cpphash.obj cpperror.obj cppinit.obj cppdefault.obj \ 6 | hashtable.obj mkdeps.obj prefix.obj version.obj mbchar.obj \ 7 | safe-ctype.obj obstack.obj splay-tree.obj lbasename.obj 8 | 9 | TARGET = $(PRJDIR)/bin/sdcpp.exe 10 | 11 | # Compiling entire program or any subproject 12 | # ------------------------------------------ 13 | all: $(TARGET) 14 | 15 | 16 | CFLAGS = -I. -I.\libiberty -DHAVE_CONFIG_H 17 | 18 | # My rules 19 | # -------- 20 | $(TARGET): $(OBJECTS) 21 | bcc32 -e$(TARGET) $(OBJECTS) 22 | 23 | !include ..\..\Bcc.inc 24 | 25 | safe-ctype.obj: libiberty\safe-ctype.c 26 | obstack.obj: libiberty\obstack.c 27 | splay-tree.obj: libiberty\splay-tree.c 28 | lbasename.obj: libiberty\lbasename.c 29 | 30 | -------------------------------------------------------------------------------- /sdcc/support/regression/tests/funptrs.c: -------------------------------------------------------------------------------- 1 | /** Function pointer tests. 2 | */ 3 | #include 4 | 5 | /* Must use a typedef as there is no way of adding the code modifier 6 | on the z80. 7 | */ 8 | typedef void (*NOARGFUNPTR)(void); 9 | typedef void (*ONEARGFUNPTR)(int) REENTRANT; 10 | 11 | int count; 12 | 13 | void 14 | incCount(void) 15 | { 16 | count++; 17 | } 18 | 19 | void 20 | incBy(int a) REENTRANT 21 | { 22 | count += a; 23 | } 24 | 25 | void 26 | callViaPtr(NOARGFUNPTR fptr) 27 | { 28 | (*fptr)(); 29 | } 30 | 31 | void 32 | callViaPtr2(ONEARGFUNPTR fptr, int arg) 33 | { 34 | (*fptr)(arg); 35 | } 36 | 37 | void 38 | callViaPtr3(void (*fptr)(void)) 39 | { 40 | (*fptr)(); 41 | } 42 | 43 | void 44 | testFunPtr(void) 45 | { 46 | ASSERT(count == 0); 47 | callViaPtr(incCount); 48 | ASSERT(count == 1); 49 | callViaPtr2(incBy, 7); 50 | ASSERT(count == 8); 51 | } 52 | -------------------------------------------------------------------------------- /gbdk-lib/libc/string.c: -------------------------------------------------------------------------------- 1 | /** Dumb strings hack. 2 | */ 3 | #include 4 | #include 5 | 6 | #if USE_C_STRCPY 7 | char *strcpy(char *dest, const char *source) NONBANKED 8 | { 9 | char *d = dest; 10 | const char *s = source; 11 | while (*d = *s) 12 | d++, s++; 13 | return dest; 14 | } 15 | #endif 16 | 17 | #if USE_C_MEMCPY 18 | void *memcpy(void *dest, const void *source, size_t count) NONBANKED 19 | { 20 | char *d = dest; 21 | const char *s = source; 22 | while (count--) { 23 | *d = *s; 24 | d++; 25 | s++; 26 | } 27 | return dest; 28 | } 29 | #endif 30 | 31 | #if USE_C_STRCMP 32 | int strcmp(const char *s1, const char *s2) NONBANKED 33 | { 34 | char ret = 0; 35 | 36 | while (!(ret = *s1 - *s2) && *s2) 37 | ++s1, ++s2; 38 | 39 | if (ret < 0) 40 | return -1; 41 | else if (ret > 0) 42 | return 1; 43 | return 0; 44 | } 45 | #endif 46 | -------------------------------------------------------------------------------- /sdcc/debugger/mcs51/clean.mk: -------------------------------------------------------------------------------- 1 | # Deleting all files created by building the program 2 | # -------------------------------------------------- 3 | clean: 4 | rm -f *core *[%~] *.[oa] 5 | rm -f .[a-z]*~ 6 | rm -f $(PRJDIR)/bin/sdcdb \ 7 | $(PRJDIR)/support/Util/SDCCerr.o 8 | 9 | # Deleting all files created by configuring or building the program 10 | # ----------------------------------------------------------------- 11 | distclean: clean 12 | rm -f config.cache config.log config.status 13 | rm -f Makefile *.dep 14 | 15 | 16 | # Like clean but some files may still exist 17 | # ----------------------------------------- 18 | mostlyclean: clean 19 | 20 | 21 | # Deleting everything that can reconstructed by this Makefile. It deletes 22 | # everything deleted by distclean plus files created by bison, etc. 23 | # ----------------------------------------------------------------------- 24 | realclean: distclean 25 | -------------------------------------------------------------------------------- /sdcc/src/z80/peeph-gbz80.def: -------------------------------------------------------------------------------- 1 | replace { 2 | ld (hl),a 3 | dec hl 4 | } by { 5 | ld (hl-),a 6 | } 7 | replace { 8 | ld (hl),a 9 | inc hl 10 | } by { 11 | ld (hl+),a 12 | } 13 | replace { 14 | ld a,(hl) 15 | inc hl 16 | } by { 17 | ld a,(hl+) 18 | } 19 | replace { 20 | ld a,[hl] 21 | inc hl 22 | } by { 23 | ld a,[hl+] 24 | } 25 | replace { 26 | ld a,[hl] 27 | inc hl 28 | } by { 29 | ld a,[hl+] 30 | } 31 | replace { 32 | ld [hl],a 33 | inc hl 34 | } by { 35 | ld [hl+],a 36 | } 37 | replace { 38 | ld [hl],a 39 | dec hl 40 | } by { 41 | ld [hl-],a 42 | } 43 | replace { 44 | ld (hl+),a 45 | ld (hl),d 46 | dec hl 47 | ld e,(hl) 48 | inc hl 49 | ld d,(hl) 50 | ld a,(de) 51 | } by { 52 | ld (hl+),a 53 | ld (hl),d 54 | ld e,a 55 | ld a,(de) 56 | } 57 | replace { 58 | ld (hl),a 59 | ld %1,(hl) 60 | } by { 61 | ld (hl),a 62 | ld %1,a 63 | } 64 | -------------------------------------------------------------------------------- /gbdk-lib/libc/rrgb/crt0.s: -------------------------------------------------------------------------------- 1 | ;; Generic crt0.s for rrgb 2 | .globl _main 3 | 4 | .area _HEADER (ABS) 5 | ;; Reset vector 6 | .org 0 7 | jp init 8 | 9 | .org 0x08 10 | reti 11 | .org 0x10 12 | reti 13 | .org 0x18 14 | reti 15 | .org 0x20 16 | reti 17 | .org 0x28 18 | reti 19 | .org 0x30 20 | reti 21 | .org 0x38 22 | reti 23 | 24 | .org 0x100 25 | jp 0x150 26 | 27 | .org 0x150 28 | init: 29 | di 30 | ;; Stack at the top of memory. 31 | ld sp,#0xdfff 32 | 33 | call _main 34 | jp _exit 35 | 36 | ;; Ordering of segments for the linker. 37 | .area _CODE 38 | .area _DATA 39 | 40 | __clock:: 41 | ld a,#2 42 | rst 0x00 43 | ret 44 | 45 | _getsp:: 46 | ld hl,#0 47 | add hl,sp 48 | ret 49 | 50 | __printTStates:: 51 | ld a,#3 52 | rst 0x00 53 | ret 54 | 55 | _exit:: 56 | ;; Exit - special code to the emulator 57 | ld a,#1 58 | rst 0x00 59 | 1$: 60 | halt 61 | jr 1$ 62 | -------------------------------------------------------------------------------- /sdcc/device/examples/startupcode/src/makefile.dep: -------------------------------------------------------------------------------- 1 | startup_code.rel: startup_code.c ../inc/startup_code.h \ 2 | ../inc/..\inc\hardware_description.h ../inc/..\inc\c515a.h \ 3 | /usr/local/share/include/stdarg.h /usr/local/share/include/stdio.h \ 4 | /usr/local/share/include/stdlib.h /usr/local/share/include/string.h \ 5 | /usr/local/share/include/ctype.h /usr/local/share/include/assert.h \ 6 | /usr/local/share/include/limits.h /usr/local/share/include/malloc.h \ 7 | ../inc/..\inc\cpu_c515a.h 8 | cpu_c515a.rel: cpu_c515a.c ../inc/hardware_description.h \ 9 | ../inc/..\inc\c515a.h /usr/local/share/include/stdarg.h \ 10 | /usr/local/share/include/stdio.h /usr/local/share/include/stdlib.h \ 11 | /usr/local/share/include/string.h /usr/local/share/include/ctype.h \ 12 | /usr/local/share/include/assert.h /usr/local/share/include/limits.h \ 13 | /usr/local/share/include/malloc.h ../inc/..\inc\cpu_c515a.h 14 | -------------------------------------------------------------------------------- /sdcc/src/regression/xor.c: -------------------------------------------------------------------------------- 1 | unsigned char success=0; 2 | unsigned char failures=0; 3 | unsigned char dummy=0; 4 | 5 | unsigned char achar0 = 0; 6 | unsigned char achar1 = 0; 7 | unsigned char achar2 = 0; 8 | 9 | void done() 10 | { 11 | 12 | dummy++; 13 | 14 | } 15 | 16 | void xor_chars_0_1(void) 17 | { 18 | 19 | achar2 = achar0 ^ achar1; 20 | 21 | achar0 = achar0 ^ 0x1; 22 | 23 | achar1 = achar0 ^ achar1 ^ 4; 24 | } 25 | 26 | void xor_if(void) 27 | { 28 | 29 | if(achar0 ^ achar1) 30 | failures++; 31 | 32 | achar0 ^= 0xff; 33 | 34 | if( !(achar0 ^ achar1) ) 35 | failures++; 36 | 37 | } 38 | 39 | void main(void) 40 | { 41 | 42 | xor_chars_0_1(); 43 | 44 | if(achar2) 45 | failures++; 46 | 47 | if(achar0 != 1) 48 | failures++; 49 | 50 | if(achar1 != 5) 51 | failures++; 52 | 53 | achar0 = achar1; 54 | xor_if(); 55 | 56 | success = failures; 57 | done(); 58 | } 59 | -------------------------------------------------------------------------------- /sdcc/doc/Makefile: -------------------------------------------------------------------------------- 1 | include ../Makefile.common 2 | 3 | MANUAL = sdccman 4 | TSS = test_suite_spec 5 | 6 | all: $(MANUAL).html $(MANUAL).pdf $(MANUAL).txt \ 7 | $(TSS).html $(TSS).pdf $(TSS).txt 8 | 9 | install: 10 | $(INSTALL) -d $(docdir) 11 | cp -rf *.html *.txt *.pdf z80 avr $(docdir) 12 | 13 | uninstall: 14 | rm -rf $(docdir) 15 | 16 | 17 | $(MANUAL).html: $(MANUAL).tex $(MANUAL).ind ;#$(MANUAL).glo 18 | latex2html -split 5 -show_section_numbers -dir $(MANUAL).html $(MANUAL) 19 | 20 | $(TSS).html: $(TSS).tex 21 | latex2html -split 0 -dir $(TSS).html $(TSS) 22 | 23 | %.txt: %.lyx 24 | lyx -e text $< 25 | 26 | %.pdf: %.dvi 27 | pdflatex $* 28 | 29 | %.dvi: %.tex 30 | latex $< 31 | 32 | %.tex: %.lyx 33 | lyx -e latex $< 34 | 35 | %.ind: %.dvi 36 | makeindex -s l2hidx.ist $* 37 | 38 | %.glo: %.dvi 39 | # the glossary, not implemented yet 40 | # makeindex -s l2hglo.ist -o $@ $< 41 | 42 | include clean.mk 43 | -------------------------------------------------------------------------------- /sdcc/device/examples/serialcomm/windows/test_serialcomm.cpp: -------------------------------------------------------------------------------- 1 | // Test program for serial communication. Visual C / MFC Version 2 | // Bela Torok / bela.torok@kssg.ch, March 2001 3 | 4 | #include // Defines the entry point for the console application. 5 | 6 | #include 7 | #include 8 | 9 | #include "serial.h" 10 | 11 | int main(int argc, char* argv[]) 12 | { 13 | 14 | HANDLE hComPort; 15 | 16 | int ComPortNumber = 1; 17 | 18 | hComPort = SerialInit("com1", 1200); // 1200 Baud 19 | 20 | if( hComPort == 0) { 21 | printf("\n\nError initializing %s!\n", "com1"); 22 | exit(1); 23 | } 24 | 25 | // write string to RS232 26 | SerialPuts(&hComPort, "\nInitialize\n"); 27 | // sleep(5000); 28 | 29 | // read string from RS232 30 | printf("\nString received: %s\n", SerialGets(&hComPort)); 31 | 32 | CloseHandle(hComPort); 33 | 34 | return 0; 35 | } 36 | 37 | -------------------------------------------------------------------------------- /sdcc/sim/ucsim/cmd.src/clean.mk: -------------------------------------------------------------------------------- 1 | # 2 | # ucsim cmd.src/clean.mk 3 | # 4 | 5 | # Deleting all files created by building the program 6 | # -------------------------------------------------- 7 | clean: 8 | rm -f *core *[%~] *.[oa] 9 | rm -f .[a-z]*~ 10 | 11 | 12 | # Deleting all files created by configuring or building the program 13 | # ----------------------------------------------------------------- 14 | distclean: clean 15 | rm -f config.cache config.log config.status 16 | rm -f Makefile *.dep 17 | 18 | 19 | # Like clean but some files may still exist 20 | # ----------------------------------------- 21 | mostlyclean: clean 22 | 23 | 24 | # Deleting everything that can reconstructed by this Makefile. It deletes 25 | # everything deleted by distclean plus files created by bison, etc. 26 | # ----------------------------------------------------------------------- 27 | realclean: distclean 28 | 29 | # End of cmd.src/clean.mk 30 | -------------------------------------------------------------------------------- /sdcc/support/cpp2/clean.mk: -------------------------------------------------------------------------------- 1 | PRJDIR = ../.. 2 | 3 | # Deleting all files created by building the program 4 | # -------------------------------------------------- 5 | clean: 6 | rm -f *core *[%~] *.[oa] 7 | rm -f .[a-z]*~ 8 | rm -f $(PRJDIR)/bin/sdcpp 9 | 10 | 11 | # Deleting all files created by configuring or building the program 12 | # ----------------------------------------------------------------- 13 | distclean: clean 14 | rm -f config.cache config.log config.status 15 | rm -f Makefile *.dep auto-host.h configargs.h cstamp-h 16 | 17 | 18 | # Like clean but some files may still exist 19 | # ----------------------------------------- 20 | mostlyclean: clean 21 | 22 | 23 | # Deleting everything that can reconstructed by this Makefile. It deletes 24 | # everything deleted by distclean plus files created by bison, etc. 25 | # ----------------------------------------------------------------------- 26 | realclean: distclean 27 | -------------------------------------------------------------------------------- /sdcc/Makefile.bcc: -------------------------------------------------------------------------------- 1 | all: as cpp ports sdcc packihx cpp2 2 | 3 | as: 4 | cd as\mcs51 5 | make -f Makefile.bcc 6 | cd ..\.. 7 | 8 | cpp: 9 | cd support\cpp 10 | make -f Makefile.bcc 11 | cd ..\.. 12 | 13 | cpp2: 14 | cd support\cpp2 15 | make -f Makefile.bcc 16 | cd ..\.. 17 | 18 | ports: z80 mcs51 avr ds390 pic izt 19 | 20 | z80: 21 | cd src\z80 22 | make -f Makefile.bcc 23 | cd ..\.. 24 | 25 | mcs51: 26 | cd src\mcs51 27 | make -f Makefile.bcc 28 | cd ..\.. 29 | 30 | avr: 31 | cd src\avr 32 | make -f Makefile.bcc 33 | cd ..\.. 34 | 35 | ds390: 36 | cd src\ds390 37 | make -f Makefile.bcc 38 | cd ..\.. 39 | 40 | pic: 41 | cd src\pic 42 | make -f Makefile.bcc 43 | cd ..\.. 44 | 45 | izt: 46 | cd src\izt 47 | make -f Makefile.bcc 48 | cd ..\.. 49 | 50 | sdcc: 51 | cd src 52 | make -f Makefile.bcc 53 | cd .. 54 | 55 | packihx: 56 | cd packihx 57 | make -f Makefile.bcc 58 | cd .. 59 | 60 | -------------------------------------------------------------------------------- /sdcc/src/z80/support.c: -------------------------------------------------------------------------------- 1 | /** @file z80/support.c 2 | */ 3 | #include "z80.h" 4 | #include 5 | 6 | int 7 | convertFloat (Z80_FLOAT * f, double native) 8 | { 9 | unsigned long mantissa, exponent; 10 | double f2; 11 | wassert (f); 12 | if (native != 0) 13 | { 14 | f2 = floor (log (fabs (native)) / log (2)) + 1; 15 | mantissa = (unsigned long) (0x1000000 * fabs (native) / exp (f2 * log (2))) ; 16 | mantissa &= 0xffffff; 17 | exponent = (unsigned long) (f2 + 0x40) ; 18 | if (native < 0) 19 | exponent |= 0x80; 20 | } 21 | else 22 | { 23 | mantissa = 0; 24 | exponent = 0; 25 | } 26 | 27 | f->w[0] = (WORD) mantissa; 28 | f->w[1] = (BYTE) (mantissa >> 16); 29 | f->w[1] |= exponent << 8; 30 | 31 | f->b[0] = (BYTE) f->w[0]; 32 | f->b[1] = (BYTE) (f->w[0] >> 8); 33 | f->b[2] = (BYTE) f->w[1]; 34 | f->b[3] = (BYTE) (f->w[1] >> 8); 35 | 36 | return 0; 37 | } 38 | -------------------------------------------------------------------------------- /sdcc/src/SDCCalloc.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _SDCCalloc_H 3 | #define _SDCCalloc_H 4 | 5 | #include "SDCCerr.h" 6 | 7 | #if OPT_DISABLE_GC != 0 8 | 9 | # include 10 | # define GC_malloc(x) calloc((x), 1) 11 | # define GC_free(x) free(x) 12 | # define GC_realloc realloc 13 | # define GC_malloc_atomic malloc 14 | 15 | #else 16 | 17 | #include "./gc/gc.h" 18 | 19 | #endif 20 | 21 | 22 | #define ALLOC(x,sz) if (!(x = GC_malloc(sz))) \ 23 | { \ 24 | werror(E_OUT_OF_MEM,__FILE__,(long) sz);\ 25 | exit (1); \ 26 | } 27 | 28 | #define ALLOC_ATOMIC(x,sz) if (!((x) = GC_malloc_atomic(sz))) \ 29 | { \ 30 | werror(E_OUT_OF_MEM,__FILE__,(long) sz); \ 31 | exit (1); \ 32 | } 33 | 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /sdcc/support/regression/collate-results.py: -------------------------------------------------------------------------------- 1 | import sys, re 2 | import string 3 | 4 | """Simple script that scans all of the test suite results text fed in 5 | through stdin and summarises the total number of failures, test 6 | points, and test cases.""" 7 | 8 | # Read in everything 9 | lines = sys.stdin.readlines() 10 | 11 | # Init the running totals 12 | failures = 0 13 | cases = 0 14 | tests = 0 15 | 16 | for line in lines: 17 | # '--- Summary: f/t/c ...', where f = # failures, t = # test points, 18 | # c = # test cases. 19 | if (re.search(r'^--- Summary:', line)): 20 | (summary, data, rest) = re.split(r':', line) 21 | (nfailures, ntests, ncases) = re.split(r'/', data) 22 | failures = failures + string.atof(nfailures) 23 | tests = tests + string.atof(ntests) 24 | cases = cases + string.atof(ncases) 25 | 26 | print "%.0f failures, %.0f tests, %.0f test cases" % (failures, tests, cases) 27 | -------------------------------------------------------------------------------- /sdcc/support/regression/tests/bug-221220.c: -------------------------------------------------------------------------------- 1 | /* bug-221220.c 2 | Or an approximation there of. 3 | */ 4 | #include 5 | 6 | typedef struct { 7 | int filler; 8 | int value; 9 | } TESTSTRUCT; 10 | 11 | static void 12 | incrementValue(TESTSTRUCT *ps) 13 | { 14 | ps->value++; 15 | } 16 | 17 | static void 18 | subTestStructVolatile(TESTSTRUCT *ps) 19 | { 20 | int a, b; 21 | 22 | /* sdcc used to cache the value of ps->value into registers, such 23 | that as a = ps->value and b = ps->value, then a = b. However 24 | if an intervening function uses the structure then ps->value 25 | could change. 26 | */ 27 | a = ps->value; 28 | incrementValue(ps); 29 | b = ps->value; 30 | 31 | ASSERT(a == 7); 32 | ASSERT(b == 8); 33 | } 34 | 35 | static void 36 | testStructVolatile(void) 37 | { 38 | TESTSTRUCT s; 39 | 40 | s.value = 7; 41 | subTestStructVolatile(&s); 42 | } 43 | -------------------------------------------------------------------------------- /sdcc/device/examples/clean.mk: -------------------------------------------------------------------------------- 1 | include incl.mk 2 | 3 | # Deleting all files created by building the program 4 | # -------------------------------------------------- 5 | clean: 6 | rm -f *core *[%~] *.[oa] *.rel *.lst *.sym *.asm *.ihx *.dump* 7 | rm -f .[a-z]*~ 8 | rm -f *.dump* 9 | for model in $(MODELS); do \ 10 | rm -rf $$model; \ 11 | done 12 | 13 | 14 | # Deleting all files created by configuring or building the program 15 | # ----------------------------------------------------------------- 16 | distclean: clean 17 | rm -f Makefile *.dep 18 | 19 | 20 | # Like clean but some files may still exist 21 | # ----------------------------------------- 22 | mostlyclean: clean 23 | 24 | 25 | # Deleting everything that can reconstructed by this Makefile. It deletes 26 | # everything deleted by distclean plus files created by bison, etc. 27 | # ----------------------------------------------------------------------- 28 | realclean: distclean 29 | -------------------------------------------------------------------------------- /sdcc/sim/ucsim/doc/interrupt.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Simulator for MCS51 4 | 5 | 6 | 7 | 8 |

Software simulator for MCS51

9 | 10 | This screenshot demonstrates window which displays interrupt system of 11 | the microcontroller. Interrupt enable register and priority register 12 | as well as interrupt request bits are displayed in this window. Note 13 | that if you set some request bit during simulation and interrupt is 14 | enabled, the CPU will accept the interrupt and responding to it by 15 | starting the service routine. 16 | 17 |

18 | 19 |

The `Interrupt/program rate' pane shows ratio of execution time of 20 | main program and interrupt service routines. Content of this pane is 21 | not saved if you close tha window which means that measure of the 22 | ratio is restarted every time you reopen the window. 23 | 24 |


25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /sdcc/sdccconf_in.h: -------------------------------------------------------------------------------- 1 | /* 2 | */ 3 | 4 | #ifndef SDCCCONF_HEADER 5 | #define SDCCCONF_HEADER 6 | 7 | 8 | #undef SDCC_VERSION_HI 9 | #undef SDCC_VERSION_LO 10 | #undef SDCC_VERSION_P 11 | #undef SDCC_VERSION_STR 12 | 13 | #undef PREFIX 14 | #undef DATADIR 15 | #undef SRCDIR 16 | 17 | #undef STANDARD_INCLUDE_DIR 18 | #undef SDCC_INCLUDE_DIR 19 | #undef SDCC_LIB_DIR 20 | #undef STD_LIB 21 | #undef STD_INT_LIB 22 | #undef STD_LONG_LIB 23 | #undef STD_FP_LIB 24 | #undef STD_DS390_LIB 25 | #undef HAVE_SYS_SOCKET_H 26 | #undef HAVE_SYS_ISA_DEFS_H 27 | #undef HAVE_ENDIAN_H 28 | #undef HAVE_MACHINE_ENDIAN_H 29 | 30 | #undef HAVE_STRERROR 31 | 32 | #undef OPT_DISABLE_MCS51 33 | #undef OPT_DISABLE_GBZ80 34 | #undef OPT_DISABLE_Z80 35 | #undef OPT_DISABLE_AVR 36 | #undef OPT_DISABLE_DS390 37 | #undef OPT_DISABLE_PIC 38 | #undef OPT_DISABLE_I186 39 | #undef OPT_DISABLE_TLCS900H 40 | 41 | #undef OPT_ENABLE_LIBGC 42 | 43 | #endif 44 | 45 | /* End of config.h */ 46 | -------------------------------------------------------------------------------- /sdcc/src/asm.h: -------------------------------------------------------------------------------- 1 | #ifndef ASM_PORT_INCLUDE 2 | #define ASM_PORT_INCLUDE 3 | 4 | void tfprintf (FILE * fp, const char *szFormat,...); 5 | void tsprintf (char *buffer, const char *szFormat,...); 6 | void tvsprintf (char *buffer, const char *szFormat, va_list ap); 7 | 8 | typedef struct 9 | { 10 | const char *szKey; 11 | const char *szValue; 12 | } 13 | ASM_MAPPING; 14 | 15 | typedef struct _ASM_MAPPINGS ASM_MAPPINGS; 16 | 17 | /* PENDING: could include the peephole rules here as well. 18 | */ 19 | struct _ASM_MAPPINGS 20 | { 21 | const ASM_MAPPINGS *pParent; 22 | const ASM_MAPPING *pMappings; 23 | }; 24 | 25 | /* The default asxxxx token mapping. 26 | */ 27 | extern const ASM_MAPPINGS asm_asxxxx_mapping; 28 | extern const ASM_MAPPINGS asm_gas_mapping; 29 | 30 | /** Last entry has szKey = NULL. 31 | */ 32 | void asm_addTree (const ASM_MAPPINGS * pMappings); 33 | 34 | char *FileBaseName (char *fileFullName); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /sdcc/src/regression/b.c: -------------------------------------------------------------------------------- 1 | 2 | unsigned char success = 0; 3 | unsigned char dummy = 0; 4 | 5 | unsigned char uchar0=0; 6 | unsigned char uchar1=0; 7 | unsigned char uchar2=0; 8 | 9 | 10 | void done(void) 11 | { 12 | dummy++; 13 | } 14 | /* 15 | void incptr(unsigned char *ucP) 16 | { 17 | *ucP = *ucP + 1; 18 | } 19 | */ 20 | 21 | void inc(unsigned char k) 22 | { 23 | uchar0 = uchar0 + k; 24 | } 25 | 26 | void f1(void) 27 | { 28 | 29 | uchar2++; 30 | } 31 | 32 | void nested_call(unsigned char u) 33 | { 34 | 35 | f1(); 36 | uchar1 = uchar1 + u; 37 | inc(uchar1); 38 | 39 | } 40 | // uchar1 = uchar1 + uchar0; 41 | // uchar2 = uchar1 + k; 42 | 43 | void main(void) 44 | { 45 | 46 | uchar0=1; 47 | //incptr(&uchar0); 48 | inc(uchar0); 49 | if(uchar0 !=2) 50 | success++; 51 | 52 | uchar0 = 2; 53 | uchar1 = 1; 54 | uchar2 = 1; 55 | nested_call(uchar2); 56 | 57 | if(uchar0 !=4) 58 | success++; 59 | 60 | done(); 61 | } 62 | -------------------------------------------------------------------------------- /sdcc/sim/ucsim/gui.src/serio.src/clean.mk: -------------------------------------------------------------------------------- 1 | # uCsim gui.src/serio.src/clean.mk 2 | 3 | # Deleting all files created by building the program 4 | # -------------------------------------------------- 5 | clean: 6 | rm -f *core *[%~] *.[oa] 7 | rm -f .[a-z]*~ 8 | rm -f serialview 9 | 10 | 11 | # Deleting all files created by configuring or building the program 12 | # ----------------------------------------------------------------- 13 | distclean: clean 14 | rm -f config.cache config.log config.status 15 | rm -f Makefile *.dep 16 | 17 | 18 | # Like clean but some files may still exist 19 | # ----------------------------------------- 20 | mostlyclean: clean 21 | 22 | 23 | # Deleting everything that can reconstructed by this Makefile. It deletes 24 | # everything deleted by distclean plus files created by bison, etc. 25 | # ----------------------------------------------------------------------- 26 | realclean: distclean 27 | 28 | # End of gui.src/serio.src/clean.mk 29 | -------------------------------------------------------------------------------- /sdcc/sim/ucsim/s51.src/clean.mk: -------------------------------------------------------------------------------- 1 | # uCsim s51.src/clean.mk 2 | 3 | # Deleting all files created by building the program 4 | # -------------------------------------------------- 5 | clean: 6 | rm -f *core *[%~] *.[oa] 7 | rm -f test_*.??* '(null).cdb' 8 | rm -f .[a-z]*~ 9 | rm -f s51 10 | 11 | 12 | # Deleting all files created by configuring or building the program 13 | # ----------------------------------------------------------------- 14 | distclean: clean 15 | rm -f config.cache config.log config.status 16 | rm -f Makefile *.dep 17 | 18 | 19 | # Like clean but some files may still exist 20 | # ----------------------------------------- 21 | mostlyclean: clean 22 | 23 | 24 | # Deleting everything that can reconstructed by this Makefile. It deletes 25 | # everything deleted by distclean plus files created by bison, etc. 26 | # ----------------------------------------------------------------------- 27 | realclean: distclean 28 | 29 | # End of s51.src/clean.mk 30 | -------------------------------------------------------------------------------- /gbdk-lib/libc/gb/Makefile: -------------------------------------------------------------------------------- 1 | # GB specific Makefile 2 | 3 | TOPDIR = ../.. 4 | 5 | THIS = gb 6 | PORT = gbz80 7 | 8 | CSRC = digits.c gprint.c gprintf.c gprintln.c gprintn.c 9 | 10 | ASSRC = cgb.s cpy_data.s drawing.s f_ibm_sh.s \ 11 | f_italic.s f_min.s f_spect.s get_bk_t.s get_data.s \ 12 | get_prop.s get_spr.s get_wi_t.s get_xy_t.s global.s \ 13 | hiramcpy.s ibmfixed.s init_tt.s input.s mv_bkg.s \ 14 | mv_spr.s mv_win.s pad.s sample.s \ 15 | scroll_b.s scroll_s.s scroll_w.s serial.s set_bk_t.s \ 16 | set_data.s set_prop.s set_spr.s set_wi_t.s set_xy_t.s \ 17 | sgb.s font.s delay.s \ 18 | rand.s arand.s \ 19 | crt0.s 20 | 21 | ifeq ($(ASM),asxxxx) 22 | ASSRC += sfr.s 23 | endif 24 | ifeq ($(ASM),rgbds) 25 | ASSRC += stubs.s 26 | endif 27 | 28 | CRT0 = crt0.s 29 | 30 | include $(TOPDIR)/Makefile.common 31 | 32 | AS = $(AS_GBZ80) 33 | 34 | include ../Makefile.platform 35 | 36 | #OBJ = crt0.o putchar.o font.o ibmfixed.o drawing.o init_tt.o \ 37 | # cpy_data.o 38 | -------------------------------------------------------------------------------- /sdcc/device/examples/startupcode/src/makefile: -------------------------------------------------------------------------------- 1 | # Makefile for startup-code 2 | 3 | SDCC = sdcc 4 | AS = asx8051 5 | CP = cp 6 | RM = rm -f 7 | 8 | CFLAGS = --debug --stack-after-data --model-large 9 | LDFLAGS = --debug --stack-after-data 10 | 11 | COBJECTS = startup_code.rel \ 12 | cpu_c515a.rel 13 | 14 | CSOURCES = $(patsubst %.rel,%.c,$(COBJECTS)) 15 | 16 | .SUFFIXES: .rel 17 | 18 | .c.rel: 19 | $(SDCC) $(CFLAGS) -c $< 20 | 21 | all: startup 22 | $(SDCC) $(LDFLAGS) $(COBJECTS) 23 | 24 | c: $(COBJECTS) 25 | 26 | startup: $(COBJECTS) 27 | 28 | clean: 29 | $(RM) *.lst 30 | $(RM) *.asm 31 | $(RM) *.bak 32 | $(RM) *.rst 33 | $(RM) *.sym 34 | $(RM) *.hex 35 | $(RM) *.map 36 | 37 | include makefile.dep 38 | 39 | dep: makefile.dep 40 | 41 | makefile.dep: $(CSOURCES) 42 | rm -f makefile.dep 43 | for csrc in $(CSOURCES) ;do\ 44 | $(SDCC) -MM $$csrc >>makefile.dep ;\ 45 | done 46 | -------------------------------------------------------------------------------- /sdcc/sim/ucsim/avr.src/clean.mk: -------------------------------------------------------------------------------- 1 | # avr.src/clean.mk 2 | 3 | # Deleting all files created by building the program 4 | # -------------------------------------------------- 5 | clean: 6 | rm -f *core *[%~] *.[oa] *.map 7 | rm -f .[a-z]*~ 8 | rm -f savr 9 | 10 | 11 | # Deleting all files created by configuring or building the program 12 | # ----------------------------------------------------------------- 13 | distclean: clean 14 | rm -f config.cache config.log config.status 15 | rm -f Makefile *.dep 16 | rm -f *.obj *.list *.lst *.hex 17 | 18 | 19 | # Like clean but some files may still exist 20 | # ----------------------------------------- 21 | mostlyclean: clean 22 | 23 | 24 | # Deleting everything that can reconstructed by this Makefile. It deletes 25 | # everything deleted by distclean plus files created by bison, etc. 26 | # ----------------------------------------------------------------------- 27 | realclean: distclean 28 | 29 | # End of avr.src/clean.mk 30 | -------------------------------------------------------------------------------- /sdcc/sim/ucsim/gui.src/obsolete/portmon.src/clean.mk: -------------------------------------------------------------------------------- 1 | # uCsim gui.src/portmon.src/clean.mk 2 | 3 | # Deleting all files created by building the program 4 | # -------------------------------------------------- 5 | clean: 6 | rm -f *core *[%~] *.[oa] 7 | rm -f .[a-z]*~ 8 | rm -f portmon 9 | 10 | 11 | # Deleting all files created by configuring or building the program 12 | # ----------------------------------------------------------------- 13 | distclean: clean 14 | rm -f config.cache config.log config.status 15 | rm -f Makefile *.dep 16 | 17 | 18 | # Like clean but some files may still exist 19 | # ----------------------------------------- 20 | mostlyclean: clean 21 | 22 | 23 | # Deleting everything that can reconstructed by this Makefile. It deletes 24 | # everything deleted by distclean plus files created by bison, etc. 25 | # ----------------------------------------------------------------------- 26 | realclean: distclean 27 | 28 | # End of gui.src/portmon.src/clean.mk 29 | -------------------------------------------------------------------------------- /gbdk-lib/libc/consolez80/crt0.s: -------------------------------------------------------------------------------- 1 | ;; Generic crt0.s for a Z80 2 | .globl _main 3 | 4 | .area _HEADER (ABS) 5 | ;; Reset vector 6 | .org 0 7 | jp init 8 | 9 | .org 0x08 10 | reti 11 | .org 0x10 12 | reti 13 | .org 0x18 14 | reti 15 | .org 0x20 16 | reti 17 | .org 0x28 18 | reti 19 | .org 0x30 20 | reti 21 | .org 0x38 22 | reti 23 | 24 | .org 0x150 25 | init: 26 | ;; Stack at the top of memory. 27 | ld sp,#0xffff 28 | 29 | ;; Use _main instead of main to bypass sdcc's intelligence 30 | ei 31 | call _main 32 | jp _exit 33 | 34 | ;; Ordering of segments for the linker. 35 | .area _HOME 36 | .area _BASE 37 | .area _CODE 38 | .area _DATA 39 | 40 | .area _CODE 41 | _clock:: 42 | ld a,#2 43 | out (0xff),a 44 | ret 45 | 46 | _getsp:: 47 | ld hl,#0 48 | add hl,sp 49 | ret 50 | 51 | __printTStates:: 52 | ld a,#3 53 | out (0xff),a 54 | ret 55 | 56 | _exit:: 57 | ;; Exit - special code to the emulator 58 | ld a,#1 59 | out (0xff),a 60 | 1$: 61 | halt 62 | jr 1$ 63 | -------------------------------------------------------------------------------- /sdcc/device/lib/ds390/Makefile: -------------------------------------------------------------------------------- 1 | CC = ../../../bin/sdcc 2 | 3 | #VERBOSE = --verbose 4 | 5 | OBJECTS = tinibios.rel memcpyx.rel lcd390.rel i2c390.rel rtc390.rel 6 | 7 | SOURCES = $(patsubst %.rel,%.c,$(OBJECTS)) 8 | 9 | CPPFLAGS = -I../../include 10 | CFLAGS = -mds390 $(CPPFLAGS) $(VERBOSE) 11 | 12 | all: $(OBJECTS) libds390.lib 13 | 14 | clean: 15 | rm -f *.lst *.rel *.sym *.cdb *.asm \#* *~ *.rst *.hex 16 | rm -f *.ihx temp.lnk *.map *.lib 17 | 18 | superclean: 19 | make clean ; rm Makefile.dep 20 | 21 | libds390.lib: $(OBJECTS) 22 | rm -f $@; \ 23 | for libfile in $(OBJECTS); do \ 24 | echo $$libfile >>$@; \ 25 | done; 26 | 27 | %.rel: %.c 28 | $(CC) -c $(CFLAGS) $< 29 | 30 | # Creating dependencies 31 | # --------------------- 32 | depend: Makefile.dep 33 | 34 | Makefile.dep: $(SOURCES) 35 | rm -f Makefile.dep 36 | for i in $(SOURCES); do \ 37 | $(CC) -M $(CPPFLAGS) $$i >$${i}.dep; \ 38 | cat $${i}.dep >>Makefile.dep; \ 39 | rm $${i}.dep; \ 40 | done 41 | 42 | include Makefile.dep 43 | -------------------------------------------------------------------------------- /sdcc/sim/ucsim/doc/obsolete.html: -------------------------------------------------------------------------------- 1 |

bl

2 | 3 | List breakpoints. This command prints out information about every 4 | fetch and then event breakpoints. 5 | 6 |
 7 | > bl
 8 | F 1(1) 000160 c2 CLR   P1.0
 9 | D 2(2) 000180 02 LJMP  022a
10 | F 1(1) 000006 wi
11 | > 
12 | 13 | First character on the list shows permanency of the 14 | breakpoint. F means fix and D means dynamic. Second item 15 | on the list is the hit number associated to breakpoint. After that 16 | between the parentheses there is the actual value of the hit 17 | counter. If hit counter reaches zero, breakpoint is activated and hit 18 | counter is preset with value of hit number. Next item is the 19 | address. Next items are different for fetch and event breakpoints. 20 | 21 |

Fetch breakpoints list hexadecimal code of instruction at 22 | breakpoint's address and then dissassembled instruction. 23 | 24 |

Event breakpoints list identification of the event's type. 25 | 26 | -------------------------------------------------------------------------------- /sdcc/sim/ucsim/avr.src/info_1111.txt: -------------------------------------------------------------------------------- 1 | BRCS k 1111 00kk kkkk k000 =BRBS 0,k =BRLO k 2 | BRLO k 1111 00kk kkkk k000 =BRBS 0,k =BRCS k 3 | BREQ k 1111 00kk kkkk k001 =BRBS 1,k 4 | BRMI k 1111 00kk kkkk k010 =BRBS 2,k 5 | BRVS k 1111 00kk kkkk k011 =BRBS 3,k 6 | BRLT k 1111 00kk kkkk k100 =BRBS 4,k 7 | BRHS k 1111 00kk kkkk k101 =BRBS 5,k 8 | BRTS k 1111 00kk kkkk k110 =BRBS 6,k 9 | BRIE k 1111 00kk kkkk k111 =BRBS 7,k 10 | BRBS s,k 1111 00kk kkkk ksss 11 | 12 | BRCC k 1111 01kk kkkk k000 =BRBC 0,k 13 | BRHS k 1111 01kk kkkk k000 =BRBC 0,k 14 | BRNE k 1111 01kk kkkk k001 =BRBC 1,k 15 | BRPL k 1111 01kk kkkk k010 =BRBC 2,k 16 | BRVC k 1111 01kk kkkk k011 =BRBC 3,k 17 | BRGE k 1111 01kk kkkk k100 =BRBC 4,k 18 | BRHC k 1111 01kk kkkk k101 =BRBC 5,k 19 | BRTC k 1111 01kk kkkk k110 =BRBC 6,k 20 | BRID k 1111 01kk kkkk k111 =BRBC 7,k 21 | BRBC s,k 1111 01kk kkkk ksss 22 | 23 | BLD Rd,b 1111 100d dddd 0bbb 24 | BST Rd,b 1111 101d dddd 0bbb 25 | 26 | SBRC Rr,b 1111 110r rrrr 0bbb 27 | SBRS Rr,b 1111 111r rrrr 0bbb 28 | -------------------------------------------------------------------------------- /sdcc/support/regression/tests/scott-call1.c: -------------------------------------------------------------------------------- 1 | /* 2 | */ 3 | #include 4 | 5 | unsigned int aint0 = 0; 6 | unsigned int aint1 = 0; 7 | unsigned char achar0 = 0; 8 | unsigned char achar1 = 0; 9 | 10 | unsigned char call3 (void); 11 | 12 | void 13 | call1 (unsigned char uc0) 14 | { 15 | ASSERT (!(uc0)); 16 | } 17 | 18 | void 19 | call2 (unsigned int ui0) 20 | { 21 | ASSERT (!(ui0)); 22 | 23 | } 24 | 25 | unsigned char 26 | call3 (void) 27 | { 28 | ASSERT (!(achar0)); 29 | 30 | return 0; 31 | } 32 | 33 | unsigned int 34 | call4 (void) 35 | { 36 | unsigned int i = 0; 37 | 38 | if (aint0) 39 | i++; 40 | 41 | return (i); 42 | 43 | } 44 | 45 | unsigned int 46 | call5 (unsigned int k) 47 | { 48 | 49 | ASSERT (!(k)); 50 | 51 | return (k); 52 | 53 | } 54 | 55 | void 56 | testCall1 (void) 57 | { 58 | 59 | call1 (achar0); 60 | call2 (aint0); 61 | achar1 = call3 (); 62 | aint1 = call4 (); 63 | ASSERT (!(aint1)); 64 | 65 | aint1 = call5 (aint0); 66 | ASSERT (!(aint1)); 67 | } 68 | --------------------------------------------------------------------------------