URL
https://opencores.org/ocsvn/copyblaze/copyblaze/trunk
Subversion Repositories copyblaze
Compare Revisions
- This comparison shows the changes necessary to convert path
/copyblaze/trunk/copyblaze/sw/tools
- from Rev 44 to Rev 45
- ↔ Reverse comparison
Rev 44 → Rev 45
/comp/pbcc/pbccv2-bin-win32-cygwin-2011-10-24/tests/pblaze/testINOUT.c
0,0 → 1,20
// test INPUT/OUTPUT instrukci |
volatile char gl = 5; |
|
// definice portu |
extern char PBLAZEPORT[]; |
|
void fun(char *a) |
{ |
char i; |
for(i = 0; i < *a; i++) { |
PBLAZEPORT[i] = gl; |
} |
} |
|
void main() |
{ |
char a = PBLAZEPORT[5]; |
fun(&a); |
|
} |
/comp/pbcc/pbccv2-bin-win32-cygwin-2011-10-24/tests/pblaze/vlam_lcd.psm
0,0 → 1,303
;-------------------------------------------------------- |
; File Created by SDCC : free open source ANSI-C Compiler |
; Version 3.0.1 #6227 (Oct 24 2011) (CYGWIN) |
; This file was generated Sun Nov 27 22:32:29 2011 |
;-------------------------------------------------------- |
;-------------------------------------------------------- |
; global & static initialisations |
;-------------------------------------------------------- |
|
LOAD sF, 3f |
JUMP __sdcc_program_startup |
;-------------------------------------------------------- |
; Home |
;-------------------------------------------------------- |
__sdcc_program_startup: |
CALL _main |
; return from main will lock up |
__sdcc_loop: |
JUMP __sdcc_loop |
;-------------------------------------------------------- |
; code |
;-------------------------------------------------------- |
; vlam_lcd.c:30: void delayms() { |
_delayms: |
; vlam_lcd.c:34: for (i = 0; i < 100; i++) |
LOAD s0, 00 |
_L00105: |
LOAD s1, s0 |
COMPARE s1, 64 |
JUMP C, _LC00136 |
JUMP _L00109 |
_LC00136: |
; vlam_lcd.c:35: for (j = 0; j < 255; j++); |
LOAD s1, 00 |
_L00101: |
LOAD s2, s1 |
COMPARE s2, ff |
JUMP C, _LC00137 |
JUMP _L00107 |
_LC00137: |
ADD s1, 01 |
JUMP _L00101 |
_L00107: |
; vlam_lcd.c:34: for (i = 0; i < 100; i++) |
ADD s0, 01 |
JUMP _L00105 |
_L00109: |
RETURN |
; vlam_lcd.c:40: void delay1s() { |
_delay1s: |
; vlam_lcd.c:43: for (i = 0; i < 100; i++) |
LOAD s0, 00 |
_L00115: |
LOAD s1, s0 |
COMPARE s1, 64 |
JUMP C, _LC00138 |
JUMP _L00119 |
_LC00138: |
; vlam_lcd.c:44: delayms(); |
STORE s0, (sF) |
SUB sF, 01 |
CALL _delayms |
ADD sF, 01 |
FETCH s0, (sF) |
; vlam_lcd.c:43: for (i = 0; i < 100; i++) |
ADD s0, 01 |
JUMP _L00115 |
_L00119: |
RETURN |
; vlam_lcd.c:48: void lcd_init() { |
_lcd_init: |
; vlam_lcd.c:49: lcd_cmd(LCD_CLEAR_DISPLAY); |
LOAD s0, 00 |
OUTPUT s0, 71 |
LOAD s0, 01 |
OUTPUT s0, 70 |
CALL _delayms |
LOAD s0, 02 |
OUTPUT s0, 71 |
CALL _delayms |
LOAD s0, 00 |
OUTPUT s0, 71 |
; vlam_lcd.c:50: lcd_cmd(LCD_CURSOR_AT_HOME); |
LOAD s0, 00 |
OUTPUT s0, 71 |
LOAD s0, 02 |
OUTPUT s0, 70 |
CALL _delayms |
LOAD s0, 02 |
OUTPUT s0, 71 |
CALL _delayms |
LOAD s0, 00 |
OUTPUT s0, 71 |
; vlam_lcd.c:51: lcd_cmd(0x38); // LCD function set - osmibitovy prenos, displej slozen ze dvou polovin, font 5x8 |
LOAD s0, 00 |
OUTPUT s0, 71 |
LOAD s0, 38 |
OUTPUT s0, 70 |
CALL _delayms |
LOAD s0, 02 |
OUTPUT s0, 71 |
CALL _delayms |
LOAD s0, 00 |
OUTPUT s0, 71 |
; vlam_lcd.c:52: lcd_cmd(0x0E); // LCD display - zobrazeni kurzoru, zapnuti displeje |
LOAD s0, 00 |
OUTPUT s0, 71 |
LOAD s0, 0e |
OUTPUT s0, 70 |
CALL _delayms |
LOAD s0, 02 |
OUTPUT s0, 71 |
CALL _delayms |
LOAD s0, 00 |
OUTPUT s0, 71 |
; vlam_lcd.c:53: lcd_cmd(0x06); // LCD entry mode - automaticka inkrementace adresy kurzoru |
LOAD s0, 00 |
OUTPUT s0, 71 |
LOAD s0, 06 |
OUTPUT s0, 70 |
CALL _delayms |
LOAD s0, 02 |
OUTPUT s0, 71 |
CALL _delayms |
LOAD s0, 00 |
OUTPUT s0, 71 |
RETURN |
; vlam_lcd.c:57: void lcd_upd(unsigned char val) { |
_lcd_upd: |
LOAD s0, sB |
; vlam_lcd.c:58: lcd_cmd(0x80); //cursor zac |
LOAD s1, 00 |
OUTPUT s1, 71 |
LOAD s1, 80 |
OUTPUT s1, 70 |
STORE s0, (sF) |
SUB sF, 01 |
CALL _delayms |
ADD sF, 01 |
FETCH s0, (sF) |
LOAD s1, 02 |
OUTPUT s1, 71 |
STORE s0, (sF) |
SUB sF, 01 |
CALL _delayms |
ADD sF, 01 |
FETCH s0, (sF) |
LOAD s1, 00 |
OUTPUT s1, 71 |
; vlam_lcd.c:59: lcd_wr('V'); |
LOAD s1, 00 |
OUTPUT s1, 71 |
LOAD s1, 56 |
OUTPUT s1, 70 |
STORE s0, (sF) |
SUB sF, 01 |
CALL _delayms |
ADD sF, 01 |
FETCH s0, (sF) |
LOAD s1, 03 |
OUTPUT s1, 71 |
STORE s0, (sF) |
SUB sF, 01 |
CALL _delayms |
ADD sF, 01 |
FETCH s0, (sF) |
LOAD s1, 01 |
OUTPUT s1, 71 |
; vlam_lcd.c:60: lcd_wr('L'); |
LOAD s1, 00 |
OUTPUT s1, 71 |
LOAD s1, 4c |
OUTPUT s1, 70 |
STORE s0, (sF) |
SUB sF, 01 |
CALL _delayms |
ADD sF, 01 |
FETCH s0, (sF) |
LOAD s1, 03 |
OUTPUT s1, 71 |
STORE s0, (sF) |
SUB sF, 01 |
CALL _delayms |
ADD sF, 01 |
FETCH s0, (sF) |
LOAD s1, 01 |
OUTPUT s1, 71 |
; vlam_lcd.c:61: lcd_wr('A'); |
LOAD s1, 00 |
OUTPUT s1, 71 |
LOAD s1, 41 |
OUTPUT s1, 70 |
STORE s0, (sF) |
SUB sF, 01 |
CALL _delayms |
ADD sF, 01 |
FETCH s0, (sF) |
LOAD s1, 03 |
OUTPUT s1, 71 |
STORE s0, (sF) |
SUB sF, 01 |
CALL _delayms |
ADD sF, 01 |
FETCH s0, (sF) |
LOAD s1, 01 |
OUTPUT s1, 71 |
; vlam_lcd.c:62: lcd_wr('M'); |
LOAD s1, 00 |
OUTPUT s1, 71 |
LOAD s1, 4d |
OUTPUT s1, 70 |
STORE s0, (sF) |
SUB sF, 01 |
CALL _delayms |
ADD sF, 01 |
FETCH s0, (sF) |
LOAD s1, 03 |
OUTPUT s1, 71 |
STORE s0, (sF) |
SUB sF, 01 |
CALL _delayms |
ADD sF, 01 |
FETCH s0, (sF) |
LOAD s1, 01 |
OUTPUT s1, 71 |
; vlam_lcd.c:63: lcd_wr(' '); |
LOAD s1, 00 |
OUTPUT s1, 71 |
LOAD s1, 20 |
OUTPUT s1, 70 |
STORE s0, (sF) |
SUB sF, 01 |
CALL _delayms |
ADD sF, 01 |
FETCH s0, (sF) |
LOAD s1, 03 |
OUTPUT s1, 71 |
STORE s0, (sF) |
SUB sF, 01 |
CALL _delayms |
ADD sF, 01 |
FETCH s0, (sF) |
LOAD s1, 01 |
OUTPUT s1, 71 |
; vlam_lcd.c:64: val = val & 0xF; |
LOAD s1, s0 |
AND s1, 0f |
; vlam_lcd.c:65: val = (val > 9) ? 55 + val : 48 + val; |
LOAD s0, 09 |
COMPARE s0, s1 |
JUMP C, _LC00139 |
JUMP _L00127 |
_LC00139: |
LOAD s0, s1 |
ADD s0, 37 |
LOAD s2, s0 |
JUMP _L00128 |
_L00127: |
LOAD s0, s1 |
ADD s0, 30 |
LOAD s2, s0 |
_L00128: |
LOAD s1, s2 |
; vlam_lcd.c:66: lcd_wr(val); |
LOAD s0, 00 |
OUTPUT s0, 71 |
OUTPUT s1, 70 |
CALL _delayms |
LOAD s0, 03 |
OUTPUT s0, 71 |
CALL _delayms |
LOAD s0, 01 |
OUTPUT s0, 71 |
RETURN |
; vlam_lcd.c:71: void main() { |
_main: |
; vlam_lcd.c:74: lcd_init(); |
CALL _lcd_init |
; vlam_lcd.c:76: while (1) { |
LOAD s0, 00 |
_L00131: |
; vlam_lcd.c:77: lcd_upd(val); |
STORE s0, (sF) |
SUB sF, 01 |
LOAD sB, s0 |
CALL _lcd_upd |
ADD sF, 01 |
FETCH s0, (sF) |
; vlam_lcd.c:78: set_led(val++); |
LOAD s1, s0 |
ADD s0, 01 |
OUTPUT s1, 80 |
; vlam_lcd.c:79: delay1s(); |
STORE s0, (sF) |
SUB sF, 01 |
CALL _delay1s |
ADD sF, 01 |
FETCH s0, (sF) |
JUMP _L00131 |
RETURN |
;-------------------------------------------------------- |
; interrupt vector |
;-------------------------------------------------------- |
/comp/pbcc/pbccv2-bin-win32-cygwin-2011-10-24/tests/pblaze/inctest7.c
0,0 → 1,31
// test bitových operací všeho druhu (pBlazeIDE) |
#include "port.h" |
|
void main() |
{ |
volatile unsigned char c = 1; |
volatile unsigned char d = 1; |
volatile unsigned char e = 15; |
|
c <<= 4; |
|
c >>= 3; |
|
c |= c; |
|
c |= d + 1; |
|
c = c & d; |
|
d = ~e; |
|
e = c ^ d; |
|
c = !c && d || e; |
c = c || e; |
|
if (!c) |
{ |
c = -e; |
} |
} |
/comp/pbcc/pbccv2-bin-win32-cygwin-2011-10-24/tests/pblaze/stubs.c
0,0 → 1,5
void main() |
{ |
int i = 42; |
for (;;) {i--;}; |
} |
/comp/pbcc/pbccv2-bin-win32-cygwin-2011-10-24/tests/pblaze/funvar.c
0,0 → 1,11
char globvar = 13; |
|
char test(char x) |
{ |
return x; |
} |
|
void main() |
{ |
test(globvar); |
} |
/comp/pbcc/pbccv2-bin-win32-cygwin-2011-10-24/tests/pblaze/funlit.c
0,0 → 1,14
char sum(char nnn1, char n2, char n3) |
{ |
return nnn1 + n2 + n3; |
} |
|
|
void main() |
{ |
char c = 29; |
char d = 57; |
char e = 113; |
sum (c, d, e); |
|
} |
/comp/pbcc/pbccv2-bin-win32-cygwin-2011-10-24/tests/pblaze/lcd.c
0,0 → 1,56
//#include <stdio.h> |
|
void __port_write(char port, char arg) { } |
char __port_read(char port) { } |
void __nop() { } |
|
#define LED_wr(arg) __port_write(0x80, (arg)) |
|
#define LCD_wr(arg) __port_write(0x01, (arg)) |
#define LCD_rd() __port_read(0x01) |
#define LCD_busy() (LCD_rd() & 0x80) == 0x80 |
|
void delay_ms(int ms) |
{ |
int i; |
for (i=0;i<ms;i++) { |
for (i=0; i < 10000; i++) __nop(); |
} |
} |
|
void LCD_init() |
{ |
LCD_wr(0x42); |
while (LCD_rd()) { __nop();} |
LCD_wr(0x43); |
delay_ms(10); |
LCD_wr(0x44); |
LCD_wr(0x45); |
} |
|
void LCD_write(char ch) |
{ |
LCD_wr(0x46); |
LCD_wr(0x47); |
} |
|
|
int main(void) { |
char st = 0; |
|
while(1) { |
LED_wr(st); |
st ^= 1; |
delay_ms(1000); |
} |
/* |
char ch = 0x31; |
LCD_init(); |
while (1) { |
LCD_write(ch); |
delay_ms(1000); |
} |
*/ |
} |
|
|
/comp/pbcc/pbccv2-bin-win32-cygwin-2011-10-24/tests/pblaze/pointers.c
0,0 → 1,56
// TODO |
/comp/pbcc/pbccv2-bin-win32-cygwin-2011-10-24/tests/pblaze/types.c
0,0 → 1,18
int i; |
struct stype { |
int x; |
int y; |
} str; |
|
int f(char a, short b) |
{ |
return a + b; |
} |
|
|
int main(void) |
{ |
// stype lstr; |
i = str.x = str.y = 13; |
return f(i, str.x); |
} |
/comp/pbcc/pbccv2-bin-win32-cygwin-2011-10-24/tests/pblaze/test6.c
0,0 → 1,22
// interrupt handler test for pBlazeIDE |
|
char __xdata val = 0; |
char __xdata c; |
|
void interruptHandler() __interrupt |
{ |
val++; |
} |
|
void main() |
{ |
c = 0; |
__asm |
EINT |
__endasm; |
|
for (;;) { |
|
c += 4; |
} |
} |
/comp/pbcc/pbccv2-bin-win32-cygwin-2011-10-24/tests/pblaze/funargs.c
0,0 → 1,15
char f(char arg, char arg2) |
{ |
return arg+arg2; |
} |
|
|
void main() |
{ |
char i = 0; |
for(; i < 10; i++) |
{ |
i++; |
f(i, 17); |
} |
} |
/comp/pbcc/pbccv2-bin-win32-cygwin-2011-10-24/tests/pblaze/simplefunc.c
0,0 → 1,12
char inc(char number) |
{ |
return number + 1; |
} |
|
|
void main() |
{ |
char c = 42; |
inc(c); |
|
} |
/comp/pbcc/pbccv2-bin-win32-cygwin-2011-10-24/tests/pblaze/test7.c
0,0 → 1,30
// test bitových operací všeho druhu (pBlazeIDE) |
|
void main() |
{ |
volatile unsigned char c = 1; |
volatile unsigned char d = 1; |
volatile unsigned char e = 15; |
|
c <<= 4; |
|
c >>= 3; |
|
c |= c; |
|
c |= d + 1; |
|
c = c & d; |
|
d = ~e; |
|
e = c ^ d; |
|
c = !c && d || e; |
c = c || e; |
|
if (!c) |
{ |
c = -e; |
} |
} |
/comp/pbcc/pbccv2-bin-win32-cygwin-2011-10-24/tests/pblaze/test8.c
0,0 → 1,31
// switch test |
|
void main() |
{ |
volatile char c = 5; |
|
// JUMPTABLE generated |
switch(c) |
{ |
case 10: c = 11; break; |
case 11: c = 22; break; |
case 12: c = 33; break; |
case 13: c = 44; break; |
case 14: c = 55; break; |
default: c = 99; |
break; |
} |
|
// sequence of IFXs generated |
switch(c) |
{ |
case 10: c = 11; break; |
case 23: c = 22; break; |
case 31: c = 33; break; |
case 4: c = 44; break; |
case 59: c = 55; break; |
default: c = 99; |
break; |
} |
|
} |
/comp/pbcc/pbccv2-bin-win32-cygwin-2011-10-24/tests/pblaze/test9.c
0,0 → 1,17
// test bitových operací - problem with NOT_OP (pBlazeIDE) |
|
/* link the C libarary */ |
|
//#pragma library c |
|
void main() |
{ |
volatile char c = 1; |
c = !c; |
c = 0; |
c = !c; |
c = c && c; |
c = c || c; |
c = 29; |
c = c % 13; |
} |
/comp/pbcc/pbccv2-bin-win32-cygwin-2011-10-24/tests/pblaze/intr.c
0,0 → 1,18
// test of inserted asm code into C code |
int i; |
|
void ihandler() __interrupt (3) __using (7) |
{ |
_asm |
DISALBE INTERRUPT |
_endasm; |
} |
|
int main(int x, int y) |
{ |
_asm |
INPUT s0 |
_endasm; |
i = 10; |
return i; |
} |
/comp/pbcc/pbccv2-bin-win32-cygwin-2011-10-24/tests/pblaze/inctest7.psm
0,0 → 1,228
;-------------------------------------------------------- |
; File Created by SDCC : free open source ANSI-C Compiler |
; Version 3.0.1 #6227 (Oct 24 2011) (CYGWIN) |
; This file was generated Sun Nov 27 22:30:15 2011 |
;-------------------------------------------------------- |
;-------------------------------------------------------- |
; global & static initialisations |
;-------------------------------------------------------- |
|
LOAD sF, 3f |
JUMP __sdcc_program_startup |
;-------------------------------------------------------- |
; Home |
;-------------------------------------------------------- |
__sdcc_program_startup: |
CALL _main |
; return from main will lock up |
__sdcc_loop: |
JUMP __sdcc_loop |
;-------------------------------------------------------- |
; code |
;-------------------------------------------------------- |
; ../../device/include/pblaze/delay.h:51: void delay(unsigned char time) |
_delay: |
LOAD s0, sB |
; ../../device/include/pblaze/delay.h:53: volatile unsigned char i = time; |
LOAD s1, s0 |
_L00101: |
; ../../device/include/pblaze/delay.h:54: for(; i > 0; i--) |
LOAD s0, s1 |
COMPARE s0, 00 |
JUMP NZ, _LC00135 |
JUMP _L00107 |
_LC00135: |
LOAD s0, 01 |
JUMP _L00108 |
_L00107: |
LOAD s0, 00 |
_L00108: |
COMPARE s0, 00 |
JUMP NZ, _LC00136 |
JUMP _L00105 |
_LC00136: |
; ../../device/include/pblaze/delay.h:72: __endasm; |
LOAD s2, 00 |
ADD s2, 01 |
LOAD s1, 00 |
rpt22: |
ADD s1, 01 |
LOAD s0, 00 |
rpt11: |
ADD s0, 01 |
JUMP NZ, rpt11 |
COMPARE s1, 00 |
JUMP NZ, rpt22 |
; ../../device/include/pblaze/delay.h:54: for(; i > 0; i--) |
SUB s1, 01 |
JUMP _L00101 |
_L00105: |
RETURN |
; ../../device/include/pblaze/port.h:16: void __port_write(unsigned char port, unsigned char arg) |
___port_write: |
LOAD s0, sB |
LOAD s1, sC |
; ../../device/include/pblaze/port.h:20: p = port; |
LOAD s2, s0 |
; ../../device/include/pblaze/port.h:21: a = arg; |
LOAD s0, s1 |
; ../../device/include/pblaze/port.h:24: __endasm; |
OUTPUT _a, _p |
; ../../device/include/pblaze/port.h:25: delay(MIN_PAUSE); |
STORE s0, (sF) |
SUB sF, 01 |
STORE s2, (sF) |
SUB sF, 01 |
LOAD sB, 0a |
CALL _delay |
ADD sF, 01 |
FETCH s2, (sF) |
ADD sF, 01 |
FETCH s0, (sF) |
RETURN |
; ../../device/include/pblaze/port.h:28: unsigned char __port_read(volatile unsigned char port) |
___port_read: |
LOAD s0, sB |
; ../../device/include/pblaze/port.h:30: volatile unsigned char d = 0; |
LOAD s1, 00 |
; ../../device/include/pblaze/port.h:31: volatile unsigned char p = port; |
LOAD s2, s0 |
LOAD s3, s2 |
; ../../device/include/pblaze/port.h:34: __endasm; |
INPUT _d, _p |
; ../../device/include/pblaze/port.h:35: delay(MIN_PAUSE); |
STORE s0, (sF) |
SUB sF, 01 |
STORE s1, (sF) |
SUB sF, 01 |
STORE s3, (sF) |
SUB sF, 01 |
LOAD sB, 0a |
CALL _delay |
ADD sF, 01 |
FETCH s3, (sF) |
ADD sF, 01 |
FETCH s1, (sF) |
ADD sF, 01 |
FETCH s0, (sF) |
; ../../device/include/pblaze/port.h:36: return d; |
LOAD s2, s1 |
LOAD sB, s2 |
RETURN |
; inctest7.c:4: void main() |
_main: |
; inctest7.c:6: volatile unsigned char c = 1; |
LOAD s0, 01 |
; inctest7.c:7: volatile unsigned char d = 1; |
LOAD s1, 01 |
; inctest7.c:8: volatile unsigned char e = 15; |
LOAD s2, 0f |
; inctest7.c:10: c <<= 4; |
LOAD s3, s0 |
SL0 s3 |
SL0 s3 |
SL0 s3 |
SL0 s3 |
LOAD s0, s3 |
; inctest7.c:12: c >>= 3; |
LOAD s3, s0 |
SR0 s3 |
SR0 s3 |
SR0 s3 |
LOAD s0, s3 |
; inctest7.c:14: c |= c; |
LOAD s3, s0 |
LOAD s4, s0 |
OR s4, s3 |
LOAD s0, s4 |
; inctest7.c:16: c |= d + 1; |
LOAD s3, s1 |
ADD s3, 01 |
LOAD s4, s0 |
OR s4, s3 |
LOAD s0, s4 |
; inctest7.c:18: c = c & d; |
LOAD s3, s0 |
LOAD s4, s1 |
AND s3, s4 |
LOAD s0, s3 |
; inctest7.c:20: d = ~e; |
LOAD s3, s2 |
XOR s3, ff |
LOAD s1, s3 |
; inctest7.c:22: e = c ^ d; |
LOAD s3, s1 |
LOAD s4, s0 |
XOR s4, s3 |
LOAD s2, s4 |
; inctest7.c:24: c = !c && d || e; |
LOAD s3, s0 |
LOAD s4, 00 |
COMPARE s3, 00 |
JUMP NZ, _LC00137 |
LOAD s4, 01 |
_LC00137: |
COMPARE s4, 00 |
JUMP NZ, _LC00138 |
JUMP _L00123 |
_LC00138: |
LOAD s3, s1 |
COMPARE s3, 00 |
JUMP Z, _LC00139 |
JUMP _L00124 |
_LC00139: |
_L00123: |
LOAD s3, 00 |
JUMP _L00125 |
_L00124: |
LOAD s3, 01 |
_L00125: |
COMPARE s3, 00 |
JUMP Z, _LC00140 |
JUMP _L00121 |
_LC00140: |
LOAD s3, s2 |
COMPARE s3, 00 |
JUMP Z, _LC00141 |
JUMP _L00121 |
_LC00141: |
LOAD s3, 00 |
JUMP _L00122 |
_L00121: |
LOAD s3, 01 |
_L00122: |
LOAD s0, s3 |
; inctest7.c:25: c = c || e; |
LOAD s3, s0 |
COMPARE s3, 00 |
JUMP Z, _LC00142 |
JUMP _L00127 |
_LC00142: |
LOAD s3, s2 |
COMPARE s3, 00 |
JUMP Z, _LC00143 |
JUMP _L00127 |
_LC00143: |
LOAD s3, 00 |
JUMP _L00128 |
_L00127: |
LOAD s3, 01 |
_L00128: |
LOAD s0, s3 |
; inctest7.c:27: if (!c) |
LOAD s3, s0 |
COMPARE s3, 00 |
JUMP Z, _LC00144 |
JUMP _L00118 |
_LC00144: |
; inctest7.c:29: c = -e; |
LOAD s3, s2 |
LOAD s4, s3 |
XOR s4, ff |
ADD s4, 01 |
LOAD s0, s4 |
_L00118: |
RETURN |
;-------------------------------------------------------- |
; interrupt vector |
;-------------------------------------------------------- |
/comp/pbcc/pbccv2-bin-win32-cygwin-2011-10-24/tests/pblaze/operators.c
0,0 → 1,11
int main() |
{ |
int i = 0; |
int j = 13; |
zkouska: |
i += 2; |
j -= i; |
i |= j; |
goto zkouska; |
return i*j; |
} |
/comp/pbcc/pbccv2-bin-win32-cygwin-2011-10-24/tests/pblaze/testM2.c
0,0 → 1,35
// test ruzne typy ukazatelu |
|
int pole[] = {100,200,300,400}; |
char text[] = "Pepa"; |
int nepole = 6; |
volatile int *vgptr; |
int *gptr; |
|
|
char fun( volatile char *a, int b, char c, char *d) |
{ |
volatile char val = 0; |
char t1 = *d; |
|
val = val * c; |
b = pole[3] & pole[1]; |
text[2] = 'R'; |
*d = text[3]; |
return t1 + b + nepole; |
} |
|
void main() |
{ |
volatile char a = 10; |
volatile char b = 20; |
char c = 30; |
gptr = &nepole; |
vgptr = &nepole; |
pole[1] = 150; |
pole[0] = *gptr; |
*vgptr = 18; |
fun(&a,555,c, &c); |
nepole = c; |
|
} |
/comp/pbcc/pbccv2-bin-win32-cygwin-2011-10-24/tests/pblaze/test10.c
0,0 → 1,23
// test array of ints |
|
#define ARRAY_SIZE 10 |
|
volatile short numbers[ARRAY_SIZE] = {9,8,7,6,5,4,3,2,1,0}; |
|
void main() |
{ |
short i, j, temp; |
|
for (i = (ARRAY_SIZE - 1); i > 0; i--) |
{ |
for (j = 1; j <= i; j++) |
{ |
if (numbers[j-1] > numbers[j]) |
{ |
temp = numbers[j-1]; |
numbers[j-1] = numbers[j]; |
numbers[j] = temp; |
} |
} |
} |
} |
/comp/pbcc/pbccv2-bin-win32-cygwin-2011-10-24/tests/pblaze/asm.c
0,0 → 1,17
// test of inserted asm code into C code |
int i; |
|
/* |
asm |
ENABLE_INTERRUPT; |
endasm |
*/ |
|
int main(void) |
{ |
__asm |
INPUT s0 |
__endasm; |
i = 10; |
return i; |
} |
/comp/pbcc/pbccv2-bin-win32-cygwin-2011-10-24/tests/pblaze/vlam_lcd.c
0,0 → 1,89
// definice portu |
extern char PBLAZEPORT[]; |
|
#define port_led 0x80 |
#define port_lcd_low 0x70 // Port address |
#define port_lcd_high 0x71 // Port address 71 + 70 LE|LRS LD |
|
// INFO: |
// PORT[x] = y se mapuje automaticky na dvojici instrukci LOAD s?, y; OUTPUT s?, x |
// alokace registru se provadi dle aktualniho obsazeni |
#define set_led(val) PBLAZEPORT[port_led] = val |
|
#define led_on() set_led(0) |
#define led_off() set_led(1) |
|
volatile unsigned char x; |
/* |
|
#define lcd_cmd(cmd) { PBLAZEPORT[port_lcd_high] = 0; PBLAZEPORT[port_lcd_low] = cmd; delayms(); PBLAZEPORT[port_lcd_high] = 2; delayms(); PBLAZEPORT[port_lcd_high] = 0;} |
#define lcd_wr(cmd) { x=1; PBLAZEPORT[port_lcd_high] = x; x=cmd; PBLAZEPORT[port_lcd_low] = x; delayms(); x=3; PBLAZEPORT[port_lcd_high] = x; delayms(); x=1; PBLAZEPORT[port_lcd_high] = x;} |
|
*/ |
#define lcd_cmd(cmd) { PBLAZEPORT[port_lcd_high] = 0; PBLAZEPORT[port_lcd_low] = cmd; delayms(); PBLAZEPORT[port_lcd_high] = 2; delayms(); PBLAZEPORT[port_lcd_high] = 0;} |
#define lcd_wr(cmd) { PBLAZEPORT[port_lcd_high] = 0; PBLAZEPORT[port_lcd_low] = cmd; delayms(); PBLAZEPORT[port_lcd_high] = 3; delayms(); PBLAZEPORT[port_lcd_high] = 1;} |
|
#define LCD_CLEAR_DISPLAY 0x01 |
#define LCD_CURSOR_AT_HOME 0x02 |
|
//cekaci smycka ~ 1ms |
void delayms() { |
volatile unsigned char i; |
volatile unsigned char j; |
|
for (i = 0; i < 100; i++) |
for (j = 0; j < 255; j++); |
|
} |
|
//cekaci smycka ~ 1s |
void delay1s() { |
volatile unsigned char i; |
|
for (i = 0; i < 100; i++) |
delayms(); |
} |
|
|
void lcd_init() { |
lcd_cmd(LCD_CLEAR_DISPLAY); |
lcd_cmd(LCD_CURSOR_AT_HOME); |
lcd_cmd(0x38); // LCD function set - osmibitovy prenos, displej slozen ze dvou polovin, font 5x8 |
lcd_cmd(0x0E); // LCD display - zobrazeni kurzoru, zapnuti displeje |
lcd_cmd(0x06); // LCD entry mode - automaticka inkrementace adresy kurzoru |
|
} |
|
void lcd_upd(unsigned char val) { |
lcd_cmd(0x80); //cursor zac |
lcd_wr('V'); |
lcd_wr('L'); |
lcd_wr('A'); |
lcd_wr('M'); |
lcd_wr(' '); |
val = val & 0xF; |
val = (val > 9) ? 55 + val : 48 + val; |
lcd_wr(val); |
} |
|
// hlavni program |
// blikani s LED, perioda 1 sekunda |
void main() { |
unsigned char val = 0; |
|
lcd_init(); |
|
while (1) { |
lcd_upd(val); |
set_led(val++); |
delay1s(); |
/* |
led_on(); |
delay1s(); |
led_off(); |
delay1s(); |
*/ |
} |
} |
|
|
/comp/pbcc/pbccv2-bin-win32-cygwin-2011-10-24/tests/pblaze/funargs.psm
0,0 → 1,60
;-------------------------------------------------------- |
; File Created by SDCC : free open source ANSI-C Compiler |
; Version 3.0.1 #6227 (Oct 24 2011) (CYGWIN) |
; This file was generated Mon Nov 28 08:43:45 2011 |
;-------------------------------------------------------- |
;-------------------------------------------------------- |
; global & static initialisations |
;-------------------------------------------------------- |
|
LOAD sF, 3f |
JUMP __sdcc_program_startup |
;-------------------------------------------------------- |
; Home |
;-------------------------------------------------------- |
__sdcc_program_startup: |
CALL _main |
; return from main will lock up |
__sdcc_loop: |
JUMP __sdcc_loop |
;-------------------------------------------------------- |
; code |
;-------------------------------------------------------- |
; funargs.c:1: char f(char arg, char arg2) |
_f: |
LOAD s0, sB |
LOAD s1, sC |
; funargs.c:3: return arg+arg2; |
ADD s0, s1 |
LOAD sB, s0 |
RETURN |
; funargs.c:7: void main() |
_main: |
; funargs.c:9: char i = 0; |
LOAD s0, 00 |
_L00103: |
; funargs.c:10: for(; i < 10; i++) |
TEST s0, 80 |
JUMP C, _LC00111 |
COMPARE s0, 0a |
JUMP C, _LC00111 |
JUMP _L00107 |
_LC00111: |
; funargs.c:12: i++; |
ADD s0, 01 |
; funargs.c:13: f(i, 17); |
STORE s0, (sF) |
SUB sF, 01 |
LOAD sB, s0 |
LOAD sC, 11 |
CALL _f |
ADD sF, 01 |
FETCH s0, (sF) |
; funargs.c:10: for(; i < 10; i++) |
ADD s0, 01 |
JUMP _L00103 |
_L00107: |
RETURN |
;-------------------------------------------------------- |
; interrupt vector |
;-------------------------------------------------------- |
/comp/pbcc/pbccv2-bin-win32-cygwin-2011-10-24/tests/pblaze/build.bat
0,0 → 1,8
@REM Compile-only (no assembling and linking) |
..\..\bin\sdcc.exe %1 -mpblaze -S -I"..\..\device\include\pblaze" |
|
@REM Compile and assemble only (no linking) |
@REM ..\..\bin\sdcc.exe %1 -mpblaze -c -I"..\..\device\include\pblaze" |
|
@REM Compile, assemble and link |
@REM ..\..\bin\sdcc.exe %1 -mpblaze -I"..\..\device\include\pblaze" |
/comp/pbcc/pbccv2-bin-win32-cygwin-2011-10-24/tests/pblaze/demo.c
0,0 → 1,42
//#include <stdio.h> |
|
void __port_write(char port, char arg) { } |
char __port_read(char port) { } |
void __nop() { } |
|
#define LCD_wr(arg) __port_write(0x01, (arg)) |
#define LCD_rd() __port_read(0x01) |
#define LCD_busy() (LCD_rd() & 0x80) == 0x80 |
|
void delay_ms(int ms) |
{ |
int i; |
for (;;) { |
for (i=0; i < 10000; i++) __nop(); |
} |
} |
|
void LCD_init() |
{ |
LCD_wr(0x42); |
while (LCD_rd()) { __nop();} |
LCD_wr(0x43); |
delay_ms(10); |
LCD_wr(0x44); |
LCD_wr(0x45); |
} |
|
void LCD_write(char ch) |
{ |
LCD_wr(0x46); |
LCD_wr(0x47); |
} |
|
int main(void) { |
char ch = 0x31; |
LCD_init(); |
while (1) { |
LCD_write(ch); |
delay_ms(1000); |
} |
} |
/comp/pbcc/pbccv2-bin-win32-cygwin-2011-10-24/tests/pblaze/test10.psm
0,0 → 1,221
;-------------------------------------------------------- |
; File Created by SDCC : free open source ANSI-C Compiler |
; Version 3.0.1 #6227 (Oct 24 2011) (CYGWIN) |
; This file was generated Sun Nov 27 22:31:09 2011 |
;-------------------------------------------------------- |
;-------------------------------------------------------- |
; global & static initialisations |
;-------------------------------------------------------- |
CONSTANT _numbers_19, 00 |
CONSTANT _numbers_18, 01 |
CONSTANT _numbers_17, 02 |
CONSTANT _numbers_16, 03 |
CONSTANT _numbers_15, 04 |
CONSTANT _numbers_14, 05 |
CONSTANT _numbers_13, 06 |
CONSTANT _numbers_12, 07 |
CONSTANT _numbers_11, 08 |
CONSTANT _numbers_10, 09 |
CONSTANT _numbers_9, 0a |
CONSTANT _numbers_8, 0b |
CONSTANT _numbers_7, 0c |
CONSTANT _numbers_6, 0d |
CONSTANT _numbers_5, 0e |
CONSTANT _numbers_4, 0f |
CONSTANT _numbers_3, 10 |
CONSTANT _numbers_2, 11 |
CONSTANT _numbers_1, 12 |
CONSTANT _numbers_0, 13 |
|
; test10.c:5: volatile short numbers[ARRAY_SIZE] = {9,8,7,6,5,4,3,2,1,0}; |
LOAD s0, _numbers_19 |
LOAD s1, 00 |
STORE s1, (s0) |
ADD s0, 01 |
LOAD s1, 09 |
STORE s1, (s0) |
LOAD s0, _numbers_19 |
ADD s0, 02 |
LOAD s1, 00 |
STORE s1, (s0) |
ADD s0, 01 |
LOAD s1, 08 |
STORE s1, (s0) |
LOAD s0, _numbers_19 |
ADD s0, 04 |
LOAD s1, 00 |
STORE s1, (s0) |
ADD s0, 01 |
LOAD s1, 07 |
STORE s1, (s0) |
LOAD s0, _numbers_19 |
ADD s0, 06 |
LOAD s1, 00 |
STORE s1, (s0) |
ADD s0, 01 |
LOAD s1, 06 |
STORE s1, (s0) |
LOAD s0, _numbers_19 |
ADD s0, 08 |
LOAD s1, 00 |
STORE s1, (s0) |
ADD s0, 01 |
LOAD s1, 05 |
STORE s1, (s0) |
LOAD s0, _numbers_19 |
ADD s0, 0a |
LOAD s1, 00 |
STORE s1, (s0) |
ADD s0, 01 |
LOAD s1, 04 |
STORE s1, (s0) |
LOAD s0, _numbers_19 |
ADD s0, 0c |
LOAD s1, 00 |
STORE s1, (s0) |
ADD s0, 01 |
LOAD s1, 03 |
STORE s1, (s0) |
LOAD s0, _numbers_19 |
ADD s0, 0e |
LOAD s1, 00 |
STORE s1, (s0) |
ADD s0, 01 |
LOAD s1, 02 |
STORE s1, (s0) |
LOAD s0, _numbers_19 |
ADD s0, 10 |
LOAD s1, 00 |
STORE s1, (s0) |
ADD s0, 01 |
LOAD s1, 01 |
STORE s1, (s0) |
LOAD s0, _numbers_19 |
ADD s0, 12 |
LOAD s1, 00 |
STORE s1, (s0) |
ADD s0, 01 |
LOAD s1, 00 |
STORE s1, (s0) |
LOAD sF, 3f |
JUMP __sdcc_program_startup |
;-------------------------------------------------------- |
; Home |
;-------------------------------------------------------- |
__sdcc_program_startup: |
CALL _main |
; return from main will lock up |
__sdcc_loop: |
JUMP __sdcc_loop |
;-------------------------------------------------------- |
; code |
;-------------------------------------------------------- |
; test10.c:7: void main() |
_main: |
; test10.c:11: for (i = (ARRAY_SIZE - 1); i > 0; i--) |
LOAD s0, 09 |
LOAD s1, 00 |
_L00107: |
TEST s1, 80 |
JUMP C, _L00119 |
LOAD s2, 00 |
COMPARE s2, s1 |
JUMP C, _LC00120 |
LOAD s2, 00 |
COMPARE s2, s0 |
JUMP C, _LC00120 |
JUMP _L00119 |
_LC00120: |
; test10.c:13: for (j = 1; j <= i; j++) |
LOAD s2, 01 |
LOAD s3, 00 |
_L00103: |
LOAD s4, s1 |
XOR s4, s3 |
AND s4, 80 |
JUMP Z, _LC00122 |
TEST s1, 80 |
JUMP C, _L00118 |
JUMP _LC00121 |
_LC00122: |
COMPARE s1, s3 |
JUMP C, _L00118 |
COMPARE s0, s2 |
JUMP C, _L00118 |
_LC00121: |
; test10.c:15: if (numbers[j-1] > numbers[j]) |
LOAD s4, _numbers_19 |
LOAD s5, s2 |
SUB s5, 01 |
SL0 s5 |
ADD s4, s5 |
FETCH s6, (s4) |
ADD s4, 01 |
FETCH s7, (s4) |
LOAD s4, _numbers_19 |
LOAD s8, s2 |
LOAD s9, s3 |
SL0 s8 |
SLA s9 |
ADD s4, s8 |
FETCH sA, (s4) |
ADD s4, 01 |
STORE s8, 14 |
FETCH s8, (s4) |
LOAD s4, sA |
XOR s4, s6 |
AND s4, 80 |
JUMP Z, _LC00124 |
TEST sA, 80 |
JUMP NC, _L00105 |
JUMP _LC00123 |
_LC00124: |
COMPARE sA, s6 |
JUMP C, _LC00123 |
COMPARE s8, s7 |
JUMP C, _LC00123 |
JUMP _L00105 |
_LC00123: |
; test10.c:17: temp = numbers[j-1]; |
LOAD s4, _numbers_19 |
ADD s4, s5 |
FETCH s6, (s4) |
ADD s4, 01 |
FETCH s7, (s4) |
LOAD s4, s7 |
LOAD s8, s6 |
; test10.c:18: numbers[j-1] = numbers[j]; |
LOAD s6, _numbers_19 |
ADD s6, s5 |
LOAD s5, _numbers_19 |
FETCH s7, 14 |
ADD s5, s7 |
FETCH sA, (s5) |
ADD s5, 01 |
STORE s4, 14 |
FETCH s4, (s5) |
STORE sA, (s6) |
ADD s6, 01 |
STORE s4, (s6) |
; test10.c:19: numbers[j] = temp; |
LOAD s4, _numbers_19 |
ADD s4, s7 |
STORE s8, (s4) |
ADD s4, 01 |
FETCH s5, 14 |
STORE s5, (s4) |
_L00105: |
; test10.c:13: for (j = 1; j <= i; j++) |
ADD s2, 01 |
ADDCY s3, 00 |
JUMP _L00103 |
_L00118: |
; test10.c:11: for (i = (ARRAY_SIZE - 1); i > 0; i--) |
SUB s0, 01 |
SUBCY s1, 00 |
JUMP _L00107 |
_L00119: |
RETURN |
;-------------------------------------------------------- |
; interrupt vector |
;-------------------------------------------------------- |
/comp/pbcc/pbccv2-bin-win32-cygwin-2011-10-24/tests/pblaze/asm.psm
0,0 → 1,40
;-------------------------------------------------------- |
; File Created by SDCC : free open source ANSI-C Compiler |
; Version 3.0.1 #6227 (Oct 24 2011) (CYGWIN) |
; This file was generated Sun Nov 27 22:27:30 2011 |
;-------------------------------------------------------- |
;-------------------------------------------------------- |
; global & static initialisations |
;-------------------------------------------------------- |
CONSTANT _i_1, 00 |
CONSTANT _i_0, 01 |
|
LOAD sF, 3f |
JUMP __sdcc_program_startup |
;-------------------------------------------------------- |
; Home |
;-------------------------------------------------------- |
__sdcc_program_startup: |
CALL _main |
; return from main will lock up |
__sdcc_loop: |
JUMP __sdcc_loop |
;-------------------------------------------------------- |
; code |
;-------------------------------------------------------- |
; asm.c:10: int main(void) |
_main: |
; asm.c:14: __endasm; |
INPUT s0 |
; asm.c:15: i = 10; |
LOAD s0, 0a |
LOAD s1, 00 |
; asm.c:16: return i; |
LOAD sC, 00 |
LOAD sB, 0a |
STORE s1, _i_1 |
STORE s0, _i_0 |
RETURN |
;-------------------------------------------------------- |
; interrupt vector |
;-------------------------------------------------------- |
/comp/pbcc/pbccv2-bin-win32-cygwin-2011-10-24/tests/pblaze/funstruct.c
0,0 → 1,31
struct s { |
int a; |
char b; |
} struktura; |
|
int sum(char nnn1, short n2, int n3) |
{ |
return (int)nnn1 + n2 + n3; |
} |
|
void main() |
{ |
char c = 29; |
short d = 57; |
int e = 113; |
|
|
if (sum(1, 2, 3) > 5) |
{ |
sum(2, 3, c + d); |
return; |
} |
else |
{ |
struktura.a = 99; |
} |
struktura.a = 2*e; |
struktura.b = c; |
sum (struktura.b, d, e); |
|
} |