![]() |
C compiler
Посоветуйте, плз, сабж под Спекки. Ничего, кроме Hisoft C, в голову не приходит
|
Quote:
|
Quote:
|
Quote:
SDCC (Small Device C Compiler) is a Freeware, retargettable, optimizing ANSI-C compiler by Sandeep Dutta designed for 8 bit Microprocessors. The current version targets Intel MCS51 based Microprocessors (8031, 8032, 8051, 8052, etc.), Dallas DS80C390 variants, Motorola HC08 and Zilog Z80 based MCUs. It can be retargetted for other microprocessors, support for Microchip PIC, Atmel AVR is under development. The entire source code for the compiler is distributed under GPL. SDCC uses ASXXXX & ASLINK, a Freeware, retargettable assembler & linker. SDCC has extensive language extensions suitable for utilizing various microcontrollers and underlying hardware effectively. In addition to the MCU specific optimizations SDCC also does a host of standard optimizations like: global sub expression elimination, loop optimizations (loop invariant, strength reduction of induction variables and loop reversing), constant folding & propagation, copy propagation, dead code elimination jump tables for switch statements. For the back-end SDCC uses a global register allocation scheme which should be well suited for other 8 bit MCUs. The peep hole optimizer uses a rule based substitution mechanism which is MCU independent. Supported data-types are: char (8 bits, 1 byte), short and int (16 bits, 2 bytes), long (32 bit, 4 bytes) float (4 byte IEEE). The compiler also allows inline assembler code to be embedded anywhere in a function. In addition, routines developed in assembly can also be called. SDCC also provides an option (--cyclomatic) to report the relative complexity of a function. These functions can then be further optimized, or hand coded in assembly if needed. SDCC also comes with a companion source level debugger SDCDB, the debugger currently uses ucSim a freeware simulator for 8051 and other micro-controllers. The latest version can be downloaded from http://sdcc.sourceforge.net/snap.php. |
1 Attachment(s)
Quote:
#include "chars.h" int main() { unsigned char i,j,k,m; m=1; i=1; while (1) { //_cls_c(); ++i; for(j=0;j<23;j++) { for(k=0;k<5;k++) { _set_pos_c(k,j);//x,y _set_attr_c(i++); _prn_str_c(" !!ZX Spectrum - FOREVER!! "); j++; } } } return 0; } компилируется вот во что: ;-------------------------------------------------------- ; File Created by SDCC : FreeWare ANSI-C Compiler ; Version 2.4.0 Fri Apr 15 13:59:27 2005 ;-------------------------------------------------------- .module main .optsdcc -mz80 ;-------------------------------------------------------- ; Public variables in this module ;-------------------------------------------------------- .globl _main ;-------------------------------------------------------- ; special function registers ;-------------------------------------------------------- ;-------------------------------------------------------- ; ram data ;-------------------------------------------------------- .area _DATA ;-------------------------------------------------------- ; overlayable items in ram ;-------------------------------------------------------- .area _OVERLAY ;-------------------------------------------------------- ; external initialized ram data ;-------------------------------------------------------- ;-------------------------------------------------------- ; global & static initialisations ;-------------------------------------------------------- .area _GSINIT .area _GSFINAL .area _GSINIT ;-------------------------------------------------------- ; Home ;-------------------------------------------------------- .area _HOME .area _CODE ;-------------------------------------------------------- ; code ;-------------------------------------------------------- .area _CODE ;main.c:3: int main() ; genLabel ; genFunction ; --------------------------------- ; Function main ; --------------------------------- _main_start:: _main: push ix ld ix,#0 add ix,sp ld hl,#-1 add hl,sp ld sp,hl ;main.c:8: i=1; ; genAssign ld c,#0x01 ;main.c:9: while (1) ; genLabel 00102$: ;main.c:12: ++i; ; genPlus ; genPlusIncr ; Removed redundent load inc c ;main.c:13: for(j=0;j<23;j++) ; genAssign ld b,#0x00 ; genLabel 00108$: ; genCmpLt ld a,b sub a,#0x17 jp nc,00102$ ;main.c:15: for(k=0;k<5;k++) ; genAssign ld e,c ; genAssign ; (registers are the same) ; genAssign ; AOP_STK for _main_k_1_1 ld -1(ix),#0x00 ; genLabel 00104$: ; genCmpLt ; AOP_STK for _main_k_1_1 ld a,-1(ix) sub a,#0x05 ld a,#0x00 rla ld d,a ; genAssign ld c,e ; genIfx xor a,a or a,d jp z,00110$ ;main.c:17: _set_pos_c(k,j);//x,y ; genIpush ; _saveRegsForCall: sendSetSize: 0 deInUse: 1 bcInUse: 1 deSending: 0 push bc push de push bc inc sp ; genIpush ; AOP_STK for _main_k_1_1 ld a,-1(ix) push af inc sp ; genCall call __set_pos_c pop af pop de pop bc ;main.c:18: _set_attr_c(i++); ; genAssign ld d,e ; genPlus ; genPlusIncr ; Removed redundent load inc e ; genIpush ; _saveRegsForCall: sendSetSize: 0 deInUse: 1 bcInUse: 1 deSending: 0 push bc push de push de inc sp ; genCall call __set_attr_c inc sp pop de pop bc ;main.c:19: _prn_str_c(" !!ZX Spectrum - FOREVER!! "); ; genIpush ; _saveRegsForCall: sendSetSize: 0 deInUse: 1 bcInUse: 1 deSending: 0 push bc push de ld hl,#__str_0 push hl ; genCall call __prn_str_c pop af pop de pop bc ;main.c:20: j++; ; genPlus ; genPlusIncr ; Removed redundent load inc b ;main.c:15: for(k=0;k<5;k++) ; genPlus ; AOP_STK for _main_k_1_1 ; genPlusIncr inc -1(ix) ; genGoto jp 00104$ ; genLabel 00110$: ;main.c:13: for(j=0;j<23;j++) ; genPlus ; genPlusIncr ; Removed redundent load inc b ; genGoto jp 00108$ ;main.c:24: return 0; ; genLabel 00112$: ; genEndFunction ld sp,ix pop ix ret _main_end:: __str_0: .ascii " !!ZX Spectrum - FOREVER!! " .db 0x00 .area _CODE и после линковки оно даже работает :) (см.вложение) |
Quote:
|
Quote:
Quote:
Насчет кросс-компиляции вот лично у меня эдакий морально-этический :) вопрос: Кросс-компилятор будучи практически эмулятором, и даже более.... Должны ли использовать его настоящие спектрумисты. Это ведь практически таже надувная женщина! :) |
Quote:
|
Quote:
|
Quote:
отквотить чужую фразу так, что смысл меняется на противоположный - был кросс Ц-компилятор - надувная женсчина, стал бейсик :) И вообще, чего ты к Бейсику то докопался, "настоящие спектрумисты" пишут сразу в исполняемом коде, и вся эта ассемблерно-сишная мутотень им вообще никчему! :) |
| All times are GMT +4. The time now is 21:13. |
Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.