Close

Porting code to SDCC

A project log for TEK - PS/2 to Matrix Keyboard Adapter/Emulator

Matrix Keyboard emulator designed for retrocomputing use.

danjovicdanjovic 03/31/2016 at 17:420 Comments

After receiving feedback of Joachim from ZX81 user group that assembled the TEK I've started to porting the code to SDCC. At this time I can compile the code in SDCC running under Windows. On Linux I am still dealing with some compilation errors related to libraries but this is a matter for another log.

The porting basically required:

    1. SDCC
    2. GPUTILS
//#fuses INTRC_IO, NOPROTECT, NOBROWNOUT, NOWDT, PUT 
uint16_t __at _CONFIG configWord = _INTRC_OSC_NOCLKOUT & _CPD_OFF & _CP_OFF & _WDT_OFF & _PWRTE_ON; 
// output_low (PIN_SDA);

TRIS_SDA=0; //set as output
PIN_SDA=0;
#define delay_us(x) {  uint8_t us;	\
      us = (x)*FOSC/36000000L - 4/9;\
      while(--us != 0) continue; }

The SDCC compiler provides an estimate size of code generated: 669 instructions.

It is almost the same size of the code generated with CCS. The difference is minimal.

Discussions